Don't allow blank cats. Props donncha. fixes #2960

git-svn-id: https://develop.svn.wordpress.org/trunk@4022 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2006-07-20 01:30:37 +00:00
parent 47f127394b
commit e06934b624
2 changed files with 9 additions and 3 deletions

View File

@ -84,6 +84,9 @@ function wp_insert_category($catarr) {
extract($catarr);
if( trim( $cat_name ) == '' )
return 0;
$cat_ID = (int) $cat_ID;
// Are we updating or creating?

View File

@ -15,9 +15,11 @@ case 'addcat':
if ( !current_user_can('manage_categories') )
wp_die(__('Cheatin’ uh?'));
wp_insert_category($_POST);
wp_redirect('categories.php?message=1#addcat');
if( wp_insert_category($_POST ) ) {
wp_redirect('categories.php?message=1#addcat');
} else {
wp_redirect('categories.php?message=4#addcat');
}
break;
case 'delete':
@ -71,6 +73,7 @@ require_once ('admin-header.php');
$messages[1] = __('Category added.');
$messages[2] = __('Category deleted.');
$messages[3] = __('Category updated.');
$messages[4] = __('Category not added.');
?>
<?php if (isset($_GET['message'])) : ?>