r18913 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r18912‎ | r18913 | r18914 >
Date:06:58, 7 January 2007
Author:werdna
Status:old
Tags:
Comment:
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.
Modified paths:
  • /trunk/phase3/includes/Block.php (modified) (history)
  • /trunk/phase3/includes/User.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/User.php
@@ -836,15 +836,10 @@
837837 $this->mBlockedby = 0;
838838 $ip = wfGetIP();
839839
840 - if (!$this->isAllowed( 'ipblock-exempt' ) ) {
841 - # Check for IP blocks - ipblock-exempt is exempt from all types of IP block.
842 - $check_ip = $ip;
843 - }
844 -
845840 # User/IP blocking
846841 $this->mBlock = new Block();
847842 $this->mBlock->fromMaster( !$bFromSlave );
848 - if ( $this->mBlock->load( $check_ip , $this->mId ) ) {
 843+ if ( $this->mBlock->load( $ip , $this->mId ) ) {
849844 wfDebug( __METHOD__.": Found block.\n" );
850845 $this->mBlockedby = $this->mBlock->mBy;
851846 $this->mBlockreason = $this->mBlock->mReason;
@@ -860,14 +855,14 @@
861856 if ( !$this->isAllowed('proxyunbannable') && !in_array( $ip, $wgProxyWhitelist ) ) {
862857
863858 # Local list
864 - if ( wfIsLocallyBlockedProxy( $check_ip ) ) {
 859+ if ( wfIsLocallyBlockedProxy( $ip ) ) {
865860 $this->mBlockedby = wfMsg( 'proxyblocker' );
866861 $this->mBlockreason = wfMsg( 'proxyblockreason' );
867862 }
868863
869864 # DNSBL
870865 if ( !$this->mBlockedby && $wgEnableSorbs && !$this->getID() ) {
871 - if ( $this->inSorbsBlacklist( $check_ip ) ) {
 866+ if ( $this->inSorbsBlacklist( $ip ) ) {
872867 $this->mBlockedby = wfMsg( 'sorbs' );
873868 $this->mBlockreason = wfMsg( 'sorbsreason' );
874869 }
Index: trunk/phase3/includes/Block.php
@@ -126,6 +126,12 @@
127127 if ( $this->loadFromResult( $res, $killExpired ) ) {
128128 return true;
129129 }
 130+
 131+ $userObject = User::newFromId($user);
 132+
 133+ if ($userObject->isAllowed('ipblock-exempt') ) {
 134+ $address = '';
 135+ }
130136 }
131137
132138 # Try IP block