aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions.php
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2007-05-13 20:09:33 +0000
committerNils Adermann <naderman@naderman.de>2007-05-13 20:09:33 +0000
commit36cb62292fde86ab15875e5c2d54d024eb6fd878 (patch)
tree8fd927aeecc98c212f3fc67a5b9ab4b7468f9e4c /phpBB/includes/functions.php
parentf1b60939fd5ac8be9f0c9db4a65eca94d1222340 (diff)
downloadforums-36cb62292fde86ab15875e5c2d54d024eb6fd878.tar
forums-36cb62292fde86ab15875e5c2d54d024eb6fd878.tar.gz
forums-36cb62292fde86ab15875e5c2d54d024eb6fd878.tar.bz2
forums-36cb62292fde86ab15875e5c2d54d024eb6fd878.tar.xz
forums-36cb62292fde86ab15875e5c2d54d024eb6fd878.zip
- use /48 and /64 subnets for IPv6 matching [Bug #9538]
git-svn-id: file:///svn/phpbb/trunk@7561 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r--phpBB/includes/functions.php10
1 files changed, 7 insertions, 3 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 079d09ac94..5cbb3b4515 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -3411,9 +3411,10 @@ function get_preg_expression($mode)
}
/**
-* Returns the first 4 blocks of the specified IPv6 address and as many
-* as specified in the length paramater additional ones.
+* Returns the first block of the specified IPv6 address and as many additional
+* ones as specified in the length paramater.
* If length is zero, then an empty string is returned.
+* If length is greater than 3 the complete IP will be returned
*/
function short_ipv6($ip, $length)
{
@@ -3432,7 +3433,10 @@ function short_ipv6($ip, $length)
{
$ip = '0000' . $ip;
}
- $ip = implode(':', array_slice(explode(':', $ip), 0, 4 + $length));
+ if ($length < 4)
+ {
+ $ip = implode(':', array_slice(explode(':', $ip), 0, 1 + $length));
+ }
return $ip;
}