Ticket #20336: 20336.diff
File 20336.diff, 3.1 KB (added by , 12 years ago) |
---|
-
wp-includes/class-wp-xmlrpc-server.php
1760 1760 return $this->error; 1761 1761 } 1762 1762 1763 $page = get_page($page_id); 1764 if ( ! $page ) 1765 return new IXR_Error( 404, __( 'Invalid post ID.' ) ); 1766 1763 1767 if ( !current_user_can( 'edit_page', $page_id ) ) 1764 1768 return new IXR_Error( 401, __( 'Sorry, you cannot edit this page.' ) ); 1765 1769 1766 1770 do_action('xmlrpc_call', 'wp.getPage'); 1767 1771 1768 // Lookup page info.1769 $page = get_page($page_id);1770 1771 1772 // If we found the page then format the data. 1772 1773 if ( $page->ID && ($page->post_type == 'page') ) { 1773 1774 // Get all of the page content and link. … … 3208 3209 if ( !$user = $this->login($username, $password) ) 3209 3210 return $this->error; 3210 3211 3212 $post_data = wp_get_single_post($post_ID, ARRAY_A); 3213 if ( ! $post_data ) 3214 return new IXR_Error( 404, __( 'Invalid post ID.' ) ); 3215 3211 3216 if ( !current_user_can( 'edit_post', $post_ID ) ) 3212 3217 return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) ); 3213 3218 3214 3219 do_action('xmlrpc_call', 'blogger.getPost'); 3215 3220 3216 $post_data = wp_get_single_post($post_ID, ARRAY_A);3217 3218 3221 $categories = implode(',', wp_get_post_categories($post_ID)); 3219 3222 3220 3223 $content = '<title>'.stripslashes($post_data['post_title']).'</title>'; … … 4158 4161 if ( !$user = $this->login($username, $password) ) 4159 4162 return $this->error; 4160 4163 4164 $postdata = wp_get_single_post($post_ID, ARRAY_A); 4165 if ( ! $postdata ) 4166 return new IXR_Error( 404, __( 'Invalid post ID.' ) ); 4167 4161 4168 if ( !current_user_can( 'edit_post', $post_ID ) ) 4162 4169 return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) ); 4163 4170 4164 4171 do_action('xmlrpc_call', 'metaWeblog.getPost'); 4165 4172 4166 $postdata = wp_get_single_post($post_ID, ARRAY_A);4167 4168 4173 if ($postdata['post_date'] != '') { 4169 4174 $post_date = $this->_convert_date( $postdata['post_date'] ); 4170 4175 $post_date_gmt = $this->_convert_date_gmt( $postdata['post_date_gmt'], $postdata['post_date'] ); … … 4626 4631 if ( !$user = $this->login($username, $password) ) 4627 4632 return $this->error; 4628 4633 4634 if ( ! get_post( $post_ID ) ) 4635 return new IXR_Error( 404, __( 'Invalid post ID.' ) ); 4636 4629 4637 if ( !current_user_can( 'edit_post', $post_ID ) ) 4630 4638 return new IXR_Error( 401, __( 'Sorry, you can not edit this post.' ) ); 4631 4639 … … 4669 4677 4670 4678 do_action('xmlrpc_call', 'mt.setPostCategories'); 4671 4679 4680 if ( ! get_post( $post_ID ) ) 4681 return new IXR_Error( 404, __( 'Invalid post ID.' ) ); 4682 4672 4683 if ( !current_user_can('edit_post', $post_ID) ) 4673 4684 return new IXR_Error(401, __('Sorry, you cannot edit this post.')); 4674 4685 … … 4776 4787 4777 4788 do_action('xmlrpc_call', 'mt.publishPost'); 4778 4789 4790 $postdata = wp_get_single_post($post_ID,ARRAY_A); 4791 if ( ! $postdata ) 4792 return new IXR_Error( 404, __( 'Invalid post ID.' ) ); 4793 4779 4794 if ( !current_user_can('publish_posts') || !current_user_can('edit_post', $post_ID) ) 4780 4795 return new IXR_Error(401, __('Sorry, you cannot publish this post.')); 4781 4796 4782 $postdata = wp_get_single_post($post_ID,ARRAY_A);4783 4784 4797 $postdata['post_status'] = 'publish'; 4785 4798 4786 4799 // retain old cats