[wp-cvs] wordpress/wp-admin categories.php,1.43,1.44

Matthew Mullenweg saxmatt at users.sourceforge.net
Thu Dec 9 01:02:28 UTC 2004


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

Modified Files:
	categories.php 
Log Message:
Fix HTML on edit category form, allow category slug to be edited.

Index: categories.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/categories.php,v
retrieving revision 1.43
retrieving revision 1.44
diff -C2 -d -r1.43 -r1.44
*** categories.php	18 Nov 2004 19:51:31 -0000	1.43
--- categories.php	9 Dec 2004 01:02:25 -0000	1.44
***************
*** 24,41 ****
  
  case 'addcat':
! 
!     if ($user_level < 3)
!         die (__('Cheatin&#8217; uh?'));
!     
!     $cat_name= $_POST['cat_name'];
!     $cat_ID = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories ORDER BY cat_ID DESC LIMIT 1") + 1;
!     $category_nicename = sanitize_title($cat_name, $cat_ID);
!     $category_description = $_POST['category_description'];
!     $cat = intval($_POST['cat']);
! 
!     $wpdb->query("INSERT INTO $wpdb->categories (cat_ID, cat_name, category_nicename, category_description, category_parent) VALUES ('0', '$cat_name', '$category_nicename', '$category_description', '$cat')");
!     
!     header('Location: categories.php?message=1#addcat');
! 
  break;
  
--- 24,40 ----
  
  case 'addcat':
! 	if ($user_level < 3)
! 		die (__('Cheatin&#8217; uh?'));
! 	
! 	$cat_name= $_POST['cat_name'];
! 	$id_result = $wpdb->get_row("SHOW TABLE STATUS LIKE '$wpdb->categories'");
! 	$cat_ID = $id_result->Auto_increment;
! 	$category_nicename = sanitize_title($cat_name, $cat_ID);
! 	$category_description = $_POST['category_description'];
! 	$cat = intval($_POST['cat']);
! 	
! 	$wpdb->query("INSERT INTO $wpdb->categories (cat_ID, cat_name, category_nicename, category_description, category_parent) VALUES ('0', '$cat_name', '$category_nicename', '$category_description', '$cat')");
! 	
! 	header('Location: categories.php?message=1#addcat');
  break;
  
***************
*** 72,94 ****
  
  <div class="wrap">
!     <h2><?php _e('Edit Category') ?></h2>
!     <form name="editcat" action="categories.php" method="post">
!         <input type="hidden" name="action" value="editedcat" />
!         <input type="hidden" name="cat_ID" value="<?php echo $cat_ID ?>" />
!         <p><?php _e('Category name:') ?><br />
!         <input type="text" name="cat_name" value="<?php echo htmlspecialchars($cat_name); ?>" /></p>
!         <p><?php _e('Category parent:') ?><br />
!         <select name='cat' class='postform'>
!         <option value='0'<?php if (!$category->category_parent) echo " selected='selected'"; ?>><?php _e('None') ?></option>
!         <?php wp_dropdown_cats($category->cat_ID, $category->category_parent); ?>
!         </select>
!         </p>
! 
!         <p><?php _e('Description:') ?><br />
! 										     <textarea name="category_description" rows="5" cols="50" style="width: 97%;"><?php echo htmlspecialchars($category->category_description, ENT_NOQUOTES); ?></textarea></p>
!         <p class="submit"><input type="submit" name="submit" value="<?php _e('Edit category &raquo;') ?>" /></p>
!     </form>
  </div>
- 
      <?php
  
--- 71,103 ----
  
  <div class="wrap">
!  <h2><?php _e('Edit Category') ?></h2>
!  <form name="editcat" action="categories.php" method="post">
! 	  <table class="editform" width="100%" cellspacing="2" cellpadding="5">
! 		<tr>
! 		  <th width="33%" scope="row"><?php _e('Category name:') ?></th>
! 		  <td width="67%"><input name="cat_name" type="text" value="<?php echo htmlspecialchars($cat_name); ?>" size="40" /> <input type="hidden" name="action" value="editedcat" />
! <input type="hidden" name="cat_ID" value="<?php echo $cat_ID ?>" /></td>
! 		</tr>
! 		<tr>
! 			<th scope="row"><?php _e('Category slug:') ?></th>
! 			<td><input name="category_nicename" type="text" value="<?php echo htmlspecialchars($category->category_nicename); ?>" size="40" /></td>
! 		</tr>
! 		<tr>
! 			<th scope="row"><?php _e('Category parent:') ?></th>
! 			<td>        
! 			<select name='cat'>
! 	  <option value='0' <?php if (!$category->category_parent) echo " selected='selected'"; ?>><?php _e('None') ?></option>
! 	  <?php wp_dropdown_cats($category->cat_ID, $category->category_parent); ?>
! 	  </select></td>
! 		</tr>
! 		<tr>
! 			<th scope="row"><?php _e('Description:') ?></th>
! 			<td><textarea name="category_description" rows="5" cols="50" style="width: 97%;"><?php echo htmlspecialchars($category->category_description, ENT_NOQUOTES); ?></textarea></td>
! 		</tr>
! 		</table>
! 	  <p class="submit"><input type="submit" name="submit" value="<?php _e('Edit category') ?> &raquo;" /></p>
!  </form>
!  <p><a href="categories.php"><?php _e('&laquo; Return to category list'); ?></a></p>
  </div>
      <?php
  
***************
*** 96,112 ****
  
  case 'editedcat':
  
!     if ($user_level < 3)
!         die (__('Cheatin&#8217; uh?'));
!     
!     $cat_name = $_POST['cat_name'];
!     $cat_ID = (int) $_POST['cat_ID'];
!     $category_nicename = sanitize_title($cat_name, $cat_ID);
!     $category_description = $_POST['category_description'];
! 
!     $wpdb->query("UPDATE $wpdb->categories SET cat_name = '$cat_name', category_nicename = '$category_nicename', category_description = '$category_description', category_parent = '$cat' WHERE cat_ID = '$cat_ID'");
!     
!     header('Location: categories.php?message=3');
! 
  break;
  
--- 105,119 ----
  
  case 'editedcat':
+ 	if ($user_level < 3)
+ 		die (__('Cheatin&#8217; uh?'));
+ 	
+ 	$cat_name = $_POST['cat_name'];
+ 	$cat_ID = (int) $_POST['cat_ID'];
+ 	$category_nicename = sanitize_title($_POST['category_nicename'], $cat_ID);
+ 	$category_description = $_POST['category_description'];
+ 	
+ 	$wpdb->query("UPDATE $wpdb->categories SET cat_name = '$cat_name', category_nicename = '$category_nicename', category_description = '$category_description', category_parent = '$cat' WHERE cat_ID = '$cat_ID'");
  
! 	header('Location: categories.php?message=3');
  break;
  




More information about the cvs mailing list