Changeset 22914
- Timestamp:
- 11/29/2012 02:35:39 AM (13 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/class-wp-xmlrpc-server.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/class-wp-xmlrpc-server.php
r22908 r22914 91 91 'blogger.getPost' => 'this:blogger_getPost', 92 92 'blogger.getRecentPosts' => 'this:blogger_getRecentPosts', 93 'blogger.getTemplate' => 'this:blogger_getTemplate',94 'blogger.setTemplate' => 'this:blogger_setTemplate',95 93 'blogger.newPost' => 'this:blogger_newPost', 96 94 'blogger.editPost' => 'this:blogger_editPost', … … 108 106 // see http://www.xmlrpc.com/stories/storyReader$2460 109 107 'metaWeblog.deletePost' => 'this:blogger_deletePost', 110 'metaWeblog.getTemplate' => 'this:blogger_getTemplate',111 'metaWeblog.setTemplate' => 'this:blogger_setTemplate',112 108 'metaWeblog.getUsersBlogs' => 'this:blogger_getUsersBlogs', 113 109 … … 3827 3823 3828 3824 /** 3829 * Retrieve blog_filename content.3825 * Deprecated. 3830 3826 * 3831 3827 * @since 1.5.0 3832 * 3833 * @param array $args Method parameters. 3834 * @return string 3828 * @deprecated 3.5.0 3835 3829 */ 3836 3830 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. 3869 3836 * 3870 3837 * @since 1.5.0 3871 * 3872 * @param array $args Method parameters. 3873 * @return bool True when done. 3838 * @deprecated 3.5.0 3874 3839 */ 3875 3840 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.' ) ); 3905 3842 } 3906 3843
Note: See TracChangeset
for help on using the changeset viewer.