From cf69e6deb375d3b4b322fff7cef9425019068deb Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 2 Sep 2015 16:29:21 +0000 Subject: [PATCH] Provide more helpful feedback than just "Cheatin' uh?" for permission errors in `wp-admin/custom-header.php`. props ericlewis, kraftbj, lukecarbis, mrmist. fixes #33667. see #14530. Built from https://develop.svn.wordpress.org/trunk@33854 git-svn-id: http://core.svn.wordpress.org/trunk@33822 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/custom-header.php | 27 +++++++++++++++++++++------ wp-includes/version.php | 2 +- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/wp-admin/custom-header.php b/wp-admin/custom-header.php index e61feb781c..ba9bb72dd4 100644 --- a/wp-admin/custom-header.php +++ b/wp-admin/custom-header.php @@ -683,8 +683,13 @@ wp_nonce_field( 'custom-header-options', '_wpnonce-custom-header-options' ); ?> */ public function step_2() { check_admin_referer('custom-header-upload', '_wpnonce-custom-header-upload'); - if ( ! current_theme_supports( 'custom-header', 'uploads' ) ) - wp_die( __( 'Cheatin’ uh?' ), 403 ); + if ( ! current_theme_supports( 'custom-header', 'uploads' ) ) { + wp_die( + '

' . __( 'Cheatin’ uh?' ) . '

' . + '

' . __( 'The current theme does not support uploading a custom header image.' ) . '

', + 403 + ); + } if ( empty( $_POST ) && isset( $_GET['file'] ) ) { $attachment_id = absint( $_GET['file'] ); @@ -834,11 +839,21 @@ wp_nonce_field( 'custom-header-options', '_wpnonce-custom-header-options' ); ?> public function step_3() { check_admin_referer( 'custom-header-crop-image' ); - if ( ! current_theme_supports( 'custom-header', 'uploads' ) ) - wp_die( __( 'Cheatin’ uh?' ), 403 ); + if ( ! current_theme_supports( 'custom-header', 'uploads' ) ) { + wp_die( + '

' . __( 'Cheatin’ uh?' ) . '

' . + '

' . __( 'The current theme does not support uploading a custom header image.' ) . '

', + 403 + ); + } - if ( ! empty( $_POST['skip-cropping'] ) && ! ( current_theme_supports( 'custom-header', 'flex-height' ) || current_theme_supports( 'custom-header', 'flex-width' ) ) ) - wp_die( __( 'Cheatin’ uh?' ), 403 ); + if ( ! empty( $_POST['skip-cropping'] ) && ! ( current_theme_supports( 'custom-header', 'flex-height' ) || current_theme_supports( 'custom-header', 'flex-width' ) ) ) { + wp_die( + '

' . __( 'Cheatin’ uh?' ) . '

' . + '

' . __( 'The current theme does not support a flexible sized header image.' ) . '

', + 403 + ); + } if ( $_POST['oitar'] > 1 ) { $_POST['x1'] = $_POST['x1'] * $_POST['oitar']; diff --git a/wp-includes/version.php b/wp-includes/version.php index 3456c00163..9af9aca7c5 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-33853'; +$wp_version = '4.4-alpha-33854'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.