From ba16ce5730c509f6e3754bae7e1ed6fb131c8703 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Sat, 27 Sep 2008 20:04:27 +0000 Subject: [PATCH] Fix for r41108 (as per comment on bug 15642): Also disallow blocking anonymous users --- includes/specials/SpecialBlockip.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/includes/specials/SpecialBlockip.php b/includes/specials/SpecialBlockip.php index 7f99661410..eb84e41bd5 100644 --- a/includes/specials/SpecialBlockip.php +++ b/includes/specials/SpecialBlockip.php @@ -286,8 +286,7 @@ class IPBlockForm { * $userID and $expiry will be filled accordingly * @return array(message key, arguments) on failure, empty array on success */ - function doBlock(&$userId = null, &$expiry = null) - { + function doBlock( &$userId = null, &$expiry = null ) { global $wgUser, $wgSysopUserBans, $wgSysopRangeBans; $userId = 0; @@ -327,9 +326,6 @@ class IPBlockForm { # Username block if ( $wgSysopUserBans ) { $user = User::newFromName( $this->BlockAddress ); - if ( $wgUser->isBlocked() && ( $wgUser->getId !== $user->getId() ) ) { - return array( 'cant-block-while-blocked' ); - } if( !is_null( $user ) && $user->getId() ) { # Use canonical name $userId = $user->getId(); @@ -343,8 +339,12 @@ class IPBlockForm { } } + if ( $wgUser->isBlocked() && ( $wgUser->getId() !== $userId ) ) { + return array( 'cant-block-while-blocked' ); + } + $reasonstr = $this->BlockReasonList; - if ( $reasonstr != 'other' && $this->BlockReason != '') { + if ( $reasonstr != 'other' && $this->BlockReason != '' ) { // Entry from drop down menu + additional comment $reasonstr .= ': ' . $this->BlockReason; } elseif ( $reasonstr == 'other' ) { @@ -355,7 +355,7 @@ class IPBlockForm { if( $expirestr == 'other' ) $expirestr = $this->BlockOther; - if ((strlen($expirestr) == 0) || (strlen($expirestr) > 50)) { + if ( ( strlen( $expirestr ) == 0) || ( strlen( $expirestr ) > 50) ) { return array('ipb_expiry_invalid'); } -- 2.20.1