diff options
author | Chris Case <kahotep@bunda.dreamhost.com> | 2011-05-21 21:40:16 -0700 |
---|---|---|
committer | Chris Case <kahotep@bunda.dreamhost.com> | 2011-05-21 21:40:16 -0700 |
commit | 4cff911939b263993eb41682ca558c975e2db01f (patch) | |
tree | 78f58e08d04413827744689d0f5df7660bee6caa /index.php | |
parent | 2cf696d0b5d647e1741d2f94ee379aa19b25ae1b (diff) | |
parent | f3f063c0dd7fd8b706987b856d79c7b58924acbb (diff) | |
download | volse-hubzilla-4cff911939b263993eb41682ca558c975e2db01f.tar.gz volse-hubzilla-4cff911939b263993eb41682ca558c975e2db01f.tar.bz2 volse-hubzilla-4cff911939b263993eb41682ca558c975e2db01f.zip |
merged multipart email changes
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 25 |
1 files changed, 24 insertions, 1 deletions
@@ -1,5 +1,7 @@ <?php + error_reporting(E_ERROR | E_WARNING | E_PARSE); + /** * * Friendika @@ -31,10 +33,18 @@ $install = ((file_exists('.htconfig.php') && filesize('.htconfig.php')) ? false * * Get the language setting directly from system variables, bypassing get_config() * as database may not yet be configured. + * + * If possible, we use the value from the browser. * */ -$lang = ((isset($a->config['system']['language'])) ? $a->config['system']['language'] : 'en'); +if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { + $langs = preg_split("/[,-]/",$_SERVER['HTTP_ACCEPT_LANGUAGE'],2); + $lang = $langs[0]; +} else { + $lang = ((isset($a->config['system']['language'])) ? $a->config['system']['language'] : 'en'); +} + load_translation_table($lang); @@ -80,6 +90,19 @@ $a->init_pagehead(); session_start(); /** + * Language was set earlier, but we can over-ride it in the session. + * We have to do it here because the session was just now opened. + */ + +if(x($_POST,'system_language')) + $_SESSION['language'] = $_POST['system_language']; +if((x($_SESSION,'language')) && ($_SESSION['language'] !== $lang)) { + $lang = $_SESSION['language']; + load_translation_table($lang); +} + + +/** * * For Mozilla auth manager - still needs sorting, and this might conflict with LRDD header. * Apache/PHP lumps the Link: headers into one - and other services might not be able to parse it |