Make WordPress Core

Ticket #20051: 20051.diff

File 20051.diff, 22.5 KB (added by nacin, 13 years ago)
  • wp-includes/functions.php

     
    395395}
    396396
    397397/**
    398  * Open the file handle for debugging.
    399  *
    400  * This function is used for XMLRPC feature, but it is general purpose enough
    401  * to be used in anywhere.
    402  *
    403  * @see fopen() for mode options.
    404  * @package WordPress
    405  * @subpackage Debug
    406  * @since 0.71
    407  * @uses $debug Used for whether debugging is enabled.
    408  *
    409  * @param string $filename File path to debug file.
    410  * @param string $mode Same as fopen() mode parameter.
    411  * @return bool|resource File handle. False on failure.
    412  */
    413 function debug_fopen( $filename, $mode ) {
    414         global $debug;
    415         if ( 1 == $debug ) {
    416                 $fp = fopen( $filename, $mode );
    417                 return $fp;
    418         } else {
    419                 return false;
    420         }
    421 }
    422 
    423 /**
    424  * Write contents to the file used for debugging.
    425  *
    426  * Technically, this can be used to write to any file handle when the global
    427  * $debug is set to 1 or true.
    428  *
    429  * @package WordPress
    430  * @subpackage Debug
    431  * @since 0.71
    432  * @uses $debug Used for whether debugging is enabled.
    433  *
    434  * @param resource $fp File handle for debugging file.
    435  * @param string $string Content to write to debug file.
    436  */
    437 function debug_fwrite( $fp, $string ) {
    438         global $debug;
    439         if ( 1 == $debug )
    440                 fwrite( $fp, $string );
    441 }
    442 
    443 /**
    444  * Close the debugging file handle.
    445  *
    446  * Technically, this can be used to close any file handle when the global $debug
    447  * is set to 1 or true.
    448  *
    449  * @package WordPress
    450  * @subpackage Debug
    451  * @since 0.71
    452  * @uses $debug Used for whether debugging is enabled.
    453  *
    454  * @param resource $fp Debug File handle.
    455  */
    456 function debug_fclose( $fp ) {
    457         global $debug;
    458         if ( 1 == $debug )
    459                 fclose( $fp );
    460 }
    461 
    462 /**
    463398 * Check content for video and audio links to add as enclosures.
    464399 *
    465400 * Will not add enclosures that have already been added and will
     
    480415        //TODO: Tidy this ghetto code up and make the debug code optional
    481416        include_once( ABSPATH . WPINC . '/class-IXR.php' );
    482417
    483         $log = debug_fopen( ABSPATH . 'enclosures.log', 'a' );
    484418        $post_links = array();
    485         debug_fwrite( $log, 'BEGIN ' . date( 'YmdHis', time() ) . "\n" );
    486419
    487420        $pung = get_enclosed( $post_ID );
    488421
     
    493426
    494427        preg_match_all( "{\b http : [$any] +? (?= [$punc] * [^$any] | $)}x", $content, $post_links_temp );
    495428
    496         debug_fwrite( $log, 'Post contents:' );
    497         debug_fwrite( $log, $content . "\n" );
    498 
    499429        foreach ( $pung as $link_test ) {
    500430                if ( !in_array( $link_test, $post_links_temp[0] ) ) { // link no longer in post
    501431                        $mid = $wpdb->get_col( $wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE (%s)", $post_ID, like_escape( $link_test ) . '%') );
  • wp-includes/class-wp-xmlrpc-server.php

     
    27002700
    27012701                $this->attach_uploads( $post_ID, $post_content );
    27022702
    2703                 logIO('O', "Posted ! ID: $post_ID");
    2704 
    27052703                return $post_ID;
    27062704        }
    27072705
     
    30463044                $post_category = array();
    30473045                if ( isset( $content_struct['categories'] ) ) {
    30483046                        $catnames = $content_struct['categories'];
    3049                         logIO('O', 'Post cats: ' . var_export($catnames,true));
    30503047
    30513048                        if ( is_array($catnames) ) {
    30523049                                foreach ($catnames as $cat) {
     
    30883085                if ( !$post_ID )
    30893086                        return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.'));
    30903087
    3091                 logIO('O', "Posted ! ID: $post_ID");
    3092 
    30933088                return strval($post_ID);
    30943089        }
    30953090
     
    33813376                if ( isset( $content_struct['wp_post_format'] ) )
    33823377                        wp_set_post_terms( $post_ID, array( 'post-format-' . $content_struct['wp_post_format'] ), 'post_format' );
    33833378
    3384                 logIO('O',"(MW) Edited ! ID: $post_ID");
    3385 
    33863379                return true;
    33873380        }
    33883381
     
    36953688                $type = $data['type'];
    36963689                $bits = $data['bits'];
    36973690
    3698                 logIO('O', '(MW) Received '.strlen($bits).' bytes');
    3699 
    37003691                if ( !$user = $this->login($username, $password) )
    37013692                        return $this->error;
    37023693
    37033694                do_action('xmlrpc_call', 'metaWeblog.newMediaObject');
    37043695
    37053696                if ( !current_user_can('upload_files') ) {
    3706                         logIO('O', '(MW) User does not have upload_files capability');
    37073697                        $this->error = new IXR_Error(401, __('You are not allowed to upload files to this site.'));
    37083698                        return $this->error;
    37093699                }
     
    37323722                $upload = wp_upload_bits($name, null, $bits);
    37333723                if ( ! empty($upload['error']) ) {
    37343724                        $errorString = sprintf(__('Could not write file %1$s (%2$s)'), $name, $upload['error']);
    3735                         logIO('O', '(MW) ' . $errorString);
    37363725                        return new IXR_Error(500, $errorString);
    37373726                }
    37383727                // Construct the attachment array
     
    41194108                }
    41204109                $post_ID = (int) $post_ID;
    41214110
    4122                 logIO("O","(PB) URL='$pagelinkedto' ID='$post_ID' Found='$way'");
    4123 
    41244111                $post = get_post($post_ID);
    41254112
    41264113                if ( !$post ) // Post_ID not found
  • wp-includes/deprecated.php

     
    25642564 * Is the current admin page generated by a plugin?
    25652565 *
    25662566 * @since 1.5.0
    2567  * @deprecated 3.1
     2567 * @deprecated 3.1.0
    25682568 * @deprecated Use global $plugin_page and/or get_plugin_page_hookname() hooks.
    25692569 *
    25702570 * @global $plugin_page
     
    25902590 * for updating the category cache.
    25912591 *
    25922592 * @since 1.5.0
    2593  * @deprecated 3.1
     2593 * @deprecated 3.1.0
    25942594 *
    25952595 * @return bool Always return True
    25962596 */
     
    26042604 * Check for PHP timezone support
    26052605 *
    26062606 * @since 2.9.0
    2607  * @deprecated 3.2
     2607 * @deprecated 3.2.0
    26082608 *
    26092609 * @return bool
    26102610 */
     
    26182618 * Display editor: TinyMCE, HTML, or both.
    26192619 *
    26202620 * @since 2.1.0
    2621  * @deprecated 3.3
     2621 * @deprecated 3.3.0
     2622 * @deprecated Use wp_editor()
     2623 * @see wp_editor()
    26222624 *
    26232625 * @param string $content Textarea content.
    26242626 * @param string $id Optional, default is 'content'. HTML ID attribute value.
     
    26272629 * @param int $tab_index Optional, not used
    26282630 */
    26292631function the_editor($content, $id = 'content', $prev_id = 'title', $media_buttons = true, $tab_index = 2, $extended = true) {
     2632        _deprecated_function( __FUNCTION__, '3.3', 'wp_editor()' );
    26302633
    26312634        wp_editor( $content, $id, array( 'media_buttons' => $media_buttons ) );
    26322635        return;
     
    26362639 * Perform the query to get the $metavalues array(s) needed by _fill_user and _fill_many_users
    26372640 *
    26382641 * @since 3.0.0
     2642 * @deprecated 3.3.0
     2643 *
    26392644 * @param array $ids User ID numbers list.
    26402645 * @return array of arrays. The array is indexed by user_id, containing $metavalues object arrays.
    26412646 */
     
    26682673 *
    26692674 * @since 2.3.0
    26702675 * @deprecated 3.3.0
    2671  * @uses sanitize_user_field() Used to sanitize the fields.
    26722676 *
    26732677 * @param object|array $user The User Object or Array
    26742678 * @param string $context Optional, default is 'display'. How to sanitize user fields.
     
    27052709 * Can either be start or end post relational link.
    27062710 *
    27072711 * @since 2.8.0
    2708  * @deprecated 3.3
     2712 * @deprecated 3.3.0
    27092713 *
    27102714 * @param string $title Optional. Link title format.
    27112715 * @param bool $in_same_cat Optional. Whether link should be in a same category.
     
    27452749 * Display relational link for the first post.
    27462750 *
    27472751 * @since 2.8.0
    2748  * @deprecated 3.3
     2752 * @deprecated 3.3.0
    27492753 *
    27502754 * @param string $title Optional. Link title format.
    27512755 * @param bool $in_same_cat Optional. Whether link should be in a same category.
     
    27612765 * Get site index relational link.
    27622766 *
    27632767 * @since 2.8.0
    2764  * @deprecated 3.3
     2768 * @deprecated 3.3.0
    27652769 *
    27662770 * @return string
    27672771 */
     
    27762780 * Display relational link for the site index.
    27772781 *
    27782782 * @since 2.8.0
    2779  * @deprecated 3.3
     2783 * @deprecated 3.3.0
    27802784 */
    27812785function index_rel_link() {
    27822786        _deprecated_function( __FUNCTION__, '3.3' );
     
    27882792 * Get parent post relational link.
    27892793 *
    27902794 * @since 2.8.0
    2791  * @deprecated 3.3
     2795 * @deprecated 3.3.0
    27922796 *
    27932797 * @param string $title Optional. Link title format.
    27942798 * @return string
     
    28192823 * Display relational link for parent item
    28202824 *
    28212825 * @since 2.8.0
    2822  * @deprecated 3.3
     2826 * @deprecated 3.3.0
    28232827 */
    28242828function parent_post_rel_link($title = '%title') {
    28252829        _deprecated_function( __FUNCTION__, '3.3' );
     
    28312835 * Add the "Dashboard"/"Visit Site" menu.
    28322836 *
    28332837 * @since 3.2.0
    2834  * @deprecated 3.3
     2838 * @deprecated 3.3.0
    28352839 */
    28362840function wp_admin_bar_dashboard_view_site_menu( $wp_admin_bar ) {
    28372841        _deprecated_function( __FUNCTION__, '3.3' );
     
    28522856 * Checks if the current user belong to a given blog.
    28532857 *
    28542858 * @since MU
    2855  * @deprecated 3.3
     2859 * @deprecated 3.3.0
    28562860 * @deprecated Use is_user_member_of_blog()
    28572861 * @see is_user_member_of_blog()
    28582862 *
     
    28642868
    28652869        return is_user_member_of_blog( get_current_user_id(), $blog_id );
    28662870}
     2871
     2872/**
     2873 * Open the file handle for debugging.
     2874 *
     2875 * @since 0.71
     2876 * @deprecated Use error_log()
     2877 * @link http://www.php.net/manual/en/function.error-log.php
     2878 * @deprecated 3.4.0
     2879 */
     2880function debug_fopen( $filename, $mode ) {
     2881        _deprecated_function( __FUNCTION__, 'error_log' );
     2882        return false;
     2883}
     2884
     2885/**
     2886 * Write contents to the file used for debugging.
     2887 *
     2888 * @since 0.71
     2889 * @deprecated Use error_log() instead.
     2890 * @link http://www.php.net/manual/en/function.error-log.php
     2891 * @deprecated 3.4.0
     2892 */
     2893function debug_fwrite( $fp, $string ) {
     2894        _deprecated_function( __FUNCTION__, 'error_log' );
     2895        error_log( $string );
     2896}
     2897
     2898/**
     2899 * Close the debugging file handle.
     2900 *
     2901 * @since 0.71
     2902 * @deprecated Use error_log()
     2903 * @link http://www.php.net/manual/en/function.error-log.php
     2904 * @deprecated 3.4.0
     2905 */
     2906function debug_fclose( $fp ) {
     2907        _deprecated_function( __FUNCTION__, 'error_log' );
     2908}
     2909 No newline at end of file
  • wp-app.php

     
    2424$_SERVER['PATH_INFO'] = preg_replace( '/.*\/wp-app\.php/', '', $_SERVER['REQUEST_URI'] );
    2525
    2626/**
    27  * Whether to enable Atom Publishing Protocol Logging.
    28  *
    29  * @name app_logging
    30  * @var int|bool
    31  */
    32 $app_logging = 0;
    33 
    34 /**
    3527 * Whether to always authenticate user. Permanently set to true.
    3628 *
    3729 * @name always_authenticate
     
    4436 * Writes logging info to a file.
    4537 *
    4638 * @since 2.2.0
    47  * @uses $app_logging
    48  * @package WordPress
    49  * @subpackage Logging
     39 * @deprecated 3.4.0
     40 * @deprecated Use error_log()
     41 * @link http://www.php.net/manual/en/function.error-log.php
    5042 *
    5143 * @param string $label Type of logging
    5244 * @param string $msg Information describing logging reason.
    5345 */
    54 function log_app($label,$msg) {
    55         global $app_logging;
    56         if ($app_logging) {
    57                 $fp = fopen( 'wp-app.log', 'a+');
    58                 $date = gmdate( 'Y-m-d H:i:s' );
    59                 fwrite($fp, "\n\n$date - $label\n$msg\n");
    60                 fclose($fp);
    61         }
     46function log_app( $label, $msg ) {
     47        _deprecated_function( __FUNCTION__, '3.4', 'error_log()' );
     48        if ( ! empty( $GLOBALS['app_logging'] ) )
     49                error_log( $label . ' - ' . $message );
    6250}
    6351
    6452/**
     
    268256
    269257                $method = $_SERVER['REQUEST_METHOD'];
    270258
    271                 log_app('REQUEST',"$method $path\n================");
    272 
    273259                $this->process_conditionals();
    274260                //$this->process_conditionals();
    275261
     
    319305         * @since 2.2.0
    320306         */
    321307        function get_service() {
    322                 log_app('function','get_service()');
    323 
    324308                if ( !current_user_can( 'edit_posts' ) )
    325309                        $this->auth_required( __( 'Sorry, you do not have the right to access this site.' ) );
    326310
     
    360344         * @since 2.2.0
    361345         */
    362346        function get_categories_xml() {
    363                 log_app('function','get_categories_xml()');
    364 
    365347                if ( !current_user_can( 'edit_posts' ) )
    366348                        $this->auth_required( __( 'Sorry, you do not have the right to access this site.' ) );
    367349
     
    397379
    398380                $entry = array_pop($parser->feed->entries);
    399381
    400                 log_app('Received entry:', print_r($entry,true));
    401 
    402382                $catnames = array();
    403383                foreach ( $entry->categories as $cat ) {
    404384                        array_push($catnames, $cat["term"]);
     
    436416                $post_data = compact('blog_ID', 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'post_name');
    437417
    438418                $this->escape($post_data);
    439                 log_app('Inserting Post. Data:', print_r($post_data,true));
    440419
    441420                $postID = wp_insert_post($post_data);
    442421                if ( is_wp_error( $postID ) )
     
    455434
    456435                $output = $this->get_entry($postID);
    457436
    458                 log_app('function',"create_post($postID)");
    459437                $this->created($postID, $output);
    460438        }
    461439
     
    474452
    475453                $this->set_current_entry($postID);
    476454                $output = $this->get_entry($postID);
    477                 log_app('function',"get_post($postID)");
    478455                $this->output($output);
    479456
    480457        }
     
    497474
    498475                $parsed = array_pop($parser->feed->entries);
    499476
    500                 log_app('Received UPDATED entry:', print_r($parsed,true));
    501 
    502477                // check for not found
    503478                global $entry;
    504479                $this->set_current_entry($postID);
     
    531506
    532507                do_action( 'atompub_put_post', $ID, $parsed );
    533508
    534                 log_app('function',"put_post($postID)");
    535509                $this->ok();
    536510        }
    537511
     
    560534                                $this->internal_error(__('For some strange yet very annoying reason, this post could not be deleted.'));
    561535                        }
    562536
    563                         log_app('function',"delete_post($postID)");
    564537                        $this->ok();
    565538                }
    566539
     
    582555                } else {
    583556                        $this->set_current_entry($postID);
    584557                        $output = $this->get_entry($postID, 'attachment');
    585                         log_app('function',"get_attachment($postID)");
    586558                        $this->output($output);
    587559                }
    588560        }
     
    617589                $slug = sanitize_file_name( "$slug.$ext" );
    618590                $file = wp_upload_bits( $slug, null, $bits);
    619591
    620                 log_app('wp_upload_bits returns:',print_r($file,true));
    621 
    622592                $url = $file['url'];
    623593                $file = $file['file'];
    624594
     
    643613                $output = $this->get_entry($postID, 'attachment');
    644614
    645615                $this->created($postID, $output, 'attachment');
    646                 log_app('function',"create_attachment($postID)");
    647616        }
    648617
    649618        /**
     
    688657                if ( !$result )
    689658                        $this->internal_error(__('For some strange yet very annoying reason, this post could not be edited.'));
    690659
    691                 log_app('function',"put_attachment($postID)");
    692660                $this->ok();
    693661        }
    694662
     
    700668         * @param int $postID Post ID.
    701669         */
    702670        function delete_attachment($postID) {
    703                 log_app('function',"delete_attachment($postID). File '$location' deleted.");
    704 
    705671                // check for not found
    706672                global $entry;
    707673                $this->set_current_entry($postID);
     
    724690                if ( !$result )
    725691                        $this->internal_error(__('For some strange yet very annoying reason, this post could not be deleted.'));
    726692
    727                 log_app('function',"delete_attachment($postID). File '$location' deleted.");
    728693                $this->ok();
    729694        }
    730695
     
    770735                        status_header ('404');
    771736                }
    772737
    773                 log_app('function',"get_file($postID)");
    774738                exit;
    775739        }
    776740
     
    828792
    829793                wp_update_attachment_metadata( $postID, wp_generate_attachment_metadata( $postID, $location ) );
    830794
    831                 log_app('function',"put_file($postID)");
    832795                $this->ok();
    833796        }
    834797
     
    939902
    940903                $url = $this->app_base . $this->ENTRY_PATH . "/$postID";
    941904
    942                 log_app('function',"get_entry_url() = $url");
    943905                return $url;
    944906        }
    945907
     
    970932
    971933                $url = $this->app_base . $this->MEDIA_SINGLE_PATH ."/file/$postID";
    972934
    973                 log_app('function',"get_media_url() = $url");
    974935                return $url;
    975936        }
    976937
     
    994955         */
    995956        function set_current_entry($postID) {
    996957                global $entry;
    997                 log_app('function',"set_current_entry($postID)");
    998958
    999959                if (!isset($postID)) {
    1000960                        // $this->bad_request();
     
    1018978         * @param string $post_type Optional, default is 'post'. Post Type.
    1019979         */
    1020980        function get_posts($page = 1, $post_type = 'post') {
    1021                         log_app('function',"get_posts($page, '$post_type')");
    1022981                        $feed = $this->get_feed($page, $post_type);
    1023982                        $this->output($feed);
    1024983        }
     
    1032991         * @param string $post_type Optional, default is 'attachment'. Post type.
    1033992         */
    1034993        function get_attachments($page = 1, $post_type = 'attachment') {
    1035                 log_app('function',"get_attachments($page, '$post_type')");
    1036994                $GLOBALS['post_type'] = $post_type;
    1037995                $feed = $this->get_feed($page, $post_type);
    1038996                $this->output($feed);
     
    10491007         */
    10501008        function get_feed($page = 1, $post_type = 'post') {
    10511009                global $post, $wp, $wp_query, $posts, $wpdb, $blog_id;
    1052                 log_app('function',"get_feed($page, '$post_type')");
    10531010                ob_start();
    10541011
    10551012                $this->ENTRY_PATH = $post_type;
     
    10691026                $wp_query = $GLOBALS['wp_query'];
    10701027                $wpdb = $GLOBALS['wpdb'];
    10711028                $blog_id = (int) $GLOBALS['blog_id'];
    1072                 log_app('function',"query_posts(# " . print_r($wp_query, true) . "#)");
    10731029
    1074                 log_app('function',"total_count(# $wp_query->max_num_pages #)");
    10751030                $last_page = $wp_query->max_num_pages;
    10761031                $next_page = (($page + 1) > $last_page) ? null : $page + 1;
    10771032                $prev_page = ($page - 1) < 1 ? null : $page - 1;
     
    11161071         * @return string.
    11171072         */
    11181073        function get_entry($postID, $post_type = 'post') {
    1119                 log_app('function',"get_entry($postID, '$post_type')");
    11201074                ob_start();
    11211075                switch($post_type) {
    11221076                        case 'post':
     
    11321086                        while ( have_posts() ) {
    11331087                                the_post();
    11341088                                $this->echo_entry();
    1135                                 log_app('$post',print_r($GLOBALS['post'],true));
    11361089                                $entry = ob_get_contents();
    11371090                                break;
    11381091                        }
    11391092                }
    11401093                ob_end_clean();
    11411094
    1142                 log_app('get_entry returning:',$entry);
    11431095                return $entry;
    11441096        }
    11451097
     
    11901142         * @since 2.2.0
    11911143         */
    11921144        function ok() {
    1193                 log_app('Status','200: OK');
    11941145                header('Content-Type: text/plain');
    11951146                status_header('200');
    11961147                exit;
     
    12021153         * @since 2.2.0
    12031154         */
    12041155        function no_content() {
    1205                 log_app('Status','204: No Content');
    12061156                header('Content-Type: text/plain');
    12071157                status_header('204');
    12081158                echo "Moved to Trash.";
     
    12171167         * @param string $msg Optional. Status string.
    12181168         */
    12191169        function internal_error($msg = 'Internal Server Error') {
    1220                 log_app('Status','500: Server Error');
    12211170                header('Content-Type: text/plain');
    12221171                status_header('500');
    12231172                echo $msg;
     
    12301179         * @since 2.2.0
    12311180         */
    12321181        function bad_request() {
    1233                 log_app('Status','400: Bad Request');
    12341182                header('Content-Type: text/plain');
    12351183                status_header('400');
    12361184                exit;
     
    12421190         * @since 2.2.0
    12431191         */
    12441192        function length_required() {
    1245                 log_app('Status','411: Length Required');
    12461193                header("HTTP/1.1 411 Length Required");
    12471194                header('Content-Type: text/plain');
    12481195                status_header('411');
     
    12551202         * @since 2.2.0
    12561203         */
    12571204        function invalid_media() {
    1258                 log_app('Status','415: Unsupported Media Type');
    12591205                header("HTTP/1.1 415 Unsupported Media Type");
    12601206                header('Content-Type: text/plain');
    12611207                exit;
     
    12671213         * @since 2.6.0
    12681214         */
    12691215        function forbidden($reason='') {
    1270                 log_app('Status','403: Forbidden');
    12711216                header('Content-Type: text/plain');
    12721217                status_header('403');
    12731218                echo $reason;
     
    12801225         * @since 2.2.0
    12811226         */
    12821227        function not_found() {
    1283                 log_app('Status','404: Not Found');
    12841228                header('Content-Type: text/plain');
    12851229                status_header('404');
    12861230                exit;
     
    12921236         * @since 2.2.0
    12931237         */
    12941238        function not_allowed($allow) {
    1295                 log_app('Status','405: Not Allowed');
    12961239                header('Allow: ' . join(',', $allow));
    12971240                status_header('405');
    12981241                exit;
     
    13041247         * @since 2.3.0
    13051248         */
    13061249        function redirect($url) {
    1307 
    1308                 log_app('Status','302: Redirect');
    13091250                $escaped_url = esc_attr($url);
    13101251                $content = <<<EOD
    13111252<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
     
    13341275         * @since 2.2.0
    13351276         */
    13361277        function client_error($msg = 'Client Error') {
    1337                 log_app('Status','400: Client Error');
    13381278                header('Content-Type: text/plain');
    13391279                status_header('400');
    13401280                exit;
     
    13481288         * @since 2.2.0
    13491289         */
    13501290        function created($post_ID, $content, $post_type = 'post') {
    1351                 log_app('created()::$post_ID',"$post_ID, $post_type");
    13521291                $edit = $this->get_entry_url($post_ID);
    13531292                switch($post_type) {
    13541293                        case 'post':
     
    13751314         * @param string $msg Status header content and HTML content.
    13761315         */
    13771316        function auth_required($msg) {
    1378                 log_app('Status','401: Auth Required');
    13791317                nocache_headers();
    13801318                header('WWW-Authenticate: Basic realm="WordPress Atom Protocol"');
    13811319                header("HTTP/1.1 401 $msg");
     
    14161354                        header('Date: '. date('r'));
    14171355                        if ($this->do_output)
    14181356                                echo $xml;
    1419                         log_app('function', "output:\n$xml");
    14201357                        exit;
    14211358        }
    14221359
     
    14491386         * @return bool
    14501387         */
    14511388        function authenticate() {
    1452                 log_app("authenticate()",print_r($_ENV, true));
    1453 
    14541389                // if using mod_rewrite/ENV hack
    14551390                // http://www.besthostratings.com/articles/http-auth-php-cgi.html
    14561391                if (isset($_SERVER['HTTP_AUTHORIZATION'])) {
     
    14651400
    14661401                // If Basic Auth is working...
    14671402                if (isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) {
    1468                         log_app("Basic Auth",$_SERVER['PHP_AUTH_USER']);
    1469 
    14701403                        $user = wp_authenticate($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
    14711404                        if ( $user && !is_wp_error($user) ) {
    14721405                                wp_set_current_user($user->ID);
    1473                                 log_app("authenticate()", $user->user_login);
    14741406                                return true;
    14751407                        }
    14761408                }
     
    14991431                $type = $_SERVER['CONTENT_TYPE'];
    15001432                list($type,$subtype) = explode('/',$type);
    15011433                list($subtype) = explode(";",$subtype); // strip MIME parameters
    1502                 log_app("get_accepted_content_type", "type=$type, subtype=$subtype");
    15031434
    15041435                foreach($types as $t) {
    15051436                        list($acceptedType,$acceptedSubtype) = explode('/',$t);
  • xmlrpc.php

     
    5454include_once(ABSPATH . WPINC . '/class-IXR.php');
    5555include_once(ABSPATH . WPINC . '/class-wp-xmlrpc-server.php');
    5656
    57 // Turn off all warnings and errors.
    58 // error_reporting(0);
    59 
    6057/**
    6158 * Posts submitted via the xmlrpc interface get that title
    6259 * @name post_default_title
     
    6562$post_default_title = "";
    6663
    6764/**
    68  * Whether to enable XMLRPC Logging.
    69  *
    70  * @name xmlrpc_logging
    71  * @var int|bool
    72  */
    73 $xmlrpc_logging = 0;
    74 
    75 /**
    7665 * logIO() - Writes logging info to a file.
    7766 *
    78  * @uses $xmlrpc_logging
    79  * @package WordPress
    80  * @subpackage Logging
     67 * @deprecated 3.4.0
     68 * @deprecated Use error_log()
    8169 *
    8270 * @param string $io Whether input or output
    8371 * @param string $msg Information describing logging reason.
    84  * @return bool Always return true
    8572 */
    86 function logIO($io,$msg) {
    87         global $xmlrpc_logging;
    88         if ($xmlrpc_logging) {
    89                 $fp = fopen("../xmlrpc.log","a+");
    90                 $date = gmdate("Y-m-d H:i:s ");
    91                 $iot = ($io == "I") ? " Input: " : " Output: ";
    92                 fwrite($fp, "\n\n".$date.$iot.$msg);
    93                 fclose($fp);
    94         }
    95         return true;
     73function logIO( $io, $msg ) {
     74        _deprecated_function( __FUNCTION__, '3.4', 'error_log()' );
     75        if ( ! empty( $GLOBALS['xmlrpc_logging'] ) )
     76                erorr_log( $io . ' - ' . $msg );
    9677}
    9778
    98 if ( isset($HTTP_RAW_POST_DATA) )
    99         logIO("I", $HTTP_RAW_POST_DATA);
    100 
    10179// Allow for a plugin to insert a different class to handle requests.
    10280$wp_xmlrpc_server_class = apply_filters('wp_xmlrpc_server_class', 'wp_xmlrpc_server');
    10381$wp_xmlrpc_server = new $wp_xmlrpc_server_class;