Ticket #20051: 20051.diff
File 20051.diff, 22.5 KB (added by , 13 years ago) |
---|
-
wp-includes/functions.php
395 395 } 396 396 397 397 /** 398 * Open the file handle for debugging.399 *400 * This function is used for XMLRPC feature, but it is general purpose enough401 * to be used in anywhere.402 *403 * @see fopen() for mode options.404 * @package WordPress405 * @subpackage Debug406 * @since 0.71407 * @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 global427 * $debug is set to 1 or true.428 *429 * @package WordPress430 * @subpackage Debug431 * @since 0.71432 * @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 $debug447 * is set to 1 or true.448 *449 * @package WordPress450 * @subpackage Debug451 * @since 0.71452 * @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 /**463 398 * Check content for video and audio links to add as enclosures. 464 399 * 465 400 * Will not add enclosures that have already been added and will … … 480 415 //TODO: Tidy this ghetto code up and make the debug code optional 481 416 include_once( ABSPATH . WPINC . '/class-IXR.php' ); 482 417 483 $log = debug_fopen( ABSPATH . 'enclosures.log', 'a' );484 418 $post_links = array(); 485 debug_fwrite( $log, 'BEGIN ' . date( 'YmdHis', time() ) . "\n" );486 419 487 420 $pung = get_enclosed( $post_ID ); 488 421 … … 493 426 494 427 preg_match_all( "{\b http : [$any] +? (?= [$punc] * [^$any] | $)}x", $content, $post_links_temp ); 495 428 496 debug_fwrite( $log, 'Post contents:' );497 debug_fwrite( $log, $content . "\n" );498 499 429 foreach ( $pung as $link_test ) { 500 430 if ( !in_array( $link_test, $post_links_temp[0] ) ) { // link no longer in post 501 431 $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
2700 2700 2701 2701 $this->attach_uploads( $post_ID, $post_content ); 2702 2702 2703 logIO('O', "Posted ! ID: $post_ID");2704 2705 2703 return $post_ID; 2706 2704 } 2707 2705 … … 3046 3044 $post_category = array(); 3047 3045 if ( isset( $content_struct['categories'] ) ) { 3048 3046 $catnames = $content_struct['categories']; 3049 logIO('O', 'Post cats: ' . var_export($catnames,true));3050 3047 3051 3048 if ( is_array($catnames) ) { 3052 3049 foreach ($catnames as $cat) { … … 3088 3085 if ( !$post_ID ) 3089 3086 return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.')); 3090 3087 3091 logIO('O', "Posted ! ID: $post_ID");3092 3093 3088 return strval($post_ID); 3094 3089 } 3095 3090 … … 3381 3376 if ( isset( $content_struct['wp_post_format'] ) ) 3382 3377 wp_set_post_terms( $post_ID, array( 'post-format-' . $content_struct['wp_post_format'] ), 'post_format' ); 3383 3378 3384 logIO('O',"(MW) Edited ! ID: $post_ID");3385 3386 3379 return true; 3387 3380 } 3388 3381 … … 3695 3688 $type = $data['type']; 3696 3689 $bits = $data['bits']; 3697 3690 3698 logIO('O', '(MW) Received '.strlen($bits).' bytes');3699 3700 3691 if ( !$user = $this->login($username, $password) ) 3701 3692 return $this->error; 3702 3693 3703 3694 do_action('xmlrpc_call', 'metaWeblog.newMediaObject'); 3704 3695 3705 3696 if ( !current_user_can('upload_files') ) { 3706 logIO('O', '(MW) User does not have upload_files capability');3707 3697 $this->error = new IXR_Error(401, __('You are not allowed to upload files to this site.')); 3708 3698 return $this->error; 3709 3699 } … … 3732 3722 $upload = wp_upload_bits($name, null, $bits); 3733 3723 if ( ! empty($upload['error']) ) { 3734 3724 $errorString = sprintf(__('Could not write file %1$s (%2$s)'), $name, $upload['error']); 3735 logIO('O', '(MW) ' . $errorString);3736 3725 return new IXR_Error(500, $errorString); 3737 3726 } 3738 3727 // Construct the attachment array … … 4119 4108 } 4120 4109 $post_ID = (int) $post_ID; 4121 4110 4122 logIO("O","(PB) URL='$pagelinkedto' ID='$post_ID' Found='$way'");4123 4124 4111 $post = get_post($post_ID); 4125 4112 4126 4113 if ( !$post ) // Post_ID not found -
wp-includes/deprecated.php
2564 2564 * Is the current admin page generated by a plugin? 2565 2565 * 2566 2566 * @since 1.5.0 2567 * @deprecated 3.1 2567 * @deprecated 3.1.0 2568 2568 * @deprecated Use global $plugin_page and/or get_plugin_page_hookname() hooks. 2569 2569 * 2570 2570 * @global $plugin_page … … 2590 2590 * for updating the category cache. 2591 2591 * 2592 2592 * @since 1.5.0 2593 * @deprecated 3.1 2593 * @deprecated 3.1.0 2594 2594 * 2595 2595 * @return bool Always return True 2596 2596 */ … … 2604 2604 * Check for PHP timezone support 2605 2605 * 2606 2606 * @since 2.9.0 2607 * @deprecated 3.2 2607 * @deprecated 3.2.0 2608 2608 * 2609 2609 * @return bool 2610 2610 */ … … 2618 2618 * Display editor: TinyMCE, HTML, or both. 2619 2619 * 2620 2620 * @since 2.1.0 2621 * @deprecated 3.3 2621 * @deprecated 3.3.0 2622 * @deprecated Use wp_editor() 2623 * @see wp_editor() 2622 2624 * 2623 2625 * @param string $content Textarea content. 2624 2626 * @param string $id Optional, default is 'content'. HTML ID attribute value. … … 2627 2629 * @param int $tab_index Optional, not used 2628 2630 */ 2629 2631 function the_editor($content, $id = 'content', $prev_id = 'title', $media_buttons = true, $tab_index = 2, $extended = true) { 2632 _deprecated_function( __FUNCTION__, '3.3', 'wp_editor()' ); 2630 2633 2631 2634 wp_editor( $content, $id, array( 'media_buttons' => $media_buttons ) ); 2632 2635 return; … … 2636 2639 * Perform the query to get the $metavalues array(s) needed by _fill_user and _fill_many_users 2637 2640 * 2638 2641 * @since 3.0.0 2642 * @deprecated 3.3.0 2643 * 2639 2644 * @param array $ids User ID numbers list. 2640 2645 * @return array of arrays. The array is indexed by user_id, containing $metavalues object arrays. 2641 2646 */ … … 2668 2673 * 2669 2674 * @since 2.3.0 2670 2675 * @deprecated 3.3.0 2671 * @uses sanitize_user_field() Used to sanitize the fields.2672 2676 * 2673 2677 * @param object|array $user The User Object or Array 2674 2678 * @param string $context Optional, default is 'display'. How to sanitize user fields. … … 2705 2709 * Can either be start or end post relational link. 2706 2710 * 2707 2711 * @since 2.8.0 2708 * @deprecated 3.3 2712 * @deprecated 3.3.0 2709 2713 * 2710 2714 * @param string $title Optional. Link title format. 2711 2715 * @param bool $in_same_cat Optional. Whether link should be in a same category. … … 2745 2749 * Display relational link for the first post. 2746 2750 * 2747 2751 * @since 2.8.0 2748 * @deprecated 3.3 2752 * @deprecated 3.3.0 2749 2753 * 2750 2754 * @param string $title Optional. Link title format. 2751 2755 * @param bool $in_same_cat Optional. Whether link should be in a same category. … … 2761 2765 * Get site index relational link. 2762 2766 * 2763 2767 * @since 2.8.0 2764 * @deprecated 3.3 2768 * @deprecated 3.3.0 2765 2769 * 2766 2770 * @return string 2767 2771 */ … … 2776 2780 * Display relational link for the site index. 2777 2781 * 2778 2782 * @since 2.8.0 2779 * @deprecated 3.3 2783 * @deprecated 3.3.0 2780 2784 */ 2781 2785 function index_rel_link() { 2782 2786 _deprecated_function( __FUNCTION__, '3.3' ); … … 2788 2792 * Get parent post relational link. 2789 2793 * 2790 2794 * @since 2.8.0 2791 * @deprecated 3.3 2795 * @deprecated 3.3.0 2792 2796 * 2793 2797 * @param string $title Optional. Link title format. 2794 2798 * @return string … … 2819 2823 * Display relational link for parent item 2820 2824 * 2821 2825 * @since 2.8.0 2822 * @deprecated 3.3 2826 * @deprecated 3.3.0 2823 2827 */ 2824 2828 function parent_post_rel_link($title = '%title') { 2825 2829 _deprecated_function( __FUNCTION__, '3.3' ); … … 2831 2835 * Add the "Dashboard"/"Visit Site" menu. 2832 2836 * 2833 2837 * @since 3.2.0 2834 * @deprecated 3.3 2838 * @deprecated 3.3.0 2835 2839 */ 2836 2840 function wp_admin_bar_dashboard_view_site_menu( $wp_admin_bar ) { 2837 2841 _deprecated_function( __FUNCTION__, '3.3' ); … … 2852 2856 * Checks if the current user belong to a given blog. 2853 2857 * 2854 2858 * @since MU 2855 * @deprecated 3.3 2859 * @deprecated 3.3.0 2856 2860 * @deprecated Use is_user_member_of_blog() 2857 2861 * @see is_user_member_of_blog() 2858 2862 * … … 2864 2868 2865 2869 return is_user_member_of_blog( get_current_user_id(), $blog_id ); 2866 2870 } 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 */ 2880 function 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 */ 2893 function 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 */ 2906 function debug_fclose( $fp ) { 2907 _deprecated_function( __FUNCTION__, 'error_log' ); 2908 } 2909 No newline at end of file -
wp-app.php
24 24 $_SERVER['PATH_INFO'] = preg_replace( '/.*\/wp-app\.php/', '', $_SERVER['REQUEST_URI'] ); 25 25 26 26 /** 27 * Whether to enable Atom Publishing Protocol Logging.28 *29 * @name app_logging30 * @var int|bool31 */32 $app_logging = 0;33 34 /**35 27 * Whether to always authenticate user. Permanently set to true. 36 28 * 37 29 * @name always_authenticate … … 44 36 * Writes logging info to a file. 45 37 * 46 38 * @since 2.2.0 47 * @ uses $app_logging48 * @ package WordPress49 * @ subpackage Logging39 * @deprecated 3.4.0 40 * @deprecated Use error_log() 41 * @link http://www.php.net/manual/en/function.error-log.php 50 42 * 51 43 * @param string $label Type of logging 52 44 * @param string $msg Information describing logging reason. 53 45 */ 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 } 46 function log_app( $label, $msg ) { 47 _deprecated_function( __FUNCTION__, '3.4', 'error_log()' ); 48 if ( ! empty( $GLOBALS['app_logging'] ) ) 49 error_log( $label . ' - ' . $message ); 62 50 } 63 51 64 52 /** … … 268 256 269 257 $method = $_SERVER['REQUEST_METHOD']; 270 258 271 log_app('REQUEST',"$method $path\n================");272 273 259 $this->process_conditionals(); 274 260 //$this->process_conditionals(); 275 261 … … 319 305 * @since 2.2.0 320 306 */ 321 307 function get_service() { 322 log_app('function','get_service()');323 324 308 if ( !current_user_can( 'edit_posts' ) ) 325 309 $this->auth_required( __( 'Sorry, you do not have the right to access this site.' ) ); 326 310 … … 360 344 * @since 2.2.0 361 345 */ 362 346 function get_categories_xml() { 363 log_app('function','get_categories_xml()');364 365 347 if ( !current_user_can( 'edit_posts' ) ) 366 348 $this->auth_required( __( 'Sorry, you do not have the right to access this site.' ) ); 367 349 … … 397 379 398 380 $entry = array_pop($parser->feed->entries); 399 381 400 log_app('Received entry:', print_r($entry,true));401 402 382 $catnames = array(); 403 383 foreach ( $entry->categories as $cat ) { 404 384 array_push($catnames, $cat["term"]); … … 436 416 $post_data = compact('blog_ID', 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'post_name'); 437 417 438 418 $this->escape($post_data); 439 log_app('Inserting Post. Data:', print_r($post_data,true));440 419 441 420 $postID = wp_insert_post($post_data); 442 421 if ( is_wp_error( $postID ) ) … … 455 434 456 435 $output = $this->get_entry($postID); 457 436 458 log_app('function',"create_post($postID)");459 437 $this->created($postID, $output); 460 438 } 461 439 … … 474 452 475 453 $this->set_current_entry($postID); 476 454 $output = $this->get_entry($postID); 477 log_app('function',"get_post($postID)");478 455 $this->output($output); 479 456 480 457 } … … 497 474 498 475 $parsed = array_pop($parser->feed->entries); 499 476 500 log_app('Received UPDATED entry:', print_r($parsed,true));501 502 477 // check for not found 503 478 global $entry; 504 479 $this->set_current_entry($postID); … … 531 506 532 507 do_action( 'atompub_put_post', $ID, $parsed ); 533 508 534 log_app('function',"put_post($postID)");535 509 $this->ok(); 536 510 } 537 511 … … 560 534 $this->internal_error(__('For some strange yet very annoying reason, this post could not be deleted.')); 561 535 } 562 536 563 log_app('function',"delete_post($postID)");564 537 $this->ok(); 565 538 } 566 539 … … 582 555 } else { 583 556 $this->set_current_entry($postID); 584 557 $output = $this->get_entry($postID, 'attachment'); 585 log_app('function',"get_attachment($postID)");586 558 $this->output($output); 587 559 } 588 560 } … … 617 589 $slug = sanitize_file_name( "$slug.$ext" ); 618 590 $file = wp_upload_bits( $slug, null, $bits); 619 591 620 log_app('wp_upload_bits returns:',print_r($file,true));621 622 592 $url = $file['url']; 623 593 $file = $file['file']; 624 594 … … 643 613 $output = $this->get_entry($postID, 'attachment'); 644 614 645 615 $this->created($postID, $output, 'attachment'); 646 log_app('function',"create_attachment($postID)");647 616 } 648 617 649 618 /** … … 688 657 if ( !$result ) 689 658 $this->internal_error(__('For some strange yet very annoying reason, this post could not be edited.')); 690 659 691 log_app('function',"put_attachment($postID)");692 660 $this->ok(); 693 661 } 694 662 … … 700 668 * @param int $postID Post ID. 701 669 */ 702 670 function delete_attachment($postID) { 703 log_app('function',"delete_attachment($postID). File '$location' deleted.");704 705 671 // check for not found 706 672 global $entry; 707 673 $this->set_current_entry($postID); … … 724 690 if ( !$result ) 725 691 $this->internal_error(__('For some strange yet very annoying reason, this post could not be deleted.')); 726 692 727 log_app('function',"delete_attachment($postID). File '$location' deleted.");728 693 $this->ok(); 729 694 } 730 695 … … 770 735 status_header ('404'); 771 736 } 772 737 773 log_app('function',"get_file($postID)");774 738 exit; 775 739 } 776 740 … … 828 792 829 793 wp_update_attachment_metadata( $postID, wp_generate_attachment_metadata( $postID, $location ) ); 830 794 831 log_app('function',"put_file($postID)");832 795 $this->ok(); 833 796 } 834 797 … … 939 902 940 903 $url = $this->app_base . $this->ENTRY_PATH . "/$postID"; 941 904 942 log_app('function',"get_entry_url() = $url");943 905 return $url; 944 906 } 945 907 … … 970 932 971 933 $url = $this->app_base . $this->MEDIA_SINGLE_PATH ."/file/$postID"; 972 934 973 log_app('function',"get_media_url() = $url");974 935 return $url; 975 936 } 976 937 … … 994 955 */ 995 956 function set_current_entry($postID) { 996 957 global $entry; 997 log_app('function',"set_current_entry($postID)");998 958 999 959 if (!isset($postID)) { 1000 960 // $this->bad_request(); … … 1018 978 * @param string $post_type Optional, default is 'post'. Post Type. 1019 979 */ 1020 980 function get_posts($page = 1, $post_type = 'post') { 1021 log_app('function',"get_posts($page, '$post_type')");1022 981 $feed = $this->get_feed($page, $post_type); 1023 982 $this->output($feed); 1024 983 } … … 1032 991 * @param string $post_type Optional, default is 'attachment'. Post type. 1033 992 */ 1034 993 function get_attachments($page = 1, $post_type = 'attachment') { 1035 log_app('function',"get_attachments($page, '$post_type')");1036 994 $GLOBALS['post_type'] = $post_type; 1037 995 $feed = $this->get_feed($page, $post_type); 1038 996 $this->output($feed); … … 1049 1007 */ 1050 1008 function get_feed($page = 1, $post_type = 'post') { 1051 1009 global $post, $wp, $wp_query, $posts, $wpdb, $blog_id; 1052 log_app('function',"get_feed($page, '$post_type')");1053 1010 ob_start(); 1054 1011 1055 1012 $this->ENTRY_PATH = $post_type; … … 1069 1026 $wp_query = $GLOBALS['wp_query']; 1070 1027 $wpdb = $GLOBALS['wpdb']; 1071 1028 $blog_id = (int) $GLOBALS['blog_id']; 1072 log_app('function',"query_posts(# " . print_r($wp_query, true) . "#)");1073 1029 1074 log_app('function',"total_count(# $wp_query->max_num_pages #)");1075 1030 $last_page = $wp_query->max_num_pages; 1076 1031 $next_page = (($page + 1) > $last_page) ? null : $page + 1; 1077 1032 $prev_page = ($page - 1) < 1 ? null : $page - 1; … … 1116 1071 * @return string. 1117 1072 */ 1118 1073 function get_entry($postID, $post_type = 'post') { 1119 log_app('function',"get_entry($postID, '$post_type')");1120 1074 ob_start(); 1121 1075 switch($post_type) { 1122 1076 case 'post': … … 1132 1086 while ( have_posts() ) { 1133 1087 the_post(); 1134 1088 $this->echo_entry(); 1135 log_app('$post',print_r($GLOBALS['post'],true));1136 1089 $entry = ob_get_contents(); 1137 1090 break; 1138 1091 } 1139 1092 } 1140 1093 ob_end_clean(); 1141 1094 1142 log_app('get_entry returning:',$entry);1143 1095 return $entry; 1144 1096 } 1145 1097 … … 1190 1142 * @since 2.2.0 1191 1143 */ 1192 1144 function ok() { 1193 log_app('Status','200: OK');1194 1145 header('Content-Type: text/plain'); 1195 1146 status_header('200'); 1196 1147 exit; … … 1202 1153 * @since 2.2.0 1203 1154 */ 1204 1155 function no_content() { 1205 log_app('Status','204: No Content');1206 1156 header('Content-Type: text/plain'); 1207 1157 status_header('204'); 1208 1158 echo "Moved to Trash."; … … 1217 1167 * @param string $msg Optional. Status string. 1218 1168 */ 1219 1169 function internal_error($msg = 'Internal Server Error') { 1220 log_app('Status','500: Server Error');1221 1170 header('Content-Type: text/plain'); 1222 1171 status_header('500'); 1223 1172 echo $msg; … … 1230 1179 * @since 2.2.0 1231 1180 */ 1232 1181 function bad_request() { 1233 log_app('Status','400: Bad Request');1234 1182 header('Content-Type: text/plain'); 1235 1183 status_header('400'); 1236 1184 exit; … … 1242 1190 * @since 2.2.0 1243 1191 */ 1244 1192 function length_required() { 1245 log_app('Status','411: Length Required');1246 1193 header("HTTP/1.1 411 Length Required"); 1247 1194 header('Content-Type: text/plain'); 1248 1195 status_header('411'); … … 1255 1202 * @since 2.2.0 1256 1203 */ 1257 1204 function invalid_media() { 1258 log_app('Status','415: Unsupported Media Type');1259 1205 header("HTTP/1.1 415 Unsupported Media Type"); 1260 1206 header('Content-Type: text/plain'); 1261 1207 exit; … … 1267 1213 * @since 2.6.0 1268 1214 */ 1269 1215 function forbidden($reason='') { 1270 log_app('Status','403: Forbidden');1271 1216 header('Content-Type: text/plain'); 1272 1217 status_header('403'); 1273 1218 echo $reason; … … 1280 1225 * @since 2.2.0 1281 1226 */ 1282 1227 function not_found() { 1283 log_app('Status','404: Not Found');1284 1228 header('Content-Type: text/plain'); 1285 1229 status_header('404'); 1286 1230 exit; … … 1292 1236 * @since 2.2.0 1293 1237 */ 1294 1238 function not_allowed($allow) { 1295 log_app('Status','405: Not Allowed');1296 1239 header('Allow: ' . join(',', $allow)); 1297 1240 status_header('405'); 1298 1241 exit; … … 1304 1247 * @since 2.3.0 1305 1248 */ 1306 1249 function redirect($url) { 1307 1308 log_app('Status','302: Redirect');1309 1250 $escaped_url = esc_attr($url); 1310 1251 $content = <<<EOD 1311 1252 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> … … 1334 1275 * @since 2.2.0 1335 1276 */ 1336 1277 function client_error($msg = 'Client Error') { 1337 log_app('Status','400: Client Error');1338 1278 header('Content-Type: text/plain'); 1339 1279 status_header('400'); 1340 1280 exit; … … 1348 1288 * @since 2.2.0 1349 1289 */ 1350 1290 function created($post_ID, $content, $post_type = 'post') { 1351 log_app('created()::$post_ID',"$post_ID, $post_type");1352 1291 $edit = $this->get_entry_url($post_ID); 1353 1292 switch($post_type) { 1354 1293 case 'post': … … 1375 1314 * @param string $msg Status header content and HTML content. 1376 1315 */ 1377 1316 function auth_required($msg) { 1378 log_app('Status','401: Auth Required');1379 1317 nocache_headers(); 1380 1318 header('WWW-Authenticate: Basic realm="WordPress Atom Protocol"'); 1381 1319 header("HTTP/1.1 401 $msg"); … … 1416 1354 header('Date: '. date('r')); 1417 1355 if ($this->do_output) 1418 1356 echo $xml; 1419 log_app('function', "output:\n$xml");1420 1357 exit; 1421 1358 } 1422 1359 … … 1449 1386 * @return bool 1450 1387 */ 1451 1388 function authenticate() { 1452 log_app("authenticate()",print_r($_ENV, true));1453 1454 1389 // if using mod_rewrite/ENV hack 1455 1390 // http://www.besthostratings.com/articles/http-auth-php-cgi.html 1456 1391 if (isset($_SERVER['HTTP_AUTHORIZATION'])) { … … 1465 1400 1466 1401 // If Basic Auth is working... 1467 1402 if (isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) { 1468 log_app("Basic Auth",$_SERVER['PHP_AUTH_USER']);1469 1470 1403 $user = wp_authenticate($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']); 1471 1404 if ( $user && !is_wp_error($user) ) { 1472 1405 wp_set_current_user($user->ID); 1473 log_app("authenticate()", $user->user_login);1474 1406 return true; 1475 1407 } 1476 1408 } … … 1499 1431 $type = $_SERVER['CONTENT_TYPE']; 1500 1432 list($type,$subtype) = explode('/',$type); 1501 1433 list($subtype) = explode(";",$subtype); // strip MIME parameters 1502 log_app("get_accepted_content_type", "type=$type, subtype=$subtype");1503 1434 1504 1435 foreach($types as $t) { 1505 1436 list($acceptedType,$acceptedSubtype) = explode('/',$t); -
xmlrpc.php
54 54 include_once(ABSPATH . WPINC . '/class-IXR.php'); 55 55 include_once(ABSPATH . WPINC . '/class-wp-xmlrpc-server.php'); 56 56 57 // Turn off all warnings and errors.58 // error_reporting(0);59 60 57 /** 61 58 * Posts submitted via the xmlrpc interface get that title 62 59 * @name post_default_title … … 65 62 $post_default_title = ""; 66 63 67 64 /** 68 * Whether to enable XMLRPC Logging.69 *70 * @name xmlrpc_logging71 * @var int|bool72 */73 $xmlrpc_logging = 0;74 75 /**76 65 * logIO() - Writes logging info to a file. 77 66 * 78 * @uses $xmlrpc_logging 79 * @package WordPress 80 * @subpackage Logging 67 * @deprecated 3.4.0 68 * @deprecated Use error_log() 81 69 * 82 70 * @param string $io Whether input or output 83 71 * @param string $msg Information describing logging reason. 84 * @return bool Always return true85 72 */ 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; 73 function logIO( $io, $msg ) { 74 _deprecated_function( __FUNCTION__, '3.4', 'error_log()' ); 75 if ( ! empty( $GLOBALS['xmlrpc_logging'] ) ) 76 erorr_log( $io . ' - ' . $msg ); 96 77 } 97 78 98 if ( isset($HTTP_RAW_POST_DATA) )99 logIO("I", $HTTP_RAW_POST_DATA);100 101 79 // Allow for a plugin to insert a different class to handle requests. 102 80 $wp_xmlrpc_server_class = apply_filters('wp_xmlrpc_server_class', 'wp_xmlrpc_server'); 103 81 $wp_xmlrpc_server = new $wp_xmlrpc_server_class;