BackUpWordPress - Version 0.3.2

Version Description

Download this release

Release Info

Developer wpdprx
Plugin Icon 128x128 BackUpWordPress
Version 0.3.2
Comparing to
See all releases

Code changes from version 0.3.1 to 0.3.2

backupwordpress.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: BackUpWordPress
4
  Plugin URI: http://wordpress.designpraxis.at
5
  Description: Manage <a href="admin.php?page=backupwordpress/backupwordpress.php">WordPress Backups</a>. Beta Release. Please help testing and give me feedback under the comments section of <a href="http://wordpress.designpraxis.at/plugins/backupwordpress/">the Plugin page</a>. Backup DB, Files & Folders, use .tar.gz, .zip, Exclude List, etc.
6
  Author: Roland Rust
7
- Version: 0.3.1
8
  Author URI: http://wordpress.designpraxis.at
9
  */
10
 
@@ -26,7 +26,7 @@ Author URI: http://wordpress.designpraxis.at
26
  */
27
 
28
  $GLOBALS['bkpwp_plugin_path'] = ABSPATH."wp-content/plugins/backupwordpress/";
29
- $GLOBALS['bkpwp_version'] = "0.3.1";
30
 
31
  // get the functions
32
  require_once($GLOBALS['bkpwp_plugin_path']."functions.php");
@@ -47,6 +47,7 @@ add_action('deactivate_backupwordpress/backupwordpress.php', 'bkpwp_exit');
47
  // set up ajax stuff on init, to prevent header oputput
48
  add_action('init', 'bkpwp_download_files');
49
  add_action('init', 'bkpwp_setup');
 
50
  add_action('init', 'bkpwp_proceed_unfinished');
51
 
52
  // cron jobs with wordpress' pseude-cron: add special reccurences
4
  Plugin URI: http://wordpress.designpraxis.at
5
  Description: Manage <a href="admin.php?page=backupwordpress/backupwordpress.php">WordPress Backups</a>. Beta Release. Please help testing and give me feedback under the comments section of <a href="http://wordpress.designpraxis.at/plugins/backupwordpress/">the Plugin page</a>. Backup DB, Files & Folders, use .tar.gz, .zip, Exclude List, etc.
6
  Author: Roland Rust
7
+ Version: 0.3.2
8
  Author URI: http://wordpress.designpraxis.at
9
  */
10
 
26
  */
27
 
28
  $GLOBALS['bkpwp_plugin_path'] = ABSPATH."wp-content/plugins/backupwordpress/";
29
+ $GLOBALS['bkpwp_version'] = "0.3.2";
30
 
31
  // get the functions
32
  require_once($GLOBALS['bkpwp_plugin_path']."functions.php");
47
  // set up ajax stuff on init, to prevent header oputput
48
  add_action('init', 'bkpwp_download_files');
49
  add_action('init', 'bkpwp_setup');
50
+ add_action('init', 'bkpwp_security_check');
51
  add_action('init', 'bkpwp_proceed_unfinished');
52
 
53
  // cron jobs with wordpress' pseude-cron: add special reccurences
bkpwp-classes/manage_backups.php CHANGED
@@ -1004,7 +1004,7 @@ class BKPWP_MANAGE {
1004
  }
1005
  if ($handle = opendir($bkpwppath)) {
1006
  while (false !== ($file = readdir($handle))) {
1007
- if (($file != ".") && ($file != "..") && !is_dir($bkpwppath."/".$file)) {
1008
  $files[] = array("file" => $bkpwppath."/".$file,
1009
  "filename" => $file);
1010
  }
1004
  }
1005
  if ($handle = opendir($bkpwppath)) {
1006
  while (false !== ($file = readdir($handle))) {
1007
+ if ((substr($file,0,1) != ".") && !is_dir($bkpwppath."/".$file)) {
1008
  $files[] = array("file" => $bkpwppath."/".$file,
1009
  "filename" => $file);
1010
  }
bkpwp-classes/options.php CHANGED
@@ -345,6 +345,12 @@ class BKPWP_OPTIONS {
345
  return $a;
346
  }
347
 
 
 
 
 
 
 
348
  function bkpwp_default_archive_types() {
349
  // a wishlist of compression types
350
  $archive_types_wishlist = array();
@@ -448,6 +454,7 @@ class BKPWP_OPTIONS {
448
  $this->bkpwp_default_excludelists();
449
  $this->bkpwp_default_presets();
450
  $this->bkpwp_default_schedules();
 
451
  }
452
  }
453
  ?>
345
  return $a;
346
  }
347
 
348
+ function bkpwp_add_capabilities() {
349
+ global $wp_roles;
350
+ $wp_roles->add_cap('administrator','manage_backups', true);
351
+ $wp_roles->add_cap('administrator','download_backups', true);
352
+ }
353
+
354
  function bkpwp_default_archive_types() {
355
  // a wishlist of compression types
356
  $archive_types_wishlist = array();
454
  $this->bkpwp_default_excludelists();
455
  $this->bkpwp_default_presets();
456
  $this->bkpwp_default_schedules();
457
+ $this->bkpwp_add_capabilities();
458
  }
459
  }
460
  ?>
functions.php CHANGED
@@ -21,18 +21,20 @@ function bkpwp_exit() {
21
  delete_option("bkpwp_domain_path");
22
  delete_option("bkpwp_archive_types");
23
  delete_option("bkpwp_easy_mode");
24
- delete_option("bkpwp_excludelists");
25
  delete_option("bkpwp_reccurrences");
26
  delete_option("bkpwp_calculation");
27
- delete_option("bkpwp_max_backups");
28
  delete_option("bkpwp_listmax_backups");
29
  delete_option("bkpwp_automail");
30
  delete_option("bkpwp_automail_maxsize");
31
- delete_option("bkpwp_automail_address");
32
- delete_option("bkpwp_automail_receiver");
33
- delete_option("bkpwp_automail_from");
34
  delete_option("bkpwp_status");
35
  delete_option("bkpwp_status_config");
 
 
 
 
 
 
 
36
  }
37
 
38
  function bkpwp_setup() {
@@ -319,6 +321,9 @@ function bkpwp_schedule_bkpwp($options) {
319
 
320
  function bkpwp_download_files() {
321
  if (!empty($_REQUEST['bkpwp_download'])) {
 
 
 
322
  $file = base64_decode($_REQUEST['bkpwp_download']);
323
  bkpwp_send_file($file);
324
  }
@@ -361,5 +366,20 @@ function bkpwp_send_file($path) {
361
  return((connection_status()==0) and !connection_aborted());
362
  }
363
 
364
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
365
  ?>
21
  delete_option("bkpwp_domain_path");
22
  delete_option("bkpwp_archive_types");
23
  delete_option("bkpwp_easy_mode");
 
24
  delete_option("bkpwp_reccurrences");
25
  delete_option("bkpwp_calculation");
 
26
  delete_option("bkpwp_listmax_backups");
27
  delete_option("bkpwp_automail");
28
  delete_option("bkpwp_automail_maxsize");
 
 
 
29
  delete_option("bkpwp_status");
30
  delete_option("bkpwp_status_config");
31
+
32
+ // configuration options to keep
33
+ //delete_option("bkpwp_excludelists");
34
+ //delete_option("bkpwp_max_backups");
35
+ //delete_option("bkpwp_automail_address");
36
+ //delete_option("bkpwp_automail_receiver");
37
+ //delete_option("bkpwp_automail_from");
38
  }
39
 
40
  function bkpwp_setup() {
321
 
322
  function bkpwp_download_files() {
323
  if (!empty($_REQUEST['bkpwp_download'])) {
324
+ if (!current_user_can("download_backups")) {
325
+ die("Permission denied");
326
+ }
327
  $file = base64_decode($_REQUEST['bkpwp_download']);
328
  bkpwp_send_file($file);
329
  }
366
  return((connection_status()==0) and !connection_aborted());
367
  }
368
 
369
+ function bkpwp_security_check() {
370
+ // secure the backup directory with .htaccess
371
+ // deny from all
372
+ $path = get_option("bkpwppath");
373
+ if (empty($path)) { return; }
374
+ $filename = $path."/.htaccess";
375
+ if (!$handle = fopen($filename, 'w')) {
376
+ echo "Cannot open file ($filename)";
377
+ // should be checked at configuration
378
+ }
379
+ if (fwrite($handle, "deny from all") === FALSE) {
380
+ echo "Cannot write to file ($filename)";
381
+ // todo: warn the blog owner
382
+ }
383
+ fclose($handle);
384
+ }
385
  ?>
readme.txt CHANGED
@@ -72,6 +72,10 @@ Some pieces of code have been modified:
72
 
73
  Changelog:
74
 
 
 
 
 
75
  Changes in 0.2.7:
76
 
77
  + manage presets. link to configure excludelists corrected
72
 
73
  Changelog:
74
 
75
+ Changes in 0.3.2:
76
+ + added capabilities manage_backups and download_backups
77
+ + backup repository secured by .htaccess
78
+
79
  Changes in 0.2.7:
80
 
81
  + manage presets. link to configure excludelists corrected