From fbf4acf638f0c23b35b9efb522b62247be8a411e Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Thu, 29 Nov 2012 02:35:39 +0000 Subject: [PATCH] Remove XML-RPC's blogger::getTemplate and setTemplate. They are not supported and do nothing. git-svn-id: http://core.svn.wordpress.org/trunk@22914 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-xmlrpc-server.php | 75 +++----------------------- 1 file changed, 6 insertions(+), 69 deletions(-) diff --git a/wp-includes/class-wp-xmlrpc-server.php b/wp-includes/class-wp-xmlrpc-server.php index 0798fcbf90..ac758e4c1b 100644 --- a/wp-includes/class-wp-xmlrpc-server.php +++ b/wp-includes/class-wp-xmlrpc-server.php @@ -90,8 +90,6 @@ class wp_xmlrpc_server extends IXR_Server { 'blogger.getUserInfo' => 'this:blogger_getUserInfo', 'blogger.getPost' => 'this:blogger_getPost', 'blogger.getRecentPosts' => 'this:blogger_getRecentPosts', - 'blogger.getTemplate' => 'this:blogger_getTemplate', - 'blogger.setTemplate' => 'this:blogger_setTemplate', 'blogger.newPost' => 'this:blogger_newPost', 'blogger.editPost' => 'this:blogger_editPost', 'blogger.deletePost' => 'this:blogger_deletePost', @@ -107,8 +105,6 @@ class wp_xmlrpc_server extends IXR_Server { // MetaWeblog API aliases for Blogger API // see http://www.xmlrpc.com/stories/storyReader$2460 'metaWeblog.deletePost' => 'this:blogger_deletePost', - 'metaWeblog.getTemplate' => 'this:blogger_getTemplate', - 'metaWeblog.setTemplate' => 'this:blogger_setTemplate', 'metaWeblog.getUsersBlogs' => 'this:blogger_getUsersBlogs', // MovableType API @@ -3826,82 +3822,23 @@ class wp_xmlrpc_server extends IXR_Server { } /** - * Retrieve blog_filename content. + * Deprecated. * * @since 1.5.0 - * - * @param array $args Method parameters. - * @return string + * @deprecated 3.5.0 */ function blogger_getTemplate($args) { - - $this->escape($args); - - $blog_ID = (int) $args[1]; - $username = $args[2]; - $password = $args[3]; - $template = $args[4]; /* could be 'main' or 'archiveIndex', but we don't use it */ - - if ( !$user = $this->login($username, $password) ) - return $this->error; - - do_action('xmlrpc_call', 'blogger.getTemplate'); - - if ( !current_user_can('edit_themes') ) - return new IXR_Error(401, __('Sorry, this user cannot edit the template.')); - - /* warning: here we make the assumption that the blog's URL is on the same server */ - $filename = get_option('home') . '/'; - $filename = preg_replace('#https?://.+?/#', $_SERVER['DOCUMENT_ROOT'].'/', $filename); - - $f = fopen($filename, 'r'); - $content = fread($f, filesize($filename)); - fclose($f); - - /* so it is actually editable with a windows/mac client */ - // FIXME: (or delete me) do we really want to cater to bad clients at the expense of good ones by BEEPing up their line breaks? commented. $content = str_replace("\n", "\r\n", $content); - - return $content; + return new IXR_Error( 403, __('Sorry, that file cannot be edited.' ) ); } /** - * Updates the content of blog_filename. + * Deprecated. * * @since 1.5.0 - * - * @param array $args Method parameters. - * @return bool True when done. + * @deprecated 3.5.0 */ function blogger_setTemplate($args) { - - $this->escape($args); - - $blog_ID = (int) $args[1]; - $username = $args[2]; - $password = $args[3]; - $content = $args[4]; - $template = $args[5]; /* could be 'main' or 'archiveIndex', but we don't use it */ - - if ( !$user = $this->login($username, $password) ) - return $this->error; - - do_action('xmlrpc_call', 'blogger.setTemplate'); - - if ( !current_user_can('edit_themes') ) - return new IXR_Error(401, __('Sorry, this user cannot edit the template.')); - - /* warning: here we make the assumption that the blog's URL is on the same server */ - $filename = get_option('home') . '/'; - $filename = preg_replace('#https?://.+?/#', $_SERVER['DOCUMENT_ROOT'].'/', $filename); - - if ($f = fopen($filename, 'w+')) { - fwrite($f, $content); - fclose($f); - } else { - return new IXR_Error(500, __('Either the file is not writable, or something wrong happened. The file has not been updated.')); - } - - return true; + return new IXR_Error( 403, __('Sorry, that file cannot be edited.' ) ); } /**