Fix for php8
This commit is contained in:
parent
d7225327e7
commit
f22017080d
@ -75,7 +75,7 @@ if ($time >= $_SESSION['auto_check_events_not_before'])
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||
|
||||
|
||||
dol_syslog('NEW $_SESSION[auto_check_events_not_before]='.$_SESSION['auto_check_events_not_before']);
|
||||
dol_syslog('NEW $_SESSION[auto_check_events_not_before]='.(empty($_SESSION['auto_check_events_not_before']) ? '' : $_SESSION['auto_check_events_not_before']));
|
||||
|
||||
$sql = 'SELECT id';
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'actioncomm a, ' . MAIN_DB_PREFIX . 'actioncomm_resources ar';
|
||||
|
||||
@ -467,15 +467,18 @@ function getRandomPassword($generic = false, $replaceambiguouschars = null, $len
|
||||
{
|
||||
$max = strlen($lowercase) - 1;
|
||||
for ($x = 0; $x < $nbofchar; $x++) {
|
||||
$randomCode .= $lowercase{random_int(0, $max)};
|
||||
$tmp = random_int(0, $max);
|
||||
$randomCode .= $lowercase[$tmp];
|
||||
}
|
||||
$max = strlen($uppercase) - 1;
|
||||
for ($x = 0; $x < $nbofchar; $x++) {
|
||||
$randomCode .= $uppercase{random_int(0, $max)};
|
||||
$tmp = random_int(0, $max);
|
||||
$randomCode .= $uppercase[$tmp];
|
||||
}
|
||||
$max = strlen($numbers) - 1;
|
||||
for ($x = 0; $x < $nbofcharlast; $x++) {
|
||||
$randomCode .= $numbers{random_int(0, $max)};
|
||||
$tmp = random_int(0, $max);
|
||||
$randomCode .= $numbers[$tmp];
|
||||
}
|
||||
|
||||
$generated_password=str_shuffle($randomCode);
|
||||
@ -484,15 +487,18 @@ function getRandomPassword($generic = false, $replaceambiguouschars = null, $len
|
||||
{
|
||||
$max = strlen($lowercase) - 1;
|
||||
for ($x = 0; $x < $nbofchar; $x++) {
|
||||
$randomCode .= $lowercase{mt_rand(0, $max)};
|
||||
$tmp = mt_rand(0, $max);
|
||||
$randomCode .= $lowercase[$tmp];
|
||||
}
|
||||
$max = strlen($uppercase) - 1;
|
||||
for ($x = 0; $x < $nbofchar; $x++) {
|
||||
$randomCode .= $uppercase{mt_rand(0, $max)};
|
||||
$tmp = mt_rand(0, $max);
|
||||
$randomCode .= $uppercase[$tmp];
|
||||
}
|
||||
$max = strlen($numbers) - 1;
|
||||
for ($x = 0; $x < $nbofcharlast; $x++) {
|
||||
$randomCode .= $numbers{mt_rand(0, $max)};
|
||||
$tmp = mt_rand(0, $max);
|
||||
$randomCode .= $numbers[$tmp];
|
||||
}
|
||||
|
||||
$generated_password=str_shuffle($randomCode);
|
||||
@ -516,11 +522,13 @@ function getRandomPassword($generic = false, $replaceambiguouschars = null, $len
|
||||
$max = strlen($numbers) - 1;
|
||||
if (function_exists('random_int')) // Cryptographic random
|
||||
{
|
||||
$generated_password=str_replace($replaceambiguouschars, $numbers{random_int(0, $max)}, $generated_password);
|
||||
$tmp = random_int(0, $max);
|
||||
$generated_password=str_replace($replaceambiguouschars, $numbers[$tmp], $generated_password);
|
||||
}
|
||||
else
|
||||
{
|
||||
$generated_password=str_replace($replaceambiguouschars, $numbers{mt_rand(0, $max)}, $generated_password);
|
||||
$tmp = random_int(0, $max);
|
||||
$generated_password=str_replace($replaceambiguouschars, $numbers[$tmp], $generated_password);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user