Changeset 3626
- Timestamp:
- 03/06/2006 11:29:10 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/list-manipulation.php
r3570 r3626 7 7 die('-1'); 8 8 9 function grab_results() {10 global $ajax_results;11 $ajax_results = func_get_arg(0);12 }13 14 9 function get_out_now() { exit; } 15 add_action( 'shutdown', 'get_out_now', -1);10 add_action( 'shutdown', 'get_out_now', -1 ); 16 11 17 12 // check_admin_referer(); 18 13 14 $id = (int) $_POST['id']; 19 15 switch ( $_POST['action'] ) : 20 16 case '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'); 24 19 25 if ( wp_delete_link( $id) )20 if ( wp_delete_link( $id ) ) 26 21 die('1'); 27 22 else die('0'); 28 23 break; 29 24 case '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; 30 32 case 'delete-page' : 31 $id = (int) $_POST['id']; 32 if ( !current_user_can('edit_post', $id) ) { 33 if ( !current_user_can( 'delete_page', $id ) ) 33 34 die('-1'); 34 }35 35 36 if ( wp_delete_post( $id) ) {36 if ( wp_delete_post( $id ) ) 37 37 die('1'); 38 }else die('0');38 else die('0'); 39 39 break; 40 40 case 'delete-cat' : 41 if ( !current_user_can( 'manage_categories') )42 die 41 if ( !current_user_can( 'manage_categories' ) ) 42 die('-1'); 43 43 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 ) ) 48 45 die('1'); 49 46 else die('0'); 50 47 break; 51 48 case 'delete-comment' : 52 $id = (int) $_POST['id']; 53 54 if ( !$comment = get_comment($id) ) 49 if ( !$comment = get_comment( $id ) ) 55 50 die('0'); 56 if ( !current_user_can( 'edit_post', $comment->comment_post_ID) )51 if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) ) 57 52 die('-1'); 58 53 59 if ( wp_delete_comment( $comment->comment_ID) ) {54 if ( wp_delete_comment( $comment->comment_ID ) ) 60 55 die('1'); 61 } else { 62 die('0'); 63 } 56 else die('0'); 64 57 break; 65 58 case 'delete-comment-as-spam' : 66 $id = (int) $_POST['id']; 67 68 if ( !$comment = get_comment($id) ) 59 if ( !$comment = get_comment( $id ) ) 69 60 die('0'); 70 if ( !current_user_can( 'edit_post', $comment->comment_post_ID) )61 if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) ) 71 62 die('-1'); 72 63 73 if ( wp_set_comment_status( $comment->comment_ID, 'spam') ) {64 if ( wp_set_comment_status( $comment->comment_ID, 'spam' ) ) 74 65 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'); 91 67 break; 92 68 endswitch;
Note: See TracChangeset
for help on using the changeset viewer.