From 7cd8d225a31438ebe5941744e182b5b0a61a16a5 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 13 Nov 2013 02:40:28 +0000 Subject: [PATCH] Use case-insensitive comparison for email addresses. fixes #25779. git-svn-id: https://develop.svn.wordpress.org/trunk@26115 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/ms.php | 2 +- src/wp-includes/pluggable.php | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/wp-admin/includes/ms.php b/src/wp-admin/includes/ms.php index 7c3f4bba59..d7b47f2741 100644 --- a/src/wp-admin/includes/ms.php +++ b/src/wp-admin/includes/ms.php @@ -756,7 +756,7 @@ function revoke_super_admin( $user_id ) { $super_admins = get_site_option( 'site_admins', array( 'admin' ) ); $user = get_userdata( $user_id ); - if ( $user && $user->user_email != get_site_option( 'admin_email' ) ) { + if ( $user && 0 !== strcasecmp( $user->user_email, get_site_option( 'admin_email' ) ) ) { if ( false !== ( $key = array_search( $user->user_login, $super_admins ) ) ) { unset( $super_admins[$key] ); update_site_option( 'site_admins', $super_admins ); diff --git a/src/wp-includes/pluggable.php b/src/wp-includes/pluggable.php index bbb229830e..0eb167024f 100644 --- a/src/wp-includes/pluggable.php +++ b/src/wp-includes/pluggable.php @@ -1141,9 +1141,11 @@ function wp_notify_moderator($comment_id) { $post = get_post($comment->comment_post_ID); $user = get_userdata( $post->post_author ); // Send to the administration and to the post author if the author can modify the comment. - $emails = array( get_option('admin_email') ); - if ( user_can($user->ID, 'edit_comment', $comment_id) && !empty($user->user_email) && ( get_option('admin_email') != $user->user_email) ) - $emails[] = $user->user_email; + $emails = array( get_option( 'admin_email' ) ); + if ( user_can( $user->ID, 'edit_comment', $comment_id ) && ! empty( $user->user_email ) ) { + if ( 0 !== strcasecmp( $user->user_email, get_option( 'admin_email' ) ) ) + $emails[] = $user->user_email; + } $comment_author_domain = @gethostbyaddr($comment->comment_author_IP); $comments_waiting = $wpdb->get_var("SELECT count(comment_ID) FROM $wpdb->comments WHERE comment_approved = '0'"); @@ -1216,7 +1218,7 @@ if ( !function_exists('wp_password_change_notification') ) : function wp_password_change_notification(&$user) { // send a copy of password change notification to the admin // but check to see if it's the admin whose password we're changing, and skip this - if ( $user->user_email != get_option('admin_email') ) { + if ( 0 !== strcasecmp( $user->user_email, get_option( 'admin_email' ) ) ) { $message = sprintf(__('Password Lost and Changed for user: %s'), $user->user_login) . "\r\n"; // The blogname option is escaped with esc_html on the way into the database in sanitize_option // we want to reverse this for the plain text arena of emails.