backup_dir = trailingslashit($this->backup_dir); $this->basename = preg_replace('/^.*wp-content[\\\\\/]plugins[\\\\\/]/', '', __FILE__); if (isset($_POST['do_backup'])) { switch($_POST['do_backup']) { case 'backup': $this->perform_backup(); break; case 'fragments': add_action('admin_menu', array(&$this, 'fragment_menu')); break; } } elseif (isset($_GET['fragment'] )) { add_action('init', array(&$this, 'init')); } elseif (isset($_GET['backup'] )) { add_action('init', array(&$this, 'init')); } else { add_action('admin_menu', array(&$this, 'admin_menu')); } } function init() { global $user_level; get_currentuserinfo(); if ($user_level < 9) die(__('Need higher user level.')); if (isset($_GET['backup'])) { $via = isset($_GET['via']) ? $_GET['via'] : 'http'; $this->backup_file = $_GET['backup']; switch($via) { case 'smtp': case 'email': $this->deliver_backup ($this->backup_file, 'smtp', $_GET['recipient']); echo ' '; break; default: $this->deliver_backup ($this->backup_file, $via); } die(); } if (isset($_GET['fragment'] )) { list($table, $segment, $filename) = explode(':', $_GET['fragment']); $this->backup_fragment($table, $segment, $filename); } die(); } function build_backup_script() { global $wpdb; $datum = date("Ymd_B"); $backup_filename = DB_NAME . '_' . $wpdb->prefix . $datum . '.sql'; if ($this->gzip()) $backup_filename .= '.gz'; echo "
" . print_r($_POST, 1) . ""; echo '
' . __('Backup Successful') . '!';
$file = $this->backup_file;
switch($_POST['deliver']) {
case 'http':
$feedback .= '
' . sprintf(__('Your backup file: %2s should begin downloading shortly.'), get_settings('siteurl') . "/{$this->backup_dir}{$this->backup_file}", $this->backup_file);
break;
case 'smtp':
if (! is_email($_POST['backup_recipient'])) {
$feedback .= get_settings('admin_email');
} else {
$feedback .= $_POST['backup_recipient'];
}
$feedback = '
' . sprintf(__('Your backup has been emailed to %s'), $feedback);
break;
case 'none':
$feedback .= '
' . __('Your backup file has been saved on the server. If you would like to download it now, right click and select "Save As"');
$feedback .= ':
backup_dir}$file\">$file : " . sprintf(__('%s bytes'), filesize(ABSPATH . $this->backup_dir . $file));
}
$feedback .= '
"; foreach($this->backup_errors as $error) { $feedback .= "{$error}\n"; //Errors are already localized } $feedback .= "
' . __('Scheduled Backup Options Saved!') . '
' . __('WARNING: Your wp-content directory is NOT writable! We can not create the backup directory.') . '
' . ABSPATH . $this->backup_dir . "
' . __('WARNING: Your backup directory is NOT writable! We can not create the backup directory.') . '
' . ABSPATH . "