[wp-cvs] wordpress/wp-admin admin-functions.php, 1.67, 1.68 categories.php, 1.45, 1.46

Matthew Mullenweg saxmatt at users.sourceforge.net
Tue Dec 14 09:22:23 UTC 2004


Update of /cvsroot/cafelog/wordpress/wp-admin
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14468/wp-admin

Modified Files:
	admin-functions.php categories.php 
Log Message:
Just a little code cleanup and case normalization. http://mosquito.wordpress.org/view.php?id=360

Index: categories.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/categories.php,v
retrieving revision 1.45
retrieving revision 1.46
diff -C2 -d -r1.45 -r1.46
*** categories.php	12 Dec 2004 20:41:13 -0000	1.45
--- categories.php	14 Dec 2004 09:22:21 -0000	1.46
***************
*** 39,62 ****
  break;
  
! case 'Delete':
  
!     check_admin_referer();
  
!     $cat_ID = intval($_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;
  
!     if (1 == $cat_ID)
!         die(sprintf(__("Can't delete the <strong>%s</strong> category: this is the default one"), $cat_name));
  
!     if ($user_level < 3)
!         die (__('Cheatin&#8217; uh?'));
  
!     $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'");
!     $wpdb->query("UPDATE $wpdb->post2cat SET category_id='1' WHERE category_id='$cat_ID'");
  
!     header('Location: categories.php?message=2');
  
  break;
--- 39,63 ----
  break;
  
! case 'delete':
  
! 	check_admin_referer();
  
! 	$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;
  
! 	if ( 1 == $cat_ID )
! 		die(sprintf(__("Can't delete the <strong>%s</strong> category: this is the default one"), $cat_name));
  
! 	if ( $user_level < 3 )
! 		die (__('Cheatin&#8217; uh?'));
  
! 	$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');
  
  break;

Index: admin-functions.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/admin-functions.php,v
retrieving revision 1.67
retrieving revision 1.68
diff -C2 -d -r1.67 -r1.68
*** admin-functions.php	12 Dec 2004 20:41:13 -0000	1.67
--- admin-functions.php	14 Dec 2004 09:22:21 -0000	1.68
***************
*** 118,122 ****
  				$pad = str_repeat('&#8212; ', $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>";
  				else
  					$edit = '';
--- 118,122 ----
  				$pad = str_repeat('&#8212; ', $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>";
  				else
  					$edit = '';




More information about the cvs mailing list