From ef2049566fd6e3605b46a0f7e08a77216722f890 Mon Sep 17 00:00:00 2001 From: matt Date: Sun, 9 Oct 2005 01:59:02 +0000 Subject: [PATCH] admin-db is needed for wp_delete_category git-svn-id: http://svn.automattic.com/wordpress/trunk@2940 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/list-manipulation.php | 161 +++++++++++++++++---------------- 1 file changed, 81 insertions(+), 80 deletions(-) diff --git a/wp-admin/list-manipulation.php b/wp-admin/list-manipulation.php index d1ad97d47a..a797cbf2a2 100644 --- a/wp-admin/list-manipulation.php +++ b/wp-admin/list-manipulation.php @@ -1,80 +1,81 @@ -query("DELETE FROM $wpdb->links WHERE link_id = '$id'") ) - die('1'); - else die('0'); - break; -case 'delete-post' : -case 'delete-page' : - $id = (int) $_POST['id']; - if ( !current_user_can('edit_post', $post_id) ) - die('-1'); - - if ( wp_delete_post($id) ) - die('1'); - else die('0'); - break; -case 'delete-cat' : - if ( !current_user_can('manage_categories') ) - die ('-1'); - - $id = (int) $_POST['id']; - $cat_name = get_catname($cat_ID); - - if ( wp_delete_category($id) ) - die('1'); - else die('0'); - break; -case 'delete-comment' : - $id = (int) $_POST['id']; - - if ( !$comment = get_comment($id) ) - die('0'); - if ( !current_user_can('edit_post', $comment->comment_post_ID) ) - die('-1'); - - if ( wp_set_comment_status($comment->comment_ID, "delete") ) { - do_action('delete_comment', $comment->comment_ID); - die('1'); - } else { - die('0'); - } - break; -case 'delete-link-category' : - $id = (int) $_POST['id']; - if ( 1 == $id ) - die('0'); - if ( !current_user_can('manage_links') ) - die('-1'); - - if ( $wpdb->query("DELETE FROM $wpdb->linkcategories WHERE cat_id='$id'") ) { - $wpdb->query("UPDATE $wpdb->links SET link_category=1 WHERE link_category='$id'"); - die('1'); - } else { - die('0'); - } - break; -endswitch; -?> +query("DELETE FROM $wpdb->links WHERE link_id = '$id'") ) + die('1'); + else die('0'); + break; +case 'delete-post' : +case 'delete-page' : + $id = (int) $_POST['id']; + if ( !current_user_can('edit_post', $post_id) ) + die('-1'); + + if ( wp_delete_post($id) ) + die('1'); + else die('0'); + break; +case 'delete-cat' : + if ( !current_user_can('manage_categories') ) + die ('-1'); + + $id = (int) $_POST['id']; + $cat_name = get_catname($cat_ID); + + if ( wp_delete_category($id) ) + die('1'); + else die('0'); + break; +case 'delete-comment' : + $id = (int) $_POST['id']; + + if ( !$comment = get_comment($id) ) + die('0'); + if ( !current_user_can('edit_post', $comment->comment_post_ID) ) + die('-1'); + + if ( wp_set_comment_status($comment->comment_ID, "delete") ) { + do_action('delete_comment', $comment->comment_ID); + die('1'); + } else { + die('0'); + } + break; +case 'delete-link-category' : + $id = (int) $_POST['id']; + if ( 1 == $id ) + die('0'); + if ( !current_user_can('manage_links') ) + die('-1'); + + if ( $wpdb->query("DELETE FROM $wpdb->linkcategories WHERE cat_id='$id'") ) { + $wpdb->query("UPDATE $wpdb->links SET link_category=1 WHERE link_category='$id'"); + die('1'); + } else { + die('0'); + } + break; +endswitch; +?>