Ticket #34521: class-wp-xmlrpc-server.php.2.patch
File class-wp-xmlrpc-server.php.2.patch, 25.1 KB (added by , 8 years ago) |
---|
-
wp-includes/class-wp-xmlrpc-server.php
1233 1233 if ( 'private' === $post_data['post_status'] || ! empty( $post_data['post_password'] ) ) { 1234 1234 // Error if the client tried to stick the post, otherwise, silently unstick. 1235 1235 if ( ! empty( $post_data['sticky'] ) ) { 1236 return new IXR_Error( 401, __( ' Sorry, you cannotstick a private post.' ) );1236 return new IXR_Error( 401, __( 'You are not allowed to stick a private post.' ) ); 1237 1237 } 1238 1238 1239 1239 if ( $update ) { … … 1241 1241 } 1242 1242 } elseif ( isset( $post_data['sticky'] ) ) { 1243 1243 if ( ! current_user_can( $post_type->cap->edit_others_posts ) ) { 1244 return new IXR_Error( 401, __( ' Sorry, you are not allowed to stick this post.' ) );1244 return new IXR_Error( 401, __( 'You are not allowed to make this post sticky.' ) ); 1245 1245 } 1246 1246 1247 1247 $sticky = wp_validate_boolean( $post_data['sticky'] ); … … 1281 1281 if ( ! get_post( $post_data['ID'] ) ) 1282 1282 return new IXR_Error( 401, __( 'Invalid post ID.' ) ); 1283 1283 if ( ! current_user_can( 'edit_post', $post_data['ID'] ) ) 1284 return new IXR_Error( 401, __( ' Sorry, you are not allowed to edit this post.' ) );1284 return new IXR_Error( 401, __( 'You are not allowed to edit this post.' ) ); 1285 1285 if ( $post_data['post_type'] != get_post_type( $post_data['ID'] ) ) 1286 1286 return new IXR_Error( 401, __( 'The post type may not be changed.' ) ); 1287 1287 } else { 1288 1288 if ( ! current_user_can( $post_type->cap->create_posts ) || ! current_user_can( $post_type->cap->edit_posts ) ) 1289 return new IXR_Error( 401, __( ' Sorry, you are not allowed to post on this site.' ) );1289 return new IXR_Error( 401, __( 'You are not allowed to post on this site.' ) ); 1290 1290 } 1291 1291 1292 1292 switch ( $post_data['post_status'] ) { … … 1295 1295 break; 1296 1296 case 'private': 1297 1297 if ( ! current_user_can( $post_type->cap->publish_posts ) ) 1298 return new IXR_Error( 401, __( ' Sorry, you are not allowed to create private posts in this post type' ) );1298 return new IXR_Error( 401, __( 'You are not allowed to create private posts in this post type' ) ); 1299 1299 break; 1300 1300 case 'publish': 1301 1301 case 'future': 1302 1302 if ( ! current_user_can( $post_type->cap->publish_posts ) ) 1303 return new IXR_Error( 401, __( ' Sorry, you are not allowed to publish posts in this post type' ) );1303 return new IXR_Error( 401, __( 'You are not allowed to publish posts in this post type' ) ); 1304 1304 break; 1305 1305 default: 1306 1306 if ( ! get_post_status_object( $post_data['post_status'] ) ) … … 1309 1309 } 1310 1310 1311 1311 if ( ! empty( $post_data['post_password'] ) && ! current_user_can( $post_type->cap->publish_posts ) ) 1312 return new IXR_Error( 401, __( ' Sorry, you are not allowed to create password protected posts in this post type' ) );1312 return new IXR_Error( 401, __( 'You are not allowed to create password protected posts in this post type' ) ); 1313 1313 1314 1314 $post_data['post_author'] = absint( $post_data['post_author'] ); 1315 1315 if ( ! empty( $post_data['post_author'] ) && $post_data['post_author'] != $user->ID ) { … … 1380 1380 // Validating term ids. 1381 1381 foreach ( $taxonomies as $taxonomy ) { 1382 1382 if ( ! array_key_exists( $taxonomy , $post_type_taxonomies ) ) 1383 return new IXR_Error( 401, __( ' Sorry, one of the given taxonomies is not supported by the post type.' ) );1383 return new IXR_Error( 401, __( 'One of the given taxonomies is not supported by the post type.' ) ); 1384 1384 1385 1385 if ( ! current_user_can( $post_type_taxonomies[$taxonomy]->cap->assign_terms ) ) 1386 return new IXR_Error( 401, __( ' Sorry, you are not allowed to assign a term to one of the given taxonomies.' ) );1386 return new IXR_Error( 401, __( 'You are not allowed to assign a term to one of the given taxonomies.' ) ); 1387 1387 1388 1388 $term_ids = $post_data['terms'][$taxonomy]; 1389 1389 $terms[ $taxonomy ] = array(); … … 1404 1404 1405 1405 foreach ( $taxonomies as $taxonomy ) { 1406 1406 if ( ! array_key_exists( $taxonomy , $post_type_taxonomies ) ) 1407 return new IXR_Error( 401, __( ' Sorry, one of the given taxonomies is not supported by the post type.' ) );1407 return new IXR_Error( 401, __( 'One of the given taxonomies is not supported by the post type.' ) ); 1408 1408 1409 1409 if ( ! current_user_can( $post_type_taxonomies[$taxonomy]->cap->assign_terms ) ) 1410 return new IXR_Error( 401, __( ' Sorry, you are not allowed to assign a term to one of the given taxonomies.' ) );1410 return new IXR_Error( 401, __( 'You are not allowed to assign a term to one of the given taxonomies.' ) ); 1411 1411 1412 1412 /* 1413 1413 * For hierarchical taxonomies, we can't assign a term when multiple terms … … 1436 1436 if ( ! $term ) { 1437 1437 // Term doesn't exist, so check that the user is allowed to create new terms. 1438 1438 if ( ! current_user_can( $post_type_taxonomies[$taxonomy]->cap->edit_terms ) ) 1439 return new IXR_Error( 401, __( ' Sorry, you are not allowed to add a term to one of the given taxonomies.' ) );1439 return new IXR_Error( 401, __( 'You are not allowed to add a term to one of the given taxonomies.' ) ); 1440 1440 1441 1441 // Create the new term. 1442 1442 $term_info = wp_insert_term( $term_name, $taxonomy ); … … 1488 1488 return new IXR_Error( 500, $post_ID->get_error_message() ); 1489 1489 1490 1490 if ( ! $post_ID ) 1491 return new IXR_Error( 401, __( ' Sorry, your entry could not be posted. Something wrong happened.' ) );1491 return new IXR_Error( 401, __( 'Your entry could not be posted. Something wrong happened.' ) ); 1492 1492 1493 1493 return strval( $post_ID ); 1494 1494 } … … 1602 1602 } 1603 1603 1604 1604 if ( ! current_user_can( 'delete_post', $post_id ) ) { 1605 return new IXR_Error( 401, __( ' Sorry, you do not have the rightto delete this post.' ) );1605 return new IXR_Error( 401, __( 'You are not allowed to delete this post.' ) ); 1606 1606 } 1607 1607 1608 1608 $result = wp_delete_post( $post_id ); … … 1699 1699 return new IXR_Error( 404, __( 'Invalid post ID.' ) ); 1700 1700 1701 1701 if ( ! current_user_can( 'edit_post', $post_id ) ) 1702 return new IXR_Error( 401, __( ' Sorry, you cannotedit this post.' ) );1702 return new IXR_Error( 401, __( 'You are not allowed to edit this post.' ) ); 1703 1703 1704 1704 return $this->_prepare_post( $post, $fields ); 1705 1705 } … … 1882 1882 return new IXR_Error( 500, $term->get_error_message() ); 1883 1883 1884 1884 if ( ! $term ) 1885 return new IXR_Error( 500, __( ' Sorry, yourterm could not be created. Something wrong happened.' ) );1885 return new IXR_Error( 500, __( 'The term could not be created. Something wrong happened.' ) ); 1886 1886 1887 1887 return strval( $term['term_id'] ); 1888 1888 } … … 1980 1980 return new IXR_Error( 500, $term->get_error_message() ); 1981 1981 1982 1982 if ( ! $term ) 1983 return new IXR_Error( 500, __( ' Sorry, editing the term failed.' ) );1983 return new IXR_Error( 500, __( 'Failed editing the term.' ) ); 1984 1984 1985 1985 return true; 1986 1986 } … … 2042 2042 return new IXR_Error( 500, $term->get_error_message() ); 2043 2043 2044 2044 if ( ! $result ) 2045 return new IXR_Error( 500, __( ' Sorry, deleting the term failed.' ) );2045 return new IXR_Error( 500, __( 'Failed deleting the term.' ) ); 2046 2046 2047 2047 return $result; 2048 2048 } … … 2380 2380 do_action( 'xmlrpc_call', 'wp.getUser' ); 2381 2381 2382 2382 if ( ! current_user_can( 'edit_user', $user_id ) ) 2383 return new IXR_Error( 401, __( ' Sorry, you cannotedit users.' ) );2383 return new IXR_Error( 401, __( 'You are not allowed to edit users.' ) ); 2384 2384 2385 2385 $user_data = get_userdata( $user_id ); 2386 2386 … … 2511 2511 do_action( 'xmlrpc_call', 'wp.getProfile' ); 2512 2512 2513 2513 if ( ! current_user_can( 'edit_user', $user->ID ) ) 2514 return new IXR_Error( 401, __( ' Sorry, you cannotedit your profile.' ) );2514 return new IXR_Error( 401, __( 'You are not allowed to edit your profile.' ) ); 2515 2515 2516 2516 $user_data = get_userdata( $user->ID ); 2517 2517 … … 2557 2557 do_action( 'xmlrpc_call', 'wp.editProfile' ); 2558 2558 2559 2559 if ( ! current_user_can( 'edit_user', $user->ID ) ) 2560 return new IXR_Error( 401, __( ' Sorry, you cannotedit your profile.' ) );2560 return new IXR_Error( 401, __( 'You are not allowed to edit your profile.' ) ); 2561 2561 2562 2562 // holds data of the user 2563 2563 $user_data = array(); … … 2591 2591 return new IXR_Error( 500, $result->get_error_message() ); 2592 2592 2593 2593 if ( ! $result ) 2594 return new IXR_Error( 500, __( ' Sorry, the user cannot be updated.' ) );2594 return new IXR_Error( 500, __( 'The user cannot be updated.' ) ); 2595 2595 2596 2596 return true; 2597 2597 } … … 2627 2627 return new IXR_Error( 404, __( 'Invalid post ID.' ) ); 2628 2628 2629 2629 if ( !current_user_can( 'edit_page', $page_id ) ) 2630 return new IXR_Error( 401, __( ' Sorry, you cannotedit this page.' ) );2630 return new IXR_Error( 401, __( 'You are not allowed to edit this page.' ) ); 2631 2631 2632 2632 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2633 2633 do_action( 'xmlrpc_call', 'wp.getPage' ); … … 2668 2668 return $this->error; 2669 2669 2670 2670 if ( !current_user_can( 'edit_pages' ) ) 2671 return new IXR_Error( 401, __( ' Sorry, you cannotedit pages.' ) );2671 return new IXR_Error( 401, __( 'You are not allowed to edit pages.' ) ); 2672 2672 2673 2673 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2674 2674 do_action( 'xmlrpc_call', 'wp.getPages' ); … … 2762 2762 2763 2763 // Make sure the user can delete pages. 2764 2764 if ( !current_user_can('delete_page', $page_id) ) 2765 return new IXR_Error( 401, __( ' Sorry, you do not have the rightto delete this page.' ) );2765 return new IXR_Error( 401, __( 'You are not allowed to delete this page.' ) ); 2766 2766 2767 2767 // Attempt to delete the page. 2768 2768 $result = wp_delete_post($page_id); … … 2824 2824 2825 2825 // Make sure the user is allowed to edit pages. 2826 2826 if ( !current_user_can('edit_page', $page_id) ) 2827 return new IXR_Error( 401, __( ' Sorry, you do not have the rightto edit this page.' ) );2827 return new IXR_Error( 401, __( 'You are not allowed to edit this page.' ) ); 2828 2828 2829 2829 // Mark this as content for a page. 2830 2830 $content['post_type'] = 'page'; … … 2870 2870 return $this->error; 2871 2871 2872 2872 if ( !current_user_can( 'edit_pages' ) ) 2873 return new IXR_Error( 401, __( ' Sorry, you cannotedit pages.' ) );2873 return new IXR_Error( 401, __( 'You are not allowed to edit pages.' ) ); 2874 2874 2875 2875 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2876 2876 do_action( 'xmlrpc_call', 'wp.getPageList' ); … … 2926 2926 return $this->error; 2927 2927 2928 2928 if ( !current_user_can('edit_posts') ) 2929 return new IXR_Error( 401, __( ' Sorry, you cannotedit posts on this site.' ) );2929 return new IXR_Error( 401, __( 'You are not allowed to edit posts on this site.' ) ); 2930 2930 2931 2931 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2932 2932 do_action( 'xmlrpc_call', 'wp.getAuthors' ); … … 2967 2967 return $this->error; 2968 2968 2969 2969 if ( !current_user_can( 'edit_posts' ) ) 2970 return new IXR_Error( 401, __( ' Sorry, you must be able to edit posts on this site in order to view tags.' ) );2970 return new IXR_Error( 401, __( 'You must be able to edit posts on this site in order to view tags.' ) ); 2971 2971 2972 2972 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 2973 2973 do_action( 'xmlrpc_call', 'wp.getKeywords' ); … … 3021 3021 3022 3022 // Make sure the user is allowed to add a category. 3023 3023 if ( !current_user_can('manage_categories') ) 3024 return new IXR_Error(401, __(' Sorry, you do not have the rightto add a category.'));3024 return new IXR_Error(401, __('You are not allowed to add a category.')); 3025 3025 3026 3026 // If no slug was provided make it empty so that 3027 3027 // WordPress will generate one. … … 3096 3096 do_action( 'xmlrpc_call', 'wp.deleteCategory' ); 3097 3097 3098 3098 if ( !current_user_can('manage_categories') ) 3099 return new IXR_Error( 401, __( ' Sorry, you do not have the rightto delete a category.' ) );3099 return new IXR_Error( 401, __( 'You are not allowed to delete a category.' ) ); 3100 3100 3101 3101 $status = wp_delete_term( $category_id, 'category' ); 3102 3102 … … 3143 3143 return $this->error; 3144 3144 3145 3145 if ( !current_user_can( 'edit_posts' ) ) 3146 return new IXR_Error( 401, __( ' Sorry, you must be able to edit posts on this site in order to view categories.' ) );3146 return new IXR_Error( 401, __( 'You must be able to edit posts on this site in order to view categories.' ) ); 3147 3147 3148 3148 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3149 3149 do_action( 'xmlrpc_call', 'wp.suggestCategories' ); … … 3437 3437 return new IXR_Error(500, $result->get_error_message()); 3438 3438 3439 3439 if ( !$result ) 3440 return new IXR_Error(500, __(' Sorry, the comment could not be edited. Something wrong happened.'));3440 return new IXR_Error(500, __('The comment could not be edited. Something wrong happened.')); 3441 3441 3442 3442 /** 3443 3443 * Fires after a comment has been successfully updated via XML-RPC. … … 3513 3513 } 3514 3514 3515 3515 if ( ! comments_open( $post_id ) ) { 3516 return new IXR_Error( 403, __( ' Sorry, comments are closed for this item.' ) );3516 return new IXR_Error( 403, __( 'Comments are closed for this item.' ) ); 3517 3517 } 3518 3518 3519 3519 $comment = array(); … … 3889 3889 return $this->error; 3890 3890 3891 3891 if ( !current_user_can( 'upload_files' ) ) 3892 return new IXR_Error( 403, __( 'You do not have permissionto upload files.' ) );3892 return new IXR_Error( 403, __( 'You are not allowed to upload files.' ) ); 3893 3893 3894 3894 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3895 3895 do_action( 'xmlrpc_call', 'wp.getMediaItem' ); … … 3937 3937 return $this->error; 3938 3938 3939 3939 if ( !current_user_can( 'upload_files' ) ) 3940 return new IXR_Error( 401, __( 'You do not have permissionto upload files.' ) );3940 return new IXR_Error( 401, __( 'You are not allowed to upload files.' ) ); 3941 3941 3942 3942 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 3943 3943 do_action( 'xmlrpc_call', 'wp.getMediaLibrary' ); … … 4069 4069 $post_type = get_post_type_object( $post_type_name ); 4070 4070 4071 4071 if ( ! current_user_can( $post_type->cap->edit_posts ) ) 4072 return new IXR_Error( 401, __( ' Sorry, you are not allowed to edit this post type.' ) );4072 return new IXR_Error( 401, __( 'You are not allowed to edit this post type.' ) ); 4073 4073 4074 4074 return $this->_prepare_post_type( $post_type, $fields ); 4075 4075 } … … 4185 4185 return new IXR_Error( 404, __( 'Invalid post ID.' ) ); 4186 4186 4187 4187 if ( ! current_user_can( 'edit_post', $post_id ) ) 4188 return new IXR_Error( 401, __( ' Sorry, you are not allowed to edit posts.' ) );4188 return new IXR_Error( 401, __( 'You are not allowed to edit posts.' ) ); 4189 4189 4190 4190 // Check if revisions are enabled. 4191 4191 if ( ! wp_revisions_enabled( $post ) ) … … 4255 4255 return new IXR_Error( 404, __( 'Invalid post ID.' ) ); 4256 4256 4257 4257 if ( ! current_user_can( 'edit_post', $revision->post_parent ) ) 4258 return new IXR_Error( 401, __( ' Sorry, you cannotedit this post.' ) );4258 return new IXR_Error( 401, __( 'You are not allowed to edit this post.' ) ); 4259 4259 4260 4260 // Check if revisions are disabled. 4261 4261 if ( ! wp_revisions_enabled( $post ) ) … … 4371 4371 return $this->error; 4372 4372 4373 4373 if ( !current_user_can( 'edit_posts' ) ) 4374 return new IXR_Error( 401, __( ' Sorry, you do not have access to user data on this site.' ) );4374 return new IXR_Error( 401, __( 'You do not have access to user data on this site.' ) ); 4375 4375 4376 4376 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 4377 4377 do_action( 'xmlrpc_call', 'blogger.getUserInfo' ); … … 4417 4417 return new IXR_Error( 404, __( 'Invalid post ID.' ) ); 4418 4418 4419 4419 if ( !current_user_can( 'edit_post', $post_ID ) ) 4420 return new IXR_Error( 401, __( ' Sorry, you cannotedit this post.' ) );4420 return new IXR_Error( 401, __( 'You are not allowed to edit this post.' ) ); 4421 4421 4422 4422 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 4423 4423 do_action( 'xmlrpc_call', 'blogger.getPost' ); … … 4470 4470 return $this->error; 4471 4471 4472 4472 if ( ! current_user_can( 'edit_posts' ) ) 4473 return new IXR_Error( 401, __( ' Sorry, you cannotedit posts on this site.' ) );4473 return new IXR_Error( 401, __( 'You are not allowed to edit posts on this site.' ) ); 4474 4474 4475 4475 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 4476 4476 do_action( 'xmlrpc_call', 'blogger.getRecentPosts' ); … … 4513 4513 * @return IXR_Error 4514 4514 */ 4515 4515 public function blogger_getTemplate($args) { 4516 return new IXR_Error( 403, __(' Sorry, that file cannot be edited.' ) );4516 return new IXR_Error( 403, __('That file cannot be edited.' ) ); 4517 4517 } 4518 4518 4519 4519 /** … … 4524 4524 * @return IXR_Error 4525 4525 */ 4526 4526 public function blogger_setTemplate($args) { 4527 return new IXR_Error( 403, __(' Sorry, that file cannot be edited.' ) );4527 return new IXR_Error( 403, __('That file cannot be edited.' ) ); 4528 4528 } 4529 4529 4530 4530 /** … … 4560 4560 4561 4561 $cap = ($publish) ? 'publish_posts' : 'edit_posts'; 4562 4562 if ( ! current_user_can( get_post_type_object( 'post' )->cap->create_posts ) || !current_user_can($cap) ) 4563 return new IXR_Error(401, __(' Sorry, you are not allowed to post on this site.'));4563 return new IXR_Error(401, __('You are not allowed to post on this site.')); 4564 4564 4565 4565 $post_status = ($publish) ? 'publish' : 'draft'; 4566 4566 … … 4580 4580 return new IXR_Error(500, $post_ID->get_error_message()); 4581 4581 4582 4582 if ( !$post_ID ) 4583 return new IXR_Error(500, __(' Sorry, your entry could not be posted. Something wrong happened.'));4583 return new IXR_Error(500, __('Your entry could not be posted. Something wrong happened.')); 4584 4584 4585 4585 $this->attach_uploads( $post_ID, $post_content ); 4586 4586 … … 4640 4640 $this->escape($actual_post); 4641 4641 4642 4642 if ( ! current_user_can( 'edit_post', $post_ID ) ) { 4643 return new IXR_Error(401, __(' Sorry, you do not have the rightto edit this post.'));4643 return new IXR_Error(401, __('You are not allowed to edit this post.')); 4644 4644 } 4645 4645 if ( 'publish' == $actual_post['post_status'] && ! current_user_can( 'publish_posts' ) ) { 4646 return new IXR_Error( 401, __( ' Sorry, you do not have the rightto publish this post.' ) );4646 return new IXR_Error( 401, __( 'You are not allowed to publish this post.' ) ); 4647 4647 } 4648 4648 4649 4649 $postdata = array(); … … 4710 4710 } 4711 4711 4712 4712 if ( ! current_user_can( 'delete_post', $post_ID ) ) { 4713 return new IXR_Error( 401, __( ' Sorry, you do not have the rightto delete this post.' ) );4713 return new IXR_Error( 401, __( 'You are not allowed to delete this post.' ) ); 4714 4714 } 4715 4715 4716 4716 $result = wp_delete_post( $post_ID ); … … 4797 4797 $cap = 'publish_pages'; 4798 4798 else 4799 4799 $cap = 'edit_pages'; 4800 $error_message = __( ' Sorry, you are not allowed to publish pages on this site.' );4800 $error_message = __( 'You are not allowed to publish pages on this site.' ); 4801 4801 $post_type = 'page'; 4802 4802 if ( !empty( $content_struct['wp_page_template'] ) ) 4803 4803 $page_template = $content_struct['wp_page_template']; … … 4808 4808 $cap = 'publish_posts'; 4809 4809 else 4810 4810 $cap = 'edit_posts'; 4811 $error_message = __( ' Sorry, you are not allowed to publish posts on this site.' );4811 $error_message = __( 'You are not allowed to publish posts on this site.' ); 4812 4812 $post_type = 'post'; 4813 4813 } else { 4814 4814 // No other post_type values are allowed here … … 4821 4821 $cap = 'publish_posts'; 4822 4822 else 4823 4823 $cap = 'edit_posts'; 4824 $error_message = __( ' Sorry, you are not allowed to publish posts on this site.' );4824 $error_message = __( 'You are not allowed to publish posts on this site.' ); 4825 4825 $post_type = 'post'; 4826 4826 } 4827 4827 4828 4828 if ( ! current_user_can( get_post_type_object( $post_type )->cap->create_posts ) ) 4829 return new IXR_Error( 401, __( ' Sorry, you are not allowed to publish posts on this site.' ) );4829 return new IXR_Error( 401, __( 'You are not allowed to publish posts on this site.' ) ); 4830 4830 if ( !current_user_can( $cap ) ) 4831 4831 return new IXR_Error( 401, $error_message ); 4832 4832 … … 5039 5039 return new IXR_Error(500, $post_ID->get_error_message()); 5040 5040 5041 5041 if ( !$post_ID ) 5042 return new IXR_Error(500, __(' Sorry, your entry could not be posted. Something wrong happened.'));5042 return new IXR_Error(500, __('Your entry could not be posted. Something wrong happened.')); 5043 5043 5044 5044 /** 5045 5045 * Fires after a new post has been successfully created via the XML-RPC MovableType API. … … 5140 5140 return new IXR_Error( 404, __( 'Invalid post ID.' ) ); 5141 5141 5142 5142 if ( ! current_user_can( 'edit_post', $post_ID ) ) 5143 return new IXR_Error( 401, __( ' Sorry, you do not have the rightto edit this post.' ) );5143 return new IXR_Error( 401, __( 'You are not allowed to edit this post.' ) ); 5144 5144 5145 5145 // Use wp.editPost to edit post types other than post and page. 5146 5146 if ( ! in_array( $postdata[ 'post_type' ], array( 'post', 'page' ) ) ) … … 5311 5311 5312 5312 if ( 'publish' == $post_status || 'private' == $post_status ) { 5313 5313 if ( 'page' == $post_type && ! current_user_can( 'publish_pages' ) ) { 5314 return new IXR_Error( 401, __( ' Sorry, you do not have the rightto publish this page.' ) );5314 return new IXR_Error( 401, __( 'You are not allowed to publish this page.' ) ); 5315 5315 } elseif ( ! current_user_can( 'publish_posts' ) ) { 5316 return new IXR_Error( 401, __( ' Sorry, you do not have the rightto publish this post.' ) );5316 return new IXR_Error( 401, __( 'You are not allowed to publish this post.' ) ); 5317 5317 } 5318 5318 } 5319 5319 … … 5350 5350 return new IXR_Error(500, $result->get_error_message()); 5351 5351 5352 5352 if ( !$result ) 5353 return new IXR_Error(500, __(' Sorry, your entry could not be edited. Something wrong happened.'));5353 return new IXR_Error(500, __('Your entry could not be edited. Something wrong happened.')); 5354 5354 5355 5355 // Only posts can be sticky 5356 5356 if ( $post_type == 'post' && isset( $content_struct['sticky'] ) ) { … … 5431 5431 return new IXR_Error( 404, __( 'Invalid post ID.' ) ); 5432 5432 5433 5433 if ( !current_user_can( 'edit_post', $post_ID ) ) 5434 return new IXR_Error( 401, __( ' Sorry, you cannotedit this post.' ) );5434 return new IXR_Error( 401, __( 'You are not allowed to edit this post.' ) ); 5435 5435 5436 5436 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5437 5437 do_action( 'xmlrpc_call', 'metaWeblog.getPost' ); … … 5561 5561 return $this->error; 5562 5562 5563 5563 if ( ! current_user_can( 'edit_posts' ) ) 5564 return new IXR_Error( 401, __( ' Sorry, you cannotedit posts on this site.' ) );5564 return new IXR_Error( 401, __( 'You are not allowed to edit posts on this site.' ) ); 5565 5565 5566 5566 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5567 5567 do_action( 'xmlrpc_call', 'metaWeblog.getRecentPosts' ); … … 5674 5674 return $this->error; 5675 5675 5676 5676 if ( !current_user_can( 'edit_posts' ) ) 5677 return new IXR_Error( 401, __( ' Sorry, you must be able to edit posts on this site in order to view categories.' ) );5677 return new IXR_Error( 401, __( 'You must be able to edit posts on this site in order to view categories.' ) ); 5678 5678 5679 5679 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5680 5680 do_action( 'xmlrpc_call', 'metaWeblog.getCategories' ); … … 5738 5738 do_action( 'xmlrpc_call', 'metaWeblog.newMediaObject' ); 5739 5739 5740 5740 if ( !current_user_can('upload_files') ) { 5741 $this->error = new IXR_Error( 401, __( 'You do not have permissionto upload files.' ) );5741 $this->error = new IXR_Error( 401, __( 'You are not allowed to upload files.' ) ); 5742 5742 return $this->error; 5743 5743 } 5744 5744 5745 5745 if ( is_multisite() && upload_is_user_over_quota( false ) ) { 5746 $this->error = new IXR_Error( 401, __( ' Sorry, you have used your space allocation.' ) );5746 $this->error = new IXR_Error( 401, __( 'You have used your space allocation.' ) ); 5747 5747 return $this->error; 5748 5748 } 5749 5749 … … 5772 5772 $post_id = (int) $data['post_id']; 5773 5773 5774 5774 if ( ! current_user_can( 'edit_post', $post_id ) ) 5775 return new IXR_Error( 401, __( ' Sorry, you cannotedit this post.' ) );5775 return new IXR_Error( 401, __( 'You are not allowed to edit this post.' ) ); 5776 5776 } 5777 5777 $attachment = array( 5778 5778 'post_title' => $name, … … 5895 5895 return $this->error; 5896 5896 5897 5897 if ( !current_user_can( 'edit_posts' ) ) 5898 return new IXR_Error( 401, __( ' Sorry, you must be able to edit posts on this site in order to view categories.' ) );5898 return new IXR_Error( 401, __( 'You must be able to edit posts on this site in order to view categories.' ) ); 5899 5899 5900 5900 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5901 5901 do_action( 'xmlrpc_call', 'mt.getCategoryList' ); … … 5943 5943 return new IXR_Error( 404, __( 'Invalid post ID.' ) ); 5944 5944 5945 5945 if ( !current_user_can( 'edit_post', $post_ID ) ) 5946 return new IXR_Error( 401, __( ' Sorry, you can notedit this post.' ) );5946 return new IXR_Error( 401, __( 'You are not allowed to edit this post.' ) ); 5947 5947 5948 5948 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 5949 5949 do_action( 'xmlrpc_call', 'mt.getPostCategories' ); … … 5997 5997 return new IXR_Error( 404, __( 'Invalid post ID.' ) ); 5998 5998 5999 5999 if ( !current_user_can('edit_post', $post_ID) ) 6000 return new IXR_Error(401, __(' Sorry, you cannotedit this post.'));6000 return new IXR_Error(401, __('You are not allowed to edit this post.')); 6001 6001 6002 6002 $catids = array(); 6003 6003 foreach ( $categories as $cat ) { … … 6116 6116 return new IXR_Error( 404, __( 'Invalid post ID.' ) ); 6117 6117 6118 6118 if ( !current_user_can('publish_posts') || !current_user_can('edit_post', $post_ID) ) 6119 return new IXR_Error(401, __(' Sorry, you cannotpublish this post.'));6119 return new IXR_Error(401, __('You are not allowed to publish this post.')); 6120 6120 6121 6121 $postdata['post_status'] = 'publish'; 6122 6122