Fix rangeblock detection
authorAlex Z <mrzman@users.mediawiki.org>
Sat, 1 Nov 2008 21:46:47 +0000 (21:46 +0000)
committerAlex Z <mrzman@users.mediawiki.org>
Sat, 1 Nov 2008 21:46:47 +0000 (21:46 +0000)
includes/specials/SpecialBlockip.php

index c04cf96..15edf74 100644 (file)
@@ -100,9 +100,12 @@ class IPBlockForm {
                        if ( is_object( $user ) )
                                $userId = $user->getId();
                        $currentBlock = Block::newFromDB( $this->BlockAddress, $userId );
-                       if ( !is_null($currentBlock) && !$currentBlock->mAuto && !($currentBlock->mRangeStart && $currentBlock->mAddress != $this->BlockAddress) ) {
-                               $wgOut->addWikiMsg( 'ipb-needreblock', $this->BlockAddress );
-                               $alreadyBlocked = true;
+                       if ( !is_null($currentBlock) && !$currentBlock->mAuto && # The block exists and isn't an autoblock
+                               ( $currentBlock->mRangeStart == $currentBlock->mRangeEnd || # The block isn't a rangeblock
+                               # or if it is, the range is what we're about to block
+                               ( $currentBlock->mAddress == $this->BlockAddress ) ) ) {
+                                       $wgOut->addWikiMsg( 'ipb-needreblock', $this->BlockAddress );
+                                       $alreadyBlocked = true;
                        }
                }