WordPress.org

Make WordPress Core

Ticket #25663: 25663.2.diff

File 25663.2.diff, 2.7 KB (added by kovshenin, 6 years ago)
  • src/wp-admin/async-upload.php

     
    1313else
    1414        require_once( dirname( dirname( __FILE__ ) ) . '/wp-load.php' );
    1515
    16 if ( ! ( isset( $_REQUEST['action'] ) && 'upload-attachment' == $_REQUEST['action'] ) ) {
    17         // Flash often fails to send cookies with the POST or upload, so we need to pass it in GET or POST instead
    18         if ( is_ssl() && empty($_COOKIE[SECURE_AUTH_COOKIE]) && !empty($_REQUEST['auth_cookie']) )
    19                 $_COOKIE[SECURE_AUTH_COOKIE] = $_REQUEST['auth_cookie'];
    20         elseif ( empty($_COOKIE[AUTH_COOKIE]) && !empty($_REQUEST['auth_cookie']) )
    21                 $_COOKIE[AUTH_COOKIE] = $_REQUEST['auth_cookie'];
    22         if ( empty($_COOKIE[LOGGED_IN_COOKIE]) && !empty($_REQUEST['logged_in_cookie']) )
    23                 $_COOKIE[LOGGED_IN_COOKIE] = $_REQUEST['logged_in_cookie'];
    24         unset($current_user);
     16// Flash often fails to send cookies with the POST or upload, so we need to pass it in GET or POST instead
     17if ( 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'];
    2521}
    2622
     23if ( empty( $_COOKIE[LOGGED_IN_COOKIE] ) && ! empty( $_REQUEST['logged_in_cookie'] ) ) {
     24        $_COOKIE[LOGGED_IN_COOKIE] = $_REQUEST['logged_in_cookie'];
     25}
     26
     27unset( $current_user );
     28
    2729require_once( ABSPATH . 'wp-admin/admin.php' );
    2830
    2931if ( !current_user_can('upload_files') )
  • src/wp-admin/includes/media.php

     
    17431743
    17441744$post_params = array(
    17451745                "post_id" => $post_id,
     1746                "auth_cookie" => ( is_ssl() ? $_COOKIE[SECURE_AUTH_COOKIE] : $_COOKIE[AUTH_COOKIE] ),
     1747                "logged_in_cookie" => $_COOKIE[LOGGED_IN_COOKIE],
    17461748                "_wpnonce" => wp_create_nonce('media-form'),
    17471749                "type" => $_type,
    17481750                "tab" => $_tab,
  • src/wp-includes/media.php

     
    21862186
    21872187        $params = apply_filters( 'plupload_default_params', $params );
    21882188        $params['_wpnonce'] = wp_create_nonce( 'media-form' );
     2189        $params['auth_cookie'] = ( is_ssl() ? $_COOKIE[SECURE_AUTH_COOKIE] : $_COOKIE[AUTH_COOKIE] );
     2190        $params['logged_in_cookie'] = $_COOKIE[LOGGED_IN_COOKIE];
     2191
    21892192        $defaults['multipart_params'] = $params;
    21902193
    21912194        $settings = array(