WordPress.org

Make WordPress Core

Ticket #22622: 22622.diff

File 22622.diff, 1.6 KB (added by nacin, 17 months ago)
  • wp-admin/async-upload.php

     
    66 * @subpackage Administration 
    77 */ 
    88 
    9 define('WP_ADMIN', true); 
    10  
    11 if ( defined('ABSPATH') ) 
    12         require_once(ABSPATH . 'wp-load.php'); 
    13 else 
    14         require_once('../wp-load.php'); 
    15  
    16 // Flash often fails to send cookies with the POST or upload, so we need to pass it in GET or POST instead 
    17 if ( is_ssl() && empty($_COOKIE[SECURE_AUTH_COOKIE]) && !empty($_REQUEST['auth_cookie']) ) 
    18         $_COOKIE[SECURE_AUTH_COOKIE] = $_REQUEST['auth_cookie']; 
    19 elseif ( empty($_COOKIE[AUTH_COOKIE]) && !empty($_REQUEST['auth_cookie']) ) 
    20         $_COOKIE[AUTH_COOKIE] = $_REQUEST['auth_cookie']; 
    21 if ( empty($_COOKIE[LOGGED_IN_COOKIE]) && !empty($_REQUEST['logged_in_cookie']) ) 
    22         $_COOKIE[LOGGED_IN_COOKIE] = $_REQUEST['logged_in_cookie']; 
    23 unset($current_user); 
    249require_once('./admin.php'); 
    2510 
    26 header('Content-Type: text/html; charset=' . get_option('blog_charset')); 
    27  
    2811if ( !current_user_can('upload_files') ) 
    2912        wp_die(__('You do not have permission to upload files.')); 
    3013 
     14header('Content-Type: text/html; charset=' . get_option('blog_charset')); 
     15 
     16if ( isset( $_REQUEST['action'] ) && 'upload-attachment' === $_REQUEST['action'] ) { 
     17        include ABSPATH . 'wp-admin/includes/ajax-actions.php'; 
     18 
     19        send_nosniff_header(); 
     20        nocache_headers(); 
     21 
     22        do_action( 'wp_ajax_upload_attachment' ); 
     23        die( '0' ); 
     24} 
     25 
    3126// just fetch the detail form for that attachment 
    3227if ( isset($_REQUEST['attachment_id']) && ($id = intval($_REQUEST['attachment_id'])) && $_REQUEST['fetch'] ) { 
    3328        $post = get_post( $id );