Ticket #4599: xml-rpc.php.diff

File xml-rpc.php.diff, 1.5 kB (added by josephscott, 10 months ago)
  • xmlrpc.php

    old new  
    8585                        'wp.getAuthors'                 => 'this:wp_getAuthors', 
    8686                        'wp.getCategories'              => 'this:mw_getCategories',             // Alias 
    8787                        'wp.newCategory'                => 'this:wp_newCategory', 
     88                        'wp.deleteCategory'             => 'this:wp_deleteCategory', 
    8889                        'wp.suggestCategories'  => 'this:wp_suggestCategories', 
    8990                        'wp.uploadFile'                 => 'this:mw_newMediaObject',    // Alias 
    9091 
     
    494495                // Set the user context and make sure they are 
    495496                // allowed to add a category. 
    496497                set_current_user(0, $username); 
    497                 if(!current_user_can("manage_categories", $page_id)) { 
     498                if(!current_user_can("manage_categories")) { 
    498499                        return(new IXR_Error(401, __("Sorry, you do not have the right to add a category."))); 
    499500                } 
    500501 
     
    531532 
    532533        /** 
    533534         * WordPress XML-RPC API 
     535         * wp_deleteCategory 
     536         */ 
     537        function wp_deleteCategory($args) { 
     538                $this->escape($args); 
     539 
     540                $blog_id                = (int) $args[0]; 
     541                $username               = $args[1]; 
     542                $password               = $args[2]; 
     543                $category_id    = (int) $args[3]; 
     544 
     545                if( !$this->login_pass_ok( $username, $password ) ) { 
     546                        return $this->error; 
     547                } 
     548 
     549                set_current_user(0, $username); 
     550                if( !current_user_can("manage_categories") ) { 
     551                        return new IXR_Error( 401, __( "Sorry, you do not the right to delete a category." ) ); 
     552                } 
     553 
     554                return wp_delete_category( $category_id ); 
     555        } 
     556 
     557 
     558        /** 
     559         * WordPress XML-RPC API 
    534560         * wp_suggestCategories 
    535561         */ 
    536562        function wp_suggestCategories($args) {