Make WordPress Core

Ticket #19131: 19131.2.diff

File 19131.2.diff, 1.7 KB (added by ryan, 13 years ago)

'_invalid' post type

  • wp-admin/includes/screen.php

     
    447447
    448448                // If this is the current screen, see if we can be more accurate for post types and taxonomies.
    449449                if ( ! $hook_name ) {
    450                         if ( isset( $_REQUEST['post_type'] ) && post_type_exists( $_REQUEST['post_type'] ) )
    451                                 $post_type = $_REQUEST['post_type'];
    452                         if ( isset( $_REQUEST['taxonomy'] ) && taxonomy_exists( $_REQUEST['taxonomy'] ) )
    453                                 $taxonomy = $_REQUEST['taxonomy'];
     450                        if ( isset( $_REQUEST['post_type'] ) )
     451                                $post_type = post_type_exists( $_REQUEST['post_type'] ) ? $_REQUEST['post_type'] : '_invalid';
     452                        if ( isset( $_REQUEST['taxonomy'] ) )
     453                                $taxonomy = taxonomy_exists( $_REQUEST['taxonomy'] ) ? $_REQUEST['taxonomy'] : '_invalid';
    454454
    455455                        switch ( $base ) {
    456456                                case 'post' :
  • wp-admin/edit.php

     
    99/** WordPress Administration Bootstrap */
    1010require_once( './admin.php' );
    1111
    12 if ( !isset($_GET['post_type']) )
    13         $post_type = 'post';
    14 elseif ( in_array( $_GET['post_type'], get_post_types( array('show_ui' => true ) ) ) )
    15         $post_type = $_GET['post_type'];
    16 else
    17         wp_die( __('Invalid post type') );
     12if ( ! $typenow )
     13        wp_die( __( 'Invalid post type' ) );
    1814
    19 $_GET['post_type'] = $post_type;
    20 
     15$post_type = $typenow;
    2116$post_type_object = get_post_type_object( $post_type );
    2217
     18if ( ! $post_type_object )
     19        wp_die( __('Invalid post type') );
     20
    2321if ( !current_user_can($post_type_object->cap->edit_posts) )
    2422        wp_die(__('Cheatin’ uh?'));
    2523