Ported proxy whitelist from REL1_4, also fixed broken $bFromSlave parameter (untested)
authorTim Starling <tstarling@users.mediawiki.org>
Sun, 29 May 2005 04:44:13 +0000 (04:44 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Sun, 29 May 2005 04:44:13 +0000 (04:44 +0000)
includes/DefaultSettings.php
includes/User.php

index 4cb9f45..c552e22 100644 (file)
@@ -1422,6 +1422,12 @@ $wgEnableSorbs = false;
  */
 $wgEnableOpm = false;
 
+/**
+ * Proxy whitelist, list of addresses that are assumed to be non-proxy despite what the other
+ * methods might say
+ */
+$wgProxyWhitelist = array();
+
 /**
  * Simple rate limiter options to brake edit floods.
  * Maximum number actions allowed in the given number of seconds;
index 7d637cb..a165947 100644 (file)
@@ -291,8 +291,8 @@ class User {
         * just slightly outta sync and soon corrected - safer to block slightly more that less.
         * And it's cheaper to check slave first, then master if needed, than master always.
         */
-       function getBlockedStatus() {
-               global $wgIP, $wgBlockCache, $wgProxyList, $wgEnableSorbs, $bFromSlave;
+       function getBlockedStatus( $bFromSlave = true ) {
+               global $wgIP, $wgBlockCache, $wgProxyList, $wgEnableSorbs, $wgProxyWhitelist;
 
                if ( -1 != $this->mBlockedby ) { return; }
 
@@ -326,21 +326,22 @@ class User {
                }
 
                # Proxy blocking
-               if ( !$this->mBlockedby ) {
+               if ( !$this->isSysop() && !in_array( $wgIP, $wgProxyWhitelist ) ) {
+               
+                       # Local list
                        if ( array_key_exists( $wgIP, $wgProxyList ) ) {
                                $this->mBlockedby = wfMsg( 'proxyblocker' );
                                $this->mBlockreason = wfMsg( 'proxyblockreason' );
                        }
-               }
 
-               # DNSBL
-               if ( !$this->mBlockedby && $wgEnableSorbs ) {
-                       if ( $this->inSorbsBlacklist( $wgIP ) ) {
-                               $this->mBlockedby = wfMsg( 'sorbs' );
-                               $this->mBlockreason = wfMsg( 'sorbsreason' );
+                       # DNSBL
+                       if ( !$this->mBlockedby && $wgEnableSorbs ) {
+                               if ( $this->inSorbsBlacklist( $wgIP ) ) {
+                                       $this->mBlockedby = wfMsg( 'sorbs' );
+                                       $this->mBlockreason = wfMsg( 'sorbsreason' );
+                               }
                        }
                }
-                       
        }
 
        function inSorbsBlacklist( $ip ) {