Файл: user/inc/dop_set.php
Строк: 156
<?php
$set['title'] = lang('Дополнительные настройки');
only_reg();
$back_link_set = true;
if (isset($_POST['save'])) {
if (isset($_POST['add_konts']) && ($_POST['add_konts'] == 2 || $_POST['add_konts'] == 1 || $_POST['add_konts'] == 0)) {
$user['add_konts'] = intval($_POST['add_konts']);
mysql_query("UPDATE `user` SET `add_konts` = '$user[add_konts]' WHERE `id` = '$user[id]' LIMIT 1");
} else {
$err = lang('Ошибка режима добавления контактов');
}
$user['set_translit'] = (isset($_POST['set_translit']) && $_POST['set_translit']) ? '1' : '0';
mysql_query("UPDATE `user` SET `set_translit` = '" . mysql_real_escape_string($user['set_translit']) . "' WHERE `id` = '$user[id]' LIMIT 1");
$user['set_files'] = (isset($_POST['set_files']) && $_POST['set_files']) ? '1' : '0';
mysql_query("UPDATE `user` SET `set_files` = '" . mysql_real_escape_string($user['set_files']) . "' WHERE `id` = '$user[id]' LIMIT 1");
$user['show_url'] = (isset($_POST['show_url']) && $_POST['show_url']) ? '1' : '0';
mysql_query("UPDATE `user` SET `show_url` = '" . mysql_real_escape_string($user['show_url']) . "' WHERE `id` = '$user[id]' LIMIT 1");
$user['set_news_to_mail'] = (isset($_POST['set_news_to_mail']) && $_POST['set_news_to_mail']) ? '1' : '0';
mysql_query("UPDATE `user` SET `set_news_to_mail` = '" . mysql_real_escape_string($user['set_news_to_mail']) . "' WHERE `id` = '$user[id]' LIMIT 1");
$user['set_times'] = (isset($_POST['set_times']) && $_POST['set_times']) ? '1' : '0';
mysql_query("UPDATE `user` SET `set_times` = '" . mysql_real_escape_string($user['set_times']) . "' WHERE `id` = '$user[id]' LIMIT 1");
if (isset($_POST['set_p_str']) && is_numeric($_POST['set_p_str']) && $_POST['set_p_str'] > 0 && $_POST['set_p_str'] <= $set['p_str_set'] == 1 ? 30 : 10) {
$user['set_p_str'] = intval($_POST['set_p_str']);
$set['p_str'] = $user['set_p_str'];
mysql_query("UPDATE `user` SET `set_p_str` = '$user[set_p_str]' WHERE `id` = '$user[id]' LIMIT 1");
} else {
$err = lang('Неправильное количество пунктов на страницу');
}
if (isset($_POST['set_timesdvig']) && (is_numeric($_POST['set_timesdvig']) && $_POST['set_timesdvig'] >= -12 && $_POST['set_timesdvig'] <= 12)) {
$user['set_timesdvig'] = intval($_POST['set_timesdvig']);
mysql_query("UPDATE `user` SET `set_timesdvig` = '$user[set_timesdvig]' WHERE `id` = '$user[id]' LIMIT 1");
} else {
$err[] = lang('Ошибка временной зоны');
}
if (!isset($err)) {
$_SESSION['message'] = lang('Изменения успешно приняты');
#Удаляем кэш
cache_delete::user($user['id']);
exit(header('Location: ?rand=' . mt_rand(0, 9999)));
}
}
err();
echo "<form method='post' class='list-group-item' action='?$passgen'>n";
echo "<label class='c-input c-checkbox'><input type='checkbox'" . ($user['set_translit'] ? " checked='checked'" : null) . " name='set_translit' value='1' /><span class='c-indicator'></span> " . lang('Транслит') . "</label><br />n";
echo "<label class='c-input c-checkbox'><input type='checkbox'" . ($user['set_files'] ? " checked='checked'" : null) . " name='set_files' value='1' /><span class='c-indicator'></span> " . lang('Выгрузка файлов') . "</label><br />n";
echo "<label class='c-input c-checkbox'><input type='checkbox'" . ($user['show_url'] ? " checked='checked'" : null) . " name='show_url' value='1' /><span class='c-indicator'></span> " . lang('Местоположение') . "</label><br />n";
if ($user['ank_mail'] != null) {
echo "<label class='c-input c-checkbox'><input type='checkbox' name='set_news_to_mail'" . ($user['set_news_to_mail'] ? " checked='checked'" : null) . " value='1' /><span class='c-indicator'></span> " . lang('Получать новости на E-mail') . "</label><br />";
}
echo "<label class='c-input c-checkbox'><input type='checkbox'" . ($user['set_times'] ? " checked='checked'" : null) . " name='set_times' value='1' /><span class='c-indicator'></span> " . lang('Время') . "</label><br />n";
echo "<select class='form-control' name="set_timesdvig"><br />n";
for ($i = -12; $i < 12; $i++) {
echo "<option value='$i'" . ($user['set_timesdvig'] == $i ? " selected='selected'" : null) . ">" . date("G:i", $time + $i * 60 * 60) . "</option>n";
}
echo "</select>";
echo lang('Пунктов на страницу') . ":<br />";
echo "<select class='form-control' name='set_p_str'>";
echo "<option value='5'" . ($user['set_p_str'] == 5 ? " selected='selected'" : null) . "> 5 </option>";
echo "<option value='7'" . ($user['set_p_str'] == 7 ? " selected='selected'" : null) . "> 7 </option>";
echo "<option value='10'" . ($user['set_p_str'] == 10 ? " selected='selected'" : null) . "> 10 </option>";
if ($set['p_str_set'] == 1) {
echo "<option value='15'" . ($user['set_p_str'] == 15 ? " selected='selected'" : null) . "> 15 </option>";
echo "<option value='20'" . ($user['set_p_str'] == 20 ? " selected='selected'" : null) . "> 20 </option>";
echo "<option value='25'" . ($user['set_p_str'] == 25 ? " selected='selected'" : null) . "> 25 </option>";
echo "<option value='30'" . ($user['set_p_str'] == 30 ? " selected='selected'" : null) . "> 30 </option>";
}
echo "</select>";
echo lang('Добавление контактов') . ":<br />n";
echo "<select class='form-control' name='add_konts'>n";
echo "<option value='2'" . ($user['add_konts'] == 2 ? " selected='selected'" : null) . ">" . lang('При чтении сообщений') . "</option>n";
echo "<option value='1'" . ($user['add_konts'] == 1 ? " selected='selected'" : null) . ">" . lang('При написании сообщения') . "</option>n";
echo "<option value='0'" . ($user['add_konts'] == 0 ? " selected='selected'" : null) . ">" . lang('Только вручную') . "</option>n";
echo "</select><br />";
echo "<button class='btn btn-success' name='save'><span class='fa fa-save fa-fw'></span> " . lang('Сохранить') . "</button>";
echo "</form>n";