r11990 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r11989‎ | r11990 | r11991 >
Date:13:24, 6 December 2005
Author:timstarling
Status:old
Tags:
Comment:
Lazy initialisation of wgProxyList, no flip required
Modified paths:
  • /trunk/phase3/includes/ProxyTools.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/ProxyTools.php
@@ -175,4 +175,38 @@
176176 return array( $network, $bits );
177177 }
178178
 179+/**
 180+ * Check if an IP address is in the local proxy list
 181+ */
 182+function wfIsLocallyBlockedProxy( $ip ) {
 183+ global $wgProxyList;
 184+ $fname = 'wfIsLocallyBlockedProxy';
 185+
 186+ if ( !$wgProxyList ) {
 187+ return false;
 188+ }
 189+ wfProfileIn( $fname );
 190+
 191+ if ( !is_array( $wgProxyList ) ) {
 192+ # Load from the specified file
 193+ $wgProxyList = array_map( 'trim', file( $wgProxyList ) );
 194+ }
 195+
 196+ if ( !is_array( $wgProxyList ) ) {
 197+ $ret = false;
 198+ } elseif ( array_search( $ip, $wgProxyList ) !== false ) {
 199+ $ret = true;
 200+ } elseif ( array_key_exists( $ip, $wgProxyList ) ) {
 201+ # Old-style flipped proxy list
 202+ $ret = true;
 203+ } else {
 204+ $ret = false;
 205+ }
 206+ wfProfileOut( $fname );
 207+ return $ret;
 208+}
 209+
 210+
 211+
 212+
179213 ?>

Status & tagging log