mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-08-21 05:44:07 -07:00
fix default language
This commit is contained in:
parent
085a9e40c7
commit
6b4b81f7d6
1 changed files with 15 additions and 4 deletions
|
@ -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');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue