Don't allow non-image uploads for custom headers and backgrounds. props kovshenin. fixes #22149.
git-svn-id: http://core.svn.wordpress.org/trunk@22521 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -355,7 +355,13 @@ if ( current_theme_supports( 'custom-background', 'default-color' ) )
|
||||
|
||||
check_admin_referer('custom-background-upload', '_wpnonce-custom-background-upload');
|
||||
$overrides = array('test_form' => false);
|
||||
$file = wp_handle_upload($_FILES['import'], $overrides);
|
||||
|
||||
$uploaded_file = $_FILES['import'];
|
||||
$wp_filetype = wp_check_filetype_and_ext( $uploaded_file['tmp_name'], $uploaded_file['name'], false );
|
||||
if ( ! wp_match_mime_types( 'image', $wp_filetype['type'] ) )
|
||||
wp_die( __( 'The uploaded file is not a valid image. Please try again.' ) );
|
||||
|
||||
$file = wp_handle_upload($uploaded_file, $overrides);
|
||||
|
||||
if ( isset($file['error']) )
|
||||
wp_die( $file['error'] );
|
||||
|
||||
Reference in New Issue
Block a user