Skip to content

Commit 6b4b81f

Browse files
committed
fix default language
1 parent 085a9e4 commit 6b4b81f

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

web/login/index.php

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@
33
define('NO_AUTH_REQUIRED',true);
44

55

6-
76
// Main include
87
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
98

10-
//echo $_SESSION['request_uri'];
11-
129

1310
$TAB = 'LOGIN';
1411

@@ -18,6 +15,8 @@
1815
}
1916

2017

18+
19+
2120
// Login as someone else
2221
if (isset($_SESSION['user'])) {
2322
if ($_SESSION['user'] == 'admin' && !empty($_GET['loginas'])) {
@@ -71,7 +70,16 @@
7170
get_favourites();
7271

7372
// Define language
74-
if (!empty($data[$v_user]['LANGUAGE'])) $_SESSION['language'] = $data[$v_user]['LANGUAGE'];
73+
$output = '';
74+
exec (VESTA_CMD."v-list-sys-languages json", $output, $return_var);
75+
$languages = json_decode(implode('', $output), true);
76+
if(in_array($data[$v_user]['LANGUAGE'], $languages)){
77+
$_SESSION['language'] = $data[$v_user]['LANGUAGE'];
78+
}
79+
else {
80+
$_SESSION['language'] = 'en';
81+
}
82+
7583

7684
// Redirect request to control panel interface
7785
if (!empty($_SESSION['request_uri'])) {
@@ -106,6 +114,9 @@
106114
if(in_array($lang, $languages)){
107115
$_SESSION['language'] = $lang;
108116
}
117+
else {
118+
$_SESSION['language'] = 'en';
119+
}
109120
}
110121

111122
require_once($_SERVER['DOCUMENT_ROOT'].'/inc/i18n/'.$_SESSION['language'].'.php');

0 commit comments

Comments
 (0)