More informative error message when remote publishing is disabled. Don't disable if upgrading. Props josephscott. see #7157
git-svn-id: http://svn.automattic.com/wordpress/trunk@8202 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
1fa06da55c
commit
3f90dc2f58
|
@ -254,8 +254,8 @@ function populate_options() {
|
|||
|
||||
// 2.6
|
||||
add_option('avatar_default', 'mystery');
|
||||
add_option('enable_app',0);
|
||||
add_option('enable_xmlrpc',0);
|
||||
add_option('enable_app', 0);
|
||||
add_option('enable_xmlrpc', 0);
|
||||
|
||||
// Delete unused options
|
||||
$unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog', '_wpnonce', '_wp_http_referer', 'Update', 'action', 'rich_editing', 'autosave_interval', 'deactivated_plugins');
|
||||
|
|
|
@ -6,7 +6,7 @@ require_once(ABSPATH . 'wp-admin/includes/admin.php');
|
|||
require_once(ABSPATH . 'wp-admin/includes/schema.php');
|
||||
|
||||
if ( !function_exists('wp_install') ) :
|
||||
function wp_install($blog_title, $user_name, $user_email, $public, $remote) {
|
||||
function wp_install($blog_title, $user_name, $user_email, $public, $deprecated='') {
|
||||
global $wp_rewrite;
|
||||
|
||||
wp_check_mysql_version();
|
||||
|
@ -18,8 +18,6 @@ function wp_install($blog_title, $user_name, $user_email, $public, $remote) {
|
|||
update_option('blogname', $blog_title);
|
||||
update_option('admin_email', $user_email);
|
||||
update_option('blog_public', $public);
|
||||
update_option('enable_app',$remote);
|
||||
update_option('enable_xmlrpc',$remote);
|
||||
|
||||
$guessurl = wp_guess_url();
|
||||
|
||||
|
@ -206,7 +204,7 @@ function upgrade_all() {
|
|||
if ( $wp_current_db_version < 7935 )
|
||||
upgrade_252();
|
||||
|
||||
if ( $wp_current_db_version < 8000 )
|
||||
if ( $wp_current_db_version < 8201 )
|
||||
upgrade_260();
|
||||
|
||||
maybe_disable_automattic_widgets();
|
||||
|
@ -744,7 +742,13 @@ function upgrade_252() {
|
|||
}
|
||||
|
||||
function upgrade_260() {
|
||||
populate_roles_260();
|
||||
if ( $wp_current_db_version < 8000 )
|
||||
populate_roles_260();
|
||||
|
||||
if ( $wp_current_db_version < 8201 ) {
|
||||
update_option('enable_app', 1);
|
||||
update_option('enable_xmlrpc', 1);
|
||||
}
|
||||
}
|
||||
|
||||
// The functions we use to actually do stuff
|
||||
|
|
|
@ -53,10 +53,6 @@ switch($step) {
|
|||
<tr>
|
||||
<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>
|
||||
</tr>
|
||||
<tr>
|
||||
<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>
|
||||
</tr>
|
||||
</table>
|
||||
</table>
|
||||
<input type="submit" name="Submit" value="<?php _e('Install WordPress'); ?>" class="button" />
|
||||
</form>
|
||||
|
@ -72,7 +68,6 @@ switch($step) {
|
|||
$weblog_title = stripslashes($_POST['weblog_title']);
|
||||
$admin_email = stripslashes($_POST['admin_email']);
|
||||
$public = (int) $_POST['blog_public'];
|
||||
$remote = (int) $_POST['enable_remotepublishing'];
|
||||
// check e-mail address
|
||||
if (empty($admin_email)) {
|
||||
// TODO: poka-yoke
|
||||
|
@ -83,7 +78,7 @@ switch($step) {
|
|||
}
|
||||
|
||||
$wpdb->show_errors();
|
||||
$result = wp_install($weblog_title, 'admin', $admin_email, $public, $remote);
|
||||
$result = wp_install($weblog_title, 'admin', $admin_email, $public);
|
||||
extract($result, EXTR_SKIP);
|
||||
?>
|
||||
|
||||
|
|
|
@ -195,6 +195,10 @@ class AtomServer {
|
|||
$this->redirect($this->get_service_url());
|
||||
}
|
||||
|
||||
// check to see if AtomPub is enabled
|
||||
if( !get_option( 'enable_app' ) )
|
||||
$this->not_allowed( 'AtomPub services are disabled on this blog. An admin user can enable them at ' . admin_url('options-writing.php') );
|
||||
|
||||
// dispatch
|
||||
foreach($this->selectors as $regex => $funcs) {
|
||||
if(preg_match($regex, $path, $matches)) {
|
||||
|
@ -1187,4 +1191,4 @@ EOD;
|
|||
$server = new AtomServer();
|
||||
$server->handle_request();
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -15,6 +15,6 @@ $wp_version = '2.6-beta1';
|
|||
*
|
||||
* @global int $wp_db_version
|
||||
*/
|
||||
$wp_db_version = 8134;
|
||||
$wp_db_version = 8201;
|
||||
|
||||
?>
|
||||
|
|
35
xmlrpc.php
35
xmlrpc.php
|
@ -39,14 +39,11 @@ header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
|
|||
<engineLink>http://wordpress.org/</engineLink>
|
||||
<homePageLink><?php bloginfo_rss('url') ?></homePageLink>
|
||||
<apis>
|
||||
<?php if ( get_option('enable_xmlrpc') ) :?>
|
||||
<api name="WordPress" blogID="1" preferred="true" apiLink="<?php bloginfo_rss('wpurl') ?>/xmlrpc.php" />
|
||||
<api name="Movable Type" blogID="1" preferred="false" apiLink="<?php bloginfo_rss('wpurl') ?>/xmlrpc.php" />
|
||||
<api name="MetaWeblog" blogID="1" preferred="false" apiLink="<?php bloginfo_rss('wpurl') ?>/xmlrpc.php" />
|
||||
<api name="Blogger" blogID="1" preferred="false" apiLink="<?php bloginfo_rss('wpurl') ?>/xmlrpc.php" />
|
||||
<?php endif; if ( get_option('enable_app') ) :?>
|
||||
<api name="Atom" blogID="" preferred="false" apiLink="<?php echo apply_filters('atom_service_url', (get_bloginfo('url')."/wp-app.php/service"))?>" />
|
||||
<?php endif; ?>
|
||||
</apis>
|
||||
</service>
|
||||
</rsd>
|
||||
|
@ -111,7 +108,7 @@ if ( isset($HTTP_RAW_POST_DATA) )
|
|||
class wp_xmlrpc_server extends IXR_Server {
|
||||
|
||||
function wp_xmlrpc_server() {
|
||||
$xmlrpc_methods = array(
|
||||
$this->methods = array(
|
||||
// WordPress API
|
||||
'wp.getUsersBlogs' => 'this:wp_getUsersBlogs',
|
||||
'wp.getPage' => 'this:wp_getPage',
|
||||
|
@ -167,10 +164,8 @@ class wp_xmlrpc_server extends IXR_Server {
|
|||
'mt.supportedMethods' => 'this:mt_supportedMethods',
|
||||
'mt.supportedTextFilters' => 'this:mt_supportedTextFilters',
|
||||
'mt.getTrackbackPings' => 'this:mt_getTrackbackPings',
|
||||
'mt.publishPost' => 'this:mt_publishPost'
|
||||
);
|
||||
|
||||
$xmlrpc_functions = array (
|
||||
'mt.publishPost' => 'this:mt_publishPost',
|
||||
|
||||
// PingBack
|
||||
'pingback.ping' => 'this:pingback_ping',
|
||||
'pingback.extensions.getPingbacks' => 'this:pingback_extensions_getPingbacks',
|
||||
|
@ -179,13 +174,6 @@ class wp_xmlrpc_server extends IXR_Server {
|
|||
'demo.addTwoNumbers' => 'this:addTwoNumbers'
|
||||
);
|
||||
|
||||
if ( get_option('enable_xmlrpc') )
|
||||
{
|
||||
$this->methods = array_merge($xmlrpc_methods,$xmlrpc_functions);
|
||||
} else {
|
||||
$this->methods = $xmlrpc_functions;
|
||||
}
|
||||
|
||||
$this->initialise_blog_option_info( );
|
||||
$this->methods = apply_filters('xmlrpc_methods', $this->methods);
|
||||
$this->IXR_Server($this->methods);
|
||||
|
@ -202,6 +190,11 @@ class wp_xmlrpc_server extends IXR_Server {
|
|||
}
|
||||
|
||||
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 blog. An admin user can enable them at %s'), admin_url('options-writing.php') ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!user_pass_ok($user_login, $user_pass)) {
|
||||
$this->error = new IXR_Error(403, __('Bad login/pass combination.'));
|
||||
return false;
|
||||
|
@ -845,7 +838,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
|||
$post_id = (int) $args[3];
|
||||
|
||||
if( !$this->login_pass_ok( $username, $password ) ) {
|
||||
return new IXR_Error( 403, __( 'Bad login/pass combination.' ) );
|
||||
return $this->error;
|
||||
}
|
||||
|
||||
set_current_user( 0, $username );
|
||||
|
@ -873,7 +866,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
|||
$password = $args[2];
|
||||
|
||||
if( !$this->login_pass_ok( $username, $password ) ) {
|
||||
return new IXR_Error( 403, __( 'Bad login/pass combination.' ) );
|
||||
return $this->error;
|
||||
}
|
||||
|
||||
set_current_user( 0, $username );
|
||||
|
@ -895,7 +888,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
|||
$password = $args[2];
|
||||
|
||||
if( !$this->login_pass_ok( $username, $password ) ) {
|
||||
return new IXR_Error( 403, __( 'Bad login/pass combination.' ) );
|
||||
return $this->error;
|
||||
}
|
||||
|
||||
set_current_user( 0, $username );
|
||||
|
@ -916,7 +909,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
|||
$password = $args[2];
|
||||
|
||||
if( !$this->login_pass_ok( $username, $password ) ) {
|
||||
return new IXR_Error( 403, __( 'Bad login/pass combination.' ) );
|
||||
return $this->error;
|
||||
}
|
||||
|
||||
set_current_user( 0, $username );
|
||||
|
@ -939,7 +932,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
|||
$options = (array) $args[3];
|
||||
|
||||
if( !$this->login_pass_ok( $username, $password ) )
|
||||
return new IXR_Error( 403, __( 'Bad login/pass combination.' ) );
|
||||
return $this->error;
|
||||
|
||||
$user = set_current_user( 0, $username );
|
||||
|
||||
|
@ -978,7 +971,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
|||
$options = (array) $args[3];
|
||||
|
||||
if( !$this->login_pass_ok( $username, $password ) )
|
||||
return new IXR_Error( 403, __( 'Bad login/pass combination.' ) );
|
||||
return $this->error;
|
||||
|
||||
$user = set_current_user( 0, $username );
|
||||
if( !current_user_can( 'manage_options' ) )
|
||||
|
|
Loading…
Reference in New Issue