Fixed issue in get_config_value. Each parameter needs to be enclosed in quotes, since we want to check if the parameter is defined

This commit is contained in:
Peio Rigaux 2021-05-31 11:21:15 +02:00 committed by Peio Rigaux
parent 903da8652f
commit 2ed044aab1
6 changed files with 10 additions and 9 deletions

View file

@ -44,7 +44,7 @@ function update_account_user_info($username, $ha1, $firstname, $lastname, $gende
$user_info = new UserInfo($db);
$user_info->account_id = $account->id;
if (get_config_value(ENABLE_NEW_ACCOUNTS_GEOLOC, FALSE)) {
if (get_config_value("ENABLE_NEW_ACCOUNTS_GEOLOC", FALSE)) {
Logger::getInstance()->debug("userInfo : Account ip after enable geoloc if " . $account->ip_address);
$country_infos = Geoloc::getGeolocInfosFromIp($account->ip_address);
if ($country_infos) {

View file

@ -194,6 +194,7 @@ function time_elapsed_as_string($secs)
return join(' ', $ret);
}
// /!\ ALWAYS enter the const config value under quotes, otherwize it won't be taken into account
function get_config_value($param_name, $default_value) {
return defined($param_name) ? constant($param_name) : $default_value;
}

View file

@ -126,7 +126,7 @@ class UserInfo
{
$query = "INSERT INTO " . USER_INFO_DB_TABLE . " SET account_id=:account_id, firstname=:firstname, lastname=:lastname, gender=:gender, subscribe=:subscribe";
if (get_config_value(ENABLE_NEW_ACCOUNTS_GEOLOC, FALSE)) {
if (get_config_value("ENABLE_NEW_ACCOUNTS_GEOLOC", FALSE)) {
$query .= ", country_code=:country_code, country_name=:country_name";
}
@ -145,7 +145,7 @@ class UserInfo
$stmt->bindParam(":gender", $this->gender);
$stmt->bindParam(":subscribe", $this->subscribe);
if (get_config_value(ENABLE_NEW_ACCOUNTS_GEOLOC, FALSE)) {
if (get_config_value("ENABLE_NEW_ACCOUNTS_GEOLOC", FALSE)) {
$this->country_code = htmlspecialchars(strip_tags($this->country_code));
$this->country_name = htmlspecialchars(strip_tags($this->country_name));

View file

@ -104,7 +104,7 @@ function xmlrpc_create_email_account($method, $args)
//need username + domain
//We call this function to set the geoloc if enabled
if (get_config_value(ENABLE_NEW_ACCOUNTS_GEOLOC, FALSE)) {
if (get_config_value("ENABLE_NEW_ACCOUNTS_GEOLOC", FALSE)) {
return update_account_user_info($account->username, $hashed_password, null, null, "unknown", '0', $account->domain, $algo);
}
@ -189,7 +189,7 @@ function xmlrpc_create_email_md5_sha256_account($method, $args)
//We call this function to set the geoloc if enabled
// args needed = [username, ha1, firstname, lastname, gender, subscribe, [domain], [algo]]
//need username + domain
if (get_config_value(ENABLE_NEW_ACCOUNTS_GEOLOC, FALSE)) {
if (get_config_value("ENABLE_NEW_ACCOUNTS_GEOLOC", FALSE)) {
return update_account_user_info($account->username, $md5_hash, null, null, "unknown", '0', $account->domain, MD5);
}

View file

@ -137,7 +137,7 @@ function xmlrpc_create_phone_account($method, $args)
//We call this function to set the geoloc if enabled
// args needed = [username, ha1, firstname, lastname, gender, subscribe, [domain], [algo]]
//need username + domain
if (get_config_value(ENABLE_NEW_ACCOUNTS_GEOLOC, FALSE)) {
if (get_config_value("ENABLE_NEW_ACCOUNTS_GEOLOC", FALSE)) {
return update_account_user_info($account->username, $hashed_password, null, null, "unknown", '0', $account->domain, $algo);
}

View file

@ -184,7 +184,7 @@ if (!empty($username)) {
$xml .= '<entry name="reg_identity"' . (REMOTE_PROVISIONING_OVERWRITE_ALL ? ' overwrite="true"' : '') . '>&lt;sip:' . $username . '@' . $domain . '&gt;</entry>';
$xml .= '<entry name="reg_sendregister"' . (REMOTE_PROVISIONING_OVERWRITE_ALL ? ' overwrite="true"' : '') . '>1</entry>';
$xml .= '<entry name="refkey"' . (REMOTE_PROVISIONING_OVERWRITE_ALL ? ' overwrite="true"' : '') . '>push_notification</entry>';
if (get_config_value(CUSTOM_HOOKS, FALSE)) {
if (get_config_value("CUSTOM_HOOKS", FALSE)) {
provisioning_hook_on_proxy_config($xml, $request_params);
}
$xml .= '</section>';
@ -195,14 +195,14 @@ if (!empty($username)) {
$xml .= '<entry name="ha1"' . (REMOTE_PROVISIONING_OVERWRITE_ALL ? ' overwrite="true"' : '') . '>' . $ha1 . '</entry>';
$xml .= '<entry name="realm"' . (REMOTE_PROVISIONING_OVERWRITE_ALL ? ' overwrite="true"' : '') . '>' . $domain . '</entry>';
$xml .= '<entry name="algorithm"' . (REMOTE_PROVISIONING_OVERWRITE_ALL ? ' overwrite="true"' : '') . '>' . $algo . '</entry>';
if (get_config_value(CUSTOM_HOOKS, FALSE)) {
if (get_config_value("CUSTOM_HOOKS", FALSE)) {
provisioning_hook_on_auth_info($xml, $request_params);
}
$xml .= '</section>';
}
}
if (get_config_value(CUSTOM_HOOKS, FALSE)) {
if (get_config_value("CUSTOM_HOOKS", FALSE)) {
provisioning_hook_on_additional_section($xml, $request_params);
}