WordPress.org

Make WordPress Core

Changeset 22914


Ignore:
Timestamp:
11/29/2012 02:35:39 AM (9 years ago)
Author:
nacin
Message:

Remove XML-RPC's blogger::getTemplate and setTemplate. They are not supported and do nothing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/class-wp-xmlrpc-server.php

    r22908 r22914  
    9191            'blogger.getPost' => 'this:blogger_getPost',
    9292            'blogger.getRecentPosts' => 'this:blogger_getRecentPosts',
    93             'blogger.getTemplate' => 'this:blogger_getTemplate',
    94             'blogger.setTemplate' => 'this:blogger_setTemplate',
    9593            'blogger.newPost' => 'this:blogger_newPost',
    9694            'blogger.editPost' => 'this:blogger_editPost',
     
    108106            // see http://www.xmlrpc.com/stories/storyReader$2460
    109107            'metaWeblog.deletePost' => 'this:blogger_deletePost',
    110             'metaWeblog.getTemplate' => 'this:blogger_getTemplate',
    111             'metaWeblog.setTemplate' => 'this:blogger_setTemplate',
    112108            'metaWeblog.getUsersBlogs' => 'this:blogger_getUsersBlogs',
    113109
     
    38273823
    38283824    /**
    3829      * Retrieve blog_filename content.
     3825     * Deprecated.
    38303826     *
    38313827     * @since 1.5.0
    3832      *
    3833      * @param array $args Method parameters.
    3834      * @return string
     3828     * @deprecated 3.5.0
    38353829     */
    38363830    function blogger_getTemplate($args) {
    3837 
    3838         $this->escape($args);
    3839 
    3840         $blog_ID    = (int) $args[1];
    3841         $username = $args[2];
    3842         $password  = $args[3];
    3843         $template   = $args[4]; /* could be 'main' or 'archiveIndex', but we don't use it */
    3844 
    3845         if ( !$user = $this->login($username, $password) )
    3846             return $this->error;
    3847 
    3848         do_action('xmlrpc_call', 'blogger.getTemplate');
    3849 
    3850         if ( !current_user_can('edit_themes') )
    3851             return new IXR_Error(401, __('Sorry, this user cannot edit the template.'));
    3852 
    3853         /* warning: here we make the assumption that the blog's URL is on the same server */
    3854         $filename = get_option('home') . '/';
    3855         $filename = preg_replace('#https?://.+?/#', $_SERVER['DOCUMENT_ROOT'].'/', $filename);
    3856 
    3857         $f = fopen($filename, 'r');
    3858         $content = fread($f, filesize($filename));
    3859         fclose($f);
    3860 
    3861         /* so it is actually editable with a windows/mac client */
    3862         // 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);
    3863 
    3864         return $content;
    3865     }
    3866 
    3867     /**
    3868      * Updates the content of blog_filename.
     3831        return new IXR_Error( 403, __('Sorry, that file cannot be edited.' ) );
     3832    }
     3833
     3834    /**
     3835     * Deprecated.
    38693836     *
    38703837     * @since 1.5.0
    3871      *
    3872      * @param array $args Method parameters.
    3873      * @return bool True when done.
     3838     * @deprecated 3.5.0
    38743839     */
    38753840    function blogger_setTemplate($args) {
    3876 
    3877         $this->escape($args);
    3878 
    3879         $blog_ID    = (int) $args[1];
    3880         $username = $args[2];
    3881         $password  = $args[3];
    3882         $content    = $args[4];
    3883         $template   = $args[5]; /* could be 'main' or 'archiveIndex', but we don't use it */
    3884 
    3885         if ( !$user = $this->login($username, $password) )
    3886             return $this->error;
    3887 
    3888         do_action('xmlrpc_call', 'blogger.setTemplate');
    3889 
    3890         if ( !current_user_can('edit_themes') )
    3891             return new IXR_Error(401, __('Sorry, this user cannot edit the template.'));
    3892 
    3893         /* warning: here we make the assumption that the blog's URL is on the same server */
    3894         $filename = get_option('home') . '/';
    3895         $filename = preg_replace('#https?://.+?/#', $_SERVER['DOCUMENT_ROOT'].'/', $filename);
    3896 
    3897         if ($f = fopen($filename, 'w+')) {
    3898             fwrite($f, $content);
    3899             fclose($f);
    3900         } else {
    3901             return new IXR_Error(500, __('Either the file is not writable, or something wrong happened. The file has not been updated.'));
    3902         }
    3903 
    3904         return true;
     3841        return new IXR_Error( 403, __('Sorry, that file cannot be edited.' ) );
    39053842    }
    39063843
Note: See TracChangeset for help on using the changeset viewer.