save language selection

This commit is contained in:
Roland Gruber 2013-07-21 10:05:16 +00:00
parent a2b5b92bd1
commit 7318c7364d
1 changed files with 10 additions and 2 deletions

View File

@ -60,7 +60,7 @@ session_regenerate_id(true);
$profiles = getConfigProfiles();
// save last selected login profile
if(isset($_GET['useProfile'])) {
if (isset($_GET['useProfile'])) {
if (in_array($_GET['useProfile'], $profiles)) {
setcookie("lam_default_profile", $_GET['useProfile'], time() + 365*60*60*24);
}
@ -69,6 +69,11 @@ if(isset($_GET['useProfile'])) {
}
}
// save last selected language
if (isset($_POST['language'])) {
setcookie('lam_last_language', $_POST['language'], time() + 365*60*60*24);
}
// init some session variables
$default_Config = new LAMCfgMain();
$_SESSION["cfgMain"] = $default_Config;
@ -97,7 +102,10 @@ if (!isset($default_Config->default) || !in_array($default_Config->default, $pro
$error_message = _('No default profile set. Please set it in the server profile configuration.');
}
if (!empty($_SESSION["config"])) {
if (isset($_COOKIE['lam_last_language'])) {
$_SESSION['language'] = $_COOKIE['lam_last_language'];
}
elseif (!empty($_SESSION["config"])) {
$_SESSION['language'] = $_SESSION["config"]->get_defaultLanguage();
}
else {