X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/ff81ee6e8304a1982a3ec4f5b134764a29d502cf..refs/tags/wordpress-2.8.3-scripts:/wp-admin/categories.php diff --git a/wp-admin/categories.php b/wp-admin/categories.php index 79163a98..8d26b9e1 100644 --- a/wp-admin/categories.php +++ b/wp-admin/categories.php @@ -1,169 +1,306 @@ %s category: this is the default one"), $cat_name)); + // Don't delete the default cats. + if ( $cat_ID == get_option('default_category') ) + wp_die(sprintf(__("Can’t delete the %s category: this is the default one"), $cat_name)); wp_delete_category($cat_ID); - header('Location: categories.php?message=2'); + wp_safe_redirect( add_query_arg( 'message', 2, wp_get_referer() ) ); + exit; break; +case 'bulk-delete': + check_admin_referer('bulk-categories'); + + if ( !current_user_can('manage_categories') ) + wp_die( __('You are not allowed to delete categories.') ); + + foreach ( (array) $_GET['delete'] as $cat_ID ) { + $cat_name = get_cat_name($cat_ID); + + // Don't delete the default cats. + if ( $cat_ID == get_option('default_category') ) + wp_die(sprintf(__("Can’t delete the %s category: this is the default one"), $cat_name)); + + wp_delete_category($cat_ID); + } + + wp_safe_redirect( wp_get_referer() ); + exit(); + +break; case 'edit': - require_once ('admin-header.php'); - $cat_ID = (int) $_GET['cat_ID']; - $category = get_category_to_edit($cat_ID); - ?> - -
- + +