From bb333c1c6f95e739ed6498897a55e9f0c8afa7aa Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Sat, 25 Nov 2006 16:27:33 +0000 Subject: [PATCH] Removed wfRangeStartEnd() and wfIsAddressInRange() -- avoid proliferation of global functions. --- includes/GlobalFunctions.php | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 02db709992..3d002f662f 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -2040,37 +2040,6 @@ function wfWikiID() { } } -/** - * Get the start and end of a range. - * @param $range The range to get the start and end for. - * @return array An array with the first element as the start of the range, as a long, and the second element as the end of the range, also as a long. - * - */ -function wfRangeStartEnd( $range ) { - list( $network, $bits ) = wfParseCIDR( $range ); - if ( $network !== false ) { - $start = sprintf( '%08X', $network ); - $end = sprintf( '%08X', $network + (1 << (32 - $bits)) - 1 ); - return array($start, $end); - } - return false; -} - -/** - * Determine if a given integer IPv4 address is in a given CIDR network - * @param $addr The address to check against the given range. - * @param $range The range to check the given address against. - * @return bool Whether or not the given address is in the given range. - */ -function wfIsAddressInRange( $addr, $range ) { - $unsignedIP = IP::toUnsigned($addr); - $startend = wfRangeStartEnd($range); - $start = $startend[0]; - $end = $startend[1]; - - return (($unsignedIP >= $start) && ($unsignedIP <= $end)); -} - /* * Get a Database object * @param integer $db Index of the connection to get. May be DB_MASTER for the -- 2.20.1