diff -r 490d5cc509ed -r cf61fcea0001 wp/wp-content/plugins/wp-db-backup/wp-db-backup.php --- a/wp/wp-content/plugins/wp-db-backup/wp-db-backup.php Tue Jun 09 11:14:17 2015 +0000 +++ b/wp/wp-content/plugins/wp-db-backup/wp-db-backup.php Mon Oct 14 17:39:30 2019 +0200 @@ -1,13 +1,13 @@ Tools → Backup to get started. -Author: Austin Matzko +Author: Austin Matzko Author URI: http://austinmatzko.com/ -Version: 2.2.4 +Version: 2.3.3 -Copyright 2013 Austin Matzko (email : austin at pressedcode.com) +Copyright 2018 Austin Matzko (email : austin at pressedcode.com) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -24,36 +24,22 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA */ -/** - * Change WP_BACKUP_DIR if you want to - * use a different backup location - */ - if ( ! defined('ABSPATH') ) { die('Please do not load this file directly.'); } $rand = substr( md5( md5( DB_PASSWORD ) ), -5 ); -global $wpdbb_content_dir, $wpdbb_content_url, $wpdbb_plugin_dir; +global $wpdbb_content_dir, $wpdbb_content_url; $wpdbb_content_dir = ( defined('WP_CONTENT_DIR') ) ? WP_CONTENT_DIR : ABSPATH . 'wp-content'; $wpdbb_content_url = ( defined('WP_CONTENT_URL') ) ? WP_CONTENT_URL : get_option('siteurl') . '/wp-content'; -$wpdbb_plugin_dir = ( defined('WP_PLUGIN_DIR') ) ? WP_PLUGIN_DIR : $wpdbb_content_dir . '/plugins'; - -if ( ! defined('WP_BACKUP_DIR') ) { - define('WP_BACKUP_DIR', $wpdbb_content_dir . '/backup-' . $rand . '/'); -} - -if ( ! defined('WP_BACKUP_URL') ) { - define('WP_BACKUP_URL', $wpdbb_content_url . '/backup-' . $rand . '/'); -} if ( ! defined('ROWS_PER_SEGMENT') ) { define('ROWS_PER_SEGMENT', 100); } -/** - * Set MOD_EVASIVE_OVERRIDE to true - * and increase MOD_EVASIVE_DELAY +/** + * Set MOD_EVASIVE_OVERRIDE to true + * and increase MOD_EVASIVE_DELAY * if the backup stops prematurely. */ // define('MOD_EVASIVE_OVERRIDE', false); @@ -71,30 +57,30 @@ var $basename; var $page_url; var $referer_check_key; - var $version = '2.1.5-alpha'; + var $version = '2.3.3'; function module_check() { $mod_evasive = false; if ( defined( 'MOD_EVASIVE_OVERRIDE' ) && true === MOD_EVASIVE_OVERRIDE ) return true; if ( ! defined( 'MOD_EVASIVE_OVERRIDE' ) || false === MOD_EVASIVE_OVERRIDE ) return false; - if ( function_exists('apache_get_modules') ) - foreach( (array) apache_get_modules() as $mod ) + if ( function_exists('apache_get_modules') ) + foreach( (array) apache_get_modules() as $mod ) if ( false !== strpos($mod,'mod_evasive') || false !== strpos($mod,'mod_dosevasive') ) return true; return false; } - function wpdbBackup() { + function __construct() { global $table_prefix, $wpdb; add_action('wp_ajax_save_backup_time', array(&$this, 'save_backup_time')); add_action('init', array(&$this, 'init_textdomain')); add_action('init', array(&$this, 'set_page_url')); - add_action('load-update-core.php', array(&$this, 'update_notice_action')); + add_action('admin_init', array(&$this, 'update_notice_action')); add_action('wp_db_backup_cron', array(&$this, 'cron_backup')); add_action('wp_cron_daily', array(&$this, 'wp_cron_daily')); add_filter('cron_schedules', array(&$this, 'add_sched_options')); add_filter('wp_db_b_schedule_choices', array(&$this, 'schedule_choices')); - + $table_prefix = ( isset( $table_prefix ) ) ? $table_prefix : $wpdb->prefix; $datum = date("Ymd_B"); $this->backup_filename = DB_NAME . "_$table_prefix$datum.sql"; @@ -122,27 +108,29 @@ $this->core_table_names[] = $wpdb->{$name}; } } - - $this->backup_dir = trailingslashit(apply_filters('wp_db_b_backup_dir', WP_BACKUP_DIR)); + + $requested_temp_dir = sanitize_text_field($_GET['wp_db_temp_dir']); + $this->backup_dir = trailingslashit(apply_filters('wp_db_b_backup_dir', (isset($requested_temp_dir) && is_writable($requested_temp_dir)) ? $requested_temp_dir : get_temp_dir())); $this->basename = 'wp-db-backup'; - + $this->referer_check_key = $this->basename . '-download_' . DB_NAME; if (isset($_POST['do_backup'])) { $this->wp_secure('fatal'); check_admin_referer($this->referer_check_key); $this->can_user_backup('main'); + // save exclude prefs - - $exc_revisions = isset( $_POST['exclude-revisions'] ) ? (array) $_POST['exclude-revisions'] : array(); - $exc_spam = isset( $_POST['exclude-spam'] ) ? (array) $_POST['exclude-spam'] : array(); - update_option('wp_db_backup_excs', array('revisions' => $exc_revisions, 'spam' => $exc_spam)); + update_option('wp_db_backup_excs', array( + 'revisions' => $this->get_revisions_to_exclude(), + 'spam' => $this->get_spam_to_exclude() + )); switch($_POST['do_backup']) { case 'backup': add_action('init', array(&$this, 'perform_backup')); break; case 'fragments': add_action('admin_menu', array(&$this, 'fragment_menu')); - break; + break; } } elseif (isset($_GET['fragment'] )) { $this->can_user_backup('frame'); @@ -154,19 +142,19 @@ add_action('admin_menu', array(&$this, 'admin_menu')); } } - + function init() { $this->can_user_backup(); if (isset($_GET['backup'])) { - $via = isset($_GET['via']) ? $_GET['via'] : 'http'; - - $this->backup_file = $_GET['backup']; + $via = isset($_GET['via']) ? sanitize_text_field($_GET['via']) : 'http'; + + $this->backup_file = sanitize_text_field($_GET['backup']); $this->validate_file($this->backup_file); switch($via) { case 'smtp': case 'email': - $success = $this->deliver_backup($this->backup_file, 'smtp', $_GET['recipient'], 'frame'); + $success = $this->deliver_backup($this->backup_file, 'smtp', sanitize_text_field($_GET['recipient']), 'frame'); $this->error_display( 'frame' ); if ( $success ) { echo ' @@ -175,7 +163,7 @@ '; echo ' alert("' . __('Backup Complete!','wp-db-backup') . '"); - window.onbeforeunload = null; + window.onbeforeunload = null; '; } @@ -183,7 +171,7 @@ default: $success = $this->deliver_backup($this->backup_file, $via); echo $this->error_display( 'frame', false ); - + if ( $success ) { echo '