Ticket #10658: XMLRPCErrorString.diff
File XMLRPCErrorString.diff, 1.8 KB (added by , 16 years ago) |
---|
-
xmlrpc.php
207 207 $this->IXR_Server($this->methods); 208 208 } 209 209 210 function errorStringForDisabledXMLRPC() { 211 return sprintf(__( 'XML-RPC services are disabled on this blog. An admin user can enable them at %s'), admin_url('options-writing.php')); 212 } 213 214 function serve($data = false) { 215 // We want to intercept the case where a GET request is issued, but XMLRPC support is disabled. 216 // In this case, it makes a more useful failure message (and one that matches wp-app.php) if we 217 // express the disabled error string instead of allowing the default 'POST requests only' error in IXR. 218 global $HTTP_RAW_POST_DATA; 219 if ( !get_option( 'enable_xmlrpc' ) && !$HTTP_RAW_POST_DATA) { 220 header( 'Content-Type: text/plain' ); 221 die($this->errorStringForDisabledXMLRPC()); 222 } 223 else { 224 parent::serve($data); 225 } 226 } 227 210 228 /** 211 229 * Test XMLRPC API by saying, "Hello!" to client. 212 230 * … … 246 264 */ 247 265 function login_pass_ok($user_login, $user_pass) { 248 266 if ( !get_option( 'enable_xmlrpc' ) ) { 249 $this->error = new IXR_Error( 405, sprintf( __( 'XML-RPC services are disabled on this blog. An admin user can enable them at %s'), admin_url('options-writing.php') ));267 $this->error = new IXR_Error( 405, $this->errorStringForDisabledXMLRPC()); 250 268 return false; 251 269 } 252 270 … … 268 286 */ 269 287 function login($username, $password) { 270 288 if ( !get_option( 'enable_xmlrpc' ) ) { 271 $this->error = new IXR_Error( 405, sprintf( __( 'XML-RPC services are disabled on this blog. An admin user can enable them at %s'), admin_url('options-writing.php') ));289 $this->error = new IXR_Error( 405, $this->errorStringForDisabledXMLRPC()); 272 290 return false; 273 291 } 274 292