UpdraftPlus WordPress Backup Plugin - Version 1.13.4

Version Description

  • 08/Jun/2017 =

  • FIX: Import function had a regression and was not coping with all formats

  • TWEAK: When the import function failed, the error was not shown to the user

Download this release

Release Info

Developer DavidAnderson
Plugin Icon 128x128 UpdraftPlus WordPress Backup Plugin
Version 1.13.4
Comparing to
See all releases

Code changes from version 1.13.2 to 1.13.4

Files changed (4) hide show
  1. admin.php +13 -6
  2. includes/updraft-admin.js +19 -9
  3. readme.txt +11 -2
  4. updraftplus.php +1 -1
admin.php CHANGED
@@ -3938,12 +3938,12 @@ ENDHERE;
3938
  }
3939
 
3940
  public function updraft_ajax_importsettings() {
3941
- global $updraftplus;
3942
 
3943
- if (empty($_POST) || empty($_POST['subaction']) || 'importsettings' != $_POST['subaction'] || !isset($_POST['nonce']) || !is_user_logged_in() || !UpdraftPlus_Options::user_can_manage() || !wp_verify_nonce($_POST['nonce'], 'updraftplus-settings-nonce')) die('Security check');
3944
 
3945
- if (empty($_POST['settings']) || !is_string($_POST['settings'])) die('Invalid data');
3946
-
3947
  $this->import_settings($_POST);
3948
  }
3949
 
@@ -3955,7 +3955,14 @@ ENDHERE;
3955
  public function import_settings($settings) {
3956
  global $updraftplus;
3957
 
3958
- $posted_settings = json_decode(stripslashes($settings['settings']),true);
 
 
 
 
 
 
 
3959
 
3960
  if (!empty($settings['updraftplus_version'])) $posted_settings['updraftplus_version'] = $settings['updraftplus_version'];
3961
 
@@ -4012,7 +4019,7 @@ ENDHERE;
4012
  UpdraftPlus_Options::admin_init();
4013
 
4014
  $more_files_path_updated = false;
4015
-
4016
  if (isset($settings['updraftplus_version']) && $updraftplus->version == $settings['updraftplus_version']) {
4017
 
4018
  $return_array = array('saved' => true);
3938
  }
3939
 
3940
  public function updraft_ajax_importsettings() {
3941
+ global $updraftplus;
3942
 
3943
+ if (empty($_POST) || empty($_POST['subaction']) || 'importsettings' != $_POST['subaction'] || !isset($_POST['nonce']) || !is_user_logged_in() || !UpdraftPlus_Options::user_can_manage() || !wp_verify_nonce($_POST['nonce'], 'updraftplus-settings-nonce')) die('Security check');
3944
 
3945
+ if (empty($_POST['settings']) || !is_string($_POST['settings'])) die('Invalid data');
3946
+
3947
  $this->import_settings($_POST);
3948
  }
3949
 
3955
  public function import_settings($settings) {
3956
  global $updraftplus;
3957
 
3958
+ // A bug in UD releases around 1.12.40 - 1.13.3 meant that it was saved in URL-string format, instead of JSON
3959
+ $perhaps_not_yet_parsed = json_decode(stripslashes($settings['settings']), true);
3960
+
3961
+ if (!is_array($perhaps_not_yet_parsed)) {
3962
+ parse_str($perhaps_not_yet_parsed, $posted_settings);
3963
+ } else {
3964
+ $posted_settings = $perhaps_not_yet_parsed;
3965
+ }
3966
 
3967
  if (!empty($settings['updraftplus_version'])) $posted_settings['updraftplus_version'] = $settings['updraftplus_version'];
3968
 
4019
  UpdraftPlus_Options::admin_init();
4020
 
4021
  $more_files_path_updated = false;
4022
+
4023
  if (isset($settings['updraftplus_version']) && $updraftplus->version == $settings['updraftplus_version']) {
4024
 
4025
  $return_array = array('saved' => true);
includes/updraft-admin.js CHANGED
@@ -2547,7 +2547,7 @@ jQuery(document).ready(function($){
2547
  var data = decodeURIComponent(updraft_file_result);
2548
 
2549
  data = JSON.parse(data);
2550
-
2551
  if (window.confirm(updraftlion.importing_data_from + ' ' + data['network_site_url'] + "\n" + updraftlion.exported_on + ' ' + data['local_date'] + "\n" + updraftlion.continue_import)) {
2552
  // GET the settings back to the AJAX handler
2553
  data = JSON.stringify(data['data']);
@@ -2555,11 +2555,18 @@ jQuery(document).ready(function($){
2555
  settings: data,
2556
  updraftplus_version: updraftlion.updraftplus_version,
2557
  }, function(response) {
2558
- updraft_handle_page_updates(response);
2559
- // Prevent the user being told they have unsaved settings
2560
- updraft_settings_form_changed = false;
2561
- // Add page updates etc based on response
2562
- location.replace(updraftlion.updraft_settings_url);
 
 
 
 
 
 
 
2563
  }, { action: 'updraft_importsettings', nonce: updraftplus_settings_nonce, json_parse: false } );
2564
  } else {
2565
  $.unblockUI();
@@ -2576,7 +2583,7 @@ jQuery(document).ready(function($){
2576
  function gather_updraft_settings(output_format) {
2577
 
2578
  var form_data = '';
2579
- var output_format = ('object' === typeof output_format) ? output_format : 'string';
2580
 
2581
  if ('object' == output_format) {
2582
  // Excluding the unnecessary 'action' input avoids triggering a very mis-conceived mod_security rule seen on one user's site
@@ -2603,7 +2610,8 @@ jQuery(document).ready(function($){
2603
 
2604
  /**
2605
  * Method to parse the response from the backend and update the page with the returned content or display error messages if failed
2606
- * @param {[JSON]} response a JSON encoded response containing information to update the settings page with
 
2607
  */
2608
  function updraft_handle_page_updates(response) {
2609
 
@@ -2622,7 +2630,7 @@ jQuery(document).ready(function($){
2622
  console.log(response);
2623
  alert(updraftlion.jsonnotunderstood);
2624
  $.unblockUI();
2625
- return;
2626
  }
2627
 
2628
  if (resp.hasOwnProperty('changed')) {
@@ -2668,6 +2676,8 @@ jQuery(document).ready(function($){
2668
 
2669
  $('#next-backup-table-inner').html(resp.scheduled);
2670
 
 
 
2671
  }
2672
 
2673
  //this function has the workings for checking if any cloud storage needs authentication
2547
  var data = decodeURIComponent(updraft_file_result);
2548
 
2549
  data = JSON.parse(data);
2550
+
2551
  if (window.confirm(updraftlion.importing_data_from + ' ' + data['network_site_url'] + "\n" + updraftlion.exported_on + ' ' + data['local_date'] + "\n" + updraftlion.continue_import)) {
2552
  // GET the settings back to the AJAX handler
2553
  data = JSON.stringify(data['data']);
2555
  settings: data,
2556
  updraftplus_version: updraftlion.updraftplus_version,
2557
  }, function(response) {
2558
+ var resp = updraft_handle_page_updates(response);
2559
+ if (!resp.hasOwnProperty('saved') || resp.saved) {
2560
+ // Prevent the user being told they have unsaved settings
2561
+ updraft_settings_form_changed = false;
2562
+ // Add page updates etc based on response
2563
+ location.replace(updraftlion.updraft_settings_url);
2564
+ } else {
2565
+ $.unblockUI();
2566
+ if (resp.hasOwnProperty('error_message') && resp.error_message) {
2567
+ alert(resp.error_message);
2568
+ }
2569
+ }
2570
  }, { action: 'updraft_importsettings', nonce: updraftplus_settings_nonce, json_parse: false } );
2571
  } else {
2572
  $.unblockUI();
2583
  function gather_updraft_settings(output_format) {
2584
 
2585
  var form_data = '';
2586
+ var output_format = ('undefined' === typeof output_format) ? 'string' : output_format;
2587
 
2588
  if ('object' == output_format) {
2589
  // Excluding the unnecessary 'action' input avoids triggering a very mis-conceived mod_security rule seen on one user's site
2610
 
2611
  /**
2612
  * Method to parse the response from the backend and update the page with the returned content or display error messages if failed
2613
+ * @param String - the JSON-encoded response containing information to update the settings page with
2614
+ * @return Object - the decoded response (empty if decoding was not successful)
2615
  */
2616
  function updraft_handle_page_updates(response) {
2617
 
2630
  console.log(response);
2631
  alert(updraftlion.jsonnotunderstood);
2632
  $.unblockUI();
2633
+ return {};
2634
  }
2635
 
2636
  if (resp.hasOwnProperty('changed')) {
2676
 
2677
  $('#next-backup-table-inner').html(resp.scheduled);
2678
 
2679
+ return resp;
2680
+
2681
  }
2682
 
2683
  //this function has the workings for checking if any cloud storage needs authentication
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: Backup with UpdraftPlus, DavidAnderson, DNutbourne, aporter, snigh
3
  Tags: backup, restore, database backup, wordpress backup, cloud backup, s3, dropbox, google drive, onedrive, ftp, backups
4
  Requires at least: 3.2
5
  Tested up to: 4.8
6
- Stable tag: 1.13.2
7
  Author URI: https://updraftplus.com
8
  Donate link: https://david.dw-perspective.org.uk/donate
9
  License: GPLv3 or later
@@ -127,6 +127,15 @@ The <a href="https://updraftplus.com/news/">UpdraftPlus backup blog</a> is the b
127
 
128
  N.B. Paid versions of UpdraftPlus Backup / Restore have a version number which is 1 higher in the first digit, and has an extra component on the end, but the changelog below still applies. i.e. changes listed for 1.13.1 of the free version correspond to changes made in 2.13.1.x of the paid version.
129
 
 
 
 
 
 
 
 
 
 
130
  = 1.13.2 - 07/Jun/2017 =
131
 
132
  * TWEAK: Marked as tested and compatible on WordPress 4.8
@@ -468,4 +477,4 @@ We recognise and thank the following for code and/or libraries used and/or modif
468
 
469
 
470
  == Upgrade Notice ==
471
- * 1.13.2: Small tweaks, and marked as WP 4.8 compatible.
3
  Tags: backup, restore, database backup, wordpress backup, cloud backup, s3, dropbox, google drive, onedrive, ftp, backups
4
  Requires at least: 3.2
5
  Tested up to: 4.8
6
+ Stable tag: 1.13.4
7
  Author URI: https://updraftplus.com
8
  Donate link: https://david.dw-perspective.org.uk/donate
9
  License: GPLv3 or later
127
 
128
  N.B. Paid versions of UpdraftPlus Backup / Restore have a version number which is 1 higher in the first digit, and has an extra component on the end, but the changelog below still applies. i.e. changes listed for 1.13.1 of the free version correspond to changes made in 2.13.1.x of the paid version.
129
 
130
+ = 1.13.4 - 08/Jun/2017 =
131
+
132
+ * FIX: Import function had a regression and was not coping with all formats
133
+ * TWEAK: When the import function failed, the error was not shown to the user
134
+
135
+ = 1.13.3 - 07/Jun/2017 =
136
+
137
+ * FIX: Revert Dropbox authentication change in 1.13.2, which was not working on all sites
138
+
139
  = 1.13.2 - 07/Jun/2017 =
140
 
141
  * TWEAK: Marked as tested and compatible on WordPress 4.8
477
 
478
 
479
  == Upgrade Notice ==
480
+ * 1.13.4: Import function had a regression and was not coping with all formats
updraftplus.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: UpdraftPlus - Backup/Restore
4
  Plugin URI: https://updraftplus.com
5
  Description: Backup and restore: take backups locally, or backup to Amazon S3, Dropbox, Google Drive, Rackspace, (S)FTP, WebDAV & email, on automatic schedules.
6
  Author: UpdraftPlus.Com, DavidAnderson
7
- Version: 1.13.2
8
  Donate link: https://david.dw-perspective.org.uk/donate
9
  License: GPLv3 or later
10
  Text Domain: updraftplus
4
  Plugin URI: https://updraftplus.com
5
  Description: Backup and restore: take backups locally, or backup to Amazon S3, Dropbox, Google Drive, Rackspace, (S)FTP, WebDAV & email, on automatic schedules.
6
  Author: UpdraftPlus.Com, DavidAnderson
7
+ Version: 1.13.4
8
  Donate link: https://david.dw-perspective.org.uk/donate
9
  License: GPLv3 or later
10
  Text Domain: updraftplus