Changeset 2946
- Timestamp:
- 10/13/05 18:17:05 (3 years ago)
- Files:
-
- trunk/wp-admin/admin-db.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wp-admin/admin-db.php
r2937 r2946 89 89 90 90 // Are we updating or creating? 91 if (!empty ($cat_ID)) {91 if (!empty ($cat_ID)) 92 92 $update = true; 93 } else {93 else 94 94 $update = false; 95 $id_result = $wpdb->get_row("SHOW TABLE STATUS LIKE '$wpdb->categories'");96 $cat_ID = $id_result->Auto_increment;97 }98 95 99 96 $cat_name = wp_specialchars($cat_name); 100 97 101 98 if (empty ($category_nicename)) 102 $category_nicename = sanitize_title($cat_name , $cat_ID);99 $category_nicename = sanitize_title($cat_name); 103 100 else 104 $category_nicename = sanitize_title($category_nicename , $cat_ID);101 $category_nicename = sanitize_title($category_nicename); 105 102 106 103 if (empty ($category_description)) … … 110 107 $category_parent = 0; 111 108 112 if (!$update) 109 if (!$update) { 113 110 $query = "INSERT INTO $wpdb->categories (cat_ID, cat_name, category_nicename, category_description, category_parent) VALUES ('0', '$cat_name', '$category_nicename', '$category_description', '$cat')"; 114 else 111 $cat_ID = $wpdb->insert_id; 112 } else { 115 113 $query = "UPDATE $wpdb->categories SET cat_name = '$cat_name', category_nicename = '$category_nicename', category_description = '$category_description', category_parent = '$category_parent' WHERE cat_ID = '$cat_ID'"; 116 114 } 115 116 if ( $category_nicename == '' ) { 117 $category_nicename = sanitize_title($cat_name, $cat_ID ); 118 $wpdb->query( "UPDATE $wpdb->categories SET category_nicename = '$category_nicename' WHERE cat_ID = '$cat_ID'" ); 119 } 120 117 121 $result = $wpdb->query($query); 118 122 … … 120 124 do_action('edit_category', $cat_ID); 121 125 } else { 122 do_action('create_category', $ rval);123 do_action('add_category', $ rval);126 do_action('create_category', $cat_ID); 127 do_action('add_category', $cat_ID); 124 128 } 125 129
