Backup and Restore WordPress – WPBackItUp Backup Plugin - Version 1.3.0

Version Description

Recommended upgrade: Amalgameted lite and pro versions of the plugin

Download this release

Release Info

Developer jcpeden
Plugin Icon 128x128 Backup and Restore WordPress – WPBackItUp Backup Plugin
Version 1.3.0
Comparing to
See all releases

Code changes from version 1.2.2 to 1.3.0

css/admin.css CHANGED
@@ -1,7 +1,7 @@
1
  /**
2
  * WP Backitup Admin Control Panel Stylesheets
3
  *
4
- * @version 1.2.1
5
  * @since 1.0.1
6
  */
7
 
@@ -27,7 +27,7 @@ iframe {
27
  top: 0;
28
  right: 0;
29
  width: 0;
30
- z-index: -10;
31
  }
32
 
33
  .submit {
1
  /**
2
  * WP Backitup Admin Control Panel Stylesheets
3
  *
4
+ * @version 1.3.0
5
  * @since 1.0.1
6
  */
7
 
27
  top: 0;
28
  right: 0;
29
  width: 0;
30
+ z-index: -1;
31
  }
32
 
33
  .submit {
index.php CHANGED
@@ -1,19 +1,19 @@
1
  <?php
2
  /**
3
- * WP Backitup Lite
4
  *
5
- * @package WP Backitup Lite
6
  *
7
  * @global object $wpdb
8
  *
9
  * @author jcpeden
10
- * @version 1.2.2
11
  */
12
  /*
13
- Plugin Name: WP Backitup Lite
14
  Plugin URI: http://www.wpbackitup.com
15
  Description: Backup your content, settings, themes, plugins and media in just a few simple clicks.
16
- Version: 1.2.2
17
  Author: John Peden
18
  Author URI: http://www.johncpeden.com
19
  License: GPL3
@@ -36,8 +36,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
36
  // Include constants file
37
  include_once dirname( __FILE__ ) . '/lib/constants.php';
38
 
39
- class WPBackitupLite {
40
- var $namespace = "wp-backitup-lite";
41
  var $friendly_name = WPBACKITUP_ITEM_NAME;
42
  var $version = WPBACKITUP_VERSION;
43
 
@@ -52,8 +52,8 @@ class WPBackitupLite {
52
  * Instantiation construction
53
  *
54
  * @uses add_action()
55
- * @uses WPBackitupLite::wp_register_scripts()
56
- * @uses WPBackitupLite::wp_register_styles()
57
  */
58
  function __construct() {
59
  // Name of the option_value to store plugin options in
@@ -77,8 +77,6 @@ class WPBackitupLite {
77
 
78
  /**
79
  * Add in various hooks
80
- *
81
- * Place all add_action, add_filter, add_shortcode hook-ins here
82
  */
83
  private function _add_hooks() {
84
  // Options page for configuration
@@ -96,11 +94,17 @@ class WPBackitupLite {
96
  }
97
 
98
  /**
99
- * Process update page form submissions
100
  *
101
- * @uses WPBackitupLite::sanitize()
102
  * @uses wp_redirect()
103
  * @uses wp_verify_nonce()
 
 
 
 
 
 
104
  */
105
  private function _admin_options_update() {
106
 
@@ -194,9 +198,6 @@ class WPBackitupLite {
194
 
195
  /**
196
  * Hook into register_activation_hook action
197
- *
198
- * Put code here that needs to happen when your plugin is first activated (database
199
- * creation, permalink additions, etc.)
200
  */
201
  static function activate() {
202
  // Do activation actions
@@ -209,7 +210,7 @@ class WPBackitupLite {
209
  * @uses add_options_page()
210
  */
211
  function admin_menu() {
212
- $page_hook = add_menu_page( $this->friendly_name, $this->friendly_name, 'administrator', $this->namespace, array( &$this, 'admin_options_page' ), WPBACKITUP_URLPATH .'/images/icon.png', 73);
213
 
214
  // Add print scripts and styles action based off the option page hook
215
  add_action( 'admin_print_scripts-' . $page_hook, array( &$this, 'admin_print_scripts' ) );
@@ -292,18 +293,15 @@ class WPBackitupLite {
292
  * etc. up for use.
293
  */
294
  static function instance() {
295
- global $WPBackitupLite;
296
 
297
  // Only instantiate the Class if it hasn't been already
298
- if( !isset( $WPBackitupLite ) ) $WPBackitupLite = new WPBackitupLite();
299
  }
300
 
301
  /**
302
  * Hook into plugin_action_links filter
303
  *
304
- * Adds a "Settings" link next to the "Deactivate" link in the plugin listing page
305
- * when the plugin is active.
306
- *
307
  * @param object $links An array of the links to show, this will be the modified variable
308
  * @param string $file The name of the file being processed in the filter
309
  */
@@ -322,10 +320,7 @@ class WPBackitupLite {
322
  /**
323
  * Route the user based off of environment conditions
324
  *
325
- * This function will handling routing of form submissions to the appropriate
326
- * form processor.
327
- *
328
- * @uses WPBackitupLite::_admin_options_update()
329
  */
330
  function route() {
331
  $uri = $_SERVER['REQUEST_URI'];
@@ -372,9 +367,9 @@ class WPBackitupLite {
372
  wp_register_style( "{$this->namespace}-admin", WPBACKITUP_URLPATH . "/css/admin.css", array(), $this->version, 'screen' );
373
  }
374
  }
375
- if( !isset( $WPBackitupLite ) ) {
376
- WPBackitupLite::instance();
377
  }
378
 
379
- register_activation_hook( __FILE__, array( 'WPBackitupLite', 'activate' ) );
380
- register_deactivation_hook( __FILE__, array( 'WPBackitupLite', 'deactivate' ) );
1
  <?php
2
  /**
3
+ * WP Backitup
4
  *
5
+ * @package WP Backitup
6
  *
7
  * @global object $wpdb
8
  *
9
  * @author jcpeden
10
+ * @version 1.3.0
11
  */
12
  /*
13
+ Plugin Name: WP Backitup
14
  Plugin URI: http://www.wpbackitup.com
15
  Description: Backup your content, settings, themes, plugins and media in just a few simple clicks.
16
+ Version: 1.3.0
17
  Author: John Peden
18
  Author URI: http://www.johncpeden.com
19
  License: GPL3
36
  // Include constants file
37
  include_once dirname( __FILE__ ) . '/lib/constants.php';
38
 
39
+ class WPBackitup {
40
+ var $namespace = "wp-backitup";
41
  var $friendly_name = WPBACKITUP_ITEM_NAME;
42
  var $version = WPBACKITUP_VERSION;
43
 
52
  * Instantiation construction
53
  *
54
  * @uses add_action()
55
+ * @uses WPBackitup::wp_register_scripts()
56
+ * @uses WPBackitup::wp_register_styles()
57
  */
58
  function __construct() {
59
  // Name of the option_value to store plugin options in
77
 
78
  /**
79
  * Add in various hooks
 
 
80
  */
81
  private function _add_hooks() {
82
  // Options page for configuration
94
  }
95
 
96
  /**
97
+ * Process update page form submissions and validate license key
98
  *
99
+ * @uses WPBackitup::sanitize()
100
  * @uses wp_redirect()
101
  * @uses wp_verify_nonce()
102
+ * @uses wp_remote_get()
103
+ * @uses add_query_arg()
104
+ * @uses is_wp_error()
105
+ * @uses wp_remote_retrieve_body()
106
+ * @uses update_option()
107
+ * @uses wp_safe_redirect()
108
  */
109
  private function _admin_options_update() {
110
 
198
 
199
  /**
200
  * Hook into register_activation_hook action
 
 
 
201
  */
202
  static function activate() {
203
  // Do activation actions
210
  * @uses add_options_page()
211
  */
212
  function admin_menu() {
213
+ $page_hook = add_menu_page( $this->friendly_name, $this->friendly_name, 'administrator', $this->namespace, array( &$this, 'admin_options_page' ), WPBACKITUP_URLPATH .'/images/icon.png', 77);
214
 
215
  // Add print scripts and styles action based off the option page hook
216
  add_action( 'admin_print_scripts-' . $page_hook, array( &$this, 'admin_print_scripts' ) );
293
  * etc. up for use.
294
  */
295
  static function instance() {
296
+ global $WPBackitup;
297
 
298
  // Only instantiate the Class if it hasn't been already
299
+ if( !isset( $WPBackitup ) ) $WPBackitup = new WPBackitup();
300
  }
301
 
302
  /**
303
  * Hook into plugin_action_links filter
304
  *
 
 
 
305
  * @param object $links An array of the links to show, this will be the modified variable
306
  * @param string $file The name of the file being processed in the filter
307
  */
320
  /**
321
  * Route the user based off of environment conditions
322
  *
323
+ * @uses WPBackitup::_admin_options_update()
 
 
 
324
  */
325
  function route() {
326
  $uri = $_SERVER['REQUEST_URI'];
367
  wp_register_style( "{$this->namespace}-admin", WPBACKITUP_URLPATH . "/css/admin.css", array(), $this->version, 'screen' );
368
  }
369
  }
370
+ if( !isset( $WPBackitup ) ) {
371
+ WPBackitup::instance();
372
  }
373
 
374
+ register_activation_hook( __FILE__, array( 'WPBackitup', 'activate' ) );
375
+ register_deactivation_hook( __FILE__, array( 'WPBackitup', 'deactivate' ) );
js/admin.js CHANGED
@@ -1,7 +1,7 @@
1
  /**
2
  * WP Backitup Admin Control Panel JavaScripts
3
  *
4
- * @version 1.2.0
5
  * @since 1.0.1
6
  */
7
 
@@ -11,11 +11,12 @@
11
  action: 'backup',
12
  beforeSend: function() {
13
  $('.backup-icon').css('visibility','visible');
14
- var htmlText = "<div class='prerequisites'>Checking prerequisites: <span class='currentStatus'>Pending</span></div><div class='backupfiles'>Backing-up /wp-content/: <span class='currentStatus'>Pending</span></div><div class='backupdb'>Backing-up database: <span class='currentStatus'>Pending</span></div><div class='infofile'>Creating backup directory: <span class='currentStatus'>Pending</span></div><div class='zipfile'>Zipping backup directory: <span class='currentStatus'>Pending</span></div><div class='cleanup'>Cleaning up: <span class='currentStatus'>Pending</span></div><div class='errorMessage'><span class='currentStatus'></span></div>";
15
  $("#status").html(htmlText);
16
- window.intervalDefine = setInterval(display_log, 1000);
17
  }
18
  };
 
19
  //define download variables
20
  var download = {
21
  action: 'download'
@@ -28,16 +29,16 @@
28
  function display_log() {
29
  $.post(ajaxurl, logreader, function(response) {
30
  var xmlObj = $(response);
31
- xmlObj.each(function(){
32
  var attributename = "." + $(this).attr('code');
33
  $(attributename).find(".currentStatus").html($(this).text());
34
- if($(this).attr('code') == "finalinfo" || $(this).attr('code') == "errorMessage")
35
- {
36
  clearInterval(window.intervalDefine);
37
  }
38
  });
39
  });
40
  }
 
41
  //define download function
42
  function download_link() {
43
  $.post(ajaxurl, download, function(response) {
@@ -55,31 +56,20 @@
55
  clearInterval(display_log);
56
  $('.backup-icon').fadeOut(1000);
57
  $("#php").html(response); //Return PHP messages, used for development
58
- });
59
- return false;
60
  })
61
 
62
  //execute restore on button click
63
  $("#restore-form").submit(function() {
64
- var maximum = $("#maximum").val();
65
- var fil = document.getElementById("wpbackitup-zip");
66
- var sizes = fil.files[0].size;
67
- var sizesd = sizes/(1024*1024);
68
- if(sizesd > maximum) {
69
- $("#status").html("<span style='color: red'>File size exceeds maxium upload size.</span>");
70
- return false;
71
- }
72
- var htmlvals = '<div class="upload">Uploading: <span class="currentStatus">Pending</span></div><div class="unzipping">Unzipping: <span class="currentStatus">Pending</span></div><div class="validation">Validating restoration file: <span class="currentStatus">Pending</span></div><div class="wpcontent">Restoring /wp-content/ directory: <span class="currentStatus">Pending</span></div><div class="database">Restoring database: <span class="currentStatus">Pending</span></div><div class="infomessage"><span class="currentStatus"></span></div><div class="errorMessage"><span class="currentStatus"></span></div>';
73
-
74
  $("#status").html(htmlvals);
75
- $(".upload").find('.currentStatus').html('In Progress');
76
  $('.restore-icon').css('visibility','visible');
77
  window.intervalDefine = setInterval(display_log, 1000);
78
  $("#restore-form").attr("target","upload_target");
79
  $("#upload_target").load(function (){
80
  importRestore();
81
  });
82
- return false;
83
  });
84
 
85
  //define importRestore function
1
  /**
2
  * WP Backitup Admin Control Panel JavaScripts
3
  *
4
+ * @version 1.3.0
5
  * @since 1.0.1
6
  */
7
 
11
  action: 'backup',
12
  beforeSend: function() {
13
  $('.backup-icon').css('visibility','visible');
14
+ var htmlText = "<div class='prerequisites'>Checking prerequisites: <span class='currentStatus'>Pending</span></div><div class='backupfiles'>Backing-up /wp-content/: <span class='currentStatus'>Pending</span></div><div class='backupdb'>Backing-up database: <span class='currentStatus'>Pending</span></div><div class='infofile'>Creating backup directory: <span class='currentStatus'>Pending</span></div><div class='zipfile'>Zipping backup directory: <span class='currentStatus'>Pending</span></div><div class='cleanup'>Cleaning up: <span class='currentStatus'>Pending</span></div><div class='errorMessage'><span class='currentStatus'></span></div>";
15
  $("#status").html(htmlText);
16
+ window.intervalDefine = setInterval(display_log, 1000);
17
  }
18
  };
19
+
20
  //define download variables
21
  var download = {
22
  action: 'download'
29
  function display_log() {
30
  $.post(ajaxurl, logreader, function(response) {
31
  var xmlObj = $(response);
32
+ xmlObj.each(function() {
33
  var attributename = "." + $(this).attr('code');
34
  $(attributename).find(".currentStatus").html($(this).text());
35
+ if($(this).attr('code') == "finalinfo" || $(this).attr('code') == "errorMessage") {
 
36
  clearInterval(window.intervalDefine);
37
  }
38
  });
39
  });
40
  }
41
+
42
  //define download function
43
  function download_link() {
44
  $.post(ajaxurl, download, function(response) {
56
  clearInterval(display_log);
57
  $('.backup-icon').fadeOut(1000);
58
  $("#php").html(response); //Return PHP messages, used for development
59
+ });
 
60
  })
61
 
62
  //execute restore on button click
63
  $("#restore-form").submit(function() {
64
+ var htmlvals = '<div class="upload">Uploading: <span class="currentStatus">Pending</span></div><div class="unzipping">Unzipping: <span class="currentStatus">Pending</span></div><div class="validation">Validating restoration file: <span class="currentStatus">Pending</span></div><div class="wpcontent">Restoring /wp-content/ directory: <span class="currentStatus">Pending</span></div><div class="database">Restoring database: <span class="currentStatus">Pending</span></div><div class="infomessage"><span class="currentStatus"></span></div><div class="errorMessage"><span class="currentStatus"></span></div>';
 
 
 
 
 
 
 
 
 
65
  $("#status").html(htmlvals);
66
+ $(".upload").find('.currentStatus').html('In Progress');
67
  $('.restore-icon').css('visibility','visible');
68
  window.intervalDefine = setInterval(display_log, 1000);
69
  $("#restore-form").attr("target","upload_target");
70
  $("#upload_target").load(function (){
71
  importRestore();
72
  });
 
73
  });
74
 
75
  //define importRestore function
js/ajaxfileupload.js CHANGED
@@ -1,205 +1,204 @@
1
- /**
2
- * WP Backitup Ajax File Upload
3
- *
4
- * @version 1.2.0
5
- * @since 1.0.1
6
- */
7
-
8
- jQuery.extend({
9
- createUploadIframe: function(id, uri)
10
- {
11
- //create frame
12
- var frameId = 'jUploadFrame' + id;
13
- var iframeHtml = '<iframe id="' + frameId + '" name="' + frameId + '" style="position:absolute; top:-9999px; left:-9999px"';
14
- if(window.ActiveXObject)
15
- {
16
- if(typeof uri== 'boolean'){
17
- iframeHtml += ' src="' + 'javascript:false' + '"';
18
-
19
- }
20
- else if(typeof uri== 'string'){
21
- iframeHtml += ' src="' + uri + '"';
22
-
23
- }
24
- }
25
- iframeHtml += ' />';
26
- jQuery(iframeHtml).appendTo(document.body);
27
-
28
- return jQuery('#' + frameId).get(0);
29
- },
30
- createUploadForm: function(id, fileElementId, data)
31
- {
32
- //create form
33
- var formId = 'jUploadForm' + id;
34
- var fileId = 'jUploadFile' + id;
35
- var form = jQuery('<form action="" method="POST" name="' + formId + '" id="' + formId + '" enctype="multipart/form-data"></form>');
36
- if(data)
37
- {
38
- for(var i in data)
39
- {
40
- jQuery('<input type="hidden" name="' + i + '" value="' + data[i] + '" />').appendTo(form);
41
- }
42
- }
43
- var oldElement = jQuery('#' + fileElementId);
44
- var newElement = jQuery(oldElement).clone();
45
- jQuery(oldElement).attr('id', fileId);
46
- jQuery(oldElement).before(newElement);
47
- jQuery(oldElement).appendTo(form);
48
-
49
-
50
-
51
- //set attributes
52
- jQuery(form).css('position', 'absolute');
53
- jQuery(form).css('top', '-1200px');
54
- jQuery(form).css('left', '-1200px');
55
- jQuery(form).appendTo('body');
56
- return form;
57
- },
58
-
59
- ajaxFileUpload: function(s) {
60
- // TODO introduce global settings, allowing the client to modify them for all requests, not only timeout
61
- s = jQuery.extend({}, jQuery.ajaxSettings, s);
62
- var id = new Date().getTime()
63
- var form = jQuery.createUploadForm(id, s.fileElementId, (typeof(s.data)=='undefined'?false:s.data));
64
- var io = jQuery.createUploadIframe(id, s.secureuri);
65
- var frameId = 'jUploadFrame' + id;
66
- var formId = 'jUploadForm' + id;
67
- // Watch for a new set of requests
68
- if ( s.global && ! jQuery.active++ )
69
- {
70
- jQuery.event.trigger( "ajaxStart" );
71
- }
72
- var requestDone = false;
73
- // Create the request object
74
- var xml = {}
75
- if ( s.global )
76
- jQuery.event.trigger("ajaxSend", [xml, s]);
77
- // Wait for a response to come back
78
- var uploadCallback = function(isTimeout)
79
- {
80
- var io = document.getElementById(frameId);
81
- try
82
- {
83
- if(io.contentWindow)
84
- {
85
- xml.responseText = io.contentWindow.document.body?io.contentWindow.document.body.innerHTML:null;
86
- xml.responseXML = io.contentWindow.document.XMLDocument?io.contentWindow.document.XMLDocument:io.contentWindow.document;
87
-
88
- }else if(io.contentDocument)
89
- {
90
- xml.responseText = io.contentDocument.document.body?io.contentDocument.document.body.innerHTML:null;
91
- xml.responseXML = io.contentDocument.document.XMLDocument?io.contentDocument.document.XMLDocument:io.contentDocument.document;
92
- }
93
- }catch(e)
94
- {
95
- jQuery.handleError(s, xml, null, e);
96
- }
97
- if ( xml || isTimeout == "timeout")
98
- {
99
- requestDone = true;
100
- var status;
101
- try {
102
- status = isTimeout != "timeout" ? "success" : "error";
103
- // Make sure that the request was successful or notmodified
104
- if ( status != "error" )
105
- {
106
- // process the data (runs the xml through httpData regardless of callback)
107
- var data = jQuery.uploadHttpData( xml, s.dataType );
108
- // If a local callback was specified, fire it and pass it the data
109
- if ( s.success )
110
- s.success( data, status );
111
-
112
- // Fire the global callback
113
- if( s.global )
114
- jQuery.event.trigger( "ajaxSuccess", [xml, s] );
115
- } else
116
- jQuery.handleError(s, xml, status);
117
- } catch(e)
118
- {
119
- status = "error";
120
- jQuery.handleError(s, xml, status, e);
121
- }
122
-
123
- // The request was completed
124
- if( s.global )
125
- jQuery.event.trigger( "ajaxComplete", [xml, s] );
126
-
127
- // Handle the global AJAX counter
128
- if ( s.global && ! --jQuery.active )
129
- jQuery.event.trigger( "ajaxStop" );
130
-
131
- // Process result
132
- if ( s.complete )
133
- s.complete(xml, status);
134
-
135
- jQuery(io).unbind()
136
-
137
- setTimeout(function()
138
- { try
139
- {
140
- jQuery(io).remove();
141
- jQuery(form).remove();
142
-
143
- } catch(e)
144
- {
145
- jQuery.handleError(s, xml, null, e);
146
- }
147
-
148
- }, 100)
149
-
150
- xml = null
151
-
152
- }
153
- }
154
- // Timeout checker
155
- if ( s.timeout > 0 )
156
- {
157
- setTimeout(function(){
158
- // Check to see if the request is still happening
159
- if( !requestDone ) uploadCallback( "timeout" );
160
- }, s.timeout);
161
- }
162
- try
163
- {
164
-
165
- var form = jQuery('#' + formId);
166
- jQuery(form).attr('action', s.url);
167
- jQuery(form).attr('method', 'POST');
168
- jQuery(form).attr('target', frameId);
169
- if(form.encoding)
170
- {
171
- jQuery(form).attr('encoding', 'multipart/form-data');
172
- }
173
- else
174
- {
175
- jQuery(form).attr('enctype', 'multipart/form-data');
176
- }
177
- jQuery(form).submit();
178
-
179
- } catch(e)
180
- {
181
- jQuery.handleError(s, xml, null, e);
182
- }
183
-
184
- jQuery('#' + frameId).load(uploadCallback );
185
- return {abort: function () {}};
186
-
187
- },
188
-
189
- uploadHttpData: function( r, type ) {
190
- var data = !type;
191
- data = type == "xml" || data ? r.responseXML : r.responseText;
192
- // If the type is "script", eval it in global context
193
- if ( type == "script" )
194
- jQuery.globalEval( data );
195
- // Get the JavaScript object, if JSON is used.
196
- if ( type == "json" )
197
- eval( "data = " + data );
198
- // evaluate scripts within html
199
- if ( type == "html" )
200
- jQuery("<div>").html(data).evalScripts();
201
-
202
- return data;
203
- }
204
- })
205
-
1
+ /**
2
+ * WP Backitup Ajax File Upload
3
+ *
4
+ * @version 1.2.0
5
+ * @since 1.0.1
6
+ */
7
+
8
+ jQuery.extend({
9
+ createUploadIframe: function(id, uri)
10
+ {
11
+ //create frame
12
+ var frameId = 'jUploadFrame' + id;
13
+ var iframeHtml = '<iframe id="' + frameId + '" name="' + frameId + '" style="position:absolute; top:-9999px; left:-9999px"';
14
+ if(window.ActiveXObject)
15
+ {
16
+ if(typeof uri== 'boolean'){
17
+ iframeHtml += ' src="' + 'javascript:false' + '"';
18
+
19
+ }
20
+ else if(typeof uri== 'string'){
21
+ iframeHtml += ' src="' + uri + '"';
22
+
23
+ }
24
+ }
25
+ iframeHtml += ' />';
26
+ jQuery(iframeHtml).appendTo(document.body);
27
+
28
+ return jQuery('#' + frameId).get(0);
29
+ },
30
+ createUploadForm: function(id, fileElementId, data)
31
+ {
32
+ //create form
33
+ var formId = 'jUploadForm' + id;
34
+ var fileId = 'jUploadFile' + id;
35
+ var form = jQuery('<form action="" method="POST" name="' + formId + '" id="' + formId + '" enctype="multipart/form-data"></form>');
36
+ if(data)
37
+ {
38
+ for(var i in data)
39
+ {
40
+ jQuery('<input type="hidden" name="' + i + '" value="' + data[i] + '" />').appendTo(form);
41
+ }
42
+ }
43
+ var oldElement = jQuery('#' + fileElementId);
44
+ var newElement = jQuery(oldElement).clone();
45
+ jQuery(oldElement).attr('id', fileId);
46
+ jQuery(oldElement).before(newElement);
47
+ jQuery(oldElement).appendTo(form);
48
+
49
+
50
+
51
+ //set attributes
52
+ jQuery(form).css('position', 'absolute');
53
+ jQuery(form).css('top', '-1200px');
54
+ jQuery(form).css('left', '-1200px');
55
+ jQuery(form).appendTo('body');
56
+ return form;
57
+ },
58
+
59
+ ajaxFileUpload: function(s) {
60
+ // TODO introduce global settings, allowing the client to modify them for all requests, not only timeout
61
+ s = jQuery.extend({}, jQuery.ajaxSettings, s);
62
+ var id = new Date().getTime()
63
+ var form = jQuery.createUploadForm(id, s.fileElementId, (typeof(s.data)=='undefined'?false:s.data));
64
+ var io = jQuery.createUploadIframe(id, s.secureuri);
65
+ var frameId = 'jUploadFrame' + id;
66
+ var formId = 'jUploadForm' + id;
67
+ // Watch for a new set of requests
68
+ if ( s.global && ! jQuery.active++ )
69
+ {
70
+ jQuery.event.trigger( "ajaxStart" );
71
+ }
72
+ var requestDone = false;
73
+ // Create the request object
74
+ var xml = {}
75
+ if ( s.global )
76
+ jQuery.event.trigger("ajaxSend", [xml, s]);
77
+ // Wait for a response to come back
78
+ var uploadCallback = function(isTimeout)
79
+ {
80
+ var io = document.getElementById(frameId);
81
+ try
82
+ {
83
+ if(io.contentWindow)
84
+ {
85
+ xml.responseText = io.contentWindow.document.body?io.contentWindow.document.body.innerHTML:null;
86
+ xml.responseXML = io.contentWindow.document.XMLDocument?io.contentWindow.document.XMLDocument:io.contentWindow.document;
87
+
88
+ }else if(io.contentDocument)
89
+ {
90
+ xml.responseText = io.contentDocument.document.body?io.contentDocument.document.body.innerHTML:null;
91
+ xml.responseXML = io.contentDocument.document.XMLDocument?io.contentDocument.document.XMLDocument:io.contentDocument.document;
92
+ }
93
+ }catch(e)
94
+ {
95
+ jQuery.handleError(s, xml, null, e);
96
+ }
97
+ if ( xml || isTimeout == "timeout")
98
+ {
99
+ requestDone = true;
100
+ var status;
101
+ try {
102
+ status = isTimeout != "timeout" ? "success" : "error";
103
+ // Make sure that the request was successful or notmodified
104
+ if ( status != "error" )
105
+ {
106
+ // process the data (runs the xml through httpData regardless of callback)
107
+ var data = jQuery.uploadHttpData( xml, s.dataType );
108
+ // If a local callback was specified, fire it and pass it the data
109
+ if ( s.success )
110
+ s.success( data, status );
111
+
112
+ // Fire the global callback
113
+ if( s.global )
114
+ jQuery.event.trigger( "ajaxSuccess", [xml, s] );
115
+ } else
116
+ jQuery.handleError(s, xml, status);
117
+ } catch(e)
118
+ {
119
+ status = "error";
120
+ jQuery.handleError(s, xml, status, e);
121
+ }
122
+
123
+ // The request was completed
124
+ if( s.global )
125
+ jQuery.event.trigger( "ajaxComplete", [xml, s] );
126
+
127
+ // Handle the global AJAX counter
128
+ if ( s.global && ! --jQuery.active )
129
+ jQuery.event.trigger( "ajaxStop" );
130
+
131
+ // Process result
132
+ if ( s.complete )
133
+ s.complete(xml, status);
134
+
135
+ jQuery(io).unbind()
136
+
137
+ setTimeout(function()
138
+ { try
139
+ {
140
+ jQuery(io).remove();
141
+ jQuery(form).remove();
142
+
143
+ } catch(e)
144
+ {
145
+ jQuery.handleError(s, xml, null, e);
146
+ }
147
+
148
+ }, 100)
149
+
150
+ xml = null
151
+
152
+ }
153
+ }
154
+ // Timeout checker
155
+ if ( s.timeout > 0 )
156
+ {
157
+ setTimeout(function(){
158
+ // Check to see if the request is still happening
159
+ if( !requestDone ) uploadCallback( "timeout" );
160
+ }, s.timeout);
161
+ }
162
+ try
163
+ {
164
+
165
+ var form = jQuery('#' + formId);
166
+ jQuery(form).attr('action', s.url);
167
+ jQuery(form).attr('method', 'POST');
168
+ jQuery(form).attr('target', frameId);
169
+ if(form.encoding)
170
+ {
171
+ jQuery(form).attr('encoding', 'multipart/form-data');
172
+ }
173
+ else
174
+ {
175
+ jQuery(form).attr('enctype', 'multipart/form-data');
176
+ }
177
+ jQuery(form).submit();
178
+
179
+ } catch(e)
180
+ {
181
+ jQuery.handleError(s, xml, null, e);
182
+ }
183
+
184
+ jQuery('#' + frameId).load(uploadCallback );
185
+ return {abort: function () {}};
186
+
187
+ },
188
+
189
+ uploadHttpData: function( r, type ) {
190
+ var data = !type;
191
+ data = type == "xml" || data ? r.responseXML : r.responseText;
192
+ // If the type is "script", eval it in global context
193
+ if ( type == "script" )
194
+ jQuery.globalEval( data );
195
+ // Get the JavaScript object, if JSON is used.
196
+ if ( type == "json" )
197
+ eval( "data = " + data );
198
+ // evaluate scripts within html
199
+ if ( type == "html" )
200
+ jQuery("<div>").html(data).evalScripts();
201
+
202
+ return data;
203
+ }
204
+ })
 
languages/template_en_US.po ADDED
@@ -0,0 +1,395 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: WP Backitup Pro\n"
4
+ "POT-Creation-Date: 2013-02-17 11:26-0000\n"
5
+ "PO-Revision-Date: 2013-02-17 11:26-0000\n"
6
+ "Last-Translator: John Peden <john.peden@britishcouncil.org>\n"
7
+ "Language-Team: WP Backitup <support@wpbackitup.com>\n"
8
+ "Language: English\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 1.5.4\n"
13
+ "X-Poedit-KeywordsList: __;_e\n"
14
+ "X-Poedit-Basepath: ..\n"
15
+ "X-Poedit-SourceCharset: UTF-8\n"
16
+ "X-Poedit-SearchPath-0: .\n"
17
+
18
+ #: index.php:328
19
+ msgid "Settings"
20
+ msgstr "Bleh ble-bleh"
21
+
22
+ #: lib/functions.php:46
23
+ msgid "Download most recent export file"
24
+ msgstr ""
25
+
26
+ #: lib/functions.php:50
27
+ msgid "No export file available for download. Please create one."
28
+ msgstr ""
29
+
30
+ #: lib/includes/backup.php:25 lib/includes/restore.php:24
31
+ msgid "Can't open file"
32
+ msgstr ""
33
+
34
+ #: lib/includes/backup.php:29
35
+ msgid "Creating backup directory..."
36
+ msgstr ""
37
+
38
+ #: lib/includes/backup.php:31
39
+ msgid ""
40
+ "Cannot create backup directory. Please check the CHMOD settings of your wp-"
41
+ "backitup plugin directory"
42
+ msgstr ""
43
+
44
+ #: lib/includes/backup.php:37 lib/includes/restore.php:142
45
+ msgid "Done"
46
+ msgstr ""
47
+
48
+ #: lib/includes/backup.php:45
49
+ msgid "Backing up your files..."
50
+ msgstr ""
51
+
52
+ #: lib/includes/backup.php:50
53
+ msgid "Unable to backup your files. Please try again."
54
+ msgstr ""
55
+
56
+ #: lib/includes/backup.php:55
57
+ msgid "Backing up your database..."
58
+ msgstr ""
59
+
60
+ #: lib/includes/backup.php:57 lib/includes/backup.php:77
61
+ #: lib/includes/restore.php:156 lib/includes/restore.php:174
62
+ #: lib/includes/restore.php:200 lib/includes/restore.php:336
63
+ msgid "Done!"
64
+ msgstr ""
65
+
66
+ #: lib/includes/backup.php:59
67
+ msgid "Unable to backup your database. Please try again."
68
+ msgstr ""
69
+
70
+ #: lib/includes/backup.php:67
71
+ msgid "Unable to create site information file. Please try again."
72
+ msgstr ""
73
+
74
+ #: lib/includes/backup.php:73
75
+ msgid "Creating backup zip..."
76
+ msgstr ""
77
+
78
+ #: lib/includes/backup.php:81
79
+ msgid "Warning: Unable to cleanup your backup directory."
80
+ msgstr ""
81
+
82
+ #: lib/includes/backup.php:85
83
+ msgid ""
84
+ "Backup file created successfully. You can download your backup file using "
85
+ "the link above."
86
+ msgstr ""
87
+
88
+ #: lib/includes/restore.php:133
89
+ msgid "No file selected"
90
+ msgstr ""
91
+
92
+ #: lib/includes/restore.php:138
93
+ msgid "Uploading restoration file..."
94
+ msgstr ""
95
+
96
+ #: lib/includes/restore.php:144
97
+ msgid "Your file could not be uploaded"
98
+ msgstr ""
99
+
100
+ #: lib/includes/restore.php:158
101
+ msgid "Your restoration file could not be unzipped."
102
+ msgstr ""
103
+
104
+ #: lib/includes/restore.php:165
105
+ msgid "Validating zip..."
106
+ msgstr ""
107
+
108
+ #: lib/includes/restore.php:176
109
+ msgid ""
110
+ "Your zip file appears to be invalid. Please ensure you chose the correct zip "
111
+ "file."
112
+ msgstr ""
113
+
114
+ #: lib/includes/restore.php:184
115
+ msgid "Restoring wp-content directory..."
116
+ msgstr ""
117
+
118
+ #: lib/includes/restore.php:186
119
+ msgid ""
120
+ "Unable to remove existing wp-content directory for import. Please check your "
121
+ "CHMOD settings in /wp-content/."
122
+ msgstr ""
123
+
124
+ #: lib/includes/restore.php:193
125
+ msgid ""
126
+ "Unable to create new wp-content directory for import. Please check your "
127
+ "CHMOD settings in /wp-content/."
128
+ msgstr ""
129
+
130
+ #: lib/includes/restore.php:202
131
+ msgid "Unable to import wp-content. Please try again."
132
+ msgstr ""
133
+
134
+ #: lib/includes/restore.php:212
135
+ msgid "Restoring database..."
136
+ msgstr ""
137
+
138
+ #: lib/includes/restore.php:222
139
+ msgid "Unable to connect to your current database"
140
+ msgstr ""
141
+
142
+ #: lib/includes/restore.php:236
143
+ msgid "Unable to get current site URL from database. Please try again."
144
+ msgstr ""
145
+
146
+ #: lib/includes/restore.php:250
147
+ msgid "Unable to get current home URL from database. Please try again."
148
+ msgstr ""
149
+
150
+ #: lib/includes/restore.php:264
151
+ msgid "Unable to get current user ID from database. Please try again."
152
+ msgstr ""
153
+
154
+ #: lib/includes/restore.php:278
155
+ msgid "Unable to get current user password from database. Please try again."
156
+ msgstr ""
157
+
158
+ #: lib/includes/restore.php:292
159
+ msgid "Unable to get current user email from database. Please try again."
160
+ msgstr ""
161
+
162
+ #: lib/includes/restore.php:305
163
+ msgid ""
164
+ "Unable to get import your database. This may require importing the file "
165
+ "manually."
166
+ msgstr ""
167
+
168
+ #: lib/includes/restore.php:323
169
+ msgid ""
170
+ "Unable to update your current home URL value. This may require importing the "
171
+ "file manually."
172
+ msgstr ""
173
+
174
+ #: lib/includes/restore.php:330
175
+ msgid ""
176
+ "Unable to update your user information. This may require importing the file "
177
+ "manually."
178
+ msgstr ""
179
+
180
+ #: lib/includes/restore.php:338
181
+ msgid "Warning: Database not detected in import file."
182
+ msgstr ""
183
+
184
+ #: lib/includes/restore.php:351
185
+ msgid "Restoration complete. Please refresh the page."
186
+ msgstr ""
187
+
188
+ #: views/options.php:6 views/options.php:8
189
+ msgid "Backup"
190
+ msgstr ""
191
+
192
+ #: views/options.php:7
193
+ msgid "Create a backup file of this site's content and settings."
194
+ msgstr ""
195
+
196
+ #: views/options.php:9
197
+ msgid "Download"
198
+ msgstr ""
199
+
200
+ #: views/options.php:11 views/options.php:23
201
+ msgid "Restore"
202
+ msgstr ""
203
+
204
+ #: views/options.php:14
205
+ msgid ""
206
+ "Restore a WP Backitup zip file and overwrite this site's content, themes, "
207
+ "plugins, uploads and settings."
208
+ msgstr ""
209
+
210
+ #: views/options.php:25
211
+ msgid "Status"
212
+ msgstr ""
213
+
214
+ #: views/options.php:26
215
+ msgid "Nothing to report"
216
+ msgstr ""
217
+
218
+ #: views/options.php:35 views/options.php:56
219
+ msgid "License Key"
220
+ msgstr ""
221
+
222
+ #: views/options.php:39
223
+ msgid "Automatic updates enabled"
224
+ msgstr ""
225
+
226
+ #: views/options.php:41
227
+ msgid "Activate automatic updates by entering your license key"
228
+ msgstr ""
229
+
230
+ #: views/options.php:46
231
+ msgid "Active"
232
+ msgstr ""
233
+
234
+ #: views/options.php:47
235
+ msgid "Update"
236
+ msgstr ""
237
+
238
+ #: views/options.php:49
239
+ msgid "Inactive"
240
+ msgstr ""
241
+
242
+ #: views/options.php:50
243
+ msgid "Activate"
244
+ msgstr ""
245
+
246
+ #: views/options.php:55
247
+ msgid "Need Support?"
248
+ msgstr ""
249
+
250
+ #: views/options.php:60
251
+ msgid "Spread the Word"
252
+ msgstr ""
253
+
254
+ #: views/options.php:65
255
+ msgid "Enable"
256
+ msgstr ""
257
+
258
+ #: views/options.php:66
259
+ msgid "Disable"
260
+ msgstr ""
261
+
262
+ #: views/options.php:67
263
+ msgid ""
264
+ "Help to improve Easy Webtrends by enabling <a href=\"http://www.presstrends."
265
+ "io\" target=\"_blank\">Presstrends</a>"
266
+ msgstr ""
267
+
268
+ #: views/options.php:68
269
+ msgid "Save"
270
+ msgstr ""
271
+
272
+ #: lib/includes/restore.php:37
273
+ msgid "In Progress"
274
+ msgstr ""
275
+
276
+ #: lib/includes/restore.php:149
277
+ msgid "Done"
278
+ msgstr ""
279
+
280
+ #: lib/includes/restore.php: 155
281
+ msgid "Error: Unable to create new directory for import. Please check your CHMOD settings in "
282
+ msgstr ""
283
+
284
+ #: lib/includes/restore.php: 155
285
+ msgid "Error: Unable to create new directory for import. Please check your CHMOD settings in "
286
+ msgstr ""
287
+
288
+ #: lib/includes/restore.php: 193
289
+ msgid "Error: Your restoration file could not be unzipped."
290
+ msgstr ""
291
+
292
+ #: lib/includes/restore.php: 211
293
+ msgid "Error: Your zip file appears to be invalid. Please ensure you chose the correct zip file."
294
+ msgstr ""
295
+
296
+ #: lib/includes/restore.php: 235
297
+ msgid "Error: Unable to connect to your current database: "
298
+ msgstr ""
299
+
300
+
301
+ #: lib/includes/restore.php: 249
302
+ msgid "Error: Unable to get current site URL from database. Please try again."
303
+ msgstr ""
304
+
305
+ #: lib/includes/restore.php: 263
306
+ msgid "Error: Unable to get current home URL from database. Please try again."
307
+ msgstr ""
308
+
309
+ #: lib/includes/restore.php: 277
310
+ msgid "Error: Unable to get current user ID from database. Please try again."
311
+ msgstr ""
312
+
313
+ #: lib/includes/restore.php: 291
314
+ msgid "Error: Unable to get current user password from database. Please try again."
315
+ msgstr ""
316
+
317
+ #: lib/includes/restore.php: 305
318
+ msgid "Error: Unable to get current user email from database. Please try again."
319
+ msgstr ""
320
+
321
+ #: lib/includes/restore.php: 319
322
+ msgid "Error: Unable to get import your database. This may require importing the file manually."
323
+ msgstr ""
324
+
325
+ #: lib/includes/restore.php: 330
326
+ msgid "Error: Unable to update your current site URL value. This may require importing the file manually."
327
+ msgstr ""
328
+
329
+ #: lib/includes/restore.php: 337
330
+ msgid "Error: Unable to update your current home URL value. This may require importing the file manually."
331
+ msgstr ""
332
+
333
+ #: lib/includes/restore.php: 344
334
+ msgid "Error: Unable to update your user information. This may require importing the file manually."
335
+ msgstr ""
336
+
337
+ #: lib/includes/restore.php: 352
338
+ msgid "Error: Warning: Database not detected in import file."
339
+ msgstr ""
340
+
341
+ #: lib/includes/restore.php: 360
342
+ msgid "Error: Unable to remove existing wp-content directory for import. Please check your CHMOD settings in /wp-content/."
343
+ msgstr ""
344
+
345
+ #: lib/includes/restore.php: 367
346
+ msgid "Error: Unable to create new wp-content directory for import. Please check your CHMOD settings in /wp-content/."
347
+ msgstr ""
348
+
349
+ #: lib/includes/restore.php: 376
350
+ msgid "Error: Unable to import wp-content. Please try again."
351
+ msgstr ""
352
+
353
+
354
+ #: lib/includes/restore.php: 392
355
+ msgid "Restoration Complete"
356
+ msgstr ""
357
+
358
+
359
+ #: lib/includes/backup.php: 35
360
+ msgid "Error: Unable to create new directory for backup. Please check your CHMOD settings in "
361
+ msgstr ""
362
+
363
+
364
+ #: lib/includes/backup.php: 46
365
+ msgid "Error: Cannot create backup directory. Please check the CHMOD settings of your wp-backitup plugin directory."
366
+ msgstr ""
367
+
368
+
369
+
370
+ #: lib/includes/backup.php: 67
371
+ msgid "Error: Unable to backup your files. Please try again."
372
+ msgstr ""
373
+
374
+
375
+
376
+ #: lib/includes/backup.php: 77
377
+ msgid "Error: Unable to backup your database. Please try again."
378
+ msgstr ""
379
+
380
+
381
+
382
+ #: lib/includes/backup.php: 87
383
+ msgid "Error: Unable to create site information file. Please try again."
384
+ msgstr ""
385
+
386
+
387
+
388
+ #: lib/includes/backup.php: 107
389
+ msgid "Warning: Unable to cleanup your backup directory."
390
+ msgstr ""
391
+
392
+
393
+ #: lib/includes/backup.php: 116
394
+ msgid "Backup file created successfully. You can download your backup file using the link above."
395
+ msgstr ""
lib/constants.php CHANGED
@@ -2,16 +2,14 @@
2
  /**
3
  * Constants used by this plugin
4
  *
5
- * @package WP Backitup lite
6
  *
7
  * @author jcpeden
8
- * @version 1.2.2
9
  * @since 1.0.1
10
  */
11
 
12
- if( !defined( 'WPBACKITUP_ITEM_NAME' ) ) define( 'WPBACKITUP_ITEM_NAME', 'WP Backitup Lite' );
13
-
14
- if( !defined( 'WPBACKITUP_VERSION' ) ) define( 'WPBACKITUP_VERSION', '1.2.2' );
15
 
16
  if( !defined( 'WPBACKITUP_DIRNAME' ) ) define( 'WPBACKITUP_DIRNAME', dirname( dirname( __FILE__ ) ) );
17
 
@@ -21,4 +19,6 @@ if( !defined( 'WPBACKITUP_URLPATH' ) ) define( 'WPBACKITUP_URLPATH', WP_PLUGIN_U
21
 
22
  if( !defined( 'IS_AJAX_REQUEST' ) ) define( 'IS_AJAX_REQUEST', ( !empty( $_SERVER['HTTP_X_REQUESTED_WITH'] ) && strtolower( $_SERVER['HTTP_X_REQUESTED_WITH'] ) == 'xmlhttprequest' ) );
23
 
24
- if( !defined( 'WPBACKITUP_SITE_URL' ) ) define( 'WPBACKITUP_SITE_URL', 'http://www.wpbackitup.com' );
 
 
2
  /**
3
  * Constants used by this plugin
4
  *
5
+ * @package WP Backitup Pro
6
  *
7
  * @author jcpeden
8
+ * @version 1.3.0
9
  * @since 1.0.1
10
  */
11
 
12
+ if( !defined( 'WPBACKITUP_VERSION' ) ) define( 'WPBACKITUP_VERSION', '1.3.0' );
 
 
13
 
14
  if( !defined( 'WPBACKITUP_DIRNAME' ) ) define( 'WPBACKITUP_DIRNAME', dirname( dirname( __FILE__ ) ) );
15
 
19
 
20
  if( !defined( 'IS_AJAX_REQUEST' ) ) define( 'IS_AJAX_REQUEST', ( !empty( $_SERVER['HTTP_X_REQUESTED_WITH'] ) && strtolower( $_SERVER['HTTP_X_REQUESTED_WITH'] ) == 'xmlhttprequest' ) );
21
 
22
+ if( !defined( 'WPBACKITUP_SITE_URL' ) ) define( 'WPBACKITUP_SITE_URL', 'http://www.wpbackitup.com' );
23
+
24
+ if( !defined( 'WPBACKITUP_ITEM_NAME' ) ) define( 'WPBACKITUP_ITEM_NAME', 'WP Backitup' );
lib/functions.php CHANGED
@@ -2,17 +2,17 @@
2
  /**
3
  * WP Backitup Functions
4
  *
5
- * @package WP Backitup Pro
6
  *
7
  * @author jcpeden
8
- * @version 1.2.2
9
  * @since 1.0.1
10
  */
11
 
12
  // localize the plugin
13
  function lang_setup() {
14
- global $WPBackitupLite;
15
- load_plugin_textdomain($WPBackitupLite->namespace, false, dirname(plugin_basename(__FILE__)) . '/lang/');
16
  }
17
  add_action('after_setup_theme', 'lang_setup');
18
 
@@ -21,12 +21,35 @@ if( !class_exists( 'recurseZip' ) ) {
21
  include_once 'includes/recurse_zip.php';
22
  }
23
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  //load backup function
25
  function backup() {
26
  include_once 'includes/backup.php';
27
  }
28
  add_action('wp_ajax_backup', 'backup');
29
 
 
 
 
 
 
 
30
  //load download function
31
  function download() {
32
  if(glob(WPBACKITUP_DIRNAME . "/backups/*.zip")) {
@@ -179,8 +202,8 @@ function zip($source, $destination, $ignore) {
179
 
180
  //load presstrends
181
  function load_presstrends() {
182
- global $WPBackitupLite;
183
- if($WPBackitupLite->get_option( 'presstrends' ) == 'enabled') {
184
  // PressTrends Account API Key
185
  $api_key = 'rwiyhqfp7eioeh62h6t3ulvcghn2q8cr7j5x';
186
  $auth = 'lpa0nvlhyzbyikkwizk4navhtoaqujrbw';
2
  /**
3
  * WP Backitup Functions
4
  *
5
+ * @package WP Backitup
6
  *
7
  * @author jcpeden
8
+ * @version 1.3.0
9
  * @since 1.0.1
10
  */
11
 
12
  // localize the plugin
13
  function lang_setup() {
14
+ global $WPBackitup;
15
+ load_plugin_textdomain($WPBackitup->namespace, false, dirname(plugin_basename(__FILE__)) . '/lang/');
16
  }
17
  add_action('after_setup_theme', 'lang_setup');
18
 
21
  include_once 'includes/recurse_zip.php';
22
  }
23
 
24
+ // include auto-update class
25
+ if( !class_exists( 'EDD_SL_Plugin_Updater' ) ) {
26
+ include_once 'includes/auto_update.php';
27
+ }
28
+
29
+ // retrieve our license key from the DB
30
+ $license_key = trim( $this->get_option( 'license_key' ) );
31
+
32
+ // setup the updater
33
+ $edd_updater = new EDD_SL_Plugin_Updater( WPBACKITUP_SITE_URL, dirname ( dirname ( __FILE__) ) .'/index.php', array(
34
+ 'version' => WPBACKITUP_VERSION, // current version number
35
+ 'license' => $license_key, // license key (used get_option above to retrieve from DB)
36
+ 'item_name' => WPBACKITUP_ITEM_NAME, // name of this plugin
37
+ 'author' => 'John Peden' // author of this plugin
38
+ )
39
+ );
40
+
41
  //load backup function
42
  function backup() {
43
  include_once 'includes/backup.php';
44
  }
45
  add_action('wp_ajax_backup', 'backup');
46
 
47
+ //load restore_path function
48
+ function restore_path() {
49
+ include_once 'includes/restore_from_path.php';
50
+ }
51
+ add_action('wp_ajax_restore_path', 'restore_path');
52
+
53
  //load download function
54
  function download() {
55
  if(glob(WPBACKITUP_DIRNAME . "/backups/*.zip")) {
202
 
203
  //load presstrends
204
  function load_presstrends() {
205
+ global $WPBackitup;
206
+ if($WPBackitup->get_option( 'presstrends' ) == 'enabled') {
207
  // PressTrends Account API Key
208
  $api_key = 'rwiyhqfp7eioeh62h6t3ulvcghn2q8cr7j5x';
209
  $auth = 'lpa0nvlhyzbyikkwizk4navhtoaqujrbw';
lib/includes/auto_update.php ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * WP Backitup Auto Update
5
+ *
6
+ * @package WP Backitup
7
+ *
8
+ * @author jcpeden
9
+ * @version 1.3.0
10
+ * @since 1.0.1
11
+ */
12
+
13
+ class EDD_SL_Plugin_Updater {
14
+ private $api_url = '';
15
+ private $api_data = array();
16
+ private $name = '';
17
+ private $slug = '';
18
+
19
+ /**
20
+ * Class constructor.
21
+ *
22
+ * @uses plugin_basename()
23
+ * @uses hook()
24
+ *
25
+ * @param string $_api_url The URL pointing to the custom API endpoint.
26
+ * @param string $_plugin_file Path to the plugin file.
27
+ * @param array $_api_data Optional data to send with API calls.
28
+ * @return void
29
+ */
30
+ function __construct( $_api_url, $_plugin_file, $_api_data = null ) {
31
+ $this->api_url = trailingslashit( $_api_url );
32
+ $this->api_data = urlencode_deep( $_api_data );
33
+ $this->name = plugin_basename( $_plugin_file );
34
+ $this->slug = basename( $_plugin_file, '.php');
35
+ $this->version = $_api_data['version'];
36
+
37
+ // Set up hooks.
38
+ $this->hook();
39
+ }
40
+
41
+ /**
42
+ * Set up Wordpress filters to hook into WP's update process.
43
+ *
44
+ * @uses add_filter()
45
+ *
46
+ * @return void
47
+ */
48
+ private function hook() {
49
+ add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'pre_set_site_transient_update_plugins_filter' ) );
50
+ add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
51
+ }
52
+
53
+ /**
54
+ * Check for Updates at the defined API endpoint and modify the update array.
55
+ *
56
+ * This function dives into the update api just when Wordpress creates its update array,
57
+ * then adds a custom API call and injects the custom plugin data retrieved from the API.
58
+ * It is reassembled from parts of the native Wordpress plugin update code.
59
+ * See wp-includes/update.php line 121 for the original wp_update_plugins() function.
60
+ *
61
+ * @uses api_request()
62
+ *
63
+ * @param array $_transient_data Update array build by Wordpress.
64
+ * @return array Modified update array with custom plugin data.
65
+ */
66
+ function pre_set_site_transient_update_plugins_filter( $_transient_data ) {
67
+
68
+
69
+ if( empty( $_transient_data ) ) return $_transient_data;
70
+
71
+ $to_send = array( 'slug' => $this->slug );
72
+
73
+ $api_response = $this->api_request( 'plugin_latest_version', $to_send );
74
+
75
+ if( false !== $api_response && is_object( $api_response ) ) {
76
+ if( version_compare( $this->version, $api_response->new_version, '<' ) )
77
+ $_transient_data->response[$this->name] = $api_response;
78
+ }
79
+ return $_transient_data;
80
+ }
81
+
82
+
83
+ /**
84
+ * Updates information on the "View version x.x details" page with custom data.
85
+ *
86
+ * @uses api_request()
87
+ *
88
+ * @param mixed $_data
89
+ * @param string $_action
90
+ * @param object $_args
91
+ * @return object $_data
92
+ */
93
+ function plugins_api_filter( $_data, $_action = '', $_args = null ) {
94
+ if ( ( $_action != 'plugin_information' ) || !isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) return $_data;
95
+
96
+ $to_send = array( 'slug' => $this->slug );
97
+
98
+ $api_response = $this->api_request( 'plugin_information', $to_send );
99
+ if ( false !== $api_response ) $_data = $api_response;
100
+
101
+ return $_data;
102
+ }
103
+
104
+ /**
105
+ * Calls the API and, if successfull, returns the object delivered by the API.
106
+ *
107
+ * @uses get_bloginfo()
108
+ * @uses wp_remote_post()
109
+ * @uses is_wp_error()
110
+ *
111
+ * @param string $_action The requested action.
112
+ * @param array $_data Parameters for the API action.
113
+ * @return false||object
114
+ */
115
+ private function api_request( $_action, $_data ) {
116
+
117
+ global $wp_version;
118
+
119
+ $data = array_merge( $this->api_data, $_data );
120
+ if( $data['slug'] != $this->slug )
121
+ return;
122
+
123
+ $api_params = array(
124
+ 'edd_action' => 'get_version',
125
+ 'license' => $data['license'],
126
+ 'name' => $data['item_name'],
127
+ 'slug' => $this->slug,
128
+ 'author' => $data['author']
129
+ );
130
+ $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
131
+
132
+ if ( !is_wp_error( $request ) ):
133
+ $request = json_decode( wp_remote_retrieve_body( $request ) );
134
+ if( $request )
135
+ $request->sections = maybe_unserialize( $request->sections );
136
+ return $request;
137
+ else:
138
+ return false;
139
+ endif;
140
+ }
141
+ }
lib/includes/backup.php CHANGED
@@ -3,14 +3,14 @@
3
  /**
4
  * WP Backitup Backup Functions
5
  *
6
- * @package WP Backitup Lite
7
  *
8
  * @author jcpeden
9
- * @version 1.2.2
10
  * @since 1.0.1
11
  */
12
 
13
- global $WPBackitupLite;
14
 
15
  //limit process to 15 minutes
16
  @set_time_limit(900);
@@ -31,20 +31,16 @@ recursive_delete( WPBACKITUP_DIR_PATH .'/backups/' );
31
 
32
  //Re-create and empty backup dir
33
  if(!create_dir( WPBACKITUP_DIR_PATH .'/backups/' )) {
34
- fwrite($fh, '<status code="prerequsites">'.__('Failed', $WPBackitupLite->namespace ).'</status>');
35
- fwrite($fh, '<error code="errorMessage">' . __('Error: Unable to create new directory for backup. Please check your CHMOD settings in ' , $WPBackitupLite->namespace ).WPBACKITUP_DIR_PATH . '.</error>');
36
-
37
- fclose($fh);
38
-
39
  die();
40
  }
41
 
42
  //Check to see if the directory is writeable
43
-
44
  if(!is_writeable(WPBACKITUP_DIRNAME ."/backups/")) {
45
- fwrite($fh, '<status code="prerequsites">' . __('Failed', $WPBackitupLite->namespace ) . '</status>');
46
- fwrite($fh, '<error code="errorMessage">' . __('Error: Cannot create backup directory. Please check the CHMOD settings of your wp-backitup plugin directory.', $WPBackitupLite->namespace ) . '</error>');
47
-
48
  die();
49
  } else {
50
  //If the directory is writeable, create the backup folder if it doesn't exist
@@ -54,25 +50,23 @@ if(!is_writeable(WPBACKITUP_DIRNAME ."/backups/")) {
54
  foreach(glob(WPBACKITUP_DIRNAME ."/backups/*.zip") as $zip) {
55
  unlink($zip);
56
  }
57
- fwrite($fh, '<status code="prerequisites">' . __('Done', $WPBackitupLite->namespace ) . '</status>');
58
  }
59
 
60
  //Backup with copy
61
  if(recursive_copy($wp_content_path, $backup_project_path, $ignore = array( 'cgi-bin','.','..','._',$backup_project_dirname,'backupbuddy_backups','*.zip','cache' ) ) ) {
62
- fwrite($fh, '<status code="backupfiles">' . __('Done',$WPBackitupLite->namespace ) . '</status>');
63
  } else {
64
- fwrite($fh, '<status code="backupfiles">' . __('Failed', $WPBackitupLite->namespace ) . '</status>');
65
- fwrite($fh, '<error code="errorMessage">' . __('Error: Unable to backup your files. Please try again.', $WPBackitupLite->namespace ) . "</error>");
66
  die();
67
  }
68
 
69
  //Dump DB to project dir
70
-
71
-
72
  if( db_backup($backup_project_path) ) {
73
- fwrite($fh, '<status code="backupdb">' . __('Done', $WPBackitupLite->namespace ) . '</status>');
74
  } else {
75
- fwrite($fh, '<error code="errorMessage">' . __('Error: Unable to backup your database. Please try again.', $WPBackitupLite->namespace ) . '</error>');
76
  recursive_delete($backup_project_path);
77
  die();
78
  }
@@ -81,38 +75,31 @@ if( db_backup($backup_project_path) ) {
81
  global $wpdb;
82
 
83
  if (!create_siteinfo($backup_project_path, $wpdb->prefix) ) {
84
- fwrite($fh, '<status code="infofile">' . __('Failed' , $WPBackitupLite->namespace ) . '</status>');
85
- fwrite($fh, '<error code="errorMessage">' . __('Error: Unable to create site information file. Please try again.', $WPBackitupLite->namespace ) . '</error>');
86
  recursive_delete($backup_project_path);
87
-
88
  die();
89
- }
90
- else
91
- {
92
- fwrite($fh, '<status code="infofile">' . __('Done', $WPBackitupLite->namespace ) . '</status>');
93
  }
94
 
95
  //Zip the project dir
96
-
97
  $z = new recurseZip();
98
  $src = rtrim($backup_project_path, '/');
99
  $z->compress($src, WPBACKITUP_DIRNAME ."/backups/");
100
- fwrite($fh, '<status code="zipfile">' . __('Done', $WPBackitupLite->namespace ) . '</status>');
101
 
102
  //Delete backup dir
103
  if(!recursive_delete($backup_project_path)) {
104
- fwrite($fh, '<status code="cleanup">' . __('Failed', $WPBackitupLite->namespace ). '</status>');
105
- fwrite($fh, '<error code="errorMessage">' . __('Warning: Unable to cleanup your backup directory.', $WPBackitupLite->namespace ) . "</error>");
106
-
107
- }
108
- else
109
- {
110
- fwrite($fh, '<status code="cleanup">' . __('Done' , $WPBackitupLite->namespace ) . '</status>');
111
  }
112
 
113
  //close log file
114
- fwrite($fh, '<status code="finalinfo">' . __('Backup file created successfully. You can download your backup file using the link above.', $WPBackitupLite->namespace ) . "</status>");
115
- fwrite($fh, '<status code="end">' . __('End', $WPBackitupLite->namespace ) . '</status>');
116
  fclose($fh);
117
 
118
  //End backup function
3
  /**
4
  * WP Backitup Backup Functions
5
  *
6
+ * @package WP Backitup
7
  *
8
  * @author jcpeden
9
+ * @version 1.3.0
10
  * @since 1.0.1
11
  */
12
 
13
+ global $WPBackitup;
14
 
15
  //limit process to 15 minutes
16
  @set_time_limit(900);
31
 
32
  //Re-create and empty backup dir
33
  if(!create_dir( WPBACKITUP_DIR_PATH .'/backups/' )) {
34
+ fwrite($fh, '<status code="prerequsites">'.__('Failed', $WPBackitup->namespace ).'</status>');
35
+ fwrite($fh, '<error code="errorMessage">' . __('Error: Unable to create new directory for backup. Please check your CHMOD settings in ' , $WPBackitup->namespace ).WPBACKITUP_DIR_PATH . '.</error>');
36
+ fclose($fh);
 
 
37
  die();
38
  }
39
 
40
  //Check to see if the directory is writeable
 
41
  if(!is_writeable(WPBACKITUP_DIRNAME ."/backups/")) {
42
+ fwrite($fh, '<status code="prerequsites">' . __('Failed', $WPBackitup->namespace ) . '</status>');
43
+ fwrite($fh, '<error code="errorMessage">' . __('Error: Cannot create backup directory. Please check the CHMOD settings of your wp-backitup plugin directory.', $WPBackitup->namespace ) . '</error>');
 
44
  die();
45
  } else {
46
  //If the directory is writeable, create the backup folder if it doesn't exist
50
  foreach(glob(WPBACKITUP_DIRNAME ."/backups/*.zip") as $zip) {
51
  unlink($zip);
52
  }
53
+ fwrite($fh, '<status code="prerequisites">' . __('Done', $WPBackitup->namespace ) . '</status>');
54
  }
55
 
56
  //Backup with copy
57
  if(recursive_copy($wp_content_path, $backup_project_path, $ignore = array( 'cgi-bin','.','..','._',$backup_project_dirname,'backupbuddy_backups','*.zip','cache' ) ) ) {
58
+ fwrite($fh, '<status code="backupfiles">' . __('Done',$WPBackitup->namespace ) . '</status>');
59
  } else {
60
+ fwrite($fh, '<status code="backupfiles">' . __('Failed', $WPBackitup->namespace ) . '</status>');
61
+ fwrite($fh, '<error code="errorMessage">' . __('Error: Unable to backup your files. Please try again.', $WPBackitup->namespace ) . "</error>");
62
  die();
63
  }
64
 
65
  //Dump DB to project dir
 
 
66
  if( db_backup($backup_project_path) ) {
67
+ fwrite($fh, '<status code="backupdb">' . __('Done', $WPBackitup->namespace ) . '</status>');
68
  } else {
69
+ fwrite($fh, '<error code="errorMessage">' . __('Error: Unable to backup your database. Please try again.', $WPBackitup->namespace ) . '</error>');
70
  recursive_delete($backup_project_path);
71
  die();
72
  }
75
  global $wpdb;
76
 
77
  if (!create_siteinfo($backup_project_path, $wpdb->prefix) ) {
78
+ fwrite($fh, '<status code="infofile">' . __('Failed' , $WPBackitup->namespace ) . '</status>');
79
+ fwrite($fh, '<error code="errorMessage">' . __('Error: Unable to create site information file. Please try again.', $WPBackitup->namespace ) . '</error>');
80
  recursive_delete($backup_project_path);
 
81
  die();
82
+ } else {
83
+ fwrite($fh, '<status code="infofile">' . __('Done', $WPBackitup->namespace ) . '</status>');
 
 
84
  }
85
 
86
  //Zip the project dir
 
87
  $z = new recurseZip();
88
  $src = rtrim($backup_project_path, '/');
89
  $z->compress($src, WPBACKITUP_DIRNAME ."/backups/");
90
+ fwrite($fh, '<status code="zipfile">' . __('Done', $WPBackitup->namespace ) . '</status>');
91
 
92
  //Delete backup dir
93
  if(!recursive_delete($backup_project_path)) {
94
+ fwrite($fh, '<status code="cleanup">' . __('Failed', $WPBackitup->namespace ). '</status>');
95
+ fwrite($fh, '<error code="errorMessage">' . __('Warning: Unable to cleanup your backup directory.', $WPBackitup->namespace ) . "</error>");
96
+ } else {
97
+ fwrite($fh, '<status code="cleanup">' . __('Done' , $WPBackitup->namespace ) . '</status>');
 
 
 
98
  }
99
 
100
  //close log file
101
+ fwrite($fh, '<status code="finalinfo">' . __('Backup file created successfully. You can download your backup file using the link above.', $WPBackitup->namespace ) . "</status>");
102
+ fwrite($fh, '<status code="end">' . __('End', $WPBackitup->namespace ) . '</status>');
103
  fclose($fh);
104
 
105
  //End backup function
lib/includes/recurse_zip.php CHANGED
@@ -1 +1 @@
1
- <?php
2
  * WP Backitup Recurse Zip Function
3
  *
4
  * @package WP Backitup Lite
5
  *
6
  * @author jcpeden
7
  * @version 1.2.2
8
  * @since 1.0.1
9
  */
 
10
  * WP Backitup Recurse Zip Function
11
  *
12
  * @package WP Backitup
13
  *
14
  * @author jcpeden
15
  * @version 1.3.0
16
  * @since 1.0.1
17
  */
 
1
  * WP Backitup Recurse Zip Function
2
  *
3
  * @package WP Backitup Lite
4
  *
5
  * @author jcpeden
6
  * @version 1.2.2
7
  * @since 1.0.1
8
  */
9
+ <?php
10
  * WP Backitup Recurse Zip Function
11
  *
12
  * @package WP Backitup
13
  *
14
  * @author jcpeden
15
  * @version 1.3.0
16
  * @since 1.0.1
17
  */
lib/includes/restore.php ADDED
@@ -0,0 +1,392 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * WP Backitup Restore Functions
5
+ *
6
+ * @package WP Backitup Pro
7
+ *
8
+ * @author jcpeden
9
+ * @version 1.3.0
10
+ * @since 1.0.1
11
+ */
12
+
13
+ //define constants
14
+ if( !defined( 'WP_DIR_PATH' ) ) define( 'WP_DIR_PATH', dirname ( dirname ( dirname ( dirname ( dirname ( dirname ( __FILE__ ) ) ) ) ) ) );
15
+
16
+ if( !defined( 'WPBACKITUP_DIR_PATH' ) ) define( 'WPBACKITUP_DIR_PATH', dirname( dirname( dirname( __FILE__ ) ) ) );
17
+
18
+ if( !defined( 'WPBACKITUP_DIRNAME' ) ) define( 'WPBACKITUP_DIRNAME', basename(WPBACKITUP_DIR_PATH) );
19
+
20
+ if( !defined( 'WP_CONTENT_PATH' ) ) define( 'WP_CONTENT_PATH', dirname( dirname( WPBACKITUP_DIR_PATH ) ) ) ;
21
+
22
+ if(!function_exists('create_dir')) {
23
+ function create_dir($dir) {
24
+ if( !is_dir($dir) ) {
25
+ @mkdir($dir, 0755);
26
+ }
27
+ return true;
28
+ }
29
+ }
30
+
31
+ if(!function_exists('redo_to_checkpoint')) {
32
+ function redo_to_checkpoint($checkpoint) {
33
+
34
+ if($checkpoint == "db")
35
+ {
36
+ if( glob($restoration_dir_path . "*.cur") ) {
37
+ //collect connection information from form
38
+ fwrite($fh, '<status code="database">In Progress</status>');
39
+ include_once WP_DIR_PATH .'/wp-config.php';
40
+ //Add user to DB in v1.0.5
41
+ $user_id = $_POST['user_id'];
42
+ //Connect to DB
43
+ $output = db_import($restoration_dir_path, $import_siteurl, $current_siteurl, $table_prefix, $import_table_prefix, $dbc);
44
+ }
45
+
46
+ }
47
+
48
+ }
49
+ }
50
+
51
+ if(!function_exists('db_backup')) {
52
+ function db_backup($path) {
53
+ $handle = fopen($path .'db-backup.cur', 'w+');
54
+ $path_sql = $path .'db-backup.cur';
55
+ $db_name = DB_NAME;
56
+ $db_user = DB_USER;
57
+ $db_pass = DB_PASSWORD;
58
+ $db_host = DB_HOST;
59
+ $output = shell_exec("mysqldump --user $db_user --password=$db_pass $db_name > '$path_sql'");
60
+ fwrite($handle,$output);
61
+ fclose($handle);
62
+ return true;
63
+ }
64
+ }
65
+
66
+ //Define recusive_copy function
67
+ if(!function_exists('recursive_copy')) {
68
+ function recursive_copy($dir, $target_path, $ignore = array( 'cgi-bin','..','._' ) ) {
69
+ if( is_dir($dir) ) { //If the directory exists
70
+ if ($dh = opendir($dir) ) {
71
+ while(($file = readdir($dh)) !== false) { //While there are files in the directory
72
+ if ( !in_array($file, $ignore) && substr($file, 0, 1) != '.') { //Check the file is not in the ignore array
73
+ if (!is_dir( $dir.$file ) ) {
74
+ //Copy files to destination directory
75
+ //echo 'Copying ' .$dir .$file . ' to ' .$target_path .$file .'<br />';
76
+ $fsrc = fopen($dir .$file,'r');
77
+ $fdest = fopen($target_path .$file,'w+');
78
+ $len = stream_copy_to_stream($fsrc,$fdest);
79
+ fclose($fsrc);
80
+ fclose($fdest);
81
+ } else { //If $file is a directory
82
+ $destdir = $target_path .$file; //Modify the destination dir
83
+ if(!is_dir($destdir)) { //Create the destdir if it doesn't exist
84
+ @mkdir($destdir, 0755);
85
+ }
86
+ recursive_copy($dir .$file .'/', $target_path .$file .'/', $ignore);
87
+ }
88
+ }
89
+ }
90
+ closedir($dh);
91
+ }
92
+ }
93
+ return true;
94
+ }
95
+ }
96
+
97
+ //Define recursive_delete function
98
+ if(!function_exists('recursive_delete')){
99
+ function recursive_delete($dir, $ignore = array('cgi-bin','.','..','._') ){
100
+ if( is_dir($dir) ){
101
+ if($dh = opendir($dir)) {
102
+ while( ($file = readdir($dh)) !== false ) {
103
+ if (!in_array($file, $ignore) && substr($file, 0, 1) != '.') { //Check the file is not in the ignore array
104
+ if(!is_dir($dir .'/' .$file)) {
105
+ //echo 'Deleting ' .$dir .'/' .$file '<br />';
106
+ unlink($dir .'/' .$file);
107
+ } else {
108
+ recursive_delete($dir .'/' .$file, $ignore);
109
+ }
110
+ }
111
+ }
112
+ }
113
+ @rmdir($dir);
114
+ closedir($dh);
115
+ }
116
+ return true;
117
+ }
118
+ }
119
+
120
+ //define db_import function
121
+ if(!function_exists('db_import')) {
122
+ function db_import($restoration_dir_path, $import_siteurl, $current_siteurl, $table_prefix, $import_table_prefix, $dbc) {
123
+ //13-4-13: John C Peden [mail@johncpeden.com] This was incomplete, I've updated to make it work
124
+ foreach(glob($restoration_dir_path . "*.sql") as $sql_file) {
125
+ $db_name = DB_NAME;
126
+ $db_user = DB_USER;
127
+ $db_pass = DB_PASSWORD;
128
+ $db_host = DB_HOST;
129
+ $command = "mysql --user='$db_user' --password='$db_pass' --host='$db_host' $db_name < '$sql_file'";
130
+ $output = shell_exec(($command));
131
+ }
132
+ return true;
133
+ }
134
+ }
135
+
136
+ //create log file
137
+ $log = WPBACKITUP_DIR_PATH .'/logs/status.log';
138
+ unlink($log);
139
+ $fh = fopen($log, 'w') or die( "Can't write to log file" );
140
+
141
+ // 15 minutes per image should be PLENTY
142
+ @set_time_limit(900);
143
+
144
+ //Delete the existing backup directory
145
+ recursive_delete( WPBACKITUP_DIR_PATH .'/backups/' );
146
+
147
+ //Re-create and empty backup dir
148
+ if(!create_dir( WPBACKITUP_DIR_PATH .'/backups/' )) {
149
+ fwrite($fh, '<status code="errorMessage">Error: Unable to create new directory for import. Please check your CHMOD settings in' .WPBACKITUP_DIR_PATH.'.</status>');
150
+ fclose($fh);
151
+ die();
152
+ }
153
+
154
+ //Move the uploaded zip to the restoration directory
155
+ $restore_file_name = basename( $_FILES['wpbackitup-zip']['name']);
156
+ if( $restore_file_name == '') {
157
+ fwrite($fh, '<status code="errorMessage">Error: No file selected</status>');
158
+ fclose($fh);
159
+ die();
160
+ } else {
161
+ fwrite($fh, '<status code="upload">Done</status>');
162
+ }
163
+
164
+ //define create_dir function
165
+
166
+ fwrite($fh, '<status code="copyfiles">In Progress</status>');
167
+
168
+ $restore_path = WPBACKITUP_DIR_PATH .'/backups/' . $restore_file_name;
169
+ if(move_uploaded_file($_FILES['wpbackitup-zip']['tmp_name'], $restore_path)) {
170
+ // fwrite($fh, "Done!</li>");
171
+ } else {
172
+ // fwrite($fh, '</li><li class="error">Error: Your file could not be uploaded</li></ul>');
173
+ fclose($fh);
174
+ die();
175
+ }
176
+
177
+ //Unzip the uploaded restore file
178
+ fwrite($fh, '<status code="unzipping">In Progress</status>');
179
+
180
+ //include recurse_zip.php
181
+ include_once 'recurse_zip.php';
182
+ //unzip the upload
183
+ $zip = new ZipArchive;
184
+ $res = $zip->open(WPBACKITUP_DIR_PATH .'/backups/' . $restore_file_name);
185
+ if ($res === TRUE) {
186
+ $zip->extractTo(WPBACKITUP_DIR_PATH .'/backups/');
187
+ $zip->close();
188
+ fwrite($fh, '<status code="unzipping">Done</status>');
189
+ } else {
190
+ fwrite($fh, '<status code="errorMessage">Error: Your restoration file could not be unzipped.</status>');
191
+ unlink(WPBACKITUP_DIR_PATH .'/backups/' . $restore_file_name);
192
+ fclose($fh);
193
+ die();
194
+ }
195
+
196
+ //Identify the restoration directory
197
+ fwrite($fh, '<status code="validation">In Progress</status>');
198
+ if ( count( glob( WPBACKITUP_DIR_PATH .'/backups/*', GLOB_ONLYDIR ) ) == 1 ) {
199
+ foreach( glob(WPBACKITUP_DIR_PATH .'/backups/*', GLOB_ONLYDIR ) as $dir) {
200
+ $restoration_dir_path = $dir .'/';
201
+ }
202
+ }
203
+
204
+ //Validate the restoration
205
+ if(glob($restoration_dir_path .'backupsiteinfo.txt') ){
206
+ fwrite($fh, '<status code="validation">Done</status>');
207
+ } else {
208
+ fwrite($fh, '<status code="errorMessage">Error: Your zip file appears to be invalid. Please ensure you chose the correct zip file.</status>');
209
+ recursive_delete($restoration_dir_path);
210
+ unlink(WPBACKITUP_DIR_PATH .'/backups/' . $restore_file_name);
211
+ fclose($fh);
212
+ die();
213
+ }
214
+ // Backup the current database
215
+ //
216
+ db_backup($restoration_dir_path);
217
+
218
+ //if there is a database dump to restore
219
+ if( glob($restoration_dir_path . "*.sql") ) {
220
+ //collect connection information from form
221
+ fwrite($fh, '<status code="database">In Progress</status>');
222
+ include_once WP_DIR_PATH .'/wp-config.php';
223
+ //Add user to DB in v1.0.5
224
+ $user_id = $_POST['user_id'];
225
+ //Connect to DB
226
+ //$output = db_import($restoration_dir_path, $import_siteurl, $current_siteurl, $table_prefix, $import_table_prefix, $dbc);
227
+ //13-4-13: John C Peden [mail@johncpeden.com] This seems to be erroneous, I've commented out.
228
+ $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
229
+ if ( !$dbc ) {
230
+ fwrite($fh, '<status code="errorMessage">Error: Unable to connect to your current database: '. mysqli_connect_error() , '</status>');
231
+ recursive_delete($restoration_dir_path);
232
+ unlink(WPBACKITUP_DIR_PATH .'/backups/' . $restore_file_name);
233
+ fclose($fh);
234
+ die();
235
+ }
236
+ //get siteurl
237
+ $q1 = "SELECT option_value FROM " .$table_prefix ."options WHERE option_name ='siteurl';";
238
+ if ($result = mysqli_query($dbc, $q1)) {
239
+ while ($row = mysqli_fetch_row($result)) {
240
+ $siteurl = $row[0];
241
+ }
242
+ mysqli_free_result($result);
243
+ } else {
244
+ fwrite($fh, '<status code="errorMessage">Error: Unable to get current site URL from database. Please try again.</status>');
245
+ recursive_delete($restoration_dir_path);
246
+ unlink(WPBACKITUP_DIR_PATH .'/backups/' . $restore_file_name);
247
+ fclose($fh);
248
+ die();
249
+ }
250
+ //get homeurl
251
+ $q2 = "SELECT option_value FROM " .$table_prefix ."options WHERE option_name ='home';";
252
+ if ($result = mysqli_query($dbc, $q2)) {
253
+ while ($row = mysqli_fetch_row($result)) {
254
+ $homeurl = $row[0];
255
+ }
256
+ mysqli_free_result($result);
257
+ } else {
258
+ fwrite($fh, '<status code="errorMessage">Error: Unable to get current home URL from database. Please try again.</status>');
259
+ recursive_delete($restoration_dir_path);
260
+ unlink(WPBACKITUP_DIR_PATH .'/backups/' . $restore_file_name);
261
+ fclose($fh);
262
+ die();
263
+ }
264
+ //get user login
265
+ $q3 = "SELECT user_login FROM ". $table_prefix ."users WHERE ID=" .$user_id .";";
266
+ if ($result = mysqli_query($dbc, $q3)) {
267
+ while ($row = mysqli_fetch_row($result)) {
268
+ $user_login = $row[0];
269
+ }
270
+ mysqli_free_result($result);
271
+ } else {
272
+ fwrite($fh, '<status code="errorMessage">Error: Unable to get current user ID from database. Please try again.</status>');
273
+ recursive_delete($restoration_dir_path);
274
+ unlink(WPBACKITUP_DIR_PATH .'/backups/' . $restore_file_name);
275
+ fclose($fh);
276
+ die();
277
+ }
278
+ //get user pass
279
+ $q4 = "SELECT user_pass FROM ". $table_prefix ."users WHERE ID=" .$user_id .";";
280
+ if ($result = mysqli_query($dbc, $q4)) {
281
+ while ($row = mysqli_fetch_row($result)) {
282
+ $user_pass = $row[0];
283
+ }
284
+ mysqli_free_result($result);
285
+ } else {
286
+ fwrite($fh, '<status code="errorMessage">Error: Unable to get current user password from database. Please try again.</status>');
287
+ recursive_delete($restoration_dir_path);
288
+ unlink(WPBACKITUP_DIR_PATH .'/backups/' . $restore_file_name);
289
+ fclose($fh);
290
+ die();
291
+ }
292
+ //get user email
293
+ $q5 = "SELECT user_email FROM ". $table_prefix ."users WHERE ID=" .$user_id ."";
294
+ if ($result = mysqli_query($dbc, $q5)) {
295
+ while ($row = mysqli_fetch_row($result)) {
296
+ $user_email = $row[0];
297
+ }
298
+ mysqli_free_result($result);
299
+ } else {
300
+ fwrite($fh, '<status code="errorMessage">Error: Unable to get current user email from database. Please try again.</status>');
301
+ recursive_delete($restoration_dir_path);
302
+ unlink(WPBACKITUP_DIR_PATH .'/backups/' . $restore_file_name);
303
+ fclose($fh);
304
+ die();
305
+ }
306
+ //Collect previous backup site url start
307
+ $import_siteinfo_lines = file($restoration_dir_path .'backupsiteinfo.txt');
308
+ $import_siteurl = trim($import_siteinfo_lines[0]);
309
+ $current_siteurl = trim($siteurl ,'/');
310
+ $import_table_prefix = $import_siteinfo_lines[1];
311
+ //import the database
312
+
313
+ if(!db_import($restoration_dir_path, $import_siteurl, $current_siteurl, $table_prefix, $import_table_prefix, $dbc)) {
314
+ fwrite($fh, '<status code="errorMessage">Error: Unable to get import your database. This may require importing the file manually.</status>');
315
+ recursive_delete($restoration_dir_path);
316
+ unlink(WPBACKITUP_DIR_PATH .'/backups/' . $restore_file_name);
317
+ fclose($fh);
318
+ die();
319
+ }
320
+ //update the database
321
+ $q6 = "UPDATE ". $table_prefix ."options SET option_value='" .$current_siteurl ."' WHERE option_name='siteurl'";
322
+ $q7 = "UPDATE ". $table_prefix ."options SET option_value='" .$homeurl ."' WHERE option_name='home'";
323
+ $q8 = "UPDATE ". $table_prefix ."users SET user_login='" .$user_login ."', user_pass='" .$user_pass ."', user_email='" .$user_email ."' WHERE ID='" .$user_id ."'";
324
+ if(!mysqli_query($dbc, $q6) ) {
325
+ fwrite($fh, '<status code="errorMessage">Error: Unable to update your current site URL value. This may require importing the file manually.</status>');
326
+ recursive_delete($restoration_dir_path);
327
+ unlink(WPBACKITUP_DIR_PATH .'/backups/' . $restore_file_name);
328
+ fclose($fh);
329
+ die();
330
+ }
331
+ if(!mysqli_query($dbc, $q7) ) {
332
+ fwrite($fh, '<status code="errorMessage">Error: Unable to update your current home URL value. This may require importing the file manually.</status>');
333
+ recursive_delete($restoration_dir_path);
334
+ unlink(WPBACKITUP_DIR_PATH .'/backups/' . $restore_file_name);
335
+ fclose($fh);
336
+ die();
337
+ }
338
+ if(!mysqli_query($dbc, $q8) ) {
339
+ fwrite($fh, '<status code="errorMessage">Error: Unable to update your user information. This may require importing the file manually.</status>');
340
+ recursive_delete($restoration_dir_path);
341
+ unlink(WPBACKITUP_DIR_PATH .'/backups/' . $restore_file_name);
342
+ fclose($fh);
343
+ die();
344
+ }
345
+ fwrite($fh, '<status code="database">Done</status>');
346
+ } else {
347
+ fwrite($fh, '<status code="errorMessage">Error: Warning: Database not detected in import file.</status>');
348
+ }
349
+
350
+ //Disconnect
351
+ mysqli_close($dbc);
352
+ //Restore wp-content directories
353
+ fwrite($fh, '<status code="wpcontent">In Progress</status>');
354
+ if(!recursive_delete(WP_CONTENT_PATH, array( 'cgi-bin','.','..','._', WPBACKITUP_DIRNAME ))) {
355
+ fwrite($fh, '<status code="errorMessage">Error: Unable to remove existing wp-content directory for import. Please check your CHMOD settings in /wp-content/.</status>');
356
+ recursive_delete($restoration_dir_path);
357
+ unlink(WPBACKITUP_DIR_PATH .'/backups/' . $restore_file_name);
358
+ fclose($fh);
359
+ die();
360
+ }
361
+ if(!create_dir(WP_CONTENT_PATH)) {
362
+ fwrite($fh, '<status code="errorMessage">Error: Unable to create new wp-content directory for import. Please check your CHMOD settings in /wp-content/.</status>');
363
+ recursive_delete($restoration_dir_path);
364
+ unlink(WPBACKITUP_DIR_PATH .'/backups/' . $restore_file_name);
365
+ fclose($fh);
366
+ die();
367
+ }
368
+ if(recursive_copy($restoration_dir_path, WP_CONTENT_PATH .'/', array( 'cgi-bin', '.', '..','._', $restore_file_name, 'status.log', 'db-backup.sql', 'backupsiteinfo.txt')) ) {
369
+ fwrite($fh, '<status code="wpcontent">Done</status>');
370
+ } else {
371
+ fwrite($fh, '<status code="errorMessage">Error: Unable to import wp-content. Please try again.</status>');
372
+ recursive_delete($restoration_dir_path);
373
+ unlink(WPBACKITUP_DIR_PATH .'/backups/' . $restore_file_name);
374
+ fclose($fh);
375
+ die();
376
+ }
377
+
378
+
379
+
380
+ //Delete the restoration directory
381
+ recursive_delete($restoration_dir_path);
382
+
383
+ //Delete zip
384
+ unlink(WPBACKITUP_DIR_PATH .'/backups/' . $restore_file_name);
385
+
386
+ //close log file
387
+ fwrite($fh, '<status code="infomessage">Restoration Complete</status>');
388
+ fwrite($fh, '<status code="finalinfo">Finished</status>');
389
+ fclose($fh);
390
+
391
+ //End backup function
392
+ die();
lib/includes/restore_from_path.php ADDED
@@ -0,0 +1,360 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * WP Backitup Restore Functions
5
+ *
6
+ * @package WP Backitup
7
+ *
8
+ * @author jcpeden
9
+ * @version 1.3.0
10
+ * @since 1.0.1
11
+ */
12
+
13
+
14
+ //define constants
15
+ if( !defined( 'WP_DIR_PATH' ) ) define( 'WP_DIR_PATH', dirname ( dirname ( dirname ( dirname ( dirname ( dirname ( __FILE__ ) ) ) ) ) ) );
16
+
17
+ if( !defined( 'WPBACKITUP_DIR_PATH' ) ) define( 'WPBACKITUP_DIR_PATH', dirname( dirname( dirname( __FILE__ ) ) ) );
18
+
19
+ if( !defined( 'WPBACKITUP_DIRNAME' ) ) define( 'WPBACKITUP_DIRNAME', basename(WPBACKITUP_DIR_PATH) );
20
+
21
+ if( !defined( 'WP_CONTENT_PATH' ) ) define( 'WP_CONTENT_PATH', dirname( dirname( WPBACKITUP_DIR_PATH ) ) ) ;
22
+
23
+
24
+ //create log file
25
+ $log = WPBACKITUP_DIR_PATH .'/backups/status.log';
26
+ $fh = fopen($log, 'w') or die( "Can't open file" );
27
+ echo '<ul>';
28
+
29
+ // 15 minutes per image should be PLENTY
30
+ @set_time_limit(900);
31
+
32
+ //define create_dir function
33
+ if(!function_exists('create_dir')) {
34
+ function create_dir($dir) {
35
+ if( !is_dir($dir) ) {
36
+ @mkdir($dir, 0755);
37
+ }
38
+ return true;
39
+ }
40
+ }
41
+
42
+ //Define recusive_copy function
43
+ if(!function_exists('recursive_copy')) {
44
+ function recursive_copy($dir, $target_path, $ignore = array( 'cgi-bin','..','._' ) ) {
45
+ if( is_dir($dir) ) { //If the directory exists
46
+ if ($dh = opendir($dir) ) {
47
+ while(($file = readdir($dh)) !== false) { //While there are files in the directory
48
+ if ( !in_array($file, $ignore) && substr($file, 0, 1) != '.') { //Check the file is not in the ignore array
49
+ if (!is_dir( $dir.$file ) ) {
50
+ //Copy files to destination directory
51
+ //echo 'Copying ' .$dir .$file . ' to ' .$target_path .$file .'<br />';
52
+ $fsrc = fopen($dir .$file,'r');
53
+ $fdest = fopen($target_path .$file,'w+');
54
+ $len = stream_copy_to_stream($fsrc,$fdest);
55
+ fclose($fsrc);
56
+ fclose($fdest);
57
+ } else { //If $file is a directory
58
+ $destdir = $target_path .$file; //Modify the destination dir
59
+ if(!is_dir($destdir)) { //Create the destdir if it doesn't exist
60
+ @mkdir($destdir, 0755);
61
+ }
62
+ recursive_copy($dir .$file .'/', $target_path .$file .'/', $ignore);
63
+ }
64
+ }
65
+ }
66
+ closedir($dh);
67
+ }
68
+ }
69
+ return true;
70
+ }
71
+ }
72
+
73
+ //Define recursive_delete function
74
+ if(!function_exists('recursive_delete')){
75
+ function recursive_delete($dir, $ignore = array('cgi-bin','.','..','._') ){
76
+ if( is_dir($dir) ){
77
+ if($dh = opendir($dir)) {
78
+ while( ($file = readdir($dh)) !== false ) {
79
+ if (!in_array($file, $ignore) && substr($file, 0, 1) != '.') { //Check the file is not in the ignore array
80
+ if(!is_dir($dir .'/' .$file)) {
81
+ //echo 'Deleting ' .$dir .'/' .$file '<br />';
82
+ unlink($dir .'/' .$file);
83
+ } else {
84
+ recursive_delete($dir .'/' .$file, $ignore);
85
+ }
86
+ }
87
+ }
88
+ }
89
+ @rmdir($dir);
90
+ closedir($dh);
91
+ }
92
+ return true;
93
+ }
94
+ }
95
+
96
+ //define db_import function
97
+ if(!function_exists('db_import')) {
98
+ function db_import($restoration_dir_path, $import_siteurl, $current_siteurl, $table_prefix, $import_table_prefix, $dbc) {
99
+ global $wpdb;
100
+ $sql_files = glob($restoration_dir_path . "*.sql");
101
+ foreach($sql_files as $sql_file) {
102
+ $templine = ''; // Temporary variable, used to store current query
103
+ $lines = file($sql_file); // Read in entire file
104
+ foreach ($lines as $line) { // Loop through each line
105
+ if (substr($line, 0, 2) == '--' || $line == '') continue; // Skip it if it's a comment
106
+ $templine .= $line; // Add this line to the current segment
107
+ if (substr(trim($line), -1, 1) == ';') { // If it has a semicolon at the end, it's the end of the query
108
+ //replace imported site url with current site url
109
+ if( strstr( trim($templine), trim($import_siteurl) ) == TRUE ) //If import site url is found
110
+ $templine = str_replace( trim($import_siteurl), trim($current_siteurl), $templine ); // Replace import site url with current site url
111
+ //if the table prefixes are different, replace the imported site prefixes with the current prefixes
112
+ if ($table_prefix != $import_table_prefix) {
113
+ if( strstr( trim($templine), trim($import_table_prefix) ) == TRUE ) //If import table prefix is found
114
+ $templine = str_replace( trim($import_table_prefix), trim($table_prefix), $templine ); // Replace import site table prefix with current site table prefix
115
+ }
116
+ // Perform the query
117
+ if( mysqli_query($dbc, $templine) === FALSE)
118
+ print('Error performing query \'<strong>' . $templine . '\': ' . mysql_error() . '<br /><br />');
119
+ $templine = ''; // Reset temp variable to empty
120
+ }
121
+ }
122
+ }
123
+ return true;
124
+ }
125
+ }
126
+
127
+ //Delete any zips in the upload directory first
128
+ foreach (glob(WPBACKITUP_DIR_PATH .'/backups/' .'*.zip') as $file) {
129
+ unlink($file);
130
+ }
131
+
132
+ //Move the uploaded zip to the restoration directory
133
+ $restore_file_name = $_GET['name'];
134
+
135
+ $orig_file_name = WP_DIR_PATH . "/wp-content/uploads/" . $_GET['name'];
136
+ if( $restore_file_name == '') {
137
+ echo '<li class="error">No file selected<li></ul>' ;
138
+ fclose($fh);
139
+ die();
140
+ } else {
141
+ echo '<li>Uploading restoration file...' ;
142
+ }
143
+
144
+ $restore_path = WPBACKITUP_DIR_PATH .'/backups/' . $restore_file_name;
145
+ if(copy($orig_file_name, $restore_path)) {
146
+ echo "Done!</li>";
147
+ } else {
148
+ echo '</li><li class="error">Your file could not be uploaded</li></ul>';
149
+ fclose($fh);
150
+ die();
151
+ }
152
+
153
+ //Unzip the uploaded restore file
154
+ echo "<li>Unzipping...";
155
+ //include recurse_zip.php
156
+ include_once 'recurse_zip.php';
157
+ //unzip the upload
158
+ $zip = new ZipArchive;
159
+ $res = $zip->open(WPBACKITUP_DIR_PATH .'/backups/' . $restore_file_name);
160
+ if ($res === TRUE) {
161
+ $zip->extractTo(WPBACKITUP_DIR_PATH .'/backups/');
162
+ $zip->close();
163
+ echo 'Done!</li>';
164
+ } else {
165
+ echo '</li><li class="error">Your restoration file could not be unzipped.</li></ul>';
166
+ unlink(WPBACKITUP_DIR_PATH .'/backups/' . $restore_file_name);
167
+ fclose($fh);
168
+ die();
169
+ }
170
+
171
+ //Identify the restoration directory
172
+ echo '<li>Validating zip...' ;
173
+ if ( count( glob( WPBACKITUP_DIR_PATH .'/backups/*', GLOB_ONLYDIR ) ) == 1 ) {
174
+ foreach( glob(WPBACKITUP_DIR_PATH .'/backups/*', GLOB_ONLYDIR ) as $dir) {
175
+ $restoration_dir_path = $dir .'/';
176
+ }
177
+ }
178
+
179
+ //Validate the restoration
180
+ if(glob($restoration_dir_path .'backupsiteinfo.txt') ){
181
+ echo 'Done!</li>';
182
+ } else {
183
+ echo '</li><li class="error">Your zip file appears to be invalid. Please ensure you chose the correct zip file.</li></ul>';
184
+ recursive_delete($restoration_dir_path);
185
+ unlink(WPBACKITUP_DIR_PATH .'/backups/' . $restore_file_name);
186
+ fclose($fh);
187
+ die();
188
+ }
189
+
190
+ //Restore wp-content directories
191
+ echo "<li>Restoring wp-content directory..." ;
192
+ if(!recursive_delete(WP_CONTENT_PATH, array( 'cgi-bin','.','..','._', WPBACKITUP_DIRNAME ))) {
193
+ echo '</li><li class="error">Unable to remove existing wp-content directory for import. Please check your CHMOD settings in /wp-content/.</li></ul>';
194
+ recursive_delete($restoration_dir_path);
195
+ unlink(WPBACKITUP_DIR_PATH .'/backups/' . $restore_file_name);
196
+ fclose($fh);
197
+ die();
198
+ }
199
+ if(!create_dir(WP_CONTENT_PATH)) {
200
+ echo '</li><li class="error">Unable to create new wp-content directory for import. Please check your CHMOD settings in /wp-content/.</li></ul>';
201
+ recursive_delete($restoration_dir_path);
202
+ unlink(WPBACKITUP_DIR_PATH .'/backups/' . $restore_file_name);
203
+ fclose($fh);
204
+ die();
205
+ }
206
+ if(recursive_copy($restoration_dir_path, WP_CONTENT_PATH .'/', array( 'cgi-bin', '.', '..','._', $restore_file_name, 'status.log', 'db-backup.sql', 'backupsiteinfo.txt')) ) {
207
+ echo 'Done!</li>';
208
+ } else {
209
+ echo '</li><li class="error">Unable to import wp-content. Please try again.</li></ul>';
210
+ recursive_delete($restoration_dir_path);
211
+ unlink(WPBACKITUP_DIR_PATH .'/backups/' . $restore_file_name);
212
+ fclose($fh);
213
+ die();
214
+ }
215
+
216
+ //if there is a database dump to restore
217
+ if( glob($restoration_dir_path . "*.sql") ) {
218
+ //collect connection information from form
219
+ echo "<li>Restoring database..." ;
220
+ include_once WP_DIR_PATH .'/wp-config.php';
221
+ //Add user to DB in v1.0.5
222
+ $user_id = $_GET['userid'];
223
+ //Connect to DB
224
+ $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
225
+ if ( !$dbc ) {
226
+ echo '</li><li class="error">Unable to connect to your current database: " .mysqli_connect_error() ."</li></ul>';
227
+ recursive_delete($restoration_dir_path);
228
+ unlink(WPBACKITUP_DIR_PATH .'/backups/' . $restore_file_name);
229
+ fclose($fh);
230
+ die();
231
+ }
232
+ //get siteurl
233
+ $q1 = "SELECT option_value FROM " .$table_prefix ."options WHERE option_name ='siteurl';";
234
+ if ($result = mysqli_query($dbc, $q1)) {
235
+ while ($row = mysqli_fetch_row($result)) {
236
+ $siteurl = $row[0];
237
+ }
238
+ mysqli_free_result($result);
239
+ } else {
240
+ echo '</li><li class="error">Unable to get current site URL from database. Please try again.</li></ul>';
241
+ recursive_delete($restoration_dir_path);
242
+ unlink(WPBACKITUP_DIR_PATH .'/backups/' . $restore_file_name);
243
+ fclose($fh);
244
+ die();
245
+ }
246
+ //get homeurl
247
+ $q2 = "SELECT option_value FROM " .$table_prefix ."options WHERE option_name ='home';";
248
+ if ($result = mysqli_query($dbc, $q2)) {
249
+ while ($row = mysqli_fetch_row($result)) {
250
+ $homeurl = $row[0];
251
+ }
252
+ mysqli_free_result($result);
253
+ } else {
254
+ echo '</li><li class="error">Unable to get current home URL from database. Please try again.</li></ul>';
255
+ recursive_delete($restoration_dir_path);
256
+ unlink(WPBACKITUP_DIR_PATH .'/backups/' . $restore_file_name);
257
+ fclose($fh);
258
+ die();
259
+ }
260
+ //get user login
261
+ $q3 = "SELECT user_login FROM ". $table_prefix ."users WHERE ID=" .$user_id .";";
262
+ if ($result = mysqli_query($dbc, $q3)) {
263
+ while ($row = mysqli_fetch_row($result)) {
264
+ $user_login = $row[0];
265
+ }
266
+ mysqli_free_result($result);
267
+ } else {
268
+ echo '</li><li class="error">Unable to get current user ID from database. Please try again.</li></ul>';
269
+ recursive_delete($restoration_dir_path);
270
+ unlink(WPBACKITUP_DIR_PATH .'/backups/' . $restore_file_name);
271
+ fclose($fh);
272
+ die();
273
+ }
274
+ //get user pass
275
+ $q4 = "SELECT user_pass FROM ". $table_prefix ."users WHERE ID=" .$user_id .";";
276
+ if ($result = mysqli_query($dbc, $q4)) {
277
+ while ($row = mysqli_fetch_row($result)) {
278
+ $user_pass = $row[0];
279
+ }
280
+ mysqli_free_result($result);
281
+ } else {
282
+ echo '</li><li class="error">Unable to get current user password from database. Please try again.</li></ul>';
283
+ recursive_delete($restoration_dir_path);
284
+ unlink(WPBACKITUP_DIR_PATH .'/backups/' . $restore_file_name);
285
+ fclose($fh);
286
+ die();
287
+ }
288
+ //get user email
289
+ $q5 = "SELECT user_email FROM ". $table_prefix ."users WHERE ID=" .$user_id ."";
290
+ if ($result = mysqli_query($dbc, $q5)) {
291
+ while ($row = mysqli_fetch_row($result)) {
292
+ $user_email = $row[0];
293
+ }
294
+ mysqli_free_result($result);
295
+ } else {
296
+ echo '</li><li class="error">Unable to get current user email from database. Please try again.</li></ul>';
297
+ recursive_delete($restoration_dir_path);
298
+ unlink(WPBACKITUP_DIR_PATH .'/backups/' . $restore_file_name);
299
+ fclose($fh);
300
+ die();
301
+ }
302
+ //Collect previous backup site url start
303
+ $import_siteinfo_lines = file($restoration_dir_path .'backupsiteinfo.txt');
304
+ $import_siteurl = trim($import_siteinfo_lines[0]);
305
+ $current_siteurl = trim($siteurl ,'/');
306
+ $import_table_prefix = $import_siteinfo_lines[1];
307
+ //import the database
308
+ if(!db_import($restoration_dir_path, $import_siteurl, $current_siteurl, $table_prefix, $import_table_prefix, $dbc)) {
309
+ echo '</li><li class="error">Unable to get import your database. This may require importing the file manually.</li></ul>';
310
+ recursive_delete($restoration_dir_path);
311
+ unlink(WPBACKITUP_DIR_PATH .'/backups/' . $restore_file_name);
312
+ fclose($fh);
313
+ die();
314
+ }
315
+ //update the database
316
+ $q6 = "UPDATE ". $table_prefix ."options SET option_value='" .$current_siteurl ."' WHERE option_name='siteurl'";
317
+ $q7 = "UPDATE ". $table_prefix ."options SET option_value='" .$homeurl ."' WHERE option_name='home'";
318
+ $q8 = "UPDATE ". $table_prefix ."users SET user_login='" .$user_login ."', user_pass='" .$user_pass ."', user_email='" .$user_email ."' WHERE ID='" .$user_id ."'";
319
+ if(!mysqli_query($dbc, $q6) ) {
320
+ echo '</li><li class="error">Unable to update your current site URL value. This may require importing the file manually.</li></ul>';
321
+ recursive_delete($restoration_dir_path);
322
+ unlink(WPBACKITUP_DIR_PATH .'/backups/' . $restore_file_name);
323
+ fclose($fh);
324
+ die();
325
+ }
326
+ if(!mysqli_query($dbc, $q7) ) {
327
+ echo '</li><li class="error">Unable to update your current home URL value. This may require importing the file manually.</li></ul>';
328
+ recursive_delete($restoration_dir_path);
329
+ unlink(WPBACKITUP_DIR_PATH .'/backups/' . $restore_file_name);
330
+ fclose($fh);
331
+ die();
332
+ }
333
+ if(!mysqli_query($dbc, $q8) ) {
334
+ echo '</li><li class="error">Unable to update your user information. This may require importing the file manually.</li></ul>';
335
+ recursive_delete($restoration_dir_path);
336
+ unlink(WPBACKITUP_DIR_PATH .'/backups/' . $restore_file_name);
337
+ fclose($fh);
338
+ die();
339
+ }
340
+ echo 'Done!</li>';
341
+ } else {
342
+ echo '<li class="error">Warning: Database not detected in import file.</li>';
343
+ }
344
+
345
+ //Disconnect
346
+ mysqli_close($dbc);
347
+
348
+ //Delete the restoration directory
349
+ recursive_delete($restoration_dir_path);
350
+
351
+ //Delete zip
352
+ unlink(WPBACKITUP_DIR_PATH .'/backups/' . $restore_file_name);
353
+
354
+ //close log file
355
+ echo '<li>Restoration complete. Please refresh the page.</li>';
356
+ echo '</ul>';
357
+ fclose($fh);
358
+
359
+ //End backup function
360
+ die();
logs/status.log CHANGED
@@ -1 +1 @@
1
- <status code="prerequisites">Done</status><status code="backupfiles">Done</status><status code="backupdb">Done</status><status code="infofile">Done</status><status code="zipfile">Done</status><status code="cleanup">Done</status><status code="finalinfo">Backup file created successfully. You can download your backup file using the link above.</status><status code="end">End</status>
1
+ <status code="upload">Done</status><status code="copyfiles">In Progress</status><status code="unzipping">In Progress</status><status code="unzipping">Done</status><status code="validation">In Progress</status><status code="validation">Done</status><status code="database">In Progress</status><status code="database">Done</status><status code="wpcontent">In Progress</status><status code="wpcontent">Done</status><status code="infomessage">Restoration Complete</status><status code="finalinfo">Finished</status>
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
- === WP Backitup Lite ===
2
  Contributors: jcpeden
3
  Donate link: http://www.wpbackitup.com
4
  Tags: backup wordpress, database backup, backup database, download database, backup and restore, restoring wordpress, restore wordpress, restore wordpress backup,
5
- Requires at least: 3.4
6
  Tested up to: 3.5.1
7
- Stable tag: 1.2.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -13,22 +13,19 @@ Create a backup zip of your content and settings with a single click that can be
13
  == Description ==
14
 
15
  = The Simple Way to Backup Your Site =
16
- WP Backitup Lite creates a backup zip of your site&apos;s content and configuration in just a single click,
17
  right from your Wordpress dashboard. There is no need to FTP into your site and no knowledge of MySQL or PHPMyAdmin is required.
18
 
19
  You can use your backup zip to restore your site or to clone a site&apos;s content and settings when setting up a new one.
20
 
21
  = Automatically Restore Your Backup Zips =
22
- Tired of messing around in PHPMyAdmin and with FTP trying to restore you backups? Why not check out <a href="http://www.wpbackitup.com/wp-backitup-pro/" title="WP Backitup Pro">WP Backitup Pro</a>? WP Backitup Pro offers all the features of WP Backitup Lite but allows you to import your backup zips in seconds, right from the Wordpress Dashboard (<a href="http://wordpress.org/extend/plugins/wp-backitup/screenshots/" title="WP Backitup Screenshots">screenshots</a>).
23
-
24
- = Manually Restore Your Backup Zips =
25
- WP Backitup generates a zip file containing a copy of your wp-content directory and a database dump. You can unzip it and <a href="http://codex.wordpress.org/Restoring_Your_Database_From_Backup">import your database</a> and files manually but this requires knowledge of FTP and MySQL.
26
 
27
  = Easy To Install and Use =
28
- Simply install the plugin directly to Wordpress and browse to the new menu 'Backup/Restore'. From there, just follow the on-screen instructions and watch as WP Backitup creates a backup of you site's plugins, themes and uploads as well as you content and settings (including all custom widgets and settings for any additional plugins).
29
 
30
  = More questions? =
31
- Why not head over to the <a href="http://www.wpbackitup.com/" title="WP Backitup">WP Backitup site</a> or take a look at the <a href="http://www.wpbackitup.com/support/" title="WP Backitup Support Forum">WP Backitup Support Forum</a>, if you need more help?
32
 
33
  == Installation ==
34
 
@@ -36,8 +33,8 @@ Installation of the plugin is straightforward:
36
 
37
  1. Upload the plugin to your plugins directory via FTP or through the Wordpress dashboard.
38
  1. Activate the plugin.
39
- 1. A new menu called 'Backup/Restore' will be added to your toolbar.
40
- 1. Click 'Backup/Restore' to access WP-Backitup
41
 
42
  == Frequently Asked Questions ==
43
 
@@ -45,7 +42,7 @@ Installation of the plugin is straightforward:
45
  Sure! The backup zips generated by WP Backitup contain a database dump and a copy of your wp-content directory. Simply upload your files and import your database.
46
 
47
  = Is there an easier way to restore my backup zips? =
48
- Yes, purchase and download <a href="http://www.wpbackitup.com/wp-backitup-pro/" title="WP Backitup Pro">WP Backitup Pro</a>. Once installed, you'll be able to restore you backup zips without FTP or MySQL.
49
 
50
  = Will the plugin work on shared hosting/sub domains/webhost xxx? =
51
  Yes.
@@ -53,14 +50,14 @@ Yes.
53
  = Will WP Backitup work on Windows hosting? =
54
  Yes.
55
 
56
- = Are you going to be making progress bars both for backing up and restoring with this plugin? =
57
- It is likely this will feature in a new version of WP Backitup Pro.
58
 
59
  = Can this plugin back to Amazon S3? =
60
- This will feature in an upcoming version of WP Backitup Pro.
61
 
62
  = Is there an auto back up schedule feature? =
63
- It is likely this will feature in a new version of WP Backitup Pro.
64
 
65
  = Will the plugin work with Wordpres version x.x? =
66
  The plugin works on the latest release of WordPress and is updated to function with all new releases.
@@ -86,134 +83,104 @@ WP Backitup creates a database dump and a backup of all your themes, plugins and
86
  = Do you have any ideas about how large a blog is too big for WP Backitup to handle? =
87
  I`ve tested up to 5 themes, 20 plugins and 100 posts/pages without any issues.
88
 
89
- = Do you do regularly update this product to match with WP version updates? =
90
  Yes.
91
 
92
  == Screenshots ==
93
  1. Once activated, the plugin loads a new menu into your toolbar.
94
- 2. Simply click 'Backup' to generate a backup of your site. The plugin will update you on its progress.
95
  3. When the backup has been created, click the download link to access a zipped backup of your site.
96
 
97
  == Changelog ==
98
 
99
- = 1.2.2 =
100
- * Fixed fatal errors with plugin classname.
101
-
102
- = 1.2.1 =
103
- * Fixed issues with broken directory tree, brought versioning inline with WP Backitup Pro
104
-
105
- = 1.1.7 =
106
- * Setup backup to use mysqldump and shellexec.
107
 
108
- = 1.1.6 =
109
- * Forced backup process to ignore cache files.
110
 
111
- = 1.1.5 =
112
- * Fixed minor bugs in the code.
113
 
114
- = 1.1.4 =
115
- * Fixed minor bugs in tracking code and options.
116
 
117
- = 1.1.3 =
118
- * Re-wrote plugin in OOP, added option to disable Presstrends tracking code.
119
 
120
- = 1.1.2 =
121
- * Fixed issue with stylesheet not being loaded.
122
 
123
- = 1.1.1 =
124
- * Fixed issue with plugin not detecing addons
125
 
126
- = 1.1.0 =
127
- * Fixed bugs with addons system.
128
-
129
- = 1.0.9 =
130
- * Added Presstrends tracking code.
131
-
132
- = 1.0.8 =
133
- * Modified plugin administration and loaded menu tab in main toolbar.
134
 
135
- = 1.0.7 =
136
- * Added hooks to plugin to allow addons to be built and loaded into the free version of the theme, distributed through the Wordpress plugin repository. Backups were also limited to 20MB to ensure that the processes actually complete.
137
 
138
- = 1.0.6 =
139
- * Initial free version of the plugin distributed on Wordpress. This version can only backup.
140
 
141
- = 1.0.5 =
142
- * Modified backup to use AJAX and restore to use AJAX-like functionality. Added read-write for options so they are saved to DB on exit.
143
-
144
- = 1.0.4 =
145
- * Reduced the size of the plugin by re-using code. Added support for multiple table prefixes and media library import.
146
 
147
  = 1.0.3 =
148
- * Removed redundant code, allowed plugin to work with multiple table prefixes and user IDs other than 1.
149
 
150
  = 1.0.2 =
151
- * Fixed backup/restore function of database, plugins and themes dir. Removed PHP error notices if options are not set on admin page
152
 
153
  = 1.0.1 =
154
- * Increased PHP timeout to 900 seconds (5 minutes).
155
 
156
- = 1.0 =
157
- * Plugin released.
158
 
159
  == Upgrade Notice ==
160
 
 
 
 
161
  = 1.2.2 =
162
- * Critical upgrade. Plugin broken for most users without this update.
163
 
164
  = 1.2.1 =
165
- * Critical upgrade. Plugin broken for most users without this update.
166
 
167
- = 1.1.7 =
168
- * Recommended upgrade. Backup process faster and more stable.
169
-
170
- = 1.1.6 =
171
- * Recommended upgrade. Backup process faster and more stable.
172
-
173
- = 1.1.5 =
174
- * Non-critical upgrade. Fixed minor bugs in code.
175
-
176
- = 1.1.4 =
177
- * Non-critical upgrade. Fixed bugs in code.
178
-
179
- = 1.1.3 =
180
- * Non-critical upgrade. Re-wrote plugin in object-oriented PHP.
181
-
182
- = 1.1.2 =
183
- * Critical upgrade. Fixed issue with stylesheet.
184
-
185
- = 1.1.1 =
186
- * Critical upgrade. Fixed further bugs with addons system.
187
 
188
  = 1.1.0 =
189
- * Non-critical upgrade. Fixed bugs with addons system that caused problems for some users.
190
 
191
- = 1.0.9 =
192
- * Non-essential upgrade. Added Presstrends code.
193
 
194
- = 1.0.8 =
195
- * Recommended upgrade. Added links to admin menu.
196
 
197
- = 1.0.7 =
198
- * Critical upgrade. Totally overhauled the plugin's construction, stability and features.
199
 
200
- = 1.0.6 =
201
- * Non-critical upgrade.
202
 
203
- = 1.0.5 =
204
- * Critical upgrade: More stable, increased flexibility and power.
205
 
206
- = 1.0.4 =
207
- * Critical upgrade: Many people have had trouble prior to this release. Flexibility has been increased and the plugin is now more stable and lightweight.
208
 
209
- = 1.0.3 =
210
- * Recommended upgrade: The plugin is more flexible and offers more helpful status and error messages.
211
 
212
- = 1.0.2 =
213
- * Critical upgrade: Plugin does not work on most systems without this upgrade
214
 
215
- = 1.0.1 =
216
- * This version increases PHP timeout if possible (upgrade if you are having timeout errors).
217
 
218
- = 1.0 =
219
  Initial version of the plugin.
1
+ === WP Backitup ===
2
  Contributors: jcpeden
3
  Donate link: http://www.wpbackitup.com
4
  Tags: backup wordpress, database backup, backup database, download database, backup and restore, restoring wordpress, restore wordpress, restore wordpress backup,
5
+ Requires at least: 3.4.2
6
  Tested up to: 3.5.1
7
+ Stable tag: 1.3.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
13
  == Description ==
14
 
15
  = The Simple Way to Backup Your Site =
16
+ WP Backitup creates a backup zip of your site&apos;s content and configuration in just a single click,
17
  right from your Wordpress dashboard. There is no need to FTP into your site and no knowledge of MySQL or PHPMyAdmin is required.
18
 
19
  You can use your backup zip to restore your site or to clone a site&apos;s content and settings when setting up a new one.
20
 
21
  = Automatically Restore Your Backup Zips =
22
+ Tired of messing around in PHPMyAdmin and with FTP trying to restore you backups? <a href="http://www.wpbackitup.com/wp-backitup-pro/" title="WP Backitup">WP Backitup Pro</a> offers all the features of <a href="http://wordpress.org/extend/plugins/wp-backitup/" title="WP Backitup Lite">WP Backitup</a> but allows you to import your backup zips in seconds, right from the Wordpress Dashboard.
 
 
 
23
 
24
  = Easy To Install and Use =
25
+ Simply install the plugin directly to Wordpress and browse to the new menu 'WP Backitup'. From there, just follow the on-screen instructions and watch as WP Backitup creates a backup of you site's plugins, themes and uploads as well as you content and settings (including all custom widgets and settings for any additional plugins).
26
 
27
  = More questions? =
28
+ Why not head over to the <a href="http://www.wpbackitup.com/" title="WP Backitup">WP Backitup site</a>?
29
 
30
  == Installation ==
31
 
33
 
34
  1. Upload the plugin to your plugins directory via FTP or through the Wordpress dashboard.
35
  1. Activate the plugin.
36
+ 1. A new menu called 'WP Backitup' will be added to your toolbar.
37
+ 1. Click 'WP Backitup' to access the backup/restore interface.
38
 
39
  == Frequently Asked Questions ==
40
 
42
  Sure! The backup zips generated by WP Backitup contain a database dump and a copy of your wp-content directory. Simply upload your files and import your database.
43
 
44
  = Is there an easier way to restore my backup zips? =
45
+ Yes, purchase and download <a href="http://www.wpbackitup.com/wp-backitup-pro/" title="WP Backitup">WP Backitup</a>. Once installed, you'll be able to restore you backup zips without FTP or MySQL.
46
 
47
  = Will the plugin work on shared hosting/sub domains/webhost xxx? =
48
  Yes.
50
  = Will WP Backitup work on Windows hosting? =
51
  Yes.
52
 
53
+ = Are you going to be makinggress bars both for backing up and restoring with this plugin? =
54
+ It is likely this will feature in a new version of WP Backitup.
55
 
56
  = Can this plugin back to Amazon S3? =
57
+ This will feature in an upcoming version of WP Backitup.
58
 
59
  = Is there an auto back up schedule feature? =
60
+ It is likely this will feature in a new version of WP Backitup.
61
 
62
  = Will the plugin work with Wordpres version x.x? =
63
  The plugin works on the latest release of WordPress and is updated to function with all new releases.
83
  = Do you have any ideas about how large a blog is too big for WP Backitup to handle? =
84
  I`ve tested up to 5 themes, 20 plugins and 100 posts/pages without any issues.
85
 
86
+ = Do you do regularly update thisduct to match with WP version updates? =
87
  Yes.
88
 
89
  == Screenshots ==
90
  1. Once activated, the plugin loads a new menu into your toolbar.
91
+ 2. Simply click 'Backup' to generate a backup of your site. The plugin will update you on itsgress.
92
  3. When the backup has been created, click the download link to access a zipped backup of your site.
93
 
94
  == Changelog ==
95
 
96
+ = 1.3.0 =
97
+ Recommended upgrade: Amalgameted lite and pro versions of the plugin
 
 
 
 
 
 
98
 
99
+ = 1.2.2 =
100
+ Major updates to improve plugin performance and stability.
101
 
102
+ = 1.2.1 =
103
+ Minor updates to plugin functionality.
104
 
105
+ = 1.2.0 =
106
+ Brought versioning inline with WP Backitup Lite. Fixed incorrecy message on restore interface. Fixed restorationcess.
107
 
108
+ = 1.1.0 =
109
+ Backup from mysqldump, restore from mysql command line, restore functionality from uploaded files, file size limit check according to server before uploads, setInterval termination after operation, status update as the task completes using XML.
110
 
111
+ = 1.0.9 =
112
+ Introduced mysqldump for backup and shell exec for copy/delete operations.
113
 
114
+ = 1.0.8 =
115
+ Added ability to restore from server.
116
 
117
+ = 1.0.7 =
118
+ Improved auto-update facility and plugin stability.
 
 
 
 
 
 
119
 
120
+ = 1.0.6 =
121
+ Fixed critical issues the auto-upgradecess.
122
 
123
+ = 1.0.5 =
124
+ Fixed critical issues the auto-upgradecess.
125
 
126
+ = 1.0.4 =
127
+ Fixed issues with the restorationcess.
 
 
 
128
 
129
  = 1.0.3 =
130
+ Fixed the auto-update engine and license key activation system.
131
 
132
  = 1.0.2 =
133
+ Minor bugs patched for auto-update engine.
134
 
135
  = 1.0.1 =
136
+ WP Backitup integrated with licensing and auto-update engine.
137
 
138
+ = 1.0.0 =
139
+ Initial version of the plugin released.
140
 
141
  == Upgrade Notice ==
142
 
143
+ = 1.3.0 =
144
+ Recommended upgrade: Amalgameted lite and pro versions of the plugin
145
+
146
  = 1.2.2 =
147
+ Critical upgrade: Major overhaul of plugin structure
148
 
149
  = 1.2.1 =
150
+ Recommended upgrade: Minor update to plugin structure.
151
 
152
+ = 1.2.0 =
153
+ Recommended upgrade: Minor update to plugin structure.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
154
 
155
  = 1.1.0 =
156
+ Critical upgrade: Improved plugin performance.
157
 
158
+ = 1.0.9 =
159
+ Recommended upgrade: Improved reliability and performance.
160
 
161
+ = 1.0.8 =
162
+ Recommended upgrade: Improved functionality
163
 
164
+ = 1.0.7 =
165
+ Critical upgrade: Fixed major bugs with auto-upgradecess.
166
 
167
+ = 1.0.6 =
168
+ Critical upgrade: Fixed major bugs with auto-upgradecess.
169
 
170
+ = 1.0.5 =
171
+ Critical upgrade: Fixed major bugs with auto-upgradecess.
172
 
173
+ = 1.0.4 =
174
+ Critical upgrade: Fixed major bugs with restorationcess.
175
 
176
+ = 1.0.3 =
177
+ Critical upgrade: Patched auto-update engine.
178
 
179
+ = 1.0.2 =
180
+ Non-critical upgrade: Patched auto-update engine.
181
 
182
+ = 1.0.1 =
183
+ Recommended upgrade: Added the licensing and auto-update engine.
184
 
185
+ = 1.0.0 =
186
  Initial version of the plugin.
views/options.php CHANGED
@@ -1,4 +1,3 @@
1
- <script type="text/javascript" src="http://code.jquery.com/jquery.js"></script>
2
  <div class="wrap">
3
  <div id="wp-backitup-icon" class="icon32"><img src="<?php echo plugin_dir_url(dirname(__FILE__) ); ?>images/icon32.png" alt="WP Backitup Icon" height="32" width="32" /></div>
4
  <h2><?php echo $page_title; ?></h2>
@@ -8,6 +7,30 @@
8
  <p><a href="#" class="backup-button button-primary"><?php _e( "Backup", $namespace ) ?></a><img class="backup-icon status-icon" src="<?php echo WPBACKITUP_URLPATH. "/images/loader.gif"; ?>" height="16" width="16" /></p>
9
  <h3><?php _e('Download', $namespace );?></h3>
10
  <p id="download-link"></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  <h3><?php _e('Status', $namespace );?></h3>
12
  <p><div id="status"><?php _e('Nothing to report', $namespace );?></div></p>
13
  <?php if (site_url() == 'http://localhost/wpbackitup') {
@@ -15,28 +38,52 @@
15
  } ?>
16
  </div>
17
  <div id="sidebar">
18
- <div class="widget" id="restore-widget">
19
- <h3 class="promo">Go Pro!</h3>
20
- <p>Upgrade to <a href="http://www.wpbackitup.com/wp-backitup-pro/">WP Backitup Pro</a> and restore your backups with a few simple clicks!</p>
21
- <p><a class="button-primary" href="http://www.wpbackitup.com/wp-backitup-pro/">Read more</a></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  </div>
23
  <div class="widget">
24
- <h3 class="promo">Need support?</h3>
25
- <p>If you are having problems with this plugin please talk about them in the <a href="http://wordpress.org/support/plugin/wp-backitup">support forum</a>.</p>
 
 
 
 
 
 
 
 
26
  </div>
27
  <div class="widget">
28
- <h3 class="promo">Spread the Word!</h3>
29
- <p>Why not <a href="http://wordpress.org/extend/plugins/wp-backitup/">rate the plugin 5&#9733; on Wordpress.org</a>?</p>
30
  </div>
31
  <div class="widget">
32
  <h3 class="promo">Presstrends</h3>
33
- <form action="" method="post" id="<?php echo $namespace; ?>-form">
34
- <?php wp_nonce_field( $namespace . "-update-options" ); ?>
35
- <p><input type="radio" name="data[presstrends]" value="enabled" <?php if($this->get_option( 'presstrends' ) == 'enabled') echo 'checked'; ?>> <label>Enable</label></p>
36
- <p><input type="radio" name="data[presstrends]" value="disabled" <?php if($this->get_option( 'presstrends' ) == 'disabled') echo 'checked'; ?>> <label>Disable</label></p>
37
- <p>Help to improve Easy Webtrends by enabling <a href="http://www.presstrends.io" target="_blank">Presstrends</a>.</p>
38
- <p class="submit"><input type="submit" name="Submit" class="button-primary" value="<?php _e( "Save", $namespace ) ?>" /></p>
39
- </form>
40
  </div>
 
41
  </div>
42
  </div>
 
1
  <div class="wrap">
2
  <div id="wp-backitup-icon" class="icon32"><img src="<?php echo plugin_dir_url(dirname(__FILE__) ); ?>images/icon32.png" alt="WP Backitup Icon" height="32" width="32" /></div>
3
  <h2><?php echo $page_title; ?></h2>
7
  <p><a href="#" class="backup-button button-primary"><?php _e( "Backup", $namespace ) ?></a><img class="backup-icon status-icon" src="<?php echo WPBACKITUP_URLPATH. "/images/loader.gif"; ?>" height="16" width="16" /></p>
8
  <h3><?php _e('Download', $namespace );?></h3>
9
  <p id="download-link"></p>
10
+
11
+ <!--Disable restoration form if the user has not activated-->
12
+ <?php $status = $this->get_option( 'status' );
13
+ if( $status !== false && $status == 'valid' ) { ?>
14
+ <h3><?php _e('Restore', $namespace );?></h3>
15
+ <iframe id="upload_target" name="upload_target" src=""></iframe>
16
+ <p><?php _e('Restore a WP Backitup zip file and overwrite this site\'s content, themes, plugins, uploads and settings.', $namespace );?></p>
17
+ <?php $max_upload = (int)(ini_get('upload_max_filesize'));
18
+ $max_post = (int)(ini_get('post_max_size'));
19
+ $memory_limit = (int)(ini_get('memory_limit'));
20
+ $upload_mb = min($max_upload, $max_post, $memory_limit); ?>
21
+ <p><?php _e( 'The maximum filesize you can upload is ', $namespace );
22
+ echo $upload_mb .'MB.'; ?>
23
+ </p>
24
+ <form id="restore-form" method="post" enctype="multipart/form-data" action="<?php echo WPBACKITUP_URLPATH .'/lib/includes/restore.php'; ?>">
25
+ <?php global $current_user; ?>
26
+ <input type="hidden" name="user_id" value="<?php echo $current_user->ID; ?>" />
27
+ <input type="hidden" name="maximum" id="maximum" value="<?php echo $upload_mb; ?>" />
28
+ <p><input name="wpbackitup-zip" id="wpbackitup-zip" type="file" /></p>
29
+ <p><input type="submit" class="restore-button button-primary" name="restore" value="<?php _e( "Restore", $namespace ) ?>" /><img class="restore-icon status-icon" src="<?php echo WPBACKITUP_URLPATH. "/images/loader.gif"; ?>" height="16" width="16" /></p>
30
+ </form>
31
+ <?php } ?>
32
+ <!--End of restoration form-->
33
+
34
  <h3><?php _e('Status', $namespace );?></h3>
35
  <p><div id="status"><?php _e('Nothing to report', $namespace );?></div></p>
36
  <?php if (site_url() == 'http://localhost/wpbackitup') {
38
  } ?>
39
  </div>
40
  <div id="sidebar">
41
+ <form action="" method="post" id="<?php echo $namespace; ?>-form">
42
+ <?php wp_nonce_field( $namespace . "-update-options" ); ?>
43
+ <div class="widget">
44
+ <h3 class="promo"><?php _e('License Key', $namespace ); ?></h3>
45
+ <?php $license = $this->get_option( 'license_key' );
46
+ $status = $this->get_option( 'status' );
47
+ if( $status !== false && $status == 'valid' ) { ?>
48
+ <p><?php _e('Pro features and auto-updates enabled.', $namespace ); ?></p>
49
+ <?php } else { ?>
50
+ <p><?php _e('Activate auto-restore and auto-updates by entering your license key.', $namespace ); ?></p>
51
+ <?php } ?>
52
+ <p><input type="text" name="data[license_key]" id="license_key" value="<?php esc_attr_e( $license ); ?>">
53
+ <?php if( false !== $license ) {
54
+ if( $status !== false && $status == 'valid' ) { ?>
55
+ <span style="color:green;"><?php _e('Active', $namespace); ?></span></p>
56
+ <p class="submit"><input type="submit" name="Submit" class="button-secondary" value="<?php _e( "Update", $namespace ) ?>" /></p>
57
+ <?php } else { ?>
58
+ <span style="color:red;"><?php _e('Inactive', $namespace); ?></span></p>
59
+ <p class="submit"><input type="submit" name="Submit" class="button-secondary" value="<?php _e( "Activate", $namespace ) ?>" /></p>
60
+ <p><a href="http://www.wpbackitup.com/wp-backitup-pro"><?php _e('Purchase a license key', $namespace); ?></a></p>
61
+ <?php }
62
+ } ?>
63
  </div>
64
  <div class="widget">
65
+ <?php if( $status !== false && $status == 'valid' ) {
66
+ $support_anchor = __('WP Backitup support system',$namespace);
67
+ $support_url = 'http://www.wpbackitup.com/support/';
68
+ } else {
69
+ $support_anchor = __('support system',$namespace);
70
+ $support_url = 'http://wordpress.org/support/plugin/wp-backitup';
71
+ } ?>
72
+ <h3 class="promo"><?php _e('Need Help?', $namespace ); ?></h3>
73
+ <p><?php _e('Access the',$namespace); ?> <a href="<?php echo $support_url; ?>"><?php echo $support_anchor; ?></a>.</p>
74
+
75
  </div>
76
  <div class="widget">
77
+ <h3 class="promo"><?php _e('Spread the Word', $namespace ); ?></h3>
78
+ <p><a href="http://wordpress.org/extend/plugins/wp-backitup/"><?php _e('Rate WP Backitup', $namespace ); ?> 5&#9733;</a></p>
79
  </div>
80
  <div class="widget">
81
  <h3 class="promo">Presstrends</h3>
82
+ <p><input type="radio" name="data[presstrends]" value="enabled" <?php if($this->get_option( 'presstrends' ) == 'enabled') echo 'checked'; ?>> <label><?php _e('Enable', $namespace ); ?></label></p>
83
+ <p><input type="radio" name="data[presstrends]" value="disabled" <?php if($this->get_option( 'presstrends' ) == 'disabled') echo 'checked'; ?>> <label><?php _e('Disable', $namespace ); ?></label></p>
84
+ <p><?php _e('Help to improve Easy Webtrends by enabling', $namespace ); ?> <a href="http://www.presstrends.io" target="_blank">Presstrends</a>.</p>
85
+ <p class="submit"><input type="submit" name="Submit" class="button-primary" value="<?php _e( "Save", $namespace ) ?>" /></p>
 
 
 
86
  </div>
87
+ </form>
88
  </div>
89
  </div>