-
Notifications
You must be signed in to change notification settings - Fork 18
/
lang.php
59 lines (51 loc) · 943 Bytes
/
lang.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?PHP
session_start();
//Get browser languange
$browser_lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
//Check if lang was passed as a variable
if($_POST['lang'] == "en")
{
$language = "en";
//Set language for the rest of the session
$_SESSION['lang'] = $language;
}
else
{
if(!isSet($_SESSION['lang']))
{
if( isSet($browser_lang) )
{
//If nothing specified, use browser language
$language = $browser_lang;
$_SESSION['lang'] = $language;
}
else
{
//Default to danish
$language = "da";
$_SESSION['lang'] = $language;
}
}
else
{
$language = $_SESSION['lang'];
}
}
//Load language
switch ($language) {
case 'en':
$language_file = 'captiveportal-lang.en.inc.php';
break;
default:
//Default lang
$language_file = 'captiveportal-lang.da.inc.php';
}
if(file_exists($language_file))
{
include_once $language_file;
}
else
{
include_once 'captiveportal-lang.da.inc.php';
}
?>