Provide more helpful feedback than just "Cheatin' uh?" for permission errors in `wp-admin/options.php`.

props ericlewis, kraftbj, lukecarbis, mrmist.
fixes #33674. see #14530.
Built from https://develop.svn.wordpress.org/trunk@33863


git-svn-id: http://core.svn.wordpress.org/trunk@33831 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2015-09-02 18:31:21 +00:00
parent 5ceecc4eaf
commit a880c5c576
2 changed files with 15 additions and 5 deletions

View File

@ -44,8 +44,13 @@ if ( empty($option_page) ) {
$capability = apply_filters( "option_page_capability_{$option_page}", $capability ); $capability = apply_filters( "option_page_capability_{$option_page}", $capability );
} }
if ( !current_user_can( $capability ) ) if ( ! current_user_can( $capability ) ) {
wp_die( __( 'Cheatin’ uh?' ), 403 ); wp_die(
'<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
'<p>' . __( 'You are not allowed to manage these items.' ) . '</p>',
403
);
}
// Handle admin email change requests // Handle admin email change requests
if ( is_multisite() ) { if ( is_multisite() ) {
@ -68,8 +73,13 @@ if ( is_multisite() ) {
} }
} }
if ( is_multisite() && !is_super_admin() && 'update' != $action ) if ( is_multisite() && ! is_super_admin() && 'update' != $action ) {
wp_die( __( 'Cheatin&#8217; uh?' ), 403 ); wp_die(
'<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
'<p>' . __( 'You are not allowed to delete these items.' ) . '</p>',
403
);
}
$whitelist_options = array( $whitelist_options = array(
'general' => array( 'blogname', 'blogdescription', 'gmt_offset', 'date_format', 'time_format', 'start_of_week', 'timezone_string', 'WPLANG' ), 'general' => array( 'blogname', 'blogdescription', 'gmt_offset', 'date_format', 'time_format', 'start_of_week', 'timezone_string', 'WPLANG' ),

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.4-alpha-33862'; $wp_version = '4.4-alpha-33863';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.