Ticket #5418: 5418.xmlrpc.diff
| File 5418.xmlrpc.diff, 5.4 KB (added by DD32, 4 years ago) |
|---|
-
.php
old new 459 459 * wp_getAuthors 460 460 */ 461 461 function wp_getAuthors($args) { 462 global $wpdb;463 462 464 463 $this->escape($args); 465 464 … … 533 532 * wp_suggestCategories 534 533 */ 535 534 function wp_suggestCategories($args) { 536 global $wpdb;537 538 535 $this->escape($args); 539 536 540 537 $blog_id = (int) $args[0]; … … 625 622 return $this->error; 626 623 } 627 624 628 $user_data = get_userdatabylogin($user_login);629 625 $post_data = wp_get_single_post($post_ID, ARRAY_A); 630 626 631 627 $categories = implode(',', wp_get_post_categories($post_ID)); … … 648 644 /* blogger.getRecentPosts ...gets recent posts */ 649 645 function blogger_getRecentPosts($args) { 650 646 651 global $wpdb;652 653 647 $this->escape($args); 654 648 655 649 $blog_ID = (int) $args[1]; /* though we don't use it yet */ … … 767 761 /* blogger.newPost ...creates a new post */ 768 762 function blogger_newPost($args) { 769 763 770 global $wpdb;771 772 764 $this->escape($args); 773 765 774 766 $blog_ID = (int) $args[1]; /* though we don't use it yet */ … … 803 795 if ( is_wp_error( $post_ID ) ) 804 796 return new IXR_Error(500, $post_ID->get_error_message()); 805 797 806 if (!$post_ID) {798 if (!$post_ID) 807 799 return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.')); 808 } 800 809 801 $this->attach_uploads( $post_ID, $post_content ); 810 802 811 803 logIO('O', "Posted ! ID: $post_ID"); … … 813 805 return $post_ID; 814 806 } 815 807 816 817 808 /* blogger.editPost ...edits a post */ 818 809 function blogger_editPost($args) { 819 810 820 global $wpdb;821 822 811 $this->escape($args); 823 812 824 813 $post_ID = (int) $args[1]; … … 867 856 868 857 /* blogger.deletePost ...deletes a post */ 869 858 function blogger_deletePost($args) { 870 871 global $wpdb;872 873 859 $this->escape($args); 874 860 875 861 $post_ID = (int) $args[1]; … … 908 894 909 895 /* metaweblog.newPost creates a post */ 910 896 function mw_newPost($args) { 911 912 global $wpdb, $post_default_category;913 914 897 $this->escape($args); 915 898 916 899 $blog_ID = (int) $args[0]; // we will support this in the near future … … 1122 1105 /* metaweblog.editPost ...edits a post */ 1123 1106 function mw_editPost($args) { 1124 1107 1125 global $wpdb, $post_default_category;1126 1127 1108 $this->escape($args); 1128 1109 1129 1110 $post_ID = (int) $args[0]; … … 1330 1311 /* metaweblog.getPost ...returns a post */ 1331 1312 function mw_getPost($args) { 1332 1313 1333 global $wpdb;1334 1335 1314 $this->escape($args); 1336 1315 1337 1316 $post_ID = (int) $args[0]; … … 1345 1324 $postdata = wp_get_single_post($post_ID, ARRAY_A); 1346 1325 1347 1326 if ($postdata['post_date'] != '') { 1348 1349 1327 $post_date = mysql2date('Ymd\TH:i:s', $postdata['post_date']); 1350 1328 $post_date_gmt = mysql2date('Ymd\TH:i:s', $postdata['post_date_gmt']); 1351 1329 1352 1330 $categories = array(); 1353 1331 $catids = wp_get_post_categories($post_ID); 1354 foreach($catids as $catid) {1332 foreach($catids as $catid) 1355 1333 $categories[] = get_cat_name($catid); 1356 }1357 1334 1358 1335 $tagnames = array(); 1359 1336 $tags = wp_get_post_tags( $post_ID ); 1360 1337 if ( !empty( $tags ) ) { 1361 foreach ( $tags as $tag ) {1338 foreach ( $tags as $tag ) 1362 1339 $tagnames[] = $tag->name; 1363 }1364 1340 $tagnames = implode( ', ', $tagnames ); 1365 1341 } else { 1366 1342 $tagnames = ''; … … 1496 1472 /* metaweblog.getCategories ...returns the list of categories on a given blog */ 1497 1473 function mw_getCategories($args) { 1498 1474 1499 global $wpdb;1500 1501 1475 $this->escape($args); 1502 1476 1503 1477 $blog_ID = (int) $args[0]; … … 1576 1550 $name = "wpid{$old_file->ID}-{$filename}"; 1577 1551 } 1578 1552 1579 $upload = wp_upload_bits($name, $type, $bits , $overwrite);1553 $upload = wp_upload_bits($name, $type, $bits); 1580 1554 if ( ! empty($upload['error']) ) { 1581 1555 $errorString = sprintf(__('Could not write file %1$s (%2$s)'), $name, $upload['error']); 1582 1556 logIO('O', '(MW) ' . $errorString); … … 1654 1628 /* mt.getCategoryList ...returns the list of categories on a given blog */ 1655 1629 function mt_getCategoryList($args) { 1656 1630 1657 global $wpdb;1658 1659 1631 $this->escape($args); 1660 1632 1661 1633 $blog_ID = (int) $args[0]; … … 1834 1806 1835 1807 /* pingback.ping gets a pingback and registers it */ 1836 1808 function pingback_ping($args) { 1837 global $wpdb , $wp_version;1809 global $wpdb; 1838 1810 1839 1811 $this->escape($args); 1840 1812 … … 1847 1819 $pagelinkedto = str_replace('&', '&', $pagelinkedto); 1848 1820 $pagelinkedto = str_replace('&', '&', $pagelinkedto); 1849 1821 1850 $error_code = -1;1851 1852 1822 // Check if the page linked to is in our site 1853 1823 $pos1 = strpos($pagelinkedto, str_replace(array('http://www.','http://','https://www.','https://'), '', get_option('home'))); 1854 1824 if( !$pos1 ) … … 1912 1882 return new IXR_Error(33, __('The specified target URL cannot be used as a target. It either doesn\'t exist, or it is not a pingback-enabled resource.')); 1913 1883 1914 1884 // Let's check that the remote site didn't already pingback this entry 1915 $ result = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$post_ID' AND comment_author_url = '$pagelinkedfrom'");1885 $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$post_ID' AND comment_author_url = '$pagelinkedfrom'"); 1916 1886 1917 1887 if ( $wpdb->num_rows ) // We already have a Pingback from this URL 1918 1888 return new IXR_Error(48, __('The pingback has already been registered.')); … … 1974 1944 $pagelinkedfrom = str_replace('&', '&', $pagelinkedfrom); 1975 1945 1976 1946 $context = '[...] ' . wp_specialchars( $excerpt ) . ' [...]'; 1977 $original_pagelinkedfrom = $pagelinkedfrom;1978 1947 $pagelinkedfrom = $wpdb->escape( $pagelinkedfrom ); 1979 $original_title = $title;1980 1948 1981 1949 $comment_post_ID = (int) $post_ID; 1982 1950 $comment_author = $title;
