Changeset 6473
- Timestamp:
- 12/23/2007 01:35:44 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/xmlrpc.php
r6418 r6473 231 231 return($this->error); 232 232 } 233 234 do_action("xmlrpc_call", "wp.getPage"); 233 235 234 236 // Lookup page info. … … 314 316 } 315 317 318 do_action("xmlrpc_call", "wp.getPages"); 319 316 320 // Lookup info on pages. 317 321 $pages = get_pages(); … … 352 356 } 353 357 358 do_action("xmlrpc_call", "wp.newPage"); 359 354 360 // Set the user context and check if they are allowed 355 361 // to add new pages. … … 381 387 return($this->error); 382 388 } 389 390 do_action("xmlrpc_call", "wp.deletePage"); 383 391 384 392 // Get the current page based on the page_id and … … 424 432 } 425 433 434 do_action("xmlrpc_call", "wp.editPage"); 435 426 436 // Get the page data and make sure it is a page. 427 437 $actual_page = wp_get_single_post($page_id, ARRAY_A); … … 471 481 return($this->error); 472 482 } 483 484 do_action("xmlrpc_call", "wp.getPageList"); 473 485 474 486 // Get list of pages ids and titles … … 516 528 } 517 529 530 do_action("xmlrpc_call", "wp.getAuthors"); 531 518 532 return(get_users_of_blog()); 519 533 } … … 534 548 return($this->error); 535 549 } 550 551 do_action("xmlrpc_call", "wp.newCategory"); 536 552 537 553 // Set the user context and make sure they are … … 589 605 } 590 606 607 do_action("xmlrpc_call", "wp.deleteCategory"); 608 591 609 set_current_user(0, $username); 592 610 if( !current_user_can("manage_categories") ) { … … 614 632 return($this->error); 615 633 } 634 635 do_action("xmlrpc_call", "wp.suggestCategories"); 616 636 617 637 $category_suggestions = array(); … … 645 665 } 646 666 667 do_action("xmlrpc_call", "blogger.getUsersBlogs"); 668 647 669 set_current_user(0, $user_login); 648 670 $is_admin = current_user_can('level_8'); … … 670 692 return $this->error; 671 693 } 694 695 do_action("xmlrpc_call", "blogger.getUserInfo"); 672 696 673 697 $user_data = get_userdatabylogin($user_login); … … 699 723 } 700 724 725 do_action("xmlrpc_call", "blogger.getPost"); 726 701 727 $post_data = wp_get_single_post($post_ID, ARRAY_A); 702 728 … … 732 758 } 733 759 760 do_action("xmlrpc_call", "blogger.getRecentPosts"); 761 734 762 $posts_list = wp_get_recent_posts($num_posts); 735 763 … … 780 808 } 781 809 810 do_action("xmlrpc_call", "blogger.getTemplate"); 811 782 812 set_current_user(0, $user_login); 783 813 if ( !current_user_can('edit_themes') ) { … … 805 835 $this->escape($args); 806 836 807 $blog_ID = (int) $args[1]; 808 $user_login = $args[2]; 809 $user_pass = $args[3]; 810 $content = $args[4]; 811 $template = $args[5]; /* could be 'main' or 'archiveIndex', but we don't use it */ 812 813 if (!$this->login_pass_ok($user_login, $user_pass)) { 814 return $this->error; 815 } 816 817 set_current_user(0, $user_login); 818 if ( !current_user_can('edit_themes') ) { 819 return new IXR_Error(401, __('Sorry, this user can not edit the template.')); 820 } 821 822 /* warning: here we make the assumption that the blog's URL is on the same server */ 823 $filename = get_option('home') . '/'; 824 $filename = preg_replace('#https?://.+?/#', $_SERVER['DOCUMENT_ROOT'].'/', $filename); 825 826 if ($f = fopen($filename, 'w+')) { 827 fwrite($f, $content); 828 fclose($f); 829 } else { 830 return new IXR_Error(500, __('Either the file is not writable, or something wrong happened. The file has not been updated.')); 831 } 832 833 return true; 837 $blog_ID = (int) $args[1]; 838 $user_login = $args[2]; 839 $user_pass = $args[3]; 840 $content = $args[4]; 841 $template = $args[5]; /* could be 'main' or 'archiveIndex', but we don't use it */ 842 843 if (!$this->login_pass_ok($user_login, $user_pass)) { 844 return $this->error; 845 } 846 847 do_action("xmlrpc_call", "blogger.setTemplate"); 848 849 set_current_user(0, $user_login); 850 if ( !current_user_can('edit_themes') ) { 851 return new IXR_Error(401, __('Sorry, this user can not edit the template.')); 852 } 853 854 /* warning: here we make the assumption that the blog's URL is on the same server */ 855 $filename = get_option('home') . '/'; 856 $filename = preg_replace('#https?://.+?/#', $_SERVER['DOCUMENT_ROOT'].'/', $filename); 857 858 if ($f = fopen($filename, 'w+')) { 859 fwrite($f, $content); 860 fclose($f); 861 } else { 862 return new IXR_Error(500, __('Either the file is not writable, or something wrong happened. The file has not been updated.')); 863 } 864 865 return true; 834 866 } 835 867 … … 849 881 return $this->error; 850 882 } 851 883 884 do_action("xmlrpc_call", "blogger.newPost"); 885 852 886 $cap = ($publish) ? 'publish_posts' : 'edit_posts'; 853 887 $user = set_current_user(0, $user_login); … … 896 930 return $this->error; 897 931 } 898 932 933 do_action("xmlrpc_call", "blogger.editPost"); 934 899 935 $actual_post = wp_get_single_post($post_ID,ARRAY_A); 900 936 … … 943 979 return $this->error; 944 980 } 945 981 982 do_action("xmlrpc_call", "blogger.deletePost"); 983 946 984 $actual_post = wp_get_single_post($post_ID,ARRAY_A); 947 985 … … 982 1020 return $this->error; 983 1021 } 984 1022 1023 do_action("xmlrpc_call", "metaWeblog.newPost"); 1024 985 1025 $cap = ($publish) ? 'publish_posts' : 'edit_posts'; 986 1026 $user = set_current_user(0, $user_login); … … 1195 1235 1196 1236 if (!$this->login_pass_ok($user_login, $user_pass)) { 1197 return $this->error; 1198 } 1237 return $this->error; 1238 } 1239 1240 do_action("xmlrpc_call", "metaWeblog.editPost"); 1199 1241 1200 1242 $user = set_current_user(0, $user_login); … … 1406 1448 return $this->error; 1407 1449 } 1408 1450 1451 do_action("xmlrpc_call", "metaWeblog.getPost"); 1452 1409 1453 $postdata = wp_get_single_post($post_ID, ARRAY_A); 1410 1454 … … 1483 1527 } 1484 1528 1529 do_action("xmlrpc_call", "metaWeblog.getRecentPosts"); 1530 1485 1531 $posts_list = wp_get_recent_posts($num_posts); 1486 1532 … … 1570 1616 } 1571 1617 1618 do_action("xmlrpc_call", "metaWeblog.getCategories"); 1619 1572 1620 $categories_struct = array(); 1573 1621 … … 1609 1657 if ( !$this->login_pass_ok($user_login, $user_pass) ) 1610 1658 return $this->error; 1659 1660 do_action("xmlrpc_call", "metaWeblog.newMediaObject"); 1611 1661 1612 1662 set_current_user(0, $user_login); … … 1726 1776 } 1727 1777 1778 do_action("xmlrpc_call", "mt.getCategoryList"); 1779 1728 1780 $categories_struct = array(); 1729 1781 … … 1754 1806 return $this->error; 1755 1807 } 1808 1809 do_action("xmlrpc_call", "mt.getPostCategories"); 1756 1810 1757 1811 $categories = array(); … … 1786 1840 } 1787 1841 1842 do_action("xmlrpc_call", "mt.setPostCategories"); 1843 1788 1844 set_current_user(0, $user_login); 1789 1845 if ( !current_user_can('edit_post', $post_ID) ) … … 1802 1858 /* mt.supportedMethods ...returns an array of methods supported by this server */ 1803 1859 function mt_supportedMethods($args) { 1860 1861 do_action("xmlrpc_call", "mt.supportedMethods"); 1804 1862 1805 1863 $supported_methods = array(); … … 1825 1883 1826 1884 $post_ID = intval($args); 1885 1886 do_action("xmlrpc_call", "mt.getTrackbackPings"); 1827 1887 1828 1888 $actual_post = wp_get_single_post($post_ID, ARRAY_A); … … 1868 1928 } 1869 1929 1930 do_action("xmlrpc_call", "mt.publishPost"); 1931 1870 1932 set_current_user(0, $user_login); 1871 1933 if ( !current_user_can('edit_post', $post_ID) ) … … 1895 1957 function pingback_ping($args) { 1896 1958 global $wpdb; 1959 1960 do_action("xmlrpc_call", "pingback.ping"); 1897 1961 1898 1962 $this->escape($args); … … 2058 2122 global $wpdb; 2059 2123 2124 do_action("xmlrpc_call", "pingback.extensions.getPingsbacks"); 2125 2060 2126 $this->escape($args); 2061 2127
Note: See TracChangeset
for help on using the changeset viewer.