Ticket #986: 986-plugins.diff

File 986-plugins.diff, 5.3 KB (added by Nazgul, 6 years ago)
  • wp-content/plugins/hello.php

     
    66Author: Matt Mullenweg 
    77Version: 1.5 
    88Author URI: http://photomatt.net/ 
    9 */  
     9*/ 
    1010 
    1111// These are the lyrics to Hello Dolly 
    1212$lyrics = "Hello, Dolly 
  • wp-content/plugins/wp-db-backup.php

     
    1111in turn was derived from phpMyAdmin. 
    1212 
    1313Many thanks to Owen (http://asymptomatic.net/wp/) for his patch 
    14    http://dev.wp-plugins.org/ticket/219 
     14http://dev.wp-plugins.org/ticket/219 
    1515*/ 
    1616 
    17 // CHANGE THIS IF YOU WANT TO USE A  
     17// CHANGE THIS IF YOU WANT TO USE A 
    1818// DIFFERENT BACKUP LOCATION 
    1919 
    2020$rand = substr( md5( md5( DB_PASSWORD ) ), -5 ); 
     
    332332        ///////////////////////////////////////////////////////// 
    333333        function sql_addslashes($a_string = '', $is_like = FALSE) 
    334334        { 
    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); 
    345345 
    346             return $a_string; 
     346                return $a_string; 
    347347        } // function sql_addslashes($a_string = '', $is_like = FALSE) 
    348348 
    349349        /////////////////////////////////////////////////////////// 
    350350        function backquote($a_name) 
    351351        { 
    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             } 
     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                } 
    370370        } // function backquote($a_name, $do_it = TRUE) 
    371371 
    372372        ///////////// 
     
    421421                Alain Wolf, Zurich - Switzerland 
    422422                Website: http://restkultur.ch/personal/wolf/scripts/db_backup/ 
    423423 
    424                 Modified by Scott Merril (http://www.skippy.net/)  
     424                Modified by Scott Merril (http://www.skippy.net/) 
    425425                to use the WordPress $wpdb object 
    426426                */ 
    427427 
     
    441441                        $this->stow("\n"); 
    442442                        $this->stow("DROP TABLE IF EXISTS " . $this->backquote($table) . ";\n"); 
    443443 
    444                         //  
     444                        // 
    445445                        //Table structure 
    446446                        // Comment in SQL-file 
    447447                        $this->stow("\n\n"); 
     
    539539        } // end backup_table() 
    540540 
    541541        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.0 
    546                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                } 
    553553 
    554            return $val; 
     554                return $val; 
    555555        } 
    556556 
    557557        //////////////////////////// 
     
    635635                        $randomish = md5(time()); 
    636636                        $boundary = "==WPBACKUP-BY-SKIPPY-$randomish"; 
    637637                        $fp = fopen($diskfile,"rb"); 
    638                         $file = fread($fp,filesize($diskfile));  
     638                        $file = fread($fp,filesize($diskfile)); 
    639639                        $this->close($fp); 
    640640                        $data = chunk_split(base64_encode($file)); 
    641641                        $headers = "MIME-Version: 1.0\n"; 
     
    645645                        $message = sprintf(__("Attached to this email is\n   %1s\n   Size:%2s kilobytes\n"), $filename, round(filesize($diskfile)/1024)); 
    646646                        // Add a multipart boundary above the plain message 
    647647                        $message = "This is a multi-part message in MIME format.\n\n" . 
    648                                 "--{$boundary}\n" . 
     648                                "--{$boundary}\n" . 
    649649                                "Content-Type: text/plain; charset=\"utf-8\"\n" . 
    650650                                "Content-Transfer-Encoding: 7bit\n\n" . 
    651651                                $message . "\n\n"; 
     
    859859 
    860860                $schedule = intval(get_option('wp_cron_backup_schedule')); 
    861861                if (0 == $schedule) { 
    862                         // Scheduled backup is disabled 
    863                         return; 
     862                        // Scheduled backup is disabled 
     863                        return; 
    864864                } 
    865865 
    866866                global $wpdb; 
     
    884884 
    885885function wpdbBackup_init() { 
    886886        global $mywpdbbackup; 
    887         $mywpdbbackup = new wpdbBackup();        
     887        $mywpdbbackup = new wpdbBackup(); 
    888888} 
    889889 
    890890add_action('plugins_loaded', 'wpdbBackup_init');