Ticket #5463: xmlrpc.php.diff

File xmlrpc.php.diff, 1.2 kB (added by josephscott, 10 months ago)
  • xmlrpc.php

    old new  
    8787                        'wp.deleteCategory'             => 'this:wp_deleteCategory', 
    8888                        'wp.suggestCategories'  => 'this:wp_suggestCategories', 
    8989                        'wp.uploadFile'                 => 'this:mw_newMediaObject',    // Alias 
     90                        'wp.getCommentCount'    => 'this:wp_getCommentCount', 
    9091 
    9192                        // Blogger API 
    9293                        'blogger.getUsersBlogs' => 'this:blogger_getUsersBlogs', 
     
    676677                return($category_suggestions); 
    677678        } 
    678679 
     680        function wp_getCommentCount( $args ) { 
     681                $this->escape($args);  
    679682 
     683                $blog_id        = (int) $args[0];  
     684                $username       = $args[1];  
     685                $password       = $args[2];  
     686                $post_id        = (int) $args[3];   
     687 
     688                if( !$this->login_pass_ok( $username, $password ) ) {   
     689                        return new IXR_Error( 403, __( 'Bad login/pass combination.' ) );  
     690                }   
     691 
     692                set_current_user( 0, $username );   
     693                if( !current_user_can( 'edit_posts' ) ) {   
     694                        return new IXR_Error( 403, __( 'You are not allowed details about comments.' ) );   
     695                }  
     696 
     697                return get_comment_count( $post_id ); 
     698        } 
     699 
     700 
    680701        /* Blogger API functions 
    681702         * specs on http://plant.blogger.com/api and http://groups.yahoo.com/group/bloggerDev/ 
    682703         */