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

git-svn-id: http://svn.automattic.com/wordpress/trunk@4022 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2006-07-20 01:30:37 +00:00
parent dab38290f0
commit 9094543b51
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'])) : ?>