Changeset 8202

Show
Ignore:
Timestamp:
06/26/08 22:39:57 (4 months ago)
Author:
ryan
Message:

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

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-admin/includes/schema.php

    r8182 r8202  
    255255    // 2.6 
    256256    add_option('avatar_default', 'mystery'); 
    257     add_option('enable_app',0); 
    258     add_option('enable_xmlrpc',0); 
     257    add_option('enable_app', 0); 
     258    add_option('enable_xmlrpc', 0); 
    259259     
    260260    // Delete unused options 
  • trunk/wp-admin/includes/upgrade.php

    r8187 r8202  
    77 
    88if ( !function_exists('wp_install') ) : 
    9 function wp_install($blog_title, $user_name, $user_email, $public, $remote) { 
     9function wp_install($blog_title, $user_name, $user_email, $public, $deprecated='') { 
    1010    global $wp_rewrite; 
    1111 
     
    1919    update_option('admin_email', $user_email); 
    2020    update_option('blog_public', $public); 
    21     update_option('enable_app',$remote); 
    22     update_option('enable_xmlrpc',$remote); 
    2321 
    2422    $guessurl = wp_guess_url(); 
     
    207205        upgrade_252(); 
    208206 
    209     if ( $wp_current_db_version < 8000
     207    if ( $wp_current_db_version < 8201
    210208        upgrade_260(); 
    211209 
     
    745743 
    746744function upgrade_260() { 
    747     populate_roles_260(); 
     745    if ( $wp_current_db_version < 8000 ) 
     746        populate_roles_260(); 
     747 
     748    if ( $wp_current_db_version < 8201 ) { 
     749        update_option('enable_app', 1); 
     750        update_option('enable_xmlrpc', 1); 
     751    } 
    748752} 
    749753 
  • trunk/wp-admin/install.php

    r8139 r8202  
    5454            <td colspan="2"><label><input type="checkbox" name="blog_public" value="1" checked="checked" /> <?php _e('Allow my blog to appear in search engines like Google and Technorati.'); ?></label></td> 
    5555        </tr> 
    56         <tr> 
    57             <td colspan="2"><label><input type="checkbox" name="enable_remotepublishing" value="0" /> <?php _e('Enable remote publishing using the WordPress, Movable Type, MetaWeblog, Blogger and Atom publishing protocols for my blog.'); ?></label></td> 
    58         </tr> 
    59     </table> 
    6056    </table> 
    6157    <input type="submit" name="Submit" value="<?php _e('Install WordPress'); ?>" class="button" /> 
     
    7369        $admin_email = stripslashes($_POST['admin_email']); 
    7470        $public = (int) $_POST['blog_public']; 
    75         $remote = (int) $_POST['enable_remotepublishing']; 
    7671        // check e-mail address 
    7772        if (empty($admin_email)) { 
     
    8479 
    8580        $wpdb->show_errors(); 
    86         $result = wp_install($weblog_title, 'admin', $admin_email, $public, $remote); 
     81        $result = wp_install($weblog_title, 'admin', $admin_email, $public); 
    8782        extract($result, EXTR_SKIP); 
    8883?> 
  • trunk/wp-app.php

    r8031 r8202  
    195195            $this->redirect($this->get_service_url()); 
    196196        } 
     197 
     198        // check to see if AtomPub is enabled 
     199        if( !get_option( 'enable_app' ) ) 
     200            $this->not_allowed( 'AtomPub services are disabled on this blog.  An admin user can enable them at ' . admin_url('options-writing.php') ); 
    197201 
    198202        // dispatch 
  • trunk/wp-includes/version.php

    r8184 r8202  
    1616 * @global int $wp_db_version 
    1717 */ 
    18 $wp_db_version = 8134
     18$wp_db_version = 8201
    1919 
    2020?> 
  • 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 );