r18910 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r18909‎ | r18910 | r18911 >
Date:06:21, 7 January 2007
Author:werdna
Status:old
Tags:
Comment:
Fix for r18904 where autoblocker would not correctly block ipblock-exempt users.
Modified paths:
  • /trunk/phase3/includes/User.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/User.php
@@ -836,15 +836,15 @@
837837 $this->mBlockedby = 0;
838838 $ip = wfGetIP();
839839
840 - if ($this->isAllowed( 'ipblock-exempt' ) ) {
841 - # Exempt from all types of IP-block
842 - $ip = null;
 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;
843843 }
844844
845845 # User/IP blocking
846846 $this->mBlock = new Block();
847847 $this->mBlock->fromMaster( !$bFromSlave );
848 - if ( $this->mBlock->load( $ip , $this->mId ) ) {
 848+ if ( $this->mBlock->load( $check_ip , $this->mId ) ) {
849849 wfDebug( __METHOD__.": Found block.\n" );
850850 $this->mBlockedby = $this->mBlock->mBy;
851851 $this->mBlockreason = $this->mBlock->mReason;
@@ -860,14 +860,14 @@
861861 if ( !$this->isAllowed('proxyunbannable') && !in_array( $ip, $wgProxyWhitelist ) ) {
862862
863863 # Local list
864 - if ( wfIsLocallyBlockedProxy( $ip ) ) {
 864+ if ( wfIsLocallyBlockedProxy( $check_ip ) ) {
865865 $this->mBlockedby = wfMsg( 'proxyblocker' );
866866 $this->mBlockreason = wfMsg( 'proxyblockreason' );
867867 }
868868
869869 # DNSBL
870870 if ( !$this->mBlockedby && $wgEnableSorbs && !$this->getID() ) {
871 - if ( $this->inSorbsBlacklist( $ip ) ) {
 871+ if ( $this->inSorbsBlacklist( $check_ip ) ) {
872872 $this->mBlockedby = wfMsg( 'sorbs' );
873873 $this->mBlockreason = wfMsg( 'sorbsreason' );
874874 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r18904* (bug 3706) Allow users to be exempted from IP blocks. The ipblock-exempt pe...werdna03:23, 7 January 2007