Ticket #7157: xmlrpc.php.diff
| File xmlrpc.php.diff, 4.1 KB (added by , 18 years ago) |
|---|
-
xmlrpc.php
39 39 <engineLink>http://wordpress.org/</engineLink> 40 40 <homePageLink><?php bloginfo_rss('url') ?></homePageLink> 41 41 <apis> 42 <?php if ( get_option('enable_xmlrpc') ) :?>43 42 <api name="WordPress" blogID="1" preferred="true" apiLink="<?php bloginfo_rss('wpurl') ?>/xmlrpc.php" /> 44 43 <api name="Movable Type" blogID="1" preferred="false" apiLink="<?php bloginfo_rss('wpurl') ?>/xmlrpc.php" /> 45 44 <api name="MetaWeblog" blogID="1" preferred="false" apiLink="<?php bloginfo_rss('wpurl') ?>/xmlrpc.php" /> 46 45 <api name="Blogger" blogID="1" preferred="false" apiLink="<?php bloginfo_rss('wpurl') ?>/xmlrpc.php" /> 47 <?php endif; if ( get_option('enable_app') ) :?>48 46 <api name="Atom" blogID="" preferred="false" apiLink="<?php echo apply_filters('atom_service_url', (get_bloginfo('url')."/wp-app.php/service"))?>" /> 49 <?php endif; ?>50 47 </apis> 51 48 </service> 52 49 </rsd> … … 111 108 class wp_xmlrpc_server extends IXR_Server { 112 109 113 110 function wp_xmlrpc_server() { 114 $ xmlrpc_methods = array(111 $this->methods = array( 115 112 // WordPress API 116 113 'wp.getUsersBlogs' => 'this:wp_getUsersBlogs', 117 114 'wp.getPage' => 'this:wp_getPage', … … 167 164 'mt.supportedMethods' => 'this:mt_supportedMethods', 168 165 'mt.supportedTextFilters' => 'this:mt_supportedTextFilters', 169 166 'mt.getTrackbackPings' => 'this:mt_getTrackbackPings', 170 'mt.publishPost' => 'this:mt_publishPost' 171 ); 172 173 $xmlrpc_functions = array ( 167 'mt.publishPost' => 'this:mt_publishPost', 168 174 169 // PingBack 175 170 'pingback.ping' => 'this:pingback_ping', 176 171 'pingback.extensions.getPingbacks' => 'this:pingback_extensions_getPingbacks', … … 179 174 'demo.addTwoNumbers' => 'this:addTwoNumbers' 180 175 ); 181 176 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 189 177 $this->initialise_blog_option_info( ); 190 178 $this->methods = apply_filters('xmlrpc_methods', $this->methods); 191 179 $this->IXR_Server($this->methods); … … 202 190 } 203 191 204 192 function login_pass_ok($user_login, $user_pass) { 193 if( !get_option( 'enable_xmlrpc' ) ) { 194 $this->error = new IXR_Error( 405, __( 'XML-RPC servies are disabled on this blog. An admin user can enable them at ' . get_bloginfo( 'wpurl' ) . '/wp-admin/options-writing.php' ) ); 195 return false; 196 } 197 205 198 if (!user_pass_ok($user_login, $user_pass)) { 206 199 $this->error = new IXR_Error(403, __('Bad login/pass combination.')); 207 200 return false; … … 845 838 $post_id = (int) $args[3]; 846 839 847 840 if( !$this->login_pass_ok( $username, $password ) ) { 848 return new IXR_Error( 403, __( 'Bad login/pass combination.' ) );841 return $this->error; 849 842 } 850 843 851 844 set_current_user( 0, $username ); … … 873 866 $password = $args[2]; 874 867 875 868 if( !$this->login_pass_ok( $username, $password ) ) { 876 return new IXR_Error( 403, __( 'Bad login/pass combination.' ) );869 return $this->error; 877 870 } 878 871 879 872 set_current_user( 0, $username ); … … 895 888 $password = $args[2]; 896 889 897 890 if( !$this->login_pass_ok( $username, $password ) ) { 898 return new IXR_Error( 403, __( 'Bad login/pass combination.' ) );891 return $this->error; 899 892 } 900 893 901 894 set_current_user( 0, $username ); … … 916 909 $password = $args[2]; 917 910 918 911 if( !$this->login_pass_ok( $username, $password ) ) { 919 return new IXR_Error( 403, __( 'Bad login/pass combination.' ) );912 return $this->error; 920 913 } 921 914 922 915 set_current_user( 0, $username ); … … 939 932 $options = (array) $args[3]; 940 933 941 934 if( !$this->login_pass_ok( $username, $password ) ) 942 return new IXR_Error( 403, __( 'Bad login/pass combination.' ) );935 return $this->error; 943 936 944 937 $user = set_current_user( 0, $username ); 945 938 … … 978 971 $options = (array) $args[3]; 979 972 980 973 if( !$this->login_pass_ok( $username, $password ) ) 981 return new IXR_Error( 403, __( 'Bad login/pass combination.' ) );974 return $this->error; 982 975 983 976 $user = set_current_user( 0, $username ); 984 977 if( !current_user_can( 'manage_options' ) )