Docker compose #1

Merged
Nigel merged 2 commits from nigel_quick_fix into master 2020-11-21 14:06:41 +00:00
Showing only changes of commit 7df8c34fc5 - Show all commits

View File

@ -24,7 +24,7 @@ function bithex($var)
} }
function cxor($msg,$cle) function cxor($msg,$cle)
{ {
$xor = NULL; $xor = NULL;
for($i = 0; $i < strlen($msg);$i++) $xor .= substr($msg,$i,1) ^ substr($cle,$i % strlen($cle),1); for($i = 0; $i < strlen($msg);$i++) $xor .= substr($msg,$i,1) ^ substr($cle,$i % strlen($cle),1);
return $xor; return $xor;
@ -45,19 +45,19 @@ function uniquehash($var,$length=128,$raw=FALSE)
{ {
$hashs = array('tiger192,4','haval256,5','md5','snefru','gost','ripemd160','whirlpool'); $hashs = array('tiger192,4','haval256,5','md5','snefru','gost','ripemd160','whirlpool');
$r = hash('sha512',$var,TRUE); $r = hash('sha512',$var,TRUE);
foreach($hashs as $algo) $r = cxor(strrev($r),hash($algo,strrev($r),TRUE)); foreach($hashs as $algo) $r = cxor(strrev($r),hash($algo,strrev($r),TRUE));
if($length % 8 == 0 && $length >=128 && $length <= 512) $r = substr($r,0,$length/8); if($length % 8 == 0 && $length >=128 && $length <= 512) $r = substr($r,0,$length/8);
if(!$raw) $r = strhex($r); if(!$raw) $r = strhex($r);
return $r; return $r;
} }
function temphash($var,$length=128,$raw=FALSE) function temphash($var,$length=128,$raw=FALSE)
{ {
if(!$val = Cache::read('_temphash')) Cache::set('_temphash',$val = hexstr(random())); if(!$val = Cache::read('_temphash')) Cache::set('_temphash',$val = hexstr(random()));
return uniquehash(cxor($var,$val),$length,$raw); return uniquehash(cxor($var,$val),$length,$raw);
} }
@ -70,7 +70,7 @@ function decode_ip($int_ip)
function encode_ip($dotquad_ip=FALSE) function encode_ip($dotquad_ip=FALSE)
{ {
if(!$dotquad_ip) $dotquad_ip = $_SERVER['REMOTE_ADDR']; if(!$dotquad_ip) $dotquad_ip = $_SERVER['REMOTE_ADDR'];
$ip_sep = explode('.', $dotquad_ip); $ip_sep = explode('.', $dotquad_ip);
if (empty($ip_sep[3])) $ip_sep = explode('.', "127.0.0.1"); if (empty($ip_sep[3])) $ip_sep = explode('.', "127.0.0.1");
return sprintf('%02x%02x%02x%02x', $ip_sep[0], $ip_sep[1], $ip_sep[2], $ip_sep[3]); return sprintf('%02x%02x%02x%02x', $ip_sep[0], $ip_sep[1], $ip_sep[2], $ip_sep[3]);
@ -79,9 +79,9 @@ function encode_ip($dotquad_ip=FALSE)
function url($string,$external=FALSE) function url($string,$external=FALSE)
{ {
if($external) return htmlspecialchars($string); if($external) return htmlspecialchars($string);
global $VAR; global $VAR;
if(!empty($VAR['rewrite_url'])) if(!empty($VAR['rewrite_url']))
{ {
$masque = $VAR['rewrite_url']['masque']; $masque = $VAR['rewrite_url']['masque'];
@ -91,4 +91,4 @@ function url($string,$external=FALSE)
} }
else return htmlspecialchars($string); else return htmlspecialchars($string);
} }
?> ?>