Skip to content

Commit 8da02a8

Browse files
Coding Standards: Use strict comparison in wpmu_validate_blog_signup().
Follow-up to [https://mu.trac.wordpress.org/changeset/8 mu:8], [https://mu.trac.wordpress.org/changeset/543 mu:543], [https://mu.trac.wordpress.org/changeset/550 mu:550], [https://mu.trac.wordpress.org/changeset/1364 mu:1364], [https://mu.trac.wordpress.org/changeset/1958 mu:1958], [12603], [32733]. Props debarghyabanerjee, aristath, poena, afercia, SergeyBiryukov. See #62279, #62283. git-svn-id: https://develop.svn.wordpress.org/trunk@59573 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 016bbec commit 8da02a8

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/wp-includes/ms-functions.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -481,10 +481,12 @@ function wpmu_validate_user_signup( $user_name, $user_email ) {
481481
}
482482

483483
$illegal_names = get_site_option( 'illegal_names' );
484+
484485
if ( ! is_array( $illegal_names ) ) {
485486
$illegal_names = array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator' );
486487
add_site_option( 'illegal_names', $illegal_names );
487488
}
489+
488490
if ( in_array( $user_name, $illegal_names, true ) ) {
489491
$errors->add( 'user_name', __( 'Sorry, that username is not allowed.' ) );
490492
}
@@ -516,10 +518,12 @@ function wpmu_validate_user_signup( $user_name, $user_email ) {
516518
}
517519

518520
$limited_email_domains = get_site_option( 'limited_email_domains' );
521+
519522
if ( is_array( $limited_email_domains ) && ! empty( $limited_email_domains ) ) {
520523
$limited_email_domains = array_map( 'strtolower', $limited_email_domains );
521-
$emaildomain = strtolower( substr( $user_email, 1 + strpos( $user_email, '@' ) ) );
522-
if ( ! in_array( $emaildomain, $limited_email_domains, true ) ) {
524+
$email_domain = strtolower( substr( $user_email, 1 + strpos( $user_email, '@' ) ) );
525+
526+
if ( ! in_array( $email_domain, $limited_email_domains, true ) ) {
523527
$errors->add( 'user_email', __( 'Sorry, that email address is not allowed!' ) );
524528
}
525529
}
@@ -637,7 +641,8 @@ function wpmu_validate_blog_signup( $blogname, $blog_title, $user = '' ) {
637641

638642
$errors = new WP_Error();
639643
$illegal_names = get_site_option( 'illegal_names' );
640-
if ( false == $illegal_names ) {
644+
645+
if ( ! is_array( $illegal_names ) ) {
641646
$illegal_names = array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator' );
642647
add_site_option( 'illegal_names', $illegal_names );
643648
}
@@ -721,7 +726,7 @@ function wpmu_validate_blog_signup( $blogname, $blog_title, $user = '' ) {
721726
* unless it's the user's own username.
722727
*/
723728
if ( username_exists( $blogname ) ) {
724-
if ( ! is_object( $user ) || ( is_object( $user ) && ( $user->user_login != $blogname ) ) ) {
729+
if ( ! is_object( $user ) || ( is_object( $user ) && ( $user->user_login !== $blogname ) ) ) {
725730
$errors->add( 'blogname', __( 'Sorry, that site is reserved!' ) );
726731
}
727732
}

0 commit comments

Comments
 (0)