BackWPup – WordPress Backup Plugin - Version 3.0.8

Version Description

= After an upgrade from version 2 =

Please check all settings after the update:

  • Dropbox authentication must be done again
  • SugarSync authentication must be done again
  • S3 Settings
  • Google Storage is now in S3
  • Check all your passwords
Download this release

Release Info

Developer danielhuesken
Plugin Icon 128x128 BackWPup – WordPress Backup Plugin
Version 3.0.8
Comparing to
See all releases

Code changes from version 3.0.7 to 3.0.8

backwpup.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: WordPress Backup and more...
6
  * Author: Inpsyde GmbH
7
  * Author URI: http://inpsyde.com
8
- * Version: 3.0.7
9
  * Text Domain: backwpup
10
  * Domain Path: /languages/
11
  * Network: true
@@ -79,8 +79,8 @@ if ( ! class_exists( 'BackWPup' ) ) {
79
  add_action( 'backwpup_cron', array( 'BackWPup_Cron', 'run' ) );
80
  add_action( 'backwpup_check_cleanup', array( 'BackWPup_Cron', 'check_cleanup' ) );
81
  // add action for doing thinks if cron active
82
- add_action( 'wp_loaded', array( 'BackWPup_Cron', 'cron_active' ) );
83
- // if in cron the rest is not needed
84
  return;
85
  }
86
  //deactivation hook
5
  * Description: WordPress Backup and more...
6
  * Author: Inpsyde GmbH
7
  * Author URI: http://inpsyde.com
8
+ * Version: 3.0.8
9
  * Text Domain: backwpup
10
  * Domain Path: /languages/
11
  * Network: true
79
  add_action( 'backwpup_cron', array( 'BackWPup_Cron', 'run' ) );
80
  add_action( 'backwpup_check_cleanup', array( 'BackWPup_Cron', 'check_cleanup' ) );
81
  // add action for doing thinks if cron active
82
+ add_action( 'wp_loaded', array( 'BackWPup_Cron', 'cron_active' ), 1 );
83
+ // if in cron the rest must not needed
84
  return;
85
  }
86
  //deactivation hook
css/adminbar.css CHANGED
@@ -1 +1 @@
1
- #wp-admin-bar-backwpup.menupop>.ab-item .ab-icon,#wp-admin-bar-backwpup.menupop>a>span .ab-icon{background-image:url(../images/BackWPup20.png);background-repeat:no-repeat;position:relative;float:left;width:20px;height:20px;margin-top:3px;margin-right:5px;background-position:top center}#wp-admin-bar-backwpup.menupop.hover>.ab-item .ab-icon,#wp-admin-bar-backwpup.menupop.hover>a>span .ab-icon:hover{background-image:url(../images/BackWPup20.png);background-repeat:no-repeat;background-position:bottom center}@media only screen and (-webkit-min-device-pixel-ratio:2){#wp-admin-bar-backwpup.menupop>.ab-item .ab-icon,#wp-admin-bar-backwpup.menupop>a>span .ab-icon{background-image:url(../images/BackWPup20_2x.png);background-repeat:no-repeat;background-size:20px 40px;background-position:top center;position:relative}#wp-admin-bar-backwpup.menupop.hover>.ab-item .ab-icon,#wp-admin-bar-backwpup.menupop.hover>a>span .ab-icon:hover{background-image:url(../images/BackWPup20_2x.png);background-repeat:no-repeat;background-position:bottom center}}
1
+ #wp-admin-bar-backwpup.menupop>.ab-item .ab-icon,#wp-admin-bar-backwpup.menupop>a>span .ab-icon{position:relative;float:left;width:20px;height:20px;margin-top:3px;margin-right:5px;background:url(../images/BackWPup20.png) no-repeat top center}#wp-admin-bar-backwpup.menupop.hover>.ab-item .ab-icon,#wp-admin-bar-backwpup.menupop.hover>a>span .ab-icon:hover{background:url(../images/BackWPup20.png) no-repeat bottom center}@media only screen and (-webkit-min-device-pixel-ratio:2){#wp-admin-bar-backwpup.menupop>.ab-item .ab-icon,#wp-admin-bar-backwpup.menupop>a>span .ab-icon{background-size:20px 40px;background:url(../images/BackWPup20_2x.png) no-repeat top center;position:relative}#wp-admin-bar-backwpup.menupop.hover>.ab-item .ab-icon,#wp-admin-bar-backwpup.menupop.hover>a>span .ab-icon:hover{background:url(../images/BackWPup20_2x.png) no-repeat bottom center}}
css/adminbar.dev.css CHANGED
@@ -1,7 +1,5 @@
1
  #wp-admin-bar-backwpup.menupop > .ab-item .ab-icon,
2
  #wp-admin-bar-backwpup.menupop > a > span .ab-icon {
3
- background-image: url(../images/BackWPup20.png);
4
- background-repeat: no-repeat;
5
  position: relative;
6
  /* for WP lower 3.3 */
7
  float: left;
@@ -9,28 +7,22 @@
9
  height: 20px;
10
  margin-top: 3px;
11
  margin-right:5px;
12
- background-position:top center;
13
  }
14
  #wp-admin-bar-backwpup.menupop.hover > .ab-item .ab-icon,
15
  #wp-admin-bar-backwpup.menupop.hover > a > span .ab-icon:hover {
16
- background-image: url(../images/BackWPup20.png);
17
- background-repeat: no-repeat;
18
- background-position:bottom center;
19
  }
20
 
21
  @media only screen and (-webkit-min-device-pixel-ratio: 2) {
22
  #wp-admin-bar-backwpup.menupop > .ab-item .ab-icon,
23
  #wp-admin-bar-backwpup.menupop > a > span .ab-icon {
24
- background-image: url(../images/BackWPup20_2x.png);
25
- background-repeat: no-repeat;
26
  background-size: 20px 40px;
27
- background-position:top center;
28
  position: relative;
29
  }
30
  #wp-admin-bar-backwpup.menupop.hover > .ab-item .ab-icon,
31
  #wp-admin-bar-backwpup.menupop.hover > a > span .ab-icon:hover {
32
- background-image: url(../images/BackWPup20_2x.png);
33
- background-repeat: no-repeat;
34
- background-position:bottom center;
35
- }
36
  }
1
  #wp-admin-bar-backwpup.menupop > .ab-item .ab-icon,
2
  #wp-admin-bar-backwpup.menupop > a > span .ab-icon {
 
 
3
  position: relative;
4
  /* for WP lower 3.3 */
5
  float: left;
7
  height: 20px;
8
  margin-top: 3px;
9
  margin-right:5px;
10
+ background: url(../images/BackWPup20.png) no-repeat top center;
11
  }
12
  #wp-admin-bar-backwpup.menupop.hover > .ab-item .ab-icon,
13
  #wp-admin-bar-backwpup.menupop.hover > a > span .ab-icon:hover {
14
+ background: url(../images/BackWPup20.png) no-repeat bottom center;
 
 
15
  }
16
 
17
  @media only screen and (-webkit-min-device-pixel-ratio: 2) {
18
  #wp-admin-bar-backwpup.menupop > .ab-item .ab-icon,
19
  #wp-admin-bar-backwpup.menupop > a > span .ab-icon {
 
 
20
  background-size: 20px 40px;
21
+ background: url(../images/BackWPup20_2x.png) no-repeat top center;
22
  position: relative;
23
  }
24
  #wp-admin-bar-backwpup.menupop.hover > .ab-item .ab-icon,
25
  #wp-admin-bar-backwpup.menupop.hover > a > span .ab-icon:hover {
26
+ background: url(../images/BackWPup20_2x.png) no-repeat bottom center;
27
+ }
 
 
28
  }
inc/class-create-archive.php CHANGED
@@ -214,9 +214,13 @@ class BackWPup_Create_Archive {
214
  */
215
  public function add_file( $file_name, $name_in_archive = '' ) {
216
 
 
 
217
  //check param
218
- if ( empty( $file_name ) )
219
- throw new BackWPup_Create_Archive_Exception( __( 'File name cannot be empty', 'backwpup' ) );
 
 
220
 
221
  if ( ! is_file( $file_name ) || ! is_readable( $file_name ) ) {
222
  trigger_error( sprintf( _x( 'File %s does not exist or is not readable', 'File path to add to archive', 'backwpup' ), $file_name ), E_USER_WARNING );
@@ -305,9 +309,13 @@ class BackWPup_Create_Archive {
305
  */
306
  public function add_empty_folder( $folder_name, $name_in_archive = '' ) {
307
 
 
 
308
  //check param
309
- if ( empty( $folder_name ) )
310
- throw new BackWPup_Create_Archive_Exception( __( 'Folder name cannot be empty', 'backwpup' ) );
 
 
311
 
312
  if ( ! is_dir( $folder_name ) || ! is_readable( $folder_name ) ) {
313
  trigger_error( sprintf( _x( 'Folder %s does not exist or is not readable', 'Folder path to add to archive', 'backwpup' ), $folder_name ), E_USER_WARNING );
214
  */
215
  public function add_file( $file_name, $name_in_archive = '' ) {
216
 
217
+ $file_name = trim( $file_name );
218
+
219
  //check param
220
+ if ( empty( $file_name ) ) {
221
+ trigger_error( __( 'File name cannot be empty', 'backwpup' ), E_USER_WARNING );
222
+ return FALSE;
223
+ }
224
 
225
  if ( ! is_file( $file_name ) || ! is_readable( $file_name ) ) {
226
  trigger_error( sprintf( _x( 'File %s does not exist or is not readable', 'File path to add to archive', 'backwpup' ), $file_name ), E_USER_WARNING );
309
  */
310
  public function add_empty_folder( $folder_name, $name_in_archive = '' ) {
311
 
312
+ $folder_name = trim( $folder_name );
313
+
314
  //check param
315
+ if ( empty( $folder_name ) ) {
316
+ trigger_error( __( 'Folder name cannot be empty', 'backwpup' ), E_USER_WARNING );
317
+ return FALSE;
318
+ }
319
 
320
  if ( ! is_dir( $folder_name ) || ! is_readable( $folder_name ) ) {
321
  trigger_error( sprintf( _x( 'Folder %s does not exist or is not readable', 'Folder path to add to archive', 'backwpup' ), $folder_name ), E_USER_WARNING );
inc/class-cron.php CHANGED
@@ -154,6 +154,15 @@ class BackWPup_Cron {
154
  if ( empty( $_GET[ 'backwpup_run' ] ) || ! in_array( $_GET[ 'backwpup_run' ], array( 'test','restart', 'runnow', 'runnowalt', 'runext', 'cronrun' ) ) )
155
  return;
156
 
 
 
 
 
 
 
 
 
 
157
  // generate normal nonce
158
  $nonce = substr( wp_hash( wp_nonce_tick() . 'backwup_job_run-' . $_GET[ 'backwpup_run' ], 'nonce' ), - 12, 10 );
159
  //special nonce on external start
@@ -163,15 +172,6 @@ class BackWPup_Cron {
163
  if ( empty( $_GET['_nonce'] ) || $nonce != $_GET['_nonce'] )
164
  return;
165
 
166
- //response on test
167
- if ( $_GET[ 'backwpup_run' ] == 'test') {
168
- @header( 'Content-Type: text/html; charset=' . get_bloginfo( 'charset' ) );
169
- @header( 'X-Robots-Tag: noindex, nofollow' );
170
- send_nosniff_header();
171
- nocache_headers();
172
- die( 'Response Test O.K.' );
173
- }
174
-
175
  //check runext is allowed for job
176
  if ( $_GET[ 'backwpup_run' ] == 'runext' ) {
177
  $jobids_external = BackWPup_Option::get_job_ids( 'activetype', 'link' );
154
  if ( empty( $_GET[ 'backwpup_run' ] ) || ! in_array( $_GET[ 'backwpup_run' ], array( 'test','restart', 'runnow', 'runnowalt', 'runext', 'cronrun' ) ) )
155
  return;
156
 
157
+ //set some header
158
+ send_nosniff_header();
159
+ nocache_headers();
160
+ @header( 'x-backwpup-ver: ' . BackWPup::get_plugin_data( 'version' ) );
161
+
162
+ //on test die for fast feedback
163
+ if ( $_GET[ 'backwpup_run' ] == 'test' )
164
+ die();
165
+
166
  // generate normal nonce
167
  $nonce = substr( wp_hash( wp_nonce_tick() . 'backwup_job_run-' . $_GET[ 'backwpup_run' ], 'nonce' ), - 12, 10 );
168
  //special nonce on external start
172
  if ( empty( $_GET['_nonce'] ) || $nonce != $_GET['_nonce'] )
173
  return;
174
 
 
 
 
 
 
 
 
 
 
175
  //check runext is allowed for job
176
  if ( $_GET[ 'backwpup_run' ] == 'runext' ) {
177
  $jobids_external = BackWPup_Option::get_job_ids( 'activetype', 'link' );
inc/class-destination-dropbox.php CHANGED
@@ -32,72 +32,30 @@ class BackWPup_Destination_Dropbox extends BackWPup_Destinations {
32
  * @param $jobid
33
  */
34
  public function edit_tab( $jobid ) {
 
35
  //Dropbox auth keys from Dropbox
36
- if ( ! empty( $_SESSION[ 'backwpup_jobedit'][ 'dropboxsandbox_auth' ][ 'oAuthRequestToken' ] ) ) {
37
-
 
 
 
 
 
 
38
  $oAuthStuff = array();
39
  try {
40
- $dropbox = new BackWPup_Destination_Dropbox_API( 'sandbox' );
41
- $oAuthStuff = $dropbox->oAuthAccessToken( $_SESSION[ 'backwpup_jobedit'][ 'dropboxsandbox_auth' ][ 'oAuthRequestToken' ], $_SESSION[ 'backwpup_jobedit'][ 'dropboxsandbox_auth' ][ 'oAuthRequestTokenSecret' ] );
42
- if ( empty( $oAuthStuff ) ) {
43
- echo '<div id="message" class="updated"><p>' . __( 'Dropbox (Sandbox) authentication complete!', 'backwpup' ) . '</p></div>';
44
  BackWPup_Option::update( $jobid, 'dropboxtoken', $oAuthStuff[ 'oauth_token' ] );
45
  BackWPup_Option::update( $jobid, 'dropboxsecret', BackWPup_Encryption::encrypt( $oAuthStuff[ 'oauth_token_secret' ] ) );
46
- BackWPup_Option::update( $jobid, 'dropboxroot', 'sandbox' );
47
- unset( $_SESSION[ 'backwpup_jobedit'][ 'dropboxsandbox_auth' ] );
48
- unset( $_SESSION[ 'backwpup_jobedit'][ 'dropboxdropbox_auth' ] );
49
  }
50
- } catch ( Exception $e ) {}
51
- if ( empty( $oAuthStuff ) ) {
52
- try {
53
- $dropbox = new BackWPup_Destination_Dropbox_API( 'dropbox' );
54
- $oAuthStuff = $dropbox->oAuthAccessToken( $_SESSION[ 'backwpup_jobedit'][ 'dropboxdropbox_auth' ][ 'oAuthRequestToken' ], $_SESSION[ 'backwpup_jobedit'][ 'dropboxdropbox_auth' ][ 'oAuthRequestTokenSecret' ] );
55
- if ( empty( $oAuthStuff ) ) {
56
- echo '<div id="message" class="updated"><p>' . __( 'Dropbox authentication complete!', 'backwpup' ) . '</p></div>';
57
- BackWPup_Option::update( $jobid, 'dropboxtoken', $oAuthStuff[ 'oauth_token' ] );
58
- BackWPup_Option::update( $jobid, 'dropboxsecret', BackWPup_Encryption::encrypt( $oAuthStuff[ 'oauth_token_secret' ] ) );
59
- BackWPup_Option::update( $jobid, 'dropboxroot', 'dropbox' );
60
- unset( $_SESSION[ 'backwpup_jobedit'][ 'dropboxsandbox_auth' ] );
61
- unset( $_SESSION[ 'backwpup_jobedit'][ 'dropboxdropbox_auth' ] );
62
- }
63
- } catch ( Exception $e ) {}
64
- }
65
- }
66
-
67
- //get auth url sandbox
68
- if ( empty( $_SESSION[ 'backwpup_jobedit'][ 'dropboxsandbox_auth' ][ 'create_time' ] ) || $_SESSION[ 'backwpup_jobedit'][ 'dropboxsandbox_auth' ][ 'create_time' ] > time() - 120 ) {
69
- try {
70
- $dropbox = new BackWPup_Destination_Dropbox_API( 'sandbox' );
71
- // let the user authorize (user will be redirected)
72
- $response_sandbox = $dropbox->oAuthAuthorize( network_admin_url( 'admin.php' ) . '?page=backwpupeditjob&jobid=' .$jobid .'&tab=dest-dropbox&_wpnonce=' . wp_create_nonce( 'edit-job' ) );
73
- // save oauth_token_secret
74
- $_SESSION[ 'backwpup_jobedit'][ 'dropboxsandbox_auth' ] = array(
75
- 'oAuthRequestToken' => $response_sandbox[ 'oauth_token' ],
76
- 'oAuthRequestTokenSecret' => $response_sandbox[ 'oauth_token_secret' ],
77
- 'authurl' => $response_sandbox[ 'authurl' ],
78
- 'create_time' => time(),
79
- );
80
- }
81
- catch ( Exception $e ) {
82
- echo '<div id="message" class="error"><p>' . sprintf( __( 'Dropbox API: %s', 'backwpup' ), $e->getMessage() ) . '</p></div>';
83
- }
84
- }
85
- //get auth url dropbox
86
- if ( empty( $_SESSION[ 'backwpup_jobedit'][ 'dropboxdropbox_auth' ][ 'create_time' ] ) || $_SESSION[ 'backwpup_jobedit'][ 'dropboxdropbox_auth' ][ 'create_time' ] > time() - 120 ) {
87
- try {
88
- $dropbox = new BackWPup_Destination_Dropbox_API( 'dropbox' );
89
- // let the user authorize (user will be redirected)
90
- $response_dropbox = $dropbox->oAuthAuthorize( network_admin_url( 'admin.php' ) . '?page=backwpupeditjob&jobid=' .$jobid .'&tab=dest-dropbox&_wpnonce=' . wp_create_nonce( 'edit-job' ) );
91
- // save oauth_token_secret
92
- $_SESSION[ 'backwpup_jobedit'][ 'dropboxdropbox_auth' ] = array(
93
- 'oAuthRequestToken' => $response_dropbox[ 'oauth_token' ],
94
- 'oAuthRequestTokenSecret' => $response_dropbox[ 'oauth_token_secret' ],
95
- 'authurl' => $response_dropbox[ 'authurl' ],
96
- 'create_time' => time(),
97
- );
98
- }
99
- catch ( Exception $e ) {
100
  echo '<div id="message" class="error"><p>' . sprintf( __( 'Dropbox API: %s', 'backwpup' ), $e->getMessage() ) . '</p></div>';
 
101
  }
102
  }
103
  ?>
@@ -112,8 +70,8 @@ class BackWPup_Destination_Dropbox extends BackWPup_Destinations {
112
  <?php } else { ?>
113
  <span style="color:green;"><?php _e( 'Authenticated!', 'backwpup' ); ?></span><br />
114
  <?php } ?>
115
- <a class="button secondary" href="<?php echo esc_url( $_SESSION[ 'backwpup_jobedit'][ 'dropboxsandbox_auth' ][ 'authurl' ] );?>"><?php _e( 'Reauthenticate (Sandbox)', 'backwpup' ); ?></a>&nbsp;
116
- <a class="button secondary" href="<?php echo esc_url( $_SESSION[ 'backwpup_jobedit'][ 'dropboxdropbox_auth' ][ 'authurl' ] );?>"><?php _e( 'Reauthenticate (full Dropbox)', 'backwpup' ); ?></a>
117
  </td>
118
  </tr>
119
  </table>
@@ -148,6 +106,54 @@ class BackWPup_Destination_Dropbox extends BackWPup_Destinations {
148
  <?php
149
  }
150
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
151
 
152
  /**
153
  * @param $jobid
@@ -402,6 +408,7 @@ final class BackWPup_Destination_Dropbox_API {
402
 
403
  /**
404
  * @param string $boxtype
 
405
  */
406
  public function __construct( $boxtype = 'dropbox' ) {
407
 
32
  * @param $jobid
33
  */
34
  public function edit_tab( $jobid ) {
35
+
36
  //Dropbox auth keys from Dropbox
37
+ // if cancelled auth
38
+ if ( ! empty( $_GET[ 'not_approved' ] ) ) {
39
+ echo '<div id="message" class="error"><p>' .__( 'Dropbox authentication not approved', 'backwpup' ) . '</p></div>';
40
+ delete_site_transient( 'backwpup_dropbox_auth_' . $jobid );
41
+ }
42
+ // if Auth data exists
43
+ $auth_data = get_site_transient( 'backwpup_dropbox_auth_' . $jobid );
44
+ if ( $auth_data ) {
45
  $oAuthStuff = array();
46
  try {
47
+ $dropbox = new BackWPup_Destination_Dropbox_API( $auth_data[ 'type' ] );
48
+ $oAuthStuff = $dropbox->oAuthAccessToken( $auth_data[ 'oauth_token' ], $auth_data[ 'oauth_token_secret' ] );
49
+ if ( ! empty( $oAuthStuff ) ) {
50
+ echo '<div id="message" class="updated"><p>' . __( 'Dropbox authentication complete!', 'backwpup' ) . '</p></div>';
51
  BackWPup_Option::update( $jobid, 'dropboxtoken', $oAuthStuff[ 'oauth_token' ] );
52
  BackWPup_Option::update( $jobid, 'dropboxsecret', BackWPup_Encryption::encrypt( $oAuthStuff[ 'oauth_token_secret' ] ) );
53
+ BackWPup_Option::update( $jobid, 'dropboxroot', $auth_data[ 'type' ] );
54
+ delete_site_transient( 'backwpup_dropbox_auth_' . $jobid );
 
55
  }
56
+ } catch ( Exception $e ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  echo '<div id="message" class="error"><p>' . sprintf( __( 'Dropbox API: %s', 'backwpup' ), $e->getMessage() ) . '</p></div>';
58
+ delete_site_transient( 'backwpup_dropbox_auth_' . $jobid );
59
  }
60
  }
61
  ?>
70
  <?php } else { ?>
71
  <span style="color:green;"><?php _e( 'Authenticated!', 'backwpup' ); ?></span><br />
72
  <?php } ?>
73
+ <a class="button secondary" href="<?php echo admin_url( 'admin-ajax.php', 'relative' );?>?action=backwpup_dest_dropbox&type=sandbox&jobid=<?php echo $jobid ?>"><?php _e( 'Reauthenticate (Sandbox)', 'backwpup' ); ?></a>&nbsp;
74
+ <a class="button secondary" href="<?php echo admin_url( 'admin-ajax.php', 'relative' );?>?action=backwpup_dest_dropbox&type=dropbox&jobid=<?php echo $jobid ?>"><?php _e( 'Reauthenticate (full Dropbox)', 'backwpup' ); ?></a>
75
  </td>
76
  </tr>
77
  </table>
106
  <?php
107
  }
108
 
109
+ /**
110
+ * Authentication over ajax
111
+ */
112
+ public function edit_ajax() {
113
+
114
+ $_GET[ 'jobid' ] = (int) $_GET[ 'jobid' ];
115
+
116
+ // dropbox auth
117
+ if ( $_GET[ 'type' ] == 'dropbox' ) {
118
+ try {
119
+ $dropbox = new BackWPup_Destination_Dropbox_API( 'dropbox' );
120
+ // let the user authorize (user will be redirected)
121
+ $response = $dropbox->oAuthAuthorize( network_admin_url( 'admin.php' ) . '?page=backwpupeditjob&jobid=' .$_GET[ 'jobid' ] .'&tab=dest-dropbox&_wpnonce=' . wp_create_nonce( 'edit-job' ) );
122
+ // save oauth_token_secret
123
+ $auth_data = array(
124
+ 'oauth_token' => $response[ 'oauth_token' ],
125
+ 'oauth_token_secret' => $response[ 'oauth_token_secret' ],
126
+ 'type' => 'dropbox'
127
+ );
128
+ set_site_transient( 'backwpup_dropbox_auth_' . $_GET[ 'jobid' ], $auth_data, 3600 );
129
+ wp_redirect( $response[ 'authurl' ] );
130
+
131
+ }
132
+ catch ( Exception $e ) {
133
+ echo '<div id="message" class="error"><p>' . sprintf( __( 'Dropbox API: %s', 'backwpup' ), $e->getMessage() ) . '</p></div>';
134
+ }
135
+ }
136
+ // sandbox auth
137
+ elseif ( $_GET[ 'type' ] == 'sandbox' ) {
138
+ try {
139
+ $dropbox = new BackWPup_Destination_Dropbox_API( 'sandbox' );
140
+ // let the user authorize (user will be redirected)
141
+ $response = $dropbox->oAuthAuthorize( network_admin_url( 'admin.php' ) . '?page=backwpupeditjob&jobid=' .$_GET[ 'jobid' ] .'&tab=dest-dropbox&_wpnonce=' . wp_create_nonce( 'edit-job' ) );
142
+ // save oauth_token_secret
143
+ $auth_data = array(
144
+ 'oauth_token' => $response[ 'oauth_token' ],
145
+ 'oauth_token_secret' => $response[ 'oauth_token_secret' ],
146
+ 'type' => 'sandbox'
147
+ );
148
+ set_site_transient( 'backwpup_dropbox_auth_' . $_GET[ 'jobid' ], $auth_data, 3600 );
149
+ wp_redirect( $response[ 'authurl' ] );
150
+ }
151
+ catch ( Exception $e ) {
152
+ echo '<div id="message" class="error"><p>' . sprintf( __( 'Dropbox API: %s', 'backwpup' ), $e->getMessage() ) . '</p></div>';
153
+ }
154
+ }
155
+ }
156
+
157
 
158
  /**
159
  * @param $jobid
408
 
409
  /**
410
  * @param string $boxtype
411
+ * @throws BackWPup_Destination_Dropbox_API_Exception
412
  */
413
  public function __construct( $boxtype = 'dropbox' ) {
414
 
inc/class-job.php CHANGED
@@ -145,6 +145,12 @@ final class BackWPup_Job {
145
  private function __construct( $starttype, $job_settings = 0 ) {
146
  global $wpdb;
147
 
 
 
 
 
 
 
148
  //check startype
149
  if ( ! in_array( $starttype, array( 'runnow', 'runnowalt', 'cronrun', 'runext', 'runcli' ) ) )
150
  return;
@@ -614,6 +620,7 @@ final class BackWPup_Job {
614
  unset( $job_object );
615
  //set Pid
616
  $this->pid = self::get_pid();
 
617
  //set function for PHP user defined error handling
618
  $this->temp[ 'PHP' ][ 'INI' ][ 'ERROR_LOG' ] = ini_get( 'error_log' );
619
  $this->temp[ 'PHP' ][ 'INI' ][ 'LOG_ERRORS' ] = ini_get( 'log_errors' );
@@ -703,7 +710,7 @@ final class BackWPup_Job {
703
  $done = call_user_func( array( $destinations[ str_replace( 'DEST_SYNC_', '', $this->step_working ) ], 'job_run_sync' ), $this );
704
  elseif ( strstr( $this->step_working, 'DEST_' ) )
705
  $done = call_user_func( array( $destinations[ str_replace( 'DEST_', '', $this->step_working ) ], 'job_run_archive' ), $this );
706
- else
707
  $done = call_user_func( $this->steps_data[ $this->step_working ][ 'CALLBACK' ], $this );
708
  //set step as done
709
  if ( $done == TRUE ) {
@@ -749,7 +756,7 @@ final class BackWPup_Job {
749
  if ( defined( 'ALTERNATE_WP_CRON' ) && ALTERNATE_WP_CRON ) {
750
  //schedule restart for now
751
  wp_clear_scheduled_hook( 'backwpup_cron', array( 'id' => 'restart' ) );
752
- wp_schedule_single_event( time() + 2, 'backwpup_cron', array( 'id' => 'restart' ) );
753
  } else {
754
  self::get_jobrun_url( 'restart' );
755
  }
@@ -1682,8 +1689,13 @@ final class BackWPup_Job {
1682
  $jobrestartarchivesize = BackWPup_Option::get( 'cfg', 'jobrestartarchivesize' );
1683
  for ( $i = $this->substeps_done - 1; $i < $this->substeps_todo - 1; $i ++ ) {
1684
  $this->steps_data[ $this->step_working ]['folder_files'] = $this->get_files_in_folder( $folders_to_backup[ $i ] );
1685
- if ( empty( $this->steps_data[ $this->step_working ]['done_files'] ) && empty( $this->steps_data[ $this->step_working ]['folder_files'] ) )
1686
- $backup_archive->add_empty_folder( $folders_to_backup[ $i ], ltrim( str_replace( $this->remove_path, '', $folders_to_backup[ $i ] ), '/' ) );
 
 
 
 
 
1687
  if ( count( $this->steps_data[ $this->step_working ]['folder_files'] ) > 0 ) {
1688
  foreach ( $this->steps_data[ $this->step_working ]['folder_files'] as $file ) {
1689
  //restart if size reached in MB
145
  private function __construct( $starttype, $job_settings = 0 ) {
146
  global $wpdb;
147
 
148
+ //check if a job started already than abort
149
+ if ( is_file( BackWPup::get_plugin_data( 'running_file' ) ) )
150
+ return;
151
+ else
152
+ file_put_contents( BackWPup::get_plugin_data( 'running_file' ), '<?php //'. serialize( $this ) );
153
+
154
  //check startype
155
  if ( ! in_array( $starttype, array( 'runnow', 'runnowalt', 'cronrun', 'runext', 'runcli' ) ) )
156
  return;
620
  unset( $job_object );
621
  //set Pid
622
  $this->pid = self::get_pid();
623
+ $this->update_working_data( TRUE );
624
  //set function for PHP user defined error handling
625
  $this->temp[ 'PHP' ][ 'INI' ][ 'ERROR_LOG' ] = ini_get( 'error_log' );
626
  $this->temp[ 'PHP' ][ 'INI' ][ 'LOG_ERRORS' ] = ini_get( 'log_errors' );
710
  $done = call_user_func( array( $destinations[ str_replace( 'DEST_SYNC_', '', $this->step_working ) ], 'job_run_sync' ), $this );
711
  elseif ( strstr( $this->step_working, 'DEST_' ) )
712
  $done = call_user_func( array( $destinations[ str_replace( 'DEST_', '', $this->step_working ) ], 'job_run_archive' ), $this );
713
+ elseif ( ! empty( $this->steps_data[ $this->step_working ][ 'CALLBACK' ] ) )
714
  $done = call_user_func( $this->steps_data[ $this->step_working ][ 'CALLBACK' ], $this );
715
  //set step as done
716
  if ( $done == TRUE ) {
756
  if ( defined( 'ALTERNATE_WP_CRON' ) && ALTERNATE_WP_CRON ) {
757
  //schedule restart for now
758
  wp_clear_scheduled_hook( 'backwpup_cron', array( 'id' => 'restart' ) );
759
+ wp_schedule_single_event( time(), 'backwpup_cron', array( 'id' => 'restart' ) );
760
  } else {
761
  self::get_jobrun_url( 'restart' );
762
  }
1689
  $jobrestartarchivesize = BackWPup_Option::get( 'cfg', 'jobrestartarchivesize' );
1690
  for ( $i = $this->substeps_done - 1; $i < $this->substeps_todo - 1; $i ++ ) {
1691
  $this->steps_data[ $this->step_working ]['folder_files'] = $this->get_files_in_folder( $folders_to_backup[ $i ] );
1692
+ //add empty folders
1693
+ if ( empty( $this->steps_data[ $this->step_working ]['done_files'] ) && empty( $this->steps_data[ $this->step_working ]['folder_files'] ) ) {
1694
+ $folder_name_in_archive = trim( ltrim( str_replace( $this->remove_path, '', $folders_to_backup[ $i ] ), '/' ) );
1695
+ if ( ! empty ( $folder_name_in_archive ) )
1696
+ $backup_archive->add_empty_folder( $folders_to_backup[ $i ], $folder_name_in_archive );
1697
+ }
1698
+ //add files
1699
  if ( count( $this->steps_data[ $this->step_working ]['folder_files'] ) > 0 ) {
1700
  foreach ( $this->steps_data[ $this->step_working ]['folder_files'] as $file ) {
1701
  //restart if size reached in MB
inc/class-jobtype-dbdump.php CHANGED
@@ -41,7 +41,7 @@ class BackWPup_JobType_DBDump extends BackWPup_JobTypes {
41
  //set only wordpress tables as default
42
  $dbtables = $wpdb->get_results( 'SHOW TABLES FROM `' . DB_NAME . '`', ARRAY_N );
43
  foreach ( $dbtables as $dbtable) {
44
- if ( $wpdb->prefix == substr( $dbtable[ 0 ], 0, strlen( $wpdb->prefix ) ) )
45
  $defaults[ 'dbdumpexclude' ][] = $dbtable[ 0 ];
46
  }
47
 
41
  //set only wordpress tables as default
42
  $dbtables = $wpdb->get_results( 'SHOW TABLES FROM `' . DB_NAME . '`', ARRAY_N );
43
  foreach ( $dbtables as $dbtable) {
44
+ if ( $wpdb->prefix != substr( $dbtable[ 0 ], 0, strlen( $wpdb->prefix ) ) )
45
  $defaults[ 'dbdumpexclude' ][] = $dbtable[ 0 ];
46
  }
47
 
inc/class-page-editjob.php CHANGED
@@ -856,7 +856,7 @@ class BackWPup_Page_Editjob {
856
  jQuery(document).ready(function ($) {
857
  // auto post if things changed
858
  var changed = false;
859
- $('input, textarea, select').change(function () {
860
  changed = true;
861
  });
862
  $( '.nav-tab' ).click( function () {
856
  jQuery(document).ready(function ($) {
857
  // auto post if things changed
858
  var changed = false;
859
+ $( '#editjob' ).change( function () {
860
  changed = true;
861
  });
862
  $( '.nav-tab' ).click( function () {
inc/class-page-jobs.php CHANGED
@@ -343,11 +343,13 @@ class BackWPup_Page_Jobs extends WP_List_Table {
343
  }
344
  }
345
  //check sever callback
346
- $raw_response = wp_remote_get( add_query_arg( array( 'backwpup_run' => 'test', '_nonce' => substr( wp_hash( wp_nonce_tick() . 'backwup_job_run-test', 'nonce' ), - 12, 10 ) ), site_url( 'wp-cron.php' ) ), array(
347
- 'blocking' => TRUE,
348
- 'sslverify' => FALSE,
349
- 'headers' => array( 'Authorization' => 'Basic ' . base64_encode( BackWPup_Option::get( 'cfg', 'httpauthuser' ) . ':' . BackWPup_Encryption::decrypt( BackWPup_Option::get( 'cfg', 'httpauthpassword' ) ) ) ),
350
- 'user-agent' => BackWPup::get_plugin_data( 'user-agent' ) ) );
 
 
351
  $test_result = '';
352
  if ( is_wp_error( $raw_response ) )
353
  $test_result .= sprintf( __( 'The HTTP response test get a error "%s"','backwpup' ), $raw_response->get_error_message() );
343
  }
344
  }
345
  //check sever callback
346
+ $raw_response = wp_remote_get( site_url( 'wp-cron.php?backwpup_run=test' ), array(
347
+ 'blocking' => TRUE,
348
+ 'sslverify' => FALSE,
349
+ 'timeout' => 15,
350
+ 'redirection' => 0,
351
+ 'headers' => array( 'Authorization' => 'Basic ' . base64_encode( BackWPup_Option::get( 'cfg', 'httpauthuser' ) . ':' . BackWPup_Encryption::decrypt( BackWPup_Option::get( 'cfg', 'httpauthpassword' ) ) ) ),
352
+ 'user-agent' => BackWPup::get_plugin_data( 'user-agent' ) ) );
353
  $test_result = '';
354
  if ( is_wp_error( $raw_response ) )
355
  $test_result .= sprintf( __( 'The HTTP response test get a error "%s"','backwpup' ), $raw_response->get_error_message() );
inc/class-page-settings.php CHANGED
@@ -365,19 +365,22 @@ class BackWPup_Page_Settings {
365
  echo '<tr title=""><td>' . __( 'cURL version', 'backwpup' ) . '</td><td>' . __( 'unavailable', 'backwpup' ) . '</td></tr>';
366
  }
367
  //response test
368
- $raw_response = wp_remote_get( add_query_arg( array( 'backwpup_run' => 'test', '_nonce' => substr( wp_hash( wp_nonce_tick() . 'backwup_job_run-test', 'nonce' ), - 12, 10 ) ), site_url( 'wp-cron.php' ) ), array(
369
- 'blocking' => TRUE,
370
- 'sslverify' => FALSE,
371
- 'headers' => array( 'Authorization' => 'Basic ' . base64_encode( BackWPup_Option::get( 'cfg', 'httpauthuser' ) . ':' . BackWPup_Encryption::decrypt( BackWPup_Option::get( 'cfg', 'httpauthpassword' ) ) ) ),
372
- 'user-agent' => BackWPup::get_plugin_data( 'user-agent' ) ) );
 
 
373
  echo '<tr><td>' . __( 'Server self connect:', 'backwpup' ) . '</td><td>';
374
  $test_result = '';
375
  if ( is_wp_error( $raw_response ) )
376
  $test_result .= sprintf( __( 'The HTTP response test get a error "%s"','backwpup' ), $raw_response->get_error_message() );
377
  if ( 200 != wp_remote_retrieve_response_code( $raw_response ) )
378
  $test_result .= sprintf( __( 'The HTTP response test get a false http status (%s)','backwpup' ), wp_remote_retrieve_response_code( $raw_response ) );
379
- if ( ! strstr( wp_remote_retrieve_body( $raw_response ), 'Response Test O.K.' ) )
380
- $test_result .= sprintf( __( 'The HTTP response gives back the false body "%s"','backwpup' ), strip_tags( wp_remote_retrieve_body( $raw_response ) ) );
 
381
 
382
  if ( empty( $test_result ) )
383
  _e( 'Response Test O.K.', 'backwpup' );
365
  echo '<tr title=""><td>' . __( 'cURL version', 'backwpup' ) . '</td><td>' . __( 'unavailable', 'backwpup' ) . '</td></tr>';
366
  }
367
  //response test
368
+ $raw_response = wp_remote_get( site_url( 'wp-cron.php?backwpup_run=test' ), array(
369
+ 'blocking' => TRUE,
370
+ 'sslverify' => FALSE,
371
+ 'timeout' => 15,
372
+ 'redirection' => 0,
373
+ 'headers' => array( 'Authorization' => 'Basic ' . base64_encode( BackWPup_Option::get( 'cfg', 'httpauthuser' ) . ':' . BackWPup_Encryption::decrypt( BackWPup_Option::get( 'cfg', 'httpauthpassword' ) ) ) ),
374
+ 'user-agent' => BackWPup::get_plugin_data( 'user-agent' ) ) );
375
  echo '<tr><td>' . __( 'Server self connect:', 'backwpup' ) . '</td><td>';
376
  $test_result = '';
377
  if ( is_wp_error( $raw_response ) )
378
  $test_result .= sprintf( __( 'The HTTP response test get a error "%s"','backwpup' ), $raw_response->get_error_message() );
379
  if ( 200 != wp_remote_retrieve_response_code( $raw_response ) )
380
  $test_result .= sprintf( __( 'The HTTP response test get a false http status (%s)','backwpup' ), wp_remote_retrieve_response_code( $raw_response ) );
381
+ $headers = wp_remote_retrieve_headers( $raw_response );
382
+ if ( isset( $headers['x-backwpup-ver'] ) && $headers['x-backwpup-ver'] != BackWPup::get_plugin_data( 'version' ) )
383
+ $test_result .= sprintf( __( 'The BackWPup HTTP response header gives back the false value "%s"','backwpup' ), $headers['x-backwpup-ver'] );
384
 
385
  if ( empty( $test_result ) )
386
  _e( 'Response Test O.K.', 'backwpup' );
js/page_edit_jobtype_dbdump.dev.js CHANGED
@@ -1,16 +1,16 @@
1
  jQuery(document).ready(function ($) {
2
 
3
  $('#dball').click(function () {
4
- $('input[name="tabledb[]"]').prop("checked", true);
5
  });
6
 
7
  $('#dbnone').click(function () {
8
- $('input[name="tabledb[]"]').prop("checked", false);
9
  });
10
 
11
  $('#dbwp').click(function () {
12
- $('input[name="tabledb[]"]').prop("checked", false);
13
- $('input[name="tabledb[]"][value^="' + $('#dbwp').val() + '"]').prop("checked", true);
14
  });
15
 
16
  $('input[name="dbdumpwpdbsettings"]').change(function () {
1
  jQuery(document).ready(function ($) {
2
 
3
  $('#dball').click(function () {
4
+ $('input[name="tabledb[]"]').prop("checked", true).change();;
5
  });
6
 
7
  $('#dbnone').click(function () {
8
+ $('input[name="tabledb[]"]').prop("checked", false).change();;
9
  });
10
 
11
  $('#dbwp').click(function () {
12
+ $('input[name="tabledb[]"]').prop("checked", false).change();;
13
+ $('input[name="tabledb[]"][value^="' + $('#dbwp').val() + '"]').prop("checked", true).change();;
14
  });
15
 
16
  $('input[name="dbdumpwpdbsettings"]').change(function () {
js/page_edit_jobtype_dbdump.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function($){$("#dball").click(function(){$('input[name="tabledb[]"]').prop("checked",true);});$("#dbnone").click(function(){$('input[name="tabledb[]"]').prop("checked",false);});$("#dbwp").click(function(){$('input[name="tabledb[]"]').prop("checked",false);$('input[name="tabledb[]"][value^="'+$("#dbwp").val()+'"]').prop("checked",true);});$('input[name="dbdumpwpdbsettings"]').change(function(){if($('input[name="dbdumpwpdbsettings"]').prop("checked")){$("#dbconnection").hide();}else{$("#dbconnection").show();}});function db_tables(){var data={action:"backwpup_jobtype_dbdump",action2:"tables",dbname:$("#dbdumpdbname").val(),dbhost:$("#dbdumpdbhost").val(),dbuser:$("#dbdumpdbuser").val(),dbpassword:$("#dbdumpdbpassword").val(),wpdbsettings:$("#dbdumpwpdbsettings:checked").val(),jobid:$("#jobid").val(),_ajax_nonce:$("#backwpupajaxnonce").val()};$.post(ajaxurl,data,function(response){$("#dbtables").replaceWith(response);});}$("#dbdumpdbname").change(function(){db_tables();});$("#dbdumpwpdbsettings").change(function(){if($("#dbdumpwpdbsettings:checked").val()){db_tables();}else{db_databases();}});function db_databases(){var data={action:"backwpup_jobtype_dbdump",action2:"databases",dbhost:$("#dbdumpdbhost").val(),dbuser:$("#dbdumpdbuser").val(),dbpassword:$("#dbdumpdbpassword").val(),dbname:$('input[name="dbselected"]').val(),_ajax_nonce:$("#backwpupajaxnonce").val()};$.post(ajaxurl,data,function(response){$("#dbdumpdbname").replaceWith(response);db_tables();$("#dbdumpdbname").change(function(){db_tables();});});}$("#dbdumpdbhost").change(function(){db_databases();});$("#dbdumpdbuser").change(function(){db_databases();});$("#dbdumpdbpassword").change(function(){db_databases();});});
1
+ jQuery(document).ready(function($){$("#dball").click(function(){$('input[name="tabledb[]"]').prop("checked",true).change();});$("#dbnone").click(function(){$('input[name="tabledb[]"]').prop("checked",false).change();});$("#dbwp").click(function(){$('input[name="tabledb[]"]').prop("checked",false).change();$('input[name="tabledb[]"][value^="'+$("#dbwp").val()+'"]').prop("checked",true).change();});$('input[name="dbdumpwpdbsettings"]').change(function(){if($('input[name="dbdumpwpdbsettings"]').prop("checked")){$("#dbconnection").hide();}else{$("#dbconnection").show();}});function db_tables(){var data={action:"backwpup_jobtype_dbdump",action2:"tables",dbname:$("#dbdumpdbname").val(),dbhost:$("#dbdumpdbhost").val(),dbuser:$("#dbdumpdbuser").val(),dbpassword:$("#dbdumpdbpassword").val(),wpdbsettings:$("#dbdumpwpdbsettings:checked").val(),jobid:$("#jobid").val(),_ajax_nonce:$("#backwpupajaxnonce").val()};$.post(ajaxurl,data,function(response){$("#dbtables").replaceWith(response);});}$("#dbdumpdbname").change(function(){db_tables();});$("#dbdumpwpdbsettings").change(function(){if($("#dbdumpwpdbsettings:checked").val()){db_tables();}else{db_databases();}});function db_databases(){var data={action:"backwpup_jobtype_dbdump",action2:"databases",dbhost:$("#dbdumpdbhost").val(),dbuser:$("#dbdumpdbuser").val(),dbpassword:$("#dbdumpdbpassword").val(),dbname:$('input[name="dbselected"]').val(),_ajax_nonce:$("#backwpupajaxnonce").val()};$.post(ajaxurl,data,function(response){$("#dbdumpdbname").replaceWith(response);db_tables();$("#dbdumpdbname").change(function(){db_tables();});});}$("#dbdumpdbhost").change(function(){db_databases();});$("#dbdumpdbuser").change(function(){db_databases();});$("#dbdumpdbpassword").change(function(){db_databases();});});
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: inpsyde, danielhuesken, Bueltge, nullbyte
3
  Tags: backup, dump, database, file, ftp, xml, time, upload, multisite, cloud, dropbox, storage, S3
4
  Requires at least: 3.2
5
  Tested up to: 3.5.1
6
- Stable tag: 3.0.7
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
@@ -179,6 +179,12 @@ Please check all settings after the update:
179
 
180
 
181
  == Changelog ==
 
 
 
 
 
 
182
  = Version 3.0.7 =
183
  * Improved: All job requests will done over wp-cron.php now
184
  * Improved: Ajax calls if blog in maintenance mode
3
  Tags: backup, dump, database, file, ftp, xml, time, upload, multisite, cloud, dropbox, storage, S3
4
  Requires at least: 3.2
5
  Tested up to: 3.5.1
6
+ Stable tag: 3.0.8
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
179
 
180
 
181
  == Changelog ==
182
+ = Version 3.0.8 =
183
+ * Fixed: Selected database tables not save on tab change
184
+ * Fixed: Database tables selection on new job
185
+ * Fixed: adding empty folder names tow archive
186
+ * Improved/Fixed: Dropbox Authentication
187
+
188
  = Version 3.0.7 =
189
  * Improved: All job requests will done over wp-cron.php now
190
  * Improved: Ajax calls if blog in maintenance mode