Die if invalid post type is passed. see #9674

git-svn-id: https://develop.svn.wordpress.org/trunk@13537 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2010-03-01 20:33:03 +00:00
parent 04899b5212
commit a37ca909a6
2 changed files with 8 additions and 4 deletions

View File

@ -20,10 +20,12 @@ if ( $_redirect = intval( max( @$_GET['p'], @$_GET['attachment_id'], @$_GET['pag
unset( $_redirect ); unset( $_redirect );
} }
if ( isset($_GET['post_type']) && ( in_array( $_GET['post_type'], get_post_types( array('public' => true ) ) ) ) ) if ( !isset($_GET['post_type']) )
$post_type = 'post';
elseif ( in_array( $_GET['post_type'], get_post_types( array('public' => true ) ) ) )
$post_type = $_GET['post_type']; $post_type = $_GET['post_type'];
else else
$post_type = 'post'; wp_die( __('Invalid post type') );
$_GET['post_type'] = $post_type; $_GET['post_type'] = $post_type;
$post_type_object = get_post_type_object($post_type); $post_type_object = get_post_type_object($post_type);

View File

@ -9,10 +9,12 @@
/** Load WordPress Administration Bootstrap */ /** Load WordPress Administration Bootstrap */
require_once('admin.php'); require_once('admin.php');
if ( isset($_GET['post_type']) && ( in_array( $_GET['post_type'], get_post_types( array('public' => true ) ) ) ) ) if ( !isset($_GET['post_type']) )
$post_type = 'post';
elseif ( in_array( $_GET['post_type'], get_post_types( array('public' => true ) ) ) )
$post_type = $_GET['post_type']; $post_type = $_GET['post_type'];
else else
$post_type = 'post'; wp_die( __('Invalid post type') );
if ( 'post' != $post_type ) { if ( 'post' != $post_type ) {
$parent_file = "edit.php?post_type=$post_type"; $parent_file = "edit.php?post_type=$post_type";