Changeset 6847
- Timestamp:
- 02/14/2008 09:17:00 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/categories.php
r6804 r6847 6 6 7 7 wp_reset_vars(array('action', 'cat')); 8 9 if ( isset($_GET['deleteit']) && isset($_GET['delete']) ) 10 $action = 'bulk-delete'; 8 11 9 12 switch($action) { … … 44 47 break; 45 48 49 case 'bulk-delete': 50 check_admin_referer('bulk-categories'); 51 52 if ( !current_user_can('manage_categories') ) 53 wp_die( __('You are not allowed to delete categories.') ); 54 55 foreach ( (array) $_GET['delete'] as $cat_ID ) { 56 $cat_name = get_catname($cat_ID); 57 58 // Don't delete the default cats. 59 if ( $cat_ID == get_option('default_category') ) 60 wp_die(sprintf(__("Can’t delete the <strong>%s</strong> category: this is the default one"), $cat_name)); 61 62 wp_delete_category($cat_ID); 63 } 64 65 $sendback = wp_get_referer(); 66 $sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback); 67 68 wp_redirect($sendback); 69 exit(); 70 71 break; 46 72 case 'edit': 47 73 … … 71 97 72 98 wp_enqueue_script( 'admin-categories' ); 99 wp_enqueue_script('admin-forms'); 100 73 101 require_once ('admin-header.php'); 74 102 … … 102 130 103 131 <div style="float: left"> 104 <input type="button" value="<?php _e('Delete'); ?>" name="deleteit" /> 132 <input type="submit" value="<?php _e('Delete'); ?>" name="deleteit" /> 133 <?php wp_nonce_field('bulk-categories'); ?> 105 134 </div> 106 135 107 136 <br style="clear:both;" /> 108 137 </div> 109 </form>110 138 111 139 <br style="clear:both;" /> … … 114 142 <thead> 115 143 <tr> 116 <th scope="col"><div style="text-align: center"><input type="checkbox" name="TODO" /></div></th>144 <th scope="col"><div style="text-align: center"><input type="checkbox" onclick="checkAll(document.getElementById('posts-filter'));" /></div></th> 117 145 <th scope="col"><?php _e('Name') ?></th> 118 146 <th scope="col"><?php _e('Description') ?></th> 119 <th scope="col" width="90"style="text-align: center"><?php _e('Posts') ?></th>147 <th scope="col" style="text-align: center"><?php _e('Posts') ?></th> 120 148 </tr> 121 149 </thead> … … 126 154 </tbody> 127 155 </table> 156 </form> 128 157 129 158 <br style="clear:both;" />
Note: See TracChangeset
for help on using the changeset viewer.