2016-04-26 23:51:27 +02:00
|
|
|
<?php
|
|
|
|
/***********************************************************************
|
|
|
|
* Copyright (C) 2016 Max Mehl <mail [at] mehl [dot] mx>
|
|
|
|
************************************************************************
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as
|
|
|
|
* published by the Free Software Foundation, either version 3 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public
|
|
|
|
* License along with this program. If not, see
|
|
|
|
* <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
************************************************************************
|
|
|
|
*
|
|
|
|
* This file detects the sessions language setting or the one which we
|
|
|
|
* set in a cookie.
|
|
|
|
*
|
|
|
|
***********************************************************************/
|
|
|
|
?>
|
2015-12-11 19:39:52 +01:00
|
|
|
<?php
|
|
|
|
session_start();
|
|
|
|
header('Cache-control: private'); // IE 6 FIX
|
|
|
|
|
|
|
|
if(isSet($_GET['lang']))
|
|
|
|
{
|
|
|
|
$lang = $_GET['lang'];
|
|
|
|
|
|
|
|
// register the session and set the cookie
|
|
|
|
$_SESSION['lang'] = $lang;
|
|
|
|
|
|
|
|
setcookie("lang", $lang, time() + (3600 * 24 * 30));
|
|
|
|
}
|
|
|
|
else if(isSet($_SESSION['lang']))
|
|
|
|
{
|
|
|
|
$lang = $_SESSION['lang'];
|
|
|
|
}
|
|
|
|
else if(isSet($_COOKIE['lang']))
|
|
|
|
{
|
|
|
|
$lang = $_COOKIE['lang'];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$lang = 'en';
|
|
|
|
}
|
|
|
|
|
|
|
|
switch ($lang) {
|
|
|
|
case 'en':
|
|
|
|
$lang_file = 'lang.en.php';
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'de':
|
|
|
|
$lang_file = 'lang.de.php';
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
$lang_file = 'lang.en.php';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
include_once 'lang/'.$lang_file;
|
|
|
|
?>
|