From: Arthur Richards Date: Tue, 21 Feb 2012 22:00:58 +0000 (+0000) Subject: Refactors the check if a particular IP is in the list of configured squid servers... X-Git-Tag: 1.31.0-rc.0~24585 X-Git-Url: http://git.cyclocoop.org/%24dirpuce/puce%24spip_lang_rtl.gif?a=commitdiff_plain;h=05e5a8196280f0aedc4a19deb26fca68068dad23;p=lhc%2Fweb%2Fwiklou.git Refactors the check if a particular IP is in the list of configured squid servers into its own function. --- diff --git a/includes/ProxyTools.php b/includes/ProxyTools.php index bdab3be24f..aa4ce44041 100644 --- a/includes/ProxyTools.php +++ b/includes/ProxyTools.php @@ -53,11 +53,20 @@ function wfGetIP() { * @return bool */ function wfIsTrustedProxy( $ip ) { - global $wgSquidServers, $wgSquidServersNoPurge; + $trusted = wfIsConfiguredProxy( $ip ); + wfRunHooks( 'IsTrustedProxy', array( &$ip, &$trusted ) ); + return $trusted; +} +/** + * Checks if an IP matches a proxy we've configured. + * @param $ip String + * @return bool + */ +function wfIsConfiguredProxy( $ip ) { + global $wgSquidServers, $wgSquidServersNoPurge; $trusted = in_array( $ip, $wgSquidServers ) || in_array( $ip, $wgSquidServersNoPurge ); - wfRunHooks( 'IsTrustedProxy', array( &$ip, &$trusted ) ); return $trusted; }