Update functions.php

This commit is contained in:
FusionPBX 2019-08-14 12:02:18 -06:00 committed by GitHub
parent ea5977fd28
commit 5b580a23ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 0 deletions

View File

@ -2147,4 +2147,19 @@ function number_pad($number,$n) {
}
}
//add a random_bytes function when it doesn't exist for older versions of PHP
if (!function_exists('random_bytes')) {
function random_bytes($length) {
$charset .= "0123456789";
$charset .= "abcdefghijkmnopqrstuvwxyz";
$charset .= "ABCDEFGHIJKLMNPQRSTUVWXYZ";
srand((double)microtime() * rand(1000000, 9999999));
while ($length > 0) {
$string .= $charset[rand(0, strlen($charset)-1)];
$length--;
}
return $string.' ';
}
}
?>