Make WordPress Core

Changeset 8202 for trunk/xmlrpc.php


Ignore:
Timestamp:
06/26/2008 10:39:57 PM (16 years ago)
Author:
ryan
Message:

More informative error message when remote publishing is disabled. Don't disable if upgrading. Props josephscott. see #7157

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/xmlrpc.php

    r8136 r8202  
    4040    <homePageLink><?php bloginfo_rss('url') ?></homePageLink>
    4141    <apis>
    42     <?php if ( get_option('enable_xmlrpc') ) :?>
    4342      <api name="WordPress" blogID="1" preferred="true" apiLink="<?php bloginfo_rss('wpurl') ?>/xmlrpc.php" />
    4443      <api name="Movable Type" blogID="1" preferred="false" apiLink="<?php bloginfo_rss('wpurl') ?>/xmlrpc.php" />
    4544      <api name="MetaWeblog" blogID="1" preferred="false" apiLink="<?php bloginfo_rss('wpurl') ?>/xmlrpc.php" />
    4645      <api name="Blogger" blogID="1" preferred="false" apiLink="<?php bloginfo_rss('wpurl') ?>/xmlrpc.php" />
    47     <?php endif; if ( get_option('enable_app') ) :?>
    4846      <api name="Atom" blogID="" preferred="false" apiLink="<?php echo apply_filters('atom_service_url', (get_bloginfo('url')."/wp-app.php/service"))?>" />
    49     <?php endif; ?>
    5047    </apis>
    5148  </service>
     
    112109
    113110    function wp_xmlrpc_server() {
    114         $xmlrpc_methods = array(
     111        $this->methods = array(
    115112            // WordPress API
    116113            'wp.getUsersBlogs'      => 'this:wp_getUsersBlogs',
     
    168165            'mt.supportedTextFilters' => 'this:mt_supportedTextFilters',
    169166            'mt.getTrackbackPings' => 'this:mt_getTrackbackPings',
    170             'mt.publishPost' => 'this:mt_publishPost'
    171         );
    172        
    173         $xmlrpc_functions = array (
     167            'mt.publishPost' => 'this:mt_publishPost',
     168
    174169            // PingBack
    175170            'pingback.ping' => 'this:pingback_ping',
     
    180175        );
    181176
    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        
    189177        $this->initialise_blog_option_info( );
    190178        $this->methods = apply_filters('xmlrpc_methods', $this->methods);
     
    203191
    204192    function login_pass_ok($user_login, $user_pass) {
     193        if ( !get_option( 'enable_xmlrpc' ) ) {
     194            $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') ) );
     195            return false;
     196        }
     197
    205198        if (!user_pass_ok($user_login, $user_pass)) {
    206199            $this->error = new IXR_Error(403, __('Bad login/pass combination.'));
     
    846839
    847840        if( !$this->login_pass_ok( $username, $password ) ) {
    848             return new IXR_Error( 403, __( 'Bad login/pass combination.' ) );
     841            return $this->error;
    849842        }
    850843
     
    874867
    875868        if( !$this->login_pass_ok( $username, $password ) ) {
    876             return new IXR_Error( 403, __( 'Bad login/pass combination.' ) );
     869            return $this->error;
    877870        }
    878871
     
    896889
    897890        if( !$this->login_pass_ok( $username, $password ) ) {
    898             return new IXR_Error( 403, __( 'Bad login/pass combination.' ) );
     891            return $this->error;
    899892        }
    900893
     
    917910
    918911        if( !$this->login_pass_ok( $username, $password ) ) {
    919             return new IXR_Error( 403, __( 'Bad login/pass combination.' ) );
     912            return $this->error;
    920913        }
    921914
     
    940933
    941934        if( !$this->login_pass_ok( $username, $password ) )
    942             return new IXR_Error( 403, __( 'Bad login/pass combination.' ) );
     935            return $this->error;
    943936
    944937        $user = set_current_user( 0, $username );
     
    979972
    980973        if( !$this->login_pass_ok( $username, $password ) )
    981             return new IXR_Error( 403, __( 'Bad login/pass combination.' ) );
     974            return $this->error;
    982975
    983976        $user = set_current_user( 0, $username );
Note: See TracChangeset for help on using the changeset viewer.