X-Git-Url: https://scripts.mit.edu/gitweb/autoinstallsdev/wordpress.git/blobdiff_plain/ff81ee6e8304a1982a3ec4f5b134764a29d502cf..022dfbbbe3215917d84708eb09acca93b21ae9e0:/wp-admin/categories.php diff --git a/wp-admin/categories.php b/wp-admin/categories.php index 79163a98..d26a847b 100644 --- a/wp-admin/categories.php +++ b/wp-admin/categories.php @@ -25,31 +25,34 @@ switch($action) { case 'addcat': + check_admin_referer('add-category'); + if ( !current_user_can('manage_categories') ) die (__('Cheatin’ uh?')); wp_insert_category($_POST); - header('Location: categories.php?message=1#addcat'); + wp_redirect('categories.php?message=1#addcat'); + exit; break; case 'delete': - - check_admin_referer(); + $cat_ID = (int) $_GET['cat_ID']; + check_admin_referer('delete-category_' . $cat_ID); if ( !current_user_can('manage_categories') ) die (__('Cheatin’ uh?')); - $cat_ID = (int) $_GET['cat_ID']; $cat_name = get_catname($cat_ID); - if ( 1 == $cat_ID ) + // Don't delete the default cats. + if ( $cat_ID == get_option('default_category') ) 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_redirect('categories.php?message=2'); + exit; break; case 'edit': @@ -62,15 +65,16 @@ case 'edit':