Escape the output in `wp_ajax_upload_attachment()`.
Merges [45936] to the 4.4 branch. Props whyisjake, sstoqnov. Built from https://develop.svn.wordpress.org/branches/4.4@45951 git-svn-id: http://core.svn.wordpress.org/branches/4.4@45762 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
b82d7057c6
commit
51be1d635c
|
@ -32,7 +32,7 @@ if ( ! ( isset( $_REQUEST['action'] ) && 'upload-attachment' == $_REQUEST['actio
|
||||||
|
|
||||||
require_once( ABSPATH . 'wp-admin/admin.php' );
|
require_once( ABSPATH . 'wp-admin/admin.php' );
|
||||||
|
|
||||||
header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
|
header( 'Content-Type: text/plain; charset=' . get_option( 'blog_charset' ) );
|
||||||
|
|
||||||
if ( isset( $_REQUEST['action'] ) && 'upload-attachment' === $_REQUEST['action'] ) {
|
if ( isset( $_REQUEST['action'] ) && 'upload-attachment' === $_REQUEST['action'] ) {
|
||||||
include( ABSPATH . 'wp-admin/includes/ajax-actions.php' );
|
include( ABSPATH . 'wp-admin/includes/ajax-actions.php' );
|
||||||
|
|
|
@ -1996,7 +1996,7 @@ function wp_ajax_upload_attachment() {
|
||||||
'success' => false,
|
'success' => false,
|
||||||
'data' => array(
|
'data' => array(
|
||||||
'message' => __( 'You do not have permission to upload files.' ),
|
'message' => __( 'You do not have permission to upload files.' ),
|
||||||
'filename' => $_FILES['async-upload']['name'],
|
'filename' => esc_html( $_FILES['async-upload']['name'] ),
|
||||||
)
|
)
|
||||||
) );
|
) );
|
||||||
|
|
||||||
|
@ -2010,7 +2010,7 @@ function wp_ajax_upload_attachment() {
|
||||||
'success' => false,
|
'success' => false,
|
||||||
'data' => array(
|
'data' => array(
|
||||||
'message' => __( "You don't have permission to attach files to this post." ),
|
'message' => __( "You don't have permission to attach files to this post." ),
|
||||||
'filename' => $_FILES['async-upload']['name'],
|
'filename' => esc_html( $_FILES['async-upload']['name'] ),
|
||||||
)
|
)
|
||||||
) );
|
) );
|
||||||
|
|
||||||
|
@ -2034,7 +2034,7 @@ function wp_ajax_upload_attachment() {
|
||||||
'success' => false,
|
'success' => false,
|
||||||
'data' => array(
|
'data' => array(
|
||||||
'message' => __( 'The uploaded file is not a valid image. Please try again.' ),
|
'message' => __( 'The uploaded file is not a valid image. Please try again.' ),
|
||||||
'filename' => $_FILES['async-upload']['name'],
|
'filename' => esc_html( $_FILES['async-upload']['name'] ),
|
||||||
)
|
)
|
||||||
) );
|
) );
|
||||||
|
|
||||||
|
@ -2049,7 +2049,7 @@ function wp_ajax_upload_attachment() {
|
||||||
'success' => false,
|
'success' => false,
|
||||||
'data' => array(
|
'data' => array(
|
||||||
'message' => $attachment_id->get_error_message(),
|
'message' => $attachment_id->get_error_message(),
|
||||||
'filename' => $_FILES['async-upload']['name'],
|
'filename' => esc_html( $_FILES['async-upload']['name'] ),
|
||||||
)
|
)
|
||||||
) );
|
) );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue