From 1e975a47b05930de923dd8e7d1f325e160b62ae7 Mon Sep 17 00:00:00 2001 From: Andrew Garrett Date: Sun, 7 Jan 2007 06:58:21 +0000 Subject: [PATCH] Okay brion, this patch actually /works/. Thanks to the miracles of testing, I can now be certain that it does something other than give a PHP warning. --- includes/Block.php | 6 ++++++ includes/User.php | 11 +++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/includes/Block.php b/includes/Block.php index ff813ba3e4..644fd9c161 100644 --- a/includes/Block.php +++ b/includes/Block.php @@ -126,6 +126,12 @@ class Block if ( $this->loadFromResult( $res, $killExpired ) ) { return true; } + + $userObject = User::newFromId($user); + + if ($userObject->isAllowed('ipblock-exempt') ) { + $address = ''; + } } # Try IP block diff --git a/includes/User.php b/includes/User.php index 079e103c4c..c66c2d77bc 100644 --- a/includes/User.php +++ b/includes/User.php @@ -836,15 +836,10 @@ class User { $this->mBlockedby = 0; $ip = wfGetIP(); - if (!$this->isAllowed( 'ipblock-exempt' ) ) { - # Check for IP blocks - ipblock-exempt is exempt from all types of IP block. - $check_ip = $ip; - } - # User/IP blocking $this->mBlock = new Block(); $this->mBlock->fromMaster( !$bFromSlave ); - if ( $this->mBlock->load( $check_ip , $this->mId ) ) { + if ( $this->mBlock->load( $ip , $this->mId ) ) { wfDebug( __METHOD__.": Found block.\n" ); $this->mBlockedby = $this->mBlock->mBy; $this->mBlockreason = $this->mBlock->mReason; @@ -860,14 +855,14 @@ class User { if ( !$this->isAllowed('proxyunbannable') && !in_array( $ip, $wgProxyWhitelist ) ) { # Local list - if ( wfIsLocallyBlockedProxy( $check_ip ) ) { + if ( wfIsLocallyBlockedProxy( $ip ) ) { $this->mBlockedby = wfMsg( 'proxyblocker' ); $this->mBlockreason = wfMsg( 'proxyblockreason' ); } # DNSBL if ( !$this->mBlockedby && $wgEnableSorbs && !$this->getID() ) { - if ( $this->inSorbsBlacklist( $check_ip ) ) { + if ( $this->inSorbsBlacklist( $ip ) ) { $this->mBlockedby = wfMsg( 'sorbs' ); $this->mBlockreason = wfMsg( 'sorbsreason' ); } -- 2.20.1