diff --git a/htdocs/core/ajax/check_notifications.php b/htdocs/core/ajax/check_notifications.php index 01cb85008bd..60d3b1d29a7 100644 --- a/htdocs/core/ajax/check_notifications.php +++ b/htdocs/core/ajax/check_notifications.php @@ -131,7 +131,7 @@ if (empty($_SESSION['auto_check_events_not_before']) || $time >= $_SESSION['auto 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 a.id as id_agenda, a.code, a.datep, a.label, a.location, ar.rowid as id_reminder, ar.dateremind, ar.fk_user as id_user_reminder'; $sql .= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a'; diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index 3c094ff5a6b..dca7c123399 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -105,7 +105,7 @@ class HookManager if (in_array($context, $arrayhooks) || in_array('all', $arrayhooks)) // We instantiate action class only if initialized hook is handled by module { // Include actions class overwriting hooks - if (!is_object($this->hooks[$context][$module])) // If set, class was already loaded + if (empty($this->hooks[$context][$module]) || !is_object($this->hooks[$context][$module])) // If set to an object value, class was already loaded { $path = '/'.$module.'/class/'; $actionfile = 'actions_'.$module.'.class.php'; @@ -167,6 +167,7 @@ class HookManager 'doActions', 'doMassActions', 'formatEvent', + 'formConfirm', 'formCreateThirdpartyOptions', 'formObjectOptions', 'formattachOptions', diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index 60b01b567f4..cc785698000 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -450,15 +450,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); @@ -466,15 +469,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); @@ -497,9 +503,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); - } 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); + } + else + { + $tmp = mt_rand(0, $max); + $generated_password = str_replace($replaceambiguouschars, $numbers[$tmp], $generated_password); } } diff --git a/htdocs/core/tpl/advtarget.tpl.php b/htdocs/core/tpl/advtarget.tpl.php index 8f9c8ec83e2..a096c097bdc 100644 --- a/htdocs/core/tpl/advtarget.tpl.php +++ b/htdocs/core/tpl/advtarget.tpl.php @@ -482,6 +482,7 @@ if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { print '' . $extrafields->attributes[$elementtype]['label'][$key]; if ($array_query['options_' . $key . '_cnct'] != '' || (is_array($array_query['options_' . $key . '_cnct']) && count($array_query['options_' . $key . '_cnct']) > 0)) { print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } print ''; if (($extrafields->attributes[$elementtype]['type'][$key] == 'varchar') || ($extrafields->attributes[$elementtype]['type'][$key] == 'text')) { @@ -519,14 +520,11 @@ if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { print $formadvtargetemaling->advMultiselectarraySelllist('options_' . $key . '_cnct', $extrafields->attributes[$key]['param']['options'], $array_query['options_' . $key . '_cnct']); print '' . "\n"; } else { - print ''; - print '
'; if (is_array($array_query['options_' . $key . '_cnct'])) { print $extrafields->showInputField($key, implode(',', $array_query['options_' . $key . '_cnct']), '', '_cnct'); } else { print $extrafields->showInputField($key, $array_query['options_' . $key . '_cnct'], '', '_cnct'); } - print '
'; print '' . "\n"; } print '' . "\n"; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 2d28ac799d7..77958deca5f 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -255,6 +255,7 @@ if (!empty($conf->debugbar->enabled) && !GETPOST('dol_use_jmobile') && empty($_S include_once DOL_DOCUMENT_ROOT.'/debugbar/class/DebugBar.php'; $debugbar = new DolibarrDebugBar(); $renderer = $debugbar->getRenderer(); + if (empty($conf->global->MAIN_HTML_HEADER)) $conf->global->MAIN_HTML_HEADER = ''; $conf->global->MAIN_HTML_HEADER .= $renderer->renderHead(); $debugbar['time']->startMeasure('pageaftermaster', 'Page generation (after environment init)'); @@ -925,7 +926,7 @@ if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && !empty($user->conf->MAI } // set MAIN_OPTIMIZEFORCOLORBLIND for user -$conf->global->MAIN_OPTIMIZEFORCOLORBLIND = $user->conf->MAIN_OPTIMIZEFORCOLORBLIND; +$conf->global->MAIN_OPTIMIZEFORCOLORBLIND = empty($user->conf->MAIN_OPTIMIZEFORCOLORBLIND) ? '' : $user->conf->MAIN_OPTIMIZEFORCOLORBLIND; // Set terminal output option according to conf->browser. if (GETPOST('dol_hide_leftmenu', 'int') || !empty($_SESSION['dol_hide_leftmenu'])) $conf->dol_hide_leftmenu = 1; @@ -1162,8 +1163,8 @@ function top_httphead($contenttype = 'text/html', $forcenocache = 0) // // A default security policy that keep usage of js external component like ckeditor, stripe, google, working // $contentsecuritypolicy = "font-src *; img-src *; style-src * 'unsafe-inline' 'unsafe-eval'; default-src 'self' *.stripe.com 'unsafe-inline' 'unsafe-eval'; script-src 'self' *.stripe.com 'unsafe-inline' 'unsafe-eval'; frame-src 'self' *.stripe.com; connect-src 'self';"; //} - //else $contentsecuritypolicy = $conf->global->MAIN_HTTP_CONTENT_SECURITY_POLICY; - $contentsecuritypolicy = $conf->global->MAIN_HTTP_CONTENT_SECURITY_POLICY; + //else + $contentsecuritypolicy = empty($conf->global->MAIN_HTTP_CONTENT_SECURITY_POLICY) ? '': $conf->global->MAIN_HTTP_CONTENT_SECURITY_POLICY; if (!is_object($hookmanager)) $hookmanager = new HookManager($db); $hookmanager->initHooks(array("main")); diff --git a/htdocs/stripe/config.php b/htdocs/stripe/config.php index 4cae940d955..c7fa11df498 100644 --- a/htdocs/stripe/config.php +++ b/htdocs/stripe/config.php @@ -34,12 +34,12 @@ global $stripearrayofkeysbyenv; $stripearrayofkeysbyenv = array( 0=>array( - "secret_key" => $conf->global->STRIPE_TEST_SECRET_KEY, - "publishable_key" => $conf->global->STRIPE_TEST_PUBLISHABLE_KEY + "secret_key" => empty($conf->global->STRIPE_TEST_SECRET_KEY) ? '' : $conf->global->STRIPE_TEST_SECRET_KEY, + "publishable_key" => empty($conf->global->STRIPE_TEST_PUBLISHABLE_KEY) ? '' : $conf->global->STRIPE_TEST_PUBLISHABLE_KEY ), 1=>array( - "secret_key" => $conf->global->STRIPE_LIVE_SECRET_KEY, - "publishable_key" => $conf->global->STRIPE_LIVE_PUBLISHABLE_KEY + "secret_key" => empty($conf->global->STRIPE_LIVE_SECRET_KEY) ? '' : $conf->global->STRIPE_LIVE_SECRET_KEY, + "publishable_key" => empty($conf->global->STRIPE_LIVE_PUBLISHABLE_KEY) ? '' : $conf->global->STRIPE_LIVE_PUBLISHABLE_KEY ) ); diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 59aaf0ecc2c..43fdeee35ad 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -239,7 +239,7 @@ print 'fontsizesmaller='.$fontsizesmaller."\n"; print 'topMenuFontSize='.$topMenuFontSize."\n"; print 'toolTipBgColor='.$toolTipBgColor."\n"; print 'toolTipFontColor='.$toolTipFontColor."\n"; -print 'conf->global->THEME_SATURATE_RATIO='.$conf->global->THEME_SATURATE_RATIO." (must be between 0 and 1)\n"; +print 'conf->global->THEME_SATURATE_RATIO='.(empty($conf->global->THEME_SATURATE_RATIO) ? '' : $conf->global->THEME_SATURATE_RATIO)." (must be between 0 and 1)\n"; print '*/'."\n"; diff --git a/htdocs/theme/eldy/timeline.inc.php b/htdocs/theme/eldy/timeline.inc.php index eb13821c221..d5fba863b3d 100644 --- a/htdocs/theme/eldy/timeline.inc.php +++ b/htdocs/theme/eldy/timeline.inc.php @@ -112,7 +112,7 @@ a.timeline-btn:hover { background-color: #e7e7e7; color: #333; - border-color: #adadad;; + border-color: #adadad; }