Index: trunk/phase3/includes/ProxyTools.php |
— | — | @@ -179,35 +179,3 @@ |
180 | 180 | $wgMemc->set( $mcKey, 1, $wgProxyMemcExpiry ); |
181 | 181 | } |
182 | 182 | } |
183 | | - |
184 | | -/** |
185 | | - * Check if an IP address is in the local proxy list |
186 | | - * @return bool |
187 | | - */ |
188 | | -function wfIsLocallyBlockedProxy( $ip ) { |
189 | | - global $wgProxyList; |
190 | | - |
191 | | - if ( !$wgProxyList ) { |
192 | | - return false; |
193 | | - } |
194 | | - wfProfileIn( __METHOD__ ); |
195 | | - |
196 | | - if ( !is_array( $wgProxyList ) ) { |
197 | | - # Load from the specified file |
198 | | - $wgProxyList = array_map( 'trim', file( $wgProxyList ) ); |
199 | | - } |
200 | | - |
201 | | - if ( !is_array( $wgProxyList ) ) { |
202 | | - $ret = false; |
203 | | - } elseif ( array_search( $ip, $wgProxyList ) !== false ) { |
204 | | - $ret = true; |
205 | | - } elseif ( array_key_exists( $ip, $wgProxyList ) ) { |
206 | | - # Old-style flipped proxy list |
207 | | - $ret = true; |
208 | | - } else { |
209 | | - $ret = false; |
210 | | - } |
211 | | - wfProfileOut( __METHOD__ ); |
212 | | - return $ret; |
213 | | -} |
214 | | - |
Index: trunk/phase3/includes/User.php |
— | — | @@ -1220,9 +1220,9 @@ |
1221 | 1221 | } |
1222 | 1222 | |
1223 | 1223 | # Proxy blocking |
1224 | | - if ( !$this->isAllowed( 'proxyunbannable' ) && !in_array( $ip, $wgProxyWhitelist ) ) { |
| 1224 | + if ( $ip !== null && !$this->isAllowed( 'proxyunbannable' ) && !in_array( $ip, $wgProxyWhitelist ) ) { |
1225 | 1225 | # Local list |
1226 | | - if ( wfIsLocallyBlockedProxy( $ip ) ) { |
| 1226 | + if ( self::isLocallyBlockedProxy( $ip ) ) { |
1227 | 1227 | $this->mBlockedby = wfMsg( 'proxyblocker' ); |
1228 | 1228 | $this->mBlockreason = wfMsg( 'proxyblockreason' ); |
1229 | 1229 | } |
— | — | @@ -1301,6 +1301,37 @@ |
1302 | 1302 | } |
1303 | 1303 | |
1304 | 1304 | /** |
| 1305 | + * Check if an IP address is in the local proxy list |
| 1306 | + * @return bool |
| 1307 | + */ |
| 1308 | + public static function isLocallyBlockedProxy( $ip ) { |
| 1309 | + global $wgProxyList; |
| 1310 | + |
| 1311 | + if ( !$wgProxyList ) { |
| 1312 | + return false; |
| 1313 | + } |
| 1314 | + wfProfileIn( __METHOD__ ); |
| 1315 | + |
| 1316 | + if ( !is_array( $wgProxyList ) ) { |
| 1317 | + # Load from the specified file |
| 1318 | + $wgProxyList = array_map( 'trim', file( $wgProxyList ) ); |
| 1319 | + } |
| 1320 | + |
| 1321 | + if ( !is_array( $wgProxyList ) ) { |
| 1322 | + $ret = false; |
| 1323 | + } elseif ( array_search( $ip, $wgProxyList ) !== false ) { |
| 1324 | + $ret = true; |
| 1325 | + } elseif ( array_key_exists( $ip, $wgProxyList ) ) { |
| 1326 | + # Old-style flipped proxy list |
| 1327 | + $ret = true; |
| 1328 | + } else { |
| 1329 | + $ret = false; |
| 1330 | + } |
| 1331 | + wfProfileOut( __METHOD__ ); |
| 1332 | + return $ret; |
| 1333 | + } |
| 1334 | + |
| 1335 | + /** |
1305 | 1336 | * Is this user subject to rate limiting? |
1306 | 1337 | * |
1307 | 1338 | * @return Bool True if rate limited |