Adding validation to the user language

skala
Julio Montoya 14 years ago
parent e632193385
commit ba53c119b6
  1. 9
      main/auth/profile.php
  2. 17
      main/inc/lib/usermanager.lib.php

@ -649,6 +649,12 @@ if ($form->validate()) {
$user_data['openid'] = 'http://'.$my_user_openid;
}
$extras = array();
//Checking the user language
$languages = api_get_languages();
if (!in_array($user_data['language'], $languages['folder'])) {
$user_data['language'] = api_get_setting('platformLanguage');
}
//Only update values that are request by the "profile" setting
$profile_list = api_get_setting('profile');
@ -664,8 +670,9 @@ if ($form->validate()) {
$available_values_to_modify[] = $key;
}
}
}
}
// build SQL query
$sql = "UPDATE $table_user SET";
unset($user_data['api_key_generate']);

@ -81,10 +81,11 @@ class UserManager
// database table definition
$table_user = Database::get_main_table(TABLE_MAIN_USER);
// default langauge
if ($language == '') {
$language = api_get_setting('platformLanguage');
}
//Checking the user language
$languages = api_get_languages();
if (!in_array($language, $languages['folder'])) {
$language = api_get_setting('platformLanguage');
}
if ($_user['user_id']) {
$creator_id = intval($_user['user_id']);
@ -341,6 +342,14 @@ class UserManager
if ($user_id != strval(intval($user_id))) return false;
if ($user_id === false) return false;
$table_user = Database :: get_main_table(TABLE_MAIN_USER);
//Checking the user language
$languages = api_get_languages();
if (!in_array($language, $languages['folder'])) {
$language = api_get_setting('platformLanguage');
}
$sql = "UPDATE $table_user SET
lastname='".Database::escape_string($lastname)."',
firstname='".Database::escape_string($firstname)."',

Loading…
Cancel
Save