Project

General

Profile

Bug #17221 ยป patch_on_t3lib_div.diff

Administrator Admin, 2007-04-19 13:44

View differences:

class.t3lib_div.new.php Thu Apr 19 13:11:44 2007
$values = t3lib_div::trimExplode(',',$list,1);
foreach ($values as $test) {
list($test,$mask) = explode('/',$test);
$test = t3lib_div::normalizeIPv6($test); // normalize IP, otherwise following line always fails
if (t3lib_div::validIPv6($test)) {
$test = t3lib_div::normalizeIPv6($test);
if (intval($mask)) {
switch ($mask) { // test on /48 /64
case '48':
......
/**
* [Describe function...]
*
* @param [type] $hex: ...
* @param [type] $hex: normalized IPv6
* @return [type] ...
*/
function IPv6Hex2Bin ($hex) {
$bin = '';
$hex = str_replace(':', '', $hex); // Replace colon to nothing
for ($i=0; $i<strlen($hex); $i=$i+2) {
$bin.= chr(hexdec(substr($hex, $i, 2)));
}
for ($i=0; $i<strlen($hex); $i+=4) {
$binIP = base_convert(substr($hex, $i, 4), 16, 2);
$binIPLength = strlen($binIP);
while ($binIPLength < 16) { // fill block up with 0 at front
$bin .= "0";
$binIPLength += 1;
}
$bin .= $binIP;
}
return $bin;
}
    (1-1/1)