Changeset 28412
- Timestamp:
- 05/15/2014 03:24:40 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-xmlrpc-server.php
r28083 r28412 4210 4210 * @return bool true when done. 4211 4211 */ 4212 function blogger_editPost( $args) {4212 function blogger_editPost( $args ) { 4213 4213 4214 4214 $this->escape($args); … … 4220 4220 $publish = $args[5]; 4221 4221 4222 if ( !$user = $this->login($username, $password) ) 4223 return $this->error; 4222 if ( ! $user = $this->login( $username, $password ) ) { 4223 return $this->error; 4224 } 4224 4225 4225 4226 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 4226 4227 do_action( 'xmlrpc_call', 'blogger.editPost' ); 4227 4228 4228 $actual_post = get_post($post_ID,ARRAY_A); 4229 4230 if ( !$actual_post || $actual_post['post_type'] != 'post' ) 4231 return new IXR_Error(404, __('Sorry, no such post.')); 4229 $actual_post = get_post( $post_ID, ARRAY_A ); 4230 4231 if ( ! $actual_post || $actual_post['post_type'] != 'post' ) { 4232 return new IXR_Error( 404, __( 'Sorry, no such post.' ) ); 4233 } 4232 4234 4233 4235 $this->escape($actual_post); 4234 4236 4235 if ( ! current_user_can('edit_post', $post_ID) )4237 if ( ! current_user_can( 'edit_post', $post_ID ) ) { 4236 4238 return new IXR_Error(401, __('Sorry, you do not have the right to edit this post.')); 4237 4238 extract($actual_post, EXTR_SKIP); 4239 4240 if ( ('publish' == $post_status) && !current_user_can('publish_posts') ) 4241 return new IXR_Error(401, __('Sorry, you do not have the right to publish this post.')); 4242 4243 $post_title = xmlrpc_getposttitle($content); 4244 $post_category = xmlrpc_getpostcategory($content); 4245 $post_content = xmlrpc_removepostdata($content); 4246 4247 $postdata = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt'); 4248 4249 $result = wp_update_post($postdata); 4250 4251 if ( !$result ) 4239 } 4240 if ( 'publish' == $actual_post['post_status'] && ! current_user_can( 'publish_posts' ) ) { 4241 return new IXR_Error( 401, __( 'Sorry, you do not have the right to publish this post.' ) ); 4242 } 4243 4244 $postdata = array(); 4245 $postdata['ID'] = $actual_post['ID']; 4246 $postdata['post_content'] = xmlrpc_removepostdata( $content ); 4247 $postdata['post_title'] = xmlrpc_getposttitle( $content ); 4248 $postdata['post_category'] = xmlrpc_getpostcategory( $content ); 4249 $postdata['post_status'] = $actual_post['post_status']; 4250 $postdata['post_excerpt'] = $actual_post['post_excerpt']; 4251 4252 $result = wp_update_post( $postdata ); 4253 4254 if ( ! $result ) { 4252 4255 return new IXR_Error(500, __('For some strange yet very annoying reason, this post could not be edited.')); 4253 4254 $this->attach_uploads( $ ID, $post_content);4256 } 4257 $this->attach_uploads( $actual_post['ID'], $postdata['post_content'] ); 4255 4258 4256 4259 /**
Note: See TracChangeset
for help on using the changeset viewer.