Merge branch 'release-1.34'
This commit is contained in:
commit
e06912a995
|
@ -2643,4 +2643,19 @@ function random_colour() {
|
||||||
str_pad( dechex( mt_rand( 0, 255 ) ), 2, '0', STR_PAD_LEFT);
|
str_pad( dechex( mt_rand( 0, 255 ) ), 2, '0', STR_PAD_LEFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function zm_random_bytes($length = 32){
|
||||||
|
if ( !isset($length) || intval($length) <= 8 ) {
|
||||||
|
$length = 32;
|
||||||
|
}
|
||||||
|
if ( function_exists('random_bytes') ) {
|
||||||
|
return random_bytes($length);
|
||||||
|
}
|
||||||
|
if ( function_exists('mcrypt_create_iv') ) {
|
||||||
|
return mcrypt_create_iv($length, MCRYPT_DEV_URANDOM);
|
||||||
|
}
|
||||||
|
if ( function_exists('openssl_random_pseudo_bytes') ) {
|
||||||
|
return openssl_random_pseudo_bytes($length);
|
||||||
|
}
|
||||||
|
ZM\Error('No random_bytes function found.');
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -178,7 +178,7 @@ if ( isset($_REQUEST['view']) )
|
||||||
|
|
||||||
|
|
||||||
# Add CSP Headers
|
# Add CSP Headers
|
||||||
$cspNonce = bin2hex(openssl_random_pseudo_bytes(16));
|
$cspNonce = bin2hex(zm_random_bytes(16));
|
||||||
|
|
||||||
$request = null;
|
$request = null;
|
||||||
if ( isset($_REQUEST['request']) )
|
if ( isset($_REQUEST['request']) )
|
||||||
|
|
Loading…
Reference in New Issue