Changeset 6478
- Timestamp:
- 09/26/2006 03:11:54 AM (20 years ago)
- File:
-
- 1 edited
-
wp-db-backup/trunk/wp-db-backup.php (modified) (44 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-db-backup/trunk/wp-db-backup.php
r3079 r6478 5 5 Description: On-demand backup of your WordPress database. 6 6 Author: Scott Merrill 7 Version: 1. 77 Version: 1.8 8 8 Author URI: http://www.skippy.net/ 9 9 … … 17 17 // CHANGE THIS IF YOU WANT TO USE A 18 18 // DIFFERENT BACKUP LOCATION 19 define('WP_BACKUP_DIR', 'wp-content/backup'); 19 20 $rand = substr( md5( md5( DB_PASSWORD ) ), -5 ); 21 22 define('WP_BACKUP_DIR', 'wp-content/backup-' . $rand); 20 23 21 24 define('ROWS_PER_SEGMENT', 100); … … 34 37 35 38 function wpdbBackup() { 36 load_plugin_textdomain('wp-db-backup');37 38 39 add_action('wp_cron_daily', array(&$this, 'wp_cron_daily')); 39 40 … … 42 43 43 44 if (isset($_POST['do_backup'])) { 45 if ( !current_user_can('import') ) die(__('You are not allowed to perform backups.')); 44 46 switch($_POST['do_backup']) { 45 47 case 'backup': … … 51 53 } 52 54 } elseif (isset($_GET['fragment'] )) { 55 if ( !current_user_can('import') ) die(__('You are not allowed to perform backups.')); 53 56 add_action('init', array(&$this, 'init')); 54 57 } elseif (isset($_GET['backup'] )) { 58 if ( !current_user_can('import') ) die(__('You are not allowed to perform backups.')); 55 59 add_action('init', array(&$this, 'init')); 56 60 } else { 57 61 add_action('admin_menu', array(&$this, 'admin_menu')); 58 } 62 } 59 63 } 60 64 61 65 function init() { 62 global $user_level; 63 get_currentuserinfo(); 64 65 if ($user_level < 9) die('Need higher user level.'); 66 if ( !current_user_can('import') ) die(__('You are not allowed to perform backups.')); 66 67 67 68 if (isset($_GET['backup'])) { … … 69 70 70 71 $this->backup_file = $_GET['backup']; 71 72 $this->validate_file($this->backup_file); 73 72 74 switch($via) { 73 75 case 'smtp': … … 84 86 } 85 87 echo ' 86 alert("' . __('Backup Complete!' , 'wp-db-backup') . '");88 alert("' . __('Backup Complete!') . '"); 87 89 </script> 88 90 '; … … 95 97 if (isset($_GET['fragment'] )) { 96 98 list($table, $segment, $filename) = explode(':', $_GET['fragment']); 99 $this->validate_file($filename); 97 100 $this->backup_fragment($table, $segment, $filename); 98 101 } … … 110 113 echo "<div class='wrap'>"; 111 114 //echo "<pre>" . print_r($_POST, 1) . "</pre>"; 112 echo '<h2>' . __('Backup', 'wp-db-backup') . '</h2> 113 <fieldset class="options"><legend>' . __('Progress', 'wp-db-backup') . '</legend> 114 ' . __('<p><strong>DO NOT DO THE FOLLOWING AS IT WILL CAUSE YOUR BACKUP TO FAIL:</strong></p> <ol><li>Close this browser</li><li>Reload this page</li><li>Click the Stop or Back buttons in your browser</li></ol>', 'wp-db-backup') . ' 115 <p><strong>' . __('Progress:', 'wp-db-backup') . '</strong></p> 115 echo '<h2>' . __('Backup') . '</h2> 116 <fieldset class="options"><legend>' . __('Progress') . '</legend> 117 <p><strong>' . 118 __('DO NOT DO THE FOLLOWING AS IT WILL CAUSE YOUR BACKUP TO FAIL:'). 119 '</strong></p> 120 <ol> 121 <li>'.__('Close this browser').'</li> 122 <li>'.__('Reload this page').'</li> 123 <li>'.__('Click the Stop or Back buttons in your browser').'</li> 124 </ol> 125 <p><strong>' . __('Progress:') . '</strong></p> 116 126 <div id="meterbox" style="height:11px;width:80%;padding:3px;border:1px solid #659fff;"><div id="meter" style="height:11px;background-color:#659fff;width:0%;text-align:center;font-size:6pt;"> </div></div> 117 127 <div id="progress_message"></div> … … 133 143 errors.innerHTML = errors.innerHTML + str + "<br />"; 134 144 } 135 145 136 146 function backup(table, segment) { 137 147 var fram = document.getElementById("backuploader"); … … 156 166 case 'http': 157 167 echo ' 158 setProgress("' . sprintf(__("Backup complete, preparing <a href=\\\"%s\\\">backup</a> for download..." , 'wp-db-backup'), $download_uri) . '");168 setProgress("' . sprintf(__("Backup complete, preparing <a href=\\\"%s\\\">backup</a> for download..."), $download_uri) . '"); 159 169 fram.src = "' . $download_uri . '"; 160 170 '; … … 162 172 case 'smtp': 163 173 echo ' 164 setProgress("' . sprintf(__("Backup complete, sending <a href=\\\"%s\\\">backup</a> via email..." , 'wp-db-backup'), $download_uri) . '");174 setProgress("' . sprintf(__("Backup complete, sending <a href=\\\"%s\\\">backup</a> via email..."), $download_uri) . '"); 165 175 fram.src = "' . $download_uri . '&via=email&recipient=' . $_POST['backup_recipient'] . '"; 166 176 '; … … 168 178 default: 169 179 echo ' 170 setProgress("' . sprintf(__("Backup complete, download <a href=\\\"%s\\\">here</a>." , 'wp-db-backup'), $download_uri) . '");180 setProgress("' . sprintf(__("Backup complete, download <a href=\\\"%s\\\">here</a>."), $download_uri) . '"); 171 181 '; 172 182 } … … 207 217 if(step != 0) setMeter(100 * step / ' . $step_count . '); 208 218 } 209 219 210 220 nextStep(); 211 221 //--></script> 222 </div> 212 223 '; 213 224 } … … 219 230 220 231 if($table == '') { 221 $msg = __( "Creating backup file...", 'wp-db-backup');232 $msg = __('Creating backup file...'); 222 233 } else { 223 234 if($segment == -1) { 224 $msg = sprintf(__('Finished backing up table \\"%s\\".' , 'wp-db-backup'), $table);235 $msg = sprintf(__('Finished backing up table \\"%s\\".'), $table); 225 236 } else { 226 $msg = sprintf(__('Backing up table \\"%s\\"...' , 'wp-db-backup'), $table);237 $msg = sprintf(__('Backing up table \\"%s\\"...'), $table); 227 238 } 228 239 } … … 236 247 $this->fp = $this->open(ABSPATH . $this->backup_dir . $filename, 'a'); 237 248 if(!$this->fp) { 238 $this->backup_error(__('Could not open the backup file for writing!' , 'wp-db-backup'));239 $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');249 $this->backup_error(__('Could not open the backup file for writing!')); 250 $this->fatal_error = __('The backup file could not be saved. Please check the permissions for writing to your backup directory and try again.'); 240 251 } 241 252 else { … … 262 273 } 263 274 } else { 264 $this->backup_error(__('The backup directory is not writeable!' , 'wp-db-backup'));265 $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');275 $this->backup_error(__('The backup directory is not writeable!')); 276 $this->fatal_error = __('The backup directory is not writeable! Please check the permissions for writing to your backup directory and try again.'); 266 277 } 267 278 … … 298 309 $core_tables = $_POST['core_tables']; 299 310 $this->backup_file = $this->db_backup($core_tables, $also_backup); 300 if (FALSE !== $ backup_file) {311 if (FALSE !== $this->backup_file) { 301 312 if ('smtp' == $_POST['deliver']) { 302 313 $this->deliver_backup ($this->backup_file, $_POST['deliver'], $_POST['backup_recipient']); … … 312 323 /////////////////////////////// 313 324 function admin_menu() { 314 add_management_page( 'Backup', 'Backup', 9, basename(__FILE__), array(&$this, 'backup_menu'));325 add_management_page(__('Backup'), __('Backup'), 'import', basename(__FILE__), array(&$this, 'backup_menu')); 315 326 } 316 327 317 328 function fragment_menu() { 318 add_management_page( 'Backup', 'Backup', 9, basename(__FILE__), array(&$this, 'build_backup_script'));319 } 320 329 add_management_page(__('Backup'), __('Backup'), 'import', basename(__FILE__), array(&$this, 'build_backup_script')); 330 } 331 321 332 ///////////////////////////////////////////////////////// 322 333 function sql_addslashes($a_string = '', $is_like = FALSE) … … 332 343 } 333 344 $a_string = str_replace('\'', '\\\'', $a_string); 334 345 335 346 return $a_string; 336 347 } // function sql_addslashes($a_string = '', $is_like = FALSE) 337 348 338 349 /////////////////////////////////////////////////////////// 339 350 function backquote($a_name) … … 383 394 if ($this->gzip()) { 384 395 if(@gzwrite($this->fp, $query_line) === FALSE) { 385 backup_error(__('There was an error writing a line to the backup script:' , 'wp-db-backup'));396 backup_error(__('There was an error writing a line to the backup script:')); 386 397 backup_error(' ' . $query_line); 387 398 } 388 399 } else { 389 400 if(@fwrite($this->fp, $query_line) === FALSE) { 390 backup_error(__('There was an error writing a line to the backup script:' , 'wp-db-backup'));401 backup_error(__('There was an error writing a line to the backup script:')); 391 402 backup_error(' ' . $query_line); 392 403 } … … 398 409 $this->backup_errors[] = $err; 399 410 } elseif(count($this->backup_errors) == 20) { 400 $this->backup_errors[] = __('Subsequent errors have been omitted from this log.' , 'wp-db-backup');411 $this->backup_errors[] = __('Subsequent errors have been omitted from this log.'); 401 412 } 402 413 } … … 417 428 $table_structure = $wpdb->get_results("DESCRIBE $table"); 418 429 if (! $table_structure) { 419 backup_errors(__('Error getting table details' , 'wp-db-backup') . ": $table");430 backup_errors(__('Error getting table details') . ": $table"); 420 431 return FALSE; 421 432 } … … 442 453 $create_table = $wpdb->get_results("SHOW CREATE TABLE $table", ARRAY_N); 443 454 if (FALSE === $create_table) { 444 $this->backup_error(sprintf(__("Error with SHOW CREATE TABLE for %s." , 'wp-db-backup'), $table));455 $this->backup_error(sprintf(__("Error with SHOW CREATE TABLE for %s."), $table)); 445 456 $this->stow("#\n# Error with SHOW CREATE TABLE for $table!\n#\n"); 446 457 } … … 448 459 449 460 if (FALSE === $table_structure) { 450 $this->backup_error(sprintf(__("Error getting table structure of %s" , 'wp-db-backup'), $table));461 $this->backup_error(sprintf(__("Error getting table structure of %s"), $table)); 451 462 $this->stow("#\n# Error getting table structure of $table!\n#\n"); 452 463 } … … 487 498 if ( !ini_get('safe_mode')) @set_time_limit(15*60); 488 499 $table_data = $wpdb->get_results("SELECT * FROM $table LIMIT {$row_start}, {$row_inc}", ARRAY_A); 489 500 490 501 /* 491 502 if (FALSE === $table_data) { … … 557 568 $this->fp = $this->open(ABSPATH . $this->backup_dir . $wp_backup_filename); 558 569 if(!$this->fp) { 559 $this->backup_error(__('Could not open the backup file for writing!' , 'wp-db-backup'));570 $this->backup_error(__('Could not open the backup file for writing!')); 560 571 return false; 561 572 } 562 573 } else { 563 $this->backup_error(__('The backup directory is not writeable!' , 'wp-db-backup'));574 $this->backup_error(__('The backup directory is not writeable!')); 564 575 return false; 565 576 } … … 605 616 if ('http' == $delivery) { 606 617 if (! file_exists($diskfile)) { 607 $msg = sprintf(__('File not found: <br /><strong>%1s</strong><br />', 'wp-db-backup'), $filename);618 $msg = sprintf(__('File not found:%s'), "<br /><strong>$filename</strong><br />"); 608 619 $this_basename = preg_replace('/^.*wp-content[\\\\\/]plugins[\\\\\/]/', '', __FILE__); 609 $msg .= '<br /><a href="' . get_settings('siteurl') . "/wp-admin/edit.php?page={$this_basename}" . '">' . __('Return to Backup' , 'wp-db-backup');620 $msg .= '<br /><a href="' . get_settings('siteurl') . "/wp-admin/edit.php?page={$this_basename}" . '">' . __('Return to Backup'); 610 621 die($msg); 611 622 } … … 632 643 $headers .= 'From: ' . get_settings('admin_email') . "\n"; 633 644 634 $message = sprintf(__("Attached to this email is\n %1s\n Size:%2s kilobytes\n" , 'wp-db-backup'), $filename, round(filesize($diskfile)/1024));645 $message = sprintf(__("Attached to this email is\n %1s\n Size:%2s kilobytes\n"), $filename, round(filesize($diskfile)/1024)); 635 646 // Add a multipart boundary above the plain message 636 647 $message = "This is a multi-part message in MIME format.\n\n" . 637 648 "--{$boundary}\n" . 638 "Content-Type: text/plain; charset=\" iso-8859-1\"\n" .649 "Content-Type: text/plain; charset=\"utf-8\"\n" . 639 650 "Content-Transfer-Encoding: 7bit\n\n" . 640 651 $message . "\n\n"; … … 651 662 652 663 if (function_exists('wp_mail')) { 653 wp_mail ($recipient, get_bloginfo('name') . ' ' . __('Database Backup' , 'wp-db-backup'), $message, $headers);664 wp_mail ($recipient, get_bloginfo('name') . ' ' . __('Database Backup'), $message, $headers); 654 665 } else { 655 mail ($recipient, get_bloginfo('name') . ' ' . __('Database Backup' , 'wp-db-backup'), $message, $headers);666 mail ($recipient, get_bloginfo('name') . ' ' . __('Database Backup'), $message, $headers); 656 667 } 657 668 … … 669 680 // did we just do a backup? If so, let's report the status 670 681 if ( $this->backup_complete ) { 671 $feedback = '<div class="updated"><p>' . __('Backup Successful' , 'wp-db-backup') . '!';682 $feedback = '<div class="updated"><p>' . __('Backup Successful') . '!'; 672 683 $file = $this->backup_file; 673 684 switch($_POST['deliver']) { 674 685 case 'http': 675 $feedback .= '<br />' . sprintf(__('Your backup file: <a href="%1s">%2s</a> should begin downloading shortly.' , 'wp-db-backup'), get_settings('siteurl') . "/{$this->backup_dir}{$this->backup_file}", $this->backup_file);686 $feedback .= '<br />' . sprintf(__('Your backup file: <a href="%1s">%2s</a> should begin downloading shortly.'), get_settings('siteurl') . "/{$this->backup_dir}{$this->backup_file}", $this->backup_file); 676 687 break; 677 688 case 'smtp': … … 681 692 $feedback .= $_POST['backup_recipient']; 682 693 } 683 $feedback = '<br />' . sprintf(__('Your backup has been emailed to %s' , 'wp-db-backup'), $feedback);694 $feedback = '<br />' . sprintf(__('Your backup has been emailed to %s'), $feedback); 684 695 break; 685 696 case 'none': 686 $feedback .= '<br />' . __('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');687 $feedback .= ':<br /> <a href="' . get_settings('siteurl') . "/{$this->backup_dir}$file\">$file</a> : " . filesize(ABSPATH . $this->backup_dir . $file) . __(' bytes', 'wp-db-backup');697 $feedback .= '<br />' . __('Your backup file has been saved on the server. If you would like to download it now, right click and select "Save As"'); 698 $feedback .= ':<br /> <a href="' . get_settings('siteurl') . "/{$this->backup_dir}$file\">$file</a> : " . sprintf(__('%s bytes'), filesize(ABSPATH . $this->backup_dir . $file)); 688 699 } 689 700 $feedback .= '</p></div>'; … … 691 702 692 703 if (count($this->backup_errors)) { 693 $feedback .= '<div class="updated error">' . __('The following errors were reported ', 'wp-db-backup') . ":<pre>";704 $feedback .= '<div class="updated error">' . __('The following errors were reported:') . "<pre>"; 694 705 foreach($this->backup_errors as $error) { 695 706 $feedback .= "{$error}\n"; //Errors are already localized … … 705 716 update_option('wp_cron_backup_recipient', $_POST['cron_backup_recipient'], FALSE); 706 717 } 707 $feedback .= '<div class="updated"><p>' . __('Scheduled Backup Options Saved!' , 'wp-db-backup') . '</p></div>';718 $feedback .= '<div class="updated"><p>' . __('Scheduled Backup Options Saved!') . '</p></div>'; 708 719 } 709 720 … … 727 738 echo $feedback; 728 739 } 729 730 if (! is_dir(ABSPATH . $this->backup_dir)) { 731 echo '<div class="updated error"><p align="center">' . __('WARNING: Your backup directory does not exist!', 'wp-db-backup') . '<br />' . ABSPATH . $this->backup_dir . "</p></div>"; 740 741 // Give the new dirs the same perms as wp-content. 742 $stat = stat( ABSPATH . 'wp-content' ); 743 $dir_perms = $stat['mode'] & 0000777; // Get the permission bits. 744 745 if ( !file_exists( ABSPATH . $this->backup_dir) ) { 746 if ( @ mkdir( ABSPATH . $this->backup_dir) ) { 747 @ chmod( ABSPATH . $this->backup_dir, $dir_perms); 748 } else { 749 echo '<div class="updated error"><p align="center">' . __('WARNING: Your wp-content directory is <strong>NOT</strong> writable! We can not create the backup directory.') . '<br />' . ABSPATH . $this->backup_dir . "</p></div>"; 732 750 $WHOOPS = TRUE; 733 }elseif (! is_writable(ABSPATH . $this->backup_dir)) { 734 echo '<div class="updated error"><p align="center">' . __('WARNING: Your backup directory is <strong>NOT</strong> writable!', 'wp-db-backup') . '<br />' . ABSPATH . $this->backup_dir . "</p></div>"; 735 $WHOOPS = TRUE; 736 } 751 } 752 } 753 754 if ( !is_writable( ABSPATH . $this->backup_dir) ) { 755 echo '<div class="updated error"><p align="center">' . __('WARNING: Your backup directory is <strong>NOT</strong> writable! We can not create the backup directory.') . '<br />' . ABSPATH . "</p></div>"; 756 } 757 758 if ( !file_exists( ABSPATH . $this->backup_dir . 'index.php') ) { 759 @ touch( ABSPATH . $this->backup_dir . "index.php"); 760 } 761 737 762 echo "<div class='wrap'>"; 738 echo '<h2>' . __('Backup' , 'wp-db-backup') . '</h2>';739 echo '<fieldset class="options"><legend>' . __('Tables' , 'wp-db-backup') . '</legend>';763 echo '<h2>' . __('Backup') . '</h2>'; 764 echo '<fieldset class="options"><legend>' . __('Tables') . '</legend>'; 740 765 echo '<form method="post">'; 741 766 echo '<table align="center" cellspacing="5" cellpadding="5"><tr><td width="50%" align="left" class="alternate" valign="top">'; 742 echo __('These core WordPress tables will always be backed up ', 'wp-db-backup') . ':<br /><ul>';767 echo __('These core WordPress tables will always be backed up:') . '<br /><ul>'; 743 768 foreach ($wp_backup_default_tables as $table) { 744 769 echo "<li><input type='hidden' name='core_tables[]' value='$table' />$table</li>"; … … 746 771 echo '</ul></td><td width="50%" align="left" valign="top">'; 747 772 if (count($other_tables) > 0) { 748 echo __('You may choose to include any of the following tables ', 'wp-db-backup') . ':<br />';773 echo __('You may choose to include any of the following tables:') . ' <br />'; 749 774 foreach ($other_tables as $table) { 750 775 echo "<label style=\"display:block;\"><input type='checkbox' name='other_tables[]' value='{$table}' /> {$table}</label>"; … … 752 777 } 753 778 echo '</tr></table></fieldset>'; 754 echo '<fieldset class="options"><legend>' . __('Backup Options' , 'wp-db-backup') . '</legend>';755 echo __('What to do with the backup file ', 'wp-db-backup') . ":<br />";756 echo '<label style="display:block;"><input type="radio" name="deliver" value="none" /> ' . __('Save to server' , 'wp-db-backup') . " ({$this->backup_dir})</label>";757 echo '<label style="display:block;"><input type="radio" checked="checked" name="deliver" value="http" /> ' . __('Download to your computer' , 'wp-db-backup') . '</label>';779 echo '<fieldset class="options"><legend>' . __('Backup Options') . '</legend>'; 780 echo __('What to do with the backup file:') . "<br />"; 781 echo '<label style="display:block;"><input type="radio" name="deliver" value="none" /> ' . __('Save to server') . " ({$this->backup_dir})</label>"; 782 echo '<label style="display:block;"><input type="radio" checked="checked" name="deliver" value="http" /> ' . __('Download to your computer') . '</label>'; 758 783 echo '<div><input type="radio" name="deliver" id="do_email" value="smtp" /> '; 759 echo sprintf(__('<label for="do_email">Email backup to:</label> %s', 'wp-db-backup'), '<input type="text" name="backup_recipient" size="20" value="' . get_settings('admin_email') . '" />');784 echo '<label for="do_email">'.__('Email backup to:').'</label><input type="text" name="backup_recipient" size="20" value="' . get_settings('admin_email') . '" />'; 760 785 761 786 // Check DB dize. … … 775 800 if (! $WHOOPS) { 776 801 echo '<input type="hidden" name="do_backup" id="do_backup" value="backup" /></div>'; 777 echo '<p class="submit"><input type="submit" name="submit" onclick="document.getElementById(\'do_backup\').value=\'fragments\';" value="' . __('Backup' , 'wp-db-backup') . '!" / ></p>';802 echo '<p class="submit"><input type="submit" name="submit" onclick="document.getElementById(\'do_backup\').value=\'fragments\';" value="' . __('Backup') . '!" / ></p>'; 778 803 } else { 779 echo '<p class="alternate">' . __('WARNING: Your backup directory is <strong>NOT</strong> writable!' , 'wp-db-backup') . '</p>';804 echo '<p class="alternate">' . __('WARNING: Your backup directory is <strong>NOT</strong> writable!') . '</p>'; 780 805 } 781 806 echo '</fieldset>'; … … 784 809 // this stuff only displays if wp_cron is installed 785 810 if (function_exists('wp_cron_init')) { 786 echo '<fieldset class="options"><legend>' . __('Scheduled Backup' , 'wp-db-backup') . '</legend>';811 echo '<fieldset class="options"><legend>' . __('Scheduled Backup') . '</legend>'; 787 812 $datetime = get_settings('date_format') . ' @ ' . get_settings('time_format'); 788 echo '<p>' . __('Last WP-Cron Daily Execution' , 'wp-db-backup') . ': ' . date($datetime, get_option('wp_cron_daily_lastrun')) . '<br />';789 echo __('Next WP-Cron Daily Execution' , 'wp-db-backup') . ': ' . date($datetime, (get_option('wp_cron_daily_lastrun') + 86400)) . '</p>';813 echo '<p>' . __('Last WP-Cron Daily Execution') . ': ' . date($datetime, get_option('wp_cron_daily_lastrun')) . '<br />'; 814 echo __('Next WP-Cron Daily Execution') . ': ' . date($datetime, (get_option('wp_cron_daily_lastrun') + 86400)) . '</p>'; 790 815 echo '<form method="post">'; 791 816 echo '<table width="100%" callpadding="5" cellspacing="5">'; 792 817 echo '<tr><td align="center">'; 793 echo __('Schedule: ' , 'wp-db-backup');818 echo __('Schedule: '); 794 819 $wp_cron_backup_schedule = get_option('wp_cron_backup_schedule'); 795 $schedule = array(0 => __('None' , 'wp-db-backup'), 1 => __('Daily', 'wp-db-backup'));820 $schedule = array(0 => __('None'), 1 => __('Daily')); 796 821 foreach ($schedule as $value => $name) { 797 822 echo ' <input type="radio" name="cron_schedule"'; … … 799 824 echo ' checked="checked" '; 800 825 } 801 echo 'value="' . $value . '" /> ' . __($name , 'wp-db-backup');826 echo 'value="' . $value . '" /> ' . __($name); 802 827 } 803 828 echo '</td><td align="center">'; … … 806 831 $cron_recipient = get_settings('admin_email'); 807 832 } 808 echo __('Email backup to ', 'wp-db-backup') . ':<input type="text" name="cron_backup_recipient" size="20" value="' . $cron_recipient . '" />';833 echo __('Email backup to:') . ' <input type="text" name="cron_backup_recipient" size="20" value="' . $cron_recipient . '" />'; 809 834 echo '</td></tr>'; 810 835 $cron_tables = get_option('wp_cron_backup_tables'); … … 813 838 } 814 839 if (count($other_tables) > 0) { 815 echo '<tr><td colspan="2" align="left">' . __('Tables to include ', 'wp-db-backup') . ':<br />';840 echo '<tr><td colspan="2" align="left">' . __('Tables to include:') . '<br />'; 816 841 foreach ($other_tables as $table) { 817 842 echo '<input type="checkbox" '; … … 823 848 echo '</td></tr>'; 824 849 } 825 echo '<tr><td colspan="2" align="center"><input type="hidden" name="wp_cron_backup_options" value="SET" /><input type="submit" name="submit" value="' . __('Submit' , 'wp-db-backup') . '" /></td></tr></table></form>';850 echo '<tr><td colspan="2" align="center"><input type="hidden" name="wp_cron_backup_options" value="SET" /><input type="submit" name="submit" value="' . __('Submit') . '" /></td></tr></table></form>'; 826 851 echo '</fieldset>'; 827 852 } … … 859 884 return; 860 885 } // wp_cron_db_backup 886 887 function validate_file($file) { 888 if (false !== strpos($file, '..')) 889 die(__("Cheatin' uh ?")); 890 891 if (false !== strpos($file, './')) 892 die(__("Cheatin' uh ?")); 893 894 if (':' == substr($file, 1, 1)) 895 die(__("Cheatin' uh ?")); 896 } 897 861 898 } 862 899 863 $mywpdbbackup = new wpdbBackup(); 900 function wpdbBackup_init() { 901 global $mywpdbbackup; 902 903 if ( !current_user_can('import') ) return; 904 905 $mywpdbbackup = new wpdbBackup(); 906 } 907 908 add_action('plugins_loaded', 'wpdbBackup_init'); 864 909 865 910 ?>
Note:
See TracChangeset
for help on using the changeset viewer.