Remove cruft from media-new.php. No need to keep extra parameters around (including post ID, which is always 0 here). see #22083.

git-svn-id: http://core.svn.wordpress.org/trunk@22752 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2012-11-21 12:27:12 +00:00
parent f6b9a928e5
commit 07a0349e2c
1 changed files with 11 additions and 24 deletions

View File

@ -21,20 +21,11 @@ wp_enqueue_script('set-post-thumbnail' );
wp_enqueue_style('imgareaselect');
wp_enqueue_script( 'media-gallery' );
$errors = array();
// IDs should be integers
$ID = isset($ID) ? (int) $ID : 0;
$post_id = isset($post_id)? (int) $post_id : 0;
// Require an ID for the edit screen
if ( isset($action) && $action == 'edit' && !$ID )
wp_die( __( 'Cheatin’ uh?' ) );
$errors = array();
if ( ! empty( $_REQUEST['post_id'] ) && ! current_user_can( 'edit_post' , $_REQUEST['post_id'] ) )
wp_die( __( 'Cheatin’ uh?' ) );
unset( $_REQUEST['post_id'] );
if ( $_POST ) {
if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
check_admin_referer('media-form');
// Upload File button was clicked
@ -46,19 +37,15 @@ if ( isset($action) && $action == 'edit' && !$ID )
}
}
if ( isset($_GET['upload-page-form']) ) {
$errors = array_merge($errors, (array) media_upload_form_handler());
$errors = array_merge($errors, (array) media_upload_form_handler());
$location = 'upload.php';
if ( $errors )
$location .= '?message=3';
$location = 'upload.php';
if ( $errors )
$location .= '?message=3';
wp_redirect( admin_url($location) );
exit;
}
if ( isset( $_REQUEST['post_id'] ) )
wp_die( __( 'Cheatin’ uh?' ) );
wp_redirect( admin_url($location) );
exit;
}
$title = __('Upload New Media');
$parent_file = 'upload.php';
@ -91,7 +78,7 @@ if ( isset($action) && $action == 'edit' && !$ID )
<?php screen_icon(); ?>
<h2><?php echo esc_html( $title ); ?></h2>
<form enctype="multipart/form-data" method="post" action="<?php echo admin_url('media-new.php?inline=&amp;upload-page-form='); ?>" class="<?php echo $form_class; ?>" id="file-form">
<form enctype="multipart/form-data" method="post" action="<?php echo admin_url('media-new.php'); ?>" class="<?php echo $form_class; ?>" id="file-form">
<?php media_upload_form(); ?>