Changeset 967
- Timestamp:
- 04/17/07 16:27:48 (2 years ago)
- Files:
-
- trunk/xmlrpc.php (modified) (43 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/xmlrpc.php
r934 r967 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 … … 361 361 // Items not escaped here will be escaped in editPost. 362 362 $blog_id = (int) $args[0]; 363 $page_id = $this->escape((int)$args[1]);363 $page_id = (int) $this->escape($args[1]); 364 364 $username = $this->escape($args[2]); 365 365 $password = $this->escape($args[3]); … … 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 … … 677 677 678 678 if (!$posts_list) { 679 $this->error = new IXR_Error(500, 'Either there are no posts, or something went wrong.');679 $this->error = new IXR_Error(500, __('Either there are no posts, or something went wrong.')); 680 680 return $this->error; 681 681 } … … 724 724 set_current_user(0, $user_login); 725 725 if ( !current_user_can('edit_themes') ) { 726 return new IXR_Error(401, 'Sorry, this user can not edit the template.');726 return new IXR_Error(401, __('Sorry, this user can not edit the template.')); 727 727 } 728 728 … … 759 759 set_current_user(0, $user_login); 760 760 if ( !current_user_can('edit_themes') ) { 761 return new IXR_Error(401, 'Sorry, this user can not edit the template.');761 return new IXR_Error(401, __('Sorry, this user can not edit the template.')); 762 762 } 763 763 … … 770 770 fclose($f); 771 771 } else { 772 return new IXR_Error(500, 'Either the file is not writable, or something wrong happened. The file has not been updated.');772 return new IXR_Error(500, __('Either the file is not writable, or something wrong happened. The file has not been updated.')); 773 773 } 774 774 … … 797 797 $user = set_current_user(0, $user_login); 798 798 if ( !current_user_can($cap) ) 799 return new IXR_Error(401, 'Sorry, you can not post on this weblog or category.');799 return new IXR_Error(401, __('Sorry, you can not post on this weblog or category.')); 800 800 801 801 $post_status = ($publish) ? 'publish' : 'draft'; … … 815 815 816 816 if (!$post_ID) { 817 return new IXR_Error(500, 'Sorry, your entry could not be posted. Something wrong happened.');817 return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.')); 818 818 } 819 819 $this->attach_uploads( $post_ID, $post_content ); … … 845 845 846 846 if (!$actual_post) { 847 return new IXR_Error(404, 'Sorry, no such post.');847 return new IXR_Error(404, __('Sorry, no such post.')); 848 848 } 849 849 … … 852 852 set_current_user(0, $user_login); 853 853 if ( !current_user_can('edit_post', $post_ID) ) 854 return new IXR_Error(401, 'Sorry, you do not have the right to edit this post.');854 return new IXR_Error(401, __('Sorry, you do not have the right to edit this post.')); 855 855 856 856 extract($actual_post); 857 857 858 858 if ( ('publish' == $post_status) && !current_user_can('publish_posts') ) 859 return new IXR_Error(401, 'Sorry, you do not have the right to publish this post.');859 return new IXR_Error(401, __('Sorry, you do not have the right to publish this post.')); 860 860 861 861 $post_title = xmlrpc_getposttitle($content); … … 868 868 869 869 if (!$result) { 870 return new IXR_Error(500, 'For some strange yet very annoying reason, this post could not be edited.');870 return new IXR_Error(500, __('For some strange yet very annoying reason, this post could not be edited.')); 871 871 } 872 872 $this->attach_uploads( $ID, $post_content ); … … 895 895 896 896 if (!$actual_post) { 897 return new IXR_Error(404, 'Sorry, no such post.');897 return new IXR_Error(404, __('Sorry, no such post.')); 898 898 } 899 899 900 900 set_current_user(0, $user_login); 901 901 if ( !current_user_can('edit_post', $post_ID) ) 902 return new IXR_Error(401, 'Sorry, you do not have the right to delete this post.');902 return new IXR_Error(401, __('Sorry, you do not have the right to delete this post.')); 903 903 904 904 $result = wp_delete_post($post_ID); 905 905 906 906 if (!$result) { 907 return new IXR_Error(500, 'For some strange yet very annoying reason, this post could not be deleted.');907 return new IXR_Error(500, __('For some strange yet very annoying reason, this post could not be deleted.')); 908 908 } 909 909 … … 936 936 $user = set_current_user(0, $user_login); 937 937 if ( !current_user_can('publish_posts') ) 938 return new IXR_Error(401, 'Sorry, you can not post on this weblog or category.');938 return new IXR_Error(401, __('Sorry, you can not post on this weblog or category.')); 939 939 940 940 // The post_type defaults to post, but could also be page. … … 987 987 break; 988 988 default: 989 return(new IXR_Error(401, "Invalid post type."));989 return(new IXR_Error(401, __("Invalid post type."))); 990 990 break; 991 991 } … … 1043 1043 1044 1044 if (!$post_ID) { 1045 return new IXR_Error(500, 'Sorry, your entry could not be posted. Something wrong happened.');1045 return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.')); 1046 1046 } 1047 1047 … … 1097 1097 // Edit page caps are checked in editPage. Just check post here. 1098 1098 if ( ( 'post' == $post_type ) && !current_user_can('edit_post', $post_ID) ) 1099 return new IXR_Error(401, 'Sorry, you can not edit this post.');1099 return new IXR_Error(401, __('Sorry, you can not edit this post.')); 1100 1100 1101 1101 $postdata = wp_get_single_post($post_ID, ARRAY_A); … … 1105 1105 // created (which was the old behavior). 1106 1106 if(empty($postdata["ID"])) { 1107 return(new IXR_Error(404, "Invalid post id."));1107 return(new IXR_Error(404, __("Invalid post id."))); 1108 1108 } 1109 1109 … … 1148 1148 break; 1149 1149 default: 1150 return(new IXR_Error(401, "Invalid post type."));1150 return(new IXR_Error(401, __("Invalid post type."))); 1151 1151 break; 1152 1152 } … … 1184 1184 if ( ('publish' == $post_status) ) { 1185 1185 if ( ( 'page' == $post_type ) && !current_user_can('publish_pages') ) 1186 return new IXR_Error(401, 'Sorry, you do not have the right to publish this page.');1186 return new IXR_Error(401, __('Sorry, you do not have the right to publish this page.')); 1187 1187 else if ( !current_user_can('publish_posts') ) 1188 return new IXR_Error(401, 'Sorry, you do not have the right to publish this post.');1188 return new IXR_Error(401, __('Sorry, you do not have the right to publish this post.')); 1189 1189 } 1190 1190 … … 1217 1217 $result = wp_update_post($newpost); 1218 1218 if (!$result) { 1219 return new IXR_Error(500, 'Sorry, your entry could not be edited. Something wrong happened.');1219 return new IXR_Error(500, __('Sorry, your entry could not be edited. Something wrong happened.')); 1220 1220 } 1221 1221 $this->attach_uploads( $ID, $post_content ); … … 1286 1286 return $resp; 1287 1287 } else { 1288 return new IXR_Error(404, 'Sorry, no such post.');1288 return new IXR_Error(404, __('Sorry, no such post.')); 1289 1289 } 1290 1290 } … … 1308 1308 1309 1309 if (!$posts_list) { 1310 $this->error = new IXR_Error(500, 'Either there are no posts, or something went wrong.');1310 $this->error = new IXR_Error(500, __('Either there are no posts, or something went wrong.')); 1311 1311 return $this->error; 1312 1312 } … … 1439 1439 if ( !current_user_can('upload_files') ) { 1440 1440 logIO('O', '(MW) User does not have upload_files capability'); 1441 $this->error = new IXR_Error(401, 'You are not allowed to upload files to this site.');1441 $this->error = new IXR_Error(401, __('You are not allowed to upload files to this site.')); 1442 1442 return $this->error; 1443 1443 } … … 1493 1493 1494 1494 if (!$posts_list) { 1495 $this->error = new IXR_Error(500, 'Either there are no posts, or something went wrong.');1495 $this->error = new IXR_Error(500, __('Either there are no posts, or something went wrong.')); 1496 1496 return $this->error; 1497 1497 } … … 1596 1596 set_current_user(0, $user_login); 1597 1597 if ( !current_user_can('edit_post', $post_ID) ) 1598 return new IXR_Error(401, 'Sorry, you can not edit this post.');1598 return new IXR_Error(401, __('Sorry, you can not edit this post.')); 1599 1599 1600 1600 foreach($categories as $cat) { … … 1637 1637 1638 1638 if (!$actual_post) { 1639 return new IXR_Error(404, 'Sorry, no such post.');1639 return new IXR_Error(404, __('Sorry, no such post.')); 1640 1640 } 1641 1641 … … 1678 1678 set_current_user(0, $user_login); 1679 1679 if ( !current_user_can('edit_post', $post_ID) ) 1680 return new IXR_Error(401, 'Sorry, you can not edit this post.');1680 return new IXR_Error(401, __('Sorry, you can not edit this post.')); 1681 1681 1682 1682 $postdata = wp_get_single_post($post_ID,ARRAY_A); … … 1719 1719 $pos1 = strpos($pagelinkedto, str_replace(array('http://www.','http://','https://www.','https://'), '', get_option('home'))); 1720 1720 if( !$pos1 ) 1721 return new IXR_Error(0, 'Is there no link to us?');1721 return new IXR_Error(0, __('Is there no link to us?')); 1722 1722 1723 1723 // let's find which post is linked to … … 1772 1772 1773 1773 if ( $post_ID == url_to_postid($pagelinkedfrom) ) 1774 return new IXR_Error(0, 'The source URL and the target URL cannot both point to the same resource.');1774 return new IXR_Error(0, __('The source URL and the target URL cannot both point to the same resource.')); 1775 1775 1776 1776 // Check if pings are on … … 1782 1782 1783 1783 if ( $wpdb->num_rows ) // We already have a Pingback from this URL 1784 return new IXR_Error(48, 'The pingback has already been registered.');1784 return new IXR_Error(48, __('The pingback has already been registered.')); 1785 1785 1786 1786 // very stupid, but gives time to the 'from' server to publish ! … … 1790 1790 $linea = wp_remote_fopen( $pagelinkedfrom ); 1791 1791 if ( !$linea ) 1792 return new IXR_Error(16, 'The source URL does not exist.');1792 return new IXR_Error(16, __('The source URL does not exist.')); 1793 1793 1794 1794 // Work around bug in strip_tags(): … … 1800 1800 $title = $matchtitle[1]; 1801 1801 if ( empty( $title ) ) 1802 return new IXR_Error(32, 'We cannot find a title on that page.');1802 return new IXR_Error(32, __('We cannot find a title on that page.')); 1803 1803 1804 1804 $linea = strip_tags( $linea, '<a>' ); // just keep the tag we need … … 1836 1836 1837 1837 if ( empty($context) ) // Link to target not found 1838 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.');1838 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.')); 1839 1839 1840 1840 $pagelinkedfrom = preg_replace('#&([^amp\;])#is', '&$1', $pagelinkedfrom); … … 1883 1883 if (!$actual_post) { 1884 1884 // No such post = resource not found 1885 return new IXR_Error(32, 'The specified target URL does not exist.');1885 return new IXR_Error(32, __('The specified target URL does not exist.')); 1886 1886 } 1887 1887
