Die if invalid post type is passed. see #9674

git-svn-id: http://svn.automattic.com/wordpress/trunk@13537 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2010-03-01 20:33:03 +00:00
parent d71efc7362
commit 9f0db9355a
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 );
}
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'];
else
$post_type = 'post';
wp_die( __('Invalid post type') );
$_GET['post_type'] = $post_type;
$post_type_object = get_post_type_object($post_type);

View File

@ -9,10 +9,12 @@
/** Load WordPress Administration Bootstrap */
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'];
else
$post_type = 'post';
wp_die( __('Invalid post type') );
if ( 'post' != $post_type ) {
$parent_file = "edit.php?post_type=$post_type";