Changeset 994

Show
Ignore:
Timestamp:
06/04/07 18:47:47 (1 year ago)
Author:
donncha
Message:

Mostly merge xmlrpc.php from wp to 5651

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/xmlrpc.php

    r991 r994  
    1919 
    2020if ( isset( $_GET['rsd'] ) ) { // http://archipelago.phrasewise.com/rsd  
    21 header('Content-type: text/xml; charset=' . get_option('blog_charset'), true); 
     21header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true); 
    2222 
    2323?> 
     
    2929    <homePageLink><?php bloginfo_rss('url') ?></homePageLink> 
    3030    <apis> 
    31       <api name="WordPress" blogID="1" preferred="false" apiLink="<?php bloginfo_rss('url') ?>/xmlrpc.php" /> 
    32       <api name="Movable Type" blogID="1" preferred="true" apiLink="<?php bloginfo_rss('url') ?>/xmlrpc.php" /> 
    33       <api name="MetaWeblog" blogID="1" preferred="false" apiLink="<?php bloginfo_rss('url') ?>/xmlrpc.php" /> 
    34       <api name="Blogger" blogID="1" preferred="false" apiLink="<?php bloginfo_rss('url') ?>/xmlrpc.php" /> 
     31      <api name="WordPress" blogID="1" preferred="false" apiLink="<?php bloginfo_rss('wpurl') ?>/xmlrpc.php" /> 
     32      <api name="Movable Type" blogID="1" preferred="true" apiLink="<?php bloginfo_rss('wpurl') ?>/xmlrpc.php" /> 
     33      <api name="MetaWeblog" blogID="1" preferred="false" apiLink="<?php bloginfo_rss('wpurl') ?>/xmlrpc.php" /> 
     34      <api name="Blogger" blogID="1" preferred="false" apiLink="<?php bloginfo_rss('wpurl') ?>/xmlrpc.php" /> 
    3535    </apis> 
    3636  </service> 
     
    209209 
    210210                        // Format page date. 
    211                         $page_date = mysql2date("Ymd\TH:i:s", $page->post_date_gmt); 
     211                        $page_date = mysql2date("Ymd\TH:i:s\Z", $page->post_date_gmt); 
    212212 
    213213                        // Pull the categories info together. 
     
    439439                $num_pages = count($page_list); 
    440440                for($i = 0; $i < $num_pages; $i++) { 
    441                         $post_date = mysql2date("Ymd\TH:i:s", $page_list[$i]->post_date_gmt); 
     441                        $post_date = mysql2date("Ymd\TH:i:s\Z", $page_list[$i]->post_date_gmt); 
    442442                        $page_list[$i]->dateCreated = new IXR_Date($post_date); 
    443443 
     
    539539                $password                               = $args[2]; 
    540540                $category                               = $args[3]; 
    541                 $max_results                    = $args[4]; 
     541                $max_results                    = (int) $args[4]; 
    542542 
    543543                if(!$this->login_pass_ok($username, $password)) { 
     
    943943          } 
    944944 
     945      $cap = ($publish) ? 'publish_posts' : 'edit_posts'; 
    945946          $user = set_current_user(0, $user_login); 
    946           if ( !current_user_can('publish_posts') ) 
     947          if ( !current_user_can($cap) ) 
    947948            return new IXR_Error(401, __('Sorry, you can not post on this weblog or category.')); 
    948949 
     
    988989                                case "post": 
    989990                                        if(!current_user_can("edit_others_posts")) { 
    990                                                 return(new IXR_Error(401, "You are not allowed to " . 
    991                                                         "post as this user")); 
     991                                                return(new IXR_Error(401, __("You are not allowed to post as this user"))); 
    992992                                        } 
    993993                                        break; 
    994994                                case "page": 
    995995                                        if(!current_user_can("edit_others_pages")) { 
    996                                                 return(new IXR_Error(401, "You are not allowed to " . 
    997                                                         "create pages as this user")); 
     996                                                return(new IXR_Error(401, __("You are not allowed to create pages as this user"))); 
    998997                                        } 
    999998                                        break; 
     
    11641163                } 
    11651164 
    1166                 $post_author = $user->ID
     1165                $post_author = $postdata["post_author"]
    11671166 
    11681167                // Only set the post_author if one is set. 
     
    11741173                                case "post": 
    11751174                                        if(!current_user_can("edit_others_posts")) { 
    1176                                                 return(new IXR_Error(401, "You are not allowed to " . 
    1177                                                         "change the post author as this user.")); 
     1175                                                return(new IXR_Error(401, __("You are not allowed to change the post author as this user."))); 
    11781176                                        } 
    11791177                                        break; 
    11801178                                case "page": 
    11811179                                        if(!current_user_can("edit_others_pages")) { 
    1182                                                 return(new IXR_Error(401, "You are not allowed to " . 
    1183                                                         "change the page author as this user.")); 
     1180                                                return(new IXR_Error(401, __("You are not allowed to change the page author as this user."))); 
    11841181                                        } 
    11851182                                        break; 
     
    12831280          if ($postdata['post_date'] != '') { 
    12841281 
    1285             $post_date = mysql2date('Ymd\TH:i:s', $postdata['post_date_gmt']); 
     1282            $post_date = mysql2date('Ymd\TH:i:s\Z', $postdata['post_date_gmt']); 
    12861283 
    12871284            $categories = array(); 
     
    13511348                foreach ($posts_list as $entry) { 
    13521349 
    1353                         $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date_gmt']); 
     1350                        $post_date = mysql2date('Ymd\TH:i:s\Z', $entry['post_date_gmt']); 
    13541351                        $categories = array(); 
    13551352                        $catids = wp_get_post_categories($entry['ID']); 
     
    14851482                $upload = wp_upload_bits($name, $type, $bits, $overwrite); 
    14861483                if ( ! empty($upload['error']) ) { 
    1487                         $errorString = 'Could not write file ' . $name . ' (' . $upload['error'] . ')'
     1484                        $errorString = sprintf(__('Could not write file %1$s (%2$s)'), $name, $upload['error'])
    14881485                        logIO('O', '(MW) ' . $errorString); 
    14891486                        return new IXR_Error(500, $errorString); 
     
    15361533                foreach ($posts_list as $entry) { 
    15371534 
    1538                         $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date_gmt']); 
     1535                        $post_date = mysql2date('Ymd\TH:i:s\Z', $entry['post_date_gmt']); 
    15391536 
    15401537                        $struct[] = array( 
     
    17961793                } else { 
    17971794                        // TODO: Attempt to extract a post ID from the given URL 
    1798                         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.'); 
     1795                        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.')); 
    17991796                } 
    18001797                $post_ID = (int) $post_ID; 
     
    18061803 
    18071804                if ( !$post ) // Post_ID not found 
    1808                         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.'); 
     1805                        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.')); 
    18091806 
    18101807                if ( $post_ID == url_to_postid($pagelinkedfrom) ) 
     
    18131810                // Check if pings are on 
    18141811                if ( 'closed' == $post->ping_status ) 
    1815                         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.'); 
     1812                        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.')); 
    18161813 
    18171814                // Let's check that the remote site didn't already pingback this entry 
     
    18951892                do_action('pingback_post', $comment_ID); 
    18961893 
    1897                 return "Pingback from $pagelinkedfrom to $pagelinkedto registered. Keep the web talking! :-)"
     1894                return sprintf(__('Pingback from %1$s to %2$s registered. Keep the web talking! :-)'), $pagelinkedfrom, $pagelinkedto)
    18981895        } 
    18991896 
     
    19131910                if (!$post_ID) { 
    19141911                        // We aren't sure that the resource is available and/or pingback enabled 
    1915                         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.'); 
     1912                        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.')); 
    19161913                } 
    19171914