From: Aaron Schulz Date: Mon, 12 Mar 2007 19:31:30 +0000 (+0000) Subject: *Automatic address expansion, remove redundant check X-Git-Tag: 1.31.0-rc.0~53791 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=commitdiff_plain;h=0bbc7cbe3474f7971b04e558eb2a87e935daaa47;p=lhc%2Fweb%2Fwiklou.git *Automatic address expansion, remove redundant check --- diff --git a/includes/Block.php b/includes/Block.php index 00befac4d6..4d7325e175 100644 --- a/includes/Block.php +++ b/includes/Block.php @@ -26,6 +26,8 @@ class Block $timestamp = '' , $auto = 0, $expiry = '', $anonOnly = 0, $createAccount = 0, $enableAutoblock = 0 ) { $this->mId = 0; + # Expand valid IPv6 addresses + $address = IP::expandIP( $address ); $this->mAddress = $address; $this->mUser = $user; $this->mBy = $by; diff --git a/includes/SpecialBlockip.php b/includes/SpecialBlockip.php index 13cb0b16d5..41a0f5d7b1 100644 --- a/includes/SpecialBlockip.php +++ b/includes/SpecialBlockip.php @@ -199,11 +199,9 @@ class IPBlockForm { $userId = 0; $this->BlockAddress = trim( $this->BlockAddress ); - # Expand valid IPv6 addresses - if ( IP::isIPAddress( $this->BlockAddress ) ) { - $this->BlockAddress = IP::expandIP( $this->BlockAddress ); - } - # The above validation is good enough that those below will suffice from here + # Expand valid IPv6 addresses, usernames are left as is + $this->BlockAddress = IP::expandIP( $this->BlockAddress ); + # isIPv4() and IPv6() are used for final validation $rxIP4 = '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}'; $rxIP6 = '\w{1,4}:\w{1,4}:\w{1,4}:\w{1,4}:\w{1,4}:\w{1,4}:\w{1,4}:\w{1,4}'; $rxIP = "($rxIP4|$rxIP6)";