Just a little code cleanup and case normalization. http://mosquito.wordpress.org/view.php?id=360

git-svn-id: http://svn.automattic.com/wordpress/trunk@1953 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
saxmatt 2004-12-14 09:22:21 +00:00
parent 7104f60653
commit d53401fbd5
2 changed files with 16 additions and 15 deletions

View File

@ -117,7 +117,7 @@ function cat_rows($parent = 0, $level = 0, $categories = 0) {
$count = $wpdb->get_var("SELECT COUNT(post_id) FROM $wpdb->post2cat WHERE category_id = $category->cat_ID");
$pad = str_repeat('— ', $level);
if ( $user_level > 3 )
$edit = "<a href='categories.php?action=edit&amp;cat_ID=$category->cat_ID' class='edit'>" . __('Edit') . "</a></td><td><a href='categories.php?action=Delete&amp;cat_ID=$category->cat_ID' onclick=\"return confirm('". sprintf(__("You are about to delete the category \'%s\'. All of its posts will go to the default category.\\n \'OK\' to delete, \'Cancel\' to stop."), addslashes($category->cat_name)) . "')\" class='delete'>" . __('Delete') . "</a>";
$edit = "<a href='categories.php?action=edit&amp;cat_ID=$category->cat_ID' class='edit'>" . __('Edit') . "</a></td><td><a href='categories.php?action=delete&amp;cat_ID=$category->cat_ID' onclick=\"return confirm('". sprintf(__("You are about to delete the category \'%s\'. All of its posts will go to the default category.\\n \'OK\' to delete, \'Cancel\' to stop."), addslashes($category->cat_name)) . "')\" class='delete'>" . __('Delete') . "</a>";
else
$edit = '';

View File

@ -38,11 +38,11 @@ case 'addcat':
header('Location: categories.php?message=1#addcat');
break;
case 'Delete':
case 'delete':
check_admin_referer();
$cat_ID = intval($_GET["cat_ID"]);
$cat_ID = (int) $_GET['cat_ID'];
$cat_name = get_catname($cat_ID);
$category = $wpdb->get_row("SELECT * FROM $wpdb->categories WHERE cat_ID = '$cat_ID'");
$cat_parent = $category->category_parent;
@ -55,6 +55,7 @@ case 'Delete':
$wpdb->query("DELETE FROM $wpdb->categories WHERE cat_ID = '$cat_ID'");
$wpdb->query("UPDATE $wpdb->categories SET category_parent = '$cat_parent' WHERE category_parent = '$cat_ID'");
// TODO: Only set categories to general if they're not in another category already
$wpdb->query("UPDATE $wpdb->post2cat SET category_id='1' WHERE category_id='$cat_ID'");
header('Location: categories.php?message=2');