Migration, Backup, Staging – WPvivid - Version 0.9.47

Version Description

  • Added support for Amazon S3 South Africa region.
  • Fixed: Folder would not be backed up when it's name matches regex: ^uploads.*$.
  • Successfully tested with WordPress 5.5.3.
  • Fixed some bugs in the plugin code.
  • Optimized the plugin code.
Download this release

Release Info

Developer wpvivid
Plugin Icon 128x128 Migration, Backup, Staging – WPvivid
Version 0.9.47
Comparing to
See all releases

Code changes from version 0.9.46 to 0.9.47

includes/class-wpvivid-backup.php CHANGED
@@ -85,7 +85,7 @@ class WPvivid_Backup_Task
85
  $exclude_regex[]='#^'.preg_quote($this -> transfer_path(WP_CONTENT_DIR).DIRECTORY_SEPARATOR.WPVIVID_UPLOADS_ISO_DIR, '/').'#';
86
  }
87
  $upload_dir = wp_upload_dir();
88
- $exclude_regex[]='#^'.preg_quote($this -> transfer_path($upload_dir['basedir']), '/').'#';
89
  $exclude_regex[]='#^'.preg_quote($this->transfer_path(get_theme_root()), '/').'#';
90
  }
91
 
85
  $exclude_regex[]='#^'.preg_quote($this -> transfer_path(WP_CONTENT_DIR).DIRECTORY_SEPARATOR.WPVIVID_UPLOADS_ISO_DIR, '/').'#';
86
  }
87
  $upload_dir = wp_upload_dir();
88
+ $exclude_regex[]='#^'.preg_quote($this -> transfer_path($upload_dir['basedir']), '/').'$#';
89
  $exclude_regex[]='#^'.preg_quote($this->transfer_path(get_theme_root()), '/').'#';
90
  }
91
 
includes/class-wpvivid-restore-database.php CHANGED
@@ -931,7 +931,7 @@ class WPvivid_RestoreDB
931
  $update=array();
932
  $where=array();
933
 
934
- if($row['site_id']==1)
935
  {
936
  $old_path=$row['path'];
937
  }
931
  $update=array();
932
  $where=array();
933
 
934
+ if($row['blog_id']==1)
935
  {
936
  $old_path=$row['path'];
937
  }
includes/class-wpvivid-restore.php CHANGED
@@ -294,6 +294,7 @@ class WPvivid_Restore
294
 
295
  $wpvivid_backup_pro='wpvivid-backup-pro/wpvivid-backup-pro.php';
296
  $wpvivid_backup='wpvivid-backuprestore/wpvivid-backuprestore.php';
 
297
 
298
  if (($key = array_search($wpvivid_backup_pro, $active_plugins)) !== false)
299
  {
@@ -305,6 +306,11 @@ class WPvivid_Restore
305
  unset($active_plugins[$key]);
306
  }
307
 
 
 
 
 
 
308
  if (!empty($active_plugins))
309
  {
310
  deactivate_plugins($active_plugins, true, false);
@@ -329,12 +335,14 @@ class WPvivid_Restore
329
 
330
  $wpvivid_backup_pro='wpvivid-backup-pro/wpvivid-backup-pro.php';
331
  $wpvivid_backup='wpvivid-backuprestore/wpvivid-backuprestore.php';
 
332
 
333
  $wpvivid_plugin->restore_data->write_log('Deleting all plugins','notice');
334
 
335
  $all_plugins = get_plugins();
336
  unset($all_plugins[$wpvivid_backup_pro]);
337
  unset($all_plugins[$wpvivid_backup]);
 
338
 
339
  if (!empty($all_plugins))
340
  {
294
 
295
  $wpvivid_backup_pro='wpvivid-backup-pro/wpvivid-backup-pro.php';
296
  $wpvivid_backup='wpvivid-backuprestore/wpvivid-backuprestore.php';
297
+ $wpvivid_dashboard='wpvividdashboard/wpvividdashboard.php';
298
 
299
  if (($key = array_search($wpvivid_backup_pro, $active_plugins)) !== false)
300
  {
306
  unset($active_plugins[$key]);
307
  }
308
 
309
+ if (($key = array_search($wpvivid_dashboard, $active_plugins)) !== false)
310
+ {
311
+ unset($active_plugins[$key]);
312
+ }
313
+
314
  if (!empty($active_plugins))
315
  {
316
  deactivate_plugins($active_plugins, true, false);
335
 
336
  $wpvivid_backup_pro='wpvivid-backup-pro/wpvivid-backup-pro.php';
337
  $wpvivid_backup='wpvivid-backuprestore/wpvivid-backuprestore.php';
338
+ $wpvivid_dashboard='wpvividdashboard/wpvividdashboard.php';
339
 
340
  $wpvivid_plugin->restore_data->write_log('Deleting all plugins','notice');
341
 
342
  $all_plugins = get_plugins();
343
  unset($all_plugins[$wpvivid_backup_pro]);
344
  unset($all_plugins[$wpvivid_backup]);
345
+ unset($all_plugins[$wpvivid_dashboard]);
346
 
347
  if (!empty($all_plugins))
348
  {
includes/customclass/class-wpvivid-amazons3-plus.php CHANGED
@@ -693,7 +693,14 @@ class WPvivid_AMAZONS3Class extends WPvivid_Remote{
693
  $this->bucket = $path_temp;
694
  $this->options['s3Path'] = '';
695
  }
696
- $amazons3 = new WPvivid_Base_S3($this->options['access'],$this->options['secret']);
 
 
 
 
 
 
 
697
 
698
  $amazons3 -> setExceptions();
699
  if($this->options['classMode'])
@@ -714,7 +721,13 @@ class WPvivid_AMAZONS3Class extends WPvivid_Remote{
714
  else
715
  {
716
  $this->bucket= $this->options['bucket'];
717
- $amazons3 = new WPvivid_Base_S3($this->options['access'],$this->options['secret']);
 
 
 
 
 
 
718
  $amazons3 -> setExceptions();
719
  if($this->options['classMode'])
720
  $amazons3 -> setStorageClass();
@@ -771,6 +784,9 @@ class WPvivid_AMAZONS3Class extends WPvivid_Remote{
771
  case 'cn-north-1':
772
  $endpoint = 's3.'.$region.'.amazonaws.com.cn';
773
  break;
 
 
 
774
  default:
775
  $endpoint = 's3.amazonaws.com';
776
  break;
693
  $this->bucket = $path_temp;
694
  $this->options['s3Path'] = '';
695
  }
696
+
697
+ if(isset($this->options['is_encrypt']) && $this->options['is_encrypt'] == 1){
698
+ $secret = base64_decode($this->options['secret']);
699
+ }
700
+ else {
701
+ $secret = $this->options['secret'];
702
+ }
703
+ $amazons3 = new WPvivid_Base_S3($this->options['access'],$secret);
704
 
705
  $amazons3 -> setExceptions();
706
  if($this->options['classMode'])
721
  else
722
  {
723
  $this->bucket= $this->options['bucket'];
724
+ if(isset($this->options['is_encrypt']) && $this->options['is_encrypt'] == 1){
725
+ $secret = base64_decode($this->options['secret']);
726
+ }
727
+ else {
728
+ $secret = $this->options['secret'];
729
+ }
730
+ $amazons3 = new WPvivid_Base_S3($this->options['access'],$secret);
731
  $amazons3 -> setExceptions();
732
  if($this->options['classMode'])
733
  $amazons3 -> setStorageClass();
784
  case 'cn-north-1':
785
  $endpoint = 's3.'.$region.'.amazonaws.com.cn';
786
  break;
787
+ case 'af-south-1':
788
+ $endpoint = 's3.'.$region.'.amazonaws.com';
789
+ break;
790
  default:
791
  $endpoint = 's3.amazonaws.com';
792
  break;
includes/customclass/class-wpvivid-dropbox.php CHANGED
@@ -313,7 +313,8 @@ class WPvivid_Dropbox extends WPvivid_Remote {
313
  return;
314
  }
315
  }
316
- $state = admin_url() . 'admin.php?page=WPvivid' . '&action=wpvivid_dropbox_finish_auth&name=' . $_GET['name'] . '&bdefault=' . $_GET['bdefault'];
 
317
  $url = Dropbox_Base::getUrl($this->redirect_url, $state);
318
  header('Location: ' . filter_var($url, FILTER_SANITIZE_URL));
319
  }
@@ -324,6 +325,13 @@ class WPvivid_Dropbox extends WPvivid_Remote {
324
  else if($_GET['action'] === 'wpvivid_dropbox_finish_auth')
325
  {
326
  try {
 
 
 
 
 
 
 
327
  if (!isset($_POST['code'])) {
328
  header('Location: ' . admin_url() . 'admin.php?page=' . WPVIVID_PLUGIN_SLUG . '&action=wpvivid_dropbox_drive&result=error&resp_msg=' . 'Get Dropbox token failed.');
329
  } else {
@@ -333,6 +341,7 @@ class WPvivid_Dropbox extends WPvivid_Remote {
333
  $remote_options['name'] = $_GET['name'];
334
  $remote_options['path'] = WPVIVID_DROPBOX_DEFAULT_FOLDER;
335
  $remote_options['default'] = $_GET['bdefault'];
 
336
  $ret = $wpvivid_plugin->remote_collection->add_remote($remote_options);
337
  if ($ret['result'] == 'success') {
338
  header('Location: ' . admin_url() . 'admin.php?page=' . WPVIVID_PLUGIN_SLUG . '&action=wpvivid_dropbox_drive&result=success');
@@ -371,7 +380,7 @@ class WPvivid_Dropbox extends WPvivid_Remote {
371
  }
372
 
373
  $_GET['name'] = sanitize_text_field($_GET['name']);
374
-
375
  $remoteslist = WPvivid_Setting::get_all_remote_options();
376
  foreach ($remoteslist as $key => $value) {
377
  if (isset($value['name']) && $value['name'] == $_GET['name'] && $key != $_GET['id']) {
@@ -379,7 +388,7 @@ class WPvivid_Dropbox extends WPvivid_Remote {
379
  return;
380
  }
381
  }
382
- $state = admin_url() . 'admin.php?page=WPvivid' . '&action=wpvivid_dropbox_finish_update_auth&name=' . $_GET['name'] . '&id=' . $_GET['id'];
383
  $url = Dropbox_Base::getUrl($this->redirect_url, $state);
384
  header('Location: ' . filter_var($url, FILTER_SANITIZE_URL));
385
  }
@@ -390,6 +399,13 @@ class WPvivid_Dropbox extends WPvivid_Remote {
390
  else if($_GET['action'] === 'wpvivid_dropbox_finish_update_auth')
391
  {
392
  try {
 
 
 
 
 
 
 
393
  if (!isset($_POST['code'])) {
394
  header('Location: ' . admin_url() . 'admin.php?page=' . WPVIVID_PLUGIN_SLUG . '&action=wpvivid_dropbox_drive_update&result=error&resp_msg=' . 'Get Dropbox token failed.');
395
  } else {
@@ -398,6 +414,7 @@ class WPvivid_Dropbox extends WPvivid_Remote {
398
  $remote_options['token'] = $_POST['code'];
399
  $remote_options['name'] = $_GET['name'];
400
  $remote_options['path'] = WPVIVID_DROPBOX_DEFAULT_FOLDER;
 
401
  $ret = $wpvivid_plugin->remote_collection->update_remote($_GET['id'], $remote_options);
402
  if ($ret['result'] == 'success') {
403
  header('Location: ' . admin_url() . 'admin.php?page=' . WPVIVID_PLUGIN_SLUG . '&action=wpvivid_dropbox_drive_update&result=success');
313
  return;
314
  }
315
  }
316
+ $auth_id = uniqid('wpvivid-auth-');
317
+ $state = admin_url() . 'admin.php?page=WPvivid' . '&action=wpvivid_dropbox_finish_auth&name=' . $_GET['name'] . '&bdefault=' . $_GET['bdefault'].'&auth_id='.$auth_id;
318
  $url = Dropbox_Base::getUrl($this->redirect_url, $state);
319
  header('Location: ' . filter_var($url, FILTER_SANITIZE_URL));
320
  }
325
  else if($_GET['action'] === 'wpvivid_dropbox_finish_auth')
326
  {
327
  try {
328
+ $remoteslist = WPvivid_Setting::get_all_remote_options();
329
+ foreach ($remoteslist as $key => $value) {
330
+ if (isset($value['auth_id']) && isset($_GET['auth_id']) && $value['auth_id'] == $_GET['auth_id']) {
331
+ _e('<div class="notice notice-success is-dismissible"><p>You have authenticated the Dropbox account as your remote storage.</p></div>');
332
+ return;
333
+ }
334
+ }
335
  if (!isset($_POST['code'])) {
336
  header('Location: ' . admin_url() . 'admin.php?page=' . WPVIVID_PLUGIN_SLUG . '&action=wpvivid_dropbox_drive&result=error&resp_msg=' . 'Get Dropbox token failed.');
337
  } else {
341
  $remote_options['name'] = $_GET['name'];
342
  $remote_options['path'] = WPVIVID_DROPBOX_DEFAULT_FOLDER;
343
  $remote_options['default'] = $_GET['bdefault'];
344
+ $remote_options['auth_id'] = $_GET['auth_id'];
345
  $ret = $wpvivid_plugin->remote_collection->add_remote($remote_options);
346
  if ($ret['result'] == 'success') {
347
  header('Location: ' . admin_url() . 'admin.php?page=' . WPVIVID_PLUGIN_SLUG . '&action=wpvivid_dropbox_drive&result=success');
380
  }
381
 
382
  $_GET['name'] = sanitize_text_field($_GET['name']);
383
+ $auth_id = uniqid('wpvivid-auth-');
384
  $remoteslist = WPvivid_Setting::get_all_remote_options();
385
  foreach ($remoteslist as $key => $value) {
386
  if (isset($value['name']) && $value['name'] == $_GET['name'] && $key != $_GET['id']) {
388
  return;
389
  }
390
  }
391
+ $state = admin_url() . 'admin.php?page=WPvivid' . '&action=wpvivid_dropbox_finish_update_auth&name=' . $_GET['name'] . '&id=' . $_GET['id'].'&auth_id='.$auth_id;
392
  $url = Dropbox_Base::getUrl($this->redirect_url, $state);
393
  header('Location: ' . filter_var($url, FILTER_SANITIZE_URL));
394
  }
399
  else if($_GET['action'] === 'wpvivid_dropbox_finish_update_auth')
400
  {
401
  try {
402
+ $remoteslist = WPvivid_Setting::get_all_remote_options();
403
+ foreach ($remoteslist as $key => $value) {
404
+ if (isset($value['auth_id']) && isset($_GET['auth_id']) && $value['auth_id'] == $_GET['auth_id']) {
405
+ _e('<div class="notice notice-success is-dismissible"><p>You have successfully updated the storage alias.</p></div>');
406
+ return;
407
+ }
408
+ }
409
  if (!isset($_POST['code'])) {
410
  header('Location: ' . admin_url() . 'admin.php?page=' . WPVIVID_PLUGIN_SLUG . '&action=wpvivid_dropbox_drive_update&result=error&resp_msg=' . 'Get Dropbox token failed.');
411
  } else {
414
  $remote_options['token'] = $_POST['code'];
415
  $remote_options['name'] = $_GET['name'];
416
  $remote_options['path'] = WPVIVID_DROPBOX_DEFAULT_FOLDER;
417
+ $remote_options['auth_id'] = $_GET['auth_id'];
418
  $ret = $wpvivid_plugin->remote_collection->update_remote($_GET['id'], $remote_options);
419
  if ($ret['result'] == 'success') {
420
  header('Location: ' . admin_url() . 'admin.php?page=' . WPVIVID_PLUGIN_SLUG . '&action=wpvivid_dropbox_drive_update&result=success');
includes/customclass/class-wpvivid-ftpclass.php CHANGED
@@ -278,7 +278,12 @@ class WPvivid_FTPClass extends WPvivid_Remote{
278
  $passive =$this->options['passive'];
279
  $host = $this->options['host'];
280
  $username = $this->options['username'];
281
- $password = $this->options['password'];
 
 
 
 
 
282
  $path = $this->options['path'];
283
  $port = empty($this->options['port'])?21:$this->options['port'];
284
  $conn = $this -> do_connect($host,$username,$password,$port);
@@ -437,7 +442,12 @@ class WPvivid_FTPClass extends WPvivid_Remote{
437
  $passive =$this->options['passive'];
438
  $host = $this->options['host'];
439
  $username = $this->options['username'];
440
- $password = $this->options['password'];
 
 
 
 
 
441
  $path = $this->options['path'];
442
  $port = empty($this->options['port'])?21:$this->options['port'];
443
 
@@ -546,7 +556,12 @@ class WPvivid_FTPClass extends WPvivid_Remote{
546
  $passive = $this->options['passive'];
547
  $host = $this->options['host'];
548
  $username = $this->options['username'];
549
- $password = $this->options['password'];
 
 
 
 
 
550
  $path = $this->options['path'];
551
  $port = empty($this->options['port']) ? 21 : $this->options['port'];
552
 
@@ -616,7 +631,12 @@ class WPvivid_FTPClass extends WPvivid_Remote{
616
  public function cleanup($file){
617
  $host = $this->options['host'];
618
  $username = $this->options['username'];
619
- $password = $this->options['password'];
 
 
 
 
 
620
  $path = $this->options['path'];
621
  $port = empty($this->options['port'])?21:$this->options['port'];
622
 
278
  $passive =$this->options['passive'];
279
  $host = $this->options['host'];
280
  $username = $this->options['username'];
281
+ if(isset($this->options['is_encrypt']) && $this->options['is_encrypt'] == 1){
282
+ $password = base64_decode($this->options['password']);
283
+ }
284
+ else {
285
+ $password = $this->options['password'];
286
+ }
287
  $path = $this->options['path'];
288
  $port = empty($this->options['port'])?21:$this->options['port'];
289
  $conn = $this -> do_connect($host,$username,$password,$port);
442
  $passive =$this->options['passive'];
443
  $host = $this->options['host'];
444
  $username = $this->options['username'];
445
+ if(isset($this->options['is_encrypt']) && $this->options['is_encrypt'] == 1){
446
+ $password = base64_decode($this->options['password']);
447
+ }
448
+ else {
449
+ $password = $this->options['password'];
450
+ }
451
  $path = $this->options['path'];
452
  $port = empty($this->options['port'])?21:$this->options['port'];
453
 
556
  $passive = $this->options['passive'];
557
  $host = $this->options['host'];
558
  $username = $this->options['username'];
559
+ if(isset($this->options['is_encrypt']) && $this->options['is_encrypt'] == 1){
560
+ $password = base64_decode($this->options['password']);
561
+ }
562
+ else {
563
+ $password = $this->options['password'];
564
+ }
565
  $path = $this->options['path'];
566
  $port = empty($this->options['port']) ? 21 : $this->options['port'];
567
 
631
  public function cleanup($file){
632
  $host = $this->options['host'];
633
  $username = $this->options['username'];
634
+ if(isset($this->options['is_encrypt']) && $this->options['is_encrypt'] == 1){
635
+ $password = base64_decode($this->options['password']);
636
+ }
637
+ else {
638
+ $password = $this->options['password'];
639
+ }
640
  $path = $this->options['path'];
641
  $port = empty($this->options['port'])?21:$this->options['port'];
642
 
includes/customclass/class-wpvivid-google-drive.php CHANGED
@@ -80,6 +80,7 @@ class Wpvivid_Google_drive extends WPvivid_Remote
80
  }
81
 
82
  $_GET['name']=sanitize_text_field($_GET['name']);
 
83
 
84
  $remoteslist=WPvivid_Setting::get_all_remote_options();
85
  foreach ($remoteslist as $key=>$value)
@@ -102,7 +103,7 @@ class Wpvivid_Google_drive extends WPvivid_Remote
102
  $client->setApprovalPrompt('force');
103
  $client->addScope(Google_Service_Drive::DRIVE_FILE);
104
  $client->setAccessType('offline');
105
- $client->setState(admin_url() . 'admin.php?page=WPvivid' . '&action=wpvivid_google_drive_finish_auth&name=' . $_GET['name'] . '&default=' . $_GET['default']);
106
  $auth_url = $client->createAuthUrl();
107
  header('Location: ' . filter_var($auth_url, FILTER_SANITIZE_URL));
108
  }
@@ -129,6 +130,13 @@ class Wpvivid_Google_drive extends WPvivid_Remote
129
 
130
  return;
131
  }
 
 
 
 
 
 
 
132
  if(isset($_POST) && !empty($_POST) && !isset($_POST['refresh_token']))
133
  {
134
  $err = 'No refresh token was received from Google, which means that you entered client secret incorrectly, or that you did not re-authenticated yet after you corrected it. Please authenticate again.';
@@ -149,6 +157,7 @@ class Wpvivid_Google_drive extends WPvivid_Remote
149
  $remote_options['name'] = $_GET['name'];
150
  $remote_options['default'] = $_GET['default'];
151
  $remote_options['path'] = WPVIVID_GOOGLEDRIVE_DEFAULT_FOLDER;
 
152
  $ret = $wpvivid_plugin->remote_collection->add_remote($remote_options);
153
 
154
  if ($ret['result'] == 'success') {
@@ -187,6 +196,7 @@ class Wpvivid_Google_drive extends WPvivid_Remote
187
  }
188
 
189
  $_GET['name']=sanitize_text_field($_GET['name']);
 
190
 
191
  $remoteslist=WPvivid_Setting::get_all_remote_options();
192
  foreach ($remoteslist as $key=>$value)
@@ -205,7 +215,7 @@ class Wpvivid_Google_drive extends WPvivid_Remote
205
  $client->setApprovalPrompt('force');
206
  $client->addScope(Google_Service_Drive::DRIVE_FILE);
207
  $client->setAccessType('offline');
208
- $client->setState(admin_url() . 'admin.php?page=WPvivid' . '&action=wpvivid_google_drive_finish_update_auth&name=' . $_GET['name'] . '&id=' . $_GET['id']);
209
  $auth_url = $client->createAuthUrl();
210
  header('Location: ' . filter_var($auth_url, FILTER_SANITIZE_URL));
211
  }
@@ -232,6 +242,13 @@ class Wpvivid_Google_drive extends WPvivid_Remote
232
 
233
  return;
234
  }
 
 
 
 
 
 
 
235
 
236
  global $wpvivid_plugin;
237
 
@@ -244,6 +261,7 @@ class Wpvivid_Google_drive extends WPvivid_Remote
244
  $remote_options['token']['created'] = $_POST['created'];
245
  $remote_options['name'] = $_GET['name'];
246
  $remote_options['path'] = WPVIVID_GOOGLEDRIVE_DEFAULT_FOLDER;
 
247
  $ret = $wpvivid_plugin->remote_collection->update_remote($_GET['id'], $remote_options);
248
 
249
  if ($ret['result'] == 'success') {
80
  }
81
 
82
  $_GET['name']=sanitize_text_field($_GET['name']);
83
+ $auth_id = uniqid('wpvivid-auth-');
84
 
85
  $remoteslist=WPvivid_Setting::get_all_remote_options();
86
  foreach ($remoteslist as $key=>$value)
103
  $client->setApprovalPrompt('force');
104
  $client->addScope(Google_Service_Drive::DRIVE_FILE);
105
  $client->setAccessType('offline');
106
+ $client->setState(admin_url() . 'admin.php?page=WPvivid' . '&action=wpvivid_google_drive_finish_auth&name=' . $_GET['name'] . '&default=' . $_GET['default'].'&auth_id='.$auth_id);
107
  $auth_url = $client->createAuthUrl();
108
  header('Location: ' . filter_var($auth_url, FILTER_SANITIZE_URL));
109
  }
130
 
131
  return;
132
  }
133
+ $remoteslist = WPvivid_Setting::get_all_remote_options();
134
+ foreach ($remoteslist as $key => $value) {
135
+ if (isset($value['auth_id']) && isset($_GET['auth_id']) && $value['auth_id'] == $_GET['auth_id']) {
136
+ _e('<div class="notice notice-success is-dismissible"><p>You have authenticated the Google Drive account as your remote storage.</p></div>');
137
+ return;
138
+ }
139
+ }
140
  if(isset($_POST) && !empty($_POST) && !isset($_POST['refresh_token']))
141
  {
142
  $err = 'No refresh token was received from Google, which means that you entered client secret incorrectly, or that you did not re-authenticated yet after you corrected it. Please authenticate again.';
157
  $remote_options['name'] = $_GET['name'];
158
  $remote_options['default'] = $_GET['default'];
159
  $remote_options['path'] = WPVIVID_GOOGLEDRIVE_DEFAULT_FOLDER;
160
+ $remote_options['auth_id'] = $_GET['auth_id'];
161
  $ret = $wpvivid_plugin->remote_collection->add_remote($remote_options);
162
 
163
  if ($ret['result'] == 'success') {
196
  }
197
 
198
  $_GET['name']=sanitize_text_field($_GET['name']);
199
+ $auth_id = uniqid('wpvivid-auth-');
200
 
201
  $remoteslist=WPvivid_Setting::get_all_remote_options();
202
  foreach ($remoteslist as $key=>$value)
215
  $client->setApprovalPrompt('force');
216
  $client->addScope(Google_Service_Drive::DRIVE_FILE);
217
  $client->setAccessType('offline');
218
+ $client->setState(admin_url() . 'admin.php?page=WPvivid' . '&action=wpvivid_google_drive_finish_update_auth&name=' . $_GET['name'] . '&id=' . $_GET['id'].'&auth_id='.$auth_id);
219
  $auth_url = $client->createAuthUrl();
220
  header('Location: ' . filter_var($auth_url, FILTER_SANITIZE_URL));
221
  }
242
 
243
  return;
244
  }
245
+ $remoteslist = WPvivid_Setting::get_all_remote_options();
246
+ foreach ($remoteslist as $key => $value) {
247
+ if (isset($value['auth_id']) && isset($_GET['auth_id']) && $value['auth_id'] == $_GET['auth_id']) {
248
+ _e('<div class="notice notice-success is-dismissible"><p>You have successfully updated the storage alias.</p></div>');
249
+ return;
250
+ }
251
+ }
252
 
253
  global $wpvivid_plugin;
254
 
261
  $remote_options['token']['created'] = $_POST['created'];
262
  $remote_options['name'] = $_GET['name'];
263
  $remote_options['path'] = WPVIVID_GOOGLEDRIVE_DEFAULT_FOLDER;
264
+ $remote_options['auth_id'] = $_GET['auth_id'];
265
  $ret = $wpvivid_plugin->remote_collection->update_remote($_GET['id'], $remote_options);
266
 
267
  if ($ret['result'] == 'success') {
includes/customclass/class-wpvivid-one-drive.php CHANGED
@@ -91,12 +91,14 @@ class WPvivid_one_drive extends WPvivid_Remote
91
  }
92
  }
93
 
 
 
94
  $url = 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize'
95
  . '?client_id=' . urlencode('37668be9-b55f-458f-b6a3-97e6f8aa10c9')
96
  . '&scope=' . urlencode('offline_access files.readwrite')
97
  . '&response_type=code'
98
  . '&redirect_uri=' . urlencode('https://auth.wpvivid.com/onedrive_v2/')
99
- . '&state=' . urlencode(admin_url() . 'admin.php?page=WPvivid' . '&action=wpvivid_one_drive_finish_auth&name=' . $_GET['name'] . '&default=' . $_GET['default'])
100
  . '&display=popup'
101
  . '&locale=en';
102
  header('Location: ' . esc_url_raw($url));
@@ -116,6 +118,14 @@ class WPvivid_one_drive extends WPvivid_Remote
116
  return;
117
  }
118
 
 
 
 
 
 
 
 
 
119
  global $wpvivid_plugin;
120
 
121
  $remote_options['type'] = WPVIVID_REMOTE_ONEDRIVE;
@@ -126,6 +136,7 @@ class WPvivid_one_drive extends WPvivid_Remote
126
  $remote_options['name'] = $_GET['name'];
127
  $remote_options['default'] = $_GET['default'];
128
  $remote_options['path'] = WPVIVID_ONEDRIVE_DEFAULT_FOLDER;
 
129
  $ret = $wpvivid_plugin->remote_collection->add_remote($remote_options);
130
 
131
  if ($ret['result'] == 'success') {
@@ -164,7 +175,7 @@ class WPvivid_one_drive extends WPvivid_Remote
164
  }
165
 
166
  $_GET['name'] = sanitize_text_field($_GET['name']);
167
-
168
  $remoteslist = WPvivid_Setting::get_all_remote_options();
169
  foreach ($remoteslist as $key => $value) {
170
  if (isset($value['name']) && $value['name'] == $_GET['name'] && $key != $_GET['id']) {
@@ -178,7 +189,7 @@ class WPvivid_one_drive extends WPvivid_Remote
178
  . '&scope=' . urlencode('offline_access files.readwrite')
179
  . '&response_type=code'
180
  . '&redirect_uri=' . urlencode('https://auth.wpvivid.com/onedrive_v2/')
181
- . '&state=' . urlencode(admin_url() . 'admin.php?page=WPvivid' . '&action=wpvivid_one_drive_update_finish_auth&name=' . $_GET['name'] . '&id=' . $_GET['id'])
182
  . '&display=popup'
183
  . '&locale=en';
184
  header('Location: ' . esc_url_raw($url));
@@ -197,6 +208,14 @@ class WPvivid_one_drive extends WPvivid_Remote
197
  return;
198
  }
199
 
 
 
 
 
 
 
 
 
200
  global $wpvivid_plugin;
201
 
202
  $remote_options['type'] = WPVIVID_REMOTE_ONEDRIVE;
@@ -205,6 +224,7 @@ class WPvivid_one_drive extends WPvivid_Remote
205
  $remote_options['token']['expires']=time()+$_POST['expires_in'];
206
  $remote_options['name'] = $_GET['name'];
207
  $remote_options['path'] = WPVIVID_ONEDRIVE_DEFAULT_FOLDER;
 
208
  $ret = $wpvivid_plugin->remote_collection->update_remote($_GET['id'], $remote_options);
209
 
210
  if ($ret['result'] == 'success') {
91
  }
92
  }
93
 
94
+ $auth_id = uniqid('wpvivid-auth-');
95
+
96
  $url = 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize'
97
  . '?client_id=' . urlencode('37668be9-b55f-458f-b6a3-97e6f8aa10c9')
98
  . '&scope=' . urlencode('offline_access files.readwrite')
99
  . '&response_type=code'
100
  . '&redirect_uri=' . urlencode('https://auth.wpvivid.com/onedrive_v2/')
101
+ . '&state=' . urlencode(admin_url() . 'admin.php?page=WPvivid' . '&action=wpvivid_one_drive_finish_auth&name=' . $_GET['name'] . '&default=' . $_GET['default'].'&auth_id='.$auth_id)
102
  . '&display=popup'
103
  . '&locale=en';
104
  header('Location: ' . esc_url_raw($url));
118
  return;
119
  }
120
 
121
+ $remoteslist = WPvivid_Setting::get_all_remote_options();
122
+ foreach ($remoteslist as $key => $value) {
123
+ if (isset($value['auth_id']) && isset($_GET['auth_id']) && $value['auth_id'] == $_GET['auth_id']) {
124
+ _e('<div class="notice notice-success is-dismissible"><p>You have authenticated the Microsoft OneDrive account as your remote storage.</p></div>');
125
+ return;
126
+ }
127
+ }
128
+
129
  global $wpvivid_plugin;
130
 
131
  $remote_options['type'] = WPVIVID_REMOTE_ONEDRIVE;
136
  $remote_options['name'] = $_GET['name'];
137
  $remote_options['default'] = $_GET['default'];
138
  $remote_options['path'] = WPVIVID_ONEDRIVE_DEFAULT_FOLDER;
139
+ $remote_options['auth_id'] = $_GET['auth_id'];
140
  $ret = $wpvivid_plugin->remote_collection->add_remote($remote_options);
141
 
142
  if ($ret['result'] == 'success') {
175
  }
176
 
177
  $_GET['name'] = sanitize_text_field($_GET['name']);
178
+ $auth_id = uniqid('wpvivid-auth-');
179
  $remoteslist = WPvivid_Setting::get_all_remote_options();
180
  foreach ($remoteslist as $key => $value) {
181
  if (isset($value['name']) && $value['name'] == $_GET['name'] && $key != $_GET['id']) {
189
  . '&scope=' . urlencode('offline_access files.readwrite')
190
  . '&response_type=code'
191
  . '&redirect_uri=' . urlencode('https://auth.wpvivid.com/onedrive_v2/')
192
+ . '&state=' . urlencode(admin_url() . 'admin.php?page=WPvivid' . '&action=wpvivid_one_drive_update_finish_auth&name=' . $_GET['name'] . '&id=' . $_GET['id'].'&auth_id='.$auth_id)
193
  . '&display=popup'
194
  . '&locale=en';
195
  header('Location: ' . esc_url_raw($url));
208
  return;
209
  }
210
 
211
+ $remoteslist = WPvivid_Setting::get_all_remote_options();
212
+ foreach ($remoteslist as $key => $value) {
213
+ if (isset($value['auth_id']) && isset($_GET['auth_id']) && $value['auth_id'] == $_GET['auth_id']) {
214
+ _e('<div class="notice notice-success is-dismissible"><p>You have successfully updated the storage alias.</p></div>');
215
+ return;
216
+ }
217
+ }
218
+
219
  global $wpvivid_plugin;
220
 
221
  $remote_options['type'] = WPVIVID_REMOTE_ONEDRIVE;
224
  $remote_options['token']['expires']=time()+$_POST['expires_in'];
225
  $remote_options['name'] = $_GET['name'];
226
  $remote_options['path'] = WPVIVID_ONEDRIVE_DEFAULT_FOLDER;
227
+ $remote_options['auth_id'] = $_GET['auth_id'];
228
  $ret = $wpvivid_plugin->remote_collection->update_remote($_GET['id'], $remote_options);
229
 
230
  if ($ret['result'] == 'success') {
includes/customclass/class-wpvivid-s3compat.php CHANGED
@@ -64,12 +64,18 @@ class Wpvivid_S3Compat extends WPvivid_Remote{
64
  $this -> bucket=$this->options['bucket'];
65
  }
66
 
 
 
 
 
 
 
67
  include_once WPVIVID_PLUGIN_DIR.'/vendor/autoload.php';
68
  $s3compat = S3Client::factory(
69
  array(
70
  'credentials' => array(
71
  'key' => $this -> options['access'],
72
- 'secret' => $this -> options['secret'],
73
  ),
74
  'version' => 'latest',
75
  'region' => $this -> region,
64
  $this -> bucket=$this->options['bucket'];
65
  }
66
 
67
+ if(isset($this->options['is_encrypt']) && $this->options['is_encrypt'] == 1){
68
+ $secret = base64_decode($this->options['secret']);
69
+ }
70
+ else {
71
+ $secret = $this->options['secret'];
72
+ }
73
  include_once WPVIVID_PLUGIN_DIR.'/vendor/autoload.php';
74
  $s3compat = S3Client::factory(
75
  array(
76
  'credentials' => array(
77
  'key' => $this -> options['access'],
78
+ 'secret' => $secret,
79
  ),
80
  'version' => 'latest',
81
  'region' => $this -> region,
includes/customclass/class-wpvivid-sftpclass.php CHANGED
@@ -268,7 +268,12 @@ class WPvivid_SFTPClass extends WPvivid_Remote{
268
  {
269
  $host = $this->options['host'];
270
  $username = $this->options['username'];
271
- $password = $this->options['password'];
 
 
 
 
 
272
  $path = $this->options['path'];
273
 
274
  $port = empty($this->options['port'])?22:$this->options['port'];
@@ -435,7 +440,12 @@ class WPvivid_SFTPClass extends WPvivid_Remote{
435
  $this->options['port'] = 22;
436
  $host = $this->options['host'];
437
  $username = $this->options['username'];
438
- $password = $this->options['password'];
 
 
 
 
 
439
  $path = $this->options['path'];
440
  $port = $this->options['port'];
441
 
@@ -522,7 +532,12 @@ class WPvivid_SFTPClass extends WPvivid_Remote{
522
 
523
  $host = $this->options['host'];
524
  $username = $this->options['username'];
525
- $password = $this->options['password'];
 
 
 
 
 
526
  $path = $this->options['path'];
527
  $port = empty($this->options['port']) ? 22 : $this->options['port'];
528
  $local_path = trailingslashit($local_path) . $file['file_name'];
@@ -576,7 +591,12 @@ class WPvivid_SFTPClass extends WPvivid_Remote{
576
  public function delete($remote,$files){
577
  $host = $remote['options']['host'];
578
  $username = $remote['options']['username'];
579
- $password = $remote['options']['password'];
 
 
 
 
 
580
  $path = $remote['options']['path'];
581
  $port = empty($remote['options']['port'])?22:$remote['options']['port'];
582
 
268
  {
269
  $host = $this->options['host'];
270
  $username = $this->options['username'];
271
+ if(isset($this->options['is_encrypt']) && $this->options['is_encrypt'] == 1){
272
+ $password = base64_decode($this->options['password']);
273
+ }
274
+ else {
275
+ $password = $this->options['password'];
276
+ }
277
  $path = $this->options['path'];
278
 
279
  $port = empty($this->options['port'])?22:$this->options['port'];
440
  $this->options['port'] = 22;
441
  $host = $this->options['host'];
442
  $username = $this->options['username'];
443
+ if(isset($this->options['is_encrypt']) && $this->options['is_encrypt'] == 1){
444
+ $password = base64_decode($this->options['password']);
445
+ }
446
+ else {
447
+ $password = $this->options['password'];
448
+ }
449
  $path = $this->options['path'];
450
  $port = $this->options['port'];
451
 
532
 
533
  $host = $this->options['host'];
534
  $username = $this->options['username'];
535
+ if(isset($this->options['is_encrypt']) && $this->options['is_encrypt'] == 1){
536
+ $password = base64_decode($this->options['password']);
537
+ }
538
+ else {
539
+ $password = $this->options['password'];
540
+ }
541
  $path = $this->options['path'];
542
  $port = empty($this->options['port']) ? 22 : $this->options['port'];
543
  $local_path = trailingslashit($local_path) . $file['file_name'];
591
  public function delete($remote,$files){
592
  $host = $remote['options']['host'];
593
  $username = $remote['options']['username'];
594
+ if(isset($remote['options']['is_encrypt']) && $remote['options']['is_encrypt'] == 1){
595
+ $password = base64_decode($remote['options']['password']);
596
+ }
597
+ else {
598
+ $password = $remote['options']['password'];
599
+ }
600
  $path = $remote['options']['path'];
601
  $port = empty($remote['options']['port'])?22:$remote['options']['port'];
602
 
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: wpvivid
3
  Tags: move, clone, migrate, cleaner, backup, restore, auto backup, cloud backup
4
  Requires at least: 4.5
5
- Tested up to: 5.5.1
6
  Requires PHP: 5.3
7
- Stable tag: 0.9.46
8
  License: GPLv3 or later
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
10
 
@@ -185,6 +185,12 @@ Thank you for translating WPvivid Backup Plugin to your languages!
185
  * Valentin Lyong (Bulgarian)
186
 
187
  == Changelog ==
 
 
 
 
 
 
188
  = 0.9.46 =
189
  - Fixed: Some special characters in database could not be restored properly.
190
  - Fixed: Only 1000 backups stored on Amazon S3 could be displayed.
2
  Contributors: wpvivid
3
  Tags: move, clone, migrate, cleaner, backup, restore, auto backup, cloud backup
4
  Requires at least: 4.5
5
+ Tested up to: 5.5.3
6
  Requires PHP: 5.3
7
+ Stable tag: 0.9.47
8
  License: GPLv3 or later
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
10
 
185
  * Valentin Lyong (Bulgarian)
186
 
187
  == Changelog ==
188
+ = 0.9.47 =
189
+ - Added support for Amazon S3 South Africa region.
190
+ - Fixed: Folder would not be backed up when it's name matches regex: ^uploads.*$.
191
+ - Successfully tested with WordPress 5.5.3.
192
+ - Fixed some bugs in the plugin code.
193
+ - Optimized the plugin code.
194
  = 0.9.46 =
195
  - Fixed: Some special characters in database could not be restored properly.
196
  - Fixed: Only 1000 backups stored on Amazon S3 could be displayed.
wpvivid-backuprestore.php CHANGED
@@ -7,7 +7,7 @@
7
  * @wordpress-plugin
8
  * Plugin Name: WPvivid Backup Plugin
9
  * Description: Clone or copy WP sites then move or migrate them to new host (new domain), schedule backups, transfer backups to leading remote storage. All in one.
10
- * Version: 0.9.46
11
  * Author: WPvivid Team
12
  * Author URI: https://wpvivid.com
13
  * License: GPL-3.0+
@@ -21,7 +21,7 @@ if ( ! defined( 'WPINC' ) ) {
21
  die;
22
  }
23
 
24
- define( 'WPVIVID_PLUGIN_VERSION', '0.9.46' );
25
  //
26
  define('WPVIVID_RESTORE_INIT','init');
27
  define('WPVIVID_RESTORE_READY','ready');
7
  * @wordpress-plugin
8
  * Plugin Name: WPvivid Backup Plugin
9
  * Description: Clone or copy WP sites then move or migrate them to new host (new domain), schedule backups, transfer backups to leading remote storage. All in one.
10
+ * Version: 0.9.47
11
  * Author: WPvivid Team
12
  * Author URI: https://wpvivid.com
13
  * License: GPL-3.0+
21
  die;
22
  }
23
 
24
+ define( 'WPVIVID_PLUGIN_VERSION', '0.9.47' );
25
  //
26
  define('WPVIVID_RESTORE_INIT','init');
27
  define('WPVIVID_RESTORE_READY','ready');