mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-11 12:01:23 +01:00
Update api_setup.class.php
This commit is contained in:
@@ -1409,15 +1409,15 @@ class Setup extends DolibarrApi
|
||||
*
|
||||
* Note that conf variables that stores security key or password hashes can't be loaded with API.
|
||||
*
|
||||
* @param string $constante Name of conf variable to get
|
||||
* @param string $constantname Name of conf variable to get
|
||||
* @return array|mixed Data without useless information
|
||||
*
|
||||
* @url GET conf/{constante}
|
||||
* @url GET conf/{constantname}
|
||||
*
|
||||
* @throws RestException 403 Forbidden
|
||||
* @throws RestException 500 Error Bad or unknown value for constname
|
||||
*/
|
||||
public function getConf($constante)
|
||||
public function getConf($constantname)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@@ -1426,14 +1426,14 @@ class Setup extends DolibarrApi
|
||||
throw new RestException(403, 'Error API open to admin users only or to the login user defined with constant API_LOGIN_ALLOWED_FOR_ADMIN_CHECK');
|
||||
}
|
||||
|
||||
if (! preg_match('/^[a-zA-Z0-9_]+$/', $constante) || ! isset($conf->global->$constante)) {
|
||||
if (! preg_match('/^[a-zA-Z0-9_]+$/', $constantname) || ! isset($conf->global->$constantname)) {
|
||||
throw new RestException(500, 'Error Bad or unknown value for constname');
|
||||
}
|
||||
if (preg_match('/(_pass|password|secret|_key|key$)/i', $constante)) {
|
||||
if (preg_match('/(_pass|password|secret|_key|key$)/i', $constantname)) {
|
||||
throw new RestException(403, 'Forbidden');
|
||||
}
|
||||
|
||||
return $conf->global->$constante;
|
||||
return $conf->global->$constantname;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user