QUAL Move conf->global into getDolGlobal...

This commit is contained in:
Laurent Destailleur
2023-10-24 17:00:13 +02:00
parent 6913cafadd
commit 5b15b5c647
145 changed files with 709 additions and 706 deletions

View File

@@ -40,7 +40,7 @@ class Login
$this->db = $db;
//$conf->global->MAIN_MODULE_API_LOGIN_DISABLED = 1;
if (!empty($conf->global->MAIN_MODULE_API_LOGIN_DISABLED)) {
if (getDolGlobalString('MAIN_MODULE_API_LOGIN_DISABLED')) {
throw new RestException(403, "Error login APIs are disabled. You must get the token from backoffice to be able to use APIs");
}
}
@@ -93,7 +93,7 @@ class Login
global $conf, $dolibarr_main_authentication, $dolibarr_auto_user;
// Is the login API disabled ? The token must be generated from backoffice only.
if (!empty($conf->global->API_DISABLE_LOGIN_API)) {
if (getDolGlobalString('API_DISABLE_LOGIN_API')) {
dol_syslog("Warning: A try to use the login API has been done while the login API is disabled. You must generate or get the token from the backoffice.", LOG_WARNING);
throw new RestException(403, "Error, the login API has been disabled for security purpose. You must generate or get the token from the backoffice.");
}
@@ -153,7 +153,7 @@ class Login
}
// Generate token for user
$token = dol_hash($login.uniqid().(empty($conf->global->MAIN_API_KEY)?'':$conf->global->MAIN_API_KEY), 1);
$token = dol_hash($login.uniqid().(!getDolGlobalString('MAIN_API_KEY')?'':$conf->global->MAIN_API_KEY), 1);
// We store API token into database
$sql = "UPDATE ".MAIN_DB_PREFIX."user";