diff options
author | rvelices <rv-github@modusoptimus.com> | 2008-07-05 22:36:39 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2008-07-05 22:36:39 +0000 |
commit | 03c2f3c8db54c8b3df8c344ac0ca7d7ffecac890 (patch) | |
tree | 883fef0934f468d20edb67a5430faa8475315535 /include/functions_user.inc.php | |
parent | f9927090e09be93a66c4705a760d94add583e84e (diff) |
- fix some side effects with browser language (wrong display/user creation in admin and mails to admin in user browser language)
git-svn-id: http://piwigo.org/svn/trunk@2425 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/functions_user.inc.php')
-rw-r--r-- | include/functions_user.inc.php | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/include/functions_user.inc.php b/include/functions_user.inc.php index 56127dd0e..d9e9332ad 100644 --- a/include/functions_user.inc.php +++ b/include/functions_user.inc.php @@ -151,7 +151,13 @@ SELECT id mass_inserts(USER_GROUP_TABLE, array('user_id', 'group_id'), $inserts); } - create_user_infos($next_id); + $override = null; + if ($with_notification and $conf['browser_language']) + { + if ( !get_browser_language($override['language']) ) + $override=null; + } + create_user_infos($next_id, $override); if ($with_notification and $conf['email_admin_on_new_user']) { @@ -838,32 +844,25 @@ function get_default_template() */ function get_default_language() { - global $conf; - if (isset($conf['browser_language']) and $conf['browser_language']) - { - return get_browser_language(); - } - else - { - return get_default_user_value('language', PHPWG_DEFAULT_LANGUAGE); - } + return get_default_user_value('language', PHPWG_DEFAULT_LANGUAGE); } /** - * Returns the browser language value + * Returns true if the browser language value is set into param $lang * */ -function get_browser_language() +function get_browser_language(&$lang) { $browser_language = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"], 0, 2); foreach (get_languages() as $language_code => $language_name) { if (substr($language_code, 0, 2) == $browser_language) { - return $language_code; + $lang = $language_code; + return true; } } - return PHPWG_DEFAULT_LANGUAGE; + return false; } /** @@ -923,7 +922,6 @@ function create_user_infos($arg_id, $override_values = null) { $status = 'normal'; } - $default_user['language'] = get_default_language(); $insert = array_merge( $default_user, |