fix default language

This commit is contained in:
Serghey Rodin 2016-07-18 16:54:40 +03:00
commit 6b4b81f7d6

View file

@ -3,12 +3,9 @@
define('NO_AUTH_REQUIRED',true);
// Main include
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
//echo $_SESSION['request_uri'];
$TAB = 'LOGIN';
@ -18,6 +15,8 @@ if (isset($_GET['logout'])) {
}
// Login as someone else
if (isset($_SESSION['user'])) {
if ($_SESSION['user'] == 'admin' && !empty($_GET['loginas'])) {
@ -71,7 +70,16 @@ if (isset($_POST['user']) && isset($_POST['password'])) {
get_favourites();
// Define language
if (!empty($data[$v_user]['LANGUAGE'])) $_SESSION['language'] = $data[$v_user]['LANGUAGE'];
$output = '';
exec (VESTA_CMD."v-list-sys-languages json", $output, $return_var);
$languages = json_decode(implode('', $output), true);
if(in_array($data[$v_user]['LANGUAGE'], $languages)){
$_SESSION['language'] = $data[$v_user]['LANGUAGE'];
}
else {
$_SESSION['language'] = 'en';
}
// Redirect request to control panel interface
if (!empty($_SESSION['request_uri'])) {
@ -106,6 +114,9 @@ if (empty($_SESSION['language'])) {
if(in_array($lang, $languages)){
$_SESSION['language'] = $lang;
}
else {
$_SESSION['language'] = 'en';
}
}
require_once($_SERVER['DOCUMENT_ROOT'].'/inc/i18n/'.$_SESSION['language'].'.php');