Commit da211efa authored by Peio Rigaux's avatar Peio Rigaux

Use get_config_value to ensure that geoloc accounts are disabled if there is no config value

parent e0390ce1
Pipeline #15896 passed with stages
in 9 minutes and 59 seconds
...@@ -44,7 +44,7 @@ function update_account_user_info($username, $ha1, $firstname, $lastname, $gende ...@@ -44,7 +44,7 @@ function update_account_user_info($username, $ha1, $firstname, $lastname, $gende
$user_info = new UserInfo($db); $user_info = new UserInfo($db);
$user_info->account_id = $account->id; $user_info->account_id = $account->id;
if (ENABLE_NEW_ACCOUNTS_GEOLOC) { if (get_config_value(ENABLE_NEW_ACCOUNTS_GEOLOC, FALSE)) {
Logger::getInstance()->debug("userInfo : Account ip after enable geoloc if " . $account->ip_address); Logger::getInstance()->debug("userInfo : Account ip after enable geoloc if " . $account->ip_address);
$country_infos = Geoloc::getGeolocInfosFromIp($account->ip_address); $country_infos = Geoloc::getGeolocInfosFromIp($account->ip_address);
if ($country_infos) { if ($country_infos) {
......
...@@ -126,7 +126,7 @@ class UserInfo ...@@ -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"; $query = "INSERT INTO " . USER_INFO_DB_TABLE . " SET account_id=:account_id, firstname=:firstname, lastname=:lastname, gender=:gender, subscribe=:subscribe";
if (ENABLE_NEW_ACCOUNTS_GEOLOC) { if (get_config_value(ENABLE_NEW_ACCOUNTS_GEOLOC, FALSE)) {
$query .= ", country_code=:country_code, country_name=:country_name"; $query .= ", country_code=:country_code, country_name=:country_name";
} }
...@@ -145,7 +145,7 @@ class UserInfo ...@@ -145,7 +145,7 @@ class UserInfo
$stmt->bindParam(":gender", $this->gender); $stmt->bindParam(":gender", $this->gender);
$stmt->bindParam(":subscribe", $this->subscribe); $stmt->bindParam(":subscribe", $this->subscribe);
if (ENABLE_NEW_ACCOUNTS_GEOLOC) { if (get_config_value(ENABLE_NEW_ACCOUNTS_GEOLOC, FALSE)) {
$this->country_code = htmlspecialchars(strip_tags($this->country_code)); $this->country_code = htmlspecialchars(strip_tags($this->country_code));
$this->country_name = htmlspecialchars(strip_tags($this->country_name)); $this->country_name = htmlspecialchars(strip_tags($this->country_name));
......
...@@ -104,7 +104,7 @@ function xmlrpc_create_email_account($method, $args) ...@@ -104,7 +104,7 @@ function xmlrpc_create_email_account($method, $args)
//need username + domain //need username + domain
//We call this function to set the geoloc if enabled //We call this function to set the geoloc if enabled
if (ENABLE_NEW_ACCOUNTS_GEOLOC) { 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); 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) ...@@ -189,7 +189,7 @@ function xmlrpc_create_email_md5_sha256_account($method, $args)
//We call this function to set the geoloc if enabled //We call this function to set the geoloc if enabled
// args needed = [username, ha1, firstname, lastname, gender, subscribe, [domain], [algo]] // args needed = [username, ha1, firstname, lastname, gender, subscribe, [domain], [algo]]
//need username + domain //need username + domain
if (ENABLE_NEW_ACCOUNTS_GEOLOC) { 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); return update_account_user_info($account->username, $md5_hash, null, null, "unknown", '0', $account->domain, MD5);
} }
......
...@@ -137,7 +137,7 @@ function xmlrpc_create_phone_account($method, $args) ...@@ -137,7 +137,7 @@ function xmlrpc_create_phone_account($method, $args)
//We call this function to set the geoloc if enabled //We call this function to set the geoloc if enabled
// args needed = [username, ha1, firstname, lastname, gender, subscribe, [domain], [algo]] // args needed = [username, ha1, firstname, lastname, gender, subscribe, [domain], [algo]]
//need username + domain //need username + domain
if (ENABLE_NEW_ACCOUNTS_GEOLOC) { 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); return update_account_user_info($account->username, $hashed_password, null, null, "unknown", '0', $account->domain, $algo);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment