Ticket #7157: xmlrpc_disabled.diff
| File xmlrpc_disabled.diff, 6.1 KB (added by , 18 years ago) |
|---|
-
xmlrpc.php
111 111 class wp_xmlrpc_server extends IXR_Server { 112 112 113 113 function wp_xmlrpc_server() { 114 $ xmlrpc_methods = array(114 $this->methods = array( 115 115 // WordPress API 116 116 'wp.getUsersBlogs' => 'this:wp_getUsersBlogs', 117 117 'wp.getPage' => 'this:wp_getPage', … … 167 167 'mt.supportedMethods' => 'this:mt_supportedMethods', 168 168 'mt.supportedTextFilters' => 'this:mt_supportedTextFilters', 169 169 'mt.getTrackbackPings' => 'this:mt_getTrackbackPings', 170 'mt.publishPost' => 'this:mt_publishPost' 171 ); 172 173 $xmlrpc_functions = array ( 170 'mt.publishPost' => 'this:mt_publishPost', 171 174 172 // PingBack 175 173 'pingback.ping' => 'this:pingback_ping', 176 174 'pingback.extensions.getPingbacks' => 'this:pingback_extensions_getPingbacks', … … 179 177 'demo.addTwoNumbers' => 'this:addTwoNumbers' 180 178 ); 181 179 182 if ( get_option('enable_xmlrpc') ) 183 { 184 $this->methods = array_merge($xmlrpc_methods,$xmlrpc_functions); 185 } else { 186 $this->methods = $xmlrpc_functions; 187 } 188 180 $this->enabled = ( get_option('enable_xmlrpc') ) ? true : false; 189 181 $this->initialise_blog_option_info( ); 190 182 $this->methods = apply_filters('xmlrpc_methods', $this->methods); 191 183 $this->IXR_Server($this->methods); … … 328 320 * wp_getUsersBlogs 329 321 */ 330 322 function wp_getUsersBlogs( $args ) { 323 if ( ! $this->enabled ) 324 return new IXR_Error( 401, __( 'XML-RPC is not enabled for this blog. Enable it through Settings->Writing' ) ); 325 331 326 // If this isn't on WPMU then just use blogger_getUsersBlogs 332 327 if( !function_exists( 'is_site_admin' ) ) { 333 328 array_unshift( $args, 1 ); … … 375 370 * wp_getPage 376 371 */ 377 372 function wp_getPage($args) { 373 if ( ! $this->enabled ) 374 return new IXR_Error( 401, __( 'XML-RPC is not enabled for this blog. Enable it through Settings->Writing' ) ); 375 378 376 $this->escape($args); 379 377 380 378 $blog_id = (int) $args[0]; … … 469 467 * wp_getPages 470 468 */ 471 469 function wp_getPages($args) { 470 if ( ! $this->enabled ) 471 return new IXR_Error( 401, __( 'XML-RPC is not enabled for this blog. Enable it through Settings->Writing' ) ); 472 472 473 $this->escape($args); 473 474 474 475 $blog_id = (int) $args[0]; … … 513 514 * wp_newPage 514 515 */ 515 516 function wp_newPage($args) { 517 if ( ! $this->enabled ) 518 return new IXR_Error( 401, __( 'XML-RPC is not enabled for this blog. Enable it through Settings->Writing' ) ); 519 516 520 // Items not escaped here will be escaped in newPost. 517 521 $username = $this->escape($args[1]); 518 522 $password = $this->escape($args[2]); … … 544 548 * wp_deletePage 545 549 */ 546 550 function wp_deletePage($args) { 551 if ( ! $this->enabled ) 552 return new IXR_Error( 401, __( 'XML-RPC is not enabled for this blog. Enable it through Settings->Writing' ) ); 553 547 554 $this->escape($args); 548 555 549 556 $blog_id = (int) $args[0]; … … 587 594 * wp_editPage 588 595 */ 589 596 function wp_editPage($args) { 597 if ( ! $this->enabled ) 598 return new IXR_Error( 401, __( 'XML-RPC is not enabled for this blog. Enable it through Settings->Writing' ) ); 599 590 600 // Items not escaped here will be escaped in editPost. 591 601 $blog_id = (int) $args[0]; 592 602 $page_id = (int) $this->escape($args[1]); … … 637 647 * wp_getPageList 638 648 */ 639 649 function wp_getPageList($args) { 650 if ( ! $this->enabled ) 651 return new IXR_Error( 401, __( 'XML-RPC is not enabled for this blog. Enable it through Settings->Writing' ) ); 652 640 653 global $wpdb; 641 654 642 655 $this->escape($args); … … 688 701 * wp_getAuthors 689 702 */ 690 703 function wp_getAuthors($args) { 704 if ( ! $this->enabled ) 705 return new IXR_Error( 401, __( 'XML-RPC is not enabled for this blog. Enable it through Settings->Writing' ) ); 691 706 692 707 $this->escape($args); 693 708 … … 723 738 * wp_newCategory 724 739 */ 725 740 function wp_newCategory($args) { 741 if ( ! $this->enabled ) 742 return new IXR_Error( 401, __( 'XML-RPC is not enabled for this blog. Enable it through Settings->Writing' ) ); 743 726 744 $this->escape($args); 727 745 728 746 $blog_id = (int) $args[0]; … … 779 797 * wp_deleteCategory 780 798 */ 781 799 function wp_deleteCategory($args) { 800 if ( ! $this->enabled ) 801 return new IXR_Error( 401, __( 'XML-RPC is not enabled for this blog. Enable it through Settings->Writing' ) ); 802 782 803 $this->escape($args); 783 804 784 805 $blog_id = (int) $args[0]; … … 806 827 * wp_suggestCategories 807 828 */ 808 829 function wp_suggestCategories($args) { 830 if ( ! $this->enabled ) 831 return new IXR_Error( 401, __( 'XML-RPC is not enabled for this blog. Enable it through Settings->Writing' ) ); 832 809 833 $this->escape($args); 810 834 811 835 $blog_id = (int) $args[0]; … … 837 861 } 838 862 839 863 function wp_getCommentCount( $args ) { 864 if ( ! $this->enabled ) 865 return new IXR_Error( 401, __( 'XML-RPC is not enabled for this blog. Enable it through Settings->Writing' ) ); 866 840 867 $this->escape($args); 841 868 842 869 $blog_id = (int) $args[0]; … … 866 893 867 894 868 895 function wp_getPostStatusList( $args ) { 896 if ( ! $this->enabled ) 897 return new IXR_Error( 401, __( 'XML-RPC is not enabled for this blog. Enable it through Settings->Writing' ) ); 898 869 899 $this->escape( $args ); 870 900 871 901 $blog_id = (int) $args[0]; … … 888 918 889 919 890 920 function wp_getPageStatusList( $args ) { 921 if ( ! $this->enabled ) 922 return new IXR_Error( 401, __( 'XML-RPC is not enabled for this blog. Enable it through Settings->Writing' ) ); 923 891 924 $this->escape( $args ); 892 925 893 926 $blog_id = (int) $args[0]; … … 909 942 } 910 943 911 944 function wp_getPageTemplates( $args ) { 945 if ( ! $this->enabled ) 946 return new IXR_Error( 401, __( 'XML-RPC is not enabled for this blog. Enable it through Settings->Writing' ) ); 947 912 948 $this->escape( $args ); 913 949 914 950 $blog_id = (int) $args[0]; … … 931 967 } 932 968 933 969 function wp_getOptions( $args ) { 970 if ( ! $this->enabled ) 971 return new IXR_Error( 401, __( 'XML-RPC is not enabled for this blog. Enable it through Settings->Writing' ) ); 972 934 973 $this->escape( $args ); 935 974 936 975 $blog_id = (int) $args[0]; … … 970 1009 } 971 1010 972 1011 function wp_setOptions( $args ) { 1012 if ( ! $this->enabled ) 1013 return new IXR_Error( 401, __( 'XML-RPC is not enabled for this blog. Enable it through Settings->Writing' ) ); 1014 973 1015 $this->escape( $args ); 974 1016 975 1017 $blog_id = (int) $args[0];