Changeset 29840 for trunk/include
- Timestamp:
- Sep 30, 2014, 10:23:34 AM (10 years ago)
- Location:
- trunk/include
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/functions_user.inc.php
r29839 r29840 220 220 } 221 221 222 $override = null; 223 if ($notify_admin and $conf['browser_language']) 224 { 225 // if function get_browser_language finds a language in the browser 226 // which matches a language activated in Piwigo, then it sets 227 // $override['language'] to 'ru' (for example) and returns 228 // true. $override won't stay null 229 if (!get_browser_language($override['language'])) 230 { 231 $override=null; 232 } 233 } 222 $override = array(); 223 if ($language = get_browser_language()) 224 { 225 $override['language'] = $language; 226 } 227 234 228 create_user_infos($user_id, $override); 235 229 … … 814 808 * @todo : try to match 'fr_CA' before 'fr' 815 809 * 816 * @param string &$lang 817 * @return bool 818 */ 819 function get_browser_language(&$lang) 810 * @return string 811 */ 812 function get_browser_language() 820 813 { 821 814 $browser_language = substr(@$_SERVER["HTTP_ACCEPT_LANGUAGE"], 0, 2); … … 824 817 if (substr($language_code, 0, 2) == $browser_language) 825 818 { 826 $lang = $language_code; 827 return true; 819 return $language_code; 828 820 } 829 821 } -
trunk/include/user.inc.php
r28587 r29840 69 69 ( defined('IN_ADMIN') and IN_ADMIN ) ? false : true // use cache ? 70 70 ); 71 if ($conf['browser_language'] and (is_a_guest() or is_generic()) )71 if ($conf['browser_language'] and (is_a_guest() or is_generic()) and $language = get_browser_language()) 72 72 { 73 get_browser_language($user['language']);73 $user['language'] = $language; 74 74 } 75 75 trigger_notify('user_init', $user);
Note: See TracChangeset
for help on using the changeset viewer.