Merge branch '12.0' of git@github.com:Dolibarr/dolibarr.git into develop

Conflicts:
	htdocs/core/lib/security2.lib.php
	htdocs/core/modules/livraison/doc/pdf_typhon.modules.php
	htdocs/main.inc.php
This commit is contained in:
Laurent Destailleur 2020-10-30 04:39:41 +01:00
commit b3333da5c1
8 changed files with 33 additions and 23 deletions

View File

@ -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';

View File

@ -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',

View File

@ -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);
}
}

View File

@ -482,6 +482,7 @@ if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) {
print '<tr><td>' . $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 '</td><td>';
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 '</td><td>' . "\n";
} else {
print '<table class="nobordernopadding"><tr>';
print '<td></td><td>';
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 '</td></tr></table>';
print '</td><td>' . "\n";
}
print '</td></tr>' . "\n";

View File

@ -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"));

View File

@ -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
)
);

View File

@ -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";

View File

@ -112,7 +112,7 @@ a.timeline-btn:hover
{
background-color: #e7e7e7;
color: #333;
border-color: #adadad;;
border-color: #adadad;
}