Changeset 5166 for trunk/xmlrpc.php
- Timestamp:
- 04/01/2007 03:59:50 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/xmlrpc.php
r5115 r5166 141 141 function login_pass_ok($user_login, $user_pass) { 142 142 if (!user_pass_ok($user_login, $user_pass)) { 143 $this->error = new IXR_Error(403, 'Bad login/pass combination.');143 $this->error = new IXR_Error(403, __('Bad login/pass combination.')); 144 144 return false; 145 145 } … … 242 242 // If the page doesn't exist indicate that. 243 243 else { 244 return(new IXR_Error(404, "Sorry, no such page."));244 return(new IXR_Error(404, __("Sorry, no such page."))); 245 245 } 246 246 } … … 303 303 $user = set_current_user(0, $username); 304 304 if(!current_user_can("publish_pages")) { 305 return(new IXR_Error(401, "Sorry, you can not add new pages."));305 return(new IXR_Error(401, __("Sorry, you can not add new pages."))); 306 306 } 307 307 … … 336 336 || ($actual_page["post_type"] != "page") 337 337 ) { 338 return(new IXR_Error(404, "Sorry, no such page."));338 return(new IXR_Error(404, __("Sorry, no such page."))); 339 339 } 340 340 … … 342 342 set_current_user(0, $username); 343 343 if(!current_user_can("delete_page", $page_id)) { 344 return(new IXR_Error(401, "Sorry, you do not have the right to delete this page."));344 return(new IXR_Error(401, __("Sorry, you do not have the right to delete this page."))); 345 345 } 346 346 … … 348 348 $result = wp_delete_post($page_id); 349 349 if(!$result) { 350 return(new IXR_Error(500, "Failed to delete the page."));350 return(new IXR_Error(500, __("Failed to delete the page."))); 351 351 } 352 352 … … 377 377 || ($actual_page["post_type"] != "page") 378 378 ) { 379 return(new IXR_Error(404, "Sorry, no such page."));379 return(new IXR_Error(404, __("Sorry, no such page."))); 380 380 } 381 381 … … 383 383 set_current_user(0, $username); 384 384 if(!current_user_can("edit_page", $page_id)) { 385 return(new IXR_Error(401, "Sorry, you do not have the right to edit this page."));385 return(new IXR_Error(401, __("Sorry, you do not have the right to edit this page."))); 386 386 } 387 387 … … 482 482 set_current_user(0, $username); 483 483 if(!current_user_can("manage_categories", $page_id)) { 484 return(new IXR_Error(401, "Sorry, you do not have the right to add a category."));484 return(new IXR_Error(401, __("Sorry, you do not have the right to add a category."))); 485 485 } 486 486 … … 514 514 $cat_id = wp_insert_category($new_category); 515 515 if(!$cat_id) { 516 return(new IXR_Error(500, "Sorry, the new category failed."));516 return(new IXR_Error(500, __("Sorry, the new category failed."))); 517 517 } 518 518 … … 667 667 668 668 if (!$posts_list) { 669 $this->error = new IXR_Error(500, 'Either there are no posts, or something went wrong.');669 $this->error = new IXR_Error(500, __('Either there are no posts, or something went wrong.')); 670 670 return $this->error; 671 671 } … … 714 714 set_current_user(0, $user_login); 715 715 if ( !current_user_can('edit_themes') ) { 716 return new IXR_Error(401, 'Sorry, this user can not edit the template.');716 return new IXR_Error(401, __('Sorry, this user can not edit the template.')); 717 717 } 718 718 … … 749 749 set_current_user(0, $user_login); 750 750 if ( !current_user_can('edit_themes') ) { 751 return new IXR_Error(401, 'Sorry, this user can not edit the template.');751 return new IXR_Error(401, __('Sorry, this user can not edit the template.')); 752 752 } 753 753 … … 760 760 fclose($f); 761 761 } else { 762 return new IXR_Error(500, 'Either the file is not writable, or something wrong happened. The file has not been updated.');762 return new IXR_Error(500, __('Either the file is not writable, or something wrong happened. The file has not been updated.')); 763 763 } 764 764 … … 787 787 $user = set_current_user(0, $user_login); 788 788 if ( !current_user_can($cap) ) 789 return new IXR_Error(401, 'Sorry, you can not post on this weblog or category.');789 return new IXR_Error(401, __('Sorry, you can not post on this weblog or category.')); 790 790 791 791 $post_status = ($publish) ? 'publish' : 'draft'; … … 805 805 806 806 if (!$post_ID) { 807 return new IXR_Error(500, 'Sorry, your entry could not be posted. Something wrong happened.');807 return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.')); 808 808 } 809 809 $this->attach_uploads( $post_ID, $post_content ); … … 835 835 836 836 if (!$actual_post) { 837 return new IXR_Error(404, 'Sorry, no such post.');837 return new IXR_Error(404, __('Sorry, no such post.')); 838 838 } 839 839 … … 842 842 set_current_user(0, $user_login); 843 843 if ( !current_user_can('edit_post', $post_ID) ) 844 return new IXR_Error(401, 'Sorry, you do not have the right to edit this post.');844 return new IXR_Error(401, __('Sorry, you do not have the right to edit this post.')); 845 845 846 846 extract($actual_post); 847 847 848 848 if ( ('publish' == $post_status) && !current_user_can('publish_posts') ) 849 return new IXR_Error(401, 'Sorry, you do not have the right to publish this post.');849 return new IXR_Error(401, __('Sorry, you do not have the right to publish this post.')); 850 850 851 851 $post_title = xmlrpc_getposttitle($content); … … 858 858 859 859 if (!$result) { 860 return new IXR_Error(500, 'For some strange yet very annoying reason, this post could not be edited.');860 return new IXR_Error(500, __('For some strange yet very annoying reason, this post could not be edited.')); 861 861 } 862 862 $this->attach_uploads( $ID, $post_content ); … … 885 885 886 886 if (!$actual_post) { 887 return new IXR_Error(404, 'Sorry, no such post.');887 return new IXR_Error(404, __('Sorry, no such post.')); 888 888 } 889 889 890 890 set_current_user(0, $user_login); 891 891 if ( !current_user_can('edit_post', $post_ID) ) 892 return new IXR_Error(401, 'Sorry, you do not have the right to delete this post.');892 return new IXR_Error(401, __('Sorry, you do not have the right to delete this post.')); 893 893 894 894 $result = wp_delete_post($post_ID); 895 895 896 896 if (!$result) { 897 return new IXR_Error(500, 'For some strange yet very annoying reason, this post could not be deleted.');897 return new IXR_Error(500, __('For some strange yet very annoying reason, this post could not be deleted.')); 898 898 } 899 899 … … 926 926 $user = set_current_user(0, $user_login); 927 927 if ( !current_user_can('publish_posts') ) 928 return new IXR_Error(401, 'Sorry, you can not post on this weblog or category.');928 return new IXR_Error(401, __('Sorry, you can not post on this weblog or category.')); 929 929 930 930 // The post_type defaults to post, but could also be page. … … 977 977 break; 978 978 default: 979 return(new IXR_Error(401, "Invalid post type."));979 return(new IXR_Error(401, __("Invalid post type."))); 980 980 break; 981 981 } … … 1033 1033 1034 1034 if (!$post_ID) { 1035 return new IXR_Error(500, 'Sorry, your entry could not be posted. Something wrong happened.');1035 return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.')); 1036 1036 } 1037 1037 … … 1087 1087 // Edit page caps are checked in editPage. Just check post here. 1088 1088 if ( ( 'post' == $post_type ) && !current_user_can('edit_post', $post_ID) ) 1089 return new IXR_Error(401, 'Sorry, you can not edit this post.');1089 return new IXR_Error(401, __('Sorry, you can not edit this post.')); 1090 1090 1091 1091 $postdata = wp_get_single_post($post_ID, ARRAY_A); … … 1095 1095 // created (which was the old behavior). 1096 1096 if(empty($postdata["ID"])) { 1097 return(new IXR_Error(404, "Invalid post id."));1097 return(new IXR_Error(404, __("Invalid post id."))); 1098 1098 } 1099 1099 … … 1138 1138 break; 1139 1139 default: 1140 return(new IXR_Error(401, "Invalid post type."));1140 return(new IXR_Error(401, __("Invalid post type."))); 1141 1141 break; 1142 1142 } … … 1174 1174 if ( ('publish' == $post_status) ) { 1175 1175 if ( ( 'page' == $post_type ) && !current_user_can('publish_pages') ) 1176 return new IXR_Error(401, 'Sorry, you do not have the right to publish this page.');1176 return new IXR_Error(401, __('Sorry, you do not have the right to publish this page.')); 1177 1177 else if ( !current_user_can('publish_posts') ) 1178 return new IXR_Error(401, 'Sorry, you do not have the right to publish this post.');1178 return new IXR_Error(401, __('Sorry, you do not have the right to publish this post.')); 1179 1179 } 1180 1180 … … 1207 1207 $result = wp_update_post($newpost); 1208 1208 if (!$result) { 1209 return new IXR_Error(500, 'Sorry, your entry could not be edited. Something wrong happened.');1209 return new IXR_Error(500, __('Sorry, your entry could not be edited. Something wrong happened.')); 1210 1210 } 1211 1211 $this->attach_uploads( $ID, $post_content ); … … 1276 1276 return $resp; 1277 1277 } else { 1278 return new IXR_Error(404, 'Sorry, no such post.');1278 return new IXR_Error(404, __('Sorry, no such post.')); 1279 1279 } 1280 1280 } … … 1298 1298 1299 1299 if (!$posts_list) { 1300 $this->error = new IXR_Error(500, 'Either there are no posts, or something went wrong.');1300 $this->error = new IXR_Error(500, __('Either there are no posts, or something went wrong.')); 1301 1301 return $this->error; 1302 1302 } … … 1429 1429 if ( !current_user_can('upload_files') ) { 1430 1430 logIO('O', '(MW) User does not have upload_files capability'); 1431 $this->error = new IXR_Error(401, 'You are not allowed to upload files to this site.');1431 $this->error = new IXR_Error(401, __('You are not allowed to upload files to this site.')); 1432 1432 return $this->error; 1433 1433 } … … 1483 1483 1484 1484 if (!$posts_list) { 1485 $this->error = new IXR_Error(500, 'Either there are no posts, or something went wrong.');1485 $this->error = new IXR_Error(500, __('Either there are no posts, or something went wrong.')); 1486 1486 return $this->error; 1487 1487 } … … 1586 1586 set_current_user(0, $user_login); 1587 1587 if ( !current_user_can('edit_post', $post_ID) ) 1588 return new IXR_Error(401, 'Sorry, you can not edit this post.');1588 return new IXR_Error(401, __('Sorry, you can not edit this post.')); 1589 1589 1590 1590 foreach($categories as $cat) { … … 1627 1627 1628 1628 if (!$actual_post) { 1629 return new IXR_Error(404, 'Sorry, no such post.');1629 return new IXR_Error(404, __('Sorry, no such post.')); 1630 1630 } 1631 1631 … … 1668 1668 set_current_user(0, $user_login); 1669 1669 if ( !current_user_can('edit_post', $post_ID) ) 1670 return new IXR_Error(401, 'Sorry, you can not edit this post.');1670 return new IXR_Error(401, __('Sorry, you can not edit this post.')); 1671 1671 1672 1672 $postdata = wp_get_single_post($post_ID,ARRAY_A); … … 1709 1709 $pos1 = strpos($pagelinkedto, str_replace(array('http://www.','http://','https://www.','https://'), '', get_option('home'))); 1710 1710 if( !$pos1 ) 1711 return new IXR_Error(0, 'Is there no link to us?');1711 return new IXR_Error(0, __('Is there no link to us?')); 1712 1712 1713 1713 // let's find which post is linked to … … 1762 1762 1763 1763 if ( $post_ID == url_to_postid($pagelinkedfrom) ) 1764 return new IXR_Error(0, 'The source URL and the target URL cannot both point to the same resource.');1764 return new IXR_Error(0, __('The source URL and the target URL cannot both point to the same resource.')); 1765 1765 1766 1766 // Check if pings are on … … 1772 1772 1773 1773 if ( $wpdb->num_rows ) // We already have a Pingback from this URL 1774 return new IXR_Error(48, 'The pingback has already been registered.');1774 return new IXR_Error(48, __('The pingback has already been registered.')); 1775 1775 1776 1776 // very stupid, but gives time to the 'from' server to publish ! … … 1780 1780 $linea = wp_remote_fopen( $pagelinkedfrom ); 1781 1781 if ( !$linea ) 1782 return new IXR_Error(16, 'The source URL does not exist.');1782 return new IXR_Error(16, __('The source URL does not exist.')); 1783 1783 1784 1784 // Work around bug in strip_tags(): … … 1790 1790 $title = $matchtitle[1]; 1791 1791 if ( empty( $title ) ) 1792 return new IXR_Error(32, 'We cannot find a title on that page.');1792 return new IXR_Error(32, __('We cannot find a title on that page.')); 1793 1793 1794 1794 $linea = strip_tags( $linea, '<a>' ); // just keep the tag we need … … 1826 1826 1827 1827 if ( empty($context) ) // Link to target not found 1828 return new IXR_Error(17, 'The source URL does not contain a link to the target URL, and so cannot be used as a source.');1828 return new IXR_Error(17, __('The source URL does not contain a link to the target URL, and so cannot be used as a source.')); 1829 1829 1830 1830 $pagelinkedfrom = preg_replace('#&([^amp\;])#is', '&$1', $pagelinkedfrom); … … 1873 1873 if (!$actual_post) { 1874 1874 // No such post = resource not found 1875 return new IXR_Error(32, 'The specified target URL does not exist.');1875 return new IXR_Error(32, __('The specified target URL does not exist.')); 1876 1876 } 1877 1877
Note: See TracChangeset
for help on using the changeset viewer.