Файл: user/inc/lang.php
Строк: 37
<?php
$back_link_set = true;
$set['title'] = 'Смена языка';
if ($set['lang_test'] == 0) {
exit(header('Location: /'));
}
if (isset($_POST['save'])) {
#если адрес пуст
if ($_GET['returnUrl'] == null) {
$_GET['returnUrl'] = base64_encode('?');
}
#если гость
if ($user['id'] < 1) {
$_SESSION['lang'] = $_POST['lang'];
} else {
#если юзер
mysql_query("UPDATE `user` SET `lang` = '" . my_esc($_POST['lang']) . "' WHERE `id` = '" . $user['id'] . "' LIMIT 1");
#Удаляем кэш
cache_delete::user($user['id']);
}
$_SESSION['message'] = lang('Язык установлен');
exit(header('Location: ' . base64_decode($_GET['returnUrl'])));
}
echo "<form method='post' class='list-group-item' action=''>";
echo "<select name='lang' class='form-control'>";
$lang_list = query("SELECT * FROM `lang_list`");
while ($post = mysql_fetch_assoc($lang_list)) {
echo "<option value='" . output_text($post['name_g']) . "' " . ($post['name_g'] == $set['lang'] ? " selected='selected'" : null) . ">" . output_text($post['name']) . "</option>";
}
echo "</select><br />";
echo "<button type='submit' name='save' class='btn btn-success'><span class='fa fa-save'></span> " . lang('Сохранить') . "</button>";
echo "</form>";