WordPress.org

Make WordPress Core

Changeset 16965


Ignore:
Timestamp:
12/15/10 18:58:05 (3 years ago)
Author:
westi
Message:

Move post_type var setup back into edit.php and reinstate the cap check. See #15326

Location:
trunk/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit.php

    r16900 r16965  
    99/** WordPress Administration Bootstrap */ 
    1010require_once( './admin.php' ); 
     11 
     12if ( !isset($_GET['post_type']) ) 
     13    $post_type = 'post'; 
     14elseif ( in_array( $_GET['post_type'], get_post_types( array('show_ui' => true ) ) ) ) 
     15    $post_type = $_GET['post_type']; 
     16else 
     17    wp_die( __('Invalid post type') ); 
     18 
     19$_GET['post_type'] = $post_type; 
     20 
     21$post_type_object = get_post_type_object( $post_type ); 
     22 
     23if ( !current_user_can($post_type_object->cap->edit_posts) ) 
     24    wp_die(__('Cheatin’ uh?')); 
     25 
    1126$wp_list_table = get_list_table('WP_Posts_List_Table'); 
    1227$wp_list_table->check_permissions(); 
  • trunk/wp-admin/includes/class-wp-posts-list-table.php

    r16908 r16965  
    4747    function WP_Posts_List_Table() { 
    4848        global $post_type_object, $post_type, $wpdb; 
    49  
    50         if ( !isset( $_REQUEST['post_type'] ) ) 
    51             $post_type = 'post'; 
    52         elseif ( in_array( $_REQUEST['post_type'], get_post_types( array( 'show_ui' => true ) ) ) ) 
    53             $post_type = $_REQUEST['post_type']; 
    54         else 
    55             wp_die( __( 'Invalid post type' ) ); 
    56         $_REQUEST['post_type'] = $post_type; 
    5749 
    5850        $post_type_object = get_post_type_object( $post_type ); 
Note: See TracChangeset for help on using the changeset viewer.