Changeset 12728 for trunk/wp-admin/post.php
- Timestamp:
- 01/15/2010 04:58:36 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/post.php
r12708 r12728 24 24 $post_id = 0; 25 25 $post_ID = $post_id; 26 27 26 $post = null; 28 27 $post_type_object = null; 29 28 $post_type_cap = null; 29 $post_type = null; 30 30 if ( $post_id ) { 31 31 $post = get_post($post_id); 32 32 if ( $post ) { 33 33 $post_type_object = get_post_type_object($post->post_type); 34 if ( $post_type_object ) 34 if ( $post_type_object ) { 35 $post_type = $post->post_type; 36 $current_screen->post_type = $post->post_type; 37 $current_screen->id = $current_screen->post_type; 35 38 $post_type_cap = $post_type_object->capability_type; 39 } 40 } 41 } elseif ( isset($_POST['post_type']) ) { 42 $post_type_object = get_post_type_object($_POST['post_type']); 43 if ( $post_type_object ) { 44 $post_type = $post_type_object->name; 45 $current_screen->post_type = $post_type; 46 $current_screen->id = $current_screen->post_type; 47 $post_type_cap = $post_type_object->capability_type; 36 48 } 37 49 } … … 109 121 case 'post-quickpress-publish': 110 122 case 'post-quickpress-save': 111 check_admin_referer('add- post');123 check_admin_referer('add-' . $post_type); 112 124 113 125 if ( 'post-quickpress-publish' == $action ) … … 164 176 $parent_file = "edit.php"; 165 177 $submenu_file = "edit.php"; 166 } elseif ( 'page' == $post_type ) { 167 $parent_file = "edit-pages.php"; 168 $submenu_file = "edit-pages.php"; 169 } else { 170 if ( $post_type_object->hierarchical ) { 171 $parent_file = "edit-pages.php?post_type=$post_type"; 172 $submenu_file = "edit-pages.php?post_type=$post_type"; 173 } else { 174 $parent_file = "edit.php?post_type=$post_type"; 175 $submenu_file = "edit.php?post_type=$post_type"; 176 } 178 } else { 179 $parent_file = "edit.php?post_type=$post_type"; 180 $submenu_file = "edit.php?post_type=$post_type"; 177 181 } 178 182 … … 214 218 215 219 case 'editpost': 216 check_admin_referer('update-' . $post ->post_type . '_' . $post_id);220 check_admin_referer('update-' . $post_type . '_' . $post_id); 217 221 218 222 $post_id = edit_post(); … … 224 228 225 229 case 'trash': 226 check_admin_referer('trash- post_' . $post_id);230 check_admin_referer('trash-' . $post_type . '_' . $post_id); 227 231 228 232 $post = & get_post($post_id); … … 239 243 240 244 case 'untrash': 241 check_admin_referer('untrash- post_' . $post_id);245 check_admin_referer('untrash-' . $post_type . '_' . $post_id); 242 246 243 247 if ( !current_user_can('delete_' . $post_type_cap, $post_id) ) … … 252 256 253 257 case 'delete': 254 check_admin_referer('delete- post_' . $post_id);258 check_admin_referer('delete-' . $post_type . '_' . $post_id); 255 259 256 260 if ( !current_user_can('delete_' . $post_type_cap, $post_id) ) … … 281 285 282 286 default: 283 if ( $post_type_object->hierarchical )284 wp_redirect('edit-pages.php');285 else286 287 wp_redirect('edit.php'); 287 288 exit();
Note: See TracChangeset
for help on using the changeset viewer.