Ticket #5569: xmlrpc.php.diff

File xmlrpc.php.diff, 4.0 KB (added by josephscott, 4 years ago)
  • xmlrpc.php

     
    8888                        'wp.suggestCategories'  => 'this:wp_suggestCategories', 
    8989                        'wp.uploadFile'                 => 'this:mw_newMediaObject',    // Alias 
    9090                        'wp.getCommentCount'    => 'this:wp_getCommentCount', 
     91                        'wp.getPostStatusList'  => 'this:wp_getPostStatusList', 
     92                        'wp.getPageStatusList'  => 'this:wp_getPageStatusList', 
    9193 
    9294                        // Blogger API 
    9395                        'blogger.getUsersBlogs' => 'this:blogger_getUsersBlogs', 
     
    698700        } 
    699701 
    700702 
     703        function wp_getPostStatusList( $args ) { 
     704                $this->escape( $args ); 
     705 
     706                $blog_id        = (int) $args[0]; 
     707                $username       = $args[1]; 
     708                $password       = $args[2]; 
     709 
     710                if( !$this->login_pass_ok( $username, $password ) ) { 
     711                        return new IXR_Error( 403, __( 'Bad login/pass combination.' ) ); 
     712                } 
     713 
     714                set_current_user( 0, $username ); 
     715                if( !current_user_can( 'edit_posts' ) ) { 
     716                        return new IXR_Error( 403, __( 'You are not allowed access to details about this blog.' ) ); 
     717                } 
     718 
     719                return get_post_statuses( ); 
     720        } 
     721 
     722 
     723        function wp_getPageStatusList( $args ) { 
     724                $this->escape( $args ); 
     725 
     726                $blog_id        = (int) $args[0]; 
     727                $username       = $args[1]; 
     728                $password       = $args[2]; 
     729 
     730                if( !$this->login_pass_ok( $username, $password ) ) { 
     731                        return new IXR_Error( 403, __( 'Bad login/pass combination.' ) ); 
     732                } 
     733 
     734                set_current_user( 0, $username ); 
     735                if( !current_user_can( 'edit_posts' ) ) { 
     736                        return new IXR_Error( 403, __( 'You are not allowed acces to details about this blog.' ) ); 
     737                } 
     738 
     739                return get_page_statuses( ); 
     740        } 
     741 
     742 
    701743        /* Blogger API functions 
    702744         * specs on http://plant.blogger.com/api and http://groups.yahoo.com/group/bloggerDev/ 
    703745         */ 
     
    11471189 
    11481190                $post_title = $content_struct['title']; 
    11491191                $post_content = apply_filters( 'content_save_pre', $content_struct['description'] ); 
     1192 
    11501193                $post_status = $publish ? 'publish' : 'draft'; 
     1194                if( isset( $content_struct['post_status'] ) ) { 
     1195                        switch( $content_struct['post_status'] ) { 
     1196                                case 'draft': 
     1197                                case 'private': 
     1198                                case 'publish': 
     1199                                        $post_status = $content_struct['post_status']; 
     1200                                        break; 
     1201                                case 'pending': 
     1202                                        // Pending is only valid for posts, not pages. 
     1203                                        if( $post_type === 'post' ) { 
     1204                                                $post_status = $content_struct['post_status']; 
     1205                                        } 
     1206                                        break; 
     1207                                default: 
     1208                                        $post_status = $publish ? 'publish' : 'draft'; 
     1209                                        break; 
     1210                        } 
     1211                } 
    11511212                 
    11521213                $post_excerpt = $content_struct['mt_excerpt']; 
    11531214                $post_more = $content_struct['mt_text_more']; 
     
    14471508                 
    14481509                $post_excerpt = $content_struct['mt_excerpt']; 
    14491510                $post_more = $content_struct['mt_text_more']; 
     1511 
    14501512                $post_status = $publish ? 'publish' : 'draft'; 
     1513                if( isset( $content_struct['post_status'] ) ) { 
     1514                        switch( $content_struct['post_status'] ) { 
     1515                                case 'draft': 
     1516                                case 'private': 
     1517                                case 'publish': 
     1518                                        $post_status = $content_struct['post_status']; 
     1519                                        break; 
     1520                                case 'pending': 
     1521                                        // Pending is only valid for posts, not pages. 
     1522                                        if( $post_type === 'post' ) { 
     1523                                                $post_status = $content_struct['post_status']; 
     1524                                        } 
     1525                                        break; 
     1526                                default: 
     1527                                        $post_status = $publish ? 'publish' : 'draft'; 
     1528                                        break; 
     1529                        } 
     1530                } 
    14511531                 
    14521532                $tags_input = $content_struct['mt_keywords']; 
    14531533 
     
    15451625                         
    15461626                        $allow_comments = ('open' == $postdata['comment_status']) ? 1 : 0; 
    15471627                        $allow_pings = ('open' == $postdata['ping_status']) ? 1 : 0; 
     1628 
     1629                        // Consider future posts as published 
     1630                        if( $postdata['post_status'] === 'future' ) { 
     1631                                $postdata['post_status'] = 'publish'; 
     1632                        } 
    15481633                         
    15491634                        $resp = array( 
    15501635                                'dateCreated' => new IXR_Date($post_date), 
     
    16361721                        $allow_comments = ('open' == $entry['comment_status']) ? 1 : 0; 
    16371722                        $allow_pings = ('open' == $entry['ping_status']) ? 1 : 0; 
    16381723 
     1724                        // Consider future posts as published 
     1725                        if( $entry['post_status'] === 'future' ) { 
     1726                                $entry['post_status'] = 'publish'; 
     1727                        } 
     1728 
    16391729                        $struct[] = array( 
    16401730                                'dateCreated' => new IXR_Date($post_date), 
    16411731                                'userid' => $entry['post_author'],