FIX force to entity 0 for all entities

This commit is contained in:
Regis Houssin 2021-03-20 12:35:41 +01:00
parent 573ca669da
commit 29e090b025
2 changed files with 7 additions and 7 deletions

View File

@ -67,14 +67,14 @@ print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"])
if ($action == 'firstpingok') {
// Note: pings are per installed instances / entity.
// Once this constants are set, no more ping will be tried (except if we add parameter &forceping=1 on URL). So we can say this are 'first' ping.
dolibarr_set_const($db, 'MAIN_FIRST_PING_OK_DATE', dol_print_date($now, 'dayhourlog', 'gmt'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, 'MAIN_FIRST_PING_OK_ID', $hash_unique_id, 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, 'MAIN_FIRST_PING_OK_DATE', dol_print_date($now, 'dayhourlog', 'gmt'), 'chaine', 0, '', 0);
dolibarr_set_const($db, 'MAIN_FIRST_PING_OK_ID', $hash_unique_id, 'chaine', 0, '', 0);
print 'First ping OK saved for entity '.$conf->entity;
} elseif ($action == 'firstpingko') {
// If ko
// Note: pings are by installation, done on entity 1.
dolibarr_set_const($db, 'MAIN_LAST_PING_KO_DATE', dol_print_date($now, 'dayhourlog', 'gmt'), 'chaine', 0, '', $conf->entity); // erase last value
dolibarr_set_const($db, 'MAIN_LAST_PING_KO_DATE', dol_print_date($now, 'dayhourlog', 'gmt'), 'chaine', 0, '', 0); // erase last value
print 'First ping KO saved for entity '.$conf->entity;
} else {
print 'Error action='.$action.' not supported';

View File

@ -473,7 +473,7 @@ if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && !empty($conf->gl
}
}
$sessiontokenforthisurl = $_SESSION['token'];
$sessiontokenforthisurl = (empty($_SESSION['token']) ? '' : $_SESSION['token']);
// TODO Get the sessiontokenforthisurl into the array of session token
if (GETPOSTISSET('token') && GETPOST('token', 'alpha') != $sessiontokenforthisurl) {
dol_syslog("--- Access to ".$_SERVER["PHP_SELF"]." refused due to invalid token, so we disable POST and some GET parameters - referer=".$_SERVER['HTTP_REFERER'].", action=".GETPOST('action', 'aZ09').", _GET|POST['token']=".GETPOST('token', 'alpha').", _SESSION['token']=".$_SESSION['token'], LOG_WARNING);
@ -3108,7 +3108,7 @@ if (!function_exists("llxFooter")) {
} else {
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
print "\n".'<!-- Includes JS for Ping of Dolibarr forceping='.$forceping.' MAIN_FIRST_PING_OK_DATE='.(empty($conf->global->MAIN_FIRST_PING_OK_DATE) ? '' : $conf->global->MAIN_FIRST_PING_OK_DATE).' MAIN_FIRST_PING_OK_ID='.(empty($conf->global->MAIN_FIRST_PING_OK_ID) ? '' : $conf->global->MAIN_FIRST_PING_OK_ID).' MAIN_LAST_PING_KO_DATE='.(empty($conf->global->MAIN_LAST_PING_KO_DATE) ? '' : $conf->global->MAIN_LAST_PING_KO_DATE).' -->'."\n";
print "\n".'<!-- Includes JS for Ping of Dolibarr forceping='.$forceping.' MAIN_FIRST_PING_OK_DATE='.getDolGlobalString("MAIN_FIRST_PING_OK_DATE").' MAIN_FIRST_PING_OK_ID='.getDolGlobalString("MAIN_FIRST_PING_OK_ID").' MAIN_LAST_PING_KO_DATE='.getDolGlobalString("MAIN_LAST_PING_KO_DATE").' -->'."\n";
print "\n<!-- JS CODE TO ENABLE the anonymous Ping -->\n";
$url_for_ping = (empty($conf->global->MAIN_URL_FOR_PING) ? "https://ping.dolibarr.org/" : $conf->global->MAIN_URL_FOR_PING);
// Try to guess the distrib used
@ -3168,8 +3168,8 @@ if (!function_exists("llxFooter")) {
$now = dol_now();
print "\n<!-- NO JS CODE TO ENABLE the anonymous Ping. It was disabled -->\n";
include_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
dolibarr_set_const($db, 'MAIN_FIRST_PING_OK_DATE', dol_print_date($now, 'dayhourlog', 'gmt'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, 'MAIN_FIRST_PING_OK_ID', 'disabled', 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, 'MAIN_FIRST_PING_OK_DATE', dol_print_date($now, 'dayhourlog', 'gmt'), 'chaine', 0, '', 0);
dolibarr_set_const($db, 'MAIN_FIRST_PING_OK_ID', 'disabled', 'chaine', 0, '', 0);
}
}
}