Файл: modules/pages/lang.php
Строк: 66
<?php
if(isset($_POST['lang'])) {
$lnges = (file_exists(SYS.'/lang/'.input($_POST['lnges']).'/lang.ini') ? input($_POST['lnges']) : $system['lang']);
$_COOKIE['lang'] = $lnges;
$_SESSION['lang'] = $lnges;
if(isset($user)) {
$db->query("UPDATE `settings` SET `lang` = '". $lnges."' WHERE `user_id` = '". $user['id']."' ");
setcookie('lang', $settings['lang'], time() + 86400 * 365, '/');
}
header('Location: /');
exit;
}
$title = $lang->word('slang');
require_once(SYS.'/view/header.php');
$tpl->div('title', $lang->word('slang'));
if(isset($_COOKIE['lang'])) {
$lng = $_COOKIE['lang'];
}
echo '<form action="" method="post">';
$langs_dir = opendir(SYS .'/lang');
while ($langs = readdir($langs_dir)) {
if ($langs == '.' || $langs == '..')
continue;
$lngs = parse_ini_file(SYS .'/lang/'.$langs.'/lang.ini');
echo '<div class="post"><input type="radio" value="'. $langs .'" name="lnges"'. ($lng == $langs?' checked="checked"':NULL).'/> <img src="/template/icons/'. $langs .'.png" alt=""/> <b>'. $lngs['lang_name'] .'</b></div> '; }
echo '<div class="menu"><input type="submit" name="lang" value="'. $lang->word('save') .'" /></div>
</form>';
$tpl->div('block', NAV.'<a href="javascript:history.back(-1);">'.$lang->word('back').'</a><br/>'. HICO .'<a href="/">'. $lang->word('home') .'</a>');
require_once(SYS.'/view/footer.php');
?>