Make WordPress Core

Changeset 3626


Ignore:
Timestamp:
03/06/2006 11:29:10 PM (19 years ago)
Author:
ryan
Message:

List manipulation cap update from mdawaffe. fixes #2538

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/list-manipulation.php

    r3570 r3626  
    77    die('-1');
    88
    9 function grab_results() {
    10     global $ajax_results;
    11     $ajax_results = func_get_arg(0);
    12 }
    13 
    149function get_out_now() { exit; }
    15 add_action('shutdown', 'get_out_now', -1);
     10add_action( 'shutdown', 'get_out_now', -1 );
    1611
    1712//  check_admin_referer();
    1813
     14$id = (int) $_POST['id'];
    1915switch ( $_POST['action'] ) :
    2016case 'delete-link' :
    21     $id = (int) $_POST['id'];
    22     if ( !current_user_can('manage_links') )
    23         die ('-1');
     17    if ( !current_user_can( 'manage_links' ) )
     18        die('-1');
    2419
    25     if ( wp_delete_link($id) )
     20    if ( wp_delete_link( $id ) )
    2621        die('1');
    2722    else    die('0');
    2823    break;
    2924case 'delete-post' :
     25    if ( !current_user_can( 'delete_post', $id ) )
     26        die('-1');
     27
     28    if ( wp_delete_post( $id ) )
     29        die('1');
     30    else    die('0');
     31    break;
    3032case 'delete-page' :
    31     $id = (int) $_POST['id'];
    32     if ( !current_user_can('edit_post', $id) )  {
     33    if ( !current_user_can( 'delete_page', $id ) )
    3334        die('-1');
    34     }
    3535
    36     if ( wp_delete_post($id) ) {
     36    if ( wp_delete_post( $id ) )
    3737        die('1');
    38     } else  die('0');
     38    else    die('0');
    3939    break;
    4040case 'delete-cat' :
    41     if ( !current_user_can('manage_categories') )
    42         die ('-1');
     41    if ( !current_user_can( 'manage_categories' ) )
     42        die('-1');
    4343
    44     $id = (int) $_POST['id'];
    45     $cat_name = get_catname($cat_ID);
    46 
    47     if ( wp_delete_category($id) )
     44    if ( wp_delete_category( $id ) )
    4845        die('1');
    4946    else    die('0');
    5047    break;
    5148case 'delete-comment' :
    52     $id = (int) $_POST['id'];
    53 
    54     if ( !$comment = get_comment($id) )
     49    if ( !$comment = get_comment( $id ) )
    5550        die('0');
    56     if ( !current_user_can('edit_post', $comment->comment_post_ID) )
     51    if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) )
    5752        die('-1');
    5853
    59     if ( wp_delete_comment($comment->comment_ID) ) {
     54    if ( wp_delete_comment( $comment->comment_ID ) )
    6055        die('1');
    61     } else {
    62         die('0');
    63     }
     56    else    die('0');
    6457    break;
    6558case 'delete-comment-as-spam' :
    66     $id = (int) $_POST['id'];
    67 
    68     if ( !$comment = get_comment($id) )
     59    if ( !$comment = get_comment( $id ) )
    6960        die('0');
    70     if ( !current_user_can('edit_post', $comment->comment_post_ID) )
     61    if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) )
    7162        die('-1');
    7263
    73     if ( wp_set_comment_status($comment->comment_ID, 'spam') ) {
     64    if ( wp_set_comment_status( $comment->comment_ID, 'spam' ) )
    7465        die('1');
    75     } else {
    76         die('0');
    77     }
    78     break;
    79 case 'delete-link-category' :
    80     $id = (int) $_POST['id'];
    81     if ( 1 == $id )
    82         die('0');
    83     if ( !current_user_can('manage_categories') )
    84         die('-1');
    85 
    86     if ( wp_delete_category($id) ) {
    87         die('1');
    88     } else {
    89         die('0');
    90     }
     66    else    die('0');
    9167    break;
    9268endswitch;
Note: See TracChangeset for help on using the changeset viewer.