diff --git a/wp-content/plugins/wp-db-backup.php b/wp-content/plugins/wp-db-backup.php index a6195ba7b..cf93b2e13 100644 --- a/wp-content/plugins/wp-db-backup.php +++ b/wp-content/plugins/wp-db-backup.php @@ -36,8 +36,7 @@ class wpdbBackup { } function wpdbBackup() { - load_plugin_textdomain('wp-db-backup'); - + add_action('wp_cron_daily', array(&$this, 'wp_cron_daily')); $this->backup_dir = trailingslashit($this->backup_dir); @@ -58,14 +57,14 @@ class wpdbBackup { 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 ($user_level < 9) die(__('Need higher user level.')); if (isset($_GET['backup'])) { $via = isset($_GET['via']) ? $_GET['via'] : 'http'; @@ -86,7 +85,7 @@ class wpdbBackup { } } echo ' - alert("' . __('Backup Complete!', 'wp-db-backup') . '"); + alert("' . __('Backup Complete!') . '"); '; break; @@ -112,10 +111,10 @@ class wpdbBackup { echo "
"; //echo "
" . print_r($_POST, 1) . "
"; - echo '

' . __('Backup', 'wp-db-backup') . '

-
' . __('Progress', 'wp-db-backup') . ' - ' . __('

DO NOT DO THE FOLLOWING AS IT WILL CAUSE YOUR BACKUP TO FAIL:

  1. Close this browser
  2. Reload this page
  3. Click the Stop or Back buttons in your browser
', 'wp-db-backup') . ' -

' . __('Progress:', 'wp-db-backup') . '

+ echo '

' . __('Backup') . '

+
' . __('Progress') . ' + ' . __('

DO NOT DO THE FOLLOWING AS IT WILL CAUSE YOUR BACKUP TO FAIL:

  1. Close this browser
  2. Reload this page
  3. Click the Stop or Back buttons in your browser
') . ' +

' . __('Progress:') . '

 
@@ -135,7 +134,7 @@ class wpdbBackup { var errors = document.getElementById("errors"); errors.innerHTML = errors.innerHTML + str + "
"; } - + function backup(table, segment) { var fram = document.getElementById("backuploader"); fram.src = "' . $_SERVER['REQUEST_URI'] . '&fragment=" + table + ":" + segment + ":' . $backup_filename . '"; @@ -158,19 +157,19 @@ class wpdbBackup { switch($_POST['deliver']) { case 'http': echo ' - setProgress("' . sprintf(__("Backup complete, preparing backup for download...", 'wp-db-backup'), $download_uri) . '"); + setProgress("' . sprintf(__("Backup complete, preparing backup for download..."), $download_uri) . '"); fram.src = "' . $download_uri . '"; '; break; case 'smtp': echo ' - setProgress("' . sprintf(__("Backup complete, sending backup via email...", 'wp-db-backup'), $download_uri) . '"); + setProgress("' . sprintf(__("Backup complete, sending backup via email..."), $download_uri) . '"); fram.src = "' . $download_uri . '&via=email&recipient=' . $_POST['backup_recipient'] . '"; '; break; default: echo ' - setProgress("' . sprintf(__("Backup complete, download here.", 'wp-db-backup'), $download_uri) . '"); + setProgress("' . sprintf(__("Backup complete, download here."), $download_uri) . '"); '; } @@ -209,7 +208,7 @@ class wpdbBackup { } if(step != 0) setMeter(100 * step / ' . $step_count . '); } - + nextStep(); //-->
@@ -222,12 +221,12 @@ class wpdbBackup { echo "$table:$segment:$filename"; if($table == '') { - $msg = __("Creating backup file...", 'wp-db-backup'); + $msg = __("Creating backup file..."); } else { if($segment == -1) { - $msg = sprintf(__('Finished backing up table \\"%s\\".', 'wp-db-backup'), $table); + $msg = sprintf(__('Finished backing up table \\"%s\\".'), $table); } else { - $msg = sprintf(__('Backing up table \\"%s\\"...', 'wp-db-backup'), $table); + $msg = sprintf(__('Backing up table \\"%s\\"...'), $table); } } @@ -239,8 +238,8 @@ class wpdbBackup { if (is_writable(ABSPATH . $this->backup_dir)) { $this->fp = $this->open(ABSPATH . $this->backup_dir . $filename, 'a'); if(!$this->fp) { - $this->backup_error(__('Could not open the backup file for writing!', 'wp-db-backup')); - $this->fatal_error = __('The backup file could not be saved. Please check the permissions for writing to your backup directory and try again.', 'wp-db-backup'); + $this->backup_error(__('Could not open the backup file for writing!')); + $this->fatal_error = __('The backup file could not be saved. Please check the permissions for writing to your backup directory and try again.'); } else { if($table == '') { @@ -265,8 +264,8 @@ class wpdbBackup { } } } else { - $this->backup_error(__('The backup directory is not writeable!', 'wp-db-backup')); - $this->fatal_error = __('The backup directory is not writeable! Please check the permissions for writing to your backup directory and try again.', 'wp-db-backup'); + $this->backup_error(__('The backup directory is not writeable!')); + $this->fatal_error = __('The backup directory is not writeable! Please check the permissions for writing to your backup directory and try again.'); } if($this->fp) $this->close($this->fp); @@ -315,13 +314,13 @@ class wpdbBackup { /////////////////////////////// function admin_menu() { - add_management_page('Backup', 'Backup', 9, basename(__FILE__), array(&$this, 'backup_menu')); + add_management_page(__('Backup'), __('Backup'), 9, basename(__FILE__), array(&$this, 'backup_menu')); } function fragment_menu() { - add_management_page('Backup', 'Backup', 9, basename(__FILE__), array(&$this, 'build_backup_script')); + add_management_page(__('Backup'), __('Backup'), 9, basename(__FILE__), array(&$this, 'build_backup_script')); } - + ///////////////////////////////////////////////////////// function sql_addslashes($a_string = '', $is_like = FALSE) { @@ -335,10 +334,10 @@ class wpdbBackup { $a_string = str_replace('\\', '\\\\', $a_string); } $a_string = str_replace('\'', '\\\'', $a_string); - + return $a_string; } // function sql_addslashes($a_string = '', $is_like = FALSE) - + /////////////////////////////////////////////////////////// function backquote($a_name) { @@ -386,12 +385,12 @@ class wpdbBackup { function stow($query_line) { if ($this->gzip()) { if(@gzwrite($this->fp, $query_line) === FALSE) { - backup_error(__('There was an error writing a line to the backup script:', 'wp-db-backup')); + backup_error(__('There was an error writing a line to the backup script:')); backup_error('  ' . $query_line); } } else { if(@fwrite($this->fp, $query_line) === FALSE) { - backup_error(__('There was an error writing a line to the backup script:', 'wp-db-backup')); + backup_error(__('There was an error writing a line to the backup script:')); backup_error('  ' . $query_line); } } @@ -401,7 +400,7 @@ class wpdbBackup { if(count($this->backup_errors) < 20) { $this->backup_errors[] = $err; } elseif(count($this->backup_errors) == 20) { - $this->backup_errors[] = __('Subsequent errors have been omitted from this log.', 'wp-db-backup'); + $this->backup_errors[] = __('Subsequent errors have been omitted from this log.'); } } @@ -420,7 +419,7 @@ class wpdbBackup { $table_structure = $wpdb->get_results("DESCRIBE $table"); if (! $table_structure) { - backup_errors(__('Error getting table details', 'wp-db-backup') . ": $table"); + backup_errors(__('Error getting table details') . ": $table"); return FALSE; } @@ -445,13 +444,13 @@ class wpdbBackup { $create_table = $wpdb->get_results("SHOW CREATE TABLE $table", ARRAY_N); if (FALSE === $create_table) { - $this->backup_error(sprintf(__("Error with SHOW CREATE TABLE for %s.", 'wp-db-backup'), $table)); + $this->backup_error(sprintf(__("Error with SHOW CREATE TABLE for %s."), $table)); $this->stow("#\n# Error with SHOW CREATE TABLE for $table!\n#\n"); } $this->stow($create_table[0][1] . ' ;'); if (FALSE === $table_structure) { - $this->backup_error(sprintf(__("Error getting table structure of %s", 'wp-db-backup'), $table)); + $this->backup_error(sprintf(__("Error getting table structure of %s"), $table)); $this->stow("#\n# Error getting table structure of $table!\n#\n"); } @@ -490,7 +489,7 @@ class wpdbBackup { do { if ( !ini_get('safe_mode')) @set_time_limit(15*60); $table_data = $wpdb->get_results("SELECT * FROM $table LIMIT {$row_start}, {$row_inc}", ARRAY_A); - + /* if (FALSE === $table_data) { $wp_backup_error .= "Error getting table contents from $table\r\n"; @@ -560,11 +559,11 @@ class wpdbBackup { if (is_writable(ABSPATH . $this->backup_dir)) { $this->fp = $this->open(ABSPATH . $this->backup_dir . $wp_backup_filename); if(!$this->fp) { - $this->backup_error(__('Could not open the backup file for writing!', 'wp-db-backup')); + $this->backup_error(__('Could not open the backup file for writing!')); return false; } } else { - $this->backup_error(__('The backup directory is not writeable!', 'wp-db-backup')); + $this->backup_error(__('The backup directory is not writeable!')); return false; } @@ -608,9 +607,9 @@ class wpdbBackup { $diskfile = ABSPATH . $this->backup_dir . $filename; if ('http' == $delivery) { if (! file_exists($diskfile)) { - $msg = sprintf(__('File not found:
%1s
', 'wp-db-backup'), $filename); + $msg = sprintf(__('File not found:
%1s
'), $filename); $this_basename = preg_replace('/^.*wp-content[\\\\\/]plugins[\\\\\/]/', '', __FILE__); - $msg .= '
' . __('Return to Backup', 'wp-db-backup'); + $msg .= '
' . __('Return to Backup'); die($msg); } header('Content-Description: File Transfer'); @@ -635,7 +634,7 @@ class wpdbBackup { $headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\"\n"; $headers .= 'From: ' . get_settings('admin_email') . "\n"; - $message = sprintf(__("Attached to this email is\n %1s\n Size:%2s kilobytes\n", 'wp-db-backup'), $filename, round(filesize($diskfile)/1024)); + $message = sprintf(__("Attached to this email is\n %1s\n Size:%2s kilobytes\n"), $filename, round(filesize($diskfile)/1024)); // Add a multipart boundary above the plain message $message = "This is a multi-part message in MIME format.\n\n" . "--{$boundary}\n" . @@ -654,9 +653,9 @@ class wpdbBackup { "--{$boundary}--\n"; if (function_exists('wp_mail')) { - wp_mail ($recipient, get_bloginfo('name') . ' ' . __('Database Backup', 'wp-db-backup'), $message, $headers); + wp_mail ($recipient, get_bloginfo('name') . ' ' . __('Database Backup'), $message, $headers); } else { - mail ($recipient, get_bloginfo('name') . ' ' . __('Database Backup', 'wp-db-backup'), $message, $headers); + mail ($recipient, get_bloginfo('name') . ' ' . __('Database Backup'), $message, $headers); } unlink($diskfile); @@ -672,11 +671,11 @@ class wpdbBackup { // did we just do a backup? If so, let's report the status if ( $this->backup_complete ) { - $feedback = '

' . __('Backup Successful', 'wp-db-backup') . '!'; + $feedback = '

' . __('Backup Successful') . '!'; $file = $this->backup_file; switch($_POST['deliver']) { case 'http': - $feedback .= '
' . sprintf(__('Your backup file:
%2s should begin downloading shortly.', 'wp-db-backup'), get_settings('siteurl') . "/{$this->backup_dir}{$this->backup_file}", $this->backup_file); + $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'])) { @@ -684,17 +683,17 @@ class wpdbBackup { } else { $feedback .= $_POST['backup_recipient']; } - $feedback = '
' . sprintf(__('Your backup has been emailed to %s', 'wp-db-backup'), $feedback); + $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"', 'wp-db-backup'); - $feedback .= ':
backup_dir}$file\">$file : " . filesize(ABSPATH . $this->backup_dir . $file) . __(' bytes', 'wp-db-backup'); + $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 : " . filesize(ABSPATH . $this->backup_dir . $file) . __(' bytes'); } $feedback .= '

'; } if (count($this->backup_errors)) { - $feedback .= '
' . __('The following errors were reported', 'wp-db-backup') . ":
";
+			$feedback .= '
' . __('The following errors were reported') . ":
";
 			foreach($this->backup_errors as $error) {
 				$feedback .= "{$error}\n";  //Errors are already localized
 			}
@@ -708,7 +707,7 @@ class wpdbBackup {
 			if (is_email($_POST['cron_backup_recipient'])) {
 				update_option('wp_cron_backup_recipient', $_POST['cron_backup_recipient'], FALSE);
 			}
-			$feedback .= '

' . __('Scheduled Backup Options Saved!', 'wp-db-backup') . '

'; + $feedback .= '

' . __('Scheduled Backup Options Saved!') . '

'; } // Simple table name storage @@ -739,13 +738,13 @@ class wpdbBackup { if ( @ mkdir( ABSPATH . $this->backup_dir) ) { @ chmod( ABSPATH . $this->backup_dir, $dir_perms); } else { - echo '

' . __('WARNING: Your wp-content directory is NOT writable! We can not create the backup directory.', 'wp-db-backup') . '
' . ABSPATH . $this->backup_dir . "

"; + echo '

' . __('WARNING: Your wp-content directory is NOT writable! We can not create the backup directory.') . '
' . ABSPATH . $this->backup_dir . "

"; $WHOOPS = TRUE; } } if ( !is_writable( ABSPATH . $this->backup_dir) ) { - echo '

' . __('WARNING: Your backup directory is NOT writable! We can not create the backup directory.', 'wp-db-backup') . '
' . ABSPATH . "

"; + echo '

' . __('WARNING: Your backup directory is NOT writable! We can not create the backup directory.') . '
' . ABSPATH . "

"; } if ( !file_exists( ABSPATH . $this->backup_dir . 'index.php') ) { @@ -753,28 +752,28 @@ class wpdbBackup { } echo "
"; - echo '

' . __('Backup', 'wp-db-backup') . '

'; - echo '
' . __('Tables', 'wp-db-backup') . ''; + echo '

' . __('Backup') . '

'; + echo '
' . __('Tables') . ''; echo '
'; echo '
'; - echo __('These core WordPress tables will always be backed up', 'wp-db-backup') . ':
    '; + echo __('These core WordPress tables will always be backed up') . ':
      '; foreach ($wp_backup_default_tables as $table) { echo "
    • $table
    • "; } echo '
'; if (count($other_tables) > 0) { - echo __('You may choose to include any of the following tables', 'wp-db-backup') . ':
'; + echo __('You may choose to include any of the following tables') . ':
'; foreach ($other_tables as $table) { echo ""; } } echo '
'; - echo '
' . __('Backup Options', 'wp-db-backup') . ''; - echo __('What to do with the backup file', 'wp-db-backup') . ":
"; - echo '"; - echo ''; + echo '
' . __('Backup Options') . ''; + echo __('What to do with the backup file') . ":
"; + echo '"; + echo ''; echo '
'; - echo sprintf(__(' %s', 'wp-db-backup'), ''); + echo sprintf(__(' %s'), ''); // Check DB dize. $table_status = $wpdb->get_results("SHOW TABLE STATUS FROM " . $this->backquote(DB_NAME)); @@ -792,45 +791,45 @@ class wpdbBackup { if (! $WHOOPS) { echo '
'; - echo '

'; + echo '

'; } else { - echo '

' . __('WARNING: Your backup directory is NOT writable!', 'wp-db-backup') . '

'; + echo '

' . __('WARNING: Your backup directory is NOT writable!') . '

'; } echo '
'; echo ''; // this stuff only displays if wp_cron is installed if (function_exists('wp_cron_init')) { - echo '
' . __('Scheduled Backup', 'wp-db-backup') . ''; + echo '
' . __('Scheduled Backup') . ''; $datetime = get_settings('date_format') . ' @ ' . get_settings('time_format'); - echo '

' . __('Last WP-Cron Daily Execution', 'wp-db-backup') . ': ' . date($datetime, get_option('wp_cron_daily_lastrun')) . '
'; - echo __('Next WP-Cron Daily Execution', 'wp-db-backup') . ': ' . date($datetime, (get_option('wp_cron_daily_lastrun') + 86400)) . '

'; + echo '

' . __('Last WP-Cron Daily Execution') . ': ' . date($datetime, get_option('wp_cron_daily_lastrun')) . '
'; + echo __('Next WP-Cron Daily Execution') . ': ' . date($datetime, (get_option('wp_cron_daily_lastrun') + 86400)) . '

'; echo '
'; echo ''; echo ''; $cron_tables = get_option('wp_cron_backup_tables'); if (! is_array($cron_tables)) { $cron_tables = array(); } if (count($other_tables) > 0) { - echo ''; } - echo '
'; - echo __('Schedule: ', 'wp-db-backup'); + echo __('Schedule: '); $wp_cron_backup_schedule = get_option('wp_cron_backup_schedule'); - $schedule = array(0 => __('None', 'wp-db-backup'), 1 => __('Daily', 'wp-db-backup')); + $schedule = array(0 => __('None'), 1 => __('Daily')); foreach ($schedule as $value => $name) { echo ' ' . __($name, 'wp-db-backup'); + echo 'value="' . $value . '" /> ' . __($name); } echo ''; $cron_recipient = get_option('wp_cron_backup_recipient'); if (! is_email($cron_recipient)) { $cron_recipient = get_settings('admin_email'); } - echo __('Email backup to', 'wp-db-backup') . ': '; + echo __('Email backup to') . ': '; echo '
' . __('Tables to include', 'wp-db-backup') . ':
'; + echo '
' . __('Tables to include') . ':
'; foreach ($other_tables as $table) { echo '
'; + echo ''; echo '
'; } // end of wp_cron section