Coding Standards: Use strict comparison in `wp-admin/options.php`.

Follow-up to [21852], [47874], [51075].

See #53359.
Built from https://develop.svn.wordpress.org/trunk@52431


git-svn-id: http://core.svn.wordpress.org/trunk@52023 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2022-01-03 21:28:01 +00:00
parent ed53ea3ace
commit 65ebdf45d8
2 changed files with 11 additions and 4 deletions

View File

@ -57,12 +57,17 @@ if ( ! current_user_can( $capability ) ) {
if ( ! empty( $_GET['adminhash'] ) ) { if ( ! empty( $_GET['adminhash'] ) ) {
$new_admin_details = get_option( 'adminhash' ); $new_admin_details = get_option( 'adminhash' );
$redirect = 'options-general.php?updated=false'; $redirect = 'options-general.php?updated=false';
if ( is_array( $new_admin_details ) && hash_equals( $new_admin_details['hash'], $_GET['adminhash'] ) && ! empty( $new_admin_details['newemail'] ) ) {
if ( is_array( $new_admin_details )
&& hash_equals( $new_admin_details['hash'], $_GET['adminhash'] )
&& ! empty( $new_admin_details['newemail'] )
) {
update_option( 'admin_email', $new_admin_details['newemail'] ); update_option( 'admin_email', $new_admin_details['newemail'] );
delete_option( 'adminhash' ); delete_option( 'adminhash' );
delete_option( 'new_admin_email' ); delete_option( 'new_admin_email' );
$redirect = 'options-general.php?updated=true'; $redirect = 'options-general.php?updated=true';
} }
wp_redirect( admin_url( $redirect ) ); wp_redirect( admin_url( $redirect ) );
exit; exit;
} elseif ( ! empty( $_GET['dismiss'] ) && 'new_admin_email' === $_GET['dismiss'] ) { } elseif ( ! empty( $_GET['dismiss'] ) && 'new_admin_email' === $_GET['dismiss'] ) {
@ -73,7 +78,7 @@ if ( ! empty( $_GET['adminhash'] ) ) {
exit; exit;
} }
if ( is_multisite() && ! current_user_can( 'manage_network_options' ) && 'update' != $action ) { if ( is_multisite() && ! current_user_can( 'manage_network_options' ) && 'update' !== $action ) {
wp_die( wp_die(
'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' . '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
'<p>' . __( 'Sorry, you are not allowed to delete these items.' ) . '</p>', '<p>' . __( 'Sorry, you are not allowed to delete these items.' ) . '</p>',
@ -183,7 +188,9 @@ if ( ! is_multisite() ) {
* or upload_path is not the default ('wp-content/uploads' or empty), * or upload_path is not the default ('wp-content/uploads' or empty),
* they can be edited, otherwise they're locked. * they can be edited, otherwise they're locked.
*/ */
if ( get_option( 'upload_url_path' ) || ( get_option( 'upload_path' ) != 'wp-content/uploads' && get_option( 'upload_path' ) ) ) { if ( get_option( 'upload_url_path' )
|| get_option( 'upload_path' ) && 'wp-content/uploads' !== get_option( 'upload_path' )
) {
$allowed_options['media'][] = 'upload_path'; $allowed_options['media'][] = 'upload_path';
$allowed_options['media'][] = 'upload_url_path'; $allowed_options['media'][] = 'upload_url_path';
} }

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.9-beta4-52430'; $wp_version = '5.9-beta4-52431';
/** /**
* 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.