diff --git a/src/misc/user_info.php b/src/misc/user_info.php index 19035a0..8fbaca5 100644 --- a/src/misc/user_info.php +++ b/src/misc/user_info.php @@ -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) { diff --git a/src/misc/utilities.php b/src/misc/utilities.php index 0427650..38d8ff7 100644 --- a/src/misc/utilities.php +++ b/src/misc/utilities.php @@ -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; } diff --git a/src/objects/user_info.php b/src/objects/user_info.php index edf4699..a1fcacc 100644 --- a/src/objects/user_info.php +++ b/src/objects/user_info.php @@ -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)); diff --git a/src/xmlrpc/accounts_email.php b/src/xmlrpc/accounts_email.php index ebf1148..e390b72 100644 --- a/src/xmlrpc/accounts_email.php +++ b/src/xmlrpc/accounts_email.php @@ -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); } diff --git a/src/xmlrpc/accounts_phone.php b/src/xmlrpc/accounts_phone.php index 78d9a96..04e65d2 100644 --- a/src/xmlrpc/accounts_phone.php +++ b/src/xmlrpc/accounts_phone.php @@ -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); } diff --git a/src/xmlrpc/provisioning.php b/src/xmlrpc/provisioning.php index 227d1cd..8e351dc 100644 --- a/src/xmlrpc/provisioning.php +++ b/src/xmlrpc/provisioning.php @@ -184,7 +184,7 @@ if (!empty($username)) { $xml .= '<sip:' . $username . '@' . $domain . '>'; $xml .= '1'; $xml .= 'push_notification'; - if (get_config_value(CUSTOM_HOOKS, FALSE)) { + if (get_config_value("CUSTOM_HOOKS", FALSE)) { provisioning_hook_on_proxy_config($xml, $request_params); } $xml .= ''; @@ -195,14 +195,14 @@ if (!empty($username)) { $xml .= '' . $ha1 . ''; $xml .= '' . $domain . ''; $xml .= '' . $algo . ''; - if (get_config_value(CUSTOM_HOOKS, FALSE)) { + if (get_config_value("CUSTOM_HOOKS", FALSE)) { provisioning_hook_on_auth_info($xml, $request_params); } $xml .= ''; } } -if (get_config_value(CUSTOM_HOOKS, FALSE)) { +if (get_config_value("CUSTOM_HOOKS", FALSE)) { provisioning_hook_on_additional_section($xml, $request_params); }