Ticket #986: 986-plugins.diff
| File 986-plugins.diff, 5.3 KB (added by Nazgul, 6 years ago) |
|---|
-
wp-content/plugins/hello.php
6 6 Author: Matt Mullenweg 7 7 Version: 1.5 8 8 Author URI: http://photomatt.net/ 9 */ 9 */ 10 10 11 11 // These are the lyrics to Hello Dolly 12 12 $lyrics = "Hello, Dolly -
wp-content/plugins/wp-db-backup.php
11 11 in turn was derived from phpMyAdmin. 12 12 13 13 Many thanks to Owen (http://asymptomatic.net/wp/) for his patch 14 http://dev.wp-plugins.org/ticket/21914 http://dev.wp-plugins.org/ticket/219 15 15 */ 16 16 17 // CHANGE THIS IF YOU WANT TO USE A 17 // CHANGE THIS IF YOU WANT TO USE A 18 18 // DIFFERENT BACKUP LOCATION 19 19 20 20 $rand = substr( md5( md5( DB_PASSWORD ) ), -5 ); … … 332 332 ///////////////////////////////////////////////////////// 333 333 function sql_addslashes($a_string = '', $is_like = FALSE) 334 334 { 335 /*336 Better addslashes for SQL queries.337 Taken from phpMyAdmin.338 */339 if ($is_like) {340 $a_string = str_replace('\\', '\\\\\\\\', $a_string);341 } else {342 $a_string = str_replace('\\', '\\\\', $a_string);343 }344 $a_string = str_replace('\'', '\\\'', $a_string);335 /* 336 Better addslashes for SQL queries. 337 Taken from phpMyAdmin. 338 */ 339 if ($is_like) { 340 $a_string = str_replace('\\', '\\\\\\\\', $a_string); 341 } else { 342 $a_string = str_replace('\\', '\\\\', $a_string); 343 } 344 $a_string = str_replace('\'', '\\\'', $a_string); 345 345 346 return $a_string;346 return $a_string; 347 347 } // function sql_addslashes($a_string = '', $is_like = FALSE) 348 348 349 349 /////////////////////////////////////////////////////////// 350 350 function backquote($a_name) 351 351 { 352 /*353 Add backqouotes to tables and db-names in354 SQL queries. Taken from phpMyAdmin.355 */356 if (!empty($a_name) && $a_name != '*') {357 if (is_array($a_name)) {358 $result = array();359 reset($a_name);360 while(list($key, $val) = each($a_name)) {361 $result[$key] = '`' . $val . '`';362 }363 return $result;364 } else {365 return '`' . $a_name . '`';366 }367 } else {368 return $a_name;369 }352 /* 353 Add backqouotes to tables and db-names in 354 SQL queries. Taken from phpMyAdmin. 355 */ 356 if (!empty($a_name) && $a_name != '*') { 357 if (is_array($a_name)) { 358 $result = array(); 359 reset($a_name); 360 while(list($key, $val) = each($a_name)) { 361 $result[$key] = '`' . $val . '`'; 362 } 363 return $result; 364 } else { 365 return '`' . $a_name . '`'; 366 } 367 } else { 368 return $a_name; 369 } 370 370 } // function backquote($a_name, $do_it = TRUE) 371 371 372 372 ///////////// … … 421 421 Alain Wolf, Zurich - Switzerland 422 422 Website: http://restkultur.ch/personal/wolf/scripts/db_backup/ 423 423 424 Modified by Scott Merril (http://www.skippy.net/) 424 Modified by Scott Merril (http://www.skippy.net/) 425 425 to use the WordPress $wpdb object 426 426 */ 427 427 … … 441 441 $this->stow("\n"); 442 442 $this->stow("DROP TABLE IF EXISTS " . $this->backquote($table) . ";\n"); 443 443 444 // 444 // 445 445 //Table structure 446 446 // Comment in SQL-file 447 447 $this->stow("\n\n"); … … 539 539 } // end backup_table() 540 540 541 541 function return_bytes($val) { 542 $val = trim($val);543 $last = strtolower($val{strlen($val)-1});544 switch($last) {545 // The 'G' modifier is available since PHP 5.1.0546 case 'g':547 $val *= 1024;548 case 'm':549 $val *= 1024;550 case 'k':551 $val *= 1024;552 }542 $val = trim($val); 543 $last = strtolower($val{strlen($val)-1}); 544 switch($last) { 545 // The 'G' modifier is available since PHP 5.1.0 546 case 'g': 547 $val *= 1024; 548 case 'm': 549 $val *= 1024; 550 case 'k': 551 $val *= 1024; 552 } 553 553 554 return $val;554 return $val; 555 555 } 556 556 557 557 //////////////////////////// … … 635 635 $randomish = md5(time()); 636 636 $boundary = "==WPBACKUP-BY-SKIPPY-$randomish"; 637 637 $fp = fopen($diskfile,"rb"); 638 $file = fread($fp,filesize($diskfile)); 638 $file = fread($fp,filesize($diskfile)); 639 639 $this->close($fp); 640 640 $data = chunk_split(base64_encode($file)); 641 641 $headers = "MIME-Version: 1.0\n"; … … 645 645 $message = sprintf(__("Attached to this email is\n %1s\n Size:%2s kilobytes\n"), $filename, round(filesize($diskfile)/1024)); 646 646 // Add a multipart boundary above the plain message 647 647 $message = "This is a multi-part message in MIME format.\n\n" . 648 "--{$boundary}\n" .648 "--{$boundary}\n" . 649 649 "Content-Type: text/plain; charset=\"utf-8\"\n" . 650 650 "Content-Transfer-Encoding: 7bit\n\n" . 651 651 $message . "\n\n"; … … 859 859 860 860 $schedule = intval(get_option('wp_cron_backup_schedule')); 861 861 if (0 == $schedule) { 862 // Scheduled backup is disabled863 return;862 // Scheduled backup is disabled 863 return; 864 864 } 865 865 866 866 global $wpdb; … … 884 884 885 885 function wpdbBackup_init() { 886 886 global $mywpdbbackup; 887 $mywpdbbackup = new wpdbBackup(); 887 $mywpdbbackup = new wpdbBackup(); 888 888 } 889 889 890 890 add_action('plugins_loaded', 'wpdbBackup_init');
