diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:30:02 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:30:02 -0400 |
commit | 1de335ad3f395ca6861085393ba366a9e3fb4a0d (patch) | |
tree | f1fdd326034e05177596851be6a7127615d81498 /includes/utils/IP.php | |
parent | 9c75fa8ff6d4d38ef552c00fef5969fb154765e8 (diff) | |
parent | f6d65e533c62f6deb21342d4901ece24497b433e (diff) |
Merge commit 'f6d65'
# Conflicts:
# skins/ArchLinux/ArchLinux.php
Diffstat (limited to 'includes/utils/IP.php')
-rw-r--r-- | includes/utils/IP.php | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/includes/utils/IP.php b/includes/utils/IP.php index 0e2db8cc..4441236d 100644 --- a/includes/utils/IP.php +++ b/includes/utils/IP.php @@ -629,6 +629,25 @@ class IP { } /** + * Determines if an IP address is a list of CIDR a.b.c.d/n ranges. + * + * @since 1.25 + * + * @param string $ip the IP to check + * @param array $ranges the IP ranges, each element a range + * + * @return bool true if the specified adress belongs to the specified range; otherwise, false. + */ + public static function isInRanges( $ip, $ranges ) { + foreach ( $ranges as $range ) { + if ( self::isInRange( $ip, $range ) ) { + return true; + } + } + return false; + } + + /** * Convert some unusual representations of IPv4 addresses to their * canonical dotted quad representation. * @@ -698,7 +717,7 @@ class IP { */ public static function isTrustedProxy( $ip ) { $trusted = self::isConfiguredProxy( $ip ); - wfRunHooks( 'IsTrustedProxy', array( &$ip, &$trusted ) ); + Hooks::run( 'IsTrustedProxy', array( &$ip, &$trusted ) ); return $trusted; } @@ -712,7 +731,6 @@ class IP { public static function isConfiguredProxy( $ip ) { global $wgSquidServers, $wgSquidServersNoPurge; - wfProfileIn( __METHOD__ ); // Quick check of known singular proxy servers $trusted = in_array( $ip, $wgSquidServers ); @@ -723,7 +741,6 @@ class IP { } $trusted = self::$proxyIpSet->match( $ip ); } - wfProfileOut( __METHOD__ ); return $trusted; } |