user: Minor clean up of User::isLocallyBlockedProxy()
authorTimo Tijhof <krinklemail@gmail.com>
Sat, 17 Dec 2016 06:09:06 +0000 (22:09 -0800)
committerTimo Tijhof <krinklemail@gmail.com>
Sat, 17 Dec 2016 06:11:49 +0000 (22:11 -0800)
Change-Id: If8bcb2f26f14ce04ee23fb9500be95c8cdf1a967

includes/user/User.php

index 211c629..663c5da 100644 (file)
@@ -1780,21 +1780,22 @@ class User implements IDBAccessObject {
                }
 
                if ( !is_array( $wgProxyList ) ) {
-                       // Load from the specified file
+                       // Load values from the specified file
                        $wgProxyList = array_map( 'trim', file( $wgProxyList ) );
                }
 
-               if ( !is_array( $wgProxyList ) ) {
-                       $ret = false;
-               } elseif ( array_search( $ip, $wgProxyList ) !== false ) {
-                       $ret = true;
-               } elseif ( array_key_exists( $ip, $wgProxyList ) ) {
-                       // Old-style flipped proxy list
-                       $ret = true;
-               } else {
-                       $ret = false;
+               if ( is_array( $wgProxyList ) ) {
+                       if (
+                               // Look for IP as value
+                               array_search( $ip, $wgProxyList ) !== false ||
+                               // Look for IP as key (for backwards-compatility)
+                               array_key_exists( $ip, $wgProxyList )
+                       ) {
+                               return true;
+                       }
                }
-               return $ret;
+
+               return false;
        }
 
        /**