<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>change_log.txt</filename>
    </added>
    <added>
      <filename>wordpress/wp-content/plugins/wordpress-automatic-upgrade/lib/ftp_class_pure.php</filename>
    </added>
    <added>
      <filename>wordpress/wp-content/plugins/wordpress-automatic-upgrade/lib/ftp_class_sockets.php</filename>
    </added>
    <added>
      <filename>wordpress/wp-content/plugins/wordpress-automatic-upgrade/lib/pclzip.lib.php</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,8 +1,7 @@
-
-#posting {
- 	position: static !important;
-}
- .ui-tabs-nav {
- 	margin-left: 0;
- 	border: 0 !important;
-}
+#posting {
+ 	position: static !important;
+}
+ .ui-tabs-nav {
+ 	margin-left: 0;
+ 	border: 0 !important;
+}</diff>
      <filename>wordpress/wp-admin/css/press-this-ie.css</filename>
    </modified>
    <modified>
      <diff>@@ -333,7 +333,7 @@ class Textpattern_Import {
 				$category1 = get_category_by_slug($Category1);
 				$category1 = $category1-&gt;term_id;
 				$category2 = get_category_by_slug($Category2);
-				$category2 = $category1-&gt;term_id;
+				$category2 = $category2-&gt;term_id;
 				if($cat1 = $category1) { $cats[1] = $cat1; }
 				if($cat2 = $category2) { $cats[2] = $cat2; }
 </diff>
      <filename>wordpress/wp-admin/import/textpattern.php</filename>
    </modified>
    <modified>
      <diff>@@ -219,17 +219,17 @@ function wp_read_image_metadata( $file ) {
 		if ( !empty($info['APP13']) ) {
 			$iptc = iptcparse($info['APP13']);
 			if ( !empty($iptc['2#110'][0]) ) // credit
-				$meta['credit'] = trim( $iptc['2#110'][0] );
+				$meta['credit'] = utf8_encode(trim($iptc['2#110'][0]));
 			elseif ( !empty($iptc['2#080'][0]) ) // byline
-				$meta['credit'] = trim( $iptc['2#080'][0] );
+				$meta['credit'] = utf8_encode(trim($iptc['2#080'][0]));
 			if ( !empty($iptc['2#055'][0]) and !empty($iptc['2#060'][0]) ) // created datee and time
 				$meta['created_timestamp'] = strtotime($iptc['2#055'][0] . ' ' . $iptc['2#060'][0]);
 			if ( !empty($iptc['2#120'][0]) ) // caption
-				$meta['caption'] = trim( $iptc['2#120'][0] );
+				$meta['caption'] = utf8_encode(trim($iptc['2#120'][0]));
 			if ( !empty($iptc['2#116'][0]) ) // copyright
-				$meta['copyright'] = trim( $iptc['2#116'][0] );
+				$meta['copyright'] = utf8_encode(trim($iptc['2#116'][0]));
 			if ( !empty($iptc['2#005'][0]) ) // title
-				$meta['title'] = trim( $iptc['2#005'][0] );
+				$meta['title'] = utf8_encode(trim($iptc['2#005'][0]));
 		 }
 	}
 </diff>
      <filename>wordpress/wp-admin/includes/image.php</filename>
    </modified>
    <modified>
      <diff>@@ -715,7 +715,7 @@ function _wp_get_comment_list( $status = '', $s = false, $start, $num ) {
 			$approved
 			ORDER BY comment_date_gmt DESC LIMIT $start, $num&quot;);
 	} else {
-		$comments = $wpdb-&gt;get_results( &quot;SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb-&gt;comments USE INDEX (comment_date_gmt) WHERE $approved ORDER BY comment_date_gmt DESC LIMIT $start, $num&quot; );
+		$comments = $wpdb-&gt;get_results( &quot;SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb-&gt;comments WHERE $approved ORDER BY comment_date_gmt DESC LIMIT $start, $num&quot; );
 	}
 
 	update_comment_cache($comments);</diff>
      <filename>wordpress/wp-admin/includes/template.php</filename>
    </modified>
    <modified>
      <diff>@@ -3,9 +3,9 @@
 Plugin Name: Akismet
 Plugin URI: http://akismet.com/
 Description: Akismet checks your comments against the Akismet web service to see if they look like spam or not. You need a &lt;a href=&quot;http://wordpress.com/api-keys/&quot;&gt;WordPress.com API key&lt;/a&gt; to use it. You can review the spam it catches under &quot;Comments.&quot; To show off your Akismet stats just put &lt;code&gt;&amp;lt;?php akismet_counter(); ?&gt;&lt;/code&gt; in your template. See also: &lt;a href=&quot;http://wordpress.org/extend/plugins/stats/&quot;&gt;WP Stats plugin&lt;/a&gt;.
-Version: 2.1.6
+Version: 2.1.8
 Author: Matt Mullenweg
-Author URI: http://photomatt.net/
+Author URI: http://ma.tt/
 */
 
 // If you hardcode a WP.com API key here, all key config screens will be hidden
@@ -327,7 +327,12 @@ function akismet_spam_totals() {
 }
 
 function akismet_manage_page() {
-	global $wpdb, $submenu;
+	global $wpdb, $submenu, $wp_db_version;
+
+	// WP 2.7 has its own spam management page
+	if ( 8645 &lt;= $wp_db_version )
+		return;
+
 	$count = sprintf(__('Akismet Spam (%s)'), akismet_spam_count());
 	if ( isset( $submenu['edit-comments.php'] ) )
 		add_submenu_page('edit-comments.php', __('Akismet Spam'), $count, 'moderate_comments', 'akismet-admin', 'akismet_caught' );
@@ -337,6 +342,7 @@ function akismet_manage_page() {
 
 function akismet_caught() {
 	global $wpdb, $comment, $akismet_caught, $akismet_nonce;
+
 	akismet_recheck_queue();
 	if (isset($_POST['submit']) &amp;&amp; 'recover' == $_POST['action'] &amp;&amp; ! empty($_POST['not_spam'])) {
 		check_admin_referer( $akismet_nonce );
@@ -708,18 +714,22 @@ if ( 'moderation.php' == $pagenow ) {
 function akismet_check_for_spam_button($comment_status) {
 	if ( 'approved' == $comment_status )
 		return;
-	echo &quot;&lt;/div&gt;&lt;div class='alignleft'&gt;&lt;a class='button-secondary checkforspam' href='edit-comments.php?page=akismet-admin&amp;amp;recheckqueue=true&amp;amp;noheader=true'&gt;&quot; . __('Check for Spam') . &quot;&lt;/a&gt;&quot;;
+	if ( function_exists('plugins_url') )
+		$link = 'admin.php?action=akismet_recheck_queue';
+	else
+		$link = 'edit-comments.php?page=akismet-admin&amp;amp;recheckqueue=true&amp;amp;noheader=true';
+	echo &quot;&lt;/div&gt;&lt;div class='alignleft'&gt;&lt;a class='button-secondary checkforspam' href='$link'&gt;&quot; . __('Check for Spam') . &quot;&lt;/a&gt;&quot;;
 }
 add_action('manage_comments_nav', 'akismet_check_for_spam_button');
 
 function akismet_recheck_queue() {
 	global $wpdb, $akismet_api_host, $akismet_api_port;
 
-	if ( !isset( $_GET['recheckqueue'] ) )
+	if ( ! ( isset( $_GET['recheckqueue'] ) || ( isset( $_REQUEST['action'] ) &amp;&amp; 'akismet_recheck_queue' == $_REQUEST['action'] ) ) )
 		return;
 
 	$moderation = $wpdb-&gt;get_results( &quot;SELECT * FROM $wpdb-&gt;comments WHERE comment_approved = '0'&quot;, ARRAY_A );
-	foreach ( $moderation as $c ) {
+	foreach ( (array) $moderation as $c ) {
 		$c['user_ip']    = $c['comment_author_IP'];
 		$c['user_agent'] = $c['comment_agent'];
 		$c['referrer']   = '';
@@ -739,6 +749,8 @@ function akismet_recheck_queue() {
 	exit;
 }
 
+add_action('admin_action_akismet_recheck_queue', 'akismet_recheck_queue');
+
 function akismet_check_db_comment( $id ) {
 	global $wpdb, $akismet_api_host, $akismet_api_port;
 </diff>
      <filename>wordpress/wp-content/plugins/akismet/akismet.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,252 +1,252 @@
-&lt;?php
-/*WP Ajax Edit Script
---Created by Ronald Huereca/Keith Dsouza
---Created on: 07/14/2007
---Last modified on: 07/14/2007
---Relies on jQuery
-*/
-	require_once(&quot;../../../../wp-config.php&quot;);
-?&gt;
-jQuery(document).ready(function(){
-   wpauAutomaticUpgrade.init();
-
-});
-var wpauAutomaticUpgrade = function() {
-	var $j = jQuery;
-	var PluginUrl = &quot;&lt;?php bloginfo('wpurl') ?&gt;/wp-content/plugins/wordpress-automatic-upgrade&quot;;
-	var BackupUrl = &quot;&lt;?php bloginfo('wpurl') ?&gt;/wpau-backup/&quot;;
-	var FileBakName = &quot;wpau-files-bak.zip&quot;;
-	var DbBakName = &quot;wpau-db-backup.zip&quot;;
-	var statusBar = $j(&quot;#wpau-status-bar&quot;);
-	var statusMessage = $j(&quot;#wpau-status-message&quot;);
-	var status = 0;
-
-	function linkSetup() {
-		$j(&quot;#wpau-automated&quot;).bind(&quot;click&quot;, function() { step1(); return false; });
-	}
-	//Number to set the status bar to (0-100)
-	function setStatus(number) {
-		$j(&quot;#wpau-status-bar&quot;).css({height: &quot;10px&quot;, border: &quot;1px solid #000&quot;, width: &quot;70%&quot;});
-		$j(&quot;#wpau-status-bar-indicator&quot;).css({float: &quot;left&quot;, height: &quot;100%&quot;, background: &quot;#191970&quot;, width: number + &quot;%&quot;});
-	}
-	function setStatusBar(msg) {
-		$j(&quot;#wpau-status-message&quot;).html(&quot;&lt;p&gt;&quot; + msg + &quot;&lt;/p&gt;&quot;);
-	}
-
-	function setFileDownload() {
-		//$j(&quot;#wpau-file-download&quot;).html(&quot;&lt;p&gt;&lt;a href='&quot; + BackupUrl + FileBakName + &quot;'&gt;DOWNLOAD&lt;/a&gt; Backup files.&lt;/p&gt;&quot;);
-	}
-
-	function showUpgradeLink() {
-		//$j(&quot;#wpau-update-db&quot;).html(&quot;&lt;p&gt;Please do not forget to &lt;a href='&lt;?php bloginfo('wpurl') ?&gt;/wp-admin/upgrade.php' target='_blank'&gt;UPGRADE Wordpress DB&lt;/a&gt;&lt;/p&gt;&quot;);
-	}
-
-	function setDbDownload() {
-		//$j(&quot;#wpau-db-download&quot;).html(&quot;&lt;p&gt;&lt;a href='&quot; + BackupUrl + DbBakName + &quot;'&gt;DOWNLOAD&lt;/a&gt; Database backup&lt;/p&gt;&quot;);
-	}
-
-	function step1() {
-		msg = &quot;&lt;strong&gt;Current Step&lt;/strong&gt; -&gt; Backing up your original wordpress files&quot;;
-		setStatusBar(msg);
-		setStatus(0);
-		$j.ajax({
-			type: &quot;post&quot;,
-			url: PluginUrl + '/js/wp-wpau.php',
-			timeout: 30000,
-			data: {
-				task: 1},
-			success: function(msg) { step1Complete(msg); },
-			error: function(msg) { step1Failure(msg); }
-		})
-	}
-
-	function step1Complete(msg) { //WordPress files backup
-		if (msg == &quot;true&quot;) {
-			msg = &quot;Backed up your WordPress files. &lt;br /&gt;&lt;strong&gt;Current Step&lt;/strong&gt; -&gt; Backing up your database files&quot;;
-			setStatusBar(msg);
-			setStatus(10);
-			$j.ajax({
-			type: &quot;post&quot;,
-			url: PluginUrl + '/js/wp-wpau.php',
-			timeout: 30000,
-			data: {
-				task: 2},
-			success: function(msg) { step2Complete(msg); },
-			error: function(msg) { step2Failure(msg); }
-		})
-		} else {
-			msg = &quot;Could not backup your WordPress files.  Failed at Step 1.&quot;;
-			setStatusBar(msg);
-		}
-	}
-	function step1Failure(msg) {
-		alert(&quot;Step 1 Failed&quot;);
-	}
-	function step2Complete(msg) { //database backup
-		if (msg == &quot;true&quot;) {
-			msg = &quot;The database has been succesfully backed up. &lt;br /&gt;&lt;strong&gt;Current Step&lt;/strong&gt; -&gt; Downloading the WP Latest Install.  Please be patient as this process may take between 15 - 300 seconds.&quot;;
-			setFileDownload();
-			setStatusBar(msg);
-			setStatus(20);
-			$j.ajax({
-			type: &quot;post&quot;,
-			url: PluginUrl + '/js/wp-wpau.php',
-			timeout: 300000,
-			data: {
-				task: 3},
-			success: function(msg) { step3Complete(msg); },
-			error: function(msg) { step3Failure(msg); }
-		});
-			//setStatusBar(&quot;&quot;);
-		} else {
-			msg = &quot;Database files could not be backed up.  Failed at Step 2.&quot;;
-			setStatusBar(msg);
-		}
-	}
-
-	function step2Failure(msg) {
-		alert(&quot;Step 2 Failed&quot;);
-	}
-	function step3Complete(msg) { //wp download
-		if (msg == &quot;true&quot;) {
-			msg = &quot;Successfully downloaded and unzipped all WordPress files. &lt;br /&gt;&lt;strong&gt;Current Step&lt;/strong&gt; -&gt; De-activating all your plugins&quot;;
-			setDbDownload();
-			setStatusBar(msg);
-			setStatus(30);
-			$j.ajax({
-			type: &quot;post&quot;,
-			url: PluginUrl + '/js/wp-wpau.php',
-			timeout: 15000,
-			data: {
-				task: 4},
-			success: function(msg) { step4Complete(msg); },
-			error: function(msg) { step4Failure(msg); }
-		})
-		} else {
-			msg = &quot;Could not successfully get the latest WordPress installation.  Failed at Step 3.&quot;;
-			setStatusBar(msg);
-		}
-	}
-
-	function step3Failure(msg) {
-		alert(&quot;Step 3 Failed&quot;);
-	}
-	function step4Complete(msg) { //WordPress plugin deactivation
-		if (msg == &quot;true&quot;) {
-			msg = &quot;Successfully deactivated your plugins. &lt;br /&gt;&lt;strong&gt;Current Step&lt;/strong&gt; -&gt; Putting the site into maintenance mode.&quot;;
-			setStatusBar(msg);
-		} else {
-			msg = &quot;Could not deactivate your plugins.  Failed at Step 4..&quot;;
-			setStatusBar(msg);
-		}
-		setStatus(40);
-		$j.ajax({
-			type: &quot;post&quot;,
-			url: PluginUrl + '/js/wp-wpau.php',
-			timeout: 15000,
-			data: {
-				task: 5},
-			success: function(msg) { step5Complete(msg); },
-			error: function(msg) { step5Failure(msg); }
-		})
-	}
-
-	function step4Failure(msg) {
-		alert(&quot;Step 4 Failed&quot;);
-	}
-	function step5Complete(msg) { //wp maintenance mode
-		if (msg == &quot;true&quot;) {
-			msg = &quot;Successfully activated maintenance mode for your site. &lt;br /&gt;&lt;strong&gt;Current Step&lt;/strong&gt; -&gt; Upgrading your installation files.&quot;;
-			setStatusBar(msg);
-			setStatus(50);
-			$j.ajax({
-			type: &quot;post&quot;,
-			url: PluginUrl + '/js/wp-wpau.php',
-			timeout: 300000,
-			data: {
-				task: 6},
-			success: function(msg) { step6Complete(msg); },
-			error: function(msg) { step6Failure(msg); }
-		})
-		} else {
-			msg = &quot;Could not initiate maintenance mode.&quot;;
-			setStatusBar(msg);
-		}
-	}
-
-	function step5Failure(msg) {
-		alert(&quot;Step 5 Failed&quot;);
-	}
-	
-	function step6Complete(msg) { //Upgrading Your files
-		if (msg == &quot;true&quot;) {
-			msg = &quot;Upgraded Your Files. &lt;br /&gt;&lt;strong&gt;Current Step&lt;/strong&gt; -&gt; Reactivate all your plugins&quot;;
-			showUpgradeLink();
-			setStatusBar(msg);
-			setStatus(80);
-			$j.ajax({
-			type: &quot;post&quot;,
-			url: PluginUrl + '/js/wp-wpau.php',
-			timeout: 180000,
-			data: {
-				task: 7},
-			success: function(msg) { step7Complete(msg); },
-			error: function(msg) { step7Failure(msg); }
-		})
-		} else {
-			msg = &quot;Could not upgrade your files.&quot;;
-			setStatusBar(msg);
-		}
-	}
-
-	function step6Failure(msg) {
-		alert(&quot;Step 6 Failed&quot;);
-	}
-
-		function step7Complete(msg) { //Show Log
-			setStatusBar(msg);
-			setStatus(100);
-		}
-	
-		function step7Failure(msg) {
-			alert(&quot;Step 8 Failed&quot;);
-		}
-	function step7oldComplete(msg) {
-		if (msg == &quot;true&quot;) {
-			msg = &quot;Successfully reactivated your plugins. &lt;br /&gt;&lt;strong&gt;Current Step&lt;/strong&gt; -&gt; Shows you upgradation logs.&quot;;
-			setStatusBar(msg);
-			setStatus(80);
-			$j.ajax({
-			type: &quot;post&quot;,
-			url: PluginUrl + '/js/wp-wpau.php',
-			timeout: 15000,
-			data: {
-				task: 8},
-			success: function(msg) { step8Complete(msg); },
-			error: function(msg) { step8Failure(msg); }
-		})
-		} else {
-			msg = &quot;Could not upgrade the database.&quot;;
-			setStatusBar(msg);
-		}
-	}
-
-	function step7Failure(msg) {
-		alert(&quot;Step 7 Failed&quot;);
-	}
-
-	function step8Complete(msg) { //Show Log
-		setStatusBar(msg);
-			setStatus(100);
-	}
-
-	function step8Failure(msg) {
-		alert(&quot;Step 9 Failed&quot;);
-	}
-	return {
-			init : function() { //AKA the constructor - Plugin authors can tap into the plugin by calling AjaxEditComments.init()
-				linkSetup();
-			}
-	};
-
+&lt;?php
+/*WP Ajax Edit Script
+--Created by Ronald Huereca/Keith Dsouza
+--Created on: 07/14/2007
+--Last modified on: 07/14/2007
+--Relies on jQuery
+*/
+	require_once(&quot;../../../../wp-config.php&quot;);
+?&gt;
+jQuery(document).ready(function(){
+   wpauAutomaticUpgrade.init();
+
+});
+var wpauAutomaticUpgrade = function() {
+	var $j = jQuery;
+	var PluginUrl = &quot;&lt;?php bloginfo('wpurl') ?&gt;/wp-content/plugins/wordpress-automatic-upgrade&quot;;
+	var BackupUrl = &quot;&lt;?php bloginfo('wpurl') ?&gt;/wpau-backup/&quot;;
+	var FileBakName = &quot;wpau-files-bak.zip&quot;;
+	var DbBakName = &quot;wpau-db-backup.zip&quot;;
+	var statusBar = $j(&quot;#wpau-status-bar&quot;);
+	var statusMessage = $j(&quot;#wpau-status-message&quot;);
+	var status = 0;
+
+	function linkSetup() {
+		$j(&quot;#wpau-automated&quot;).bind(&quot;click&quot;, function() { step1(); return false; });
+	}
+	//Number to set the status bar to (0-100)
+	function setStatus(number) {
+		$j(&quot;#wpau-status-bar&quot;).css({height: &quot;10px&quot;, border: &quot;1px solid #000&quot;, width: &quot;70%&quot;});
+		$j(&quot;#wpau-status-bar-indicator&quot;).css({float: &quot;left&quot;, height: &quot;100%&quot;, background: &quot;#191970&quot;, width: number + &quot;%&quot;});
+	}
+	function setStatusBar(msg) {
+		$j(&quot;#wpau-status-message&quot;).html(&quot;&lt;p&gt;&quot; + msg + &quot;&lt;/p&gt;&quot;);
+	}
+
+	function setFileDownload() {
+		//$j(&quot;#wpau-file-download&quot;).html(&quot;&lt;p&gt;&lt;a href='&quot; + BackupUrl + FileBakName + &quot;'&gt;DOWNLOAD&lt;/a&gt; Backup files.&lt;/p&gt;&quot;);
+	}
+
+	function showUpgradeLink() {
+		//$j(&quot;#wpau-update-db&quot;).html(&quot;&lt;p&gt;Please do not forget to &lt;a href='&lt;?php bloginfo('wpurl') ?&gt;/wp-admin/upgrade.php' target='_blank'&gt;UPGRADE Wordpress DB&lt;/a&gt;&lt;/p&gt;&quot;);
+	}
+
+	function setDbDownload() {
+		//$j(&quot;#wpau-db-download&quot;).html(&quot;&lt;p&gt;&lt;a href='&quot; + BackupUrl + DbBakName + &quot;'&gt;DOWNLOAD&lt;/a&gt; Database backup&lt;/p&gt;&quot;);
+	}
+
+	function step1() {
+		msg = &quot;&lt;strong&gt;Current Step&lt;/strong&gt; -&gt; Backing up your original wordpress files&quot;;
+		setStatusBar(msg);
+		setStatus(0);
+		$j.ajax({
+			type: &quot;post&quot;,
+			url: PluginUrl + '/js/wp-wpau.php',
+			timeout: 30000,
+			data: {
+				task: 1},
+			success: function(msg) { step1Complete(msg); },
+			error: function(msg) { step1Failure(msg); }
+		})
+	}
+
+	function step1Complete(msg) { //WordPress files backup
+		if (msg == &quot;true&quot;) {
+			msg = &quot;Backed up your WordPress files. &lt;br /&gt;&lt;strong&gt;Current Step&lt;/strong&gt; -&gt; Backing up your database files&quot;;
+			setStatusBar(msg);
+			setStatus(10);
+			$j.ajax({
+			type: &quot;post&quot;,
+			url: PluginUrl + '/js/wp-wpau.php',
+			timeout: 30000,
+			data: {
+				task: 2},
+			success: function(msg) { step2Complete(msg); },
+			error: function(msg) { step2Failure(msg); }
+		})
+		} else {
+			msg = &quot;Could not backup your WordPress files.  Failed at Step 1.&quot;;
+			setStatusBar(msg);
+		}
+	}
+	function step1Failure(msg) {
+		alert(&quot;Step 1 Failed&quot;);
+	}
+	function step2Complete(msg) { //database backup
+		if (msg == &quot;true&quot;) {
+			msg = &quot;The database has been succesfully backed up. &lt;br /&gt;&lt;strong&gt;Current Step&lt;/strong&gt; -&gt; Downloading the WP Latest Install.  Please be patient as this process may take between 15 - 300 seconds.&quot;;
+			setFileDownload();
+			setStatusBar(msg);
+			setStatus(20);
+			$j.ajax({
+			type: &quot;post&quot;,
+			url: PluginUrl + '/js/wp-wpau.php',
+			timeout: 300000,
+			data: {
+				task: 3},
+			success: function(msg) { step3Complete(msg); },
+			error: function(msg) { step3Failure(msg); }
+		});
+			//setStatusBar(&quot;&quot;);
+		} else {
+			msg = &quot;Database files could not be backed up.  Failed at Step 2.&quot;;
+			setStatusBar(msg);
+		}
+	}
+
+	function step2Failure(msg) {
+		alert(&quot;Step 2 Failed&quot;);
+	}
+	function step3Complete(msg) { //wp download
+		if (msg == &quot;true&quot;) {
+			msg = &quot;Successfully downloaded and unzipped all WordPress files. &lt;br /&gt;&lt;strong&gt;Current Step&lt;/strong&gt; -&gt; De-activating all your plugins&quot;;
+			setDbDownload();
+			setStatusBar(msg);
+			setStatus(30);
+			$j.ajax({
+			type: &quot;post&quot;,
+			url: PluginUrl + '/js/wp-wpau.php',
+			timeout: 15000,
+			data: {
+				task: 4},
+			success: function(msg) { step4Complete(msg); },
+			error: function(msg) { step4Failure(msg); }
+		})
+		} else {
+			msg = &quot;Could not successfully get the latest WordPress installation.  Failed at Step 3.&quot;;
+			setStatusBar(msg);
+		}
+	}
+
+	function step3Failure(msg) {
+		alert(&quot;Step 3 Failed&quot;);
+	}
+	function step4Complete(msg) { //WordPress plugin deactivation
+		if (msg == &quot;true&quot;) {
+			msg = &quot;Successfully deactivated your plugins. &lt;br /&gt;&lt;strong&gt;Current Step&lt;/strong&gt; -&gt; Putting the site into maintenance mode.&quot;;
+			setStatusBar(msg);
+		} else {
+			msg = &quot;Could not deactivate your plugins.  Failed at Step 4..&quot;;
+			setStatusBar(msg);
+		}
+		setStatus(40);
+		$j.ajax({
+			type: &quot;post&quot;,
+			url: PluginUrl + '/js/wp-wpau.php',
+			timeout: 15000,
+			data: {
+				task: 5},
+			success: function(msg) { step5Complete(msg); },
+			error: function(msg) { step5Failure(msg); }
+		})
+	}
+
+	function step4Failure(msg) {
+		alert(&quot;Step 4 Failed&quot;);
+	}
+	function step5Complete(msg) { //wp maintenance mode
+		if (msg == &quot;true&quot;) {
+			msg = &quot;Successfully activated maintenance mode for your site. &lt;br /&gt;&lt;strong&gt;Current Step&lt;/strong&gt; -&gt; Upgrading your installation files.&quot;;
+			setStatusBar(msg);
+			setStatus(50);
+			$j.ajax({
+			type: &quot;post&quot;,
+			url: PluginUrl + '/js/wp-wpau.php',
+			timeout: 300000,
+			data: {
+				task: 6},
+			success: function(msg) { step6Complete(msg); },
+			error: function(msg) { step6Failure(msg); }
+		})
+		} else {
+			msg = &quot;Could not initiate maintenance mode.&quot;;
+			setStatusBar(msg);
+		}
+	}
+
+	function step5Failure(msg) {
+		alert(&quot;Step 5 Failed&quot;);
+	}
+	
+	function step6Complete(msg) { //Upgrading Your files
+		if (msg == &quot;true&quot;) {
+			msg = &quot;Upgraded Your Files. &lt;br /&gt;&lt;strong&gt;Current Step&lt;/strong&gt; -&gt; Reactivate all your plugins&quot;;
+			showUpgradeLink();
+			setStatusBar(msg);
+			setStatus(80);
+			$j.ajax({
+			type: &quot;post&quot;,
+			url: PluginUrl + '/js/wp-wpau.php',
+			timeout: 180000,
+			data: {
+				task: 7},
+			success: function(msg) { step7Complete(msg); },
+			error: function(msg) { step7Failure(msg); }
+		})
+		} else {
+			msg = &quot;Could not upgrade your files.&quot;;
+			setStatusBar(msg);
+		}
+	}
+
+	function step6Failure(msg) {
+		alert(&quot;Step 6 Failed&quot;);
+	}
+
+		function step7Complete(msg) { //Show Log
+			setStatusBar(msg);
+			setStatus(100);
+		}
+	
+		function step7Failure(msg) {
+			alert(&quot;Step 8 Failed&quot;);
+		}
+	function step7oldComplete(msg) {
+		if (msg == &quot;true&quot;) {
+			msg = &quot;Successfully reactivated your plugins. &lt;br /&gt;&lt;strong&gt;Current Step&lt;/strong&gt; -&gt; Shows you upgradation logs.&quot;;
+			setStatusBar(msg);
+			setStatus(80);
+			$j.ajax({
+			type: &quot;post&quot;,
+			url: PluginUrl + '/js/wp-wpau.php',
+			timeout: 15000,
+			data: {
+				task: 8},
+			success: function(msg) { step8Complete(msg); },
+			error: function(msg) { step8Failure(msg); }
+		})
+		} else {
+			msg = &quot;Could not upgrade the database.&quot;;
+			setStatusBar(msg);
+		}
+	}
+
+	function step7Failure(msg) {
+		alert(&quot;Step 7 Failed&quot;);
+	}
+
+	function step8Complete(msg) { //Show Log
+		setStatusBar(msg);
+			setStatus(100);
+	}
+
+	function step8Failure(msg) {
+		alert(&quot;Step 9 Failed&quot;);
+	}
+	return {
+			init : function() { //AKA the constructor - Plugin authors can tap into the plugin by calling AjaxEditComments.init()
+				linkSetup();
+			}
+	};
+
 }();
\ No newline at end of file</diff>
      <filename>wordpress/wp-content/plugins/wordpress-automatic-upgrade/js/wp-wpau.js.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,33 +1,33 @@
-&lt;?php 
-	require_once(&quot;../../../../wp-config.php&quot;);
-if (!function_exists(&quot;wp_automatic_upgrade&quot;)) { die(&quot;Sorry&quot;); }
-
-if (isset($_POST['task'])) {
-	switch($_POST['task']) {
-	case 1:
-		if (wpau_backup_files(true)) { echo &quot;true&quot;; } else { echo &quot;false&quot;; }
-		break;
-	case 2:
-		if (wpau_backup_db(true)) {  echo &quot;true&quot;;  }  else {  echo &quot;false&quot;;  }
-		break;
-	case 3:
-		if (wpau_get_latest_version(true)) { echo &quot;true&quot;; } else { echo &quot;false&quot;; }
-		break;
-	case 4:
-		if (wpau_deactivate_plugins(true)) { echo &quot;true&quot;; } else { echo &quot;false&quot;; }
-		break;
-	case 5:
-		if (wpau_site_down(true)) { echo &quot;true&quot;; } else { echo &quot;false&quot;; }
-		break;
-	case 6:
-		if (wpau_upgrade_installation(true)) { echo &quot;true&quot;; } else { echo &quot;false&quot;; }
-		break;
-	case 7:
-		if (wpau_show_reactivate_plugins(true)) { }//echo &quot;true&quot;; } else { echo &quot;false&quot;; }
-		break;
-	case 8:
-		if (wpau_show_backup_log(true)) { echo &quot;true&quot;; } else { echo &quot;false&quot;; }
-		break;
-	}
-}
-?&gt;
+&lt;?php 
+	require_once(&quot;../../../../wp-config.php&quot;);
+if (!function_exists(&quot;wp_automatic_upgrade&quot;)) { die(&quot;Sorry&quot;); }
+
+if (isset($_POST['task'])) {
+	switch($_POST['task']) {
+	case 1:
+		if (wpau_backup_files(true)) { echo &quot;true&quot;; } else { echo &quot;false&quot;; }
+		break;
+	case 2:
+		if (wpau_backup_db(true)) {  echo &quot;true&quot;;  }  else {  echo &quot;false&quot;;  }
+		break;
+	case 3:
+		if (wpau_get_latest_version(true)) { echo &quot;true&quot;; } else { echo &quot;false&quot;; }
+		break;
+	case 4:
+		if (wpau_deactivate_plugins(true)) { echo &quot;true&quot;; } else { echo &quot;false&quot;; }
+		break;
+	case 5:
+		if (wpau_site_down(true)) { echo &quot;true&quot;; } else { echo &quot;false&quot;; }
+		break;
+	case 6:
+		if (wpau_upgrade_installation(true)) { echo &quot;true&quot;; } else { echo &quot;false&quot;; }
+		break;
+	case 7:
+		if (wpau_show_reactivate_plugins(true)) { }//echo &quot;true&quot;; } else { echo &quot;false&quot;; }
+		break;
+	case 8:
+		if (wpau_show_backup_log(true)) { echo &quot;true&quot;; } else { echo &quot;false&quot;; }
+		break;
+	}
+}
+?&gt;</diff>
      <filename>wordpress/wp-content/plugins/wordpress-automatic-upgrade/js/wp-wpau.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,162 +1,162 @@
-=== Wordpress Automatic upgrade ===
-Contributors: keithdsouza, ronalfy
-Donate link: http://techie-buzz.com/
-Tags: comments, admin, manage
-Requires at least: 1.5.2
-Tested up to: 2.6.1
-Stable tag: 1.2.2
-
-Wordpress automatic upgrade allows a user to automatically upgrade the wordpress installation to the latest one.
-
-== Description ==
-
-Wordpress Automatic Upgrade allows a user to automatically upgrade the wordpress installation to the latest one provided by wordpress.org using the 5 steps provided in the wordpress upgrade instructions.
-
-Wordpress automatic upgrade upgrades your wordpress installation by doing the following steps.
-
-1. Backs up the files and makes available a link to download it.
-2. Backs up the database and makes available a link to download it. 
-3. Downloads the latest files from http://wordpress.org/latest.zip and unzips it.
-4. Puts the site in maintenance mode.
-5. De-activates all active plugins and remembers it.
-6. Upgrades wordpress files.
-7. Gives you a link that will open in a new window to upgrade installation.
-8. Re-activates the plugins.
-
-The plugin can also can be run in a automated mode where in you do not have to click on any links to go to the next step.
-
-
-== Installation ==
-
-To do a new installation of the plugin, please follow these steps
-
-1. Download the wordpress-automatic-upgrade.zip file to your local machine.
-2. Unzip the file 
-3. Upload `wordpress-automatic-upgrade` folder to the `/wp-content/plugins/` directory
-4. Activate the plugin through the 'Plugins' menu in WordPress
-
-If you have already installed the plugin
-
-1. De-activate the plugin
-2. Download the latest files
-2. Follow the new installation steps
-
-== Frequently Asked Questions ==
-
-= What is Wordpress Automatic Upgrade? = 
-
-Wordpress Automatic Upgrade (WPAU) is a plugin that automatically upgrades your wordpress version to the latest files provided by wordpress.org.
-
-= Should I interfere with the Wordpress Automatic Plugin Process? = 
-
-No never, If the plugin fails it fails for a reason please do not interfere with any process that fails.
-
-= Do I need to change permissions on files? =
-
-No WPAU will ask you for your FTP credentials and do it automatically.
-
-= Why does WPAU run the preliminary checks? =
-
-WPAU runs the preliminary checks to determine in conditions in which it can feasibly update your site to the latest version provided by WordPress.
-
-= Why does WPAU ask me to clean up files? =
-
-When you run the plugin once we create backup files at the end of the process you need to delete these. If you missed deleting these files then WPAU will ask you to run cleanup before continuing.
-
-= Why use this plugin? = 
-
-WordPress releases regular updates and security fixes to the software and after sometime makes it mandatory. Every time you have to manually upgrade your WordPress installation. This plugin helps you to upgrade your installation without any efforts. We also ensure you will always download the latest version.
-
-= Which version of the WordPress does it upgrade to? =
-
-It upgrades to the latest version that WordPress has made available for download.
-
-= What is the lowest version from which I can upgrade? =
-
-The lowest version of WordPress I have tested this to work is with WordPress 1.5.
-
-= What files do you upgrade =
-
-This plugin only upgrades the files that are essential which includes the file in wp-includes, wp-admin and the root directory
-
-= I made some modification in the themes, will that be affected? =
-
-No, we do not touch those files at all. We only upgrade files in the root directory and wp-includes and wp-admin directory.
-
-= I modified the plugin files to play around and something went wrong, will you provide support for that? =
-
-No, this plugin is intended to run as it is. Support is free except when u modify it.
-
-= My site is in maintenance mode and the plugin did not complete. What do I do now? =
-
-Only under some rare condition will this happen. To get your site back online you need to do these things.
-
-1. Login to your site using FTP.
-2. Delete the index.php file.
-3. Rename the index.php.wpau.bak file to index.php
-
-Performing these steps should remove the maintenance mode message.
-
-= Why does the plugin say that it cannot upgrade my site? =
-
-We run preliminary checks to see if the plugin can run well with your site. Only in certain cases it will tell you that it cannot upgrade your site because the functionality of the plugin depends on it.
-
-= Why I am asked for my FTP credentials? =
-
-Initially we try to check whether your WordPress installation is writable or not. If we find that its not writable we ask you for you FTP credentials so that we can do the necessary things to make it writable.
-
-= What do you do when you get my FTP credentials? =
-
-First of all for security reasons we do not store your FTP Credentials. We only use it to change the file permission so that the plugin can run normally.
-
-Once we run the appropriate steps to check that everything is alright only then will the plugin continue the further steps.
-
-= What do you do when I give you my FTP credentials? =
-
-When you provide us with your FTP credentials we log into your site using FTP and change the permissions on files and directories such that it can be written by a file running on your server.
-
-= Is changing the permission on my site essential? =
-
-If you are asking in regards to WPAU absolutely. In order to complete the automatic upgrade we need write permissions to your site.
-
-= When will be asked for my FTP credentials and why? =
-
-You will only be asked for your FTP credentials when we cannot write to your server.
-
-Why?
-
-Some shared servers run different the webserver and apache as different users which is for security reason. In that case when we using the webserver cannot modify the files you have uploaded using a FTP client.
-
-In such a case we could ask you to do the steps required manually, but in the sense of automatic we want to make sure your upgrade is really automatic. When you provide us with those details we do not store it (though we may ask you for this everytime we determine your server is unaccesible for us) we maintain a security level which no other plugins can exploit over and above the one WordPress provides.
-
-We are very much that this plugin should be automatic and only if our preliminary checks fail initially we will ask you for the FTP credentials. You will never be asked for that when the plugin can run without the credentials.
-
-= If I am running on a server where FTP user and webserver user are different will I be able to overwrite / delete files using FTP =
-
-Yes absolutely. The plugin makes sure that whichever files it writes can be deleted by the user without having to contact the system administrator.
-
-= Why don't you provide a option for me to upload the version I want? =
-
-Couple of things here.
-a. You should always upgrade to the latest version provided by WordPress.
-b. I do not want users to upload files that requires me to do multiple validations. The WordPress files that this plugin downloads is the best one I could use.
-
-= Will it remember the plugins that were active? = 
-
-Yes it will remember the plugins that were active before upgradation and only activate those plugins.
-
-= How much bandwidth does the plugin use? = 
-
-The plugin using about 2-3MB of your bandwidth to download files. You will use more than that in a regular upgrade process.
-
-= How long will my files and db backups be available? =
-
-This plugin is to be used for a continious process till completion, it provides you with backups which you should download before moving to the next step. If you do not download the backups, at the end of the process you will be given an option to download it. Clicking clean up will delete those backup files.
-
-= Where are the files and db backup stored? =
-
-The files are db backups are stored in a folder called wpau-backup in the root folder of your site.
-
-= Does WordPress automatic upgrade provide a rollback? =
-
+=== Wordpress Automatic upgrade ===
+Contributors: keithdsouza, ronalfy
+Donate link: http://techie-buzz.com/
+Tags: comments, admin, manage
+Requires at least: 1.5.2
+Tested up to: 2.6.1
+Stable tag: 1.2.2
+
+Wordpress automatic upgrade allows a user to automatically upgrade the wordpress installation to the latest one.
+
+== Description ==
+
+Wordpress Automatic Upgrade allows a user to automatically upgrade the wordpress installation to the latest one provided by wordpress.org using the 5 steps provided in the wordpress upgrade instructions.
+
+Wordpress automatic upgrade upgrades your wordpress installation by doing the following steps.
+
+1. Backs up the files and makes available a link to download it.
+2. Backs up the database and makes available a link to download it. 
+3. Downloads the latest files from http://wordpress.org/latest.zip and unzips it.
+4. Puts the site in maintenance mode.
+5. De-activates all active plugins and remembers it.
+6. Upgrades wordpress files.
+7. Gives you a link that will open in a new window to upgrade installation.
+8. Re-activates the plugins.
+
+The plugin can also can be run in a automated mode where in you do not have to click on any links to go to the next step.
+
+
+== Installation ==
+
+To do a new installation of the plugin, please follow these steps
+
+1. Download the wordpress-automatic-upgrade.zip file to your local machine.
+2. Unzip the file 
+3. Upload `wordpress-automatic-upgrade` folder to the `/wp-content/plugins/` directory
+4. Activate the plugin through the 'Plugins' menu in WordPress
+
+If you have already installed the plugin
+
+1. De-activate the plugin
+2. Download the latest files
+2. Follow the new installation steps
+
+== Frequently Asked Questions ==
+
+= What is Wordpress Automatic Upgrade? = 
+
+Wordpress Automatic Upgrade (WPAU) is a plugin that automatically upgrades your wordpress version to the latest files provided by wordpress.org.
+
+= Should I interfere with the Wordpress Automatic Plugin Process? = 
+
+No never, If the plugin fails it fails for a reason please do not interfere with any process that fails.
+
+= Do I need to change permissions on files? =
+
+No WPAU will ask you for your FTP credentials and do it automatically.
+
+= Why does WPAU run the preliminary checks? =
+
+WPAU runs the preliminary checks to determine in conditions in which it can feasibly update your site to the latest version provided by WordPress.
+
+= Why does WPAU ask me to clean up files? =
+
+When you run the plugin once we create backup files at the end of the process you need to delete these. If you missed deleting these files then WPAU will ask you to run cleanup before continuing.
+
+= Why use this plugin? = 
+
+WordPress releases regular updates and security fixes to the software and after sometime makes it mandatory. Every time you have to manually upgrade your WordPress installation. This plugin helps you to upgrade your installation without any efforts. We also ensure you will always download the latest version.
+
+= Which version of the WordPress does it upgrade to? =
+
+It upgrades to the latest version that WordPress has made available for download.
+
+= What is the lowest version from which I can upgrade? =
+
+The lowest version of WordPress I have tested this to work is with WordPress 1.5.
+
+= What files do you upgrade =
+
+This plugin only upgrades the files that are essential which includes the file in wp-includes, wp-admin and the root directory
+
+= I made some modification in the themes, will that be affected? =
+
+No, we do not touch those files at all. We only upgrade files in the root directory and wp-includes and wp-admin directory.
+
+= I modified the plugin files to play around and something went wrong, will you provide support for that? =
+
+No, this plugin is intended to run as it is. Support is free except when u modify it.
+
+= My site is in maintenance mode and the plugin did not complete. What do I do now? =
+
+Only under some rare condition will this happen. To get your site back online you need to do these things.
+
+1. Login to your site using FTP.
+2. Delete the index.php file.
+3. Rename the index.php.wpau.bak file to index.php
+
+Performing these steps should remove the maintenance mode message.
+
+= Why does the plugin say that it cannot upgrade my site? =
+
+We run preliminary checks to see if the plugin can run well with your site. Only in certain cases it will tell you that it cannot upgrade your site because the functionality of the plugin depends on it.
+
+= Why I am asked for my FTP credentials? =
+
+Initially we try to check whether your WordPress installation is writable or not. If we find that its not writable we ask you for you FTP credentials so that we can do the necessary things to make it writable.
+
+= What do you do when you get my FTP credentials? =
+
+First of all for security reasons we do not store your FTP Credentials. We only use it to change the file permission so that the plugin can run normally.
+
+Once we run the appropriate steps to check that everything is alright only then will the plugin continue the further steps.
+
+= What do you do when I give you my FTP credentials? =
+
+When you provide us with your FTP credentials we log into your site using FTP and change the permissions on files and directories such that it can be written by a file running on your server.
+
+= Is changing the permission on my site essential? =
+
+If you are asking in regards to WPAU absolutely. In order to complete the automatic upgrade we need write permissions to your site.
+
+= When will be asked for my FTP credentials and why? =
+
+You will only be asked for your FTP credentials when we cannot write to your server.
+
+Why?
+
+Some shared servers run different the webserver and apache as different users which is for security reason. In that case when we using the webserver cannot modify the files you have uploaded using a FTP client.
+
+In such a case we could ask you to do the steps required manually, but in the sense of automatic we want to make sure your upgrade is really automatic. When you provide us with those details we do not store it (though we may ask you for this everytime we determine your server is unaccesible for us) we maintain a security level which no other plugins can exploit over and above the one WordPress provides.
+
+We are very much that this plugin should be automatic and only if our preliminary checks fail initially we will ask you for the FTP credentials. You will never be asked for that when the plugin can run without the credentials.
+
+= If I am running on a server where FTP user and webserver user are different will I be able to overwrite / delete files using FTP =
+
+Yes absolutely. The plugin makes sure that whichever files it writes can be deleted by the user without having to contact the system administrator.
+
+= Why don't you provide a option for me to upload the version I want? =
+
+Couple of things here.
+a. You should always upgrade to the latest version provided by WordPress.
+b. I do not want users to upload files that requires me to do multiple validations. The WordPress files that this plugin downloads is the best one I could use.
+
+= Will it remember the plugins that were active? = 
+
+Yes it will remember the plugins that were active before upgradation and only activate those plugins.
+
+= How much bandwidth does the plugin use? = 
+
+The plugin using about 2-3MB of your bandwidth to download files. You will use more than that in a regular upgrade process.
+
+= How long will my files and db backups be available? =
+
+This plugin is to be used for a continious process till completion, it provides you with backups which you should download before moving to the next step. If you do not download the backups, at the end of the process you will be given an option to download it. Clicking clean up will delete those backup files.
+
+= Where are the files and db backup stored? =
+
+The files are db backups are stored in a folder called wpau-backup in the root folder of your site.
+
+= Does WordPress automatic upgrade provide a rollback? =
+
 No it does not, the function of WPAU is to seamlessly upgrade your versions. Rollback features will be added in future versions.
\ No newline at end of file</diff>
      <filename>wordpress/wp-content/plugins/wordpress-automatic-upgrade/readme.txt</filename>
    </modified>
    <modified>
      <diff>@@ -1,23 +1,23 @@
-&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot;
-&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;
-&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xml:lang=&quot;en&quot; lang=&quot;en&quot;&gt;
-
-&lt;head profile=&quot;http://gmpg.org/xfn/11&quot;&gt;
-	&lt;title&gt;Maintenance Mode&lt;/title&gt;
-&lt;/head&gt;
-
-&lt;body&gt;
-
-	
-
-	&lt;div id=&quot;content&quot;&gt;
-	The Site is currently undergoing maintenance, Sorry for the inconvinience
-
-	&lt;/div&gt;
-
-	&lt;div id=&quot;footer&quot;&gt;
-		&lt;p&gt;Wordpress Automatic Upgrade Plugin provided by &lt;a href=&quot;http://techie-buzz.com/wp-plugins/worpress-automatic-upgrade-plugin.html&quot;&gt;Techie Buzz&lt;/a&gt;.&lt;/p&gt;
-	&lt;/div&gt;
-
-&lt;/body&gt;
+&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot;
+&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;
+&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xml:lang=&quot;en&quot; lang=&quot;en&quot;&gt;
+
+&lt;head profile=&quot;http://gmpg.org/xfn/11&quot;&gt;
+	&lt;title&gt;Maintenance Mode&lt;/title&gt;
+&lt;/head&gt;
+
+&lt;body&gt;
+
+	
+
+	&lt;div id=&quot;content&quot;&gt;
+	The Site is currently undergoing maintenance, Sorry for the inconvinience
+
+	&lt;/div&gt;
+
+	&lt;div id=&quot;footer&quot;&gt;
+		&lt;p&gt;Wordpress Automatic Upgrade Plugin provided by &lt;a href=&quot;http://techie-buzz.com/wp-plugins/worpress-automatic-upgrade-plugin.html&quot;&gt;Techie Buzz&lt;/a&gt;.&lt;/p&gt;
+	&lt;/div&gt;
+
+&lt;/body&gt;
 &lt;/html&gt;
\ No newline at end of file</diff>
      <filename>wordpress/wp-content/plugins/wordpress-automatic-upgrade/temp-index.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,1522 +1,1522 @@
-&lt;?php
-/*
-Plugin Name: Wordpress Automatic Upgrade
-Plugin URI: http://techie-buzz.com/wordpress-plugins/wordpress-automatic-upgrade-12-release.html
-Description: Wordpress Automatic Upgrade allows a user to automatically upgrade the wordpress installation to the latest one provided by wordpress.org using the 5 steps provided in the wordpress upgrade instructions. Go to &lt;a href=&quot;edit.php?page=wordpress-automatic-upgrade/wordpress-automatic-upgrade.php&quot;&gt;Wordpress Automatic Upgrade&lt;/a&gt; to upgrade your installation Thanks to &lt;a href=&quot;http://www.ronalfy.com&quot;&gt;Ronald Huereca&lt;/a&gt;  for making the plugin run in automatic mode.
-Version: 1.2.2
-Author: Keith Dsouza
-Author URI: http://techie-buzz.com/
-
-Wordpress automatic upgrade upgrades your wordpress installation by doing the following steps.
-
-1. Backs up the files and makes available a link to download it.
-2. Backs up the database and makes available a link to download it.
-3. Downloads the latest files from http://wordpress.org/latest.zip and unzips it.
-4. Puts the site in maintenance mode.
-5. De-activates all active plugins and remembers it.
-6. Upgrades wordpress files.
-7. Gives you a link that will open in a new window to upgrade installation.
-8. Re-activates the plugins.
-
-The plugin can  also can be run in a automated mode where in you do not have to click on any links to go to the next step.
-
-Usage Instructions
--------------------------
-
-Go to Manage -&gt; Automatic Upgrade and either click on the link provided to run or use the automated version link to let the plugin run in a automated way.
-
-Change Log
----------------
-
-@version 0.4
-1. Added a prelim check before starting the process to check whether or not we can write files to the server
-2. Checks if previous version files were not cleared
-3. If we cannot write the files to server asking user for ftp credentials so that we can make the permission changes
-4. Fixed bug where task status was not reported on error thus showing a db error to the user
-5. Fixed a bug where open_basedir restriction is on for a website hosted as virtual folder
-
-@version 0.5
-
-1. Fixed bugs where user had a www folder with full write permissions but the public_html folder was not writable.
-2. Fixed issue where while writing there were ftp errors while creating backup directory but still plugin said all ready to go
-3. Fixed issue where plugins were not activating even if one plugin threw an error.
-4. Fixed other issues with html and reporting
-
-@version 0.6
-bug fixes for security
-
-@version 0.7
-fixes for blogs that have the wordpress setup in a different directory and run the blog on a different directory
-
-@version 0.8
-Fix for database table name changes in WordPress 2.3 this should only affect blogs that are running WordPress 2.3 while running the Automatic Upgrade.
-
-@version 1.0
-Finally out for a release version as it has worked with more than 10 releases of WordPress updates
-
-This version basically fixes a issue with automatic plugin updates caused due to PCLZip library which is included used by WordPress plugin update code
-now checks in place to see that while plugins are being updated we silently drop the library inclusion
-
-@version 1.1
-Changed short tags to use full php tags which was breaking activation of the plugin when short tags were disabled on the server end.
-
-@version 1.2
-
-Fixed a major issue where plugins were not being activated after the upgrade was done. This bug was only seen in WordPress 2.5 and above since they clear out the cookies after the upgrade has comepleted.
-Changed all the urls to use wpurl instead of using siteurl
-Isolated view of the WordPress Automatic Updated Link to only the Administartors of the blog
-Uses Snoopy to downloading updates.
-Added a Nag to Update using WPAU
-Removed Automated Update mode
-Several other minor bug fixes
-
-@1.2.0.1
-updated user debug messages
-
-@1.2.0.2
-change snoopy class name to internal to fix a issue with snoopy being loaded after WP loaded and no checks in place
-
-@1.2.1
-Allows users to skip db and file backups since several users with big databases have
-reported for this feature
-
-@1.2.2
-Added nag to cleanup files from previous upgrade
-Does not write the log file to disk anymore
-Fixed a issue for including wp-config file
-
-
-
-Thanks to all who reported the bugs and helped me make this plugin better, if you still see any bugs please email me at dsouza.keith@gmail.com
-
-Copyright 2007  Keith Dsouza  (email : dsouza.keith at gmail.com)
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
-
-
-@define('WPAU_PAGE', 'wordpress-automatic-upgrade/wordpress-automatic-upgrade.php');
-@define('WPAU_BACKUP_DIR', 'wpau-backup');
-@define('WPAU_FILES_ZIP', 'wpau-files-bak');
-@define('WPAU_DB_ZIP', 'wpau-db-backup');
-@define('WPAU_LOG_FILE', 'wpau-log-data.txt');
-@define('WPAU_PLUGIN_TABLE', 'wpau_active_plugins_info');
-@define('WPAU_LOG_TABLE', 'wpau_upgrade_log');
-@define('WPAU_PLUGIN', 'wordpress-automatic-upgrade/wordpress-automatic-upgrade.php');
-
-	session_start();
-	$serverSoft = $_SERVER['SERVER_SOFTWARE'];
-	$isNix = true;
-	if(stristr($serverSoft, &quot;win32&quot;) !== false) {
-		$isNix = false;
-	}
-
-	if($isNix)
-		@define('WPAU_FILEPATH', 'wp-content/plugins/wordpress-automatic-upgrade');
-	else
-		@define('WPAU_FILEPATH', 'wp-content\plugins\wordpress-automatic-upgrade');
-
-	//the logger class
-	require_once('wpau_helper.class.php');
-
-
-	$wpauDirPath = get_bloginfo('wpurl') . WPAU_FILEPATH;
-	$wpauFileDirPath = ABSPATH. WPAU_FILEPATH;
-	$wpAbsPath = ABSPATH;
-	$wpIncludeDirs = array('wp-admin', 'wp-includes');
-	$wpAllowedExt = array('zip');
-	$theFuncComplete = false;
-	$wpauMessage = '';
-	$isAutomated = false;
-
-	$task_list = array(
-		'files',
-		'backupdbopt',
-		'backupdb',
-		'newversionoption',
-		'getlatestfiles',
-		'maintmode',
-		'de-plugin',
-		'upgrade',
-		're-plugin',
-	);
-
-
-	$task_description = array(
-		'Backs up all the current files from the wordpress installation',
-		'Shows you the options to backup your database',
-		'Backs up the database file',
-		'Shows you the options to upload latest files',
-		'Downloads / Uploads the latest files for wordpress',
-		'Puts the site into maintenance mode',
-		'De-activates all the plugins',
-		'Upgrades all the installation files',
-		'Re-activates all the plugins that were active earlier'
-	);
-
-	$automated_task_list = array(
-		'files',
-		'backupdb',
-		'getlatestfiles',
-		'maintmode',
-		'de-plugin',
-		'upgrade',
-		're-plugin'
-	);
-  
-  $skip_tasks_list = array (
-    'backupdbopt',
-    'files'
-  );
-
-	$automated_task_description = array(
-		'Backs up all the current files from the wordpress installation',
-		'Backs up the database file',
-		'Downloads / Uploads the latest files for wordpress',
-		'Puts the site into maintenance mode',
-		'De-activates all the plugins',
-		'Upgrades all the installation files',
-		'Re-activates all the plugins that were active earlier',
-		'Cleans up all the upgradation files'
-	);
-
-	if( isset($_REQUEST['task']) ) {
-		$task = $_REQUEST['task'];
-	}
-
-
-
-	if (isset($wpdb)) {
-		wpau_init();
-	}
-
-
-	function wpau_manage_page() {
-		//add_menu_page('Automatic Upgrade', 'Automatic Upgrade', 0, 'wordpress-automatic-upgrade/wordpress-automatic-upgrade.php' , 'wp_automatic_upgrade');
-		add_submenu_page('edit.php', 'Automatic Upgrade', 'Automatic Upgrade', 10, 'wordpress-automatic-upgrade/wordpress-automatic-upgrade.php', 'wp_automatic_upgrade');
-	}
-  
-  function wpau_add_nag($msg) {
-	$cur = get_option( 'update_core' );
-    	$uplink = 'edit.php?page='.WPAU_PAGE;
-    	$cllink = 'edit.php?page='.WPAU_PAGE.'&amp;task=cleanup&amp;returnhome=1';
-	if(function_exists('wp_nonce_url') ) {
-		$uplink = wp_nonce_url($uplink, 'wordpress_automatic_upgrade');
-		$cllink = wp_nonce_url($cllink, 'wordpress_automatic_upgrade');
-	}
-    
-  	if ( ! isset( $cur-&gt;response ) || $cur-&gt;response != 'upgrade' ) {
-  	  require_once('wpau_prelimcheck.class.php');
-      $prelimCheck = new wpauPrelimHelper();
-  	  if($prelimCheck-&gt;checkCleanUpRequired()) {
-  	    if ( current_user_can('manage_options') ) {
-  	      $msg = sprintf( __('You have not cleaned up the files from last upgrade. Please &lt;a href=&quot;%3$s&quot;&gt;Click Here&lt;/a&gt; to cleanup the files, and disable this nag.'), $cur-&gt;url, $cur-&gt;current, $cllink );
-          echo &quot;&lt;div id='update-nag'&gt;$msg&lt;/div&gt;&quot;;
-  	    }	
-  	  }
-      unset($prelimCheck);
-	  return false;
-	 }
-
-	if ( current_user_can('manage_options') ) {
-	  $msg = sprintf( __('&lt;a href=&quot;%3$s&quot;&gt;Click Here&lt;/a&gt; to Automatically Upgrade WordPress to latest Version.'), $cur-&gt;url, $cur-&gt;current, $uplink );
-	  echo &quot;&lt;div id='update-nag'&gt;$msg&lt;/div&gt;&quot;;
-	}
-  }
-
-	function wp_automatic_upgrade() {
-		if( ! user_can_access_admin_page()) {
-			return false;
-		}
-
-		if(isset($_REQUEST['_wpnonce']) ) {
-			if(function_exists('check_admin_referer')) {
-				check_admin_referer('wordpress_automatic_upgrade');
-			}
-		}
-
-		global $task;
-		switch($task) {
-			case 'start':
-				show_upgrade_start();
-				break;
-			case 'files':
-				wpau_backup_files();
-				break;
-      case 'skipfiles':
-				wpau_skip_backup_files();
-				break;
-			case 'backupdbopt':
-				wpau_backup_db_options();
-				break;
-      case 'skipbackupdbopt':
-				wpau_skip_backup_db();
-				break;
-			case 'backupdb':
-				wpau_backup_db();
-				break;
-			case 'newversionoption':
-				wpau_show_new_version_forms();
-				break;
-			case 'getlatestfiles':
-				wpau_get_latest_version();
-				break;
-			case 'maintmode':
-				wpau_site_down();
-				break;
-			case 'de-plugin':
-				wpau_deactivate_plugins();
-				break;
-			case 'upgrade':
-				wpau_upgrade_installation();
-				break;
-			case 'updatedb':
-				wpau_update_database();
-				break;
-			case 're-plugin':
-				wpau_reactivate_plugins();
-				break;
-			case 'cleanup':
-				wpau_cleanup();
-				break;
-			case 'done':
-				wpau_show_backup_log();
-				break;
-			case 'logs':
-				wpau_show_log();
-				break;
-			case 'prelimopts':
-				wpau_prelim_opts_and_sanatize();
-				break;
-      case 'skiptask':
-        wpau_skip_task();
-			default:
-				wpau_run_prelims();
-				break;
-		}
-	}
-
-	/** adds the initial task to the database **/
-	function wpauPersistNoLog($isUpdate, $showOutput = false, $automated = false) {
-		if(isset($_REQUEST['_wpnonce']) ) {
-			if(function_exists('check_admin_referer')) {
-				check_admin_referer('wordpress_automatic_upgrade');
-			}
-		}
-		global $isAutomated;
-		$isAutomated = $automated;
-		wpauPersist($isUpdate, '', false, '', $showOutput);
-	}
-
-	/** logs the output for a current task **/
-	function wpauPersist($isUpdate, $theLog = '', $funcComplete = false, $message = '', $showOutput = true) {
-		global $task, $wpdb, $task_list, $automated_task_list, $task_description, $automated_task_description, $isAutomated, $theFuncComplete;
-		$datetime = date('Y-m-d H:i:s');
-		if($isAutomated) {
-			$currentPos = $task - 1;
-			$taskname = $automated_task_list[$currentPos];
-			$currentTaskDescription = $automated_task_description[$currentPos];
-		}
-		else {
-			$currentPos = array_search($task, $task_list);
-			$currentTaskDescription = $task_description[$currentPos];
-			$taskname = $task;
-		}
-
-		if(! $isUpdate) {
-			checkEntryAndDelete($task);
-			//ok this is the first time the task is called so run a insert on the db
-			$wpdb-&gt;query('INSERT into '.WPAU_LOG_TABLE.' (task_name, task_status, task_description, task_log, start_date)
-						values (\''.$taskname.'\', 0, \''.$currentTaskDescription.'\' , \'\', \''.$datetime.'\')');
-			return;
-		}
-		else {
-			if($theFuncComplete == true)
-				$functionStatus = 1;
-			else
-				$functionStatus = 0;
-
-			$wpdb-&gt;query('UPDATE '.WPAU_LOG_TABLE.' set task_status = '.$functionStatus.', task_log = \''.mysql_real_escape_string($theLog).'\', end_date = \''.$datetime.'\' where task_name = \''.mysql_real_escape_string($taskname).'\'');
-			if($isAutomated) return $theFuncComplete;
-			if($theFuncComplete) {
-				getWpauNextPage($task, $message, $showOutput);
-			}
-			else {
-				$link = 'edit.php?page='.WPAU_PAGE.'&amp;task=logs';
-				if(function_exists('wp_nonce_url') ) {
-					 $link = wp_nonce_url($link, 'wordpress_automatic_upgrade');
-				}
-				echo 'We could not complete the upgrade please try again later, &lt;a href=&quot;'.$link.'&quot;&gt;click here&lt;/a&gt; to check the logs.';
-			}
-		}
-	}
-  
-	/** start html **/
-	function wpauStartHtml() {
-?&gt;
-&lt;div align=&quot;left&quot; style=&quot;margin-left:30px;&quot;&gt;
-    &lt;br/&gt;
-    &lt;br/&gt;
-    &lt;div&gt;
-        &lt;strong style=&quot;font-size:20px;&quot;&gt;Wordpress automatic upgrade&lt;/strong&gt;
-        &lt;p&gt;
-            Upgrades your wordpress installation automatically. If this plugin helped you, you can contribute towards plugin development by &lt;a href=&quot;https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&amp;business=dsouza.keith@gmail.com&amp;currency_code=&amp;amount=&amp;return=&amp;item_name=WordPress+Plugin+Development+Donation&quot; target=&quot;_blank&quot; title=&quot;Opens in New Window&quot;&gt;Donating to me&lt;/a&gt;.
-        &lt;/p&gt;
-        &lt;p&gt;
-            &lt;strong&gt;
-                &lt;u&gt;
-                    TASK OUTPUT
-                &lt;/u&gt;
-            &lt;/strong&gt;
-        &lt;/p&gt;
-        &lt;?php
-	}
-
-	/** end html **/
-	function wpauEndHtml() {
-?&gt;
-    &lt;/div&gt;
-&lt;/div&gt;
-&lt;div style=&quot;clear:both&quot;&gt;
-&lt;/div&gt;
-&lt;?php
-	}
-
-	/** if we are re-running the task we need to clear up old logs **/
-	function checkEntryAndDelete($task) {
-		//sometimes we need to retry tasks so we do it here such that we do not have duplicate entry for same task
-		global $wpdb;
-		$logs = $wpdb-&gt;get_results('SELECT id  from '.WPAU_LOG_TABLE.' where task_name = \''.$task.'\'');
-		if(count($logs) &gt; 0) {
-			$wpdb-&gt;query('DELETE from '.WPAU_LOG_TABLE.' where task_name = \''.$task.'\'');
-		}
-	}
-
-	/** clears all the upgraded data from the tables **/
-	function clearUpgradeData() {
-		global $wpdb;
-		wpau_init();
-		$wpdb-&gt;query('truncate table '. WPAU_LOG_TABLE);
-		$wpdb-&gt;query('truncate table '. WPAU_PLUGIN_TABLE);
-	}
-
-	/** builds the output and creates a link to the next task if any exists **/
-	function getWpauNextPage($task, $message, $showOutput = true) {
-		global $task_list, $task_description, $theFuncComplete, $skip_tasks_list;
-		//ensure multiple checks so that if previous task is not complete we
-		//do not do the next step as all are inter-dependent
-		$currentPos = array_search($task, $task_list);
-
-		$currentTaskDescription = $task_description[$currentPos];
-
-		//check if we have more tasks
-		if($currentPos + 1 &lt; count($task_list)) {
-			$nextTask = $task_list[$currentPos + 1];
-			$nextTaskDescription = $task_description[$currentPos + 1];
-		}
-		else {
-			$nextTask = 'done';
-			$nextTaskDescription = 'Congratulations your wordpress upgrade is complete.';
-		}
-		$nextLink = 'edit.php?page='.WPAU_PAGE.'&amp;task='.$nextTask;
-		if(function_exists('wp_nonce_url') &amp;&amp; &quot;re-plugin&quot; != $nextTask ) {
-			 $nextLink = wp_nonce_url($nextLink, 'wordpress_automatic_upgrade');
-		}
-		if($currentPost &gt; count($task_list) || $currentPos &lt; 0 ) {
-			$link = 'edit.php?page='.WPAU_PAGE;
-			if(function_exists('wp_nonce_url') ) {
-				 $link = wp_nonce_url($link, 'wordpress_automatic_upgrade');
-			}
-			$message .= 'Sorry you came across a weird task that was not to be there. Please &lt;a href=&quot;'.$link.'&quot;&gt;click here&lt;/a&gt; to restart again once more';
-			$theFuncComplete = false;
-		}
-
-		if($showOutput &amp;&amp; $theFuncComplete) {
-			wpauStartHtml();
-			echo '&lt;strong&gt;'.$message.'&lt;/strong&gt;';
-			echo &quot;&lt;hr /&gt;&lt;strong&gt;TASK STATUS&lt;/strong&gt;&lt;br /&gt;&lt;hr /&gt;&quot;;
-			echo '&lt;strong&gt;We succesfully completed the task which&lt;/strong&gt;, '.$currentTaskDescription.'. &lt;br /&gt;&lt;br /&gt;
-			&lt;strong&gt;Next Task -&gt;&lt;/strong&gt; '.$nextTaskDescription.'
-			&lt;br /&gt;&lt;br /&gt;Please &lt;a href=&quot;'.$nextLink.'&quot;&gt;CLICK HERE&lt;/a&gt; to go to the next task.';
-      //check if this can be skipped and add a link for it
-      if(in_array($nextTask, $skip_tasks_list)) {
-        $skipLink = 'edit.php?page='.WPAU_PAGE.'&amp;task=skip'.$nextTask;
-		    if(function_exists('wp_nonce_url')) {
-			   $skipLink = wp_nonce_url($skipLink, 'wordpress_automatic_upgrade');
-		    }
-        echo '&lt;br /&gt;&lt;a href=&quot;'.$skipLink.'&quot;&gt;Click here&lt;/a&gt; to skip this task.';
-      }
-			wpauEndHtml();
-		}
-		else if (! $theFuncComplete) {
-			wpauStartHtml();
-			echo '&lt;strong&gt;Sorry something went wrong we cannot continue further with this process&lt;/strong&gt;';
-			$link = 'edit.php?page='.WPAU_PAGE;
-			if(function_exists('wp_nonce_url') ) {
-				 $link = wp_nonce_url($link, 'wordpress_automatic_upgrade');
-			}
-			echo '&lt;p&gt;Please &lt;a href=&quot;'.$link.'&quot;&gt;click here&lt;/a&gt; to start over again&lt;/p&gt;';
-			wpauEndHtml();
-		}
-
-	}
-
-	function wpau_show_reactivate_plugins($automated = false) {
-		echo 'Congratulations!!! All the files have been upgraded to the latest version. Please &lt;a href=&quot;'.get_bloginfo('wpurl').'/wp-admin/upgrade.php&quot; target=&quot;_blank&quot;&gt;CLICK HERE TO COMPLETE DATABASE UPGRADE&lt;/a&gt; (opens in new window and will show you a upgrade link only if database has to be upgraded) and come back here to reactivate your plugins&lt;br&gt;';
-		$link = 'edit.php?page='.WPAU_PAGE.'&amp;task=re-plugin';
-    //skip this for now
-		/*if(function_exists('wp_nonce_url') ) {
-			 $link = wp_nonce_url($link, 'wordpress_automatic_upgrade');
-		}*/
-		echo '&lt;strong&gt;&lt;a href=&quot;'.$link.'&quot;&gt;PLEASE CLICK HERE TO RE-ACTIVATE YOUR PLUGINS. AFTER YOU HAVE UPGRADED DATABASE&lt;/a&gt;&lt;/strong&gt;';
-	}
-
-	/** runs thorough preliminary checks to see if we can run WPAU on the user's server **/
-	function wpau_run_prelims() {
-		global $wbAbsPath, $isNix, $wpdb;
-		$count = $wpdb-&gt;get_results('SELECT count(*) as counter from '.WPAU_LOG_TABLE);
-		if($counter &gt; 0) {
-			if($count-&gt;counter &gt; 0)
-				clearUpgradeData();
-		}
-
-		//clearUpgradeData();
-		$extra = '';
-		require_once('wpau_prelimcheck.class.php');
-		wpauStartHtml();
-		echo &quot;&lt;hr /&gt;&lt;strong&gt;TASK STATUS&lt;/strong&gt;&lt;br /&gt;&quot;;
-		echo &quot;We conducted some preliminary checks on your server. Below is the output&lt;hr /&gt;&quot;;
-		$canWPAURun = true;
-		$ftpError = false;
-		$allClear = true;
-		$message = '';
-		$severeError = '';
-		$prelimCheck = new wpauPrelimHelper();
-    
-    //new check to see if upgrade is required
-
-    if( ! $prelimCheck-&gt;runUpgradeRequiredCheck()) {
-     echo &quot;&lt;strong&gt;Congratulations!!! Your WordPress version is already up to date.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&quot;;
-     if($prelimCheck-&gt;checkCleanUpRequired()) {
-			echo 'There are some old files from previous installation. Please &lt;a href=&quot;edit.php?page='.WPAU_PAGE.'&amp;task=cleanup&amp;returnhome=1&quot;&gt;click here to run the clean up process before continuing&lt;br&gt;';
-		 }
-      unset($prelimCheck);
-      wpauEndHtml();
-      return false; 
-    }
-
-		if($prelimCheck-&gt;checkCleanUpRequired()) {
-			echo 'Seems you have not completed the clean up process from last upgrade. Please &lt;a href=&quot;edit.php?page='.WPAU_PAGE.'&amp;task=cleanup&amp;returnhome=1&quot;&gt;click here to run the clean up process before continuing&lt;br&gt;';
-			wpauEndHtml();
-			unset($prelimCheck);
-			return false;
-		}
-
-		if(! $prelimCheck-&gt;runFTPPrelimChecks()) {
-			$message .= 'Server does not allow us to write to your wordpress directory&lt;br /&gt;
-			In order to continue you need to do one of the two things&lt;br /&gt;';
-			$ftpError = true;
-			$allClear = false;
-		}
-		else if(ini_get('safe_mode')) {
-			//safe mode man cannot run
-			$severeError =  'Your server is running in safe mode. WPAU cannot continue in safe mode. Please ask your system administrator to change the setting to disble running in safe mode';
-			$canWPAURun = false;
-		}
-		else if (!function_exists('gzopen')) {
-			//urgh no zip support can't run
-			$severeError =  'Oops your server does not support zip functions which is core to some of the funcionalities of this plugin. Sorry but we cannot continue. Please ask your server administrator to turn on zip support';
-			$canWPAURun = false;
-		}
-
-		if(! $prelimCheck-&gt;canMakeBackupDir) {
-			$extra = &quot;mbd=true&quot;;
-		}
-		//site is running in safe mode so we cannot continue
-		if(! $canWPAURun) {
-			echo '&lt;p style=&quot;color:red;font-weight:bold&quot;&gt;'. $severeError.'&lt;/p&gt;';
-			echo '&lt;/p&gt;';
-			wpauEndHtml();
-			unset($prelimCheck);
-			return false;
-		}
-
-		/**
-			ok seems the site is having the ftp issue, show up the form to the user
-			this happens when the ftp user and web users are different on a shared
-			server running multiple sites
-		**/
-		if( $ftpError) {
-			echo '&lt;p style=&quot;color:red;font-weight:bold&quot;&gt;'. $message.'&lt;/p&gt;';
-?&gt;
-&lt;ol&gt;
-    &lt;li&gt;
-        Provide us with your FTP credentials
-    &lt;/li&gt;
-&lt;/ol&gt;
-&lt;p&gt;
-    &lt;strong&gt;Note:&lt;/strong&gt;
-    We do not store your FTP information with us due to security reasons. Your ftp credentials will only be used to make your site writable by this plugin. You only have to do this once.
-&lt;/p&gt;
-&lt;p&gt;
-    What is your FTP Base Directory. 
-    If you have installed wordpress inside &lt;strong&gt;public_html&lt;/strong&gt;
-    folder then your base ftp directory is &lt;strong&gt;/public_html&lt;/strong&gt;
-    &lt;br/&gt;
-    If your you have installed your wordpress in &lt;strong&gt;public_html/wpau&lt;/strong&gt;
-    folder then your base ftp directory is &lt;strong&gt;/public_html/wpau&lt;/strong&gt;
-    &lt;br/&gt;
-    If you install the wordpress into the root directory then your base directory will be &lt;strong&gt;/&lt;/strong&gt;
-    &lt;br/&gt;
-&lt;/p&gt;
-&lt;form method=&quot;post&quot; name=&quot;getftp&quot; action=&quot;edit.php?page=&lt;?php echo WPAU_PAGE; ?&gt;&amp;task=prelimopts&amp;&lt;?php echo $extra; ?&gt;&quot;&gt;
-    &lt;?php
-		if(function_exists('wp_nonce_field')) {
-			wp_nonce_field('wordpress_automatic_upgrade');
-		}
-?&gt;
-    &lt;table class=&quot;editform&quot; width=&quot;500&quot; cellspacing=&quot;2&quot; cellpadding=&quot;5&quot; align=&quot;left&quot;&gt;
-        &lt;tr&gt;
-            &lt;td colspan=&quot;2&quot;&gt;
-                &lt;strong&gt;Provide your FTP Credentials&lt;/strong&gt;
-            &lt;/td&gt;
-        &lt;/tr&gt;
-        &lt;tr&gt;
-            &lt;td&gt;
-                &lt;label for=&quot;disclosurepolicy-title&quot;&gt;
-                    FTP Username
-                &lt;/label&gt;
-            &lt;/td&gt;
-            &lt;td&gt;
-                &lt;input type=&quot;text&quot; id=&quot;wpau-ftpuser&quot; name=&quot;wpau-ftpuser&quot; value=&quot;&quot; style=&quot;width: 95%&quot;/&gt;
-            &lt;/td&gt;
-        &lt;/tr&gt;
-        &lt;tr&gt;
-            &lt;td&gt;
-                &lt;label for=&quot;disclosurepolicy-title&quot;&gt;
-                    FTP Password
-                &lt;/label&gt;
-            &lt;/td&gt;
-            &lt;td&gt;
-                &lt;input type=&quot;password&quot; id=&quot;wpau-ftppass&quot; name=&quot;wpau-ftppass&quot; value=&quot;&quot; style=&quot;width: 95%&quot;/&gt;
-            &lt;/td&gt;
-        &lt;/tr&gt;
-        &lt;tr&gt;
-            &lt;td&gt;
-                &lt;label for=&quot;disclosurepolicy-title&quot;&gt;
-                    FTP Base Directory (The root dir where wordpress is installed)
-                &lt;/label&gt;
-            &lt;/td&gt;
-            &lt;td&gt;
-                &lt;input type=&quot;text&quot; id=&quot;wpau-ftpbasedir&quot; name=&quot;wpau-ftpbasedir&quot; value=&quot;&quot; style=&quot;width: 95%&quot;/&gt;
-            &lt;/td&gt;
-        &lt;/tr&gt;
-        &lt;tr&gt;
-            &lt;td&gt;
-                &lt;label for=&quot;disclosurepolicy-title&quot;&gt;
-                    FTP Host
-                &lt;/label&gt;
-            &lt;/td&gt;
-            &lt;td&gt;
-                &lt;input type=&quot;text&quot; id=&quot;wpau-ftphost&quot; name=&quot;wpau-ftphost&quot; value=&quot;&quot; style=&quot;width: 95%&quot;/&gt;
-            &lt;/td&gt;
-        &lt;/tr&gt;
-        &lt;tr&gt;
-            &lt;td colspan=&quot;2&quot;&gt;
-                &lt;input type=&quot;submit&quot; name=&quot;wpau-submit&quot; id=&quot;wpau-submit&quot; value=&quot;Let's Go&quot; /&gt;
-            &lt;/td&gt;
-        &lt;/tr&gt;
-    &lt;/table&gt;
-&lt;/form&gt;
-&lt;?php
-		}
-		else if($allClear) {
-			$link = 'edit.php?page='.WPAU_PAGE.'&amp;task=files';
-      $linkskip = 'edit.php?page='.WPAU_PAGE.'&amp;task=skipfiles';
-			if(function_exists('wp_nonce_url') ) {
-				 $link = wp_nonce_url($link, 'wordpress_automatic_upgrade');
-         $linkskip = wp_nonce_url($linkskip, 'wordpress_automatic_upgrade');
-			}
-			echo 'Great the preliminiary checks of your server is complete and WPAU is ready to roll. &lt;a href=&quot;'.$link.'&quot;&gt;&lt;strong&gt;Click here&lt;/strong&gt;&lt;/a&gt; so that we can start the upgrade.';
-      echo '&lt;br /&gt;The first step will backup files, &lt;a href=&quot;'.$linkskip.'&quot;&gt;click here&lt;/a&gt; to skip it.';
-?&gt;
-&lt;div id=&quot;wpau-file-download&quot;&gt;
-&lt;/div&gt;
-&lt;div id=&quot;wpau-db-download&quot;&gt;
-&lt;/div&gt;
-&lt;div id=&quot;wpau-update-db&quot;&gt;
-&lt;/div&gt;
-&lt;!--You may also choose the &lt;a href=&quot;#&quot; id=&quot;wpau-automated&quot;&gt;automated version&lt;/a&gt;.--&gt;
-&lt;div id=&quot;wpau-status-bar&quot;&gt;
-    &lt;div id=&quot;wpau-status-bar-indicator&quot;&gt;
-    &lt;/div&gt;
-&lt;/div&gt;
-&lt;div id=&quot;wpau-status-message&quot;&gt;
-&lt;/div&gt;
-&lt;/div&gt;
-&lt;?php
-		}
-?&gt;
-&lt;?php
-		wpauEndHtml();
-		unset($prelimCheck);
-	}
-
-	/** gets the information entered by the user and sanitizes the server files so that we can run the
-	WPAU plugin without any errors **/
-	function wpau_prelim_opts_and_sanatize() {
-		global $wbAbsPath, $isNix;
-
-		$options = get_settings('wpau-params');
-		if ( $_POST['wpau-submit'] ) {
-			$wpau_ftp['ftpuser'] = strip_tags(stripslashes($_POST['wpau-ftpuser']));
-			$wpau_ftp['ftppass'] = strip_tags(stripslashes($_POST['wpau-ftppass']));
-			$wpau_ftp['ftphost'] = strip_tags(stripslashes($_POST['wpau-ftphost']));
-			$wpau_ftp['ftpbasedir'] = strip_tags(stripslashes($_POST['wpau-ftpbasedir']));
-			//only saves it temporarily so that we can run post upgrade steps
-			if ( $options != $wpau_ftp ) {
-				$options = $wpau_ftp;
-				update_option('wpau-params', $options);
-			}
-		}
-
-		require_once('wpau_prelimcheck.class.php');
-		$prelimCheck = new wpauPrelimHelper();
-		$prelimCheck-&gt;ftpUser = $wpau_ftp['ftpuser'];
-		$prelimCheck-&gt;ftpPass = $wpau_ftp['ftppass'];
-		$prelimCheck-&gt;ftpHost = $wpau_ftp['ftphost'];
-		$prelimCheck-&gt;ftpBaseDir = $wpau_ftp['ftpbasedir'];
-		$prelimCheck-&gt;checkFtpMode();
-		if($prelimCheck-&gt;checkFTPCredentials()) {
-			$makeBackUpDir = $_REQUEST['mbd'];
-			if($prelimCheck-&gt;runFTPOperation()) {
-				if('true' == $makeBackUpDir) {
-					if(! $prelimCheck-&gt;makeBackupDir()) {
-						wpauStartHtml();
-						echo '&lt;strong&gt;Oops we cannot run the WordPress Automatic Update on your site. We are currently trying to fix issues for systems like yours and will release a new version shortly.&lt;/strong&gt;';
-						wpauEndHtml();
-						return false;
-					}
-				}
-				wpauStartHtml();
-				$link = 'edit.php?page='.WPAU_PAGE.'&amp;task=files';
-				if(function_exists('wp_nonce_url') ) {
-					 $link = wp_nonce_url($link, 'wordpress_automatic_upgrade');
-				}
-				echo 'Great all done WPAU is ready to roll. &lt;a href=&quot;'.$link.'&quot;&gt;Click here&lt;/a&gt; so that we can start the upgrade.';
-?&gt;
-&lt;div id=&quot;wpau-file-download&quot;&gt;
-&lt;/div&gt;
-&lt;div id=&quot;wpau-db-download&quot;&gt;
-&lt;/div&gt;
-&lt;div id=&quot;wpau-update-db&quot;&gt;
-&lt;/div&gt;
-&lt;!--You may also choose the &lt;a href=&quot;#&quot; id=&quot;wpau-automated&quot;&gt;automated version&lt;/a&gt;.--&gt;
-&lt;div id=&quot;wpau-status-bar&quot;&gt;
-    &lt;div id=&quot;wpau-status-bar-indicator&quot;&gt;
-    &lt;/div&gt;
-&lt;/div&gt;
-&lt;div id=&quot;wpau-status-message&quot;&gt;
-&lt;/div&gt;
-&lt;/div&gt;
-&lt;?php
-				wpauEndHtml();
-			}
-		}
-		else {
-			wpauStartHtml();
-			echo '&lt;p style=&quot;color:red;font-weight:bold&quot;&gt;Oops!!!!! We are unable to connect to the ftp site with the data your provided, could you cross check and give us the data again&lt;/p&gt;';
-?&gt;
-&lt;ol&gt;
-    &lt;li&gt;
-        Provide us with your FTP credentials
-    &lt;/li&gt;
-&lt;/ol&gt;
-&lt;p&gt;
-    &lt;strong&gt;Note:&lt;/strong&gt;
-    We do not store your FTP information with us due to security reasons. Your ftp credentials will only be used to make your site writable by this plugin. You only have to do this once.
-&lt;/p&gt;
-&lt;p&gt;
-    What is your FTP Base Directory. 
-    If you have installed wordpress inside &lt;strong&gt;public_html&lt;/strong&gt;
-    folder then your base ftp directory is &lt;strong&gt;/public_html&lt;/strong&gt;
-    &lt;br/&gt;
-    If your you have installed your wordpress in &lt;strong&gt;public_html/wpau&lt;/strong&gt;
-    folder then your base ftp directory is &lt;strong&gt;/public_html/wpau&lt;/strong&gt;
-    &lt;br/&gt;
-    If you install the wordpress into the root directory then your base directory will be &lt;strong&gt;/&lt;/strong&gt;
-    &lt;br/&gt;
-&lt;/p&gt;
-&lt;form method=&quot;post&quot; name=&quot;getftp&quot; action=&quot;edit.php?page=&lt;?php echo WPAU_PAGE; ?&gt;&amp;task=prelimopts&quot;&gt;
-    &lt;?php
-		if(function_exists('wp_nonce_field')) {
-			wp_nonce_field('wordpress_automatic_upgrade');
-		}
-?&gt;
-    &lt;table class=&quot;editform&quot; width=&quot;500&quot; cellspacing=&quot;2&quot; cellpadding=&quot;5&quot; align=&quot;left&quot;&gt;
-        &lt;tr&gt;
-            &lt;td colspan=&quot;2&quot;&gt;
-                &lt;strong&gt;Provide your FTP Credentials&lt;/strong&gt;
-            &lt;/td&gt;
-        &lt;/tr&gt;
-        &lt;tr&gt;
-            &lt;td&gt;
-                &lt;label for=&quot;disclosurepolicy-title&quot;&gt;
-                    FTP Username
-                &lt;/label&gt;
-            &lt;/td&gt;
-            &lt;td&gt;
-                &lt;input type=&quot;text&quot; id=&quot;wpau-ftpuser&quot; name=&quot;wpau-ftpuser&quot; value=&quot;&quot; style=&quot;width: 95%&quot;/&gt;
-            &lt;/td&gt;
-        &lt;/tr&gt;
-        &lt;tr&gt;
-            &lt;td&gt;
-                &lt;label for=&quot;disclosurepolicy-title&quot;&gt;
-                    FTP Password
-                &lt;/label&gt;
-            &lt;/td&gt;
-            &lt;td&gt;
-                &lt;input type=&quot;password&quot; id=&quot;wpau-ftppass&quot; name=&quot;wpau-ftppass&quot; value=&quot;&quot; style=&quot;width: 95%&quot;/&gt;
-            &lt;/td&gt;
-        &lt;/tr&gt;
-        &lt;tr&gt;
-            &lt;td&gt;
-                &lt;label for=&quot;disclosurepolicy-title&quot;&gt;
-                    FTP Base Directory (The root dir where wordpress is installed)
-                &lt;/label&gt;
-            &lt;/td&gt;
-            &lt;td&gt;
-                &lt;input type=&quot;text&quot; id=&quot;wpau-ftpbasedir&quot; name=&quot;wpau-ftpbasedir&quot; value=&quot;&quot; style=&quot;width: 95%&quot;/&gt;
-            &lt;/td&gt;
-        &lt;/tr&gt;
-        &lt;tr&gt;
-            &lt;td&gt;
-                &lt;label for=&quot;disclosurepolicy-title&quot;&gt;
-                    FTP Host
-                &lt;/label&gt;
-            &lt;/td&gt;
-            &lt;td&gt;
-                &lt;input type=&quot;text&quot; id=&quot;wpau-ftphost&quot; name=&quot;wpau-ftphost&quot; value=&quot;&quot; style=&quot;width: 95%&quot;/&gt;
-            &lt;/td&gt;
-        &lt;/tr&gt;
-        &lt;tr&gt;
-            &lt;td colspan=&quot;2&quot;&gt;
-                &lt;input type=&quot;submit&quot; name=&quot;wpau-submit&quot; id=&quot;wpau-submit&quot; value=&quot;Let's Go&quot; /&gt;
-            &lt;/td&gt;
-        &lt;/tr&gt;
-    &lt;/table&gt;
-&lt;/form&gt;
-&lt;?php
-			wpauEndHtml();
-		}
-	}
-  
-  function wpau_skip_backup_files($automated = false) {
-    
-    if(!current_user_can('edit_files')) {
-				echo 'Oops sorry you are not authorized to do this';
-				return false;
-		}
-    global $task, $theFuncComplete;
-    $task = &quot;files&quot;;
-    wpauPersistNoLog(false, false, $automated);
-		$message = '&lt;span style=&quot;color:red&quot;&gt;File Backup Skipped&lt;/span&gt;&lt;br /&gt;';
-    $theFuncComplete = true;
-    wpauPersist(true, $zipFuncs-&gt;loggedData, $theFuncComplete, $message, true);
-    if($automated) { return $theFuncComplete; }
-  }
-  
-  function wpau_skip_backup_db($automated = false) {
-    
-    if(!current_user_can('edit_files')) {
-				echo 'Oops sorry you are not authorized to do this';
-				return false;
-		}
-    global $task, $theFuncComplete;
-    $task = &quot;backupdb&quot;;
-    wpauPersistNoLog(false, false, $automated);
-		$message = '&lt;span style=&quot;color:red&quot;&gt;Database Backup Skipped&lt;/span&gt;&lt;br /&gt;';
-    $theFuncComplete = true;
-    wpauPersist(true, $zipFuncs-&gt;loggedData, $theFuncComplete, $message, true);
-    if($automated) { return $theFuncComplete; }
-  }
-
-	/**
-	* FUnction to back up the existing wordpress installation files
-	**/
-	function wpau_backup_files($automated = false) {
-		if(!current_user_can('edit_files')) {
-				echo 'Oops sorry you are not authorized to do this';
-				return false;
-		}
-		global $wpauDirPath, $wpAbsPath, $theFuncComplete, $isNix, $wpIncludeDirs;
-		$wpauHelper = new wpauHelper;
-		$dirName = trailingslashit(ABSPATH);
-		$dirName = $dirName . WPAU_BACKUP_DIR;
-		$dirName = trailingslashit($dirName);
-		if(! is_dir($dirName)) {
-			mkdir ($dirName);
-			chmod($dirName, 0757);
-			$wpauHelper-&gt;createIndexes();
-		}
-		else {
-			$wpauHelper-&gt;createIndexes();
-			@chmod($dirName, 0757);
-		}
-
-		wpauPersistNoLog(false, false, $automated);
-		$message = '';
-		require_once('wpau_zip.class.php');
-		$extension = '.zip';
-		$zipFuncs = new wpauZipFuncs($wpAbsPath, $isNix, WPAU_FILES_ZIP, WPAU_BACKUP_DIR, $wpIncludeDirs, $extension);
-		$zipFuncs-&gt;createArchive();
-		if($zipFuncs-&gt;isFileWritten) {
-			$message = '&lt;br /&gt;The files been have been succesfully backed up. &lt;a href=&quot;'.get_bloginfo('wpurl').'/'.WPAU_BACKUP_DIR.'/'.$_SESSION['filesbakname'].'&quot;&gt;DOWNLOAD IT&lt;/a&gt; BEFORE YOU CAN GO AHEAD. &lt;br/&gt;CONTINUE ONLY after verifying that the files have been downloaded&lt;br /&gt;';
-			$theFuncComplete = true;
-		}
-		else {
-			$message = 'The files could not be backed up, cannot continue with the operation';
-			$theFuncComplete = false;
-		}
-		wpauPersist(true, $zipFuncs-&gt;loggedData, $theFuncComplete, $message, true);
-		unset($zipFuncs);
-		unset($wpauHelper);
-		if($automated) { return $theFuncComplete; }
-	}
-
-	/**
-	Shows the database backup options
-	Taken from the plugin Wordpress Database backup created byAustin Matzko.
-	**/
-	function wpau_backup_db_options() {
-		if(!current_user_can('edit_files')) {
-				echo 'Oops sorry you are not authorized to do this';
-				return false;
-		}
-		global $wpAbsPath, $isNix, $theFuncComplete;
-		wpauPersistNoLog(false, false, $automated);
-		$backupDir = WPAU_BACKUP_DIR;
-		require_once('wpau_db_backup.class.php');
-		$wpauDbBackup = new wpauBackup($backupDir);
-		$wpauDbBackup-&gt;backup_menu();
-		$message = '&lt;br /&gt;Table selection complete, please go ahead to complete your database backup&lt;br /&gt;';
-		$theFuncComplete = true;
-		wpauPersist(true, $wpauDbBackup-&gt;loggedData, $theFuncComplete, $message, false);
-		unset($wpauDbBackup);
-	}
-
-	/**
-	Backs up the database tables and saves it to a file
-	Taken from the plugin Wordpress Database backup created byAustin Matzko.
-	**/
-	function wpau_backup_db($automated = false) {
-		if( ! current_user_can('manage_options')) {
-			echo 'Oops sorry you are not authorized to do this';
-			return false;
-		}
-		global $wpAbsPath, $isNix, $theFuncComplete;
-		wpauPersistNoLog(false, false, $automated);
-		$backupDir = WPAU_BACKUP_DIR;
-		$wpauHelper = new wpauHelper;
-		$backupFile = WPAU_DB_ZIP . $wpauHelper-&gt;random(). '.zip';
-		$_SESSION['dbbakname'] = $backupFile;
-		unset($wpauHelper);
-		require_once('wpau_db_backup.class.php');
-		$wpauDbBackup = new wpauBackup($backupDir);
-		if($wpauDbBackup-&gt;perform_backup($automated)) {
-			if($wpauDbBackup-&gt;zip_backup($backupFile)) {
-				$theFuncComplete = true;
-				$message = 'The database has been succesfully backed up. &lt;a href=&quot;'.get_bloginfo('wpurl').'/'.WPAU_BACKUP_DIR.'/'.$_SESSION['dbbakname'].'&quot;&gt;DOWNLOAD IT&lt;/a&gt; BEFORE YOU CAN GO AHEAD. &lt;br/&gt;CONTINUE ONLY after verifying that the files have been downloaded&lt;br /&gt;';
-			}
-			else {
-				$theFuncComplete = false;
-				$message = 'Could not backup your database files, cannot continue with the further process';
-			}
-		}
-		else {
-			$theFuncComplete = false;
-			$message = 'Could not backup your database files, cannot continue with the further process';
-		}
-		wpauPersist(true, $wpauDbBackup-&gt;loggedData, $theFuncComplete, $message, true);
-		unset($wpauDbBackup);
-		if($automated) { return $theFuncComplete; }
-	}
-
-/**
-	* Function to show user an option whether to download files from wordpress site
-	* or allow them to upload a file from their local machine
-	**/
-	function wpau_show_new_version_forms() {
-		global $theFuncComplete;
-		$theFuncComplete = true;
-
-		wpauPersistNoLog(false, false, false);
-	?&gt;
-&lt;script type=&quot;text/javascript&quot; language=&quot;JavaScript&quot;&gt;
-    function showUpload(layerName){
-        document.getElementById(layerName).style.visibility = 'visible';
-        document.getElementById(layerName).style.display = 'inline';
-    }
-    
-    function hideUpload(layerName){
-        document.getElementById(layerName).style.visibility = 'hidden';
-        document.getElementById(layerName).style.display = 'none';
-    }
-&lt;/script&gt;
-&lt;div style=&quot;padding:left:20px;margin-left:30px;&quot;&gt;
-    &lt;br/&gt;
-    &lt;br/&gt;
-    &lt;span&gt;&lt;strong&gt;Get or upload the latest version of Wordpress&lt;/strong&gt;&lt;/span&gt;
-    &lt;p&gt;
-        Ok we are all set with the backups. If you do not have the backup files downloaded, you can download the files backup and the database backup.
-    &lt;/p&gt;
-    &lt;p&gt;
-        To continue with the next step we need to get the upgrade files. You can choose from two options
-        &lt;ol&gt;
-            &lt;li&gt;
-                Allow us to automatically download the files from Wordpress using the following url
-                &lt;br/&gt;
-                http://wordpress.org/latest.zip
-            &lt;/li&gt;
-            &lt;li&gt;
-                WordPress in your language (Coming SOON).
-            &lt;/li&gt;
-        &lt;/ol&gt;
-    &lt;/p&gt;
-    &lt;p&gt;
-        Please complete the form below so we can start the process
-    &lt;/p&gt;
-    &lt;p&gt;
-        NOTE: THIS WILL TAKE BETWEEN 10-300 SECONDS, PLEASE DO NOT REFRESH THE PAGE.
-    &lt;/p&gt;
-    &lt;p&gt;
-        &lt;form name=&quot;wpaunewversion&quot; method=&quot;post&quot; enctype=&quot;multipart/form-data&quot; action=&quot;edit.php?page=&lt;?php echo WPAU_PAGE ?&gt;&amp;task=getlatestfiles&quot;&gt;
-            &lt;?php
-		if(function_exists('wp_nonce_field')) {
-			wp_nonce_field('wordpress_automatic_upgrade');
-		}
-?&gt;
-            &lt;input type=&quot;Radio&quot; name=&quot;subtask&quot; value=&quot;wp-latest-ver&quot; checked=&quot;checked&quot; onchange=&quot;hideUpload('fileupload');&quot;/&gt;&lt;strong&gt;Get the Latest Version from wordpress.org&lt;/strong&gt;
-            (recommended)
-            &lt;br/&gt;
-            &lt;input type=&quot;Radio&quot; name=&quot;subtask&quot; value=&quot;wp-upped-ver&quot; onchange=&quot;showUpload('fileupload');&quot; disabled=&quot;true&quot; /&gt;WordPress in your language. Coming Soon.
-            &lt;br/&gt;
-            &lt;br/&gt;
-            &lt;div id=&quot;fileupload&quot; style=&quot;visibility:hidden;display:none;&quot;&gt;
-                &lt;input type=&quot;File&quot; name=&quot;thefile&quot; accept=&quot;application/x-zip-compressed&quot; /&gt;Choose the file to be uploaded
-                &lt;br/&gt;
-                &lt;br/&gt;
-            &lt;/div&gt;
-            &lt;input type=&quot;Submit&quot; name=&quot;doversiondownload&quot; value=&quot;Lets GO&quot; /&gt;
-        &lt;/form&gt;
-    &lt;/p&gt;
-&lt;/div&gt;
-&lt;?php
-		$loggedData = '';
-		//$message = 'Select the option to start the files download';
-		wpauPersist(true, $loggedData, $theFuncComplete, $message, false);
-	}
-
-	/**
-	* Function to download the latest version from wordpress.org
-	**/
-	function wpau_get_latest_version($automated = false) {
-		if( ! current_user_can('edit_files')) {
-			echo 'Oops sorry you are not authorized to do this';
-			return false;
-		}
-		global $wpAbsPath, $isNix, $theFuncComplete;
-		wpauPersistNoLog(false, false, $automated);
-		require_once('wpau_upgrade.class.php');
-		$upgradeHelper = new wpauUpgradeHelper($wpAbsPath, $isNix, WPAU_BACKUP_DIR, ABSPATH);
-		$subtask = 'wp-latest-ver';
-		if( isset($_REQUEST['subtask']) ) {
-			$subtask = $_REQUEST['subtask'];
-		}
-		if(strcasecmp($subtask, 'wp-upped-ver')) {
-			if (ini_get('allow_url_fopen') == '1') {
-				$downloadURL = 'http://wordpress.org/latest.zip';
-				if($upgradeHelper-&gt;getFilesFromWP($downloadURL)) {
-					$upgradeHelper-&gt;recursive_chmod_directory(ABSPATH . WPAU_BACKUP_DIR);
-					$theFuncComplete = true;
-					$message = 'Successfully downloaded and unzipped all files from '.$downloadURL.'&lt;br /&gt;';
-				}
-				else {
-					$theFuncComplete = false;
-					$message = 'Could not download and unzip the files from '.$downloadURL.'&lt;br /&gt;';
-				}
-			}
-			else {
-				$url = 'www.wordpress.org';
-				$filename = 'latest.zip';
-				if($upgradeHelper-&gt;downloadFilesFromWP($url, $filename)) {
-					$upgradeHelper-&gt;recursive_chmod_directory(ABSPATH . WPAU_BACKUP_DIR);
-					$theFuncComplete = true;
-					$message = 'Successfully downloaded and unzipped all files from '.$downloadURL.'&lt;br /&gt;';
-				}
-				else {
-					$theFuncComplete = false;
-					$message = 'Could not download and unzip the files from '.$downloadURL.'&lt;br /&gt;';
-				}
-			}
-		}
-		else {
-			//read and upload the user file
-			if($upgradeHelper-&gt;getUploadedFilesFromUser($_FILES)) {
-				$theFuncComplete = true;
-				$message = 'Successfully uploaded and unzipped all files &lt;br /&gt;';
-			}
-			else {
-				$theFuncComplete = false;
-				$message = 'Could not upload and unzip all files &lt;br /&gt;';
-			}
-		}
-		wpauPersist(true, $upgradeHelper-&gt;loggedData, $theFuncComplete, $message, true);
-		unset($upgradeHelper);
-		if($automated) { return $theFuncComplete; }
-	}
-
-	/**
-	* Function to show site downtime
-	**/
-	function wpau_site_down($automated = false) {
-		if(!current_user_can('edit_files')) {
-				echo 'Oops sorry you are not authorized to do this';
-				return false;
-		}
-		global $wpauFileDirPath, $wpAbsPath, $isNix, $theFuncComplete;
-		wpauPersistNoLog(false, false, $automated);
-		require_once('wpau_upgrade.class.php');
-		$upgradeHelper = new wpauUpgradeHelper($wpAbsPath, $isNix, WPAU_BACKUP_DIR, ABSPATH);
-		if($upgradeHelper-&gt;doMaintenanceMode($wpauFileDirPath, 'temp-index.php')) {
-			$theFuncComplete = true;
-			$message = 'The site has been put into maintenance mode, &lt;a href=&quot;'.get_bloginfo('wpurl').'&quot; target=&quot;_blank&quot;&gt;click here&lt;/a&gt; (Opens in new window) to confirm';
-		}
-		else {
-			$theFuncComplete = false;
-			$message = 'The site could not be put into maintenance mode.';
-		}
-		wpauPersist(true, $upgradeHelper-&gt;loggedData, $theFuncComplete, $message, true);
-		unset($upgradeHelper);
-		if($automated) { return $theFuncComplete; }
-	}
-
-	/**
-	* Function to de-activate all plugins
-	**/
-	function wpau_deactivate_plugins($automated = false) {
-		if(!current_user_can('edit_plugins')) {
-				echo 'Oops sorry you are not authorized to do this';
-				return false;
-		}
-		global $theFuncComplete;
-		wpauPersistNoLog(false, false, $automated);
-		$thePlugs = array();
-		require_once('wpau_plugin.class.php');
-		$path = &quot;../&quot;;
-		if ($automated) { $path = &quot;../../&quot;; }
-		$currentPlugs = get_option('active_plugins');
-		foreach($currentPlugs as $plugin) {
-
-			if ( wpau_validate_file($path.$plugin) ) {
-				//another wp guys check
-				if (in_array($plugin, $currentPlugs)) {
-					array_push($thePlugs, $plugin);
-				}
-			}
-		}
-		$wpauPluginsHandler = new wpauPluginHandler($thePlugs);
-		if($wpauPluginsHandler-&gt;deActivatePlugins()) {
-			$theFuncComplete = true;
-			$message = 'All the plugins have been de-activated, except for &lt;strong&gt;Wordpress automatic upgrade&lt;/strong&gt; plugin.';
-		}
-		else {
-			$theFuncComplete = false;
-			$message = 'The plugins could not be de-activated. Please click here to manually de-activate the plugin. Please do not de-activate the &lt;strong&gt;Wordpress automatic upgrade&lt;/strong&gt; plugin';
-		}
-		wpauPersist(true, $wpauPluginsHandler-&gt;loggedData, $theFuncComplete, $message, true);
-		unset($wpauPluginsHandler);
-		if($automated) { return $theFuncComplete; }
-	}
-
-	/**
-	* Function to upgrade the latest files and run the upgrade.php
-	**/
-	function wpau_upgrade_installation($automated = false) {
-		if(!current_user_can('edit_files')) {
-				echo 'Oops sorry you are not authorized to do this';
-				return false;
-		}
-		global $wpAbsPath, $isNix, $theFuncComplete;
-		wpauPersistNoLog(false, false, $automated);
-		require_once('wpau_upgrade.class.php');
-		$upgradeHelper = new wpauUpgradeHelper($wpAbsPath, $isNix, WPAU_BACKUP_DIR, ABSPATH);
-		if($upgradeHelper-&gt;upgradeFiles()) {
-			$theFuncComplete = true;
-			$message = 'Congratulations!!! All the files have been upgraded to the latest version. Please &lt;a href=&quot;'.get_bloginfo('wpurl').'/wp-admin/upgrade.php&quot; target=&quot;_blank&quot;&gt;CLICK HERE TO COMPLETE THE FINAL STEP&lt;/a&gt; (opens in new window and will show you a upgrade link only if database has to be upgraded) and come back here to reactivate your plugins';
-      $message .= 'Note: While re-activating plugins WordPress may log you out, but do not worry WPAU will take care of the logout and finish the upgrade like normal once you login, just remember to stay in this window and click on the link to re-activate your plugins.';
-		}
-		else {
-			$theFuncComplete = false;
-			$message = 'Oops!! we could not upgrade your files. All the files have been reverted to the older version.';
-		}
-
-		wpauPersist(true, $upgradeHelper-&gt;loggedData, $theFuncComplete, $message, true);
-		unset($upgradeHelper);
-		if($automated) { return $theFuncComplete; }
-	}
-
-	function wpau_update_database($automated = false) {
-		if(!current_user_can('edit_files')) {
-				echo 'Oops sorry you are not authorized to do this';
-				return false;
-		}
-		global $wpAbsPath, $isNix, $theFuncComplete;
-		wpauPersistNoLog(false, false, $automated);
-		require_once('wpau_upgrade.class.php');
-		$upgradeHelper = new wpauUpgradeHelper($wpAbsPath, $isNix, WPAU_BACKUP_DIR, ABSPATH);
-		if($upgradeHelper-&gt;updateDatabase()) {
-			$theFuncComplete = true;
-			$message = 'Your WordPress database has been successfully upgraded!';
-		}
-		else {
-			$theFuncComplete = false;
-			$message = 'Your wordpress database could not be upgraded succesfully. &lt;a href=&quot;'.get_bloginfo('wpurl').'/wp-admin/upgrade.php&quot; target=&quot;_blank&quot;&gt;Click here&lt;/a&gt; to manually upgrade before re-activating the plugins.';
-		}
-		wpauPersist(true, $upgradeHelper-&gt;loggedData, $theFuncComplete, $message, true);
-		unset($upgradeHelper);
-		if($automated) { return $theFuncComplete; }
-	}
-
-	/**
-	* Function to activate the plugins
-	**/
-	function wpau_reactivate_plugins($automated = false) {
-		if(!current_user_can('edit_plugins')) {
-				echo 'Oops sorry you are not authorized to do this';
-				return false;
-		}
-		global $theFuncComplete, $wpdb;
-		wpauPersistNoLog(false, false, $automated);
-		require_once('wpau_plugin.class.php');
-		$thePlugs = array();
-		$wpauPluginsHandler = new wpauPluginHandler($thePlugs);
-		if($wpauPluginsHandler-&gt;reActivatePlugins($automated)) {
-			$plugins = $wpdb-&gt;get_results(&quot;select plugin_name from &quot;.WPAU_PLUGIN_TABLE.&quot; where fatal_plugin = 1&quot;);
-			if(count($plugins) &gt; 0)  {
-				foreach($plugins as $plugin) {
-					$message .= '&lt;span style=&quot;color:red&quot;&gt;The Plugin &lt;strong&gt;'.$plugin-&gt;plugin_name.'&lt;/strong&gt; could not be activated succesfully. You will need to activate it manually.&lt;/span&gt;&lt;br&gt;';
-				}
-			}
-			else {
-				$message = 'The plugins have been reactivated succesfully';
-			}
-			$theFuncComplete = true;
-		}
-		else {
-			$theFuncComplete = true;
-			$message = 'The plugin could not be activated, please activate the plugins manually';
-		}
-		$wpau_ftp = get_settings('wpau-params');
-		if($wpau_ftp['ftpuser'] != '') {
-			do_ftp_sanitize_operations($wpau_ftp);
-		}
-		$wpau_ftp['ftpuser'] = '';
-		$wpau_ftp['ftppass'] = '';
-		$wpau_ftp['ftphost'] = '';
-		$wpau_ftp['ftpbasedir'] = '';
-		//remove the ftp information from the db
-		update_option('wpau-params', $wpau_ftp);
-
-		wpauPersist(true, $wpauPluginsHandler-&gt;loggedData, $theFuncComplete, $message, true);
-		unset($wpauPluginsHandler);
-		if($automated) { return $theFuncComplete; }
-	}
-
-	function do_ftp_sanitize_operations($wpau_ftp, $automated = false) {
-		require_once('wpau_prelimcheck.class.php');
-		$prelimCheck = new wpauPrelimHelper(ABSPATH, $isNix, true);
-		$prelimCheck-&gt;ftpUser = $wpau_ftp['ftpuser'];
-		$prelimCheck-&gt;ftpPass = $wpau_ftp['ftppass'];
-		$prelimCheck-&gt;ftpHost = $wpau_ftp['ftphost'];
-		$prelimCheck-&gt;ftpBaseDir = $wpau_ftp['ftpbasedir'];
-		$prelimCheck-&gt;checkFtpMode();
-		if($prelimCheck-&gt;checkFTPCredentials()) {
-			$prelimCheck-&gt;runFTPOperation();
-		}
-		unset($prelimCheck);
-	}
-
-	/** cleans up all the upgradation files**/
-	function wpau_cleanup($automated = false) {
-		if(!current_user_can('edit_files')) {
-				echo 'Oops sorry you are not authorized to do this';
-				return false;
-		}
-		global $wpAbsPath, $isNix, $theFuncComplete;
-		$loggedData =  '&lt;strong&gt;Congratulations your wordpress upgrade is complete&lt;/strong&gt;';
-		require_once('wpau_upgrade.class.php');
-		$upgradeHelper = new wpauUpgradeHelper($wpAbsPath, $isNix, WPAU_BACKUP_DIR, ABSPATH);
-		$upgradeHelper-&gt;cleanUpProcess();
-		$returnHome = $_REQUEST['returnhome'];
-		if($returnHome) {
-			unset($upgradeHelper);
-			//the wp_redirect does not work on some sites
-			//as we already included header above while loading the plugin use plain old js
-			//wp_redirect('edit.php?page='.WPAU_PAGE);
-?&gt;
-&lt;script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;&gt;
-    window.location = &quot;&lt;?php echo 'edit.php?page='.WPAU_PAGE;?&gt;&quot;;
-&lt;/script&gt;
-&lt;?php
-		}
-
-		$loggedData .= '&lt;p&gt;We have cleaned up all your upgradation files&lt;/p&gt;';
-		$message = '&lt;p&gt;We have cleaned up all your upgradation files&lt;/p&gt;';
-		wpauStartHtml();
-		$theFuncComplete = true;
-		echo '&lt;strong&gt;'.$message.'&lt;/strong&gt;';
-		echo &quot;&lt;hr /&gt;&lt;strong&gt;TASK STATUS&lt;/strong&gt;&lt;br /&gt;&lt;hr /&gt;&quot;;
-		echo $loggedData.'&lt;br /&gt;&lt;br /&gt;';
-		unset($upgradeHelper);
-		wpauEndHtml();
-		if($automated) { return $theFuncComplete; }
-	}
-
-	/**
-	* Function to show the log for the upgrade
-	**/
-	function wpau_show_backup_log($automated = false) {
-		global $wpdb;
-		$logData = '';
-		wpauStartHtml();
-		echo '&lt;strong&gt;Congratulations!!! Your Wordpresss installation has been upgraded.&lt;/strong&gt;';
-		echo '&lt;br /&gt;&lt;strong&gt;Please download your backup files if you have not done it.&lt;/strong&gt;&lt;br /&gt;';
-		echo '&lt;a href=&quot;'.get_bloginfo('wpurl').'/'.WPAU_BACKUP_DIR.'/'.$_SESSION['filesbakname'].'&quot;&gt;DOWNLOAD FILES BACKUP&lt;/a&gt;&lt;br /&gt;';
-		echo '&lt;a href=&quot;'.get_bloginfo('wpurl').'/'.WPAU_BACKUP_DIR.'/'.$_SESSION['dbbakname'].'&quot;&gt;DOWNLOAD DATABASE BACKUP&lt;/a&gt;&lt;br /&gt;';
-		echo 'Don\'t forget to run  &lt;a href=&quot;'.get_bloginfo('wpurl').'/wp-admin/upgrade.php&quot; target=&quot;_blank&quot;&gt;Database Upgrade&lt;/a&gt; if you have not done it.';
-		echo 'You can &lt;a href=&quot;edit.php?page='.WPAU_PAGE.'&amp;task=cleanup&quot;&gt;Clean up&lt;/a&gt; the ugradation files once your done';
-		echo &quot;&lt;hr /&gt;&lt;strong&gt;Below is the log for the upgradation&lt;/strong&gt;&lt;br /&gt;&lt;hr /&gt;&quot;;
-		$logData = getDBLog();
-		/*$wpauHelper = new wpauHelper;
-		$dirName = trailingslashit(ABSPATH);
-		$dirName = trailingslashit($dirName);
-		if($wpauHelper-&gt;writeLogToDisk($dirName, WPAU_LOG_FILE, $logData)) {
-			echo '&lt;strong&gt;Click &lt;a href=&quot;'.get_bloginfo('wpurl').'/'.WPAU_LOG_FILE.'&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt; to download the log file&lt;/strong&gt;&lt;br&gt;';
-		}
-		unset($wpauHelper);*/
-		echo $logData;
-		wpauEndHtml();
-	}
-
-	/**
-	* Function to show the log on failure
-	**/
-	function wpau_show_log($automated = false) {
-		global $wpdb;
-		$logData = '';
-		wpauStartHtml();
-		echo '&lt;strong&gt;Some problems did not allow us to upgrade your blog. This most likely ocurred due to file permission issues, you can find a workaround for the issue by visiting &lt;a href=&quot;http://forum.techie-buzz.com/topic.php?id=46&amp;page&amp;replies=1&quot; target=&quot;_blank&quot; title=&quot;Opens in new Window&quot;&gt;this forum post on WPAU forums&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;If that does not solve your problem please post on the forum and I will definitely take a look at the issue.&lt;/strong&gt;';
-		echo &quot;&lt;hr /&gt;&lt;strong&gt;Below is the log for the upgradation&lt;/strong&gt;&lt;br /&gt;&lt;hr /&gt;&quot;;
-		echo getDBLog();
-		wpauEndHtml();
-	}
-
-	function getDBLog() {
-		global $wpdb;
-		$logData = '';
-		$logged = $wpdb-&gt;get_results('SELECT task_name, task_status, task_description, task_log, start_date, end_date from  '.WPAU_LOG_TABLE);
-		if(count($logged) &gt; 0) {
-			foreach($logged as $log) {
-				$taskStatus = $log-&gt;task_status;
-				if($taskStatus) { $taskStatus = 'Complete'; }
-				else { $taskStatus = '&lt;span style=&quot;color:red&quot;&gt;Failed&lt;/span&gt;'; }
-				$logData .= '&lt;strong&gt;Task Name:&lt;/strong&gt;  '. $log-&gt;task_name.'&lt;br&gt;';
-				$logData .= '&lt;strong&gt;Task Description:&lt;/strong&gt; '. $log-&gt;task_description.'&lt;br&gt;';
-				$logData .= '&lt;strong&gt;Task Status:&lt;/strong&gt; '. $taskStatus.'&lt;br&gt;';
-				$logData .= '&lt;strong&gt;Task Start Date:&lt;/strong&gt; '. $log-&gt;start_date.'&lt;br&gt;';
-				$logData .= '&lt;strong&gt;Task End Date:&lt;/strong&gt; '. $log-&gt;end_date.'&lt;br&gt;';
-				$logData .= '&lt;strong&gt;Task Log:&lt;/strong&gt; '. $log-&gt;task_log.'&lt;br&gt;&lt;br&gt;';
-			}
-		}
-		return $logData;
-	}
-
-	/** show start instructions **/
-	function show_upgrade_start() {
-	?&gt;
-&lt;div style=&quot;padding:left:20px;margin-left:30px;&quot;&gt;
-    &lt;br/&gt;
-    &lt;br/&gt;
-    &lt;span&gt;&lt;strong&gt;Starting Wordpress automatic update. &lt;a href=&quot;edit.php?page=&lt;?php echo WPAU_PAGE ?&gt;&amp;task=prelim&quot;&gt;Click to begin&lt;/a&gt;. Here is what we will do&lt;/strong&gt;&lt;/span&gt;
-    &lt;ol&gt;
-        &lt;li&gt;
-            Checks if your server is able to run the process. 
-            &lt;br/&gt;
-            If not asks you to provide your FTP details.
-            &lt;br/&gt;
-            If its running in safe mode this plugin cannot run.
-        &lt;/li&gt;
-        &lt;li&gt;
-            Backup your current files and make if available for you to download
-        &lt;/li&gt;
-        &lt;li&gt;
-            Backup your database and make it available for you to download
-        &lt;/li&gt;
-        &lt;li&gt;
-            Get the latest files via one of the ways below
-            &lt;ul&gt;
-                &lt;li&gt;
-                    Automatically download files from the location OR
-                &lt;/li&gt;
-                &lt;li&gt;
-                    You can provide us with the latest downloaded version. (DOES NOT WORK IN THIS VERSION)
-                &lt;/li&gt;
-            &lt;/ul&gt;
-        &lt;/li&gt;
-        &lt;li&gt;
-            Deactivate your plugins and remember it
-        &lt;/li&gt;
-        &lt;li&gt;
-            Make your site offline
-        &lt;/li&gt;
-        &lt;li&gt;
-            Upgrade your files
-        &lt;/li&gt;
-        &lt;li&gt;
-            Activate your plugins
-        &lt;/li&gt;
-        &lt;li&gt;
-            Make your site online
-        &lt;/li&gt;
-        &lt;li&gt;
-            Provide you with a upgradation log
-        &lt;/li&gt;
-    &lt;/ol&gt;
-    &lt;span&gt;&lt;strong&gt;&lt;a href=&quot;edit.php?page=&lt;?php echo WPAU_PAGE ?&gt;&amp;task=files&quot;&gt;Click to begin now&lt;/a&gt;&lt;/strong&gt;&lt;/span&gt;
-    &lt;div&gt;
-        &lt;div id=&quot;wpau-file-download&quot;&gt;
-        &lt;/div&gt;
-        &lt;div id=&quot;wpau-db-download&quot;&gt;
-        &lt;/div&gt;
-        &lt;div id=&quot;wpau-update-db&quot;&gt;
-        &lt;/div&gt;
-        You may also choose the &lt;a href=&quot;#&quot; id=&quot;wpau-automated&quot;&gt;automated version&lt;/a&gt;.
-        &lt;div id=&quot;wpau-status-bar&quot;&gt;
-            &lt;div id=&quot;wpau-status-bar-indicator&quot;&gt;
-            &lt;/div&gt;
-        &lt;/div&gt;
-        &lt;div id=&quot;wpau-status-message&quot;&gt;
-        &lt;/div&gt;
-    &lt;/div&gt;
-&lt;/div&gt;
-&lt;?php
-	}
-
-	function install() {
-		global $wpdb;
-		$result = mysql_query(&quot;DROP TABLE if exists `wpau_active_plugins_info`&quot;);
-		$result = mysql_query(&quot;
-			CREATE TABLE `wpau_active_plugins_info` (
-			  `id` int(4) NOT NULL auto_increment,
-			  `plugin_name` varchar(255) NOT NULL default '',
-			  `plugin_status` varchar(255) NOT NULL default '',
-				`plugin_deactive_response` smallint(2) NULL default '0',
-				`plugin_reactive_response` smallint(2) NULL default '0',
-				`fatal_plugin` smallint(2) NULL default '0',
-			  PRIMARY KEY  (`id`)
-			) TYPE=MyISAM;
-		&quot;) or die(mysql_error().' on line: '.__LINE__);
-
-		if (!$result) {
-			return false;
-		}
-
-		$result = mysql_query(&quot;DROP TABLE if exists `wpau_upgrade_log`&quot;);
-		$result = mysql_query(&quot;
-			CREATE TABLE `wpau_upgrade_log` (
-			  `id` int(4) NOT NULL auto_increment,
-			  `task_name` varchar(150) NOT NULL default '',
-			  `task_status` varchar(150) NOT NULL default '',
-			  `task_description` varchar(150) NOT NULL default '',
-			  `task_log` text,
-			  `start_date` datetime NOT NULL default '0000-00-00 00:00:00',
-			  `end_date` datetime default NULL,
-			  PRIMARY KEY  (`id`)
-			) TYPE=MyISAM;
-		&quot;) or die(mysql_error().' on line: '.__LINE__);
-
-			if (!$result) {
-				return false;
-			}
-
-	}
-
-
-	function wpau_validate_file($file, $allowed_files = '') {
-		if ( false !== strpos($file, './'))
-			return 1;
-
-		if (':' == substr($file,1,1))
-			return 2;
-
-		if ( !empty($allowed_files) &amp;&amp; (! in_array($file, $allowed_files)) )
-			return 3;
-
-		return 0;
-	}
-
-	/**
-	* checks to see if everything is set first up so that it can be logged properly
-	**/
-	function wpau_init() {
-		global $wpdb, $table_prefix;
-		$wpdb-&gt;upgrade_log = $table_prefix.'upgrade_log';
-		$wpdb-&gt;active_plugins_info = $table_prefix.'active_plugins_info';
-
-		if (isset($_GET['activate']) &amp;&amp; $_GET['activate'] == 'true') {
-			$result = mysql_list_tables(DB_NAME);
-			$tables = array();
-			while ($row = mysql_fetch_row($result)) {
-				$tables[] = $row[0];
-			}
-			if (!in_array($wpdb-&gt;upgrade_log, $tables) &amp;&amp; !in_array($wpdb-&gt;active_plugins_info, $tables)) {
-				install();
-			}
-		}
-	}
-
-	/**
-	* Adds in the necessary JavaScript files for the automated version
-	**/
-	function wpau_add_scripts() {
-		if (function_exists('wp_enqueue_script') &amp;&amp; function_exists('wp_register_script')) {
-			wp_register_script('jquery', get_bloginfo('wpurl') . '/wp-content/plugins/wordpress-automatic-upgrade/js/jquery.js');
-			wp_enqueue_script('wpau_auto_update', get_bloginfo('wpurl') . '/wp-content/plugins/wordpress-automatic-upgrade/js/wp-wpau.js.php', array('jquery'), '0.1');
-		} else {
-			wpau_add_scripts_legacy();
-		}
-	}
-	function wpau_add_scripts_legacy() {
-		if (function_exists('wp_enqueue_script') &amp;&amp; function_exists('wp_register_script')) { wpau_add_scripts(); return; }
-		print('&lt;script type=&quot;text/javascript&quot; src=&quot;'.get_bloginfo('wpurl') . '/wp-content/plugins/wordpress-automatic-upgrade/js/jquery.js&quot;&gt;&lt;/script&gt;'.&quot;\n&quot;);
-		print('&lt;script type=&quot;text/javascript&quot; src=&quot;'.get_bloginfo('wpurl') . '/wp-content/plugins/wordpress-automatic-upgrade/js/wp-wpau.js.php&quot;&gt;&lt;/script&gt;'.&quot;\n&quot;);
-	}
-	add_action('admin_print_scripts', 'wpau_add_scripts');
-	add_action('admin_head', 'wpau_add_scripts_legacy');
-	add_action('admin_menu', 'wpau_manage_page');
-  add_action('admin_notices', 'wpau_add_nag', 3 );
-
-?&gt;
+&lt;?php
+/*
+Plugin Name: Wordpress Automatic Upgrade
+Plugin URI: http://techie-buzz.com/wordpress-plugins/wordpress-automatic-upgrade-12-release.html
+Description: Wordpress Automatic Upgrade allows a user to automatically upgrade the wordpress installation to the latest one provided by wordpress.org using the 5 steps provided in the wordpress upgrade instructions. Go to &lt;a href=&quot;edit.php?page=wordpress-automatic-upgrade/wordpress-automatic-upgrade.php&quot;&gt;Wordpress Automatic Upgrade&lt;/a&gt; to upgrade your installation Thanks to &lt;a href=&quot;http://www.ronalfy.com&quot;&gt;Ronald Huereca&lt;/a&gt;  for making the plugin run in automatic mode.
+Version: 1.2.2
+Author: Keith Dsouza
+Author URI: http://techie-buzz.com/
+
+Wordpress automatic upgrade upgrades your wordpress installation by doing the following steps.
+
+1. Backs up the files and makes available a link to download it.
+2. Backs up the database and makes available a link to download it.
+3. Downloads the latest files from http://wordpress.org/latest.zip and unzips it.
+4. Puts the site in maintenance mode.
+5. De-activates all active plugins and remembers it.
+6. Upgrades wordpress files.
+7. Gives you a link that will open in a new window to upgrade installation.
+8. Re-activates the plugins.
+
+The plugin can  also can be run in a automated mode where in you do not have to click on any links to go to the next step.
+
+Usage Instructions
+-------------------------
+
+Go to Manage -&gt; Automatic Upgrade and either click on the link provided to run or use the automated version link to let the plugin run in a automated way.
+
+Change Log
+---------------
+
+@version 0.4
+1. Added a prelim check before starting the process to check whether or not we can write files to the server
+2. Checks if previous version files were not cleared
+3. If we cannot write the files to server asking user for ftp credentials so that we can make the permission changes
+4. Fixed bug where task status was not reported on error thus showing a db error to the user
+5. Fixed a bug where open_basedir restriction is on for a website hosted as virtual folder
+
+@version 0.5
+
+1. Fixed bugs where user had a www folder with full write permissions but the public_html folder was not writable.
+2. Fixed issue where while writing there were ftp errors while creating backup directory but still plugin said all ready to go
+3. Fixed issue where plugins were not activating even if one plugin threw an error.
+4. Fixed other issues with html and reporting
+
+@version 0.6
+bug fixes for security
+
+@version 0.7
+fixes for blogs that have the wordpress setup in a different directory and run the blog on a different directory
+
+@version 0.8
+Fix for database table name changes in WordPress 2.3 this should only affect blogs that are running WordPress 2.3 while running the Automatic Upgrade.
+
+@version 1.0
+Finally out for a release version as it has worked with more than 10 releases of WordPress updates
+
+This version basically fixes a issue with automatic plugin updates caused due to PCLZip library which is included used by WordPress plugin update code
+now checks in place to see that while plugins are being updated we silently drop the library inclusion
+
+@version 1.1
+Changed short tags to use full php tags which was breaking activation of the plugin when short tags were disabled on the server end.
+
+@version 1.2
+
+Fixed a major issue where plugins were not being activated after the upgrade was done. This bug was only seen in WordPress 2.5 and above since they clear out the cookies after the upgrade has comepleted.
+Changed all the urls to use wpurl instead of using siteurl
+Isolated view of the WordPress Automatic Updated Link to only the Administartors of the blog
+Uses Snoopy to downloading updates.
+Added a Nag to Update using WPAU
+Removed Automated Update mode
+Several other minor bug fixes
+
+@1.2.0.1
+updated user debug messages
+
+@1.2.0.2
+change snoopy class name to internal to fix a issue with snoopy being loaded after WP loaded and no checks in place
+
+@1.2.1
+Allows users to skip db and file backups since several users with big databases have
+reported for this feature
+
+@1.2.2
+Added nag to cleanup files from previous upgrade
+Does not write the log file to disk anymore
+Fixed a issue for including wp-config file
+
+
+
+Thanks to all who reported the bugs and helped me make this plugin better, if you still see any bugs please email me at dsouza.keith@gmail.com
+
+Copyright 2007  Keith Dsouza  (email : dsouza.keith at gmail.com)
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+
+@define('WPAU_PAGE', 'wordpress-automatic-upgrade/wordpress-automatic-upgrade.php');
+@define('WPAU_BACKUP_DIR', 'wpau-backup');
+@define('WPAU_FILES_ZIP', 'wpau-files-bak');
+@define('WPAU_DB_ZIP', 'wpau-db-backup');
+@define('WPAU_LOG_FILE', 'wpau-log-data.txt');
+@define('WPAU_PLUGIN_TABLE', 'wpau_active_plugins_info');
+@define('WPAU_LOG_TABLE', 'wpau_upgrade_log');
+@define('WPAU_PLUGIN', 'wordpress-automatic-upgrade/wordpress-automatic-upgrade.php');
+
+	session_start();
+	$serverSoft = $_SERVER['SERVER_SOFTWARE'];
+	$isNix = true;
+	if(stristr($serverSoft, &quot;win32&quot;) !== false) {
+		$isNix = false;
+	}
+
+	if($isNix)
+		@define('WPAU_FILEPATH', 'wp-content/plugins/wordpress-automatic-upgrade');
+	else
+		@define('WPAU_FILEPATH', 'wp-content\plugins\wordpress-automatic-upgrade');
+
+	//the logger class
+	require_once('wpau_helper.class.php');
+
+
+	$wpauDirPath = get_bloginfo('wpurl') . WPAU_FILEPATH;
+	$wpauFileDirPath = ABSPATH. WPAU_FILEPATH;
+	$wpAbsPath = ABSPATH;
+	$wpIncludeDirs = array('wp-admin', 'wp-includes');
+	$wpAllowedExt = array('zip');
+	$theFuncComplete = false;
+	$wpauMessage = '';
+	$isAutomated = false;
+
+	$task_list = array(
+		'files',
+		'backupdbopt',
+		'backupdb',
+		'newversionoption',
+		'getlatestfiles',
+		'maintmode',
+		'de-plugin',
+		'upgrade',
+		're-plugin',
+	);
+
+
+	$task_description = array(
+		'Backs up all the current files from the wordpress installation',
+		'Shows you the options to backup your database',
+		'Backs up the database file',
+		'Shows you the options to upload latest files',
+		'Downloads / Uploads the latest files for wordpress',
+		'Puts the site into maintenance mode',
+		'De-activates all the plugins',
+		'Upgrades all the installation files',
+		'Re-activates all the plugins that were active earlier'
+	);
+
+	$automated_task_list = array(
+		'files',
+		'backupdb',
+		'getlatestfiles',
+		'maintmode',
+		'de-plugin',
+		'upgrade',
+		're-plugin'
+	);
+  
+  $skip_tasks_list = array (
+    'backupdbopt',
+    'files'
+  );
+
+	$automated_task_description = array(
+		'Backs up all the current files from the wordpress installation',
+		'Backs up the database file',
+		'Downloads / Uploads the latest files for wordpress',
+		'Puts the site into maintenance mode',
+		'De-activates all the plugins',
+		'Upgrades all the installation files',
+		'Re-activates all the plugins that were active earlier',
+		'Cleans up all the upgradation files'
+	);
+
+	if( isset($_REQUEST['task']) ) {
+		$task = $_REQUEST['task'];
+	}
+
+
+
+	if (isset($wpdb)) {
+		wpau_init();
+	}
+
+
+	function wpau_manage_page() {
+		//add_menu_page('Automatic Upgrade', 'Automatic Upgrade', 0, 'wordpress-automatic-upgrade/wordpress-automatic-upgrade.php' , 'wp_automatic_upgrade');
+		add_submenu_page('edit.php', 'Automatic Upgrade', 'Automatic Upgrade', 10, 'wordpress-automatic-upgrade/wordpress-automatic-upgrade.php', 'wp_automatic_upgrade');
+	}
+  
+  function wpau_add_nag($msg) {
+	$cur = get_option( 'update_core' );
+    	$uplink = 'edit.php?page='.WPAU_PAGE;
+    	$cllink = 'edit.php?page='.WPAU_PAGE.'&amp;task=cleanup&amp;returnhome=1';
+	if(function_exists('wp_nonce_url') ) {
+		$uplink = wp_nonce_url($uplink, 'wordpress_automatic_upgrade');
+		$cllink = wp_nonce_url($cllink, 'wordpress_automatic_upgrade');
+	}
+    
+  	if ( ! isset( $cur-&gt;response ) || $cur-&gt;response != 'upgrade' ) {
+  	  require_once('wpau_prelimcheck.class.php');
+      $prelimCheck = new wpauPrelimHelper();
+  	  if($prelimCheck-&gt;checkCleanUpRequired()) {
+  	    if ( current_user_can('manage_options') ) {
+  	      $msg = sprintf( __('You have not cleaned up the files from last upgrade. Please &lt;a href=&quot;%3$s&quot;&gt;Click Here&lt;/a&gt; to cleanup the files, and disable this nag.'), $cur-&gt;url, $cur-&gt;current, $cllink );
+          echo &quot;&lt;div id='update-nag'&gt;$msg&lt;/div&gt;&quot;;
+  	    }	
+  	  }
+      unset($prelimCheck);
+	  return false;
+	 }
+
+	if ( current_user_can('manage_options') ) {
+	  $msg = sprintf( __('&lt;a href=&quot;%3$s&quot;&gt;Click Here&lt;/a&gt; to Automatically Upgrade WordPress to latest Version.'), $cur-&gt;url, $cur-&gt;current, $uplink );
+	  echo &quot;&lt;div id='update-nag'&gt;$msg&lt;/div&gt;&quot;;
+	}
+  }
+
+	function wp_automatic_upgrade() {
+		if( ! user_can_access_admin_page()) {
+			return false;
+		}
+
+		if(isset($_REQUEST['_wpnonce']) ) {
+			if(function_exists('check_admin_referer')) {
+				check_admin_referer('wordpress_automatic_upgrade');
+			}
+		}
+
+		global $task;
+		switch($task) {
+			case 'start':
+				show_upgrade_start();
+				break;
+			case 'files':
+				wpau_backup_files();
+				break;
+      case 'skipfiles':
+				wpau_skip_backup_files();
+				break;
+			case 'backupdbopt':
+				wpau_backup_db_options();
+				break;
+      case 'skipbackupdbopt':
+				wpau_skip_backup_db();
+				break;
+			case 'backupdb':
+				wpau_backup_db();
+				break;
+			case 'newversionoption':
+				wpau_show_new_version_forms();
+				break;
+			case 'getlatestfiles':
+				wpau_get_latest_version();
+				break;
+			case 'maintmode':
+				wpau_site_down();
+				break;
+			case 'de-plugin':
+				wpau_deactivate_plugins();
+				break;
+			case 'upgrade':
+				wpau_upgrade_installation();
+				break;
+			case 'updatedb':
+				wpau_update_database();
+				break;
+			case 're-plugin':
+				wpau_reactivate_plugins();
+				break;
+			case 'cleanup':
+				wpau_cleanup();
+				break;
+			case 'done':
+				wpau_show_backup_log();
+				break;
+			case 'logs':
+				wpau_show_log();
+				break;
+			case 'prelimopts':
+				wpau_prelim_opts_and_sanatize();
+				break;
+      case 'skiptask':
+        wpau_skip_task();
+			default:
+				wpau_run_prelims();
+				break;
+		}
+	}
+
+	/** adds the initial task to the database **/
+	function wpauPersistNoLog($isUpdate, $showOutput = false, $automated = false) {
+		if(isset($_REQUEST['_wpnonce']) ) {
+			if(function_exists('check_admin_referer')) {
+				check_admin_referer('wordpress_automatic_upgrade');
+			}
+		}
+		global $isAutomated;
+		$isAutomated = $automated;
+		wpauPersist($isUpdate, '', false, '', $showOutput);
+	}
+
+	/** logs the output for a current task **/
+	function wpauPersist($isUpdate, $theLog = '', $funcComplete = false, $message = '', $showOutput = true) {
+		global $task, $wpdb, $task_list, $automated_task_list, $task_description, $automated_task_description, $isAutomated, $theFuncComplete;
+		$datetime = date('Y-m-d H:i:s');
+		if($isAutomated) {
+			$currentPos = $task - 1;
+			$taskname = $automated_task_list[$currentPos];
+			$currentTaskDescription = $automated_task_description[$currentPos];
+		}
+		else {
+			$currentPos = array_search($task, $task_list);
+			$currentTaskDescription = $task_description[$currentPos];
+			$taskname = $task;
+		}
+
+		if(! $isUpdate) {
+			checkEntryAndDelete($task);
+			//ok this is the first time the task is called so run a insert on the db
+			$wpdb-&gt;query('INSERT into '.WPAU_LOG_TABLE.' (task_name, task_status, task_description, task_log, start_date)
+						values (\''.$taskname.'\', 0, \''.$currentTaskDescription.'\' , \'\', \''.$datetime.'\')');
+			return;
+		}
+		else {
+			if($theFuncComplete == true)
+				$functionStatus = 1;
+			else
+				$functionStatus = 0;
+
+			$wpdb-&gt;query('UPDATE '.WPAU_LOG_TABLE.' set task_status = '.$functionStatus.', task_log = \''.mysql_real_escape_string($theLog).'\', end_date = \''.$datetime.'\' where task_name = \''.mysql_real_escape_string($taskname).'\'');
+			if($isAutomated) return $theFuncComplete;
+			if($theFuncComplete) {
+				getWpauNextPage($task, $message, $showOutput);
+			}
+			else {
+				$link = 'edit.php?page='.WPAU_PAGE.'&amp;task=logs';
+				if(function_exists('wp_nonce_url') ) {
+					 $link = wp_nonce_url($link, 'wordpress_automatic_upgrade');
+				}
+				echo 'We could not complete the upgrade please try again later, &lt;a href=&quot;'.$link.'&quot;&gt;click here&lt;/a&gt; to check the logs.';
+			}
+		}
+	}
+  
+	/** start html **/
+	function wpauStartHtml() {
+?&gt;
+&lt;div align=&quot;left&quot; style=&quot;margin-left:30px;&quot;&gt;
+    &lt;br/&gt;
+    &lt;br/&gt;
+    &lt;div&gt;
+        &lt;strong style=&quot;font-size:20px;&quot;&gt;Wordpress automatic upgrade&lt;/strong&gt;
+        &lt;p&gt;
+            Upgrades your wordpress installation automatically. If this plugin helped you, you can contribute towards plugin development by &lt;a href=&quot;https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&amp;business=dsouza.keith@gmail.com&amp;currency_code=&amp;amount=&amp;return=&amp;item_name=WordPress+Plugin+Development+Donation&quot; target=&quot;_blank&quot; title=&quot;Opens in New Window&quot;&gt;Donating to me&lt;/a&gt;.
+        &lt;/p&gt;
+        &lt;p&gt;
+            &lt;strong&gt;
+                &lt;u&gt;
+                    TASK OUTPUT
+                &lt;/u&gt;
+            &lt;/strong&gt;
+        &lt;/p&gt;
+        &lt;?php
+	}
+
+	/** end html **/
+	function wpauEndHtml() {
+?&gt;
+    &lt;/div&gt;
+&lt;/div&gt;
+&lt;div style=&quot;clear:both&quot;&gt;
+&lt;/div&gt;
+&lt;?php
+	}
+
+	/** if we are re-running the task we need to clear up old logs **/
+	function checkEntryAndDelete($task) {
+		//sometimes we need to retry tasks so we do it here such that we do not have duplicate entry for same task
+		global $wpdb;
+		$logs = $wpdb-&gt;get_results('SELECT id  from '.WPAU_LOG_TABLE.' where task_name = \''.$task.'\'');
+		if(count($logs) &gt; 0) {
+			$wpdb-&gt;query('DELETE from '.WPAU_LOG_TABLE.' where task_name = \''.$task.'\'');
+		}
+	}
+
+	/** clears all the upgraded data from the tables **/
+	function clearUpgradeData() {
+		global $wpdb;
+		wpau_init();
+		$wpdb-&gt;query('truncate table '. WPAU_LOG_TABLE);
+		$wpdb-&gt;query('truncate table '. WPAU_PLUGIN_TABLE);
+	}
+
+	/** builds the output and creates a link to the next task if any exists **/
+	function getWpauNextPage($task, $message, $showOutput = true) {
+		global $task_list, $task_description, $theFuncComplete, $skip_tasks_list;
+		//ensure multiple checks so that if previous task is not complete we
+		//do not do the next step as all are inter-dependent
+		$currentPos = array_search($task, $task_list);
+
+		$currentTaskDescription = $task_description[$currentPos];
+
+		//check if we have more tasks
+		if($currentPos + 1 &lt; count($task_list)) {
+			$nextTask = $task_list[$currentPos + 1];
+			$nextTaskDescription = $task_description[$currentPos + 1];
+		}
+		else {
+			$nextTask = 'done';
+			$nextTaskDescription = 'Congratulations your wordpress upgrade is complete.';
+		}
+		$nextLink = 'edit.php?page='.WPAU_PAGE.'&amp;task='.$nextTask;
+		if(function_exists('wp_nonce_url') &amp;&amp; &quot;re-plugin&quot; != $nextTask ) {
+			 $nextLink = wp_nonce_url($nextLink, 'wordpress_automatic_upgrade');
+		}
+		if($currentPost &gt; count($task_list) || $currentPos &lt; 0 ) {
+			$link = 'edit.php?page='.WPAU_PAGE;
+			if(function_exists('wp_nonce_url') ) {
+				 $link = wp_nonce_url($link, 'wordpress_automatic_upgrade');
+			}
+			$message .= 'Sorry you came across a weird task that was not to be there. Please &lt;a href=&quot;'.$link.'&quot;&gt;click here&lt;/a&gt; to restart again once more';
+			$theFuncComplete = false;
+		}
+
+		if($showOutput &amp;&amp; $theFuncComplete) {
+			wpauStartHtml();
+			echo '&lt;strong&gt;'.$message.'&lt;/strong&gt;';
+			echo &quot;&lt;hr /&gt;&lt;strong&gt;TASK STATUS&lt;/strong&gt;&lt;br /&gt;&lt;hr /&gt;&quot;;
+			echo '&lt;strong&gt;We succesfully completed the task which&lt;/strong&gt;, '.$currentTaskDescription.'. &lt;br /&gt;&lt;br /&gt;
+			&lt;strong&gt;Next Task -&gt;&lt;/strong&gt; '.$nextTaskDescription.'
+			&lt;br /&gt;&lt;br /&gt;Please &lt;a href=&quot;'.$nextLink.'&quot;&gt;CLICK HERE&lt;/a&gt; to go to the next task.';
+      //check if this can be skipped and add a link for it
+      if(in_array($nextTask, $skip_tasks_list)) {
+        $skipLink = 'edit.php?page='.WPAU_PAGE.'&amp;task=skip'.$nextTask;
+		    if(function_exists('wp_nonce_url')) {
+			   $skipLink = wp_nonce_url($skipLink, 'wordpress_automatic_upgrade');
+		    }
+        echo '&lt;br /&gt;&lt;a href=&quot;'.$skipLink.'&quot;&gt;Click here&lt;/a&gt; to skip this task.';
+      }
+			wpauEndHtml();
+		}
+		else if (! $theFuncComplete) {
+			wpauStartHtml();
+			echo '&lt;strong&gt;Sorry something went wrong we cannot continue further with this process&lt;/strong&gt;';
+			$link = 'edit.php?page='.WPAU_PAGE;
+			if(function_exists('wp_nonce_url') ) {
+				 $link = wp_nonce_url($link, 'wordpress_automatic_upgrade');
+			}
+			echo '&lt;p&gt;Please &lt;a href=&quot;'.$link.'&quot;&gt;click here&lt;/a&gt; to start over again&lt;/p&gt;';
+			wpauEndHtml();
+		}
+
+	}
+
+	function wpau_show_reactivate_plugins($automated = false) {
+		echo 'Congratulations!!! All the files have been upgraded to the latest version. Please &lt;a href=&quot;'.get_bloginfo('wpurl').'/wp-admin/upgrade.php&quot; target=&quot;_blank&quot;&gt;CLICK HERE TO COMPLETE DATABASE UPGRADE&lt;/a&gt; (opens in new window and will show you a upgrade link only if database has to be upgraded) and come back here to reactivate your plugins&lt;br&gt;';
+		$link = 'edit.php?page='.WPAU_PAGE.'&amp;task=re-plugin';
+    //skip this for now
+		/*if(function_exists('wp_nonce_url') ) {
+			 $link = wp_nonce_url($link, 'wordpress_automatic_upgrade');
+		}*/
+		echo '&lt;strong&gt;&lt;a href=&quot;'.$link.'&quot;&gt;PLEASE CLICK HERE TO RE-ACTIVATE YOUR PLUGINS. AFTER YOU HAVE UPGRADED DATABASE&lt;/a&gt;&lt;/strong&gt;';
+	}
+
+	/** runs thorough preliminary checks to see if we can run WPAU on the user's server **/
+	function wpau_run_prelims() {
+		global $wbAbsPath, $isNix, $wpdb;
+		$count = $wpdb-&gt;get_results('SELECT count(*) as counter from '.WPAU_LOG_TABLE);
+		if($counter &gt; 0) {
+			if($count-&gt;counter &gt; 0)
+				clearUpgradeData();
+		}
+
+		//clearUpgradeData();
+		$extra = '';
+		require_once('wpau_prelimcheck.class.php');
+		wpauStartHtml();
+		echo &quot;&lt;hr /&gt;&lt;strong&gt;TASK STATUS&lt;/strong&gt;&lt;br /&gt;&quot;;
+		echo &quot;We conducted some preliminary checks on your server. Below is the output&lt;hr /&gt;&quot;;
+		$canWPAURun = true;
+		$ftpError = false;
+		$allClear = true;
+		$message = '';
+		$severeError = '';
+		$prelimCheck = new wpauPrelimHelper();
+    
+    //new check to see if upgrade is required
+
+    if( ! $prelimCheck-&gt;runUpgradeRequiredCheck()) {
+     echo &quot;&lt;strong&gt;Congratulations!!! Your WordPress version is already up to date.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&quot;;
+     if($prelimCheck-&gt;checkCleanUpRequired()) {
+			echo 'There are some old files from previous installation. Please &lt;a href=&quot;edit.php?page='.WPAU_PAGE.'&amp;task=cleanup&amp;returnhome=1&quot;&gt;click here to run the clean up process before continuing&lt;br&gt;';
+		 }
+      unset($prelimCheck);
+      wpauEndHtml();
+      return false; 
+    }
+
+		if($prelimCheck-&gt;checkCleanUpRequired()) {
+			echo 'Seems you have not completed the clean up process from last upgrade. Please &lt;a href=&quot;edit.php?page='.WPAU_PAGE.'&amp;task=cleanup&amp;returnhome=1&quot;&gt;click here to run the clean up process before continuing&lt;br&gt;';
+			wpauEndHtml();
+			unset($prelimCheck);
+			return false;
+		}
+
+		if(! $prelimCheck-&gt;runFTPPrelimChecks()) {
+			$message .= 'Server does not allow us to write to your wordpress directory&lt;br /&gt;
+			In order to continue you need to do one of the two things&lt;br /&gt;';
+			$ftpError = true;
+			$allClear = false;
+		}
+		else if(ini_get('safe_mode')) {
+			//safe mode man cannot run
+			$severeError =  'Your server is running in safe mode. WPAU cannot continue in safe mode. Please ask your system administrator to change the setting to disble running in safe mode';
+			$canWPAURun = false;
+		}
+		else if (!function_exists('gzopen')) {
+			//urgh no zip support can't run
+			$severeError =  'Oops your server does not support zip functions which is core to some of the funcionalities of this plugin. Sorry but we cannot continue. Please ask your server administrator to turn on zip support';
+			$canWPAURun = false;
+		}
+
+		if(! $prelimCheck-&gt;canMakeBackupDir) {
+			$extra = &quot;mbd=true&quot;;
+		}
+		//site is running in safe mode so we cannot continue
+		if(! $canWPAURun) {
+			echo '&lt;p style=&quot;color:red;font-weight:bold&quot;&gt;'. $severeError.'&lt;/p&gt;';
+			echo '&lt;/p&gt;';
+			wpauEndHtml();
+			unset($prelimCheck);
+			return false;
+		}
+
+		/**
+			ok seems the site is having the ftp issue, show up the form to the user
+			this happens when the ftp user and web users are different on a shared
+			server running multiple sites
+		**/
+		if( $ftpError) {
+			echo '&lt;p style=&quot;color:red;font-weight:bold&quot;&gt;'. $message.'&lt;/p&gt;';
+?&gt;
+&lt;ol&gt;
+    &lt;li&gt;
+        Provide us with your FTP credentials
+    &lt;/li&gt;
+&lt;/ol&gt;
+&lt;p&gt;
+    &lt;strong&gt;Note:&lt;/strong&gt;
+    We do not store your FTP information with us due to security reasons. Your ftp credentials will only be used to make your site writable by this plugin. You only have to do this once.
+&lt;/p&gt;
+&lt;p&gt;
+    What is your FTP Base Directory. 
+    If you have installed wordpress inside &lt;strong&gt;public_html&lt;/strong&gt;
+    folder then your base ftp directory is &lt;strong&gt;/public_html&lt;/strong&gt;
+    &lt;br/&gt;
+    If your you have installed your wordpress in &lt;strong&gt;public_html/wpau&lt;/strong&gt;
+    folder then your base ftp directory is &lt;strong&gt;/public_html/wpau&lt;/strong&gt;
+    &lt;br/&gt;
+    If you install the wordpress into the root directory then your base directory will be &lt;strong&gt;/&lt;/strong&gt;
+    &lt;br/&gt;
+&lt;/p&gt;
+&lt;form method=&quot;post&quot; name=&quot;getftp&quot; action=&quot;edit.php?page=&lt;?php echo WPAU_PAGE; ?&gt;&amp;task=prelimopts&amp;&lt;?php echo $extra; ?&gt;&quot;&gt;
+    &lt;?php
+		if(function_exists('wp_nonce_field')) {
+			wp_nonce_field('wordpress_automatic_upgrade');
+		}
+?&gt;
+    &lt;table class=&quot;editform&quot; width=&quot;500&quot; cellspacing=&quot;2&quot; cellpadding=&quot;5&quot; align=&quot;left&quot;&gt;
+        &lt;tr&gt;
+            &lt;td colspan=&quot;2&quot;&gt;
+                &lt;strong&gt;Provide your FTP Credentials&lt;/strong&gt;
+            &lt;/td&gt;
+        &lt;/tr&gt;
+        &lt;tr&gt;
+            &lt;td&gt;
+                &lt;label for=&quot;disclosurepolicy-title&quot;&gt;
+                    FTP Username
+                &lt;/label&gt;
+            &lt;/td&gt;
+            &lt;td&gt;
+                &lt;input type=&quot;text&quot; id=&quot;wpau-ftpuser&quot; name=&quot;wpau-ftpuser&quot; value=&quot;&quot; style=&quot;width: 95%&quot;/&gt;
+            &lt;/td&gt;
+        &lt;/tr&gt;
+        &lt;tr&gt;
+            &lt;td&gt;
+                &lt;label for=&quot;disclosurepolicy-title&quot;&gt;
+                    FTP Password
+                &lt;/label&gt;
+            &lt;/td&gt;
+            &lt;td&gt;
+                &lt;input type=&quot;password&quot; id=&quot;wpau-ftppass&quot; name=&quot;wpau-ftppass&quot; value=&quot;&quot; style=&quot;width: 95%&quot;/&gt;
+            &lt;/td&gt;
+        &lt;/tr&gt;
+        &lt;tr&gt;
+            &lt;td&gt;
+                &lt;label for=&quot;disclosurepolicy-title&quot;&gt;
+                    FTP Base Directory (The root dir where wordpress is installed)
+                &lt;/label&gt;
+            &lt;/td&gt;
+            &lt;td&gt;
+                &lt;input type=&quot;text&quot; id=&quot;wpau-ftpbasedir&quot; name=&quot;wpau-ftpbasedir&quot; value=&quot;&quot; style=&quot;width: 95%&quot;/&gt;
+            &lt;/td&gt;
+        &lt;/tr&gt;
+        &lt;tr&gt;
+            &lt;td&gt;
+                &lt;label for=&quot;disclosurepolicy-title&quot;&gt;
+                    FTP Host
+                &lt;/label&gt;
+            &lt;/td&gt;
+            &lt;td&gt;
+                &lt;input type=&quot;text&quot; id=&quot;wpau-ftphost&quot; name=&quot;wpau-ftphost&quot; value=&quot;&quot; style=&quot;width: 95%&quot;/&gt;
+            &lt;/td&gt;
+        &lt;/tr&gt;
+        &lt;tr&gt;
+            &lt;td colspan=&quot;2&quot;&gt;
+                &lt;input type=&quot;submit&quot; name=&quot;wpau-submit&quot; id=&quot;wpau-submit&quot; value=&quot;Let's Go&quot; /&gt;
+            &lt;/td&gt;
+        &lt;/tr&gt;
+    &lt;/table&gt;
+&lt;/form&gt;
+&lt;?php
+		}
+		else if($allClear) {
+			$link = 'edit.php?page='.WPAU_PAGE.'&amp;task=files';
+      $linkskip = 'edit.php?page='.WPAU_PAGE.'&amp;task=skipfiles';
+			if(function_exists('wp_nonce_url') ) {
+				 $link = wp_nonce_url($link, 'wordpress_automatic_upgrade');
+         $linkskip = wp_nonce_url($linkskip, 'wordpress_automatic_upgrade');
+			}
+			echo 'Great the preliminiary checks of your server is complete and WPAU is ready to roll. &lt;a href=&quot;'.$link.'&quot;&gt;&lt;strong&gt;Click here&lt;/strong&gt;&lt;/a&gt; so that we can start the upgrade.';
+      echo '&lt;br /&gt;The first step will backup files, &lt;a href=&quot;'.$linkskip.'&quot;&gt;click here&lt;/a&gt; to skip it.';
+?&gt;
+&lt;div id=&quot;wpau-file-download&quot;&gt;
+&lt;/div&gt;
+&lt;div id=&quot;wpau-db-download&quot;&gt;
+&lt;/div&gt;
+&lt;div id=&quot;wpau-update-db&quot;&gt;
+&lt;/div&gt;
+&lt;!--You may also choose the &lt;a href=&quot;#&quot; id=&quot;wpau-automated&quot;&gt;automated version&lt;/a&gt;.--&gt;
+&lt;div id=&quot;wpau-status-bar&quot;&gt;
+    &lt;div id=&quot;wpau-status-bar-indicator&quot;&gt;
+    &lt;/div&gt;
+&lt;/div&gt;
+&lt;div id=&quot;wpau-status-message&quot;&gt;
+&lt;/div&gt;
+&lt;/div&gt;
+&lt;?php
+		}
+?&gt;
+&lt;?php
+		wpauEndHtml();
+		unset($prelimCheck);
+	}
+
+	/** gets the information entered by the user and sanitizes the server files so that we can run the
+	WPAU plugin without any errors **/
+	function wpau_prelim_opts_and_sanatize() {
+		global $wbAbsPath, $isNix;
+
+		$options = get_settings('wpau-params');
+		if ( $_POST['wpau-submit'] ) {
+			$wpau_ftp['ftpuser'] = strip_tags(stripslashes($_POST['wpau-ftpuser']));
+			$wpau_ftp['ftppass'] = strip_tags(stripslashes($_POST['wpau-ftppass']));
+			$wpau_ftp['ftphost'] = strip_tags(stripslashes($_POST['wpau-ftphost']));
+			$wpau_ftp['ftpbasedir'] = strip_tags(stripslashes($_POST['wpau-ftpbasedir']));
+			//only saves it temporarily so that we can run post upgrade steps
+			if ( $options != $wpau_ftp ) {
+				$options = $wpau_ftp;
+				update_option('wpau-params', $options);
+			}
+		}
+
+		require_once('wpau_prelimcheck.class.php');
+		$prelimCheck = new wpauPrelimHelper();
+		$prelimCheck-&gt;ftpUser = $wpau_ftp['ftpuser'];
+		$prelimCheck-&gt;ftpPass = $wpau_ftp['ftppass'];
+		$prelimCheck-&gt;ftpHost = $wpau_ftp['ftphost'];
+		$prelimCheck-&gt;ftpBaseDir = $wpau_ftp['ftpbasedir'];
+		$prelimCheck-&gt;checkFtpMode();
+		if($prelimCheck-&gt;checkFTPCredentials()) {
+			$makeBackUpDir = $_REQUEST['mbd'];
+			if($prelimCheck-&gt;runFTPOperation()) {
+				if('true' == $makeBackUpDir) {
+					if(! $prelimCheck-&gt;makeBackupDir()) {
+						wpauStartHtml();
+						echo '&lt;strong&gt;Oops we cannot run the WordPress Automatic Update on your site. We are currently trying to fix issues for systems like yours and will release a new version shortly.&lt;/strong&gt;';
+						wpauEndHtml();
+						return false;
+					}
+				}
+				wpauStartHtml();
+				$link = 'edit.php?page='.WPAU_PAGE.'&amp;task=files';
+				if(function_exists('wp_nonce_url') ) {
+					 $link = wp_nonce_url($link, 'wordpress_automatic_upgrade');
+				}
+				echo 'Great all done WPAU is ready to roll. &lt;a href=&quot;'.$link.'&quot;&gt;Click here&lt;/a&gt; so that we can start the upgrade.';
+?&gt;
+&lt;div id=&quot;wpau-file-download&quot;&gt;
+&lt;/div&gt;
+&lt;div id=&quot;wpau-db-download&quot;&gt;
+&lt;/div&gt;
+&lt;div id=&quot;wpau-update-db&quot;&gt;
+&lt;/div&gt;
+&lt;!--You may also choose the &lt;a href=&quot;#&quot; id=&quot;wpau-automated&quot;&gt;automated version&lt;/a&gt;.--&gt;
+&lt;div id=&quot;wpau-status-bar&quot;&gt;
+    &lt;div id=&quot;wpau-status-bar-indicator&quot;&gt;
+    &lt;/div&gt;
+&lt;/div&gt;
+&lt;div id=&quot;wpau-status-message&quot;&gt;
+&lt;/div&gt;
+&lt;/div&gt;
+&lt;?php
+				wpauEndHtml();
+			}
+		}
+		else {
+			wpauStartHtml();
+			echo '&lt;p style=&quot;color:red;font-weight:bold&quot;&gt;Oops!!!!! We are unable to connect to the ftp site with the data your provided, could you cross check and give us the data again&lt;/p&gt;';
+?&gt;
+&lt;ol&gt;
+    &lt;li&gt;
+        Provide us with your FTP credentials
+    &lt;/li&gt;
+&lt;/ol&gt;
+&lt;p&gt;
+    &lt;strong&gt;Note:&lt;/strong&gt;
+    We do not store your FTP information with us due to security reasons. Your ftp credentials will only be used to make your site writable by this plugin. You only have to do this once.
+&lt;/p&gt;
+&lt;p&gt;
+    What is your FTP Base Directory. 
+    If you have installed wordpress inside &lt;strong&gt;public_html&lt;/strong&gt;
+    folder then your base ftp directory is &lt;strong&gt;/public_html&lt;/strong&gt;
+    &lt;br/&gt;
+    If your you have installed your wordpress in &lt;strong&gt;public_html/wpau&lt;/strong&gt;
+    folder then your base ftp directory is &lt;strong&gt;/public_html/wpau&lt;/strong&gt;
+    &lt;br/&gt;
+    If you install the wordpress into the root directory then your base directory will be &lt;strong&gt;/&lt;/strong&gt;
+    &lt;br/&gt;
+&lt;/p&gt;
+&lt;form method=&quot;post&quot; name=&quot;getftp&quot; action=&quot;edit.php?page=&lt;?php echo WPAU_PAGE; ?&gt;&amp;task=prelimopts&quot;&gt;
+    &lt;?php
+		if(function_exists('wp_nonce_field')) {
+			wp_nonce_field('wordpress_automatic_upgrade');
+		}
+?&gt;
+    &lt;table class=&quot;editform&quot; width=&quot;500&quot; cellspacing=&quot;2&quot; cellpadding=&quot;5&quot; align=&quot;left&quot;&gt;
+        &lt;tr&gt;
+            &lt;td colspan=&quot;2&quot;&gt;
+                &lt;strong&gt;Provide your FTP Credentials&lt;/strong&gt;
+            &lt;/td&gt;
+        &lt;/tr&gt;
+        &lt;tr&gt;
+            &lt;td&gt;
+                &lt;label for=&quot;disclosurepolicy-title&quot;&gt;
+                    FTP Username
+                &lt;/label&gt;
+            &lt;/td&gt;
+            &lt;td&gt;
+                &lt;input type=&quot;text&quot; id=&quot;wpau-ftpuser&quot; name=&quot;wpau-ftpuser&quot; value=&quot;&quot; style=&quot;width: 95%&quot;/&gt;
+            &lt;/td&gt;
+        &lt;/tr&gt;
+        &lt;tr&gt;
+            &lt;td&gt;
+                &lt;label for=&quot;disclosurepolicy-title&quot;&gt;
+                    FTP Password
+                &lt;/label&gt;
+            &lt;/td&gt;
+            &lt;td&gt;
+                &lt;input type=&quot;password&quot; id=&quot;wpau-ftppass&quot; name=&quot;wpau-ftppass&quot; value=&quot;&quot; style=&quot;width: 95%&quot;/&gt;
+            &lt;/td&gt;
+        &lt;/tr&gt;
+        &lt;tr&gt;
+            &lt;td&gt;
+                &lt;label for=&quot;disclosurepolicy-title&quot;&gt;
+                    FTP Base Directory (The root dir where wordpress is installed)
+                &lt;/label&gt;
+            &lt;/td&gt;
+            &lt;td&gt;
+                &lt;input type=&quot;text&quot; id=&quot;wpau-ftpbasedir&quot; name=&quot;wpau-ftpbasedir&quot; value=&quot;&quot; style=&quot;width: 95%&quot;/&gt;
+            &lt;/td&gt;
+        &lt;/tr&gt;
+        &lt;tr&gt;
+            &lt;td&gt;
+                &lt;label for=&quot;disclosurepolicy-title&quot;&gt;
+                    FTP Host
+                &lt;/label&gt;
+            &lt;/td&gt;
+            &lt;td&gt;
+                &lt;input type=&quot;text&quot; id=&quot;wpau-ftphost&quot; name=&quot;wpau-ftphost&quot; value=&quot;&quot; style=&quot;width: 95%&quot;/&gt;
+            &lt;/td&gt;
+        &lt;/tr&gt;
+        &lt;tr&gt;
+            &lt;td colspan=&quot;2&quot;&gt;
+                &lt;input type=&quot;submit&quot; name=&quot;wpau-submit&quot; id=&quot;wpau-submit&quot; value=&quot;Let's Go&quot; /&gt;
+            &lt;/td&gt;
+        &lt;/tr&gt;
+    &lt;/table&gt;
+&lt;/form&gt;
+&lt;?php
+			wpauEndHtml();
+		}
+	}
+  
+  function wpau_skip_backup_files($automated = false) {
+    
+    if(!current_user_can('edit_files')) {
+				echo 'Oops sorry you are not authorized to do this';
+				return false;
+		}
+    global $task, $theFuncComplete;
+    $task = &quot;files&quot;;
+    wpauPersistNoLog(false, false, $automated);
+		$message = '&lt;span style=&quot;color:red&quot;&gt;File Backup Skipped&lt;/span&gt;&lt;br /&gt;';
+    $theFuncComplete = true;
+    wpauPersist(true, $zipFuncs-&gt;loggedData, $theFuncComplete, $message, true);
+    if($automated) { return $theFuncComplete; }
+  }
+  
+  function wpau_skip_backup_db($automated = false) {
+    
+    if(!current_user_can('edit_files')) {
+				echo 'Oops sorry you are not authorized to do this';
+				return false;
+		}
+    global $task, $theFuncComplete;
+    $task = &quot;backupdb&quot;;
+    wpauPersistNoLog(false, false, $automated);
+		$message = '&lt;span style=&quot;color:red&quot;&gt;Database Backup Skipped&lt;/span&gt;&lt;br /&gt;';
+    $theFuncComplete = true;
+    wpauPersist(true, $zipFuncs-&gt;loggedData, $theFuncComplete, $message, true);
+    if($automated) { return $theFuncComplete; }
+  }
+
+	/**
+	* FUnction to back up the existing wordpress installation files
+	**/
+	function wpau_backup_files($automated = false) {
+		if(!current_user_can('edit_files')) {
+				echo 'Oops sorry you are not authorized to do this';
+				return false;
+		}
+		global $wpauDirPath, $wpAbsPath, $theFuncComplete, $isNix, $wpIncludeDirs;
+		$wpauHelper = new wpauHelper;
+		$dirName = trailingslashit(ABSPATH);
+		$dirName = $dirName . WPAU_BACKUP_DIR;
+		$dirName = trailingslashit($dirName);
+		if(! is_dir($dirName)) {
+			mkdir ($dirName);
+			chmod($dirName, 0757);
+			$wpauHelper-&gt;createIndexes();
+		}
+		else {
+			$wpauHelper-&gt;createIndexes();
+			@chmod($dirName, 0757);
+		}
+
+		wpauPersistNoLog(false, false, $automated);
+		$message = '';
+		require_once('wpau_zip.class.php');
+		$extension = '.zip';
+		$zipFuncs = new wpauZipFuncs($wpAbsPath, $isNix, WPAU_FILES_ZIP, WPAU_BACKUP_DIR, $wpIncludeDirs, $extension);
+		$zipFuncs-&gt;createArchive();
+		if($zipFuncs-&gt;isFileWritten) {
+			$message = '&lt;br /&gt;The files been have been succesfully backed up. &lt;a href=&quot;'.get_bloginfo('wpurl').'/'.WPAU_BACKUP_DIR.'/'.$_SESSION['filesbakname'].'&quot;&gt;DOWNLOAD IT&lt;/a&gt; BEFORE YOU CAN GO AHEAD. &lt;br/&gt;CONTINUE ONLY after verifying that the files have been downloaded&lt;br /&gt;';
+			$theFuncComplete = true;
+		}
+		else {
+			$message = 'The files could not be backed up, cannot continue with the operation';
+			$theFuncComplete = false;
+		}
+		wpauPersist(true, $zipFuncs-&gt;loggedData, $theFuncComplete, $message, true);
+		unset($zipFuncs);
+		unset($wpauHelper);
+		if($automated) { return $theFuncComplete; }
+	}
+
+	/**
+	Shows the database backup options
+	Taken from the plugin Wordpress Database backup created byAustin Matzko.
+	**/
+	function wpau_backup_db_options() {
+		if(!current_user_can('edit_files')) {
+				echo 'Oops sorry you are not authorized to do this';
+				return false;
+		}
+		global $wpAbsPath, $isNix, $theFuncComplete;
+		wpauPersistNoLog(false, false, $automated);
+		$backupDir = WPAU_BACKUP_DIR;
+		require_once('wpau_db_backup.class.php');
+		$wpauDbBackup = new wpauBackup($backupDir);
+		$wpauDbBackup-&gt;backup_menu();
+		$message = '&lt;br /&gt;Table selection complete, please go ahead to complete your database backup&lt;br /&gt;';
+		$theFuncComplete = true;
+		wpauPersist(true, $wpauDbBackup-&gt;loggedData, $theFuncComplete, $message, false);
+		unset($wpauDbBackup);
+	}
+
+	/**
+	Backs up the database tables and saves it to a file
+	Taken from the plugin Wordpress Database backup created byAustin Matzko.
+	**/
+	function wpau_backup_db($automated = false) {
+		if( ! current_user_can('manage_options')) {
+			echo 'Oops sorry you are not authorized to do this';
+			return false;
+		}
+		global $wpAbsPath, $isNix, $theFuncComplete;
+		wpauPersistNoLog(false, false, $automated);
+		$backupDir = WPAU_BACKUP_DIR;
+		$wpauHelper = new wpauHelper;
+		$backupFile = WPAU_DB_ZIP . $wpauHelper-&gt;random(). '.zip';
+		$_SESSION['dbbakname'] = $backupFile;
+		unset($wpauHelper);
+		require_once('wpau_db_backup.class.php');
+		$wpauDbBackup = new wpauBackup($backupDir);
+		if($wpauDbBackup-&gt;perform_backup($automated)) {
+			if($wpauDbBackup-&gt;zip_backup($backupFile)) {
+				$theFuncComplete = true;
+				$message = 'The database has been succesfully backed up. &lt;a href=&quot;'.get_bloginfo('wpurl').'/'.WPAU_BACKUP_DIR.'/'.$_SESSION['dbbakname'].'&quot;&gt;DOWNLOAD IT&lt;/a&gt; BEFORE YOU CAN GO AHEAD. &lt;br/&gt;CONTINUE ONLY after verifying that the files have been downloaded&lt;br /&gt;';
+			}
+			else {
+				$theFuncComplete = false;
+				$message = 'Could not backup your database files, cannot continue with the further process';
+			}
+		}
+		else {
+			$theFuncComplete = false;
+			$message = 'Could not backup your database files, cannot continue with the further process';
+		}
+		wpauPersist(true, $wpauDbBackup-&gt;loggedData, $theFuncComplete, $message, true);
+		unset($wpauDbBackup);
+		if($automated) { return $theFuncComplete; }
+	}
+
+/**
+	* Function to show user an option whether to download files from wordpress site
+	* or allow them to upload a file from their local machine
+	**/
+	function wpau_show_new_version_forms() {
+		global $theFuncComplete;
+		$theFuncComplete = true;
+
+		wpauPersistNoLog(false, false, false);
+	?&gt;
+&lt;script type=&quot;text/javascript&quot; language=&quot;JavaScript&quot;&gt;
+    function showUpload(layerName){
+        document.getElementById(layerName).style.visibility = 'visible';
+        document.getElementById(layerName).style.display = 'inline';
+    }
+    
+    function hideUpload(layerName){
+        document.getElementById(layerName).style.visibility = 'hidden';
+        document.getElementById(layerName).style.display = 'none';
+    }
+&lt;/script&gt;
+&lt;div style=&quot;padding:left:20px;margin-left:30px;&quot;&gt;
+    &lt;br/&gt;
+    &lt;br/&gt;
+    &lt;span&gt;&lt;strong&gt;Get or upload the latest version of Wordpress&lt;/strong&gt;&lt;/span&gt;
+    &lt;p&gt;
+        Ok we are all set with the backups. If you do not have the backup files downloaded, you can download the files backup and the database backup.
+    &lt;/p&gt;
+    &lt;p&gt;
+        To continue with the next step we need to get the upgrade files. You can choose from two options
+        &lt;ol&gt;
+            &lt;li&gt;
+                Allow us to automatically download the files from Wordpress using the following url
+                &lt;br/&gt;
+                http://wordpress.org/latest.zip
+            &lt;/li&gt;
+            &lt;li&gt;
+                WordPress in your language (Coming SOON).
+            &lt;/li&gt;
+        &lt;/ol&gt;
+    &lt;/p&gt;
+    &lt;p&gt;
+        Please complete the form below so we can start the process
+    &lt;/p&gt;
+    &lt;p&gt;
+        NOTE: THIS WILL TAKE BETWEEN 10-300 SECONDS, PLEASE DO NOT REFRESH THE PAGE.
+    &lt;/p&gt;
+    &lt;p&gt;
+        &lt;form name=&quot;wpaunewversion&quot; method=&quot;post&quot; enctype=&quot;multipart/form-data&quot; action=&quot;edit.php?page=&lt;?php echo WPAU_PAGE ?&gt;&amp;task=getlatestfiles&quot;&gt;
+            &lt;?php
+		if(function_exists('wp_nonce_field')) {
+			wp_nonce_field('wordpress_automatic_upgrade');
+		}
+?&gt;
+            &lt;input type=&quot;Radio&quot; name=&quot;subtask&quot; value=&quot;wp-latest-ver&quot; checked=&quot;checked&quot; onchange=&quot;hideUpload('fileupload');&quot;/&gt;&lt;strong&gt;Get the Latest Version from wordpress.org&lt;/strong&gt;
+            (recommended)
+            &lt;br/&gt;
+            &lt;input type=&quot;Radio&quot; name=&quot;subtask&quot; value=&quot;wp-upped-ver&quot; onchange=&quot;showUpload('fileupload');&quot; disabled=&quot;true&quot; /&gt;WordPress in your language. Coming Soon.
+            &lt;br/&gt;
+            &lt;br/&gt;
+            &lt;div id=&quot;fileupload&quot; style=&quot;visibility:hidden;display:none;&quot;&gt;
+                &lt;input type=&quot;File&quot; name=&quot;thefile&quot; accept=&quot;application/x-zip-compressed&quot; /&gt;Choose the file to be uploaded
+                &lt;br/&gt;
+                &lt;br/&gt;
+            &lt;/div&gt;
+            &lt;input type=&quot;Submit&quot; name=&quot;doversiondownload&quot; value=&quot;Lets GO&quot; /&gt;
+        &lt;/form&gt;
+    &lt;/p&gt;
+&lt;/div&gt;
+&lt;?php
+		$loggedData = '';
+		//$message = 'Select the option to start the files download';
+		wpauPersist(true, $loggedData, $theFuncComplete, $message, false);
+	}
+
+	/**
+	* Function to download the latest version from wordpress.org
+	**/
+	function wpau_get_latest_version($automated = false) {
+		if( ! current_user_can('edit_files')) {
+			echo 'Oops sorry you are not authorized to do this';
+			return false;
+		}
+		global $wpAbsPath, $isNix, $theFuncComplete;
+		wpauPersistNoLog(false, false, $automated);
+		require_once('wpau_upgrade.class.php');
+		$upgradeHelper = new wpauUpgradeHelper($wpAbsPath, $isNix, WPAU_BACKUP_DIR, ABSPATH);
+		$subtask = 'wp-latest-ver';
+		if( isset($_REQUEST['subtask']) ) {
+			$subtask = $_REQUEST['subtask'];
+		}
+		if(strcasecmp($subtask, 'wp-upped-ver')) {
+			if (ini_get('allow_url_fopen') == '1') {
+				$downloadURL = 'http://wordpress.org/latest.zip';
+				if($upgradeHelper-&gt;getFilesFromWP($downloadURL)) {
+					$upgradeHelper-&gt;recursive_chmod_directory(ABSPATH . WPAU_BACKUP_DIR);
+					$theFuncComplete = true;
+					$message = 'Successfully downloaded and unzipped all files from '.$downloadURL.'&lt;br /&gt;';
+				}
+				else {
+					$theFuncComplete = false;
+					$message = 'Could not download and unzip the files from '.$downloadURL.'&lt;br /&gt;';
+				}
+			}
+			else {
+				$url = 'www.wordpress.org';
+				$filename = 'latest.zip';
+				if($upgradeHelper-&gt;downloadFilesFromWP($url, $filename)) {
+					$upgradeHelper-&gt;recursive_chmod_directory(ABSPATH . WPAU_BACKUP_DIR);
+					$theFuncComplete = true;
+					$message = 'Successfully downloaded and unzipped all files from '.$downloadURL.'&lt;br /&gt;';
+				}
+				else {
+					$theFuncComplete = false;
+					$message = 'Could not download and unzip the files from '.$downloadURL.'&lt;br /&gt;';
+				}
+			}
+		}
+		else {
+			//read and upload the user file
+			if($upgradeHelper-&gt;getUploadedFilesFromUser($_FILES)) {
+				$theFuncComplete = true;
+				$message = 'Successfully uploaded and unzipped all files &lt;br /&gt;';
+			}
+			else {
+				$theFuncComplete = false;
+				$message = 'Could not upload and unzip all files &lt;br /&gt;';
+			}
+		}
+		wpauPersist(true, $upgradeHelper-&gt;loggedData, $theFuncComplete, $message, true);
+		unset($upgradeHelper);
+		if($automated) { return $theFuncComplete; }
+	}
+
+	/**
+	* Function to show site downtime
+	**/
+	function wpau_site_down($automated = false) {
+		if(!current_user_can('edit_files')) {
+				echo 'Oops sorry you are not authorized to do this';
+				return false;
+		}
+		global $wpauFileDirPath, $wpAbsPath, $isNix, $theFuncComplete;
+		wpauPersistNoLog(false, false, $automated);
+		require_once('wpau_upgrade.class.php');
+		$upgradeHelper = new wpauUpgradeHelper($wpAbsPath, $isNix, WPAU_BACKUP_DIR, ABSPATH);
+		if($upgradeHelper-&gt;doMaintenanceMode($wpauFileDirPath, 'temp-index.php')) {
+			$theFuncComplete = true;
+			$message = 'The site has been put into maintenance mode, &lt;a href=&quot;'.get_bloginfo('wpurl').'&quot; target=&quot;_blank&quot;&gt;click here&lt;/a&gt; (Opens in new window) to confirm';
+		}
+		else {
+			$theFuncComplete = false;
+			$message = 'The site could not be put into maintenance mode.';
+		}
+		wpauPersist(true, $upgradeHelper-&gt;loggedData, $theFuncComplete, $message, true);
+		unset($upgradeHelper);
+		if($automated) { return $theFuncComplete; }
+	}
+
+	/**
+	* Function to de-activate all plugins
+	**/
+	function wpau_deactivate_plugins($automated = false) {
+		if(!current_user_can('edit_plugins')) {
+				echo 'Oops sorry you are not authorized to do this';
+				return false;
+		}
+		global $theFuncComplete;
+		wpauPersistNoLog(false, false, $automated);
+		$thePlugs = array();
+		require_once('wpau_plugin.class.php');
+		$path = &quot;../&quot;;
+		if ($automated) { $path = &quot;../../&quot;; }
+		$currentPlugs = get_option('active_plugins');
+		foreach($currentPlugs as $plugin) {
+
+			if ( wpau_validate_file($path.$plugin) ) {
+				//another wp guys check
+				if (in_array($plugin, $currentPlugs)) {
+					array_push($thePlugs, $plugin);
+				}
+			}
+		}
+		$wpauPluginsHandler = new wpauPluginHandler($thePlugs);
+		if($wpauPluginsHandler-&gt;deActivatePlugins()) {
+			$theFuncComplete = true;
+			$message = 'All the plugins have been de-activated, except for &lt;strong&gt;Wordpress automatic upgrade&lt;/strong&gt; plugin.';
+		}
+		else {
+			$theFuncComplete = false;
+			$message = 'The plugins could not be de-activated. Please click here to manually de-activate the plugin. Please do not de-activate the &lt;strong&gt;Wordpress automatic upgrade&lt;/strong&gt; plugin';
+		}
+		wpauPersist(true, $wpauPluginsHandler-&gt;loggedData, $theFuncComplete, $message, true);
+		unset($wpauPluginsHandler);
+		if($automated) { return $theFuncComplete; }
+	}
+
+	/**
+	* Function to upgrade the latest files and run the upgrade.php
+	**/
+	function wpau_upgrade_installation($automated = false) {
+		if(!current_user_can('edit_files')) {
+				echo 'Oops sorry you are not authorized to do this';
+				return false;
+		}
+		global $wpAbsPath, $isNix, $theFuncComplete;
+		wpauPersistNoLog(false, false, $automated);
+		require_once('wpau_upgrade.class.php');
+		$upgradeHelper = new wpauUpgradeHelper($wpAbsPath, $isNix, WPAU_BACKUP_DIR, ABSPATH);
+		if($upgradeHelper-&gt;upgradeFiles()) {
+			$theFuncComplete = true;
+			$message = 'Congratulations!!! All the files have been upgraded to the latest version. Please &lt;a href=&quot;'.get_bloginfo('wpurl').'/wp-admin/upgrade.php&quot; target=&quot;_blank&quot;&gt;CLICK HERE TO COMPLETE THE FINAL STEP&lt;/a&gt; (opens in new window and will show you a upgrade link only if database has to be upgraded) and come back here to reactivate your plugins';
+      $message .= 'Note: While re-activating plugins WordPress may log you out, but do not worry WPAU will take care of the logout and finish the upgrade like normal once you login, just remember to stay in this window and click on the link to re-activate your plugins.';
+		}
+		else {
+			$theFuncComplete = false;
+			$message = 'Oops!! we could not upgrade your files. All the files have been reverted to the older version.';
+		}
+
+		wpauPersist(true, $upgradeHelper-&gt;loggedData, $theFuncComplete, $message, true);
+		unset($upgradeHelper);
+		if($automated) { return $theFuncComplete; }
+	}
+
+	function wpau_update_database($automated = false) {
+		if(!current_user_can('edit_files')) {
+				echo 'Oops sorry you are not authorized to do this';
+				return false;
+		}
+		global $wpAbsPath, $isNix, $theFuncComplete;
+		wpauPersistNoLog(false, false, $automated);
+		require_once('wpau_upgrade.class.php');
+		$upgradeHelper = new wpauUpgradeHelper($wpAbsPath, $isNix, WPAU_BACKUP_DIR, ABSPATH);
+		if($upgradeHelper-&gt;updateDatabase()) {
+			$theFuncComplete = true;
+			$message = 'Your WordPress database has been successfully upgraded!';
+		}
+		else {
+			$theFuncComplete = false;
+			$message = 'Your wordpress database could not be upgraded succesfully. &lt;a href=&quot;'.get_bloginfo('wpurl').'/wp-admin/upgrade.php&quot; target=&quot;_blank&quot;&gt;Click here&lt;/a&gt; to manually upgrade before re-activating the plugins.';
+		}
+		wpauPersist(true, $upgradeHelper-&gt;loggedData, $theFuncComplete, $message, true);
+		unset($upgradeHelper);
+		if($automated) { return $theFuncComplete; }
+	}
+
+	/**
+	* Function to activate the plugins
+	**/
+	function wpau_reactivate_plugins($automated = false) {
+		if(!current_user_can('edit_plugins')) {
+				echo 'Oops sorry you are not authorized to do this';
+				return false;
+		}
+		global $theFuncComplete, $wpdb;
+		wpauPersistNoLog(false, false, $automated);
+		require_once('wpau_plugin.class.php');
+		$thePlugs = array();
+		$wpauPluginsHandler = new wpauPluginHandler($thePlugs);
+		if($wpauPluginsHandler-&gt;reActivatePlugins($automated)) {
+			$plugins = $wpdb-&gt;get_results(&quot;select plugin_name from &quot;.WPAU_PLUGIN_TABLE.&quot; where fatal_plugin = 1&quot;);
+			if(count($plugins) &gt; 0)  {
+				foreach($plugins as $plugin) {
+					$message .= '&lt;span style=&quot;color:red&quot;&gt;The Plugin &lt;strong&gt;'.$plugin-&gt;plugin_name.'&lt;/strong&gt; could not be activated succesfully. You will need to activate it manually.&lt;/span&gt;&lt;br&gt;';
+				}
+			}
+			else {
+				$message = 'The plugins have been reactivated succesfully';
+			}
+			$theFuncComplete = true;
+		}
+		else {
+			$theFuncComplete = true;
+			$message = 'The plugin could not be activated, please activate the plugins manually';
+		}
+		$wpau_ftp = get_settings('wpau-params');
+		if($wpau_ftp['ftpuser'] != '') {
+			do_ftp_sanitize_operations($wpau_ftp);
+		}
+		$wpau_ftp['ftpuser'] = '';
+		$wpau_ftp['ftppass'] = '';
+		$wpau_ftp['ftphost'] = '';
+		$wpau_ftp['ftpbasedir'] = '';
+		//remove the ftp information from the db
+		update_option('wpau-params', $wpau_ftp);
+
+		wpauPersist(true, $wpauPluginsHandler-&gt;loggedData, $theFuncComplete, $message, true);
+		unset($wpauPluginsHandler);
+		if($automated) { return $theFuncComplete; }
+	}
+
+	function do_ftp_sanitize_operations($wpau_ftp, $automated = false) {
+		require_once('wpau_prelimcheck.class.php');
+		$prelimCheck = new wpauPrelimHelper(ABSPATH, $isNix, true);
+		$prelimCheck-&gt;ftpUser = $wpau_ftp['ftpuser'];
+		$prelimCheck-&gt;ftpPass = $wpau_ftp['ftppass'];
+		$prelimCheck-&gt;ftpHost = $wpau_ftp['ftphost'];
+		$prelimCheck-&gt;ftpBaseDir = $wpau_ftp['ftpbasedir'];
+		$prelimCheck-&gt;checkFtpMode();
+		if($prelimCheck-&gt;checkFTPCredentials()) {
+			$prelimCheck-&gt;runFTPOperation();
+		}
+		unset($prelimCheck);
+	}
+
+	/** cleans up all the upgradation files**/
+	function wpau_cleanup($automated = false) {
+		if(!current_user_can('edit_files')) {
+				echo 'Oops sorry you are not authorized to do this';
+				return false;
+		}
+		global $wpAbsPath, $isNix, $theFuncComplete;
+		$loggedData =  '&lt;strong&gt;Congratulations your wordpress upgrade is complete&lt;/strong&gt;';
+		require_once('wpau_upgrade.class.php');
+		$upgradeHelper = new wpauUpgradeHelper($wpAbsPath, $isNix, WPAU_BACKUP_DIR, ABSPATH);
+		$upgradeHelper-&gt;cleanUpProcess();
+		$returnHome = $_REQUEST['returnhome'];
+		if($returnHome) {
+			unset($upgradeHelper);
+			//the wp_redirect does not work on some sites
+			//as we already included header above while loading the plugin use plain old js
+			//wp_redirect('edit.php?page='.WPAU_PAGE);
+?&gt;
+&lt;script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;&gt;
+    window.location = &quot;&lt;?php echo 'edit.php?page='.WPAU_PAGE;?&gt;&quot;;
+&lt;/script&gt;
+&lt;?php
+		}
+
+		$loggedData .= '&lt;p&gt;We have cleaned up all your upgradation files&lt;/p&gt;';
+		$message = '&lt;p&gt;We have cleaned up all your upgradation files&lt;/p&gt;';
+		wpauStartHtml();
+		$theFuncComplete = true;
+		echo '&lt;strong&gt;'.$message.'&lt;/strong&gt;';
+		echo &quot;&lt;hr /&gt;&lt;strong&gt;TASK STATUS&lt;/strong&gt;&lt;br /&gt;&lt;hr /&gt;&quot;;
+		echo $loggedData.'&lt;br /&gt;&lt;br /&gt;';
+		unset($upgradeHelper);
+		wpauEndHtml();
+		if($automated) { return $theFuncComplete; }
+	}
+
+	/**
+	* Function to show the log for the upgrade
+	**/
+	function wpau_show_backup_log($automated = false) {
+		global $wpdb;
+		$logData = '';
+		wpauStartHtml();
+		echo '&lt;strong&gt;Congratulations!!! Your Wordpresss installation has been upgraded.&lt;/strong&gt;';
+		echo '&lt;br /&gt;&lt;strong&gt;Please download your backup files if you have not done it.&lt;/strong&gt;&lt;br /&gt;';
+		echo '&lt;a href=&quot;'.get_bloginfo('wpurl').'/'.WPAU_BACKUP_DIR.'/'.$_SESSION['filesbakname'].'&quot;&gt;DOWNLOAD FILES BACKUP&lt;/a&gt;&lt;br /&gt;';
+		echo '&lt;a href=&quot;'.get_bloginfo('wpurl').'/'.WPAU_BACKUP_DIR.'/'.$_SESSION['dbbakname'].'&quot;&gt;DOWNLOAD DATABASE BACKUP&lt;/a&gt;&lt;br /&gt;';
+		echo 'Don\'t forget to run  &lt;a href=&quot;'.get_bloginfo('wpurl').'/wp-admin/upgrade.php&quot; target=&quot;_blank&quot;&gt;Database Upgrade&lt;/a&gt; if you have not done it.';
+		echo 'You can &lt;a href=&quot;edit.php?page='.WPAU_PAGE.'&amp;task=cleanup&quot;&gt;Clean up&lt;/a&gt; the ugradation files once your done';
+		echo &quot;&lt;hr /&gt;&lt;strong&gt;Below is the log for the upgradation&lt;/strong&gt;&lt;br /&gt;&lt;hr /&gt;&quot;;
+		$logData = getDBLog();
+		/*$wpauHelper = new wpauHelper;
+		$dirName = trailingslashit(ABSPATH);
+		$dirName = trailingslashit($dirName);
+		if($wpauHelper-&gt;writeLogToDisk($dirName, WPAU_LOG_FILE, $logData)) {
+			echo '&lt;strong&gt;Click &lt;a href=&quot;'.get_bloginfo('wpurl').'/'.WPAU_LOG_FILE.'&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt; to download the log file&lt;/strong&gt;&lt;br&gt;';
+		}
+		unset($wpauHelper);*/
+		echo $logData;
+		wpauEndHtml();
+	}
+
+	/**
+	* Function to show the log on failure
+	**/
+	function wpau_show_log($automated = false) {
+		global $wpdb;
+		$logData = '';
+		wpauStartHtml();
+		echo '&lt;strong&gt;Some problems did not allow us to upgrade your blog. This most likely ocurred due to file permission issues, you can find a workaround for the issue by visiting &lt;a href=&quot;http://forum.techie-buzz.com/topic.php?id=46&amp;page&amp;replies=1&quot; target=&quot;_blank&quot; title=&quot;Opens in new Window&quot;&gt;this forum post on WPAU forums&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;If that does not solve your problem please post on the forum and I will definitely take a look at the issue.&lt;/strong&gt;';
+		echo &quot;&lt;hr /&gt;&lt;strong&gt;Below is the log for the upgradation&lt;/strong&gt;&lt;br /&gt;&lt;hr /&gt;&quot;;
+		echo getDBLog();
+		wpauEndHtml();
+	}
+
+	function getDBLog() {
+		global $wpdb;
+		$logData = '';
+		$logged = $wpdb-&gt;get_results('SELECT task_name, task_status, task_description, task_log, start_date, end_date from  '.WPAU_LOG_TABLE);
+		if(count($logged) &gt; 0) {
+			foreach($logged as $log) {
+				$taskStatus = $log-&gt;task_status;
+				if($taskStatus) { $taskStatus = 'Complete'; }
+				else { $taskStatus = '&lt;span style=&quot;color:red&quot;&gt;Failed&lt;/span&gt;'; }
+				$logData .= '&lt;strong&gt;Task Name:&lt;/strong&gt;  '. $log-&gt;task_name.'&lt;br&gt;';
+				$logData .= '&lt;strong&gt;Task Description:&lt;/strong&gt; '. $log-&gt;task_description.'&lt;br&gt;';
+				$logData .= '&lt;strong&gt;Task Status:&lt;/strong&gt; '. $taskStatus.'&lt;br&gt;';
+				$logData .= '&lt;strong&gt;Task Start Date:&lt;/strong&gt; '. $log-&gt;start_date.'&lt;br&gt;';
+				$logData .= '&lt;strong&gt;Task End Date:&lt;/strong&gt; '. $log-&gt;end_date.'&lt;br&gt;';
+				$logData .= '&lt;strong&gt;Task Log:&lt;/strong&gt; '. $log-&gt;task_log.'&lt;br&gt;&lt;br&gt;';
+			}
+		}
+		return $logData;
+	}
+
+	/** show start instructions **/
+	function show_upgrade_start() {
+	?&gt;
+&lt;div style=&quot;padding:left:20px;margin-left:30px;&quot;&gt;
+    &lt;br/&gt;
+    &lt;br/&gt;
+    &lt;span&gt;&lt;strong&gt;Starting Wordpress automatic update. &lt;a href=&quot;edit.php?page=&lt;?php echo WPAU_PAGE ?&gt;&amp;task=prelim&quot;&gt;Click to begin&lt;/a&gt;. Here is what we will do&lt;/strong&gt;&lt;/span&gt;
+    &lt;ol&gt;
+        &lt;li&gt;
+            Checks if your server is able to run the process. 
+            &lt;br/&gt;
+            If not asks you to provide your FTP details.
+            &lt;br/&gt;
+            If its running in safe mode this plugin cannot run.
+        &lt;/li&gt;
+        &lt;li&gt;
+            Backup your current files and make if available for you to download
+        &lt;/li&gt;
+        &lt;li&gt;
+            Backup your database and make it available for you to download
+        &lt;/li&gt;
+        &lt;li&gt;
+            Get the latest files via one of the ways below
+            &lt;ul&gt;
+                &lt;li&gt;
+                    Automatically download files from the location OR
+                &lt;/li&gt;
+                &lt;li&gt;
+                    You can provide us with the latest downloaded version. (DOES NOT WORK IN THIS VERSION)
+                &lt;/li&gt;
+            &lt;/ul&gt;
+        &lt;/li&gt;
+        &lt;li&gt;
+            Deactivate your plugins and remember it
+        &lt;/li&gt;
+        &lt;li&gt;
+            Make your site offline
+        &lt;/li&gt;
+        &lt;li&gt;
+            Upgrade your files
+        &lt;/li&gt;
+        &lt;li&gt;
+            Activate your plugins
+        &lt;/li&gt;
+        &lt;li&gt;
+            Make your site online
+        &lt;/li&gt;
+        &lt;li&gt;
+            Provide you with a upgradation log
+        &lt;/li&gt;
+    &lt;/ol&gt;
+    &lt;span&gt;&lt;strong&gt;&lt;a href=&quot;edit.php?page=&lt;?php echo WPAU_PAGE ?&gt;&amp;task=files&quot;&gt;Click to begin now&lt;/a&gt;&lt;/strong&gt;&lt;/span&gt;
+    &lt;div&gt;
+        &lt;div id=&quot;wpau-file-download&quot;&gt;
+        &lt;/div&gt;
+        &lt;div id=&quot;wpau-db-download&quot;&gt;
+        &lt;/div&gt;
+        &lt;div id=&quot;wpau-update-db&quot;&gt;
+        &lt;/div&gt;
+        You may also choose the &lt;a href=&quot;#&quot; id=&quot;wpau-automated&quot;&gt;automated version&lt;/a&gt;.
+        &lt;div id=&quot;wpau-status-bar&quot;&gt;
+            &lt;div id=&quot;wpau-status-bar-indicator&quot;&gt;
+            &lt;/div&gt;
+        &lt;/div&gt;
+        &lt;div id=&quot;wpau-status-message&quot;&gt;
+        &lt;/div&gt;
+    &lt;/div&gt;
+&lt;/div&gt;
+&lt;?php
+	}
+
+	function install() {
+		global $wpdb;
+		$result = mysql_query(&quot;DROP TABLE if exists `wpau_active_plugins_info`&quot;);
+		$result = mysql_query(&quot;
+			CREATE TABLE `wpau_active_plugins_info` (
+			  `id` int(4) NOT NULL auto_increment,
+			  `plugin_name` varchar(255) NOT NULL default '',
+			  `plugin_status` varchar(255) NOT NULL default '',
+				`plugin_deactive_response` smallint(2) NULL default '0',
+				`plugin_reactive_response` smallint(2) NULL default '0',
+				`fatal_plugin` smallint(2) NULL default '0',
+			  PRIMARY KEY  (`id`)
+			) TYPE=MyISAM;
+		&quot;) or die(mysql_error().' on line: '.__LINE__);
+
+		if (!$result) {
+			return false;
+		}
+
+		$result = mysql_query(&quot;DROP TABLE if exists `wpau_upgrade_log`&quot;);
+		$result = mysql_query(&quot;
+			CREATE TABLE `wpau_upgrade_log` (
+			  `id` int(4) NOT NULL auto_increment,
+			  `task_name` varchar(150) NOT NULL default '',
+			  `task_status` varchar(150) NOT NULL default '',
+			  `task_description` varchar(150) NOT NULL default '',
+			  `task_log` text,
+			  `start_date` datetime NOT NULL default '0000-00-00 00:00:00',
+			  `end_date` datetime default NULL,
+			  PRIMARY KEY  (`id`)
+			) TYPE=MyISAM;
+		&quot;) or die(mysql_error().' on line: '.__LINE__);
+
+			if (!$result) {
+				return false;
+			}
+
+	}
+
+
+	function wpau_validate_file($file, $allowed_files = '') {
+		if ( false !== strpos($file, './'))
+			return 1;
+
+		if (':' == substr($file,1,1))
+			return 2;
+
+		if ( !empty($allowed_files) &amp;&amp; (! in_array($file, $allowed_files)) )
+			return 3;
+
+		return 0;
+	}
+
+	/**
+	* checks to see if everything is set first up so that it can be logged properly
+	**/
+	function wpau_init() {
+		global $wpdb, $table_prefix;
+		$wpdb-&gt;upgrade_log = $table_prefix.'upgrade_log';
+		$wpdb-&gt;active_plugins_info = $table_prefix.'active_plugins_info';
+
+		if (isset($_GET['activate']) &amp;&amp; $_GET['activate'] == 'true') {
+			$result = mysql_list_tables(DB_NAME);
+			$tables = array();
+			while ($row = mysql_fetch_row($result)) {
+				$tables[] = $row[0];
+			}
+			if (!in_array($wpdb-&gt;upgrade_log, $tables) &amp;&amp; !in_array($wpdb-&gt;active_plugins_info, $tables)) {
+				install();
+			}
+		}
+	}
+
+	/**
+	* Adds in the necessary JavaScript files for the automated version
+	**/
+	function wpau_add_scripts() {
+		if (function_exists('wp_enqueue_script') &amp;&amp; function_exists('wp_register_script')) {
+			wp_register_script('jquery', get_bloginfo('wpurl') . '/wp-content/plugins/wordpress-automatic-upgrade/js/jquery.js');
+			wp_enqueue_script('wpau_auto_update', get_bloginfo('wpurl') . '/wp-content/plugins/wordpress-automatic-upgrade/js/wp-wpau.js.php', array('jquery'), '0.1');
+		} else {
+			wpau_add_scripts_legacy();
+		}
+	}
+	function wpau_add_scripts_legacy() {
+		if (function_exists('wp_enqueue_script') &amp;&amp; function_exists('wp_register_script')) { wpau_add_scripts(); return; }
+		print('&lt;script type=&quot;text/javascript&quot; src=&quot;'.get_bloginfo('wpurl') . '/wp-content/plugins/wordpress-automatic-upgrade/js/jquery.js&quot;&gt;&lt;/script&gt;'.&quot;\n&quot;);
+		print('&lt;script type=&quot;text/javascript&quot; src=&quot;'.get_bloginfo('wpurl') . '/wp-content/plugins/wordpress-automatic-upgrade/js/wp-wpau.js.php&quot;&gt;&lt;/script&gt;'.&quot;\n&quot;);
+	}
+	add_action('admin_print_scripts', 'wpau_add_scripts');
+	add_action('admin_head', 'wpau_add_scripts_legacy');
+	add_action('admin_menu', 'wpau_manage_page');
+  add_action('admin_notices', 'wpau_add_nag', 3 );
+
+?&gt;</diff>
      <filename>wordpress/wp-content/plugins/wordpress-automatic-upgrade/wordpress-automatic-upgrade.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,528 +1,528 @@
-&lt;?php
-/*
-This class is used from the popular plugin wordpress database backup authored by  Austin Matzko  http://www.ilfilosofo.com/blog/
-
-Development continued from that done by Skippy (http://www.skippy.net/)
-
-Much of this was modified from Mark Ghosh's One Click Backup, which
-in turn was derived from phpMyAdmin.
-
-Many thanks to Owen (http://asymptomatic.net/wp/) for his patch
-   http://dev.wp-plugins.org/ticket/219
-
-Copyright 2007  Austin Matzko  (email : if.website at gmail.com)
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
-
-
-define('ROWS_PER_SEGMENT', 100);
-
-class wpauBackup extends wpauHelper {
-
-	var $backup_complete = false;
-	var $isFileWritten = false;
-	var $backup_file;
-	var $backup_dir;
-	var $backup_errors = array();
-
-	function gzip() {
-		return function_exists('gzopen');
-	}
-
-	function wpauBackup($backup_dir) {
-		global $table_prefix, $wpdb, $wp_version;
-		$current_version = (float)$wp_version;
-		$table_prefix = ( isset( $table_prefix ) ) ? $table_prefix : $wpdb-&gt;prefix;
-		if($current_version &lt; 2.3) {
-			if ( isset( $wpdb-&gt;link2cat ) ) {
-				$this-&gt;core_table_names = explode(',',&quot;$wpdb-&gt;categories,$wpdb-&gt;comments,$wpdb-&gt;link2cat,$wpdb-&gt;links,$wpdb-&gt;options,$wpdb-&gt;post2cat,$wpdb-&gt;postmeta,$wpdb-&gt;posts,$wpdb-&gt;users,$wpdb-&gt;usermeta&quot;);
-			}
-			else {
-				$this-&gt;core_table_names = explode(',',&quot;$wpdb-&gt;categories,$wpdb-&gt;comments,$wpdb-&gt;linkcategories,$wpdb-&gt;links,$wpdb-&gt;options,$wpdb-&gt;post2cat,$wpdb-&gt;postmeta,$wpdb-&gt;posts,$wpdb-&gt;users,$wpdb-&gt;usermeta&quot;);
-			}
-		}
-		else { //WP 2.3+ needs database diff table names
-			$this-&gt;core_table_names = array(
-				$wpdb-&gt;comments,
-				$wpdb-&gt;linkcategories,
-				$wpdb-&gt;links,
-				$wpdb-&gt;options,
-				$wpdb-&gt;postmeta,
-				$wpdb-&gt;posts,
-				$wpdb-&gt;terms,
-				$wpdb-&gt;term_taxonomy,
-				$wpdb-&gt;term_relationships,
-				$wpdb-&gt;users,
-				$wpdb-&gt;usermeta,
-			);
-		}
-		$this-&gt;backup_dir = trailingslashit($backup_dir);
-	}
-	
-	function perform_backup($automated = false) {
-		if(!current_user_can('manage_options')) {
-				echo 'Oops sorry you are not authorized to do this';
-				return false;
-		}
-		// are we backing up any other tables?
-		$also_backup = array();
-
-		if (isset($_POST['other_tables'])) {
-			$also_backup = $_POST['other_tables'];
-		}
-		$core_tables = $_POST['core_tables'];
-		if($automated) {
-			$core_tables = $this-&gt;core_table_names;
-		}
-
-		$this-&gt;backup_file = $this-&gt;db_backup($core_tables, $also_backup);
-		if (FALSE !== $this-&gt;backup_file) {
-			$this-&gt;backup_complete = true;
-			return true;
-		}
-		else
-			return false;
-	}
-
-	/**
-	 * Better addslashes for SQL queries.
-	 * Taken from phpMyAdmin.
-	 */
-	function sql_addslashes($a_string = '', $is_like = FALSE) {
-		if ($is_like) $a_string = str_replace('\\', '\\\\\\\\', $a_string);
-		else $a_string = str_replace('\\', '\\\\', $a_string);
-		return str_replace('\'', '\\\'', $a_string);
-	}
-
-	/**
-	 * Add backquotes to tables and db-names in
-	 * SQL queries. Taken from phpMyAdmin.
-	 */
-	function backquote($a_name) {
-		if (!empty($a_name) &amp;&amp; $a_name != '*') {
-			if (is_array($a_name)) {
-				$result = array();
-				reset($a_name);
-				while(list($key, $val) = each($a_name))
-					$result[$key] = '`' . $val . '`';
-				return $result;
-			} else {
-				return '`' . $a_name . '`';
-			}
-		} else {
-			return $a_name;
-		}
-	}
-
-	function open($filename = '', $mode = 'w') {
-		if ('' == $filename) return false;
-		if ($this-&gt;gzip())
-			$fp = @gzopen($filename, $mode);
-		else
-			$fp = @fopen($filename, $mode);
-		return $fp;
-	}
-
-	function close($fp) {
-		if ($this-&gt;gzip())
-			gzclose($fp);
-		else
-			fclose($fp);
-	}
-
-	function stow($query_line) {
-		if ($this-&gt;gzip()) {
-			if(@gzwrite($this-&gt;fp, $query_line) === FALSE) {
-				$this-&gt;backup_error(__('There was an error writing a line to the backup script:','wp-db-backup'));
-				$this-&gt;backup_error('&amp;nbsp;&amp;nbsp;' . $query_line);
-			}
-		} else {
-			if(@fwrite($this-&gt;fp, $query_line) === FALSE) {
-				$this-&gt;backup_error(__('There was an error writing a line to the backup script:','wp-db-backup'));
-				$this-&gt;backup_error('&amp;nbsp;&amp;nbsp;' . $query_line);
-			}
-		}
-	}
-
-	function backup_error($err) {
-		if(count($this-&gt;backup_errors) &lt; 20)
-			$this-&gt;backup_errors[] = $err;
-		elseif(count($this-&gt;backup_errors) == 20)
-			$this-&gt;backup_errors[] = __('Subsequent errors have been omitted from this log.','wp-db-backup');
-	}
-
-	/**
-	 * Taken partially from phpMyAdmin and partially from
-	 * Alain Wolf, Zurich - Switzerland
-	 * Website: http://restkultur.ch/personal/wolf/scripts/db_backup/
-
-	 * Modified by Scott Merril (http://www.skippy.net/)
-	 * to use the WordPress $wpdb object
-	 */
-	function backup_table($table, $segment = 'none') {
-		global $wpdb;
-		if('' == $table) {
-			return;
-		}
-		$table_structure = $wpdb-&gt;get_results(&quot;DESCRIBE $table&quot;);
-		if (! $table_structure) {
-			$this-&gt;backup_error(__('Error getting table details','wp-db-backup') . &quot;: $table&quot;);
-			return FALSE;
-		}
-
-		if(($segment == 'none') || ($segment == 0)) {
-			// Add SQL statement to drop existing table
-			$this-&gt;stow(&quot;\n\n&quot;);
-			$this-&gt;stow(&quot;#\n&quot;);
-			$this-&gt;stow(&quot;# Delete any existing table &quot; . $this-&gt;backquote($table) . &quot;\n&quot;);
-			$this-&gt;stow(&quot;#\n&quot;);
-			$this-&gt;stow(&quot;\n&quot;);
-			$this-&gt;stow(&quot;DROP TABLE IF EXISTS &quot; . $this-&gt;backquote($table) . &quot;;\n&quot;);
-
-			// Table structure
-			// Comment in SQL-file
-			$this-&gt;stow(&quot;\n\n&quot;);
-			$this-&gt;stow(&quot;#\n&quot;);
-			$this-&gt;stow(&quot;# Table structure of table &quot; . $this-&gt;backquote($table) . &quot;\n&quot;);
-			$this-&gt;stow(&quot;#\n&quot;);
-			$this-&gt;stow(&quot;\n&quot;);
-
-			$create_table = $wpdb-&gt;get_results(&quot;SHOW CREATE TABLE $table&quot;, ARRAY_N);
-			if (FALSE === $create_table) {
-				$this-&gt;backup_error(sprintf(__(&quot;Error with SHOW CREATE TABLE for %s.&quot;,'wp-db-backup'), $table));
-				$this-&gt;stow(&quot;#\n# Error with SHOW CREATE TABLE for $table!\n#\n&quot;);
-			}
-			$this-&gt;stow($create_table[0][1] . ' ;');
-
-			if (FALSE === $table_structure) {
-				$this-&gt;backup_error(sprintf(__(&quot;Error getting table structure of %s&quot;,'wp-db-backup'), $table));
-				$this-&gt;stow(&quot;#\n# Error getting table structure of $table!\n#\n&quot;);
-			}
-
-			// Comment in SQL-file
-			$this-&gt;stow(&quot;\n\n&quot;);
-			$this-&gt;stow(&quot;#\n&quot;);
-			$this-&gt;stow('# Data contents of table ' . $this-&gt;backquote($table) . &quot;\n&quot;);
-			$this-&gt;stow(&quot;#\n&quot;);
-		}
-
-		if(($segment == 'none') || ($segment &gt;= 0)) {
-			$ints = array();
-			foreach ($table_structure as $struct) {
-				if ( (0 === strpos($struct-&gt;Type, 'tinyint')) ||
-					(0 === strpos(strtolower($struct-&gt;Type), 'smallint')) ||
-					(0 === strpos(strtolower($struct-&gt;Type), 'mediumint')) ||
-					(0 === strpos(strtolower($struct-&gt;Type), 'int')) ||
-					(0 === strpos(strtolower($struct-&gt;Type), 'bigint')) ||
-					(0 === strpos(strtolower($struct-&gt;Type), 'timestamp')) ) {
-						$ints[strtolower($struct-&gt;Field)] = &quot;1&quot;;
-				}
-			}
-
-
-			// Batch by $row_inc
-
-			if($segment == 'none') {
-				$row_start = 0;
-				$row_inc = ROWS_PER_SEGMENT;
-			} else {
-				$row_start = $segment * ROWS_PER_SEGMENT;
-				$row_inc = ROWS_PER_SEGMENT;
-			}
-
-			do {
-				if ( !ini_get('safe_mode')) @set_time_limit(15*60);
-				$table_data = $wpdb-&gt;get_results(&quot;SELECT * FROM $table LIMIT {$row_start}, {$row_inc}&quot;, ARRAY_A);
-
-				/*
-				if (FALSE === $table_data) {
-					$wp_backup_error .= &quot;Error getting table contents from $table\r\n&quot;;
-					fwrite($fp, &quot;#\n# Error getting table contents fom $table!\n#\n&quot;);
-				}
-				*/
-
-				$entries = 'INSERT INTO ' . $this-&gt;backquote($table) . ' VALUES (';
-				//    \x08\\x09, not required
-				$search = array(&quot;\x00&quot;, &quot;\x0a&quot;, &quot;\x0d&quot;, &quot;\x1a&quot;);
-				$replace = array('\0', '\n', '\r', '\Z');
-				if($table_data) {
-					foreach ($table_data as $row) {
-						$values = array();
-						foreach ($row as $key =&gt; $value) {
-							if ($ints[strtolower($key)]) {
-								$values[] = $value;
-							} else {
-								$values[] = &quot;'&quot; . str_replace($search, $replace, $this-&gt;sql_addslashes($value)) . &quot;'&quot;;
-							}
-						}
-						$this-&gt;stow(&quot; \n&quot; . $entries . implode(', ', $values) . ') ;');
-					}
-					$row_start += $row_inc;
-				}
-			} while((count($table_data) &gt; 0) and ($segment=='none'));
-		}
-
-		if(($segment == 'none') || ($segment &lt; 0)) {
-			// Create footer/closing comment in SQL-file
-			$this-&gt;stow(&quot;\n&quot;);
-			$this-&gt;stow(&quot;#\n&quot;);
-			$this-&gt;stow(&quot;# End of data contents of table &quot; . $this-&gt;backquote($table) . &quot;\n&quot;);
-			$this-&gt;stow(&quot;# --------------------------------------------------------\n&quot;);
-			$this-&gt;stow(&quot;\n&quot;);
-		}
-	} // end backup_table()
-
-	function return_bytes($val) {
-		$val = trim($val);
-		$last = strtolower($val{strlen($val)-1});
-		switch($last) {
-		// The 'G' modifier is available since PHP 5.1.0
-			case 'g':
-				$val *= 1024;
-			case 'm':
-				$val *= 1024;
-			case 'k':
-				$val *= 1024;
-		}
-		return $val;
-	}
-
-	function db_backup($core_tables, $other_tables) {
-		global $table_prefix, $wpdb;
-		$datum = date(&quot;Ymd_B&quot;);
-		$wp_backup_filename = DB_NAME . &quot;_$table_prefix$datum.sql&quot;;
-
-		if ($this-&gt;gzip())
-			$wp_backup_filename .= '.gz';
-
-		if (is_writable(ABSPATH . $this-&gt;backup_dir)) {
-
-			$this-&gt;fp = $this-&gt;open(ABSPATH . $this-&gt;backup_dir . $wp_backup_filename);
-			if(!$this-&gt;fp) {
-				$this-&gt;backup_error(__('Could not open the backup file for writing!','wp-db-backup'));
-				return false;
-			}
-		} else {
-			$this-&gt;backup_error(__('The backup directory is not writeable!','wp-db-backup'));
-			return false;
-		}
-
-		//Begin new backup of MySql
-		$this-&gt;stow(&quot;# WordPress MySQL database backup\n&quot;);
-		$this-&gt;stow(&quot;#\n&quot;);
-		$this-&gt;stow(&quot;# Generated: &quot; . date(&quot;l j. F Y H:i T&quot;) . &quot;\n&quot;);
-		$this-&gt;stow(&quot;# Hostname: &quot; . DB_HOST . &quot;\n&quot;);
-		$this-&gt;stow(&quot;# Database: &quot; . $this-&gt;backquote(DB_NAME) . &quot;\n&quot;);
-		$this-&gt;stow(&quot;# --------------------------------------------------------\n&quot;);
-
-			if ( (is_array($other_tables)) &amp;&amp; (count($other_tables) &gt; 0) )
-			$tables = array_merge($core_tables, $other_tables);
-		else
-			$tables = $core_tables;
-
-		foreach ($tables as $table) {
-			// Increase script execution time-limit to 15 min for every table.
-			if ( !ini_get('safe_mode')) @set_time_limit(15*60);
-			// Create the SQL statements
-			$this-&gt;stow(&quot;# --------------------------------------------------------\n&quot;);
-			$this-&gt;stow(&quot;# Table: &quot; . $this-&gt;backquote($table) . &quot;\n&quot;);
-			$this-&gt;stow(&quot;# --------------------------------------------------------\n&quot;);
-			$this-&gt;backup_table($table);
-		}
-
-		$this-&gt;close($this-&gt;fp);
-
-		if (count($this-&gt;backup_errors)) {
-			return false;
-		} else {
-			return $wp_backup_filename;
-		}
-
-	} //wp_db_backup
-
-
-
-	function backup_menu() {
-		global $table_prefix, $wpdb;
-		$feedback = '';
-		$WHOOPS = FALSE;
-		// did we just do a backup?  If so, let's report the status
-		if ( $this-&gt;backup_complete ) {
-			$feedback = '&lt;div class=&quot;updated&quot;&gt;&lt;p&gt;' . __('Backup Successful','wp-db-backup') . '!';
-			$file = $this-&gt;backup_file;
-			switch($_POST['deliver']) {
-			case 'http':
-				$feedback .= '&lt;br /&gt;' . sprintf(__('Your backup file: &lt;a href=&quot;%1s&quot;&gt;%2s&lt;/a&gt; should begin downloading shortly.','wp-db-backup'), get_option('wpurl') . &quot;/{$this-&gt;backup_dir}{$this-&gt;backup_file}&quot;, $this-&gt;backup_file);
-				break;
-			case 'smtp':
-				if (! is_email($_POST['backup_recipient'])) {
-					$feedback .= get_option('admin_email');
-				} else {
-					$feedback .= $_POST['backup_recipient'];
-				}
-				$feedback = '&lt;br /&gt;' . sprintf(__('Your backup has been emailed to %s','wp-db-backup'), $feedback);
-				break;
-			case 'none':
-				$feedback .= '&lt;br /&gt;' . __('Your backup file has been saved on the server. If you would like to download it now, right click and select &quot;Save As&quot;','wp-db-backup');
-				$feedback .= ':&lt;br /&gt; &lt;a href=&quot;' . get_option('wpurl') . &quot;/{$this-&gt;backup_dir}$file\&quot;&gt;$file&lt;/a&gt; : &quot; . sprintf(__('%s bytes','wp-db-backup'), filesize(ABSPATH . $this-&gt;backup_dir . $file));
-			}
-			$feedback .= '&lt;/p&gt;&lt;/div&gt;';
-		}
-
-		if (count($this-&gt;backup_errors)) {
-			$feedback .= '&lt;div class=&quot;updated error&quot;&gt;' . __('The following errors were reported:','wp-db-backup') . &quot;&lt;pre&gt;&quot;;
-			foreach($this-&gt;backup_errors as $error) {
-				$feedback .= &quot;{$error}\n&quot;;  //Errors are already localized
-			}
-			$feedback .= &quot;&lt;/pre&gt;&lt;/div&gt;&quot;;
-		}
-
-		// did we just save options for wp-cron?
-		if ( (function_exists('wp_schedule_event') || function_exists('wp_cron_init'))
-			&amp;&amp; isset($_POST['wp_cron_backup_options']) ) :
-			if ( function_exists('wp_schedule_event') ) {
-				wp_clear_scheduled_hook( 'wp_db_backup_cron' ); // unschedule previous
-				$scheds = (array) wp_get_schedules();
-				$name = strval($_POST['wp_cron_schedule']);
-				$interval = ( isset($scheds[$name]['interval']) ) ?
-					(int) $scheds[$name]['interval'] : 0;
-				update_option('wp_cron_backup_schedule', $name, FALSE);
-				if ( ! 0 == $interval ) {
-					wp_schedule_event(time() + $interval, $name, 'wp_db_backup_cron');
-				}
-			}
-			else {
-				update_option('wp_cron_backup_schedule', intval($_POST['cron_schedule']), FALSE);
-			}
-			update_option('wp_cron_backup_tables', $_POST['wp_cron_backup_tables']);
-			if (is_email($_POST['cron_backup_recipient'])) {
-				update_option('wp_cron_backup_recipient', $_POST['cron_backup_recipient'], FALSE);
-			}
-			$feedback .= '&lt;div class=&quot;updated&quot;&gt;&lt;p&gt;' . __('Scheduled Backup Options Saved!','wp-db-backup') . '&lt;/p&gt;&lt;/div&gt;';
-		endif;
-
-		$other_tables = array();
-		$also_backup = array();
-
-		// Get complete db table list
-		$all_tables = $wpdb-&gt;get_results(&quot;SHOW TABLES&quot;, ARRAY_N);
-		$all_tables = array_map(create_function('$a', 'return $a[0];'), $all_tables);
-		// Get list of WP tables that actually exist in this DB (for 1.6 compat!)
-		$wp_backup_default_tables = array_intersect($all_tables, $this-&gt;core_table_names);
-		// Get list of non-WP tables
-		$other_tables = array_diff($all_tables, $wp_backup_default_tables);
-
-		if ('' != $feedback)
-			echo $feedback;
-
-		// Give the new dirs the same perms as wp-content.
-		$stat = stat( ABSPATH . 'wp-content' );
-		$dir_perms = $stat['mode'] &amp; 0000777; // Get the permission bits.
-
-		if ( !file_exists( ABSPATH . $this-&gt;backup_dir) ) {
-			if ( @ mkdir( ABSPATH . $this-&gt;backup_dir) ) {
-				@ chmod( ABSPATH . $this-&gt;backup_dir, $dir_perms);
-			} else {
-				echo '&lt;div class=&quot;updated error&quot;&gt;&lt;p style=&quot;text-align:center&quot;&gt;' . __('WARNING: Your wp-content directory is &lt;strong&gt;NOT&lt;/strong&gt; writable! We can not create the backup directory.','wp-db-backup') . '&lt;br /&gt;' . ABSPATH . $this-&gt;backup_dir . &quot;&lt;/p&gt;&lt;/div&gt;&quot;;
-			$WHOOPS = TRUE;
-			}
-		}
-
-		if ( !is_writable( ABSPATH . $this-&gt;backup_dir) ) {
-			echo '&lt;div class=&quot;updated error&quot;&gt;&lt;p style=&quot;text-align:center&quot;&gt;' . __('WARNING: Your backup directory is &lt;strong&gt;NOT&lt;/strong&gt; writable! We can not create the backup directory.','wp-db-backup') . '&lt;br /&gt;' . ABSPATH . &quot;&lt;/p&gt;&lt;/div&gt;&quot;;
-		}
-
-		?&gt;&lt;div class='wrap'&gt;
-		&lt;h2&gt;&lt;?php _e('Backup','wp-db-backup') ?&gt;&lt;/h2&gt;
-		&lt;form method=&quot;post&quot; action=&quot;edit.php?page=&lt;?php echo WPAU_PAGE ?&gt;&amp;task=backupdb&quot;&gt;
-		&lt;?php
-			if(function_exists('wp_nonce_field')) {
-				wp_nonce_field('wordpress_automatic_upgrade' );
-			}
-		?&gt;
-		&lt;fieldset class=&quot;options&quot;&gt;&lt;legend&gt;&lt;?php _e('Tables','wp-db-backup') ?&gt;&lt;/legend&gt;
-		&lt;table align=&quot;center&quot; cellspacing=&quot;5&quot; cellpadding=&quot;5&quot;&gt;&lt;tr&gt;&lt;td width=&quot;50%&quot; align=&quot;left&quot; class=&quot;alternate&quot; valign=&quot;top&quot;&gt;
-		&lt;?php _e('These core WordPress tables will always be backed up:','wp-db-backup') ?&gt;&lt;br /&gt;&lt;ul&gt;&lt;?php
-		foreach ($wp_backup_default_tables as $table) {
-			echo &quot;&lt;li&gt;&lt;input type='hidden' name='core_tables[]' value='$table' /&gt;$table&lt;/li&gt;&quot;;
-		}
-		?&gt;&lt;/ul&gt;&lt;/td&gt;&lt;td width=&quot;50%&quot; align=&quot;left&quot; valign=&quot;top&quot;&gt;&lt;?php
-		if (count($other_tables) &gt; 0) {
-			echo __('You may choose to include any of the following tables:','wp-db-backup') . ' &lt;br /&gt;';
-			foreach ($other_tables as $table) {
-				echo &quot;&lt;label style=\&quot;display:block;\&quot;&gt;&lt;input type='checkbox' name='other_tables[]' value='{$table}' /&gt; {$table}&lt;/label&gt;&quot;;
-			}
-		}
-		?&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/fieldset&gt;
-		&lt;div align=&quot;center&quot;&gt;
-		&lt;fieldset&gt;
-	&lt;input type=&quot;Submit&quot; name=&quot;wpaudbbackup&quot; value=&quot;Start DB Backup&quot; /&gt;
-	&lt;/fieldset&gt;
-	&lt;/div&gt;
-		&lt;?php
-		echo '&lt;/form&gt;';
-		echo '&lt;/div&gt;';
-
-	} // end wp_backup_menu()
-
-
-	function user_can_backup() {
-		return current_user_can('import');
-	}
-
-	function validate_file($file) {
-		if (false !== strpos($file, '..'))
-			die(__(&quot;Cheatin' uh ?&quot;,'wp-db-backup'));
-
-		if (false !== strpos($file, './'))
-			die(__(&quot;Cheatin' uh ?&quot;,'wp-db-backup'));
-
-		if (':' == substr($file, 1, 1))
-			die(__(&quot;Cheatin' uh ?&quot;,'wp-db-backup'));
-	}
-
-	function zip_backup($fileName) {
-		//require_once('lib/pclzip.lib.php');
-		//echo &quot;In here $fileName&quot;;
-		$archiveName = ABSPATH.$this-&gt;backup_dir. $fileName;
-		$this-&gt;logMessage('Creating a archive with the name '.$archiveName.'&lt;br/ &gt;');
-		$archiver = new PclZip($archiveName);
-		$list = $archiver-&gt;create(ABSPATH.$this-&gt;backup_dir.$this-&gt;backup_file);
-		if ($list == 0) {
-			$this-&gt;logMessage('Could not archive the files ' .$archiver-&gt;errorInfo(true));
-			$this-&gt;isFileWritten = false;
-			return false;
-		}
-		else {
-			$this-&gt;logMessage('&lt;br /&gt;&lt;strong&gt;Succesfully Created &lt;/strong&gt;database backup archive at '. $archiveName .'&lt;br /&gt;&lt;br /&gt;');
-			$this-&gt;isFileWritten = true;
-			if(!$basedir = @opendir(ABSPATH.$this-&gt;backup_dir)) {
-				@chmod($archiveName, 0755);
-				@closedir($this-&gt;backupPath);
-			}
-			else {
-				exec(&quot;chmod 755 $archiveName&quot;);
-			}
-			unlink(ABSPATH.$this-&gt;backup_dir.$this-&gt;backup_file);
-			return true;
-		}
-		unset($archiver);
-	}
-
-}
-
-
-?&gt;
+&lt;?php
+/*
+This class is used from the popular plugin wordpress database backup authored by  Austin Matzko  http://www.ilfilosofo.com/blog/
+
+Development continued from that done by Skippy (http://www.skippy.net/)
+
+Much of this was modified from Mark Ghosh's One Click Backup, which
+in turn was derived from phpMyAdmin.
+
+Many thanks to Owen (http://asymptomatic.net/wp/) for his patch
+   http://dev.wp-plugins.org/ticket/219
+
+Copyright 2007  Austin Matzko  (email : if.website at gmail.com)
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+
+define('ROWS_PER_SEGMENT', 100);
+
+class wpauBackup extends wpauHelper {
+
+	var $backup_complete = false;
+	var $isFileWritten = false;
+	var $backup_file;
+	var $backup_dir;
+	var $backup_errors = array();
+
+	function gzip() {
+		return function_exists('gzopen');
+	}
+
+	function wpauBackup($backup_dir) {
+		global $table_prefix, $wpdb, $wp_version;
+		$current_version = (float)$wp_version;
+		$table_prefix = ( isset( $table_prefix ) ) ? $table_prefix : $wpdb-&gt;prefix;
+		if($current_version &lt; 2.3) {
+			if ( isset( $wpdb-&gt;link2cat ) ) {
+				$this-&gt;core_table_names = explode(',',&quot;$wpdb-&gt;categories,$wpdb-&gt;comments,$wpdb-&gt;link2cat,$wpdb-&gt;links,$wpdb-&gt;options,$wpdb-&gt;post2cat,$wpdb-&gt;postmeta,$wpdb-&gt;posts,$wpdb-&gt;users,$wpdb-&gt;usermeta&quot;);
+			}
+			else {
+				$this-&gt;core_table_names = explode(',',&quot;$wpdb-&gt;categories,$wpdb-&gt;comments,$wpdb-&gt;linkcategories,$wpdb-&gt;links,$wpdb-&gt;options,$wpdb-&gt;post2cat,$wpdb-&gt;postmeta,$wpdb-&gt;posts,$wpdb-&gt;users,$wpdb-&gt;usermeta&quot;);
+			}
+		}
+		else { //WP 2.3+ needs database diff table names
+			$this-&gt;core_table_names = array(
+				$wpdb-&gt;comments,
+				$wpdb-&gt;linkcategories,
+				$wpdb-&gt;links,
+				$wpdb-&gt;options,
+				$wpdb-&gt;postmeta,
+				$wpdb-&gt;posts,
+				$wpdb-&gt;terms,
+				$wpdb-&gt;term_taxonomy,
+				$wpdb-&gt;term_relationships,
+				$wpdb-&gt;users,
+				$wpdb-&gt;usermeta,
+			);
+		}
+		$this-&gt;backup_dir = trailingslashit($backup_dir);
+	}
+	
+	function perform_backup($automated = false) {
+		if(!current_user_can('manage_options')) {
+				echo 'Oops sorry you are not authorized to do this';
+				return false;
+		}
+		// are we backing up any other tables?
+		$also_backup = array();
+
+		if (isset($_POST['other_tables'])) {
+			$also_backup = $_POST['other_tables'];
+		}
+		$core_tables = $_POST['core_tables'];
+		if($automated) {
+			$core_tables = $this-&gt;core_table_names;
+		}
+
+		$this-&gt;backup_file = $this-&gt;db_backup($core_tables, $also_backup);
+		if (FALSE !== $this-&gt;backup_file) {
+			$this-&gt;backup_complete = true;
+			return true;
+		}
+		else
+			return false;
+	}
+
+	/**
+	 * Better addslashes for SQL queries.
+	 * Taken from phpMyAdmin.
+	 */
+	function sql_addslashes($a_string = '', $is_like = FALSE) {
+		if ($is_like) $a_string = str_replace('\\', '\\\\\\\\', $a_string);
+		else $a_string = str_replace('\\', '\\\\', $a_string);
+		return str_replace('\'', '\\\'', $a_string);
+	}
+
+	/**
+	 * Add backquotes to tables and db-names in
+	 * SQL queries. Taken from phpMyAdmin.
+	 */
+	function backquote($a_name) {
+		if (!empty($a_name) &amp;&amp; $a_name != '*') {
+			if (is_array($a_name)) {
+				$result = array();
+				reset($a_name);
+				while(list($key, $val) = each($a_name))
+					$result[$key] = '`' . $val . '`';
+				return $result;
+			} else {
+				return '`' . $a_name . '`';
+			}
+		} else {
+			return $a_name;
+		}
+	}
+
+	function open($filename = '', $mode = 'w') {
+		if ('' == $filename) return false;
+		if ($this-&gt;gzip())
+			$fp = @gzopen($filename, $mode);
+		else
+			$fp = @fopen($filename, $mode);
+		return $fp;
+	}
+
+	function close($fp) {
+		if ($this-&gt;gzip())
+			gzclose($fp);
+		else
+			fclose($fp);
+	}
+
+	function stow($query_line) {
+		if ($this-&gt;gzip()) {
+			if(@gzwrite($this-&gt;fp, $query_line) === FALSE) {
+				$this-&gt;backup_error(__('There was an error writing a line to the backup script:','wp-db-backup'));
+				$this-&gt;backup_error('&amp;nbsp;&amp;nbsp;' . $query_line);
+			}
+		} else {
+			if(@fwrite($this-&gt;fp, $query_line) === FALSE) {
+				$this-&gt;backup_error(__('There was an error writing a line to the backup script:','wp-db-backup'));
+				$this-&gt;backup_error('&amp;nbsp;&amp;nbsp;' . $query_line);
+			}
+		}
+	}
+
+	function backup_error($err) {
+		if(count($this-&gt;backup_errors) &lt; 20)
+			$this-&gt;backup_errors[] = $err;
+		elseif(count($this-&gt;backup_errors) == 20)
+			$this-&gt;backup_errors[] = __('Subsequent errors have been omitted from this log.','wp-db-backup');
+	}
+
+	/**
+	 * Taken partially from phpMyAdmin and partially from
+	 * Alain Wolf, Zurich - Switzerland
+	 * Website: http://restkultur.ch/personal/wolf/scripts/db_backup/
+
+	 * Modified by Scott Merril (http://www.skippy.net/)
+	 * to use the WordPress $wpdb object
+	 */
+	function backup_table($table, $segment = 'none') {
+		global $wpdb;
+		if('' == $table) {
+			return;
+		}
+		$table_structure = $wpdb-&gt;get_results(&quot;DESCRIBE $table&quot;);
+		if (! $table_structure) {
+			$this-&gt;backup_error(__('Error getting table details','wp-db-backup') . &quot;: $table&quot;);
+			return FALSE;
+		}
+
+		if(($segment == 'none') || ($segment == 0)) {
+			// Add SQL statement to drop existing table
+			$this-&gt;stow(&quot;\n\n&quot;);
+			$this-&gt;stow(&quot;#\n&quot;);
+			$this-&gt;stow(&quot;# Delete any existing table &quot; . $this-&gt;backquote($table) . &quot;\n&quot;);
+			$this-&gt;stow(&quot;#\n&quot;);
+			$this-&gt;stow(&quot;\n&quot;);
+			$this-&gt;stow(&quot;DROP TABLE IF EXISTS &quot; . $this-&gt;backquote($table) . &quot;;\n&quot;);
+
+			// Table structure
+			// Comment in SQL-file
+			$this-&gt;stow(&quot;\n\n&quot;);
+			$this-&gt;stow(&quot;#\n&quot;);
+			$this-&gt;stow(&quot;# Table structure of table &quot; . $this-&gt;backquote($table) . &quot;\n&quot;);
+			$this-&gt;stow(&quot;#\n&quot;);
+			$this-&gt;stow(&quot;\n&quot;);
+
+			$create_table = $wpdb-&gt;get_results(&quot;SHOW CREATE TABLE $table&quot;, ARRAY_N);
+			if (FALSE === $create_table) {
+				$this-&gt;backup_error(sprintf(__(&quot;Error with SHOW CREATE TABLE for %s.&quot;,'wp-db-backup'), $table));
+				$this-&gt;stow(&quot;#\n# Error with SHOW CREATE TABLE for $table!\n#\n&quot;);
+			}
+			$this-&gt;stow($create_table[0][1] . ' ;');
+
+			if (FALSE === $table_structure) {
+				$this-&gt;backup_error(sprintf(__(&quot;Error getting table structure of %s&quot;,'wp-db-backup'), $table));
+				$this-&gt;stow(&quot;#\n# Error getting table structure of $table!\n#\n&quot;);
+			}
+
+			// Comment in SQL-file
+			$this-&gt;stow(&quot;\n\n&quot;);
+			$this-&gt;stow(&quot;#\n&quot;);
+			$this-&gt;stow('# Data contents of table ' . $this-&gt;backquote($table) . &quot;\n&quot;);
+			$this-&gt;stow(&quot;#\n&quot;);
+		}
+
+		if(($segment == 'none') || ($segment &gt;= 0)) {
+			$ints = array();
+			foreach ($table_structure as $struct) {
+				if ( (0 === strpos($struct-&gt;Type, 'tinyint')) ||
+					(0 === strpos(strtolower($struct-&gt;Type), 'smallint')) ||
+					(0 === strpos(strtolower($struct-&gt;Type), 'mediumint')) ||
+					(0 === strpos(strtolower($struct-&gt;Type), 'int')) ||
+					(0 === strpos(strtolower($struct-&gt;Type), 'bigint')) ||
+					(0 === strpos(strtolower($struct-&gt;Type), 'timestamp')) ) {
+						$ints[strtolower($struct-&gt;Field)] = &quot;1&quot;;
+				}
+			}
+
+
+			// Batch by $row_inc
+
+			if($segment == 'none') {
+				$row_start = 0;
+				$row_inc = ROWS_PER_SEGMENT;
+			} else {
+				$row_start = $segment * ROWS_PER_SEGMENT;
+				$row_inc = ROWS_PER_SEGMENT;
+			}
+
+			do {
+				if ( !ini_get('safe_mode')) @set_time_limit(15*60);
+				$table_data = $wpdb-&gt;get_results(&quot;SELECT * FROM $table LIMIT {$row_start}, {$row_inc}&quot;, ARRAY_A);
+
+				/*
+				if (FALSE === $table_data) {
+					$wp_backup_error .= &quot;Error getting table contents from $table\r\n&quot;;
+					fwrite($fp, &quot;#\n# Error getting table contents fom $table!\n#\n&quot;);
+				}
+				*/
+
+				$entries = 'INSERT INTO ' . $this-&gt;backquote($table) . ' VALUES (';
+				//    \x08\\x09, not required
+				$search = array(&quot;\x00&quot;, &quot;\x0a&quot;, &quot;\x0d&quot;, &quot;\x1a&quot;);
+				$replace = array('\0', '\n', '\r', '\Z');
+				if($table_data) {
+					foreach ($table_data as $row) {
+						$values = array();
+						foreach ($row as $key =&gt; $value) {
+							if ($ints[strtolower($key)]) {
+								$values[] = $value;
+							} else {
+								$values[] = &quot;'&quot; . str_replace($search, $replace, $this-&gt;sql_addslashes($value)) . &quot;'&quot;;
+							}
+						}
+						$this-&gt;stow(&quot; \n&quot; . $entries . implode(', ', $values) . ') ;');
+					}
+					$row_start += $row_inc;
+				}
+			} while((count($table_data) &gt; 0) and ($segment=='none'));
+		}
+
+		if(($segment == 'none') || ($segment &lt; 0)) {
+			// Create footer/closing comment in SQL-file
+			$this-&gt;stow(&quot;\n&quot;);
+			$this-&gt;stow(&quot;#\n&quot;);
+			$this-&gt;stow(&quot;# End of data contents of table &quot; . $this-&gt;backquote($table) . &quot;\n&quot;);
+			$this-&gt;stow(&quot;# --------------------------------------------------------\n&quot;);
+			$this-&gt;stow(&quot;\n&quot;);
+		}
+	} // end backup_table()
+
+	function return_bytes($val) {
+		$val = trim($val);
+		$last = strtolower($val{strlen($val)-1});
+		switch($last) {
+		// The 'G' modifier is available since PHP 5.1.0
+			case 'g':
+				$val *= 1024;
+			case 'm':
+				$val *= 1024;
+			case 'k':
+				$val *= 1024;
+		}
+		return $val;
+	}
+
+	function db_backup($core_tables, $other_tables) {
+		global $table_prefix, $wpdb;
+		$datum = date(&quot;Ymd_B&quot;);
+		$wp_backup_filename = DB_NAME . &quot;_$table_prefix$datum.sql&quot;;
+
+		if ($this-&gt;gzip())
+			$wp_backup_filename .= '.gz';
+
+		if (is_writable(ABSPATH . $this-&gt;backup_dir)) {
+
+			$this-&gt;fp = $this-&gt;open(ABSPATH . $this-&gt;backup_dir . $wp_backup_filename);
+			if(!$this-&gt;fp) {
+				$this-&gt;backup_error(__('Could not open the backup file for writing!','wp-db-backup'));
+				return false;
+			}
+		} else {
+			$this-&gt;backup_error(__('The backup directory is not writeable!','wp-db-backup'));
+			return false;
+		}
+
+		//Begin new backup of MySql
+		$this-&gt;stow(&quot;# WordPress MySQL database backup\n&quot;);
+		$this-&gt;stow(&quot;#\n&quot;);
+		$this-&gt;stow(&quot;# Generated: &quot; . date(&quot;l j. F Y H:i T&quot;) . &quot;\n&quot;);
+		$this-&gt;stow(&quot;# Hostname: &quot; . DB_HOST . &quot;\n&quot;);
+		$this-&gt;stow(&quot;# Database: &quot; . $this-&gt;backquote(DB_NAME) . &quot;\n&quot;);
+		$this-&gt;stow(&quot;# --------------------------------------------------------\n&quot;);
+
+			if ( (is_array($other_tables)) &amp;&amp; (count($other_tables) &gt; 0) )
+			$tables = array_merge($core_tables, $other_tables);
+		else
+			$tables = $core_tables;
+
+		foreach ($tables as $table) {
+			// Increase script execution time-limit to 15 min for every table.
+			if ( !ini_get('safe_mode')) @set_time_limit(15*60);
+			// Create the SQL statements
+			$this-&gt;stow(&quot;# --------------------------------------------------------\n&quot;);
+			$this-&gt;stow(&quot;# Table: &quot; . $this-&gt;backquote($table) . &quot;\n&quot;);
+			$this-&gt;stow(&quot;# --------------------------------------------------------\n&quot;);
+			$this-&gt;backup_table($table);
+		}
+
+		$this-&gt;close($this-&gt;fp);
+
+		if (count($this-&gt;backup_errors)) {
+			return false;
+		} else {
+			return $wp_backup_filename;
+		}
+
+	} //wp_db_backup
+
+
+
+	function backup_menu() {
+		global $table_prefix, $wpdb;
+		$feedback = '';
+		$WHOOPS = FALSE;
+		// did we just do a backup?  If so, let's report the status
+		if ( $this-&gt;backup_complete ) {
+			$feedback = '&lt;div class=&quot;updated&quot;&gt;&lt;p&gt;' . __('Backup Successful','wp-db-backup') . '!';
+			$file = $this-&gt;backup_file;
+			switch($_POST['deliver']) {
+			case 'http':
+				$feedback .= '&lt;br /&gt;' . sprintf(__('Your backup file: &lt;a href=&quot;%1s&quot;&gt;%2s&lt;/a&gt; should begin downloading shortly.','wp-db-backup'), get_option('wpurl') . &quot;/{$this-&gt;backup_dir}{$this-&gt;backup_file}&quot;, $this-&gt;backup_file);
+				break;
+			case 'smtp':
+				if (! is_email($_POST['backup_recipient'])) {
+					$feedback .= get_option('admin_email');
+				} else {
+					$feedback .= $_POST['backup_recipient'];
+				}
+				$feedback = '&lt;br /&gt;' . sprintf(__('Your backup has been emailed to %s','wp-db-backup'), $feedback);
+				break;
+			case 'none':
+				$feedback .= '&lt;br /&gt;' . __('Your backup file has been saved on the server. If you would like to download it now, right click and select &quot;Save As&quot;','wp-db-backup');
+				$feedback .= ':&lt;br /&gt; &lt;a href=&quot;' . get_option('wpurl') . &quot;/{$this-&gt;backup_dir}$file\&quot;&gt;$file&lt;/a&gt; : &quot; . sprintf(__('%s bytes','wp-db-backup'), filesize(ABSPATH . $this-&gt;backup_dir . $file));
+			}
+			$feedback .= '&lt;/p&gt;&lt;/div&gt;';
+		}
+
+		if (count($this-&gt;backup_errors)) {
+			$feedback .= '&lt;div class=&quot;updated error&quot;&gt;' . __('The following errors were reported:','wp-db-backup') . &quot;&lt;pre&gt;&quot;;
+			foreach($this-&gt;backup_errors as $error) {
+				$feedback .= &quot;{$error}\n&quot;;  //Errors are already localized
+			}
+			$feedback .= &quot;&lt;/pre&gt;&lt;/div&gt;&quot;;
+		}
+
+		// did we just save options for wp-cron?
+		if ( (function_exists('wp_schedule_event') || function_exists('wp_cron_init'))
+			&amp;&amp; isset($_POST['wp_cron_backup_options']) ) :
+			if ( function_exists('wp_schedule_event') ) {
+				wp_clear_scheduled_hook( 'wp_db_backup_cron' ); // unschedule previous
+				$scheds = (array) wp_get_schedules();
+				$name = strval($_POST['wp_cron_schedule']);
+				$interval = ( isset($scheds[$name]['interval']) ) ?
+					(int) $scheds[$name]['interval'] : 0;
+				update_option('wp_cron_backup_schedule', $name, FALSE);
+				if ( ! 0 == $interval ) {
+					wp_schedule_event(time() + $interval, $name, 'wp_db_backup_cron');
+				}
+			}
+			else {
+				update_option('wp_cron_backup_schedule', intval($_POST['cron_schedule']), FALSE);
+			}
+			update_option('wp_cron_backup_tables', $_POST['wp_cron_backup_tables']);
+			if (is_email($_POST['cron_backup_recipient'])) {
+				update_option('wp_cron_backup_recipient', $_POST['cron_backup_recipient'], FALSE);
+			}
+			$feedback .= '&lt;div class=&quot;updated&quot;&gt;&lt;p&gt;' . __('Scheduled Backup Options Saved!','wp-db-backup') . '&lt;/p&gt;&lt;/div&gt;';
+		endif;
+
+		$other_tables = array();
+		$also_backup = array();
+
+		// Get complete db table list
+		$all_tables = $wpdb-&gt;get_results(&quot;SHOW TABLES&quot;, ARRAY_N);
+		$all_tables = array_map(create_function('$a', 'return $a[0];'), $all_tables);
+		// Get list of WP tables that actually exist in this DB (for 1.6 compat!)
+		$wp_backup_default_tables = array_intersect($all_tables, $this-&gt;core_table_names);
+		// Get list of non-WP tables
+		$other_tables = array_diff($all_tables, $wp_backup_default_tables);
+
+		if ('' != $feedback)
+			echo $feedback;
+
+		// Give the new dirs the same perms as wp-content.
+		$stat = stat( ABSPATH . 'wp-content' );
+		$dir_perms = $stat['mode'] &amp; 0000777; // Get the permission bits.
+
+		if ( !file_exists( ABSPATH . $this-&gt;backup_dir) ) {
+			if ( @ mkdir( ABSPATH . $this-&gt;backup_dir) ) {
+				@ chmod( ABSPATH . $this-&gt;backup_dir, $dir_perms);
+			} else {
+				echo '&lt;div class=&quot;updated error&quot;&gt;&lt;p style=&quot;text-align:center&quot;&gt;' . __('WARNING: Your wp-content directory is &lt;strong&gt;NOT&lt;/strong&gt; writable! We can not create the backup directory.','wp-db-backup') . '&lt;br /&gt;' . ABSPATH . $this-&gt;backup_dir . &quot;&lt;/p&gt;&lt;/div&gt;&quot;;
+			$WHOOPS = TRUE;
+			}
+		}
+
+		if ( !is_writable( ABSPATH . $this-&gt;backup_dir) ) {
+			echo '&lt;div class=&quot;updated error&quot;&gt;&lt;p style=&quot;text-align:center&quot;&gt;' . __('WARNING: Your backup directory is &lt;strong&gt;NOT&lt;/strong&gt; writable! We can not create the backup directory.','wp-db-backup') . '&lt;br /&gt;' . ABSPATH . &quot;&lt;/p&gt;&lt;/div&gt;&quot;;
+		}
+
+		?&gt;&lt;div class='wrap'&gt;
+		&lt;h2&gt;&lt;?php _e('Backup','wp-db-backup') ?&gt;&lt;/h2&gt;
+		&lt;form method=&quot;post&quot; action=&quot;edit.php?page=&lt;?php echo WPAU_PAGE ?&gt;&amp;task=backupdb&quot;&gt;
+		&lt;?php
+			if(function_exists('wp_nonce_field')) {
+				wp_nonce_field('wordpress_automatic_upgrade' );
+			}
+		?&gt;
+		&lt;fieldset class=&quot;options&quot;&gt;&lt;legend&gt;&lt;?php _e('Tables','wp-db-backup') ?&gt;&lt;/legend&gt;
+		&lt;table align=&quot;center&quot; cellspacing=&quot;5&quot; cellpadding=&quot;5&quot;&gt;&lt;tr&gt;&lt;td width=&quot;50%&quot; align=&quot;left&quot; class=&quot;alternate&quot; valign=&quot;top&quot;&gt;
+		&lt;?php _e('These core WordPress tables will always be backed up:','wp-db-backup') ?&gt;&lt;br /&gt;&lt;ul&gt;&lt;?php
+		foreach ($wp_backup_default_tables as $table) {
+			echo &quot;&lt;li&gt;&lt;input type='hidden' name='core_tables[]' value='$table' /&gt;$table&lt;/li&gt;&quot;;
+		}
+		?&gt;&lt;/ul&gt;&lt;/td&gt;&lt;td width=&quot;50%&quot; align=&quot;left&quot; valign=&quot;top&quot;&gt;&lt;?php
+		if (count($other_tables) &gt; 0) {
+			echo __('You may choose to include any of the following tables:','wp-db-backup') . ' &lt;br /&gt;';
+			foreach ($other_tables as $table) {
+				echo &quot;&lt;label style=\&quot;display:block;\&quot;&gt;&lt;input type='checkbox' name='other_tables[]' value='{$table}' /&gt; {$table}&lt;/label&gt;&quot;;
+			}
+		}
+		?&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/fieldset&gt;
+		&lt;div align=&quot;center&quot;&gt;
+		&lt;fieldset&gt;
+	&lt;input type=&quot;Submit&quot; name=&quot;wpaudbbackup&quot; value=&quot;Start DB Backup&quot; /&gt;
+	&lt;/fieldset&gt;
+	&lt;/div&gt;
+		&lt;?php
+		echo '&lt;/form&gt;';
+		echo '&lt;/div&gt;';
+
+	} // end wp_backup_menu()
+
+
+	function user_can_backup() {
+		return current_user_can('import');
+	}
+
+	function validate_file($file) {
+		if (false !== strpos($file, '..'))
+			die(__(&quot;Cheatin' uh ?&quot;,'wp-db-backup'));
+
+		if (false !== strpos($file, './'))
+			die(__(&quot;Cheatin' uh ?&quot;,'wp-db-backup'));
+
+		if (':' == substr($file, 1, 1))
+			die(__(&quot;Cheatin' uh ?&quot;,'wp-db-backup'));
+	}
+
+	function zip_backup($fileName) {
+		//require_once('lib/pclzip.lib.php');
+		//echo &quot;In here $fileName&quot;;
+		$archiveName = ABSPATH.$this-&gt;backup_dir. $fileName;
+		$this-&gt;logMessage('Creating a archive with the name '.$archiveName.'&lt;br/ &gt;');
+		$archiver = new PclZip($archiveName);
+		$list = $archiver-&gt;create(ABSPATH.$this-&gt;backup_dir.$this-&gt;backup_file);
+		if ($list == 0) {
+			$this-&gt;logMessage('Could not archive the files ' .$archiver-&gt;errorInfo(true));
+			$this-&gt;isFileWritten = false;
+			return false;
+		}
+		else {
+			$this-&gt;logMessage('&lt;br /&gt;&lt;strong&gt;Succesfully Created &lt;/strong&gt;database backup archive at '. $archiveName .'&lt;br /&gt;&lt;br /&gt;');
+			$this-&gt;isFileWritten = true;
+			if(!$basedir = @opendir(ABSPATH.$this-&gt;backup_dir)) {
+				@chmod($archiveName, 0755);
+				@closedir($this-&gt;backupPath);
+			}
+			else {
+				exec(&quot;chmod 755 $archiveName&quot;);
+			}
+			unlink(ABSPATH.$this-&gt;backup_dir.$this-&gt;backup_file);
+			return true;
+		}
+		unset($archiver);
+	}
+
+}
+
+
+?&gt;</diff>
      <filename>wordpress/wp-content/plugins/wordpress-automatic-upgrade/wpau_db_backup.class.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,101 +1,101 @@
-&lt;?php
-/**
- Wordpress Automatic upgrades helper class
- Helps sub classes log all data
- Helps to update db with logs
- Helps to run miscelleaneous functions
- **/
-
-if($_REQUEST['action'] != 'upgrade-plugin') {
-	if(! class_exists('PclZip')) {
-		require_once('lib/pclzip.lib.php');
-	}
-}
-
-require_once('lib/snoopy.class.php');
-
-if(! function_exists('ftp_base')) {
-	require_once('lib/ftp_class.php');
-}
-
-class wpauHelper {
-	var $loggedData;
-	var $errorData;
-	var $errorFlag;
-	var $fatalError; // if its flagged as a fatal error we cannot continue with further process
-
-	function wpauHelper() {
-		$this-&gt;loggedData = '';
-		$this-&gt;errorData = '';
-		$this-&gt;errorFlag = false;
-		$this-&gt;fatalError = false;
-	}
-
-	/** log messages **/
-	function logMessage($logText) {
-		$this-&gt;loggedData .= $logText;
-	}
-
-	function logError($logError, $fatalError = false) {
-		$this-&gt;errorFlag = true;
-		$this-&gt;fatalError .= $fatalError;
-		$this-&gt;errorData .= $logErrort;
-	}
-
-	/** create a random name **/
-	function random() {
-		$chars = &quot;abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ023456789&quot;;
-		srand((double)microtime()*1000000);
-		$i = 0;
-		$rand = '' ;
-
-		while ($i &lt;= 7) {
-			$num = rand() % 33;
-			$tmp = substr($chars, $num, 1);
-			$rand = $rand . $tmp;
-			$i++;
-		}
-		return $rand;
-	}
-
-	function writeLogToDisk($filePath, $fileName, $fileData) {
-		$filePath = trailingslashit($filePath);
-		if(@file_exists($filePath . $fileName))  @unlink($filePath . $fileName);
-		$fileHandle = @fopen($filePath . $fileName, 'w');
-		if(@fwrite($fileHandle, $fileData) === false) {
-			echo '&lt;br&gt;Some error while writing the log file&lt;br&gt;';
-			return false;
-		}
-		else {
-			@fclose($fileHandle);
-			return true;
-		}
-	}
-
-	function createIndexes() {
-		$indexFile = trailingslashit(ABSPATH.'wpau-backup') . 'index.html';
-		$indexFile1 = trailingslashit(ABSPATH.'wpau-backup') . 'index.php';
-		if(!file_exists($indexFile)) {
-			if (!$handle = fopen($indexFile, 'w')) {
-				echo &quot;Cannot open file ($indexFile). Please create a empty $indexFile file manually&quot;;
-			}
-			else {
-				fclose($handle);
-				chmod($indexFile, 0755);
-			}
-		}
-
-		if(!file_exists($indexFile1)) {
-			if (!$handle = fopen($indexFile1, 'w')) {
-				echo &quot;Cannot open file ($indexFile1).  Please create a empty $indexFile file manually&quot;;
-			}
-			else {
-				fclose($handle);
-				chmod($indexFile1, 0755);
-			}
-		}
-	}
-
-}
-
-?&gt;
+&lt;?php
+/**
+ Wordpress Automatic upgrades helper class
+ Helps sub classes log all data
+ Helps to update db with logs
+ Helps to run miscelleaneous functions
+ **/
+
+if($_REQUEST['action'] != 'upgrade-plugin') {
+	if(! class_exists('PclZip')) {
+		require_once('lib/pclzip.lib.php');
+	}
+}
+
+require_once('lib/snoopy.class.php');
+
+if(! function_exists('ftp_base')) {
+	require_once('lib/ftp_class.php');
+}
+
+class wpauHelper {
+	var $loggedData;
+	var $errorData;
+	var $errorFlag;
+	var $fatalError; // if its flagged as a fatal error we cannot continue with further process
+
+	function wpauHelper() {
+		$this-&gt;loggedData = '';
+		$this-&gt;errorData = '';
+		$this-&gt;errorFlag = false;
+		$this-&gt;fatalError = false;
+	}
+
+	/** log messages **/
+	function logMessage($logText) {
+		$this-&gt;loggedData .= $logText;
+	}
+
+	function logError($logError, $fatalError = false) {
+		$this-&gt;errorFlag = true;
+		$this-&gt;fatalError .= $fatalError;
+		$this-&gt;errorData .= $logErrort;
+	}
+
+	/** create a random name **/
+	function random() {
+		$chars = &quot;abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ023456789&quot;;
+		srand((double)microtime()*1000000);
+		$i = 0;
+		$rand = '' ;
+
+		while ($i &lt;= 7) {
+			$num = rand() % 33;
+			$tmp = substr($chars, $num, 1);
+			$rand = $rand . $tmp;
+			$i++;
+		}
+		return $rand;
+	}
+
+	function writeLogToDisk($filePath, $fileName, $fileData) {
+		$filePath = trailingslashit($filePath);
+		if(@file_exists($filePath . $fileName))  @unlink($filePath . $fileName);
+		$fileHandle = @fopen($filePath . $fileName, 'w');
+		if(@fwrite($fileHandle, $fileData) === false) {
+			echo '&lt;br&gt;Some error while writing the log file&lt;br&gt;';
+			return false;
+		}
+		else {
+			@fclose($fileHandle);
+			return true;
+		}
+	}
+
+	function createIndexes() {
+		$indexFile = trailingslashit(ABSPATH.'wpau-backup') . 'index.html';
+		$indexFile1 = trailingslashit(ABSPATH.'wpau-backup') . 'index.php';
+		if(!file_exists($indexFile)) {
+			if (!$handle = fopen($indexFile, 'w')) {
+				echo &quot;Cannot open file ($indexFile). Please create a empty $indexFile file manually&quot;;
+			}
+			else {
+				fclose($handle);
+				chmod($indexFile, 0755);
+			}
+		}
+
+		if(!file_exists($indexFile1)) {
+			if (!$handle = fopen($indexFile1, 'w')) {
+				echo &quot;Cannot open file ($indexFile1).  Please create a empty $indexFile file manually&quot;;
+			}
+			else {
+				fclose($handle);
+				chmod($indexFile1, 0755);
+			}
+		}
+	}
+
+}
+
+?&gt;</diff>
      <filename>wordpress/wp-content/plugins/wordpress-automatic-upgrade/wpau_helper.class.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,158 +1,158 @@
-&lt;?php
-/*
-PLugin helper class backups plugins stores in it in the db
-
-Can't use oops man as php4 does not support it and most sites
-run on php4
-
-*/
-
-class wpauPluginHandler extends wpauHelper {
-
-	//this class depends on it so we need the activated plugins first
-	var $pluginArray;
-	/**
-	the constructor
-	takes the current activated plugins as an array
-	**/
-	function wpauPluginHandler($pluginArray) {
-		$this-&gt;pluginArray = $pluginArray;
-	}
-
-	/*
-		Loops thorugh all the plugins and de-activates all those
-		Removes this plugin from the list as further task depend
-		on this
-	*/
-	function deActivatePlugins() {
-		if(! $this-&gt;pluginArray) {
-			return 'No calls to the class without calling the constructor';
-		}
-
-		if(!current_user_can('edit_plugins')) {
-			echo 'Oops sorry you are not authorized to do this';
-			return false;
-		}
-		//remove our plugin from the list or else it will get deactivated too
-		array_splice($this-&gt;pluginArray, array_search(WPAU_PLUGIN, $this-&gt;pluginArray), 1 );
-		if(count($this-&gt;pluginArray) == 0)
-			$this-&gt;logMessage('There are no plugins for de-activation');
-
-		foreach($this-&gt;pluginArray as $plugin) {
-			$this-&gt;deActivatePlugin($plugin);
-		}
-		return true;
-	}
-
-	/*
-		De-activate the plugin and log it to our DB table
-		it will be used while re-activating
-	*/
-	function deActivatePlugin($plugin) {
-			if(!current_user_can('edit_plugins')) {
-				echo 'Oops sorry you are not authorized to do this';
-				return false;
-			}
-			global $wpdb;
-			$current = get_option('active_plugins');
-			array_splice($current, array_search($plugin, $current), 1 ); // Array-fu!
-			update_option('active_plugins', $current);
-			do_action('deactivate_' . trim( '../' . $plugin ));
-			$wpdb-&gt;query(&quot;Insert into &quot;.WPAU_PLUGIN_TABLE.&quot; (plugin_name, plugin_status, plugin_deactive_response, plugin_reactive_response) values ('&quot;.$plugin.&quot;', 0, 1, 0)&quot;);
-			$this-&gt;logMessage('Deactivated the plugin &lt;strong&gt;'.$plugin.'&lt;/strong&gt; &lt;br&gt;');
-	}
-
-	/*
-		get all info from the stored db and
-		activate all the plugins
-	*/
-	function reActivatePlugins($automated = false) {
-		if(!current_user_can('edit_plugins')) {
-			echo 'Oops sorry you are not authorized to do this';
-			return false;
-		}
-		global $wpdb;
-		if(isset($_REQUEST['pluginid'])) {
-			$fatalPluginId = $_REQUEST['pluginid'];
-			$plugins = $wpdb-&gt;get_results(&quot;select plugin_name, plugin_reactive_response from &quot;.WPAU_PLUGIN_TABLE.&quot; where id = &quot;.intval($fatalPluginId));
-			if(count($plugins) &gt; 0)  {
-				if(intval($plugins[0]-&gt;plugin_reactive_response) != 1) {
-					$this-&gt;logMessage('&lt;span style=&quot;color:red&quot;&gt;The Plugin &lt;strong&gt;'.$plugins[0]-&gt;plugin_name.'&lt;/strong&gt; could not be activated succesfully. You will need to activate it manually.&lt;/span&gt;&lt;br&gt;');
-					$wpdb-&gt;query(&quot;UPDATE &quot;.WPAU_PLUGIN_TABLE.&quot; set fatal_plugin = 1 where id = &quot;.intval($fatalPluginId) );
-				}
-			}
-		}
-		$plugins = $wpdb-&gt;get_results(&quot;select id, plugin_name from &quot;.WPAU_PLUGIN_TABLE.&quot; where plugin_status = 0 and plugin_deactive_response = 1 and fatal_plugin = 0&quot;);
-		if(count($plugins) == 0)
-			$this-&gt;logMessage('All the plugins were re-activated');
-		foreach($plugins as $plugin) {
-			if(strlen(trim($plugin-&gt;plugin_name)) &gt; 0)
-				$this-&gt;reActivatePlugin($plugin, $automated);
-		}
-		return true;
-	}
-
-	function reActivatePlugin($plugin, $automated) {
-		if(!current_user_can('edit_plugins')) {
-			echo 'Oops sorry you are not authorized to do this';
-			return false;
-		}
-		global $wpdb;
-		$current = get_option('active_plugins');
-		$pluginfile = $plugin-&gt;plugin_name;
-		$pluginid = $plugin-&gt;id;
-		$path = &quot;../&quot;;
-		if ($automated) { $path = &quot;../../&quot;; }
-		if ( wpau_validate_file($path.$pluginfile) ) {
-			if ( ! file_exists(ABSPATH . PLUGINDIR . '/' . $pluginfile) ) {
-				$this-&gt;logMessage('Plugin '.$pluginfile.' file does not exist');
-			}
-			else {
-				if (!in_array($pluginfile, $current)) {
-					ob_start();
-					echo '&lt;script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;&gt; '.
-					' window.location = &quot;edit.php?page='.WPAU_PAGE.'&amp;task=re-plugin&amp;pluginid='.$plugin-&gt;id .'&quot;' .
-					'&lt;/script&gt;';
-					if($file_included = @include(ABSPATH . PLUGINDIR . '/' . $pluginfile))  {
-						$current[] = $pluginfile;
-						sort($current);
-						update_option('active_plugins', $current);
-						do_action('activate_' . $pluginfile);
-						$wpdb-&gt;query(&quot;Update &quot;.WPAU_PLUGIN_TABLE.&quot; set plugin_status = 1, plugin_reactive_response = 1 where id = $pluginid&quot;);
-						$this-&gt;logMessage('Plugin &lt;strong&gt;'.$pluginfile.'&lt;/strong&gt; was activated succesfully&lt;br&gt;');
-					}
-					else {
-						$this-&gt;logMessage('&lt;span style=&quot;color:red&quot;&gt;Plugin &lt;strong&gt;'.$pluginfile.'&lt;/strong&gt; could not be activated succesfully. You will need to activate it manually.&lt;/span&gt;&lt;br&gt;');
-					}
-					ob_end_clean();
-				}
-				else {
-					$this-&gt;logMessage('Plugin &lt;strong&gt;'.$pluginfile.'&lt;/strong&gt; is already activated&lt;br&gt;');
-				}
-			}
-		}
-		else {
-			$this-&gt;logMessage('Could not validate the plugin &lt;strong&gt;'.$pluginfile.'&lt;/strong&gt;&lt;br&gt;');
-			//TODO LOG REASONS FOR NOT VALIDATING
-		}
-	}
-
-	/**
-	* Function to de-activate all plugins
-	**/
-	function wpau_validate_file($file, $allowed_files = '') {
-		if ( false !== strpos($file, './'))
-			return 1;
-
-		if (':' == substr($file,1,1))
-			return 2;
-
-		if ( !empty($allowed_files) &amp;&amp; (! in_array($file, $allowed_files)) )
-			return 3;
-
-		return 0;
-	}
-
-}
-
+&lt;?php
+/*
+PLugin helper class backups plugins stores in it in the db
+
+Can't use oops man as php4 does not support it and most sites
+run on php4
+
+*/
+
+class wpauPluginHandler extends wpauHelper {
+
+	//this class depends on it so we need the activated plugins first
+	var $pluginArray;
+	/**
+	the constructor
+	takes the current activated plugins as an array
+	**/
+	function wpauPluginHandler($pluginArray) {
+		$this-&gt;pluginArray = $pluginArray;
+	}
+
+	/*
+		Loops thorugh all the plugins and de-activates all those
+		Removes this plugin from the list as further task depend
+		on this
+	*/
+	function deActivatePlugins() {
+		if(! $this-&gt;pluginArray) {
+			return 'No calls to the class without calling the constructor';
+		}
+
+		if(!current_user_can('edit_plugins')) {
+			echo 'Oops sorry you are not authorized to do this';
+			return false;
+		}
+		//remove our plugin from the list or else it will get deactivated too
+		array_splice($this-&gt;pluginArray, array_search(WPAU_PLUGIN, $this-&gt;pluginArray), 1 );
+		if(count($this-&gt;pluginArray) == 0)
+			$this-&gt;logMessage('There are no plugins for de-activation');
+
+		foreach($this-&gt;pluginArray as $plugin) {
+			$this-&gt;deActivatePlugin($plugin);
+		}
+		return true;
+	}
+
+	/*
+		De-activate the plugin and log it to our DB table
+		it will be used while re-activating
+	*/
+	function deActivatePlugin($plugin) {
+			if(!current_user_can('edit_plugins')) {
+				echo 'Oops sorry you are not authorized to do this';
+				return false;
+			}
+			global $wpdb;
+			$current = get_option('active_plugins');
+			array_splice($current, array_search($plugin, $current), 1 ); // Array-fu!
+			update_option('active_plugins', $current);
+			do_action('deactivate_' . trim( '../' . $plugin ));
+			$wpdb-&gt;query(&quot;Insert into &quot;.WPAU_PLUGIN_TABLE.&quot; (plugin_name, plugin_status, plugin_deactive_response, plugin_reactive_response) values ('&quot;.$plugin.&quot;', 0, 1, 0)&quot;);
+			$this-&gt;logMessage('Deactivated the plugin &lt;strong&gt;'.$plugin.'&lt;/strong&gt; &lt;br&gt;');
+	}
+
+	/*
+		get all info from the stored db and
+		activate all the plugins
+	*/
+	function reActivatePlugins($automated = false) {
+		if(!current_user_can('edit_plugins')) {
+			echo 'Oops sorry you are not authorized to do this';
+			return false;
+		}
+		global $wpdb;
+		if(isset($_REQUEST['pluginid'])) {
+			$fatalPluginId = $_REQUEST['pluginid'];
+			$plugins = $wpdb-&gt;get_results(&quot;select plugin_name, plugin_reactive_response from &quot;.WPAU_PLUGIN_TABLE.&quot; where id = &quot;.intval($fatalPluginId));
+			if(count($plugins) &gt; 0)  {
+				if(intval($plugins[0]-&gt;plugin_reactive_response) != 1) {
+					$this-&gt;logMessage('&lt;span style=&quot;color:red&quot;&gt;The Plugin &lt;strong&gt;'.$plugins[0]-&gt;plugin_name.'&lt;/strong&gt; could not be activated succesfully. You will need to activate it manually.&lt;/span&gt;&lt;br&gt;');
+					$wpdb-&gt;query(&quot;UPDATE &quot;.WPAU_PLUGIN_TABLE.&quot; set fatal_plugin = 1 where id = &quot;.intval($fatalPluginId) );
+				}
+			}
+		}
+		$plugins = $wpdb-&gt;get_results(&quot;select id, plugin_name from &quot;.WPAU_PLUGIN_TABLE.&quot; where plugin_status = 0 and plugin_deactive_response = 1 and fatal_plugin = 0&quot;);
+		if(count($plugins) == 0)
+			$this-&gt;logMessage('All the plugins were re-activated');
+		foreach($plugins as $plugin) {
+			if(strlen(trim($plugin-&gt;plugin_name)) &gt; 0)
+				$this-&gt;reActivatePlugin($plugin, $automated);
+		}
+		return true;
+	}
+
+	function reActivatePlugin($plugin, $automated) {
+		if(!current_user_can('edit_plugins')) {
+			echo 'Oops sorry you are not authorized to do this';
+			return false;
+		}
+		global $wpdb;
+		$current = get_option('active_plugins');
+		$pluginfile = $plugin-&gt;plugin_name;
+		$pluginid = $plugin-&gt;id;
+		$path = &quot;../&quot;;
+		if ($automated) { $path = &quot;../../&quot;; }
+		if ( wpau_validate_file($path.$pluginfile) ) {
+			if ( ! file_exists(ABSPATH . PLUGINDIR . '/' . $pluginfile) ) {
+				$this-&gt;logMessage('Plugin '.$pluginfile.' file does not exist');
+			}
+			else {
+				if (!in_array($pluginfile, $current)) {
+					ob_start();
+					echo '&lt;script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;&gt; '.
+					' window.location = &quot;edit.php?page='.WPAU_PAGE.'&amp;task=re-plugin&amp;pluginid='.$plugin-&gt;id .'&quot;' .
+					'&lt;/script&gt;';
+					if($file_included = @include(ABSPATH . PLUGINDIR . '/' . $pluginfile))  {
+						$current[] = $pluginfile;
+						sort($current);
+						update_option('active_plugins', $current);
+						do_action('activate_' . $pluginfile);
+						$wpdb-&gt;query(&quot;Update &quot;.WPAU_PLUGIN_TABLE.&quot; set plugin_status = 1, plugin_reactive_response = 1 where id = $pluginid&quot;);
+						$this-&gt;logMessage('Plugin &lt;strong&gt;'.$pluginfile.'&lt;/strong&gt; was activated succesfully&lt;br&gt;');
+					}
+					else {
+						$this-&gt;logMessage('&lt;span style=&quot;color:red&quot;&gt;Plugin &lt;strong&gt;'.$pluginfile.'&lt;/strong&gt; could not be activated succesfully. You will need to activate it manually.&lt;/span&gt;&lt;br&gt;');
+					}
+					ob_end_clean();
+				}
+				else {
+					$this-&gt;logMessage('Plugin &lt;strong&gt;'.$pluginfile.'&lt;/strong&gt; is already activated&lt;br&gt;');
+				}
+			}
+		}
+		else {
+			$this-&gt;logMessage('Could not validate the plugin &lt;strong&gt;'.$pluginfile.'&lt;/strong&gt;&lt;br&gt;');
+			//TODO LOG REASONS FOR NOT VALIDATING
+		}
+	}
+
+	/**
+	* Function to de-activate all plugins
+	**/
+	function wpau_validate_file($file, $allowed_files = '') {
+		if ( false !== strpos($file, './'))
+			return 1;
+
+		if (':' == substr($file,1,1))
+			return 2;
+
+		if ( !empty($allowed_files) &amp;&amp; (! in_array($file, $allowed_files)) )
+			return 3;
+
+		return 0;
+	}
+
+}
+
 ?&gt;
\ No newline at end of file</diff>
      <filename>wordpress/wp-content/plugins/wordpress-automatic-upgrade/wpau_plugin.class.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,451 +1,451 @@
-&lt;?php
-/*
-Runs all the critical upgrade functions to upgrade the wordpress version
-FTP functions are mostly used from php.net/ftp_rawlist
-*/
-
-//require_once('lib/ftp_class.php');
-
-class wpauPrelimHelper extends wpauHelper {
-
-	var $theDirToDoThings;
-	var $slash;
-	var $relativeSlash;
-	var $ftpUser;
-	var $ftpPass;
-	var $ftpHost;
-	var $ftpBaseDir;
-	var $includeDirs;
-	var $includeExtensions;
-	var $runRegularFtpOps;
-	var $theFtpConn;
-	var $isConnected;
-	var $couldNotUpdatePermsFile;
-	var $backupDir;
-	var $isRollback;
-	
-	
-	function wpauPrelimHelper($rollback = false, $backupDir = 'wpau-backup') {
-		$this-&gt;theDirToDoThings = trailingslashit(ABSPATH) . $backupDir; //the dir where we gonna store all our stuff
-		//runs php inbuilt ftp funcs
-		$this-&gt;runRegularFtpOps = true;
-		$this-&gt;isConnected = false;
-		$this-&gt;includeDirs = array('wp-admin', 'wp-includes');
-		$this-&gt;includeExtensions = array('php', 'txt', 'htm', 'html', 'js', 'css', 'jpg', 'png', 'gif');
-		$this-&gt;isRollback = $rollback;
-		$this-&gt;backupDir = $backupDir;
-	}
-	
-
-	function checkCleanUpRequired() {
-		if(file_exists(trailingslashit(ABSPATH) . WPAU_LOG_FILE)) {
-			return true;
-		}
-		if(!is_dir($this-&gt;theDirToDoThings)) {
-			return false;
-		}
-		if($dir = @opendir($this-&gt;theDirToDoThings)) {
-			while (FALSE !== ($item = @readdir($dir))) {
-				if($item != '.' &amp;&amp; $item != '..') {
-					return true;
-				}
-			}
-		}
-		return false;
-	}
-	
-	function runRegularChangeMode() {
-		$chmod = @chmod(ABSPATH . 'index.php', 0646);
-		return $chmod;
-	}
-	
-	/**
-	* Checks if upgrade is required or not
-	**/
-	function runUpgradeRequiredCheck() {
-		//if this function does not exist, it means upgrade is definitely required
-		if(! function_exists('wp_version_check')) {
-			return true;
-		}
-		else {
-			//run the core check
-			wp_version_check();
-			$cur = get_option( 'update_core' );
-			if ( ! isset( $cur-&gt;response ) || $cur-&gt;response != 'upgrade' ) {
-				return false;
-			}
-			else {
-				return true;
-			}
-		}
-	}
-	
-	/**
-	* Runs preliminary checks on the installation to check
-	* if we can write to the directory, if we cannot it will
-	* check if we can use ftp on the site and then 
-	* ask the user for the username and password
-	* so that we can change the permissions and run the
-	* upgrade for the user
-	*/
-	function runFTPPrelimChecks() {
-		$canRun = true;
-		$theFile = ABSPATH . 'index.php';
-		$chmod = @chmod($theFile, 0644);
-		if($chmod) {
-			return true;
-		}
-		
-		$permission =  exec(&quot;ls -l $theFile |awk '{print $1}'&quot;, $output, $error);
-		if($error == 0) {
-			//get the perms
-			$thePerms = $this-&gt;chmodnum(substr($permission, 1));
-			//if its 644 or 744 we cannot run man
-			//tell our wpau guy out there we need to change perms
-			//we only can write files when they are 766 or 666 lets see
-			$this-&gt;userPermission = $thePerms[0];
-			if($thePerms[2] &lt; 6) {
-				$canRun = false;
-			}
-		}
-		else {
-			$canRun = false;
-		}
-		
-		if($canRun == true) {
-			if(! is_dir(ABSPATH.'wpau-backup')) {
-				if($mkdir = @mkdir(ABSPATH.'wpau-backup')) {
-					@chmod(ABSPATH.'wpau-backup', 0757);
-					$this-&gt;canMakeBackupDir = true;
-					$this-&gt;createIndexes();
-				}
-				else {
-					$canRun = false;
-				}
-			}
-			else {
-				$this-&gt;createIndexes();
-				$this-&gt;canMakeBackupDir = true;
-			}
-		}
-		return $canRun;
-	}
-	
-	function checkFtpMode() {
-		//does the server allow us to connect using ftp ??
-		if(!function_exists('ftp_connect')) {
-			$this-&gt;runRegularFtpOps = false;
-		}
-	}
-	
-	function checkFTPCredentials() {
-		if($this-&gt;runRegularFtpOps) {
-			$this-&gt;theFtpConn = @ftp_connect($this-&gt;ftpHost);
-			$this-&gt;isConnected = @ftp_login($this-&gt;theFtpConn, $this-&gt;ftpUser, $this-&gt;ftpPass);
-			if($this-&gt;isConnected) {
-				return true;
-			}
-			else {
-				return false;
-			}
-		}
-		else {
-			$this-&gt;theFtpConn = new ftp(TRUE);
-			$this-&gt;theFtpConn-&gt;Verbose = TRUE;
-			$this-&gt;theFtpConn-&gt;LocalEcho = TRUE;
-			if($this-&gt;theFtpConn-&gt;SetServer($this-&gt;ftpHost)) {
-				$this-&gt;theFtpConn-&gt;quit();
-			}
-			if (!$this-&gt;theFtpConn-&gt;connect()) {
-				return false;
-			}
-			$this-&gt;isConnected = $this-&gt;theFtpConn-&gt;login($this-&gt;ftpUser, $this-&gt;ftpPass);
-			if($this-&gt;isConnected) {
-				return true;
-			}
-			else {
-				$this-&gt;theFtpConn-&gt;quit();
-				return false;
-			}
-		}
-	}
-	
-	function runFTPOperation() {
-		if(!$this-&gt;theFtpConn || !$this-&gt;isConnected ) {
-			return false;
-		}
-		$directory = $this-&gt;ftpBaseDir;
-		$ignoreFiles = array('wp-config.php', 'wpau-backup', 'error_log', 'index.php.wpau.bak', '.htaccess', 'wp-config-sample.php', 'wpau-log-data.txt');
-		if($this-&gt;runRegularFtpOps) {
-			if(! $this-&gt;isRollback)
-				$chmod_cmd='CHMOD 0777 '.$directory;
-			else 
-				$chmod_cmd='CHMOD 0755 '.$directory;
-				
-			$chmod=ftp_site($this-&gt;theFtpConn, $chmod_cmd);
-			$this-&gt;chmodRegularFTP(&quot;/&quot; . $directory, $ignoreFiles, false);
-			foreach($this-&gt;includeDirs as $dir) {
-				$this-&gt;chmodRegularFTP(&quot;/&quot; . $directory. &quot;/&quot; . $dir, '', true);
-			}
-			@ftp_close($this-&gt;theFtpConn);
-		}
-		else {
-			if(! $this-&gt;isRollback)
-				$chmod=$this-&gt;theFtpConn-&gt;chmod($directory, 0777);
-			else 
-				$chmod=$this-&gt;theFtpConn-&gt;chmod($directory, 0755);
-			
-			$this-&gt;chmodPemFTP(&quot;/&quot; . $directory, $ignoreFiles, false);
-			foreach($this-&gt;includeDirs as $dir) {
-				$this-&gt;chmodPemFTP(&quot;/&quot; . $directory. &quot;/&quot; . $dir, '', true);
-			}
-			$this-&gt;theFtpConn-&gt;quit();
-		}
-		
-		//return true;
-		if ( count($this-&gt;couldNotUpdatePermsFile) &gt; 0 &amp;&amp; $this-&gt;showError) {
-			$this-&gt;logMessage('Looks like we cannot run the upgrade as we could not change permissions for these files. &lt;br /&gt; You can change the permissions to 646 manually and try again. Below are the list of files.');
-			foreach($this-&gt;couldNotUpdatePermsFile as $file) {
-				$this-&gt;logMessage($file.'&lt;br /&gt;');
-			}
-			return false;
-		}
-		else
-			return true;
-	}
-	
-	/* see http://us.php.net/manual/en/function.ftp-rawlist.php#71315 */
-	function chmodRegularFTP($directory, $ignoreFiles, $traverseSubDir = false) {
-		if(!$this-&gt;theFtpConn || !$this-&gt;isConnected ) {
-			return false;
-		}
-		ftp_chdir($this-&gt;theFtpConn, $directory);
-		$array = ftp_rawlist($this-&gt;theFtpConn, $directory);
-
-		if (is_array($array)) {
-			foreach ($array as $folder) {
-	$current = preg_split(&quot;/[\s]+/&quot;,$folder,9);
-				$permission = $current[0];
-				$name = str_replace('//','',$current[8]);
-				
-				if($this-&gt;get_type($permission) == &quot;folder&quot;) {
-					if($name != '.' &amp;&amp; $name != '..') {
-						$subdir = $directory . '/' . $name;
-						$subdir = str_replace('//','/', $subdir);
-						if($traverseSubDir || in_array($name, $this-&gt;includeDirs)) {
-							if(! $this-&gt;isRollback)
-								$chmod_cmd=&quot;CHMOD 0757 $name&quot;;
-							else
-								$chmod_cmd=&quot;CHMOD 0755 $name&quot;;
-							
-							$chmod=@ftp_site($this-&gt;theFtpConn, $chmod_cmd);
-							if(! $chmod) {
-								$uid = @fileowner(&quot;$name&quot;);
-								$userinfo = @posix_getpwuid($uid);
-								if(is_array($userinfo)) {
-									if($userinfo['name'] == $this-&gt;ftpUser) {
-										$this-&gt;couldNotUpdatePermsFile[] = $directory . &quot;/&quot; . $name;
-									}
-								}
-								else {
-									$this-&gt;couldNotUpdatePermsFile[] = $directory . &quot;/&quot; . $name;
-								}
-							}
-							$this-&gt;chmodRegularFTP($subdir, $ignoreFiles, $traverseSubDir);
-							ftp_chdir($this-&gt;theFtpConn, $directory);
-						}
-					}
-				}
-				else {
-					if(is_array($ignoreFiles)) {
-						if(in_array($name, $ignoreFiles)) {
-							continue;
-						}
-					}
-					if(($name != '.' &amp;&amp; $name != '..') &amp;&amp; $this-&gt;checkIncludeFile($name)) {
-						$name = str_replace('//','/', $name);
-						if(! $this-&gt;isRollback)
-							$chmod_cmd=&quot;CHMOD 0646 $name&quot;;
-						else
-							$chmod_cmd=&quot;CHMOD 0644 $name&quot;;
-						
-						$chmod=@ftp_site($this-&gt;theFtpConn, $chmod_cmd);
-						if(! $chmod) {
-							$uid = @fileowner(&quot;$name&quot;);
-							$userinfo = @posix_getpwuid($uid);
-							if(is_array($userinfo)) {
-								if($userinfo['name'] == $this-&gt;ftpUser) {
-									$this-&gt;couldNotUpdatePermsFile[] = $directory . &quot;/&quot; . $name;
-								}
-							}
-							else {
-								$this-&gt;couldNotUpdatePermsFile[] = $directory . &quot;/&quot; . $name;
-							}
-						}
-					}
-				}
-			}
-		}
-	}
-	
-	function checkIncludeFile($filename) {
-		$pathinfo = pathinfo($filename);
-		if(is_array($this-&gt;includeExtensions)) {
-			if(in_array($pathinfo['extension'], $this-&gt;includeExtensions)) {
-				return true;
-			}
-			else {
-				return false;
-			}
-		}
-	}
-	
-	function chmodPemFTP($directory, $ignoreFiles, $traverseSubDir = false) {
-		if(!$this-&gt;theFtpConn || !$this-&gt;isConnected ) {
-			return false;
-		}
-		
-		$this-&gt;theFtpConn-&gt;chdir($directory);
-		$array=$this-&gt;theFtpConn-&gt;rawlist(&quot;.&quot;, &quot;-lA&quot;);
-		if (is_array($array)) {
-			foreach ($array as $folder) {
-	$current = preg_split(&quot;/[\s]+/&quot;,$folder,9);
-				$permission = $current[0];
-				$name = str_replace('//','',$current[8]);
-				
-				if($this-&gt;get_type($permission) == &quot;folder&quot;) {
-					if($name != '.' &amp;&amp; $name != '..') {
-						$subdir = $directory . '/' . $name;
-						$subdir = str_replace('//','/', $subdir);
-						if($traverseSubDir || in_array($name, $this-&gt;includeDirs)) {
-							if(! $this-&gt;isRollback)
-								$chmod=$this-&gt;theFtpConn-&gt;chmod($name, 0757);
-							else 
-								$chmod=$this-&gt;theFtpConn-&gt;chmod($name, 0755);
-								
-							if(! $chmod) {
-								$uid = @fileowner(&quot;$name&quot;);
-								$userinfo = @posix_getpwuid($uid);
-								if(is_array($userinfo)) {
-									if($userinfo['name'] == $this-&gt;ftpUser) {
-										$this-&gt;couldNotUpdatePermsFile[] = $directory . &quot;/&quot; . $name;
-									}
-								}
-								else {
-									$this-&gt;couldNotUpdatePermsFile[] = $directory . &quot;/&quot; . $name;
-								}
-							}
-							$this-&gt;chmodPemFTP($subdir, $ignoreFiles, $traverseSubDir);
-							$this-&gt;theFtpConn-&gt;chdir($directory);
-						}
-					}
-				}
-				else {
-					if(is_array($ignoreFiles)) {
-						if(in_array($name, $ignoreFiles)) {
-							continue;
-						}
-					}
-					if(($name != '.' &amp;&amp; $name != '..' )  &amp;&amp; $this-&gt;checkIncludeFile($name)) {
-						if(! $this-&gt;isRollback)
-							$chmod=$this-&gt;theFtpConn-&gt;chmod($name, 0646);
-						else
-							$chmod=$this-&gt;theFtpConn-&gt;chmod($name, 0644);
-						
-						if(! $chmod) {
-							$uid = @fileowner(&quot;$name&quot;);
-							$userinfo = @posix_getpwuid($uid);
-							if(is_array($userinfo)) {
-								if($userinfo['name'] == $this-&gt;ftpUser) {
-									$this-&gt;couldNotUpdatePermsFile[] = $directory . &quot;/&quot; . $name;
-								}
-							}
-							else {
-								$this-&gt;couldNotUpdatePermsFile[] = $directory . &quot;/&quot; . $name;
-							}
-						}
-					}
-				}
-			}
-		}
-	}
-	
-	
-	/* see http://us.php.net/manual/en/function.ftp-rawlist.php#71315 */
-	function get_type($perms) {
-      if (substr($perms, 0, 1) == &quot;d&quot;) {
-	  return 'folder';
-       }
-      elseif (substr($perms, 0, 1) == &quot;l&quot;) {
-	  return 'link';
-       }
-      else {
-	  return 'file';
-       }
-   }
-	 
-	 /* see http://us.php.net/manual/en/function.ftp-rawlist.php#71315 */
-	 function chmodnum($mode) {
-       $realmode = &quot;&quot;;
-       $legal =	 array(&quot;&quot;,&quot;w&quot;,&quot;r&quot;,&quot;x&quot;,&quot;-&quot;);
-       $attarray = preg_split(&quot;//&quot;,$mode);
-       for($i=0;$i&lt;count($attarray);$i++){
-	   if($key = array_search($attarray[$i],$legal)){
-	       $realmode .= $legal[$key];
-	   }
-       }
-       $mode = str_pad($realmode,9,'-');
-       $trans = array('-'=&gt;'0','r'=&gt;'4','w'=&gt;'2','x'=&gt;'1');
-       $mode = strtr($mode,$trans);
-       $newmode = array();
-       $newmode[0] = $mode[0]+$mode[1]+$mode[2];
-       $newmode[1] = $mode[3]+$mode[4]+$mode[5];
-       $newmode[2] = $mode[6]+$mode[7]+$mode[8];
-       return $newmode;
-    }
-		
-		/** makes a backup directory if it does not exist or if we cannot create it using normal way **/
-	function makeBackupDir() {
-		if(!$this-&gt;theFtpConn || !$this-&gt;isConnected ) {
-			return false;
-		}
-		$this-&gt;checkFTPCredentials();
-		if($this-&gt;runRegularFtpOps) {
-			ftp_chdir($this-&gt;theFtpConn, $this-&gt;ftpBaseDir);
-			if($dirExists = @ftp_chdir($this-&gt;theFtpConn, $this-&gt;backupDir)) {
-				//dir exists no need to create
-				return true;
-			}
-			if(!$makeBackupDir = @ftp_mkdir($this-&gt;theFtpConn, $this-&gt;backupDir))
-				return false;
-			if(! $this-&gt;isRollback)
-				$chmod_cmd=&quot;CHMOD 0757 &quot;.$this-&gt;backupDir;
-			else
-				$chmod_cmd=&quot;CHMOD 0755 &quot;.$this-&gt;backupDir;
-				
-			$chmod=@ftp_site($this-&gt;theFtpConn, $chmod_cmd);
-			if(! $chmod) {
-				$this-&gt;logMessage('Could not change mode of backup directory');
-			}
-			$this-&gt;createIndexes();
-			return true;
-		}
-		else {
-			$this-&gt;theFtpConn-&gt;chdir($this-&gt;ftpBaseDir);
-			if(! $theBackupDir = $this-&gt;theFtpConn-&gt;mkdir($this-&gt;backupDir))
-				return false;
-			if(! $this-&gt;isRollback)
-				$chmod=$this-&gt;theFtpConn-&gt;chmod($this-&gt;backupDir, 0757);
-			else 
-				$chmod=$this-&gt;theFtpConn-&gt;chmod($this-&gt;backupDir, 0755);
-			if(!$chmod) {
-				$this-&gt;logMessage('Could not change mode of backup directory');
-			}
-			$this-&gt;createIndexes();
-			return true;
-		}
-	}
-	
-}
-
-?&gt;
+&lt;?php
+/*
+Runs all the critical upgrade functions to upgrade the wordpress version
+FTP functions are mostly used from php.net/ftp_rawlist
+*/
+
+//require_once('lib/ftp_class.php');
+
+class wpauPrelimHelper extends wpauHelper {
+
+	var $theDirToDoThings;
+	var $slash;
+	var $relativeSlash;
+	var $ftpUser;
+	var $ftpPass;
+	var $ftpHost;
+	var $ftpBaseDir;
+	var $includeDirs;
+	var $includeExtensions;
+	var $runRegularFtpOps;
+	var $theFtpConn;
+	var $isConnected;
+	var $couldNotUpdatePermsFile;
+	var $backupDir;
+	var $isRollback;
+	
+	
+	function wpauPrelimHelper($rollback = false, $backupDir = 'wpau-backup') {
+		$this-&gt;theDirToDoThings = trailingslashit(ABSPATH) . $backupDir; //the dir where we gonna store all our stuff
+		//runs php inbuilt ftp funcs
+		$this-&gt;runRegularFtpOps = true;
+		$this-&gt;isConnected = false;
+		$this-&gt;includeDirs = array('wp-admin', 'wp-includes');
+		$this-&gt;includeExtensions = array('php', 'txt', 'htm', 'html', 'js', 'css', 'jpg', 'png', 'gif');
+		$this-&gt;isRollback = $rollback;
+		$this-&gt;backupDir = $backupDir;
+	}
+	
+
+	function checkCleanUpRequired() {
+		if(file_exists(trailingslashit(ABSPATH) . WPAU_LOG_FILE)) {
+			return true;
+		}
+		if(!is_dir($this-&gt;theDirToDoThings)) {
+			return false;
+		}
+		if($dir = @opendir($this-&gt;theDirToDoThings)) {
+			while (FALSE !== ($item = @readdir($dir))) {
+				if($item != '.' &amp;&amp; $item != '..') {
+					return true;
+				}
+			}
+		}
+		return false;
+	}
+	
+	function runRegularChangeMode() {
+		$chmod = @chmod(ABSPATH . 'index.php', 0646);
+		return $chmod;
+	}
+	
+	/**
+	* Checks if upgrade is required or not
+	**/
+	function runUpgradeRequiredCheck() {
+		//if this function does not exist, it means upgrade is definitely required
+		if(! function_exists('wp_version_check')) {
+			return true;
+		}
+		else {
+			//run the core check
+			wp_version_check();
+			$cur = get_option( 'update_core' );
+			if ( ! isset( $cur-&gt;response ) || $cur-&gt;response != 'upgrade' ) {
+				return false;
+			}
+			else {
+				return true;
+			}
+		}
+	}
+	
+	/**
+	* Runs preliminary checks on the installation to check
+	* if we can write to the directory, if we cannot it will
+	* check if we can use ftp on the site and then 
+	* ask the user for the username and password
+	* so that we can change the permissions and run the
+	* upgrade for the user
+	*/
+	function runFTPPrelimChecks() {
+		$canRun = true;
+		$theFile = ABSPATH . 'index.php';
+		$chmod = @chmod($theFile, 0644);
+		if($chmod) {
+			return true;
+		}
+		
+		$permission =  exec(&quot;ls -l $theFile |awk '{print $1}'&quot;, $output, $error);
+		if($error == 0) {
+			//get the perms
+			$thePerms = $this-&gt;chmodnum(substr($permission, 1));
+			//if its 644 or 744 we cannot run man
+			//tell our wpau guy out there we need to change perms
+			//we only can write files when they are 766 or 666 lets see
+			$this-&gt;userPermission = $thePerms[0];
+			if($thePerms[2] &lt; 6) {
+				$canRun = false;
+			}
+		}
+		else {
+			$canRun = false;
+		}
+		
+		if($canRun == true) {
+			if(! is_dir(ABSPATH.'wpau-backup')) {
+				if($mkdir = @mkdir(ABSPATH.'wpau-backup')) {
+					@chmod(ABSPATH.'wpau-backup', 0757);
+					$this-&gt;canMakeBackupDir = true;
+					$this-&gt;createIndexes();
+				}
+				else {
+					$canRun = false;
+				}
+			}
+			else {
+				$this-&gt;createIndexes();
+				$this-&gt;canMakeBackupDir = true;
+			}
+		}
+		return $canRun;
+	}
+	
+	function checkFtpMode() {
+		//does the server allow us to connect using ftp ??
+		if(!function_exists('ftp_connect')) {
+			$this-&gt;runRegularFtpOps = false;
+		}
+	}
+	
+	function checkFTPCredentials() {
+		if($this-&gt;runRegularFtpOps) {
+			$this-&gt;theFtpConn = @ftp_connect($this-&gt;ftpHost);
+			$this-&gt;isConnected = @ftp_login($this-&gt;theFtpConn, $this-&gt;ftpUser, $this-&gt;ftpPass);
+			if($this-&gt;isConnected) {
+				return true;
+			}
+			else {
+				return false;
+			}
+		}
+		else {
+			$this-&gt;theFtpConn = new ftp(TRUE);
+			$this-&gt;theFtpConn-&gt;Verbose = TRUE;
+			$this-&gt;theFtpConn-&gt;LocalEcho = TRUE;
+			if($this-&gt;theFtpConn-&gt;SetServer($this-&gt;ftpHost)) {
+				$this-&gt;theFtpConn-&gt;quit();
+			}
+			if (!$this-&gt;theFtpConn-&gt;connect()) {
+				return false;
+			}
+			$this-&gt;isConnected = $this-&gt;theFtpConn-&gt;login($this-&gt;ftpUser, $this-&gt;ftpPass);
+			if($this-&gt;isConnected) {
+				return true;
+			}
+			else {
+				$this-&gt;theFtpConn-&gt;quit();
+				return false;
+			}
+		}
+	}
+	
+	function runFTPOperation() {
+		if(!$this-&gt;theFtpConn || !$this-&gt;isConnected ) {
+			return false;
+		}
+		$directory = $this-&gt;ftpBaseDir;
+		$ignoreFiles = array('wp-config.php', 'wpau-backup', 'error_log', 'index.php.wpau.bak', '.htaccess', 'wp-config-sample.php', 'wpau-log-data.txt');
+		if($this-&gt;runRegularFtpOps) {
+			if(! $this-&gt;isRollback)
+				$chmod_cmd='CHMOD 0777 '.$directory;
+			else 
+				$chmod_cmd='CHMOD 0755 '.$directory;
+				
+			$chmod=ftp_site($this-&gt;theFtpConn, $chmod_cmd);
+			$this-&gt;chmodRegularFTP(&quot;/&quot; . $directory, $ignoreFiles, false);
+			foreach($this-&gt;includeDirs as $dir) {
+				$this-&gt;chmodRegularFTP(&quot;/&quot; . $directory. &quot;/&quot; . $dir, '', true);
+			}
+			@ftp_close($this-&gt;theFtpConn);
+		}
+		else {
+			if(! $this-&gt;isRollback)
+				$chmod=$this-&gt;theFtpConn-&gt;chmod($directory, 0777);
+			else 
+				$chmod=$this-&gt;theFtpConn-&gt;chmod($directory, 0755);
+			
+			$this-&gt;chmodPemFTP(&quot;/&quot; . $directory, $ignoreFiles, false);
+			foreach($this-&gt;includeDirs as $dir) {
+				$this-&gt;chmodPemFTP(&quot;/&quot; . $directory. &quot;/&quot; . $dir, '', true);
+			}
+			$this-&gt;theFtpConn-&gt;quit();
+		}
+		
+		//return true;
+		if ( count($this-&gt;couldNotUpdatePermsFile) &gt; 0 &amp;&amp; $this-&gt;showError) {
+			$this-&gt;logMessage('Looks like we cannot run the upgrade as we could not change permissions for these files. &lt;br /&gt; You can change the permissions to 646 manually and try again. Below are the list of files.');
+			foreach($this-&gt;couldNotUpdatePermsFile as $file) {
+				$this-&gt;logMessage($file.'&lt;br /&gt;');
+			}
+			return false;
+		}
+		else
+			return true;
+	}
+	
+	/* see http://us.php.net/manual/en/function.ftp-rawlist.php#71315 */
+	function chmodRegularFTP($directory, $ignoreFiles, $traverseSubDir = false) {
+		if(!$this-&gt;theFtpConn || !$this-&gt;isConnected ) {
+			return false;
+		}
+		ftp_chdir($this-&gt;theFtpConn, $directory);
+		$array = ftp_rawlist($this-&gt;theFtpConn, $directory);
+
+		if (is_array($array)) {
+			foreach ($array as $folder) {
+	$current = preg_split(&quot;/[\s]+/&quot;,$folder,9);
+				$permission = $current[0];
+				$name = str_replace('//','',$current[8]);
+				
+				if($this-&gt;get_type($permission) == &quot;folder&quot;) {
+					if($name != '.' &amp;&amp; $name != '..') {
+						$subdir = $directory . '/' . $name;
+						$subdir = str_replace('//','/', $subdir);
+						if($traverseSubDir || in_array($name, $this-&gt;includeDirs)) {
+							if(! $this-&gt;isRollback)
+								$chmod_cmd=&quot;CHMOD 0757 $name&quot;;
+							else
+								$chmod_cmd=&quot;CHMOD 0755 $name&quot;;
+							
+							$chmod=@ftp_site($this-&gt;theFtpConn, $chmod_cmd);
+							if(! $chmod) {
+								$uid = @fileowner(&quot;$name&quot;);
+								$userinfo = @posix_getpwuid($uid);
+								if(is_array($userinfo)) {
+									if($userinfo['name'] == $this-&gt;ftpUser) {
+										$this-&gt;couldNotUpdatePermsFile[] = $directory . &quot;/&quot; . $name;
+									}
+								}
+								else {
+									$this-&gt;couldNotUpdatePermsFile[] = $directory . &quot;/&quot; . $name;
+								}
+							}
+							$this-&gt;chmodRegularFTP($subdir, $ignoreFiles, $traverseSubDir);
+							ftp_chdir($this-&gt;theFtpConn, $directory);
+						}
+					}
+				}
+				else {
+					if(is_array($ignoreFiles)) {
+						if(in_array($name, $ignoreFiles)) {
+							continue;
+						}
+					}
+					if(($name != '.' &amp;&amp; $name != '..') &amp;&amp; $this-&gt;checkIncludeFile($name)) {
+						$name = str_replace('//','/', $name);
+						if(! $this-&gt;isRollback)
+							$chmod_cmd=&quot;CHMOD 0646 $name&quot;;
+						else
+							$chmod_cmd=&quot;CHMOD 0644 $name&quot;;
+						
+						$chmod=@ftp_site($this-&gt;theFtpConn, $chmod_cmd);
+						if(! $chmod) {
+							$uid = @fileowner(&quot;$name&quot;);
+							$userinfo = @posix_getpwuid($uid);
+							if(is_array($userinfo)) {
+								if($userinfo['name'] == $this-&gt;ftpUser) {
+									$this-&gt;couldNotUpdatePermsFile[] = $directory . &quot;/&quot; . $name;
+								}
+							}
+							else {
+								$this-&gt;couldNotUpdatePermsFile[] = $directory . &quot;/&quot; . $name;
+							}
+						}
+					}
+				}
+			}
+		}
+	}
+	
+	function checkIncludeFile($filename) {
+		$pathinfo = pathinfo($filename);
+		if(is_array($this-&gt;includeExtensions)) {
+			if(in_array($pathinfo['extension'], $this-&gt;includeExtensions)) {
+				return true;
+			}
+			else {
+				return false;
+			}
+		}
+	}
+	
+	function chmodPemFTP($directory, $ignoreFiles, $traverseSubDir = false) {
+		if(!$this-&gt;theFtpConn || !$this-&gt;isConnected ) {
+			return false;
+		}
+		
+		$this-&gt;theFtpConn-&gt;chdir($directory);
+		$array=$this-&gt;theFtpConn-&gt;rawlist(&quot;.&quot;, &quot;-lA&quot;);
+		if (is_array($array)) {
+			foreach ($array as $folder) {
+	$current = preg_split(&quot;/[\s]+/&quot;,$folder,9);
+				$permission = $current[0];
+				$name = str_replace('//','',$current[8]);
+				
+				if($this-&gt;get_type($permission) == &quot;folder&quot;) {
+					if($name != '.' &amp;&amp; $name != '..') {
+						$subdir = $directory . '/' . $name;
+						$subdir = str_replace('//','/', $subdir);
+						if($traverseSubDir || in_array($name, $this-&gt;includeDirs)) {
+							if(! $this-&gt;isRollback)
+								$chmod=$this-&gt;theFtpConn-&gt;chmod($name, 0757);
+							else 
+								$chmod=$this-&gt;theFtpConn-&gt;chmod($name, 0755);
+								
+							if(! $chmod) {
+								$uid = @fileowner(&quot;$name&quot;);
+								$userinfo = @posix_getpwuid($uid);
+								if(is_array($userinfo)) {
+									if($userinfo['name'] == $this-&gt;ftpUser) {
+										$this-&gt;couldNotUpdatePermsFile[] = $directory . &quot;/&quot; . $name;
+									}
+								}
+								else {
+									$this-&gt;couldNotUpdatePermsFile[] = $directory . &quot;/&quot; . $name;
+								}
+							}
+							$this-&gt;chmodPemFTP($subdir, $ignoreFiles, $traverseSubDir);
+							$this-&gt;theFtpConn-&gt;chdir($directory);
+						}
+					}
+				}
+				else {
+					if(is_array($ignoreFiles)) {
+						if(in_array($name, $ignoreFiles)) {
+							continue;
+						}
+					}
+					if(($name != '.' &amp;&amp; $name != '..' )  &amp;&amp; $this-&gt;checkIncludeFile($name)) {
+						if(! $this-&gt;isRollback)
+							$chmod=$this-&gt;theFtpConn-&gt;chmod($name, 0646);
+						else
+							$chmod=$this-&gt;theFtpConn-&gt;chmod($name, 0644);
+						
+						if(! $chmod) {
+							$uid = @fileowner(&quot;$name&quot;);
+							$userinfo = @posix_getpwuid($uid);
+							if(is_array($userinfo)) {
+								if($userinfo['name'] == $this-&gt;ftpUser) {
+									$this-&gt;couldNotUpdatePermsFile[] = $directory . &quot;/&quot; . $name;
+								}
+							}
+							else {
+								$this-&gt;couldNotUpdatePermsFile[] = $directory . &quot;/&quot; . $name;
+							}
+						}
+					}
+				}
+			}
+		}
+	}
+	
+	
+	/* see http://us.php.net/manual/en/function.ftp-rawlist.php#71315 */
+	function get_type($perms) {
+      if (substr($perms, 0, 1) == &quot;d&quot;) {
+	  return 'folder';
+       }
+      elseif (substr($perms, 0, 1) == &quot;l&quot;) {
+	  return 'link';
+       }
+      else {
+	  return 'file';
+       }
+   }
+	 
+	 /* see http://us.php.net/manual/en/function.ftp-rawlist.php#71315 */
+	 function chmodnum($mode) {
+       $realmode = &quot;&quot;;
+       $legal =	 array(&quot;&quot;,&quot;w&quot;,&quot;r&quot;,&quot;x&quot;,&quot;-&quot;);
+       $attarray = preg_split(&quot;//&quot;,$mode);
+       for($i=0;$i&lt;count($attarray);$i++){
+	   if($key = array_search($attarray[$i],$legal)){
+	       $realmode .= $legal[$key];
+	   }
+       }
+       $mode = str_pad($realmode,9,'-');
+       $trans = array('-'=&gt;'0','r'=&gt;'4','w'=&gt;'2','x'=&gt;'1');
+       $mode = strtr($mode,$trans);
+       $newmode = array();
+       $newmode[0] = $mode[0]+$mode[1]+$mode[2];
+       $newmode[1] = $mode[3]+$mode[4]+$mode[5];
+       $newmode[2] = $mode[6]+$mode[7]+$mode[8];
+       return $newmode;
+    }
+		
+		/** makes a backup directory if it does not exist or if we cannot create it using normal way **/
+	function makeBackupDir() {
+		if(!$this-&gt;theFtpConn || !$this-&gt;isConnected ) {
+			return false;
+		}
+		$this-&gt;checkFTPCredentials();
+		if($this-&gt;runRegularFtpOps) {
+			ftp_chdir($this-&gt;theFtpConn, $this-&gt;ftpBaseDir);
+			if($dirExists = @ftp_chdir($this-&gt;theFtpConn, $this-&gt;backupDir)) {
+				//dir exists no need to create
+				return true;
+			}
+			if(!$makeBackupDir = @ftp_mkdir($this-&gt;theFtpConn, $this-&gt;backupDir))
+				return false;
+			if(! $this-&gt;isRollback)
+				$chmod_cmd=&quot;CHMOD 0757 &quot;.$this-&gt;backupDir;
+			else
+				$chmod_cmd=&quot;CHMOD 0755 &quot;.$this-&gt;backupDir;
+				
+			$chmod=@ftp_site($this-&gt;theFtpConn, $chmod_cmd);
+			if(! $chmod) {
+				$this-&gt;logMessage('Could not change mode of backup directory');
+			}
+			$this-&gt;createIndexes();
+			return true;
+		}
+		else {
+			$this-&gt;theFtpConn-&gt;chdir($this-&gt;ftpBaseDir);
+			if(! $theBackupDir = $this-&gt;theFtpConn-&gt;mkdir($this-&gt;backupDir))
+				return false;
+			if(! $this-&gt;isRollback)
+				$chmod=$this-&gt;theFtpConn-&gt;chmod($this-&gt;backupDir, 0757);
+			else 
+				$chmod=$this-&gt;theFtpConn-&gt;chmod($this-&gt;backupDir, 0755);
+			if(!$chmod) {
+				$this-&gt;logMessage('Could not change mode of backup directory');
+			}
+			$this-&gt;createIndexes();
+			return true;
+		}
+	}
+	
+}
+
+?&gt;</diff>
      <filename>wordpress/wp-content/plugins/wordpress-automatic-upgrade/wpau_prelimcheck.class.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,498 +1,498 @@
-&lt;?php
-/*
-Runs all the critical upgrade functions to upgrade the wordpress version
-
-*/
-
-class wpauUpgradeHelper extends wpauHelper {
-
-	var $theDirToDoThings;
-	var $absPath;
-	var $slash;
-	var $relativeSlash;
-	var $zipName;
-	var $extension;
-	var $archiveName;
-	var $relativePath;
-	var $relativeArchiveName; 
-	var $includeDirs;
-	var $ignoreFiles;
-	var $backupDir;
-	var $zipFileName;
-	var $operationError;
-	var $includeExtensions;
-	
-	function wpauUpgradeHelper($absPath, $isNix, $backupDir = 'wpau-backup', $relativePath = ABSPATH) {
-		$this-&gt;absPath = $absPath; //the abs path to wordpress installation
-		$this-&gt;backupDir = $backupDir;
-		if($isNix)  //change slash if we are running on windows
-			$this-&gt;slash = '/';
-		else 
-			$this-&gt;slash = '\\';
-		
-		$this-&gt;includeDirs = array('wp-admin', 'wp-includes'); //the directories we have to upgrade
-		$this-&gt;ignoreFiles = array('wp-config.php', 'wp-config-sample.php');
-		$this-&gt;includeExtensions = array('php', 'txt', 'htm', 'html', 'js', 'css', 'jpg', 'png', 'gif');
-		$this-&gt;relativeSlash = '/'; //relative is always this
-		$this-&gt;theDirToDoThings = trailingslashit($this-&gt;absPath). $backupDir; //the dir where we gonna store all our stuff
-		$this-&gt;zipName = 'wpau-latest'; // the name for the zip file
-		$this-&gt;extension = '.zip'; // the extension for the zip file
-		$this-&gt;zipFileName = $this-&gt;zipName . $this-&gt;extension; //the zip file name
-		$this-&gt;archiveName = $this-&gt;theDirToDoThings . $this-&gt;slash. $this-&gt;zipFileName; //the path to the archive
-		$this-&gt;relativePath = $relativePath; //relative path will be needed for the unzip process
-		$this-&gt;relativeArchiveName = $this-&gt;relativePath . $this-&gt;relativeSlash . &quot;wpau-backup&quot;. $this-&gt;relativeSlash . $this-&gt;zipFileName; //the archive paht for relative
-		
-		$this-&gt;operationError = false;
-    
-    if(! is_dir($this-&gt;theDirToDoThings)) {
-			mkdir ($this-&gt;theDirToDoThings);
-			$this-&gt;createIndexes();
-		}
-		
-	}
-	
-	/**
-	* Downloads the files from wordpress
-	*/
-	function getFilesFromWP($downFilePath) {
-		@unlink($this-&gt;archiveName);
-		set_time_limit ( 0 ) ;
-		$this-&gt;logMessage('Starting to download the file from ' .$downFilePath . '&lt;br /&gt;');
-		//$filename = $this-&gt;theDirToDoThings . $this-&gt;slash. $this-&gt;zipName . '-' . $this-&gt;random() . $this-&gt;extension;
-		if($this-&gt;download($downFilePath, $this-&gt;archiveName)) {
-			if($this-&gt;unzip()) {
-        return true;
-			}
-			else {
-        return false;
-			}
-		}
-		else {
-			return false;
-		}
-	}
-	
-	function downloadFilesFromWP($startUrl, $fileName) {
-		@unlink($this-&gt;archiveName);
-		set_time_limit ( 0 ) ;
-		$this-&gt;logMessage('Starting to download the file from ' .$downFilePath . '&lt;br /&gt;');
-		if($this-&gt;downloadFSock($startUrl, $fileName, $this-&gt;archiveName)) {
-			if($this-&gt;unzip()) {
-				return true;
-			}
-			else {
-				return false;
-			}
-		}
-		else {
-			return false;
-		}
-	}
-	
-	/** 
-	* Reads uploaded files from users
-	**/
-	function getUploadedFilesFromUser($fileData) {
-		if(isset($fileData)) {
-			$pathinfo = pathinfo($fileData['thefile']['name']);
-			if($this-&gt;validUploadedExtension($pathinfo['extension'])) {
-				$this-&gt;logMessage('We got a valid file to be uploaded&lt;br /&gt;');
-				if($this-&gt;upload($fileData)) {
-					if(is_file($this-&gt;relativeArchiveName)) {
-						if($this-&gt;unzip()) {
-							return true;
-						}
-					}
-					else {
-						return false;
-					}
-				}
-				else {
-					$this-&gt;logMessage('ERROR -&gt; Could not upload the file to the directory&lt;br /&gt;');
-				}
-			}
-			else {
-				$this-&gt;logMessage('ERROR -&gt; The file you are trying to upload is not a valid file, please upload only zip or tar.gz files&lt;br /&gt;');
-				return false;
-			}
-		}
-		else {
-			$this-&gt;logMessage('ERROR -&gt; You did not select any files to be uploaded&lt;br /&gt;');
-			return false;
-		}
-	}
-	
-	/**
-	* Upgrades the file from downloaded location
-	**/
-	
-	function upgradeFiles() {
-		if( ! current_user_can('edit_files')) {
-			echo 'Oops sorry you are not authorized to do this';
-			return false;
-		}
-		set_time_limit(0);
-		$theNewWPFiles = $this-&gt;theDirToDoThings . $this-&gt;slash . 'wordpress';
-		if($upgradeFilesDir = @opendir($theNewWPFiles)) {
-			@closedir($theNewWPFiles);
-			chmod($theNewWPFiles, 0755);
-			//first copy all the directory files
-			foreach($this-&gt;includeDirs as $dir) {
-				$this-&gt;copyFiles($this-&gt;theDirToDoThings . $this-&gt;slash . 'wordpress'. $this-&gt;slash. $dir, $this-&gt;absPath. $dir, true);
-			}
-			
-			$this-&gt;logMessage('&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Overwriting MAIN Directory files&lt;/strong&gt;&lt;br/&gt;');
-			if(! $this-&gt;copyFiles($this-&gt;theDirToDoThings . $this-&gt;slash . 'wordpress', $this-&gt;absPath, false) ) {
-				return false;
-			}
-			$this-&gt;logMessage('&lt;br /&gt;&lt;br /&gt;The files have been succesfully upgraded.');
-			
-			if(!$operationError)
-				return true;
-			else 
-				return false;
-		}
-		else {
-			$this-&gt;logMessage('&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Could not open the downloaded directory to read&lt;/strong&gt;&lt;br/&gt;');
-			return false;
-		}
-	}
-	
-	function copyFiles($dirFrom, $dirTo, $includeSubDirs = false) {
-		if( ! current_user_can('edit_files')) {
-			echo 'Oops sorry you are not authorized to do this';
-			return false;
-		}
-		//check if we have both the directories
-		//older versions may now have new dirs so create them
-		if(! $dir =  @opendir($dirTo)) {
-			@mkdir($dirTo);
-			@chmod($dirTo, 0757);
-			@closedir($dirTo);
-		}
-		if($sourceFiles = @opendir($dirFrom)) {
-			$this-&gt;logMessage('&lt;br /&gt;&lt;strong&gt;Copying over files&lt;/strong&gt; from '.$dirFrom.' to '.$dirTo.'&lt;br /&gt;');
-			@closedir($dirFrom);
-			$dir = dir($dirFrom);
-			@chmod($dirFrom, 0757);
-			while($item = $dir-&gt;read()) {
-				if((is_dir($dirFrom. $this-&gt;slash .$item) 
-								&amp;&amp; $item != &quot;.&quot; &amp;&amp; $item != &quot;..&quot;)
-								&amp;&amp; $includeSubDirs) {
-					$this-&gt;copyFiles($dirFrom . $this-&gt;slash. $item, $dirTo . $this-&gt;slash . $item, $includeSubDirs);
-				}
-				else {
-					if($item!=&quot;.&quot;&amp;&amp;$item!=&quot;..&quot; &amp;&amp; ! is_dir($dirFrom. $this-&gt;slash .$item) &amp;&amp; $this-&gt;checkIncludeFile($item)) {
-						if(copy($dirFrom . $this-&gt;slash . $item, $dirTo . $this-&gt;slash. $item) ) {
-							$this-&gt;logMessage('Overwriting file '.$item.' to '. $dirTo .'&lt;br/&gt;');
-						}
-						else {
-							$this-&gt;logMessage('ERROR -&gt; Could not copy '.$dirFrom . $this-&gt;slash . $item. 'to '. $dirTo . $this-&gt;slash.'&lt;br /&gt;');
-							$this-&gt;operationError = true;
-						}
-					}
-				}
-			}
-		}
-		else {
-			$this-&gt;logMessage('ERROR -&gt; Could not read either the source directory '.$dirFrom.' or the traget directory '.$dirTo.'&lt;br /&gt;');
-			$this-&gt;operationError = true;
-		}
-		return true;
-	}
-
-	/**
-	* Downloads the zip file from the given directory
-	* Cannot use it due to restrtictions in *nix based sites
-	* where the fopen cannot open remote sites
-	**/
-	function download($remoteFileLoc, $localFileLoc) {
-	    $this-&gt;logMessage('Downloading the files using Snoopy&lt;br /&gt;');
-	    if (file_exists($localFileLoc)) { 
-		$this-&gt;logMessage('ERROR -&gt; Some files already exists, please delete all files from '. $this-&gt;theDirToDoThings. ' and start the process again &lt;br /&gt;' , true);
-		return false;
-	    }
-    //open a handle for the destination file
-    $handle = fopen($localFileLoc, 'w');
-    if( ! $handle ){
-		  $this-&gt;logMessage('ERROR -&gt; Could not write the file, please delete all files from '. $this-&gt;theDirToDoThings. ' and start the process again &lt;br /&gt;' , true);
-      return false;
-		}
-    
-		$remoteFileLoc = str_replace(' ', '%20', html_entity_decode($remoteFileLoc)); // fix url format
-		$snoopy = new WPAU_Snoopy();
-		$snoopy-&gt;fetch($remoteFileLoc);
-		if( $snoopy-&gt;status != '200' ){
-		  $this-&gt;logMessage('ERROR -&gt; Could not download latest files from WordPress. Cannot continue with the process.' , true);
-      return false;
-		}
-    
-    //write the downloaded file to disk
-    fwrite($handle, $snoopy-&gt;results);
-  	fclose($handle);
-    return true;
-  }
-	
-	/**
-	* Downloads the zip file from the given directory
-	* Cannot use it due to restrtictions in *nix based sites
-	* where the fopen cannot open remote sites
-	**/
-	
-	function downloadold ($remoteFileLoc, $localFileLoc) {
-		@unlink($localFileLoc);
-		$this-&gt;logMessage('Downloading the file using FOPEN method');
-	  $remoteFileLoc = str_replace(' ', '%20', html_entity_decode($remoteFileLoc)); // fix url format
-	  if (file_exists($localFileLoc)) { 
-			//chmod($localFileLoc, 0755); 
-			$this-&gt;logMessage('ERROR -&gt; Could not write the file, please delete all files from '. $this-&gt;theDirToDoThings. ' and start the process again &lt;br /&gt;' , true);
-			return false;
-		} 
-
-	  if (($remoteFile = fopen($remoteFileLoc, 'rb')) === FALSE) { 
-			$this-&gt;logMessage('ERROR -&gt; Remote File Error -&gt; Could not read remote file. Please specify a proper path &lt;br /&gt;', true);
-			return false; 
-		} // remote file
-	  if (($localFile = fopen($localFileLoc, 'wb')) === FALSE) { 
-			$this-&gt;logMessage('ERROR -&gt;  Could not write the file, please delete all files from '. $this-&gt;theDirToDoThings. ' and start the process again &lt;br /&gt;' , true);
-			return false; 
-		} // local files
-		
-	  while (!feof($remoteFile)) {
-	    if (fwrite($localFile, fread($remoteFile, 1024)) === FALSE) { 
-				fclose($remoteFile); 
-				fclose($localFile); 
-				$this-&gt;logMessage('ERROR -&gt; Could not write the file, please delete all files from '. $this-&gt;theDirToDoThings. ' and start the process again &lt;br /&gt;' , true);
-				return false; 
-			}
-  	}
-		$this-&gt;logMessage('Finished downloading the upgrade files from the server, it has been save to the location ' . $localFileLoc .'&lt;br /&gt;');
-	
-	  // Finished without errors
-	  fclose($remoteFile);
-	  fclose($localFile);
-	  return true;
-	}
-	
-	function downloadFSock($remoteSite, $remoteFile, $localFileLoc) {
-		$fp = fsockopen($remoteSite, 80, $errno, $errstr, 30);
-		if(!$fp) {
-			$this-&gt;logMessage('Unable to open connection with '.$remoteSite);
-			return false;
-		}
-		else {
-			$out = &quot;GET /$remoteFile HTTP/1.0\r\n&quot;;
-	    $out .= &quot;Host: $remoteSite\r\n&quot;;
-  	  $out .= &quot;Connection: Close\r\n\r\n&quot;;
-			fwrite($fp, $out);
-			$data = '';
-			while (!feof($fp)) {
-				$data .= fgets($fp, 128);
-   		}
-			//seperate the header and actual content
-			$responseData = explode(&quot;\r\n\r\n&quot;, $data);
-			if($localFile = fopen($localFileLoc, 'w')) {
-	     	if(! fwrite($localFile, $responseData[1])) {
-					$this-&gt;logMessage('Could not write to local file');
-					return false;
-				}
-			}
-      $this-&gt;logMessage('Finished downloading the upgrade files from the server, it has been save to the location ' . $localFileLoc .'&lt;br /&gt;');
-			@fclose($fp);
-			@fclose($localFile);
-			return true;
-		}
-	}
-	
-	/**
-	* Upload the files to the directory
-	**/
-	function upload($fileData) {	
-		if (is_uploaded_file($fileData['thefile']['tmp_name'])) {
-			if(move_uploaded_file($fileData['thefile']['tmp_name'], $this-&gt;archiveName)) {
-				$this-&gt;logMessage('Succesfully moved the uploaded file to the directory&lt;br /&gt;');
-				return true;
-			}
-			else {
-				return false;
-			}
-		}
-		else {
-			$this-&gt;logMessage('ERROR -&gt; Oops no files uploaded could be some error&lt;br /&gt;', true);
-			return false;
-		}
-	}
-	
-	/**
-	* Unzips the downloaded or uploaded files
-	* to a directory
-	**/
-	function unzip() {
-		if( ! current_user_can('edit_files')) {
-			echo 'Oops sorry you are not authorized to do this';
-			return false;
-		}
-		//require_once('pclzip.lib.php');
-		$unzipArchive = new PclZip($this-&gt;relativeArchiveName);
-		$this-&gt;logMessage('Unzipping the files to ' . $this-&gt;theDirToDoThings . $this-&gt;slash);
-		if($unzipArchive-&gt;extract(PCLZIP_OPT_PATH, $this-&gt;theDirToDoThings . $this-&gt;slash) == 0) {
-			$this-&gt;logMessage('ERROR -&gt; Could not unarchive the file maybe it is a corrupted archive. &lt;br /&gt; Please delete all the files before you can do this. Refresh or click here to delete all the files');
-			return false;
-		}
-		else {
-			$this-&gt;logMessage('&lt;br /&gt;All set all files have been extracted&lt;br /&gt;');
-			@chmod($this-&gt;theDirToDoThings . $this-&gt;slash . 'wordpress' . $this-&gt;slash, 0755);
-			return true;
-		}
-	}
-	
-	function doMaintenanceMode($filePath, $fileName) {
-		if( ! current_user_can('edit_files')) {
-			echo 'Oops sorry you are not authorized to do this';
-			return false;
-		}
-		$this-&gt;logMessage('&lt;br /&gt;Putting the site into maintenance mode '.$filePath.'&lt;br /&gt;');
-		$theTmpFile = $filePath . $this-&gt;slash. $fileName;
-		$theFile = $this-&gt;absPath . 'index.php';
-		$toFile = $theFile  . '.wpau.bak';
-		$this-&gt;logMessage('Copying  ' . $theFile . ' to ' . $toFile. '&lt;br/&gt;');
-		if(copy($theFile, $toFile)) {
-			$this-&gt;logMessage('The file was successfully copied&lt;br/&gt;Moving the maintenance file to root&lt;br /&gt;');
-			if(copy($theTmpFile, $theFile)) {
-				$this-&gt;logMessage('Copying success ' . $theTmpFile . ' to ' . $theFile. '&lt;br/&gt;');
-				$this-&gt;logMessage('The site is now under maintenance mode. If you want to revert back please rename the file '. $toFile. ' to '. $theFile. '&lt;br /&gt;');
-				return true;
-			}
-			else {
-					$this-&gt;logMessage('ERROR -&gt; Could not put the site into maintenance mode &lt;br /&gt;');
-					return false;
-			}
-		}
-		else {
-			return false;
-		}
-	}
-	
-	function updateDatabase() {
-		if( ! current_user_can('manage_options')) {
-			echo 'Oops sorry you are not authorized to do this';
-			return false;
-		}
-		$this-&gt;logMessage('Updating your wordpress database');
-		require_once(ABSPATH . '/wp-admin/upgrade-functions.php');
-		if ( get_option('db_version') == $wp_db_version ) {
-			$this-&gt;logMessage('Everything seems to be upgraded. No need to update the database&lt;br /&gt;');
-			return true;
-		}
-		else {
-			wp_upgrade();
-			$this-&gt;logMessage('The wordpress database was succesfully upgraded to the latest version ' . get_option('db_version') . '&lt;br /&gt;');
-			return true;
-		}
-		return true;
-	}
-	
-	/**
-	* Checks whether a the uploaded file has the right extension
-	**/
-	function validUploadedExtension($extension) {
-		$this-&gt;logMessage(&quot;&lt;br /&gt;File Extension is $extension&lt;br /&gt;&quot;);
-		if(in_array($extension,  array('zip' , 'tar.gz'))) {
-			return true;
-		}
-		else {
-			return false;
-		}
-	}
-	
-	function cleanUpProcess() {
-		if(file_exists(trailingslashit(ABSPATH) . WPAU_LOG_FILE)) {
-			unlink(trailingslashit(ABSPATH) . WPAU_LOG_FILE);
-		}
-		if($dir = @dir($this-&gt;theDirToDoThings)) {
-			@chmod ($this-&gt;theDirToDoThings, 0757);
-			$this-&gt;recursive_remove_directory($this-&gt;theDirToDoThings);
-			return true;
-		}
-		else {
-			return false;
-		}
-		return false;
-	}
-	
-	
-	function recursive_remove_directory($directory, $empty=FALSE) {
-		if(substr($directory,-1) == '/') {
-			$directory = substr($directory,0,-1);
-		}
-		if(!file_exists($directory) || !is_dir($directory)) {
-			return FALSE;
-		}
-		elseif(is_readable($directory)) {
-			$handle = opendir($directory);
-			while (FALSE !== ($item = readdir($handle))) {
-				if($item != '.' &amp;&amp; $item != '..') {
-					$path = $directory.'/'.$item;
-					if(is_dir($path))  {
-						$this-&gt;recursive_remove_directory($path);
-					}
-					else{
-						unlink($path);
-					}
-				}
-			}
-			closedir($handle);
-			if($empty == FALSE &amp;&amp; $directory != $this-&gt;theDirToDoThings) { 
-				if(!rmdir($directory)) {
-					return FALSE;
-				}
-			}
-		}
-		return TRUE;
-	}
-	
-	function recursive_chmod_directory($directory) {
-		if(substr($directory,-1) == '/') {
-			$directory = substr($directory,0,-1);
-		}
-		if(!file_exists($directory) || !is_dir($directory)) {
-			return FALSE;
-		}
-		elseif(is_readable($directory)) {
-			$handle = @opendir($directory);
-			while (FALSE !== ($item = @readdir($handle))) {
-				if($item != '.' &amp;&amp; $item != '..') {
-					$path = $directory.'/'.$item;
-					if(is_dir($path))  {
-						chmod($path, 0757);
-						$this-&gt;recursive_chmod_directory($path);
-					}
-					else{
-						chmod($path, 0646);
-					}
-				}
-			}
-			closedir($handle);
-		}
-	}
-	
-	function checkIncludeFile($filename) {
-		$pathinfo = pathinfo($filename);
-		if(is_array($this-&gt;ignoreFiles)) {
-			if(in_array($filename, $this-&gt;ignoreFiles)) {
-				return false;
-			}
-		}
-		if(is_array($this-&gt;includeExtensions)) {
-			if(in_array($pathinfo['extension'], $this-&gt;includeExtensions)) {
-				return true;
-			}
-			else {
-				return false;
-			}
-		}
-	}
-
-}
-
-?&gt;
+&lt;?php
+/*
+Runs all the critical upgrade functions to upgrade the wordpress version
+
+*/
+
+class wpauUpgradeHelper extends wpauHelper {
+
+	var $theDirToDoThings;
+	var $absPath;
+	var $slash;
+	var $relativeSlash;
+	var $zipName;
+	var $extension;
+	var $archiveName;
+	var $relativePath;
+	var $relativeArchiveName; 
+	var $includeDirs;
+	var $ignoreFiles;
+	var $backupDir;
+	var $zipFileName;
+	var $operationError;
+	var $includeExtensions;
+	
+	function wpauUpgradeHelper($absPath, $isNix, $backupDir = 'wpau-backup', $relativePath = ABSPATH) {
+		$this-&gt;absPath = $absPath; //the abs path to wordpress installation
+		$this-&gt;backupDir = $backupDir;
+		if($isNix)  //change slash if we are running on windows
+			$this-&gt;slash = '/';
+		else 
+			$this-&gt;slash = '\\';
+		
+		$this-&gt;includeDirs = array('wp-admin', 'wp-includes'); //the directories we have to upgrade
+		$this-&gt;ignoreFiles = array('wp-config.php', 'wp-config-sample.php');
+		$this-&gt;includeExtensions = array('php', 'txt', 'htm', 'html', 'js', 'css', 'jpg', 'png', 'gif');
+		$this-&gt;relativeSlash = '/'; //relative is always this
+		$this-&gt;theDirToDoThings = trailingslashit($this-&gt;absPath). $backupDir; //the dir where we gonna store all our stuff
+		$this-&gt;zipName = 'wpau-latest'; // the name for the zip file
+		$this-&gt;extension = '.zip'; // the extension for the zip file
+		$this-&gt;zipFileName = $this-&gt;zipName . $this-&gt;extension; //the zip file name
+		$this-&gt;archiveName = $this-&gt;theDirToDoThings . $this-&gt;slash. $this-&gt;zipFileName; //the path to the archive
+		$this-&gt;relativePath = $relativePath; //relative path will be needed for the unzip process
+		$this-&gt;relativeArchiveName = $this-&gt;relativePath . $this-&gt;relativeSlash . &quot;wpau-backup&quot;. $this-&gt;relativeSlash . $this-&gt;zipFileName; //the archive paht for relative
+		
+		$this-&gt;operationError = false;
+    
+    if(! is_dir($this-&gt;theDirToDoThings)) {
+			mkdir ($this-&gt;theDirToDoThings);
+			$this-&gt;createIndexes();
+		}
+		
+	}
+	
+	/**
+	* Downloads the files from wordpress
+	*/
+	function getFilesFromWP($downFilePath) {
+		@unlink($this-&gt;archiveName);
+		set_time_limit ( 0 ) ;
+		$this-&gt;logMessage('Starting to download the file from ' .$downFilePath . '&lt;br /&gt;');
+		//$filename = $this-&gt;theDirToDoThings . $this-&gt;slash. $this-&gt;zipName . '-' . $this-&gt;random() . $this-&gt;extension;
+		if($this-&gt;download($downFilePath, $this-&gt;archiveName)) {
+			if($this-&gt;unzip()) {
+        return true;
+			}
+			else {
+        return false;
+			}
+		}
+		else {
+			return false;
+		}
+	}
+	
+	function downloadFilesFromWP($startUrl, $fileName) {
+		@unlink($this-&gt;archiveName);
+		set_time_limit ( 0 ) ;
+		$this-&gt;logMessage('Starting to download the file from ' .$downFilePath . '&lt;br /&gt;');
+		if($this-&gt;downloadFSock($startUrl, $fileName, $this-&gt;archiveName)) {
+			if($this-&gt;unzip()) {
+				return true;
+			}
+			else {
+				return false;
+			}
+		}
+		else {
+			return false;
+		}
+	}
+	
+	/** 
+	* Reads uploaded files from users
+	**/
+	function getUploadedFilesFromUser($fileData) {
+		if(isset($fileData)) {
+			$pathinfo = pathinfo($fileData['thefile']['name']);
+			if($this-&gt;validUploadedExtension($pathinfo['extension'])) {
+				$this-&gt;logMessage('We got a valid file to be uploaded&lt;br /&gt;');
+				if($this-&gt;upload($fileData)) {
+					if(is_file($this-&gt;relativeArchiveName)) {
+						if($this-&gt;unzip()) {
+							return true;
+						}
+					}
+					else {
+						return false;
+					}
+				}
+				else {
+					$this-&gt;logMessage('ERROR -&gt; Could not upload the file to the directory&lt;br /&gt;');
+				}
+			}
+			else {
+				$this-&gt;logMessage('ERROR -&gt; The file you are trying to upload is not a valid file, please upload only zip or tar.gz files&lt;br /&gt;');
+				return false;
+			}
+		}
+		else {
+			$this-&gt;logMessage('ERROR -&gt; You did not select any files to be uploaded&lt;br /&gt;');
+			return false;
+		}
+	}
+	
+	/**
+	* Upgrades the file from downloaded location
+	**/
+	
+	function upgradeFiles() {
+		if( ! current_user_can('edit_files')) {
+			echo 'Oops sorry you are not authorized to do this';
+			return false;
+		}
+		set_time_limit(0);
+		$theNewWPFiles = $this-&gt;theDirToDoThings . $this-&gt;slash . 'wordpress';
+		if($upgradeFilesDir = @opendir($theNewWPFiles)) {
+			@closedir($theNewWPFiles);
+			chmod($theNewWPFiles, 0755);
+			//first copy all the directory files
+			foreach($this-&gt;includeDirs as $dir) {
+				$this-&gt;copyFiles($this-&gt;theDirToDoThings . $this-&gt;slash . 'wordpress'. $this-&gt;slash. $dir, $this-&gt;absPath. $dir, true);
+			}
+			
+			$this-&gt;logMessage('&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Overwriting MAIN Directory files&lt;/strong&gt;&lt;br/&gt;');
+			if(! $this-&gt;copyFiles($this-&gt;theDirToDoThings . $this-&gt;slash . 'wordpress', $this-&gt;absPath, false) ) {
+				return false;
+			}
+			$this-&gt;logMessage('&lt;br /&gt;&lt;br /&gt;The files have been succesfully upgraded.');
+			
+			if(!$operationError)
+				return true;
+			else 
+				return false;
+		}
+		else {
+			$this-&gt;logMessage('&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Could not open the downloaded directory to read&lt;/strong&gt;&lt;br/&gt;');
+			return false;
+		}
+	}
+	
+	function copyFiles($dirFrom, $dirTo, $includeSubDirs = false) {
+		if( ! current_user_can('edit_files')) {
+			echo 'Oops sorry you are not authorized to do this';
+			return false;
+		}
+		//check if we have both the directories
+		//older versions may now have new dirs so create them
+		if(! $dir =  @opendir($dirTo)) {
+			@mkdir($dirTo);
+			@chmod($dirTo, 0757);
+			@closedir($dirTo);
+		}
+		if($sourceFiles = @opendir($dirFrom)) {
+			$this-&gt;logMessage('&lt;br /&gt;&lt;strong&gt;Copying over files&lt;/strong&gt; from '.$dirFrom.' to '.$dirTo.'&lt;br /&gt;');
+			@closedir($dirFrom);
+			$dir = dir($dirFrom);
+			@chmod($dirFrom, 0757);
+			while($item = $dir-&gt;read()) {
+				if((is_dir($dirFrom. $this-&gt;slash .$item) 
+								&amp;&amp; $item != &quot;.&quot; &amp;&amp; $item != &quot;..&quot;)
+								&amp;&amp; $includeSubDirs) {
+					$this-&gt;copyFiles($dirFrom . $this-&gt;slash. $item, $dirTo . $this-&gt;slash . $item, $includeSubDirs);
+				}
+				else {
+					if($item!=&quot;.&quot;&amp;&amp;$item!=&quot;..&quot; &amp;&amp; ! is_dir($dirFrom. $this-&gt;slash .$item) &amp;&amp; $this-&gt;checkIncludeFile($item)) {
+						if(copy($dirFrom . $this-&gt;slash . $item, $dirTo . $this-&gt;slash. $item) ) {
+							$this-&gt;logMessage('Overwriting file '.$item.' to '. $dirTo .'&lt;br/&gt;');
+						}
+						else {
+							$this-&gt;logMessage('ERROR -&gt; Could not copy '.$dirFrom . $this-&gt;slash . $item. 'to '. $dirTo . $this-&gt;slash.'&lt;br /&gt;');
+							$this-&gt;operationError = true;
+						}
+					}
+				}
+			}
+		}
+		else {
+			$this-&gt;logMessage('ERROR -&gt; Could not read either the source directory '.$dirFrom.' or the traget directory '.$dirTo.'&lt;br /&gt;');
+			$this-&gt;operationError = true;
+		}
+		return true;
+	}
+
+	/**
+	* Downloads the zip file from the given directory
+	* Cannot use it due to restrtictions in *nix based sites
+	* where the fopen cannot open remote sites
+	**/
+	function download($remoteFileLoc, $localFileLoc) {
+	    $this-&gt;logMessage('Downloading the files using Snoopy&lt;br /&gt;');
+	    if (file_exists($localFileLoc)) { 
+		$this-&gt;logMessage('ERROR -&gt; Some files already exists, please delete all files from '. $this-&gt;theDirToDoThings. ' and start the process again &lt;br /&gt;' , true);
+		return false;
+	    }
+    //open a handle for the destination file
+    $handle = fopen($localFileLoc, 'w');
+    if( ! $handle ){
+		  $this-&gt;logMessage('ERROR -&gt; Could not write the file, please delete all files from '. $this-&gt;theDirToDoThings. ' and start the process again &lt;br /&gt;' , true);
+      return false;
+		}
+    
+		$remoteFileLoc = str_replace(' ', '%20', html_entity_decode($remoteFileLoc)); // fix url format
+		$snoopy = new WPAU_Snoopy();
+		$snoopy-&gt;fetch($remoteFileLoc);
+		if( $snoopy-&gt;status != '200' ){
+		  $this-&gt;logMessage('ERROR -&gt; Could not download latest files from WordPress. Cannot continue with the process.' , true);
+      return false;
+		}
+    
+    //write the downloaded file to disk
+    fwrite($handle, $snoopy-&gt;results);
+  	fclose($handle);
+    return true;
+  }
+	
+	/**
+	* Downloads the zip file from the given directory
+	* Cannot use it due to restrtictions in *nix based sites
+	* where the fopen cannot open remote sites
+	**/
+	
+	function downloadold ($remoteFileLoc, $localFileLoc) {
+		@unlink($localFileLoc);
+		$this-&gt;logMessage('Downloading the file using FOPEN method');
+	  $remoteFileLoc = str_replace(' ', '%20', html_entity_decode($remoteFileLoc)); // fix url format
+	  if (file_exists($localFileLoc)) { 
+			//chmod($localFileLoc, 0755); 
+			$this-&gt;logMessage('ERROR -&gt; Could not write the file, please delete all files from '. $this-&gt;theDirToDoThings. ' and start the process again &lt;br /&gt;' , true);
+			return false;
+		} 
+
+	  if (($remoteFile = fopen($remoteFileLoc, 'rb')) === FALSE) { 
+			$this-&gt;logMessage('ERROR -&gt; Remote File Error -&gt; Could not read remote file. Please specify a proper path &lt;br /&gt;', true);
+			return false; 
+		} // remote file
+	  if (($localFile = fopen($localFileLoc, 'wb')) === FALSE) { 
+			$this-&gt;logMessage('ERROR -&gt;  Could not write the file, please delete all files from '. $this-&gt;theDirToDoThings. ' and start the process again &lt;br /&gt;' , true);
+			return false; 
+		} // local files
+		
+	  while (!feof($remoteFile)) {
+	    if (fwrite($localFile, fread($remoteFile, 1024)) === FALSE) { 
+				fclose($remoteFile); 
+				fclose($localFile); 
+				$this-&gt;logMessage('ERROR -&gt; Could not write the file, please delete all files from '. $this-&gt;theDirToDoThings. ' and start the process again &lt;br /&gt;' , true);
+				return false; 
+			}
+  	}
+		$this-&gt;logMessage('Finished downloading the upgrade files from the server, it has been save to the location ' . $localFileLoc .'&lt;br /&gt;');
+	
+	  // Finished without errors
+	  fclose($remoteFile);
+	  fclose($localFile);
+	  return true;
+	}
+	
+	function downloadFSock($remoteSite, $remoteFile, $localFileLoc) {
+		$fp = fsockopen($remoteSite, 80, $errno, $errstr, 30);
+		if(!$fp) {
+			$this-&gt;logMessage('Unable to open connection with '.$remoteSite);
+			return false;
+		}
+		else {
+			$out = &quot;GET /$remoteFile HTTP/1.0\r\n&quot;;
+	    $out .= &quot;Host: $remoteSite\r\n&quot;;
+  	  $out .= &quot;Connection: Close\r\n\r\n&quot;;
+			fwrite($fp, $out);
+			$data = '';
+			while (!feof($fp)) {
+				$data .= fgets($fp, 128);
+   		}
+			//seperate the header and actual content
+			$responseData = explode(&quot;\r\n\r\n&quot;, $data);
+			if($localFile = fopen($localFileLoc, 'w')) {
+	     	if(! fwrite($localFile, $responseData[1])) {
+					$this-&gt;logMessage('Could not write to local file');
+					return false;
+				}
+			}
+      $this-&gt;logMessage('Finished downloading the upgrade files from the server, it has been save to the location ' . $localFileLoc .'&lt;br /&gt;');
+			@fclose($fp);
+			@fclose($localFile);
+			return true;
+		}
+	}
+	
+	/**
+	* Upload the files to the directory
+	**/
+	function upload($fileData) {	
+		if (is_uploaded_file($fileData['thefile']['tmp_name'])) {
+			if(move_uploaded_file($fileData['thefile']['tmp_name'], $this-&gt;archiveName)) {
+				$this-&gt;logMessage('Succesfully moved the uploaded file to the directory&lt;br /&gt;');
+				return true;
+			}
+			else {
+				return false;
+			}
+		}
+		else {
+			$this-&gt;logMessage('ERROR -&gt; Oops no files uploaded could be some error&lt;br /&gt;', true);
+			return false;
+		}
+	}
+	
+	/**
+	* Unzips the downloaded or uploaded files
+	* to a directory
+	**/
+	function unzip() {
+		if( ! current_user_can('edit_files')) {
+			echo 'Oops sorry you are not authorized to do this';
+			return false;
+		}
+		//require_once('pclzip.lib.php');
+		$unzipArchive = new PclZip($this-&gt;relativeArchiveName);
+		$this-&gt;logMessage('Unzipping the files to ' . $this-&gt;theDirToDoThings . $this-&gt;slash);
+		if($unzipArchive-&gt;extract(PCLZIP_OPT_PATH, $this-&gt;theDirToDoThings . $this-&gt;slash) == 0) {
+			$this-&gt;logMessage('ERROR -&gt; Could not unarchive the file maybe it is a corrupted archive. &lt;br /&gt; Please delete all the files before you can do this. Refresh or click here to delete all the files');
+			return false;
+		}
+		else {
+			$this-&gt;logMessage('&lt;br /&gt;All set all files have been extracted&lt;br /&gt;');
+			@chmod($this-&gt;theDirToDoThings . $this-&gt;slash . 'wordpress' . $this-&gt;slash, 0755);
+			return true;
+		}
+	}
+	
+	function doMaintenanceMode($filePath, $fileName) {
+		if( ! current_user_can('edit_files')) {
+			echo 'Oops sorry you are not authorized to do this';
+			return false;
+		}
+		$this-&gt;logMessage('&lt;br /&gt;Putting the site into maintenance mode '.$filePath.'&lt;br /&gt;');
+		$theTmpFile = $filePath . $this-&gt;slash. $fileName;
+		$theFile = $this-&gt;absPath . 'index.php';
+		$toFile = $theFile  . '.wpau.bak';
+		$this-&gt;logMessage('Copying  ' . $theFile . ' to ' . $toFile. '&lt;br/&gt;');
+		if(copy($theFile, $toFile)) {
+			$this-&gt;logMessage('The file was successfully copied&lt;br/&gt;Moving the maintenance file to root&lt;br /&gt;');
+			if(copy($theTmpFile, $theFile)) {
+				$this-&gt;logMessage('Copying success ' . $theTmpFile . ' to ' . $theFile. '&lt;br/&gt;');
+				$this-&gt;logMessage('The site is now under maintenance mode. If you want to revert back please rename the file '. $toFile. ' to '. $theFile. '&lt;br /&gt;');
+				return true;
+			}
+			else {
+					$this-&gt;logMessage('ERROR -&gt; Could not put the site into maintenance mode &lt;br /&gt;');
+					return false;
+			}
+		}
+		else {
+			return false;
+		}
+	}
+	
+	function updateDatabase() {
+		if( ! current_user_can('manage_options')) {
+			echo 'Oops sorry you are not authorized to do this';
+			return false;
+		}
+		$this-&gt;logMessage('Updating your wordpress database');
+		require_once(ABSPATH . '/wp-admin/upgrade-functions.php');
+		if ( get_option('db_version') == $wp_db_version ) {
+			$this-&gt;logMessage('Everything seems to be upgraded. No need to update the database&lt;br /&gt;');
+			return true;
+		}
+		else {
+			wp_upgrade();
+			$this-&gt;logMessage('The wordpress database was succesfully upgraded to the latest version ' . get_option('db_version') . '&lt;br /&gt;');
+			return true;
+		}
+		return true;
+	}
+	
+	/**
+	* Checks whether a the uploaded file has the right extension
+	**/
+	function validUploadedExtension($extension) {
+		$this-&gt;logMessage(&quot;&lt;br /&gt;File Extension is $extension&lt;br /&gt;&quot;);
+		if(in_array($extension,  array('zip' , 'tar.gz'))) {
+			return true;
+		}
+		else {
+			return false;
+		}
+	}
+	
+	function cleanUpProcess() {
+		if(file_exists(trailingslashit(ABSPATH) . WPAU_LOG_FILE)) {
+			unlink(trailingslashit(ABSPATH) . WPAU_LOG_FILE);
+		}
+		if($dir = @dir($this-&gt;theDirToDoThings)) {
+			@chmod ($this-&gt;theDirToDoThings, 0757);
+			$this-&gt;recursive_remove_directory($this-&gt;theDirToDoThings);
+			return true;
+		}
+		else {
+			return false;
+		}
+		return false;
+	}
+	
+	
+	function recursive_remove_directory($directory, $empty=FALSE) {
+		if(substr($directory,-1) == '/') {
+			$directory = substr($directory,0,-1);
+		}
+		if(!file_exists($directory) || !is_dir($directory)) {
+			return FALSE;
+		}
+		elseif(is_readable($directory)) {
+			$handle = opendir($directory);
+			while (FALSE !== ($item = readdir($handle))) {
+				if($item != '.' &amp;&amp; $item != '..') {
+					$path = $directory.'/'.$item;
+					if(is_dir($path))  {
+						$this-&gt;recursive_remove_directory($path);
+					}
+					else{
+						unlink($path);
+					}
+				}
+			}
+			closedir($handle);
+			if($empty == FALSE &amp;&amp; $directory != $this-&gt;theDirToDoThings) { 
+				if(!rmdir($directory)) {
+					return FALSE;
+				}
+			}
+		}
+		return TRUE;
+	}
+	
+	function recursive_chmod_directory($directory) {
+		if(substr($directory,-1) == '/') {
+			$directory = substr($directory,0,-1);
+		}
+		if(!file_exists($directory) || !is_dir($directory)) {
+			return FALSE;
+		}
+		elseif(is_readable($directory)) {
+			$handle = @opendir($directory);
+			while (FALSE !== ($item = @readdir($handle))) {
+				if($item != '.' &amp;&amp; $item != '..') {
+					$path = $directory.'/'.$item;
+					if(is_dir($path))  {
+						chmod($path, 0757);
+						$this-&gt;recursive_chmod_directory($path);
+					}
+					else{
+						chmod($path, 0646);
+					}
+				}
+			}
+			closedir($handle);
+		}
+	}
+	
+	function checkIncludeFile($filename) {
+		$pathinfo = pathinfo($filename);
+		if(is_array($this-&gt;ignoreFiles)) {
+			if(in_array($filename, $this-&gt;ignoreFiles)) {
+				return false;
+			}
+		}
+		if(is_array($this-&gt;includeExtensions)) {
+			if(in_array($pathinfo['extension'], $this-&gt;includeExtensions)) {
+				return true;
+			}
+			else {
+				return false;
+			}
+		}
+	}
+
+}
+
+?&gt;</diff>
      <filename>wordpress/wp-content/plugins/wordpress-automatic-upgrade/wpau_upgrade.class.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,128 +1,128 @@
-&lt;?php
-/*
-ZIp functionality class for wordpress automatic upgrades
-*/
-
-//require_once('lib/pclzip.lib.php');
-class wpauZipFuncs extends wpauHelper {
-	var $archiveName;
-	var $fileName;
-	var $isFileWritten;
-	var $absPath;
-	var $absNewPath;
-	var $backupPath;
-	var $slash;
-	var $files;
-	var $archiver;
-	var $includeDirs;
-	var $backupDir;
-	var $includeExtensions;
-	var $ignoreFiles;
-	
-	function wpauZipFuncs($absPath, $isNix, $archiveName, $backupDir, $includeDirs, $archiveExt = '.zip') {
-		$this-&gt;isFileWritten = false;
-		$this-&gt;backupDir = $backupDir;
-		$this-&gt;files = array();
-		$this-&gt;absPath = $absPath;
-		$this-&gt;ignoreFiles = array('wp-config.php', 'wp-config-sample.php');
-		$this-&gt;absNewPath = substr($this-&gt;absPath, 0, -1);
-		$this-&gt;includeDirs = $includeDirs;
-		$this-&gt;includeExtensions = array('php', 'txt', 'htm', 'html', 'js', 'css', 'jpg', 'png', 'gif'); // the extensions we need to backup
-		
-		if($isNix) 
-			$this-&gt;slash = &quot;/&quot;;
-		else 
-			$this-&gt;slash = &quot;\\&quot;;
-		
-		$this-&gt;backupPath = $this-&gt;absPath . $this-&gt;slash . $backupDir;
-		
-		//create the backup directory if it does not exist
-		if(is_dir($this-&gt;backupPath)) {
-			//nada
-		}
-		else {
-			$backdir = @mkdir($this-&gt;backupPath);
-			$this-&gt;createIndexes();
-			@closedir($this-&gt;backupPath);
-		}
-		$this-&gt;archiveName = $this-&gt;backupPath. $this-&gt;slash. $archiveName . $archiveExt;
-		$this-&gt;fileName = $archiveName . '-' . $this-&gt;random() . $archiveExt;
-		$_SESSION['filesbakname'] = $this-&gt;fileName;
-		$this-&gt;archiver = new PclZip(trailingslashit($this-&gt;backupPath) . $this-&gt;fileName);
-		$this-&gt;logMessage('&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Creating&lt;/strong&gt; files backup archive at '.$this-&gt;fileName.'&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;');
-	}
-	
-	/** creates a archive based on current object **/
-	function createArchive() {
-		if( ! current_user_can('edit_files')) {
-			echo 'Oops sorry you are not authorized to do this';
-			return false;
-		}
-		$parentDir = $this-&gt;absNewPath;
-		/*
-		* We only backup essential directories and only extensions required
-		*/
-		//create the main dir
-		$this-&gt;logMessage('Archiving the main folder located at '. $parentDir.'&lt;br /&gt;');
-		$this-&gt;archiveDir($parentDir, $parentDir, $parentDir, false);
-		
-		//only run for wp-admin and wp-includes
-		foreach($this-&gt;includeDirs as $dirs) {
-			$this-&gt;logMessage('Archiving the folder '. $parentDir.' recursively including sub directories&lt;br &gt;');
-			$this-&gt;archiveDir($parentDir . $this-&gt;slash. $dirs, $parentDir . $this-&gt;slash. $dirs, $parentDir . $this-&gt;slash. $dirs, true);
-		}
-		$this-&gt;writeToDisk();
-	} //end createArchive
-	
-	function writeToDisk() {
-		$v_list = $this-&gt;archiver-&gt;create($this-&gt;files);
-		if ($v_list == 0) {
-		$this-&gt;logMessage('Could not archive the files ' .$this-&gt;archiver-&gt;errorInfo(true));
-		//$this-&gt;logMessage('Could not archive the files ');
-		 $this-&gt;isFileWritten = false;
-  	}
-		else {
-			$this-&gt;logMessage('&lt;br /&gt;&lt;strong&gt;Succesfully Created &lt;/strong&gt;files backup archive at '. $this-&gt;archiveName .'&lt;br /&gt;&lt;br /&gt;');
-			if(is_file($this-&gt;archiveName)) {
-				@chmod($this-&gt;archiveName, 0646);
-			}
-			$this-&gt;isFileWritten = true;
-		}
-	} //end writeToDisk
-	
-	function archiveDir($start, $dirName, $zipPath, $addSubDir = false){
-	    $basename = pathinfo($start);
-	    $basename = $basename['basename'];
-	    $ls=array();
-	    $dir = dir($start);
-	    while($item = $dir-&gt;read()) {
-        	if(($item != &quot;.&quot; &amp;&amp; $item != &quot;..&quot; &amp;&amp; is_dir($start. $this-&gt;slash .$item)) &amp;&amp; $addSubDir) {
-			$this-&gt;archiveDir($start. $this-&gt;slash. $item, $start . $this-&gt;slash . $item, $zipPath . $this-&gt;slash . $item);
-        	}
-		else{
-	            if( ( $item!=&quot;.&quot;&amp;&amp;$item!=&quot;..&quot; ) &amp;&amp; ( ! is_dir($start. $this-&gt;slash .$item) ) &amp;&amp; ($this-&gt;checkIncludeFile($item)) ) {
-			array_push($this-&gt;files, $dirName . $this-&gt;slash . $item);
-			$this-&gt;logMessage('Adding File '.$dirName.$this-&gt;slash.$item.' to '.$zipPath.$this-&gt;slash.$item.'&lt;br /&gt;');
-            	}
-           }
-         }
-        }  //end archiveDir
-	
-	
-	function checkIncludeFile($filename) {
-		$pathinfo = pathinfo($filename);
-		if(is_array($this-&gt;includeExtensions)) {
-			if(in_array($filename, $this-&gt;ignoreFiles)) {
-				return false;
-			}
-			if(in_array($pathinfo['extension'], $this-&gt;includeExtensions)) {
-				return true;
-			}
-			else {
-				return false;
-			}
-		}
-	}
-}
-
+&lt;?php
+/*
+ZIp functionality class for wordpress automatic upgrades
+*/
+
+//require_once('lib/pclzip.lib.php');
+class wpauZipFuncs extends wpauHelper {
+	var $archiveName;
+	var $fileName;
+	var $isFileWritten;
+	var $absPath;
+	var $absNewPath;
+	var $backupPath;
+	var $slash;
+	var $files;
+	var $archiver;
+	var $includeDirs;
+	var $backupDir;
+	var $includeExtensions;
+	var $ignoreFiles;
+	
+	function wpauZipFuncs($absPath, $isNix, $archiveName, $backupDir, $includeDirs, $archiveExt = '.zip') {
+		$this-&gt;isFileWritten = false;
+		$this-&gt;backupDir = $backupDir;
+		$this-&gt;files = array();
+		$this-&gt;absPath = $absPath;
+		$this-&gt;ignoreFiles = array('wp-config.php', 'wp-config-sample.php');
+		$this-&gt;absNewPath = substr($this-&gt;absPath, 0, -1);
+		$this-&gt;includeDirs = $includeDirs;
+		$this-&gt;includeExtensions = array('php', 'txt', 'htm', 'html', 'js', 'css', 'jpg', 'png', 'gif'); // the extensions we need to backup
+		
+		if($isNix) 
+			$this-&gt;slash = &quot;/&quot;;
+		else 
+			$this-&gt;slash = &quot;\\&quot;;
+		
+		$this-&gt;backupPath = $this-&gt;absPath . $this-&gt;slash . $backupDir;
+		
+		//create the backup directory if it does not exist
+		if(is_dir($this-&gt;backupPath)) {
+			//nada
+		}
+		else {
+			$backdir = @mkdir($this-&gt;backupPath);
+			$this-&gt;createIndexes();
+			@closedir($this-&gt;backupPath);
+		}
+		$this-&gt;archiveName = $this-&gt;backupPath. $this-&gt;slash. $archiveName . $archiveExt;
+		$this-&gt;fileName = $archiveName . '-' . $this-&gt;random() . $archiveExt;
+		$_SESSION['filesbakname'] = $this-&gt;fileName;
+		$this-&gt;archiver = new PclZip(trailingslashit($this-&gt;backupPath) . $this-&gt;fileName);
+		$this-&gt;logMessage('&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Creating&lt;/strong&gt; files backup archive at '.$this-&gt;fileName.'&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;');
+	}
+	
+	/** creates a archive based on current object **/
+	function createArchive() {
+		if( ! current_user_can('edit_files')) {
+			echo 'Oops sorry you are not authorized to do this';
+			return false;
+		}
+		$parentDir = $this-&gt;absNewPath;
+		/*
+		* We only backup essential directories and only extensions required
+		*/
+		//create the main dir
+		$this-&gt;logMessage('Archiving the main folder located at '. $parentDir.'&lt;br /&gt;');
+		$this-&gt;archiveDir($parentDir, $parentDir, $parentDir, false);
+		
+		//only run for wp-admin and wp-includes
+		foreach($this-&gt;includeDirs as $dirs) {
+			$this-&gt;logMessage('Archiving the folder '. $parentDir.' recursively including sub directories&lt;br &gt;');
+			$this-&gt;archiveDir($parentDir . $this-&gt;slash. $dirs, $parentDir . $this-&gt;slash. $dirs, $parentDir . $this-&gt;slash. $dirs, true);
+		}
+		$this-&gt;writeToDisk();
+	} //end createArchive
+	
+	function writeToDisk() {
+		$v_list = $this-&gt;archiver-&gt;create($this-&gt;files);
+		if ($v_list == 0) {
+		$this-&gt;logMessage('Could not archive the files ' .$this-&gt;archiver-&gt;errorInfo(true));
+		//$this-&gt;logMessage('Could not archive the files ');
+		 $this-&gt;isFileWritten = false;
+  	}
+		else {
+			$this-&gt;logMessage('&lt;br /&gt;&lt;strong&gt;Succesfully Created &lt;/strong&gt;files backup archive at '. $this-&gt;archiveName .'&lt;br /&gt;&lt;br /&gt;');
+			if(is_file($this-&gt;archiveName)) {
+				@chmod($this-&gt;archiveName, 0646);
+			}
+			$this-&gt;isFileWritten = true;
+		}
+	} //end writeToDisk
+	
+	function archiveDir($start, $dirName, $zipPath, $addSubDir = false){
+	    $basename = pathinfo($start);
+	    $basename = $basename['basename'];
+	    $ls=array();
+	    $dir = dir($start);
+	    while($item = $dir-&gt;read()) {
+        	if(($item != &quot;.&quot; &amp;&amp; $item != &quot;..&quot; &amp;&amp; is_dir($start. $this-&gt;slash .$item)) &amp;&amp; $addSubDir) {
+			$this-&gt;archiveDir($start. $this-&gt;slash. $item, $start . $this-&gt;slash . $item, $zipPath . $this-&gt;slash . $item);
+        	}
+		else{
+	            if( ( $item!=&quot;.&quot;&amp;&amp;$item!=&quot;..&quot; ) &amp;&amp; ( ! is_dir($start. $this-&gt;slash .$item) ) &amp;&amp; ($this-&gt;checkIncludeFile($item)) ) {
+			array_push($this-&gt;files, $dirName . $this-&gt;slash . $item);
+			$this-&gt;logMessage('Adding File '.$dirName.$this-&gt;slash.$item.' to '.$zipPath.$this-&gt;slash.$item.'&lt;br /&gt;');
+            	}
+           }
+         }
+        }  //end archiveDir
+	
+	
+	function checkIncludeFile($filename) {
+		$pathinfo = pathinfo($filename);
+		if(is_array($this-&gt;includeExtensions)) {
+			if(in_array($filename, $this-&gt;ignoreFiles)) {
+				return false;
+			}
+			if(in_array($pathinfo['extension'], $this-&gt;includeExtensions)) {
+				return true;
+			}
+			else {
+				return false;
+			}
+		}
+	}
+}
+
 ?&gt;
\ No newline at end of file</diff>
      <filename>wordpress/wp-content/plugins/wordpress-automatic-upgrade/wpau_zip.class.php</filename>
    </modified>
    <modified>
      <diff>@@ -332,6 +332,9 @@ function sanitize_user( $username, $strict = false ) {
 	if ( $strict )
 		$username = preg_replace('|[^a-z0-9 _.\-@]|i', '', $username);
 
+	// Consolidate contiguous whitespace
+	$username = preg_replace('|\s+|', ' ', $username);
+
 	return apply_filters('sanitize_user', $username, $raw_username, $strict);
 }
 </diff>
      <filename>wordpress/wp-includes/formatting.php</filename>
    </modified>
    <modified>
      <diff>@@ -1289,11 +1289,53 @@ function wp_generate_password($length = 12, $special_chars = true) {
 
 	$password = '';
 	for ( $i = 0; $i &lt; $length; $i++ )
-		$password .= substr($chars, mt_rand(0, strlen($chars) - 1), 1);
+		$password .= substr($chars, wp_rand(0, strlen($chars) - 1), 1);
 	return $password;
 }
 endif;
 
+if ( !function_exists('wp_rand') ) :
+ /**
+ * Generates a random number
+ *
+ * @since 2.6.2
+ *
+ * @param int $min Lower limit for the generated number (optional, default is 0)
+ * @param int $max Upper limit for the generated number (optional, default is 4294967295)
+ * @return int A random number between min and max
+ */
+function wp_rand( $min = 0, $max = 0 ) {
+	global $rnd_value;
+
+	$seed = get_option('random_seed');
+
+	// Reset $rnd_value after 14 uses
+	// 32(md5) + 40(sha1) + 40(sha1) / 8 = 14 random numbers from $rnd_value
+	if ( strlen($rnd_value) &lt; 8 ) {
+		$rnd_value = md5( uniqid(microtime() . mt_rand(), true ) . $seed );
+		$rnd_value .= sha1($rnd_value);
+		$rnd_value .= sha1($rnd_value . $seed);
+		$seed = md5($seed . $rnd_value);
+		update_option('random_seed', $seed);
+	}
+
+	// Take the first 8 digits for our value
+	$value = substr($rnd_value, 0, 8);
+
+	// Strip the first eight, leaving the remainder for the next call to wp_rand().
+	$rnd_value = substr($rnd_value, 8);
+
+	$value = abs(hexdec($value));
+
+	// Reduce the value to be within the min - max range
+	// 4294967295 = 0xffffffff = max random number
+	if ( $max != 0 )
+		$value = $min + (($max - $min + 1) * ($value / (4294967295 + 1)));
+
+	return abs(intval($value)); 
+}
+endif;
+
 if ( !function_exists('wp_set_password') ) :
 /**
  * Updates the user's password with a new encrypted one.</diff>
      <filename>wordpress/wp-includes/pluggable.php</filename>
    </modified>
    <modified>
      <diff>@@ -465,7 +465,7 @@ function get_posts($args = null) {
 		'order' =&gt; 'DESC', 'include' =&gt; '',
 		'exclude' =&gt; '', 'meta_key' =&gt; '',
 		'meta_value' =&gt;'', 'post_type' =&gt; 'post',
-		'post_parent' =&gt; 0
+		'post_parent' =&gt; 0, 'suppress_filters' =&gt; true
 	);
 
 	$r = wp_parse_args( $args, $defaults );
@@ -594,27 +594,20 @@ function get_post_meta($post_id, $key, $single = false) {
 
 	$meta_cache = wp_cache_get($post_id, 'post_meta');
 
+	if ( !$meta_cache ) {
+		update_postmeta_cache($post_id);
+		$meta_cache = wp_cache_get($post_id, 'post_meta');
+	}
+
 	if ( isset($meta_cache[$key]) ) {
 		if ( $single ) {
 			return maybe_unserialize( $meta_cache[$key][0] );
 		} else {
-			return maybe_unserialize( $meta_cache[$key] );
+			return array_map('maybe_unserialize', $meta_cache[$key]);
 		}
 	}
 
-	if ( !$meta_cache ) {
-		update_postmeta_cache($post_id);
-		$meta_cache = wp_cache_get($post_id, 'post_meta');
-	}
-
-	if ( $single ) {
-		if ( isset($meta_cache[$key][0]) )
-			return maybe_unserialize($meta_cache[$key][0]);
-		else
-			return '';
-	} else {
-		return maybe_unserialize($meta_cache[$key]);
-	}
+	return '';
 }
 
 /**
@@ -3297,7 +3290,7 @@ function _wp_put_post_revision( $post = null, $autosave = false ) {
 	if ( !$post || empty($post['ID']) )
 		return;
 
-	if ( isset($post['post_type']) &amp;&amp; 'revision' == $post_post['type'] )
+	if ( isset($post['post_type']) &amp;&amp; 'revision' == $post['post_type'] )
 		return new WP_Error( 'post_type', __( 'Cannot create a revision of a revision' ) );
 
 	$post = _wp_post_revision_fields( $post, $autosave );</diff>
      <filename>wordpress/wp-includes/post.php</filename>
    </modified>
    <modified>
      <diff>@@ -775,7 +775,7 @@ class WP_Query {
 		if ( !empty($qv['post_status']) )
 			$qv['post_status'] = preg_replace('|[^a-z0-9_,-]|', '', $qv['post_status']);
 
-		if ( $this-&gt;is_posts_page &amp;&amp; !$qv['withcomments'] )
+		if ( $this-&gt;is_posts_page &amp;&amp; ( ! isset($qv['withcomments']) || ! $qv['withcomments'] ) )
 			$this-&gt;is_comment_feed = false;
 
 		$this-&gt;is_singular = $this-&gt;is_single || $this-&gt;is_page || $this-&gt;is_attachment;
@@ -829,7 +829,12 @@ class WP_Query {
 		$join = '';
 		$search = '';
 		$groupby = '';
+		$fields = &quot;$wpdb-&gt;posts.*&quot;;
 		$post_status_join = false;
+		$page = 1;
+
+		if ( !isset($q['suppress_filters']) )
+			$q['suppress_filters'] = false;
 
 		if ( !isset($q['post_type']) ) {
 			if ( $this-&gt;is_search )
@@ -1361,8 +1366,10 @@ class WP_Query {
 
 		// Apply filters on where and join prior to paging so that any
 		// manipulations to them are reflected in the paging by day queries.
-		$where = apply_filters('posts_where', $where);
-		$join = apply_filters('posts_join', $join);
+		if ( !$q['suppress_filters'] ) {
+			$where = apply_filters('posts_where', $where);
+			$join = apply_filters('posts_join', $join);
+		}
 
 		// Paging
 		if ( empty($q['nopaging']) &amp;&amp; !$this-&gt;is_singular ) {
@@ -1394,9 +1401,11 @@ class WP_Query {
 				$cgroupby = '';
 			}
 
-			$cjoin = apply_filters('comment_feed_join', $cjoin);
-			$cwhere = apply_filters('comment_feed_where', $cwhere);
-			$cgroupby = apply_filters('comment_feed_groupby', $cgroupby);
+			if ( !$q['suppress_filters'] ) {
+				$cjoin = apply_filters('comment_feed_join', $cjoin);
+				$cwhere = apply_filters('comment_feed_where', $cwhere);
+				$cgroupby = apply_filters('comment_feed_groupby', $cgroupby);
+			}
 
 			$this-&gt;comments = (array) $wpdb-&gt;get_results(&quot;SELECT $distinct $wpdb-&gt;comments.* FROM $wpdb-&gt;comments $cjoin $cwhere $cgroupby ORDER BY comment_date_gmt DESC LIMIT &quot; . get_option('posts_per_rss'));
 			$this-&gt;comment_count = count($this-&gt;comments);
@@ -1414,28 +1423,33 @@ class WP_Query {
 				$where = &quot;AND 0&quot;;
 		}
 
+		$orderby = $q['orderby'];
+
 		// Apply post-paging filters on where and join.  Only plugins that
 		// manipulate paging queries should use these hooks.
-
-		$where = apply_filters('posts_where_paged', $where);
-		$groupby = apply_filters('posts_groupby', $groupby);
-		$join = apply_filters('posts_join_paged', $join);
-		$orderby = apply_filters('posts_orderby', $q['orderby']);
-		$distinct = apply_filters('posts_distinct', $distinct);
-		$fields = apply_filters('posts_fields', &quot;$wpdb-&gt;posts.*&quot;);
-		$limits = apply_filters( 'post_limits', $limits );
+		if ( !$q['suppress_filters'] ) {
+			$where = apply_filters('posts_where_paged', $where);
+			$groupby = apply_filters('posts_groupby', $groupby);
+			$join = apply_filters('posts_join_paged', $join);
+			$orderby = apply_filters('posts_orderby', $orderby);
+			$distinct = apply_filters('posts_distinct', $distinct);
+			$fields = apply_filters('posts_fields', $fields);
+			$limits = apply_filters( 'post_limits', $limits );
+		}
 
 		// Announce current selection parameters.  For use by caching plugins.
 		do_action( 'posts_selection', $where . $groupby . $orderby . $limits . $join );
 
 		// Filter again for the benefit of caching plugins.  Regular plugins should use the hooks above.
-		$where = apply_filters('posts_where_request', $where);
-		$groupby = apply_filters('posts_groupby_request', $groupby);
-		$join = apply_filters('posts_join_request', $join);
-		$orderby = apply_filters('posts_orderby_request', $orderby);
-		$distinct = apply_filters('posts_distinct_request', $distinct);
-		$fields = apply_filters('posts_fields_request', $fields);
-		$limits = apply_filters( 'post_limits_request', $limits );
+		if ( !$q['suppress_filters'] ) {
+			$where = apply_filters('posts_where_request', $where);
+			$groupby = apply_filters('posts_groupby_request', $groupby);
+			$join = apply_filters('posts_join_request', $join);
+			$orderby = apply_filters('posts_orderby_request', $orderby);
+			$distinct = apply_filters('posts_distinct_request', $distinct);
+			$fields = apply_filters('posts_fields_request', $fields);
+			$limits = apply_filters( 'post_limits_request', $limits );
+		}
 
 		if ( ! empty($groupby) )
 			$groupby = 'GROUP BY ' . $groupby;
@@ -1445,12 +1459,14 @@ class WP_Query {
 		if ( !empty($limits) )
 			$found_rows = 'SQL_CALC_FOUND_ROWS';
 
-		$request = &quot; SELECT $found_rows $distinct $fields FROM $wpdb-&gt;posts $join WHERE 1=1 $where $groupby $orderby $limits&quot;;
-		$this-&gt;request = apply_filters('posts_request', $request);
+		$this-&gt;request = &quot; SELECT $found_rows $distinct $fields FROM $wpdb-&gt;posts $join WHERE 1=1 $where $groupby $orderby $limits&quot;;
+		if ( !$q['suppress_filters'] )
+			$this-&gt;request = apply_filters('posts_request', $this-&gt;request);
 
 		$this-&gt;posts = $wpdb-&gt;get_results($this-&gt;request);
 		// Raw results filter.  Prior to status checks.
-		$this-&gt;posts = apply_filters('posts_results', $this-&gt;posts);
+		if ( !$q['suppress_filters'] )
+			$this-&gt;posts = apply_filters('posts_results', $this-&gt;posts);
 
 		if ( !empty($this-&gt;posts) &amp;&amp; $this-&gt;is_comment_feed &amp;&amp; $this-&gt;is_singular ) {
 			$cjoin = apply_filters('comment_feed_join', '');
@@ -1497,7 +1513,8 @@ class WP_Query {
 			}
 		}
 
-		$this-&gt;posts = apply_filters('the_posts', $this-&gt;posts);
+		if ( !$q['suppress_filters'] )
+			$this-&gt;posts = apply_filters('the_posts', $this-&gt;posts);
 
 		update_post_caches($this-&gt;posts);
 </diff>
      <filename>wordpress/wp-includes/query.php</filename>
    </modified>
    <modified>
      <diff>@@ -8,7 +8,7 @@
  *
  * @global string $wp_version
  */
-$wp_version = '2.6.1';
+$wp_version = '2.6.2';
 
 /**
  * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.</diff>
      <filename>wordpress/wp-includes/version.php</filename>
    </modified>
    <modified>
      <diff>@@ -1162,8 +1162,12 @@ function wp_widget_rss_output( $rss, $args = array() ) {
 					$author = ' &lt;cite&gt;' . wp_specialchars( strip_tags( $item['author_name'] ) ) . '&lt;/cite&gt;';
 			}
 
-			echo &quot;&lt;li&gt;&lt;a class='rsswidget' href='$link' title='$desc'&gt;$title&lt;/a&gt;{$date}{$summary}{$author}&lt;/li&gt;&quot;;
-		}
+			if ( $link == '' ) {
+				echo &quot;&lt;li&gt;$title{$date}{$summary}{$author}&lt;/li&gt;&quot;; 
+			} else {
+				echo &quot;&lt;li&gt;&lt;a class='rsswidget' href='$link' title='$desc'&gt;$title&lt;/a&gt;{$date}{$summary}{$author}&lt;/li&gt;&quot;; 
+			}
+}
 		echo '&lt;/ul&gt;';
 	} else {
 		echo '&lt;ul&gt;&lt;li&gt;' . __( 'An error has occurred; the feed is probably down. Try again later.' ) . '&lt;/li&gt;&lt;/ul&gt;';</diff>
      <filename>wordpress/wp-includes/widgets.php</filename>
    </modified>
    <modified>
      <diff>@@ -424,6 +424,8 @@ default:
 
 	$user = wp_signon('', $secure_cookie);
 
+	$redirect_to = apply_filters('login_redirect', $redirect_to, isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '', $user);
+
 	if ( !is_wp_error($user) ) {
 		// If the user can't edit posts, send them to their profile.
 		if ( !$user-&gt;has_cap('edit_posts') &amp;&amp; ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' ) )</diff>
      <filename>wordpress/wp-login.php</filename>
    </modified>
    <modified>
      <diff>@@ -101,7 +101,7 @@ if ( empty($PHP_SELF) )
 	$_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace(&quot;/(\?.*)?$/&quot;,'',$_SERVER[&quot;REQUEST_URI&quot;]);
 
 if ( version_compare( '4.3', phpversion(), '&gt;' ) ) {
-	die( sprintf( /*WP_I18N_OLD_PHP*/'Your server is running PHP version %s but WordPress requires at least 4.3.'/*/WP_I18N_OLD_PHP*/, php_version() ) );
+	die( sprintf( /*WP_I18N_OLD_PHP*/'Your server is running PHP version %s but WordPress requires at least 4.3.'/*/WP_I18N_OLD_PHP*/, phpversion() ) );
 }
 
 if ( !defined('WP_CONTENT_DIR') )</diff>
      <filename>wordpress/wp-settings.php</filename>
    </modified>
    <modified>
      <diff>@@ -3,7 +3,7 @@
 */
 
 /*------------------------------------------------------------------
-[Table of contents]
+[Table of Contents]
 
 1. Global Attributes
 	1.1. Body
@@ -15,6 +15,7 @@
 	2.3. Content / #content
 	2.4. Sidebar / #sidebar
 	2.5. Footer / #footer
+3. Helpful Classes
 -------------------------------------------------------------------*/
 
 /*------------------------------------------------------------------ 
@@ -31,6 +32,8 @@ a (hover): #purple (purple)
 a (active): #red (red) 
 -------------------------------------------------------------------*/   
 
+
+
 /* `1. Global Attributes
 ----------------------------------------------------------------------------------------------------*/
 
@@ -79,7 +82,9 @@ body {
 		
 	}
 
-
+	p {
+		line-height:1.5
+	}
 
 /* `2. Structure
 ----------------------------------------------------------------------------------------------------*/
@@ -107,4 +112,25 @@ body {
 		/* 2.5. */
 		#footer
 		{	
-		}
\ No newline at end of file
+		}
+		
+/* `3. Helpful Classes
+----------------------------------------------------------------------------------------------------*/	
+			
+.width100 { width: 100%; }
+.width75 { width: 75%; }
+.width50 { width: 50%; }
+.floatLeft { float: left; }
+.floatRight { float: right; }
+.alignLeft { text-align: left; }
+.alignRight { text-align: right; }	
+.alignCenter { text-align: center;}	
+.clear {clear: both;}
+
+.message-box { text-align: center; padding: 5px; color:#545454; width:80%;  margin:5px auto; }
+
+.clean { background-color: #efefef; border-top: 2px solid #dedede; border-bottom: 2px solid #dedede; }
+.info  { background-color: #f7fafd; border-top: 2px solid #b5d3ff; border-bottom: 2px solid #b5d3ff; }
+.ok    { background-color: #d7f7c4; border-top: 2px solid #82cb2f; border-bottom: 2px solid #82cb2f; }
+.alert { background-color: #fef5be; border-top: 2px solid #fdd425; border-bottom: 2px solid #fdd425; }
+.error { background-color: #ffcdd1; border-top: 2px solid #e10c0c; border-bottom: 2px solid #e10c0c; }</diff>
      <filename>www/css/main.css</filename>
    </modified>
    <modified>
      <diff>@@ -24,7 +24,7 @@
 		
 	&lt;/head&gt;
 	
-	&lt;body&gt;
+	&lt;body id=&quot;index&quot;&gt;
 		
 		&lt;div id=&quot;container&quot;  class=&quot;container_12&quot;&gt;
 			</diff>
      <filename>www/index.html</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>1c995879f15644ada2cc58954bae1af2c8ed37e5</id>
    </parent>
  </parents>
  <author>
    <name>Lynn Wallenstein</name>
    <email>lwallenstein@gmail.com</email>
  </author>
  <url>http://github.com/lwallenstein/start-me-up/commit/a249f1cb6f39a4b267f220cedc7787e4bebbb236</url>
  <id>a249f1cb6f39a4b267f220cedc7787e4bebbb236</id>
  <committed-date>2008-09-25T13:41:29-07:00</committed-date>
  <authored-date>2008-09-25T13:41:29-07:00</authored-date>
  <message>Just checking if I updated anything</message>
  <tree>b4faa75f541d16d2d43f569d82a85c2c57e43442</tree>
  <committer>
    <name>Lynn Wallenstein</name>
    <email>lwallenstein@gmail.com</email>
  </committer>
</commit>
