Turn XML-RPC on and remove the option on the Writing Settings page.

props markoheijnen for the initial patch.

Introduces a new filter, xmlrpc_enabled.

Respects any current callbacks registered to the pre_option_enable_xmlrpc
and option_enable_xmlrpc filters, for anyone forcing it off via code.

fixes #21509.



git-svn-id: http://core.svn.wordpress.org/trunk@21804 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2012-09-11 00:37:31 +00:00
parent e3cb5634b4
commit 26dc1e74e5
6 changed files with 24 additions and 17 deletions

View File

@ -445,7 +445,6 @@ function populate_options() {
// 2.6
'avatar_default' => 'mystery',
'enable_app' => 0,
'enable_xmlrpc' => 0,
// 2.7
'large_size_w' => 1024,
@ -543,7 +542,7 @@ function populate_options() {
'_wp_http_referer', 'Update', 'action', 'rich_editing', 'autosave_interval', 'deactivated_plugins',
'can_compress_scripts', 'page_uris', 'update_core', 'update_plugins', 'update_themes', 'doing_cron',
'random_seed', 'rss_excerpt_length', 'secret', 'use_linksupdate', 'default_comment_status_page',
'wporg_popular_tags', 'what_to_show', 'rss_language', 'language',
'wporg_popular_tags', 'what_to_show', 'rss_language', 'language', 'enable_xmlrpc',
);
foreach ( $unusedoptions as $option )
delete_option($option);

View File

@ -997,7 +997,6 @@ function upgrade_260() {
if ( $wp_current_db_version < 8201 ) {
update_option('enable_app', 1);
update_option('enable_xmlrpc', 1);
}
}

View File

@ -179,14 +179,6 @@ wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'default_email_categor
<?php _e('Enable the Atom Publishing Protocol.') ?></label><br />
</fieldset></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('XML-RPC') ?></th>
<td><fieldset><legend class="screen-reader-text"><span><?php _e('XML-RPC') ?></span></legend>
<label for="enable_xmlrpc">
<input name="enable_xmlrpc" type="checkbox" id="enable_xmlrpc" value="1" <?php checked('1', get_option('enable_xmlrpc')); ?> />
<?php _e('Enable the WordPress, Movable Type, MetaWeblog and Blogger XML-RPC publishing protocols.') ?></label><br />
</fieldset></td>
</tr>
<?php do_settings_fields('writing', 'remote_publishing'); ?>
</table>

View File

@ -64,7 +64,7 @@ $whitelist_options = array(
'media' => array( 'thumbnail_size_w', 'thumbnail_size_h', 'thumbnail_crop', 'medium_size_w', 'medium_size_h', 'large_size_w', 'large_size_h', 'image_default_size', 'image_default_align', 'image_default_link_type', 'embed_autourls', 'embed_size_w', 'embed_size_h' ),
'privacy' => array( 'blog_public' ),
'reading' => array( 'posts_per_page', 'posts_per_rss', 'rss_use_excerpt', 'blog_charset', 'show_on_front', 'page_on_front', 'page_for_posts' ),
'writing' => array( 'default_post_edit_rows', 'use_smilies', 'default_category', 'default_email_category', 'use_balanceTags', 'default_link_category', 'default_post_format', 'enable_app', 'enable_xmlrpc' ),
'writing' => array( 'default_post_edit_rows', 'use_smilies', 'default_category', 'default_email_category', 'use_balanceTags', 'default_link_category', 'default_post_format', 'enable_app' ),
'options' => array( '' ) );
$mail_options = array('mailserver_url', 'mailserver_port', 'mailserver_login', 'mailserver_pass');

View File

@ -169,8 +169,17 @@ class wp_xmlrpc_server extends IXR_Server {
* @see wp_xmlrpc_server::login
*/
function login_pass_ok($user_login, $user_pass) {
if ( !get_option( 'enable_xmlrpc' ) ) {
$this->error = new IXR_Error( 405, sprintf( __( 'XML-RPC services are disabled on this site. An admin user can enable them at %s'), admin_url('options-writing.php') ) );
// Respect any old filters against get_option() for 'enable_xmlrpc'.
$enabled = apply_filters( 'pre_option_enable_xmlrpc', false ); // Deprecated
if ( false === $enabled )
$enabled = apply_filters( 'option_enable_xmlrpc', true ); // Deprecated
// Proper filter for turning off XML-RPC. It is on by default.
$enabled = apply_filters( 'xmlrpc_enabled', $enabled );
if ( ! $enabled ) {
$this->error = new IXR_Error( 405, sprintf( __( 'XML-RPC services are disabled on this site.' ) ) );
return false;
}
@ -191,8 +200,16 @@ class wp_xmlrpc_server extends IXR_Server {
* @return mixed WP_User object if authentication passed, false otherwise
*/
function login($username, $password) {
if ( !get_option( 'enable_xmlrpc' ) ) {
$this->error = new IXR_Error( 405, sprintf( __( 'XML-RPC services are disabled on this site. An admin user can enable them at %s'), admin_url('options-writing.php') ) );
// Respect any old filters against get_option() for 'enable_xmlrpc'.
$enabled = apply_filters( 'pre_option_enable_xmlrpc', false ); // Deprecated
if ( false === $enabled )
$enabled = apply_filters( 'option_enable_xmlrpc', true ); // Deprecated
// Proper filter for turning off XML-RPC. It is on by default.
$enabled = apply_filters( 'xmlrpc_enabled', $enabled );
if ( ! $enabled ) {
$this->error = new IXR_Error( 405, sprintf( __( 'XML-RPC services are disabled on this site.' ) ) );
return false;
}

View File

@ -11,7 +11,7 @@ $wp_version = '3.5-alpha-21751';
*
* @global int $wp_db_version
*/
$wp_db_version = 21707;
$wp_db_version = 21804;
/**
* Holds the TinyMCE version