Make WordPress Core


Ignore:
Timestamp:
11/16/2014 05:46:35 AM (10 years ago)
Author:
johnbillion
Message:

Add some specific JSON responses when there are user permission errors for AJAX file uploads. Replace some usage of wp_json_encode() with wp_send_json_*().

See #25849
Props gcorne

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/async-upload.php

    r30244 r30354  
    3333require_once( ABSPATH . 'wp-admin/admin.php' );
    3434
    35 if ( !current_user_can('upload_files') )
    36     wp_die(__('You do not have permission to upload files.'));
    37 
    38 header('Content-Type: text/html; charset=' . get_option('blog_charset'));
    39 
    4035if ( isset( $_REQUEST['action'] ) && 'upload-attachment' === $_REQUEST['action'] ) {
    4136    include( ABSPATH . 'wp-admin/includes/ajax-actions.php' );
     
    4742    die( '0' );
    4843}
     44
     45if ( ! current_user_can( 'upload_files' ) ) {
     46    wp_die( __( 'You do not have permission to upload files.' ) );
     47}
     48
     49header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
    4950
    5051// just fetch the detail form for that attachment
Note: See TracChangeset for help on using the changeset viewer.