Файл: modules/user/guest_lang.php
Строк: 77
<?php
/**
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) 2013-2014, Taras Chornyi, Sergiy Mazurenko, Ivan Kotliar
* @link http://perf-engine.net
* @package PerfEngine
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
if(User::logged()) redirect('/');
if(isset($_GET['return'])) {
$return = input($_GET['return']);
} else {
$return = URL;
}
if(isset($_GET['l'])) {
$l = input($_GET['l']);
$languages = scandir(SYS.'/lang');
if(in_array($l, $languages)) {
setcookie('language', $l, time()+60*60*24*1024, '/');
redirect($return);
} else {
redirect('/user/guest_lang/');
}
}
$page = 'lang';
$title = _t('slang');
include_header($title);
$tpl->div('title', $title);
$langs_dir = opendir(SYS .'/lang');
while ($langs = readdir($langs_dir)) {
if ($langs == '.' || $langs == '..')
continue;
$lngs = include(SYS .'/lang/'.$langs.'/lang.php');
echo '<div class="menu"><img src="/template/icons/flags/'. $langs .'.png" alt="'. $langs .'" /> <a href="/user/guest_lang/?l='. $langs .'&return='.$return.'">'. ($_COOKIE['language'] == $langs ? '<b>' : NULL) . $lngs['lang_name'] . ($_COOKIE['language'] == $langs ? '</b>' : NULL) .'</a> '.($_COOKIE['language'] == $langs ? _t('used') : NULL).'</div>';
}
$tpl->div('block', img('back.png').' <a href="'.$return.'">'._t('back').'</a><br/>'.
HICO .'<a href="/">'. _t('home') .'</a>');
include_footer();
?>