From: Timo Tijhof Date: Sat, 17 Dec 2016 06:09:06 +0000 (-0800) Subject: user: Minor clean up of User::isLocallyBlockedProxy() X-Git-Tag: 1.31.0-rc.0~4533^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20%20%20%24self2%20.%20%20%20%22&var_mode_affiche=boucle?a=commitdiff_plain;h=57290f6926e56498a6e76f52e00a4e5b9b2aedc1;p=lhc%2Fweb%2Fwiklou.git user: Minor clean up of User::isLocallyBlockedProxy() Change-Id: If8bcb2f26f14ce04ee23fb9500be95c8cdf1a967 --- diff --git a/includes/user/User.php b/includes/user/User.php index 211c629750..663c5da4f8 100644 --- a/includes/user/User.php +++ b/includes/user/User.php @@ -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; } /**