Backup & Restore Dropbox - Version 1.4.7.5

Version Description

Please, keep your Dropbox Backup and Restore plugin up-to-date.

Download this release

Release Info

Developer backup-dropbox
Plugin Icon 128x128 Backup & Restore Dropbox
Version 1.4.7.5
Comparing to
See all releases

Code changes from version 1.4.7.3 to 1.4.7.5

dropbox-backup.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Dropbox Backup & Restore
4
  Description: Dropbox Backup & Restore Plugin to create Dropbox Full Backup (Files + Database) of your Web Page
5
- Version: 1.4.7.3
6
  Text Domain: dropbox-backup
7
  Domain Path: /languages/
8
  */
2
  /*
3
  Plugin Name: Dropbox Backup & Restore
4
  Description: Dropbox Backup & Restore Plugin to create Dropbox Full Backup (Files + Database) of your Web Page
5
+ Version: 1.4.7.5
6
  Text Domain: dropbox-backup
7
  Domain Path: /languages/
8
  */
img/closebox.png ADDED
Binary file
img/how-to-enable-cron.png ADDED
Binary file
libs/wpadm.server.main.class.php CHANGED
@@ -46,7 +46,7 @@
46
  {
47
  self::$backup = $b;
48
  }
49
- public static function error_log_check()
50
  {
51
  $base_path = plugin_dir_path( dirname(__FILE__) );
52
  $time = isset($_POST['time_pars']) ? $_POST['time_pars'] : "";
@@ -132,17 +132,21 @@
132
  'mail_admin' => get_option('admin_email'),
133
  'pass' => $pass, 'error_backup' => $error_backup,
134
  'msg_ajax' => isset($_POST['msg_ajax']) ? trim($_POST['msg_ajax']) : '',
135
- 'error' => $error_system)
 
 
136
  )
137
  );
138
 
139
  $res = self::sendToServer(array('actApi' => "errorLog",
140
  "site" => str_ireplace(array("http://","https://"), "", home_url()),
141
  "data" => $logs_report )
142
- );
143
- $_SESSION['sent_response'] = __('Your request was sent. <br /> Thank you for your assistance.','dropbox-backup');
144
- header("Location: " . $_SERVER['HTTP_REFERER']);
145
- exit;
 
 
146
 
147
  }
148
 
@@ -151,7 +155,7 @@
151
  $n = count($arr);
152
  $in = array();
153
  for($i = 0; $i < $n; $i++) {
154
-
155
  if (strpos($arr[$i], ABSPATH ) !== false) {
156
  $arr[$i] = str_replace(ABSPATH, '', $arr[$i]);
157
  }
@@ -167,7 +171,8 @@
167
  }
168
  public static function getDirsIncludes()
169
  {
170
- $path = isset($_POST['path']) ? $_POST['path'] : "";
 
171
  $path_show = !empty($path) ? ltrim($path, '/') . "/" : "";
172
  $dir_to_open = ABSPATH . $path;
173
  if (is_dir($dir_to_open)) {
@@ -195,11 +200,10 @@
195
  $check = true;
196
  $check_folder = urlencode( $in['/' . trim($path_show, '/')] );
197
  }
198
-
199
  $return['dir'][] = array('is_file' => is_file($dir_to_open . "/$d"), 'dir' => urlencode( $d ) , 'cache' => md5($path_show . $d), 'folder'=> urlencode('/' . $path_show . $d ), 'perm' => self::perm($dir_to_open . "/" .$d), 'check' => $check, 'check_folder' => $check_folder );
200
  }
201
  }
202
- //var_dump( $f_d );
203
  $res = json_encode($return);
204
  echo $res;
205
  if ($res === false) {
@@ -360,7 +364,6 @@
360
  if (isset($_POST['save']) && isset($_POST['data'])) {
361
  $_POST['data'] = array_map('ltrimslashes', array_unique( array_filter( $_POST['data'] ) ) );
362
  $data_save = implode(',', $_POST['data'] );
363
- // var_dump($data_save);
364
  $inludes = get_option(PREFIX_BACKUP_ . "plus-path");
365
  if ($inludes !== false) {
366
  update_option(PREFIX_BACKUP_ . "plus-path", $data_save);
@@ -631,7 +634,16 @@
631
  $name = preg_replace("|\W|", "_", $name);
632
  $name .= '-' . self::$type . '-' . date("Y_m_d_H_i");
633
 
 
 
634
  $dir_backup = DROPBOX_BACKUP_DIR_BACKUP ;
 
 
 
 
 
 
 
635
 
636
  $backups = array('data' => array(), 'md5' => '');
637
 
46
  {
47
  self::$backup = $b;
48
  }
49
+ public static function error_log_check($msg = '')
50
  {
51
  $base_path = plugin_dir_path( dirname(__FILE__) );
52
  $time = isset($_POST['time_pars']) ? $_POST['time_pars'] : "";
132
  'mail_admin' => get_option('admin_email'),
133
  'pass' => $pass, 'error_backup' => $error_backup,
134
  'msg_ajax' => isset($_POST['msg_ajax']) ? trim($_POST['msg_ajax']) : '',
135
+ 'error' => $error_system,
136
+ 'msg' => $msg,
137
+ )
138
  )
139
  );
140
 
141
  $res = self::sendToServer(array('actApi' => "errorLog",
142
  "site" => str_ireplace(array("http://","https://"), "", home_url()),
143
  "data" => $logs_report )
144
+ );
145
+ if ( empty($msg) ) {
146
+ $_SESSION['sent_response'] = __('Your request was sent. <br /> Thank you for your assistance.','dropbox-backup');
147
+ header("Location: " . $_SERVER['HTTP_REFERER']);
148
+ exit;
149
+ }
150
 
151
  }
152
 
155
  $n = count($arr);
156
  $in = array();
157
  for($i = 0; $i < $n; $i++) {
158
+
159
  if (strpos($arr[$i], ABSPATH ) !== false) {
160
  $arr[$i] = str_replace(ABSPATH, '', $arr[$i]);
161
  }
171
  }
172
  public static function getDirsIncludes()
173
  {
174
+
175
+ $path = isset($_POST['path']) ? ltrim( urldecode($_POST['path']), '/' ) : "";
176
  $path_show = !empty($path) ? ltrim($path, '/') . "/" : "";
177
  $dir_to_open = ABSPATH . $path;
178
  if (is_dir($dir_to_open)) {
200
  $check = true;
201
  $check_folder = urlencode( $in['/' . trim($path_show, '/')] );
202
  }
203
+
204
  $return['dir'][] = array('is_file' => is_file($dir_to_open . "/$d"), 'dir' => urlencode( $d ) , 'cache' => md5($path_show . $d), 'folder'=> urlencode('/' . $path_show . $d ), 'perm' => self::perm($dir_to_open . "/" .$d), 'check' => $check, 'check_folder' => $check_folder );
205
  }
206
  }
 
207
  $res = json_encode($return);
208
  echo $res;
209
  if ($res === false) {
364
  if (isset($_POST['save']) && isset($_POST['data'])) {
365
  $_POST['data'] = array_map('ltrimslashes', array_unique( array_filter( $_POST['data'] ) ) );
366
  $data_save = implode(',', $_POST['data'] );
 
367
  $inludes = get_option(PREFIX_BACKUP_ . "plus-path");
368
  if ($inludes !== false) {
369
  update_option(PREFIX_BACKUP_ . "plus-path", $data_save);
634
  $name = preg_replace("|\W|", "_", $name);
635
  $name .= '-' . self::$type . '-' . date("Y_m_d_H_i");
636
 
637
+ $dropbox_options = get_option(PREFIX_BACKUP_ . 'dropbox-setting');
638
+
639
  $dir_backup = DROPBOX_BACKUP_DIR_BACKUP ;
640
+ if ($dropbox_options) {
641
+ $dropbox_options = unserialize( base64_decode( $dropbox_options ) );
642
+ if (isset($dropbox_options['backup_folder']) && !empty($dropbox_options['backup_folder'])) {
643
+ $dir_backup = $dropbox_options['backup_folder'];
644
+ }
645
+ }
646
+
647
 
648
  $backups = array('data' => array(), 'md5' => '');
649
 
main/wpadm-class-wp.php CHANGED
@@ -202,7 +202,7 @@
202
  public static function saveSetting()
203
  {
204
  if (isset($_POST['is_admin']) || isset($_POST['is_optimization']) || isset($_POST['is_local_backup_delete'])
205
- || isset($_POST['is_repair']) || isset($_POST['time_error']) || isset($_POST['is_show_admin_bar'] ) ) {
206
 
207
  $dropbox_options = get_option(PREFIX_BACKUP_ . 'dropbox-setting');
208
  if ($dropbox_options) {
@@ -226,6 +226,9 @@
226
  if (isset($_POST['is_show_admin_bar'])) {
227
  $dropbox_options['is_show_admin_bar'] = (int) $_POST['is_show_admin_bar'];
228
  }
 
 
 
229
  update_option(PREFIX_BACKUP_ . 'dropbox-setting', base64_encode( serialize( $dropbox_options ) ) );
230
  }
231
  }
@@ -256,20 +259,28 @@
256
 
257
  WPAdm_Process::clear();
258
 
259
- WPAdm_Core::mkdir(DROPBOX_BACKUP_DIR_BACKUP);
 
 
 
 
 
 
 
 
260
  WPAdm_Running::init_params_default();
261
  $res['result'] = 'success';
262
  if (defined('DISABLE_WP_CRON')) {
263
- if (DISABLE_WP_CRON === true) {
264
  $res['result'] = 'error';
265
- $res['error'] = __('please enable cron-tasks on your website.','dropbox-backup'); //. '<br /><a href="" target="_blank">' . __('How to enable cron-tasks on my website?','dropbox-backup') . '</a>';
266
  $res['data'] = array();
267
  $res['size'] = 0;
268
  }
269
  }
270
 
271
  if ( (isset($res['result']) && $res['result'] != 'error') ) {
272
- if ( WPAdm_Core::dir_writeble(DROPBOX_BACKUP_DIR_BACKUP) ) {
273
  WPAdm_Running::delCommandResultData("local_backup");
274
  $dropbox_options = self::getSettings();
275
  $optimization = (isset($dropbox_options['is_optimization']) && $dropbox_options['is_optimization'] == 1) || (!isset($dropbox_options['is_optimization'])) ? 1 : 0;
@@ -291,7 +302,7 @@
291
  }
292
  } else {
293
  $res['result'] = 'error';
294
- $res['error'] = str_replace(array('%domain', '%dir-backup'), array(SITE_HOME, DROPBOX_BACKUP_DIR_BACKUP), __('Website "%domain" returned an error during file creation: Failed to create file, please check the permissions on the folder "%dir-backup".','dropbox-backup') );
295
  $res['data'] = array();
296
  $res['size'] = 0;
297
  }
@@ -508,7 +519,15 @@
508
  if (isset($_POST['backup-type']) ) {
509
  if ($_POST['backup-type'] == 'local') {
510
  require_once DRBBACKUP_BASE_DIR . "/modules/class-wpadm-core.php";
511
- $dir = DROPBOX_BACKUP_DIR_BACKUP . '/' . $_POST['backup-name'] ;
 
 
 
 
 
 
 
 
512
  $delete = false;
513
  if (is_dir($dir)) {
514
  WPAdm_Core::rmdir($dir);
@@ -620,11 +639,20 @@
620
 
621
  WPAdm_Process::clear();
622
 
623
- if ( WPAdm_Core::dir_writeble(DROPBOX_BACKUP_DIR_BACKUP) ) {
624
- $dropbox_options = get_option(PREFIX_BACKUP_ . 'dropbox-setting');
 
 
 
 
 
 
 
 
 
625
  $send_to_dropbox = true;
626
  if ($dropbox_options) {
627
- $dropbox_options = unserialize( base64_decode( $dropbox_options ) );
628
  if (!isset($dropbox_options['app_key'])) {
629
  WPAdm_Core::log( str_replace('%d', SITE_HOME, __('Website "%d" returned an error during connection to Dropbox: "App Key" wasn\'t found. Please, check your Dropbox settings.' ,'dropbox-backup') ) );
630
  $send_to_dropbox = false;
@@ -644,9 +672,9 @@
644
  }
645
 
646
  if (defined('DISABLE_WP_CRON')) {
647
- if (DISABLE_WP_CRON === true) {
648
  $res['result'] = 'error';
649
- $res['error'] = __('please enable cron-task of your website.','dropbox-backup');
650
  $res['data'] = array();
651
  $res['size'] = 0;
652
  $send_to_dropbox = false;
@@ -657,9 +685,11 @@
657
  parent::$type = 'full';
658
  WPAdm_Running::init_params_default();
659
  WPAdm_Running::delCommandResultData("local_backup");
 
660
  $dropbox_options = self::getSettings();
661
  $optimization = (isset($dropbox_options['is_optimization']) && $dropbox_options['is_optimization'] == 1) || (!isset($dropbox_options['is_optimization'])) ? 1 : 0;
662
  $repair = (isset($dropbox_options['is_repair']) && $dropbox_options['is_repair'] == 1) ? 1 : 0;
 
663
  $backup_local = new WPAdm_Core(array('method' => "local_backup", 'params' => array('optimize' => $optimization, 'repair' => $repair, 'limit' => 0, 'time' => @$_POST['time'], 'types' => array('db', 'files') )), 'full_backup_dropbox', WPAdm_Core::$pl_dir);
664
  $res = array();
665
  if (WPAdm_Core::$cron === false) {
@@ -682,7 +712,8 @@
682
  'token' => $dropbox_options['auth_token_secret'],
683
  'dir' => isset($res['name']) ? $res['name'] : '',
684
  'folder' => $folder_project),
685
- 'time' => @$_POST['time'],
 
686
  )
687
  ),
688
  'full_backup_dropbox', WPAdm_Core::$pl_dir) ;
@@ -694,7 +725,7 @@
694
  $res['result'] = 'error';
695
  @rename(WPAdm_Core::getTmpDir() . "/logs2", WPAdm_Core::getTmpDir() . "/logs_error_" . $backup_local->time);
696
  }
697
- WPAdm_Core::rmdir( DROPBOX_BACKUP_DIR_BACKUP . "/{$res['name']}");
698
  } else {
699
  set_transient('running_command', 'send-to-dropbox', 0);
700
  $res['result'] = 'work';
@@ -705,7 +736,7 @@
705
  }
706
  } else {
707
  $res['result'] = 'error';
708
- $res['error'] = str_replace(array('%domain', '%dir-backup'), array(SITE_HOME, DROPBOX_BACKUP_DIR_BACKUP), __('Website "%domain" returned an error during file creation: Failed to create file, please check the permissions on the folder "%dir-backup".','dropbox-backup') );
709
  $res['data'] = array();
710
  $res['size'] = 0;
711
  }
@@ -737,7 +768,6 @@
737
  $folder_project = self::getNameProject();
738
  //$dropbox->uploadFile(dirname(__FILE__) . "/index.php", $folder_project . '/index.php', true);
739
  // $res = $dropbox->downloadFile("localhost_wp_dropbox/localhost_wp_dropbox-full-2016_06_07_14_05/localhost_wp_dropbox-full-2016_06_07_14_05.md5", DROPBOX_BACKUP_DIR_BACKUP . "/localhost_wp_dropbox-full-2016_06_07_14_05.md5");
740
- //var_dump($res);
741
  $backups = $dropbox->listing($folder_project);
742
  $n = count($backups['items']);
743
  $data['data'] = array();
@@ -820,15 +850,19 @@
820
  $name_running_backup .= '-' . wpadm_class::$type . '-' . date("Y_m_d_H_i", $running_backup['params']['time']);
821
  }
822
 
823
- if ( !file_exists( DROPBOX_BACKUP_DIR_BACKUP . '/local-key') ) {
824
- WPAdm_Core::mkdir(DROPBOX_BACKUP_DIR_BACKUP);
 
 
 
 
825
  $key = md5(time() . 'wpadm-key');
826
- file_put_contents(DROPBOX_BACKUP_DIR_BACKUP . '/local-key', wpadm_pack(array('key' => $key, 'time-update' => time() + 3600) ));
827
  } else {
828
- $key_values = wpadm_unpack( file_get_contents(DROPBOX_BACKUP_DIR_BACKUP . '/local-key') );
829
  if (isset($key_values['time-update']) && $key_values['time-update'] <= time() ) {
830
  $key = md5( time() . 'wpadm-key' );
831
- file_put_contents(DROPBOX_BACKUP_DIR_BACKUP . '/local-key', wpadm_pack( array( 'key' => $key, 'time-update' => time() + 3600 ) ) );
832
  } else {
833
  $key = $key_values['key'];
834
  }
@@ -846,7 +880,7 @@
846
  require_once $base_path . DIRECTORY_SEPARATOR . "template" . DIRECTORY_SEPARATOR . "wpadm_show_backup.php";
847
  echo ob_get_clean();
848
  }
849
-
850
  public static function draw_menu()
851
  {
852
  $show = true;
202
  public static function saveSetting()
203
  {
204
  if (isset($_POST['is_admin']) || isset($_POST['is_optimization']) || isset($_POST['is_local_backup_delete'])
205
+ || isset($_POST['is_repair']) || isset($_POST['time_error']) || isset($_POST['is_show_admin_bar'] ) || isset($_POST['backup_folder'] ) ) {
206
 
207
  $dropbox_options = get_option(PREFIX_BACKUP_ . 'dropbox-setting');
208
  if ($dropbox_options) {
226
  if (isset($_POST['is_show_admin_bar'])) {
227
  $dropbox_options['is_show_admin_bar'] = (int) $_POST['is_show_admin_bar'];
228
  }
229
+ if (isset($_POST['backup_folder'])) {
230
+ $dropbox_options['backup_folder'] = rtrim( strip_tags( stripslashes( trim( $_POST['backup_folder'] ) ) ), '/' );
231
+ }
232
  update_option(PREFIX_BACKUP_ . 'dropbox-setting', base64_encode( serialize( $dropbox_options ) ) );
233
  }
234
  }
259
 
260
  WPAdm_Process::clear();
261
 
262
+ $backup_dir = DROPBOX_BACKUP_DIR_BACKUP;
263
+ $dropbox_options = get_option(PREFIX_BACKUP_ . 'dropbox-setting');
264
+ if ($dropbox_options) {
265
+ $dropbox_options = unserialize( base64_decode( $dropbox_options ) );
266
+ if (isset($dropbox_options['backup_folder']) && !empty($dropbox_options['backup_folder'])) {
267
+ $backup_dir = $dropbox_options['backup_folder'];
268
+ }
269
+ }
270
+ WPAdm_Core::mkdir($backup_dir);
271
  WPAdm_Running::init_params_default();
272
  $res['result'] = 'success';
273
  if (defined('DISABLE_WP_CRON')) {
274
+ if (DISABLE_WP_CRON === true || DISABLE_WP_CRON == 'true') {
275
  $res['result'] = 'error';
276
+ $res['error'] = __('Please enable cron-tasks on your website.','dropbox-backup') . '<br /><br /><a href="javascript:void(0)" onclick="showEnableCron();" >' . __('How to enable cron-tasks on my website?','dropbox-backup') . '</a><br /><br />';
277
  $res['data'] = array();
278
  $res['size'] = 0;
279
  }
280
  }
281
 
282
  if ( (isset($res['result']) && $res['result'] != 'error') ) {
283
+ if ( WPAdm_Core::dir_writeble($backup_dir) ) {
284
  WPAdm_Running::delCommandResultData("local_backup");
285
  $dropbox_options = self::getSettings();
286
  $optimization = (isset($dropbox_options['is_optimization']) && $dropbox_options['is_optimization'] == 1) || (!isset($dropbox_options['is_optimization'])) ? 1 : 0;
302
  }
303
  } else {
304
  $res['result'] = 'error';
305
+ $res['error'] = str_replace(array('%domain', '%dir-backup'), array(SITE_HOME, $backup_dir), __('Website "%domain" returned an error during file creation: Failed to create file, please check the permissions on the folder "%dir-backup".','dropbox-backup') );
306
  $res['data'] = array();
307
  $res['size'] = 0;
308
  }
519
  if (isset($_POST['backup-type']) ) {
520
  if ($_POST['backup-type'] == 'local') {
521
  require_once DRBBACKUP_BASE_DIR . "/modules/class-wpadm-core.php";
522
+ $backup_dir = DROPBOX_BACKUP_DIR_BACKUP;
523
+ $dropbox_options = get_option(PREFIX_BACKUP_ . 'dropbox-setting');
524
+ if ($dropbox_options) {
525
+ $dropbox_options = unserialize( base64_decode( $dropbox_options ) );
526
+ if (isset($dropbox_options['backup_folder']) && !empty($dropbox_options['backup_folder'])) {
527
+ $backup_dir = $dropbox_options['backup_folder'];
528
+ }
529
+ }
530
+ $dir = $backup_dir . '/' . $_POST['backup-name'] ;
531
  $delete = false;
532
  if (is_dir($dir)) {
533
  WPAdm_Core::rmdir($dir);
639
 
640
  WPAdm_Process::clear();
641
 
642
+ $backup_dir = DROPBOX_BACKUP_DIR_BACKUP;
643
+ $dropbox_options = get_option(PREFIX_BACKUP_ . 'dropbox-setting');
644
+ if ($dropbox_options) {
645
+ $dropbox_options = unserialize( base64_decode( $dropbox_options ) );
646
+ if (isset($dropbox_options['backup_folder']) && !empty($dropbox_options['backup_folder'])) {
647
+ $backup_dir = $dropbox_options['backup_folder'];
648
+ }
649
+ }
650
+
651
+ if ( WPAdm_Core::dir_writeble($backup_dir) ) {
652
+ //$dropbox_options = get_option(PREFIX_BACKUP_ . 'dropbox-setting');
653
  $send_to_dropbox = true;
654
  if ($dropbox_options) {
655
+ //$dropbox_options = unserialize( base64_decode( $dropbox_options ) );
656
  if (!isset($dropbox_options['app_key'])) {
657
  WPAdm_Core::log( str_replace('%d', SITE_HOME, __('Website "%d" returned an error during connection to Dropbox: "App Key" wasn\'t found. Please, check your Dropbox settings.' ,'dropbox-backup') ) );
658
  $send_to_dropbox = false;
672
  }
673
 
674
  if (defined('DISABLE_WP_CRON')) {
675
+ if (DISABLE_WP_CRON === true || DISABLE_WP_CRON == 'true') {
676
  $res['result'] = 'error';
677
+ $res['error'] = __('Please enable cron-tasks on your website.','dropbox-backup') . '<br /><br /><a href="javascript:void(0)" onclick="showEnableCron();" >' . __('How to enable cron-tasks on my website?','dropbox-backup') . '</a><br /><br />';
678
  $res['data'] = array();
679
  $res['size'] = 0;
680
  $send_to_dropbox = false;
685
  parent::$type = 'full';
686
  WPAdm_Running::init_params_default();
687
  WPAdm_Running::delCommandResultData("local_backup");
688
+
689
  $dropbox_options = self::getSettings();
690
  $optimization = (isset($dropbox_options['is_optimization']) && $dropbox_options['is_optimization'] == 1) || (!isset($dropbox_options['is_optimization'])) ? 1 : 0;
691
  $repair = (isset($dropbox_options['is_repair']) && $dropbox_options['is_repair'] == 1) ? 1 : 0;
692
+
693
  $backup_local = new WPAdm_Core(array('method' => "local_backup", 'params' => array('optimize' => $optimization, 'repair' => $repair, 'limit' => 0, 'time' => @$_POST['time'], 'types' => array('db', 'files') )), 'full_backup_dropbox', WPAdm_Core::$pl_dir);
694
  $res = array();
695
  if (WPAdm_Core::$cron === false) {
712
  'token' => $dropbox_options['auth_token_secret'],
713
  'dir' => isset($res['name']) ? $res['name'] : '',
714
  'folder' => $folder_project),
715
+ 'time' => @$_POST['time'],
716
+ 'is_folder_set' => isset($dropbox_options['backup_folder']) && !empty($dropbox_options['backup_folder']),
717
  )
718
  ),
719
  'full_backup_dropbox', WPAdm_Core::$pl_dir) ;
725
  $res['result'] = 'error';
726
  @rename(WPAdm_Core::getTmpDir() . "/logs2", WPAdm_Core::getTmpDir() . "/logs_error_" . $backup_local->time);
727
  }
728
+ WPAdm_Core::rmdir( $backup_dir . "/{$res['name']}");
729
  } else {
730
  set_transient('running_command', 'send-to-dropbox', 0);
731
  $res['result'] = 'work';
736
  }
737
  } else {
738
  $res['result'] = 'error';
739
+ $res['error'] = str_replace(array('%domain', '%dir-backup'), array(SITE_HOME, $backup_dir), __('Website "%domain" returned an error during file creation: Failed to create file, please check the permissions on the folder "%dir-backup".','dropbox-backup') );
740
  $res['data'] = array();
741
  $res['size'] = 0;
742
  }
768
  $folder_project = self::getNameProject();
769
  //$dropbox->uploadFile(dirname(__FILE__) . "/index.php", $folder_project . '/index.php', true);
770
  // $res = $dropbox->downloadFile("localhost_wp_dropbox/localhost_wp_dropbox-full-2016_06_07_14_05/localhost_wp_dropbox-full-2016_06_07_14_05.md5", DROPBOX_BACKUP_DIR_BACKUP . "/localhost_wp_dropbox-full-2016_06_07_14_05.md5");
 
771
  $backups = $dropbox->listing($folder_project);
772
  $n = count($backups['items']);
773
  $data['data'] = array();
850
  $name_running_backup .= '-' . wpadm_class::$type . '-' . date("Y_m_d_H_i", $running_backup['params']['time']);
851
  }
852
 
853
+ $backu_dir = DROPBOX_BACKUP_DIR_BACKUP;
854
+ if (isset($dropbox_options['backup_folder']) && !empty($dropbox_options['backup_folder'])) {
855
+ $backu_dir = $dropbox_options['backup_folder'];
856
+ }
857
+ if ( !file_exists( $backu_dir . '/local-key') ) {
858
+ WPAdm_Core::mkdir($backu_dir);
859
  $key = md5(time() . 'wpadm-key');
860
+ file_put_contents($backu_dir . '/local-key', wpadm_pack(array('key' => $key, 'time-update' => time() + 3600) ));
861
  } else {
862
+ $key_values = wpadm_unpack( file_get_contents($backu_dir . '/local-key') );
863
  if (isset($key_values['time-update']) && $key_values['time-update'] <= time() ) {
864
  $key = md5( time() . 'wpadm-key' );
865
+ file_put_contents($backu_dir . '/local-key', wpadm_pack( array( 'key' => $key, 'time-update' => time() + 3600 ) ) );
866
  } else {
867
  $key = $key_values['key'];
868
  }
880
  require_once $base_path . DIRECTORY_SEPARATOR . "template" . DIRECTORY_SEPARATOR . "wpadm_show_backup.php";
881
  echo ob_get_clean();
882
  }
883
+
884
  public static function draw_menu()
885
  {
886
  $show = true;
methods/class-wpadm-method-backup-delete.php CHANGED
@@ -7,7 +7,15 @@ if (!class_exists('WPAdm_Method_Backup_Delete')) {
7
  class WPAdm_Method_Backup_Delete extends WPAdm_Method_Class {
8
  public function getResult()
9
  {
10
- $backups_dir = realpath(DROPBOX_BACKUP_DIR_BACKUP . '/' . $this->params['name']);
 
 
 
 
 
 
 
 
11
  if(strpos($backups_dir, DIRECTORY_SEPARATOR . 'DROPBOX_BACKUP_DIR_NAME' . DIRECTORY_SEPARATOR) === false || !is_dir($backups_dir)) {
12
  $this->result->setResult = WPAdm_result::WPADM_RESULT_ERROR;
13
  $this->result->setError('Wrong name backup');
7
  class WPAdm_Method_Backup_Delete extends WPAdm_Method_Class {
8
  public function getResult()
9
  {
10
+ $backup_dir = DROPBOX_BACKUP_DIR_BACKUP;
11
+ $dropbox_options = get_option(PREFIX_BACKUP_ . 'dropbox-setting');
12
+ if ($dropbox_options) {
13
+ $dropbox_options = unserialize( base64_decode( $dropbox_options ) );
14
+ if (isset($dropbox_options['backup_folder']) && !empty($dropbox_options['backup_folder'])) {
15
+ $backup_dir = $dropbox_options['backup_folder'];
16
+ }
17
+ }
18
+ $backups_dir = realpath($backup_dir . '/' . $this->params['name']);
19
  if(strpos($backups_dir, DIRECTORY_SEPARATOR . 'DROPBOX_BACKUP_DIR_NAME' . DIRECTORY_SEPARATOR) === false || !is_dir($backups_dir)) {
20
  $this->result->setResult = WPAdm_result::WPADM_RESULT_ERROR;
21
  $this->result->setError('Wrong name backup');
methods/class-wpadm-method-backup-list.php CHANGED
@@ -1,15 +1,23 @@
1
  <?php
2
  /**
3
- * Return a list of backups
4
- * Class WPAdm_Method_Exec
5
- */
6
  if (!class_exists('WPAdm_Method_Backup_List')) {
7
  class WPAdm_Method_Backup_List extends WPAdm_Method_Class {
8
  public function getResult()
9
  {
10
- $backups_dir = DROPBOX_BACKUP_DIR_BACKUP . '/';
 
 
 
 
 
 
 
 
11
  $dirs = glob($backups_dir . '*');
12
-
13
  $backups = array();
14
  foreach($dirs as $dir) {
15
  if (preg_match("|(.*)\-(.*)\-(.*)|", $dir, $mm)) {
@@ -18,9 +26,9 @@ if (!class_exists('WPAdm_Method_Backup_List')) {
18
  list($y,$m,$d, $h,$i) = explode('_', $mm[3]);
19
  $dt = "$y-$m-$d $h:$i";
20
  $backup = array(
21
- 'name' => $name,
22
- 'type' => $mm[2],
23
- 'dt' => $dt,
24
  );
25
  $files = glob($dir . '/*.zip');
26
  $size = 0;
@@ -33,13 +41,13 @@ if (!class_exists('WPAdm_Method_Backup_List')) {
33
  if ($size > 0) {
34
  $backups[] = $backup;
35
  }
36
-
37
  }
38
  }
39
  $this->result->setData($backups);
40
  $this->result->setResult(WPAdm_result::WPADM_RESULT_SUCCESS);
41
  return $this->result;
42
  }
43
-
44
  }
45
  }
1
  <?php
2
  /**
3
+ * Return a list of backups
4
+ * Class WPAdm_Method_Exec
5
+ */
6
  if (!class_exists('WPAdm_Method_Backup_List')) {
7
  class WPAdm_Method_Backup_List extends WPAdm_Method_Class {
8
  public function getResult()
9
  {
10
+ $backup_dir = DROPBOX_BACKUP_DIR_BACKUP;
11
+ $dropbox_options = get_option(PREFIX_BACKUP_ . 'dropbox-setting');
12
+ if ($dropbox_options) {
13
+ $dropbox_options = unserialize( base64_decode( $dropbox_options ) );
14
+ if (isset($dropbox_options['backup_folder']) && !empty($dropbox_options['backup_folder'])) {
15
+ $backup_dir = $dropbox_options['backup_folder'];
16
+ }
17
+ }
18
+ $backups_dir = $backup_dir . '/';
19
  $dirs = glob($backups_dir . '*');
20
+
21
  $backups = array();
22
  foreach($dirs as $dir) {
23
  if (preg_match("|(.*)\-(.*)\-(.*)|", $dir, $mm)) {
26
  list($y,$m,$d, $h,$i) = explode('_', $mm[3]);
27
  $dt = "$y-$m-$d $h:$i";
28
  $backup = array(
29
+ 'name' => $name,
30
+ 'type' => $mm[2],
31
+ 'dt' => $dt,
32
  );
33
  $files = glob($dir . '/*.zip');
34
  $size = 0;
41
  if ($size > 0) {
42
  $backups[] = $backup;
43
  }
44
+
45
  }
46
  }
47
  $this->result->setData($backups);
48
  $this->result->setResult(WPAdm_result::WPADM_RESULT_SUCCESS);
49
  return $this->result;
50
  }
51
+
52
  }
53
  }
methods/class-wpadm-method-local-backup.php CHANGED
@@ -43,16 +43,41 @@ if (!class_exists('WPAdm_Method_Local_Backup')) {
43
 
44
  // folder for backup
45
 
 
 
 
 
46
  $this->dir = DROPBOX_BACKUP_DIR_BACKUP . '/' . $name;
 
 
 
 
 
 
 
 
 
 
47
  $opt_folder = WPAdm_Running::getCommandResultData('folder_create');
48
  if (!isset($opt_folder[$name])) {
49
  if (($f = $this->checkBackup()) !== false) {
50
  $this->dir = DROPBOX_BACKUP_DIR_BACKUP . '/' . $f;
51
- }
52
- $error = WPAdm_Core::mkdir(DROPBOX_BACKUP_DIR_BACKUP);
53
- if (!empty($error)) {
54
- $this->result->setError($error);
55
- $this->result->setResult(WPAdm_Result::WPADM_RESULT_ERROR);
 
 
 
 
 
 
 
 
 
 
 
56
  }
57
  $error = WPAdm_Core::mkdir($this->dir);
58
  if (!empty($error)) {
@@ -89,6 +114,7 @@ if (!class_exists('WPAdm_Method_Local_Backup')) {
89
 
90
  # create db dump
91
  if (in_array('db', $this->params['types']) ) {
 
92
  $mysql_dump_file = DROPBOX_BACKUP_DIR_BACKUP . '/mysqldump.sql';
93
  if ( !WPAdm_Running::getCommandResult('db') ) {
94
  WPAdm_Running::setCommandResult('db');
@@ -272,7 +298,7 @@ if (!class_exists('WPAdm_Method_Local_Backup')) {
272
  }
273
  if ( WPAdm_Running::is_stop() ) {
274
  $md5 = md5( print_r( $files, 1 ) );
275
- $files_str = implode(',', $files);
276
  $files_archive = WPAdm_Running::getCommandResultData('archive');
277
  if ( WPAdm_Running::is_stop() ) {
278
  if ( !isset($files_archive[$md5]) ) {
@@ -425,7 +451,7 @@ if (!class_exists('WPAdm_Method_Local_Backup')) {
425
  ABSPATH . 'wp-login.php',
426
  ABSPATH . 'wp-mail.php',
427
  ABSPATH . 'wp-settings.php',
428
- ABSPATH . 'wp-signup.php',
429
  ABSPATH . 'wp-trackback.php',
430
  ABSPATH . 'xmlrpc.php',
431
  )
@@ -445,6 +471,9 @@ if (!class_exists('WPAdm_Method_Local_Backup')) {
445
  if ( file_exists(ABSPATH . 'robots.txt') ) {
446
  $files = array_merge( $files, array( ABSPATH . 'robots.txt' ) );
447
  }
 
 
 
448
 
449
  if (!empty($this->params['minus-path'])) {
450
  $minus_path = explode(",", $this->params['minus-path']);
@@ -610,7 +639,6 @@ if (!class_exists('WPAdm_Method_Local_Backup')) {
610
  {
611
  //WPAdm_Core::log("{$name}-*.zip");
612
  $archives = glob("{$name}-*.zip");
613
- //WPAdm_Core::log( print_r($archives, 1) );
614
  if (empty($archives)) {
615
  return "{$name}-1.zip";
616
  }
43
 
44
  // folder for backup
45
 
46
+
47
+ $dropbox_options = get_option(PREFIX_BACKUP_ . 'dropbox-setting');
48
+
49
+ $this->base_dir = DROPBOX_BACKUP_DIR_BACKUP;
50
  $this->dir = DROPBOX_BACKUP_DIR_BACKUP . '/' . $name;
51
+ if ($dropbox_options) {
52
+ $dropbox_options = unserialize( base64_decode( $dropbox_options ) );
53
+ if (isset($dropbox_options['backup_folder']) && !empty($dropbox_options['backup_folder']) ) {
54
+ $this->dir = $dropbox_options['backup_folder'] . '/' . $name;
55
+ $this->base_dir = $dropbox_options['backup_folder'];
56
+ }
57
+ }
58
+
59
+
60
+
61
  $opt_folder = WPAdm_Running::getCommandResultData('folder_create');
62
  if (!isset($opt_folder[$name])) {
63
  if (($f = $this->checkBackup()) !== false) {
64
  $this->dir = DROPBOX_BACKUP_DIR_BACKUP . '/' . $f;
65
+ if (isset($dropbox_options['backup_folder']) && !empty($dropbox_options['backup_folder'])) {
66
+ $this->dir = $dropbox_options['backup_folder'] . '/' . $f;
67
+ }
68
+ }
69
+ if (isset($dropbox_options['backup_folder']) && !empty($dropbox_options['backup_folder'])) {
70
+ $error = WPAdm_Core::mkdir($dropbox_options['backup_folder']);
71
+ if (!empty($error)) {
72
+ $this->result->setError($error);
73
+ $this->result->setResult(WPAdm_Result::WPADM_RESULT_ERROR);
74
+ }
75
+ } else {
76
+ $error = WPAdm_Core::mkdir(DROPBOX_BACKUP_DIR_BACKUP);
77
+ if (!empty($error)) {
78
+ $this->result->setError($error);
79
+ $this->result->setResult(WPAdm_Result::WPADM_RESULT_ERROR);
80
+ }
81
  }
82
  $error = WPAdm_Core::mkdir($this->dir);
83
  if (!empty($error)) {
114
 
115
  # create db dump
116
  if (in_array('db', $this->params['types']) ) {
117
+
118
  $mysql_dump_file = DROPBOX_BACKUP_DIR_BACKUP . '/mysqldump.sql';
119
  if ( !WPAdm_Running::getCommandResult('db') ) {
120
  WPAdm_Running::setCommandResult('db');
298
  }
299
  if ( WPAdm_Running::is_stop() ) {
300
  $md5 = md5( print_r( $files, 1 ) );
301
+ $files_str = implode(';', $files);
302
  $files_archive = WPAdm_Running::getCommandResultData('archive');
303
  if ( WPAdm_Running::is_stop() ) {
304
  if ( !isset($files_archive[$md5]) ) {
451
  ABSPATH . 'wp-login.php',
452
  ABSPATH . 'wp-mail.php',
453
  ABSPATH . 'wp-settings.php',
454
+ //ABSPATH . 'wp-signup.php',
455
  ABSPATH . 'wp-trackback.php',
456
  ABSPATH . 'xmlrpc.php',
457
  )
471
  if ( file_exists(ABSPATH . 'robots.txt') ) {
472
  $files = array_merge( $files, array( ABSPATH . 'robots.txt' ) );
473
  }
474
+ if ( file_exists(ABSPATH . 'wp-signup.php') ) {
475
+ $files = array_merge( $files, array( ABSPATH . 'wp-signup.php' ) );
476
+ }
477
 
478
  if (!empty($this->params['minus-path'])) {
479
  $minus_path = explode(",", $this->params['minus-path']);
639
  {
640
  //WPAdm_Core::log("{$name}-*.zip");
641
  $archives = glob("{$name}-*.zip");
 
642
  if (empty($archives)) {
643
  return "{$name}-1.zip";
644
  }
methods/class-wpadm-method-send-to-dropbox.php CHANGED
@@ -52,7 +52,12 @@ if (!class_exists('WPadm_Method_Send_To_Dropbox')) {
52
  WPAdm_Core::log( __('Start copy to Dropbox Cloud', 'dropbox-backup') );
53
  foreach($files as $file) {
54
  try {
55
- $this->sendFileToDropbox( ABSPATH . $file, $ad );
 
 
 
 
 
56
  } catch (Exception $e) {
57
  $this->result->setError( $e->getMessage() );
58
  $this->result->setResult( WPAdm_Result::WPADM_RESULT_ERROR );
@@ -117,7 +122,15 @@ if (!class_exists('WPadm_Method_Send_To_Dropbox')) {
117
  $this->result->setValue('type', 'dropbox');
118
  $this->result->setValue('counts', $params_data_cron['counts'] );
119
  if( (isset($this->params['is_local_backup']) && $this->params['is_local_backup'] == 0 ) || ( !isset($this->params['is_local_backup']) ) ) {
120
- WPAdm_Core::rmdir( DROPBOX_BACKUP_DIR_BACKUP . "/{$params_data_cron['name']}");
 
 
 
 
 
 
 
 
121
  }
122
  return $this->result;
123
  } else {
@@ -256,8 +269,16 @@ if (!class_exists('WPadm_Method_Send_To_Dropbox')) {
256
  private function deleteBackup()
257
  {
258
  if( (isset($this->params['is_local_backup']) && $this->params['is_local_backup'] == 0 ) || ( !isset($this->params['is_local_backup']) ) ) {
259
- if (isset($this->params['access_details']['dir'])) {
260
- WPAdm_Core::rmdir( DROPBOX_BACKUP_DIR_BACKUP . "/{$this->params['access_details']['dir']}");
 
 
 
 
 
 
 
 
261
  }
262
  }
263
  return $this->result;
52
  WPAdm_Core::log( __('Start copy to Dropbox Cloud', 'dropbox-backup') );
53
  foreach($files as $file) {
54
  try {
55
+ if (isset($this->params['is_folder_set'])) {
56
+ $this->sendFileToDropbox( $file, $ad );
57
+ } else {
58
+ $this->sendFileToDropbox( ABSPATH . $file, $ad );
59
+ }
60
+
61
  } catch (Exception $e) {
62
  $this->result->setError( $e->getMessage() );
63
  $this->result->setResult( WPAdm_Result::WPADM_RESULT_ERROR );
122
  $this->result->setValue('type', 'dropbox');
123
  $this->result->setValue('counts', $params_data_cron['counts'] );
124
  if( (isset($this->params['is_local_backup']) && $this->params['is_local_backup'] == 0 ) || ( !isset($this->params['is_local_backup']) ) ) {
125
+ $backup_dir = DROPBOX_BACKUP_DIR_BACKUP;
126
+ $dropbox_options = get_option(PREFIX_BACKUP_ . 'dropbox-setting');
127
+ if ($dropbox_options) {
128
+ $dropbox_options = unserialize( base64_decode( $dropbox_options ) );
129
+ if (isset($dropbox_options['backup_folder']) && !empty($dropbox_options['backup_folder'])) {
130
+ $backup_dir = $dropbox_options['backup_folder'];
131
+ }
132
+ }
133
+ WPAdm_Core::rmdir( $backup_dir . "/{$params_data_cron['name']}");
134
  }
135
  return $this->result;
136
  } else {
269
  private function deleteBackup()
270
  {
271
  if( (isset($this->params['is_local_backup']) && $this->params['is_local_backup'] == 0 ) || ( !isset($this->params['is_local_backup']) ) ) {
272
+ if (isset($this->params['access_details']['dir'])) {
273
+ $backup_dir = DROPBOX_BACKUP_DIR_BACKUP;
274
+ $dropbox_options = get_option(PREFIX_BACKUP_ . 'dropbox-setting');
275
+ if ($dropbox_options) {
276
+ $dropbox_options = unserialize( base64_decode( $dropbox_options ) );
277
+ if (isset($dropbox_options['backup_folder']) && !empty($dropbox_options['backup_folder'])) {
278
+ $backup_dir = $dropbox_options['backup_folder'];
279
+ }
280
+ }
281
+ WPAdm_Core::rmdir( $backup_dir . "/{$this->params['access_details']['dir']}");
282
  }
283
  }
284
  return $this->result;
modules/class-wpadm-archive.php CHANGED
@@ -2,6 +2,10 @@
2
  if (!defined('PCLZIP_TEMPORARY_DIR')) {
3
  define('PCLZIP_TEMPORARY_DIR', WPAdm_Core::getTmpDir() . '/');
4
  }
 
 
 
 
5
  if ( !class_exists("PclZip") ) {
6
  require_once dirname(__FILE__) . '/pclzip.lib.php';
7
  }
2
  if (!defined('PCLZIP_TEMPORARY_DIR')) {
3
  define('PCLZIP_TEMPORARY_DIR', WPAdm_Core::getTmpDir() . '/');
4
  }
5
+
6
+ if (!defined('PCLZIP_SEPARATOR')) {
7
+ define('PCLZIP_SEPARATOR', ';');
8
+ }
9
  if ( !class_exists("PclZip") ) {
10
  require_once dirname(__FILE__) . '/pclzip.lib.php';
11
  }
modules/class-wpadm-core.php CHANGED
@@ -88,7 +88,7 @@ if (!class_exists('WPAdm_Core')) {
88
  if (!file_exists($tmp_dir . '/index.php')) {
89
  @file_put_contents($tmp_dir . '/index.php', '');
90
  if (!file_exists($tmp_dir . '/index.php')) {
91
- self::$error = ( sprintf( __('Failed to create a file, please check the permissions on the folders "%s".<br /> Plugin is working incorrectly.', 'dropbxo-backup'), $tmp_dir ) );
92
  }
93
  }
94
  return $tmp_dir;
@@ -224,12 +224,12 @@ if (!class_exists('WPAdm_Core')) {
224
  if(!file_exists($dir)) {
225
  @mkdir($dir, 0755);
226
  if (!is_dir($dir)) {
227
- self::$error = str_replace("&s", $dir, __('Failed to create a file, please check the permissions on the folders "&s".','dropbox-backup') );
228
  } else {
229
  //todo: права доступа
230
  @file_put_contents($dir . '/index.php', '<?php echo "Hello World!"; ');
231
  if ( !is_writable($dir . '/index.php') ) {
232
- self::$error = str_replace("&s", $dir, __('Failed to create a file, please check the permissions on the folders "&s".','dropbox-backup') );
233
  }
234
  }
235
  }
88
  if (!file_exists($tmp_dir . '/index.php')) {
89
  @file_put_contents($tmp_dir . '/index.php', '');
90
  if (!file_exists($tmp_dir . '/index.php')) {
91
+ self::$error = ( sprintf( __('Backup creating<br /><br />Please check the permissions on folder "%s".<br />Failed to create folder.', 'dropbxo-backup'), $tmp_dir ) );
92
  }
93
  }
94
  return $tmp_dir;
224
  if(!file_exists($dir)) {
225
  @mkdir($dir, 0755);
226
  if (!is_dir($dir)) {
227
+ self::$error = str_replace("&s", $dir, __('Backup creating<br /><br />Please check the permissions on folder "&s". Failed to create folder.','dropbox-backup') );
228
  } else {
229
  //todo: права доступа
230
  @file_put_contents($dir . '/index.php', '<?php echo "Hello World!"; ');
231
  if ( !is_writable($dir . '/index.php') ) {
232
+ self::$error = str_replace("&s", $dir . '/index.php' , __('Backup creating<br /><br />Please check the permissions on file "&s". Failed to create file.','dropbox-backup') );
233
  }
234
  }
235
  }
modules/class-wpadm-mysqldump.php CHANGED
@@ -218,7 +218,6 @@ if (!class_exists('WPAdm_Mysqldump')) {
218
  if ( WPAdm_Running::is_stop() ) {
219
  $return = '';
220
  $row = array_values( get_object_vars( $result2[$i] ) );
221
- //WPAdm_Core::log('row' . print_r($row, 1));
222
  $rows_num = count($row);
223
  if ($rows_num > 0) {
224
  $return.= 'INSERT INTO ' . $table . ' VALUES(';
218
  if ( WPAdm_Running::is_stop() ) {
219
  $return = '';
220
  $row = array_values( get_object_vars( $result2[$i] ) );
 
221
  $rows_num = count($row);
222
  if ($rows_num > 0) {
223
  $return.= 'INSERT INTO ' . $table . ' VALUES(';
modules/class-wpadm-running.php CHANGED
@@ -102,11 +102,18 @@ if (!class_exists('WPAdm_Running')) {
102
  self::setCommandResultData($command['method'], $result);
103
  self::stop();
104
  self::init_params_default();
 
105
  }
106
  }
107
  }
108
  }
109
  }
 
 
 
 
 
 
110
  public static function checkLock()
111
  {
112
  // false - cron is running
@@ -139,7 +146,12 @@ if (!class_exists('WPAdm_Running')) {
139
  }
140
  }
141
  }
142
- set_transient('drb_running', 1, 60 * 4);
 
 
 
 
 
143
  return true;
144
  }
145
 
102
  self::setCommandResultData($command['method'], $result);
103
  self::stop();
104
  self::init_params_default();
105
+ self::createDebug( $result );
106
  }
107
  }
108
  }
109
  }
110
  }
111
+
112
+ public static function createDebug( $result )
113
+ {
114
+ wpadm_class::error_log_check( print_r( $result, 1 ) );
115
+ }
116
+
117
  public static function checkLock()
118
  {
119
  // false - cron is running
146
  }
147
  }
148
  }
149
+ $time = ini_get('max_execution_time');
150
+ if ($time == 0) {
151
+ set_transient('drb_running', 1, 60 * 60 * 24); // 24 hour
152
+ } else {
153
+ set_transient('drb_running', 1, $time + 60);
154
+ }
155
  return true;
156
  }
157
 
modules/restore-class.php CHANGED
@@ -363,7 +363,7 @@ if ( !class_exists('dbr_helper') ) {
363
  class dbr_helper {
364
 
365
  private static $cron_is_work = 90;
366
-
367
  public static function modSecureInstalled()
368
  {
369
  ob_start();
@@ -604,7 +604,18 @@ if ( !class_exists('dbr_methods') ) {
604
  $this->setting_restore = dbr_helper::getCommand('restore-backup');
605
  if (isset($this->setting_restore['action'])) {
606
  dbr_log::log('Start restoring of backup "' . $this->setting_restore['name'] . '"');
607
- $this->dir_backup = DROPBOX_BACKUP_DIR_BACKUP . "/{$this->setting_restore['name']}";
 
 
 
 
 
 
 
 
 
 
 
608
  switch($this->setting_restore['action']) {
609
  case 'wpadm_restore_dropbox':
610
  if ( $this->dowloadDropbox() ) {
@@ -749,7 +760,7 @@ if ( !class_exists('dbr_methods') ) {
749
  }
750
  }
751
  $zip_config = dbr_helper::getCommand('zip-config');
752
- if (!$zip_config) {
753
  $md5_info = dbr_helper::getCommand('md5_info-restore');
754
  $while = true;
755
  if($md5_info) {
@@ -764,6 +775,7 @@ if ( !class_exists('dbr_methods') ) {
764
  }
765
  }
766
  }
 
767
  }
768
  }
769
  foreach($files as $f => $file) {
@@ -1033,8 +1045,12 @@ if (!class_exists('dbr_route')) {
1033
  include 'constant.php';
1034
  $setting = dbr_database::db_get('options', array('option_value'), array('option_name' => 'wpadm_backup_dropbox-setting'), 1);
1035
  $this->setting = dbr_helper::unpack( $setting['option_value'] );
1036
- if (file_exists(DROPBOX_BACKUP_DIR_BACKUP . '/local-key')) {
1037
- $key_values = dbr_helper::unpack( @file_get_contents(DROPBOX_BACKUP_DIR_BACKUP . '/local-key') );
 
 
 
 
1038
  }
1039
  if ($_POST['key'] == $this->setting['restore-key'] || ( isset($key_values['key']) && $_POST['key'] == $key_values['key'] ) ) {
1040
  $methods = new dbr_methods();
@@ -1060,7 +1076,7 @@ if (!class_exists('dbr_route')) {
1060
  }
1061
  $key = isset($this->setting['restore-key']) && !empty($this->setting['restore-key']) ? $this->setting['restore-key'] : $key_values['key'];
1062
  $res_api = dbr_api::post($http . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], array('key' => $key, 'method' => 'restore'), array('timelimit' => 5) );
1063
-
1064
  if (stripos($res_api['res'], 'mod_security') !== false || dbr_helper::modSecureInstalled() ) {
1065
  dbr_helper::is_work(time(), 'start');
1066
  dbr_helper::setError('Apache module \'mod_security\' is active and affected on your website. For successfully restoring of website please switch it temporary off.');
363
  class dbr_helper {
364
 
365
  private static $cron_is_work = 90;
366
+
367
  public static function modSecureInstalled()
368
  {
369
  ob_start();
604
  $this->setting_restore = dbr_helper::getCommand('restore-backup');
605
  if (isset($this->setting_restore['action'])) {
606
  dbr_log::log('Start restoring of backup "' . $this->setting_restore['name'] . '"');
607
+
608
+ $setting = dbr_database::db_get('options', array('option_value'), array('option_name' => 'wpadm_backup_dropbox-setting'), 1);
609
+ if (isset($setting['option_value'] )) {
610
+ $this->main = dbr_helper::unpack( $setting['option_value'] );
611
+ }
612
+
613
+ $backup_dir = DROPBOX_BACKUP_DIR_BACKUP;
614
+ if (isset($this->main['backup_folder']) && !empty($this->main['backup_folder'])) {
615
+ $backup_dir = $this->main['backup_folder'];
616
+ }
617
+ $this->base_dir = $backup_dir;
618
+ $this->dir_backup = $backup_dir . "/{$this->setting_restore['name']}";
619
  switch($this->setting_restore['action']) {
620
  case 'wpadm_restore_dropbox':
621
  if ( $this->dowloadDropbox() ) {
760
  }
761
  }
762
  $zip_config = dbr_helper::getCommand('zip-config');
763
+ if ($zip_config === false || $zip_config != null) {
764
  $md5_info = dbr_helper::getCommand('md5_info-restore');
765
  $while = true;
766
  if($md5_info) {
775
  }
776
  }
777
  }
778
+ dbr_helper::setCommand('zip-config', null);
779
  }
780
  }
781
  foreach($files as $f => $file) {
1045
  include 'constant.php';
1046
  $setting = dbr_database::db_get('options', array('option_value'), array('option_name' => 'wpadm_backup_dropbox-setting'), 1);
1047
  $this->setting = dbr_helper::unpack( $setting['option_value'] );
1048
+ $backup_dir = DROPBOX_BACKUP_DIR_BACKUP;
1049
+ if (isset($this->setting['backup_folder']) && !empty($this->setting['backup_folder'])) {
1050
+ $backup_dir = $this->setting['backup_folder'];
1051
+ }
1052
+ if (file_exists($backup_dir . '/local-key')) {
1053
+ $key_values = dbr_helper::unpack( @file_get_contents($backup_dir . '/local-key') );
1054
  }
1055
  if ($_POST['key'] == $this->setting['restore-key'] || ( isset($key_values['key']) && $_POST['key'] == $key_values['key'] ) ) {
1056
  $methods = new dbr_methods();
1076
  }
1077
  $key = isset($this->setting['restore-key']) && !empty($this->setting['restore-key']) ? $this->setting['restore-key'] : $key_values['key'];
1078
  $res_api = dbr_api::post($http . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], array('key' => $key, 'method' => 'restore'), array('timelimit' => 5) );
1079
+
1080
  if (stripos($res_api['res'], 'mod_security') !== false || dbr_helper::modSecureInstalled() ) {
1081
  dbr_helper::is_work(time(), 'start');
1082
  dbr_helper::setError('Apache module \'mod_security\' is active and affected on your website. For successfully restoring of website please switch it temporary off.');
readme.txt CHANGED
@@ -1,11 +1,11 @@
1
  === Backup & Restore Dropbox ===
2
  Plugin Name: Backup & Restore Dropbox
3
- Version: 1.4.7.3
4
  Donate link: http://www.wpadm.com/donate
5
  URI: http://www.wpadm.com/dropbox-backup
6
  Tags: dropbox, backup, dropbox backup, database, file, full backup, manage, sicherung, database backup, file backup, page backup, page, web, web backup, web page, synchronize, clone, duplicate, move, web page backup, site, site backup, back up, cloud, Cloud Files, cloud backup, db backup, dump, german, migrate, multisite, German, schedule, storage, time, upload, data bank, zip, archive, backups, restore, db, recover, recovery, restoration, wp backup, wordpress backup, wordpress backup to dropbox, plugin wordpress backup, wpadm, wpadm.com, website, website backup, website back up, wp backup, wordpress backup, scheduled backup, backup scheduler, tool, backup tool
7
  Requires at least: 3.9
8
- Tested up to: 4.6
9
  Stable tag: trunk
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
1
  === Backup & Restore Dropbox ===
2
  Plugin Name: Backup & Restore Dropbox
3
+ Version: 1.4.7.5
4
  Donate link: http://www.wpadm.com/donate
5
  URI: http://www.wpadm.com/dropbox-backup
6
  Tags: dropbox, backup, dropbox backup, database, file, full backup, manage, sicherung, database backup, file backup, page backup, page, web, web backup, web page, synchronize, clone, duplicate, move, web page backup, site, site backup, back up, cloud, Cloud Files, cloud backup, db backup, dump, german, migrate, multisite, German, schedule, storage, time, upload, data bank, zip, archive, backups, restore, db, recover, recovery, restoration, wp backup, wordpress backup, wordpress backup to dropbox, plugin wordpress backup, wpadm, wpadm.com, website, website backup, website back up, wp backup, wordpress backup, scheduled backup, backup scheduler, tool, backup tool
7
  Requires at least: 3.9
8
+ Tested up to: 4.7
9
  Stable tag: trunk
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
template/css/admin-style-wpadm.css CHANGED
@@ -1,4 +1,12 @@
1
 
 
 
 
 
 
 
 
 
2
  .dropbox-image-toolbar a:before {
3
  content: url('./../../img/wpadm-logo.png');
4
  /*background-image: ;*/
@@ -45,7 +53,7 @@
45
  float:left;
46
  }
47
  #logs-form, #reviews-dropbox, #process-box {
48
- padding: 10px; background: #ffffc8; border: 1px solid #0096d6; position: relative; height: 100px; text-align: center;
49
  }
50
  #reviews-dropbox, #process-box {
51
  float: right;
@@ -71,7 +79,7 @@
71
  border:1px solid #ccc;
72
  border-radius: 0px;
73
  display: inline-block;
74
-
75
  }
76
  .progress-text {
77
  position: absolute;
@@ -509,7 +517,7 @@ h3.plugins-title {
509
  clear:both;
510
  }
511
  .setting-checkbox input[type="checkbox"] {
512
- margin: 2px 5px 0px 0px;
513
  }
514
  .setting-checkbox input[type="checkbox"], .setting-checkbox label, .setting-checkbox select, .setting-checkbox span {
515
  float:left;
@@ -605,12 +613,12 @@ margin: 0 5px 0 0;
605
  background-image: url(folder.png);
606
  }
607
  .show-includes input.input-folder[type="checkbox"] + label.is-file::before {
608
- background-image: url(file2.png);
609
- width:15px;
610
- height:15px;
611
  }
612
  .field-value-folder-or-file {
613
- line-height: 18px;
614
  }
615
  .loading-img {
616
  text-align: center;
@@ -621,10 +629,10 @@ margin: 0 auto;
621
  margin-top:0px;
622
  }
623
  .show-includes input.input-folder[type="checkbox"]:checked + label.is-file::before {
624
- background-image: url(file2.png);
625
  }
626
  .show-includes input.input-folder[type="checkbox"]:checked:disabled + label.is-file::before {
627
- background-image: url(file2.png);
628
  }
629
  .show-includes input.input-folder[type="checkbox"]:checked + label::before {
630
  background-image: url(icon-folder-open.gif);
@@ -900,6 +908,18 @@ margin-right: 0px;
900
  text-align: center; margin-top: 10px;
901
  }
902
 
 
 
 
 
 
 
 
 
 
 
 
 
903
  /*default style */
904
  @media only screen and (max-width: 960px) {
905
  /*
@@ -980,6 +1000,8 @@ width: 18px;
980
  }
981
 
982
  }
 
 
983
  @media only screen and (max-width: 1124px) {
984
  .stat-form-counter {
985
  font-size:10px;
1
 
2
+ #wp-cron-enable {
3
+ position: relative;
4
+ }
5
+ #wp-cron-enable .close-button {
6
+ position: absolute;
7
+ right: -15px;
8
+ top: -15px;
9
+ }
10
  .dropbox-image-toolbar a:before {
11
  content: url('./../../img/wpadm-logo.png');
12
  /*background-image: ;*/
53
  float:left;
54
  }
55
  #logs-form, #reviews-dropbox, #process-box {
56
+ padding: 10px; background: #ffffc8; border: 1px solid #0096d6; position: relative; text-align: center;
57
  }
58
  #reviews-dropbox, #process-box {
59
  float: right;
79
  border:1px solid #ccc;
80
  border-radius: 0px;
81
  display: inline-block;
82
+
83
  }
84
  .progress-text {
85
  position: absolute;
517
  clear:both;
518
  }
519
  .setting-checkbox input[type="checkbox"] {
520
+ margin: 2px 5px 0px 0px;
521
  }
522
  .setting-checkbox input[type="checkbox"], .setting-checkbox label, .setting-checkbox select, .setting-checkbox span {
523
  float:left;
613
  background-image: url(folder.png);
614
  }
615
  .show-includes input.input-folder[type="checkbox"] + label.is-file::before {
616
+ background-image: url(file2.png);
617
+ width:15px;
618
+ height:15px;
619
  }
620
  .field-value-folder-or-file {
621
+ line-height: 18px;
622
  }
623
  .loading-img {
624
  text-align: center;
629
  margin-top:0px;
630
  }
631
  .show-includes input.input-folder[type="checkbox"]:checked + label.is-file::before {
632
+ background-image: url(file2.png);
633
  }
634
  .show-includes input.input-folder[type="checkbox"]:checked:disabled + label.is-file::before {
635
+ background-image: url(file2.png);
636
  }
637
  .show-includes input.input-folder[type="checkbox"]:checked + label::before {
638
  background-image: url(icon-folder-open.gif);
908
  text-align: center; margin-top: 10px;
909
  }
910
 
911
+ .cfTabsContainer.wpadm-setting-box {
912
+ width: 28%; float: left; margin-left: 10px; padding-bottom: 0px; padding-top: 0px;
913
+ }
914
+
915
+ @media only screen and (max-width: 1345px) {
916
+ .cfTabsContainer.wpadm-setting-box {
917
+ width: 97%;
918
+ float:none;
919
+ margin-left: 0px;
920
+ }
921
+ }
922
+
923
  /*default style */
924
  @media only screen and (max-width: 960px) {
925
  /*
1000
  }
1001
 
1002
  }
1003
+
1004
+
1005
  @media only screen and (max-width: 1124px) {
1006
  .stat-form-counter {
1007
  font-size:10px;
template/wpadm_show_backup.php CHANGED
@@ -441,8 +441,8 @@
441
  },
442
  error: function(jqXHR, textStatus, errorThrown){
443
  if (jqXHR.status != 0) {
444
- processStop();
445
- AjaxAlert(jqXHR, textStatus, errorThrown);
446
  }
447
  },
448
  });
@@ -850,7 +850,7 @@
850
  function saveSetting(id)
851
  {
852
  if (jQuery('#' + id).length > 0) {
853
- if ( jQuery('#' + id).is('select') ) {
854
  is_value = jQuery('#' + id).val();
855
  } else {
856
  is_value = 0;
@@ -870,7 +870,7 @@
870
  location.reload();
871
  },
872
  error: function( jqXHR, textStatus, errorThrown ){
873
- AjaxAlert(jqXHR, textStatus, errorThrown);
874
  }
875
  });
876
  }
@@ -907,6 +907,18 @@
907
  jQuery('#form-ajax-ftp-email').hide('slow');
908
  }
909
  }
 
 
 
 
 
 
 
 
 
 
 
 
910
  <?php
911
  $command_running = get_transient('running_command');
912
  if (isset($is_runnig) && $is_runnig && $command_running ) {
@@ -944,7 +956,7 @@
944
  });
945
  </script>
946
  <?php if (!empty($error)) {
947
- echo '<div class="error" style="text-align: center; color: red; font-weight:bold;">
948
  <p style="font-size: 16px;">
949
  ' . $error . '
950
  </p></div>';
@@ -955,6 +967,13 @@
955
  ' . $msg . '
956
  </p></div>';
957
  }?>
 
 
 
 
 
 
 
958
  <div id="is-dropbox-auth" style="display: none; width: 380px; text-align: center; background: #fff; border: 2px solid #dde4ff; border-radius: 5px;">
959
  <div class="title-description" style="font-size: 20px; text-align: center;padding-top:45px; line-height: 30px;">
960
  <?php _e('Your Dropbox account must be connected before backup to Dropbox.', 'dropbox-backup'); ?> <br />
@@ -1174,7 +1193,7 @@
1174
  </div>
1175
  </div>
1176
  <?php } ?>
1177
- <div class="cfTabsContainer" style="width: 28%; float: left; margin-left: 10px; padding-bottom: 0px; padding-top: 0px;">
1178
  <div class="stat-wpadm-info-title" id="title-setting" style="padding :20px 0px; margin-top:11px; line-height: 50px;">
1179
  <?php _e('Settings','dropbox-backup'); ?>
1180
  </div>
@@ -1258,6 +1277,14 @@
1258
  <?php _e('Include/Exclude','dropbox-backup'); ?>
1259
  <a onclick="InludesSetting();" href="javascript:void(0);" style="color: #fff"><?php _e('Folders and files','dropbox-backup'); ?></a>
1260
  </div>
 
 
 
 
 
 
 
 
1261
 
1262
  </div>
1263
  </form>
441
  },
442
  error: function(jqXHR, textStatus, errorThrown){
443
  if (jqXHR.status != 0) {
444
+ //processStop();
445
+ //AjaxAlert(jqXHR, textStatus, errorThrown);
446
  }
447
  },
448
  });
850
  function saveSetting(id)
851
  {
852
  if (jQuery('#' + id).length > 0) {
853
+ if ( jQuery('#' + id).is('select') || jQuery('#' + id).is( ":text" ) ) {
854
  is_value = jQuery('#' + id).val();
855
  } else {
856
  is_value = 0;
870
  location.reload();
871
  },
872
  error: function( jqXHR, textStatus, errorThrown ){
873
+ //AjaxAlert(jqXHR, textStatus, errorThrown);
874
  }
875
  });
876
  }
907
  jQuery('#form-ajax-ftp-email').hide('slow');
908
  }
909
  }
910
+
911
+ function showEnableCron()
912
+ {
913
+ jQuery('#wp-cron-enable').arcticmodal({
914
+ beforeOpen: function(data, el) {
915
+ jQuery('#wp-cron-enable').css('display','block');
916
+ },
917
+ afterClose: function(data, el) {
918
+ jQuery('#wp-cron-enable').css('display','none');
919
+ }
920
+ });
921
+ }
922
  <?php
923
  $command_running = get_transient('running_command');
924
  if (isset($is_runnig) && $is_runnig && $command_running ) {
956
  });
957
  </script>
958
  <?php if (!empty($error)) {
959
+ echo '<div class="error" style="text-align: left; color: red; font-weight:bold;background:#ffcece;">
960
  <p style="font-size: 16px;">
961
  ' . $error . '
962
  </p></div>';
967
  ' . $msg . '
968
  </p></div>';
969
  }?>
970
+
971
+ <div id="wp-cron-enable" style="display: none;">
972
+ <div class="close-button"><a href="javascript:void(0)" onclick="jQuery('#wp-cron-enable').arcticmodal('close');"><img src="<?php echo plugins_url('/img/closebox.png', dirname(__FILE__));?>" alt=""></a></div>
973
+ <div class="image-enable">
974
+ <img src="<?php echo plugins_url('/img/how-to-enable-cron.png', dirname(__FILE__));?>" alt="">
975
+ </div>
976
+ </div>
977
  <div id="is-dropbox-auth" style="display: none; width: 380px; text-align: center; background: #fff; border: 2px solid #dde4ff; border-radius: 5px;">
978
  <div class="title-description" style="font-size: 20px; text-align: center;padding-top:45px; line-height: 30px;">
979
  <?php _e('Your Dropbox account must be connected before backup to Dropbox.', 'dropbox-backup'); ?> <br />
1193
  </div>
1194
  </div>
1195
  <?php } ?>
1196
+ <div class="cfTabsContainer wpadm-setting-box" style="">
1197
  <div class="stat-wpadm-info-title" id="title-setting" style="padding :20px 0px; margin-top:11px; line-height: 50px;">
1198
  <?php _e('Settings','dropbox-backup'); ?>
1199
  </div>
1277
  <?php _e('Include/Exclude','dropbox-backup'); ?>
1278
  <a onclick="InludesSetting();" href="javascript:void(0);" style="color: #fff"><?php _e('Folders and files','dropbox-backup'); ?></a>
1279
  </div>
1280
+ <div style="border-bottom:1px solid #fff; margin:10px 0px;"></div>
1281
+ <div class="setting-checkbox">
1282
+ <input type="text" style="width: 90%;" name="backup_folder" value="<?php echo ( isset($dropbox_options['backup_folder']) && !empty($dropbox_options['backup_folder']) ) ? $dropbox_options['backup_folder'] : DROPBOX_BACKUP_DIR_BACKUP; ?>" id="backup_folder" onclick="" />
1283
+ <label for="backup_folder" style="font-size: 13px;"><?php _e('Backup folder location','dropbox-backup'); ?></label>
1284
+ </div>
1285
+ <div class="setting-checkbox" style="text-align: center;">
1286
+ <input class="btn-orange" type="button" value="<?php echo _e('Save', 'dropbox-backup'); ?>" onclick="saveSetting('backup_folder');">
1287
+ </div>
1288
 
1289
  </div>
1290
  </form>