Make WordPress Core


Ignore:
Timestamp:
11/21/2012 12:27:12 PM (14 years ago)
Author:
nacin
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/media-new.php

    r22751 r22752  
    2222wp_enqueue_script( 'media-gallery' );
    2323
     24$errors = array();
    2425
    25 // IDs should be integers
    26 $ID = isset($ID) ? (int) $ID : 0;
    27 $post_id = isset($post_id)? (int) $post_id : 0;
     26unset( $_REQUEST['post_id'] );
    2827
    29 // Require an ID for the edit screen
    30 if ( isset($action) && $action == 'edit' && !$ID )
    31         wp_die( __( 'Cheatin’ uh?' ) );
    32 
    33         $errors = array();
    34 
    35         if ( ! empty( $_REQUEST['post_id'] ) && ! current_user_can( 'edit_post' , $_REQUEST['post_id'] ) )
    36                 wp_die( __( 'Cheatin’ uh?' ) );
    37 
     28if ( $_POST ) {
    3829        if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
    3930                check_admin_referer('media-form');
     
    4738        }
    4839
    49         if ( isset($_GET['upload-page-form']) ) {
    50                 $errors = array_merge($errors, (array) media_upload_form_handler());
     40        $errors = array_merge($errors, (array) media_upload_form_handler());
    5141
    52                 $location = 'upload.php';
    53                 if ( $errors )
    54                         $location .= '?message=3';
     42        $location = 'upload.php';
     43        if ( $errors )
     44                $location .= '?message=3';
    5545
    56                 wp_redirect( admin_url($location) );
    57                 exit;
    58         }
    59 
    60         if ( isset( $_REQUEST['post_id'] ) )
    61                 wp_die( __( 'Cheatin’ uh?' ) );
     46        wp_redirect( admin_url($location) );
     47        exit;
     48}
    6249
    6350        $title = __('Upload New Media');
     
    9279        <h2><?php echo esc_html( $title ); ?></h2>
    9380
    94         <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">
     81        <form enctype="multipart/form-data" method="post" action="<?php echo admin_url('media-new.php'); ?>" class="<?php echo $form_class; ?>" id="file-form">
    9582
    9683        <?php media_upload_form(); ?>
Note: See TracChangeset for help on using the changeset viewer.