From: Tim Starling Date: Sat, 25 Nov 2006 16:27:33 +0000 (+0000) Subject: Removed wfRangeStartEnd() and wfIsAddressInRange() -- avoid proliferation of global... X-Git-Tag: 1.31.0-rc.0~55082 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/password.php?a=commitdiff_plain;h=bb333c1c6f95e739ed6498897a55e9f0c8afa7aa;p=lhc%2Fweb%2Fwiklou.git Removed wfRangeStartEnd() and wfIsAddressInRange() -- avoid proliferation of global functions. --- 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