Файл: user/settings.php
Строк: 175
<?php
require_once '../sys/inc/start.php';
require_once '../sys/inc/compress.php';
require_once '../sys/inc/sess.php';
require_once '../sys/inc/settings.php';
require_once '../sys/inc/db_connect.php';
require_once '../sys/inc/ipua.php';
require_once '../sys/inc/fnc.php';
require_once '../sys/inc/user.php';
only_reg();
$set['title'] = 'Общие настройки';
require_once '../sys/inc/thead.php';
if (isset($_POST['save'])) {
if (isset($_POST['set_online']) && ($_POST['set_online'] == 2 || $_POST['set_online'] == 1 || $_POST['set_online'] == 0)) {
$user['set_online'] = intval($_POST['set_online']);
mysql_query("UPDATE `user` SET `set_online` = '$user[set_online]' WHERE `id` = '$user[id]' LIMIT 1");
} else {
$err[] = 'Ошибка панели онлайн пользователей';
}
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 = 'Ошибка режима добавления контактов';
}
$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` = '0' 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");
$user['set_forum'] = (isset($_POST['set_forum']) && $_POST['set_forum']) ? '1' : '0';
mysql_query("UPDATE `user` SET `set_forum` = '" . mysql_real_escape_string($user['set_forum']) . "' WHERE `id` = '$user[id]' LIMIT 1");
if (isset($_POST['set_time_chat']) && (is_numeric($_POST['set_time_chat']) && $_POST['set_time_chat'] >= 0 && $_POST['set_time_chat'] <= 900)) {
$user['set_time_chat'] = intval($_POST['set_time_chat']);
$set['time_chat'] = $user['set_time_chat'];
mysql_query("UPDATE `user` SET `set_time_chat` = '$user[set_time_chat]' WHERE `id` = '$user[id]' LIMIT 1");
} else {
$err[] = 'Ошибка во времени автообновления';
}
if (isset($_POST['set_them']) && preg_match('#^([A-z0-9-_()]+)$#ui', $_POST['set_them']) && is_dir(H . 'style/themes/' . $_POST['set_them'])) {
$user['set_them'] = $_POST['set_them'];
mysql_query("UPDATE `user` SET `set_them` = '$user[set_them]' WHERE `id` = '$user[id]' LIMIT 1");
} elseif (isset($_POST['set_them2']) && preg_match('#^([A-z0-9-_()]+)$#ui', $_POST['set_them2']) && is_dir(H . 'style/themes/' . $_POST['set_them2'])) {
$user['set_them2'] = $_POST['set_them2'];
mysql_query("UPDATE `user` SET `set_them2` = '$user[set_them2]' WHERE `id` = '$user[id]' LIMIT 1");
} else {
$err[] = 'Ошибка применения темы';
}
if (isset($_POST['set_p_str']) && is_numeric($_POST['set_p_str']) && $_POST['set_p_str'] > 0 && $_POST['set_p_str'] <= 100) {
$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[] = 'Неправильное количество пунктов на страницу';
}
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[] = 'Ошибка временной зоны';
}
if (!isset($err)) {
msg('Изменения успешно приняты');
header("Location: settings.php?" . SID);
exit;
}
}
err();
aut();
echo "<div class = 'tabs'>";
echo "<a href = '/user/settings.php' class = 'active'>Общие</a>";
echo "<a href = '/user/private/'>Приватность</a>";
echo "<a href = '/user/password_edit.php'>Безопасность</a>";
echo "</div><div class = 'tabcontent'>";
echo "<form name = 'settings' action = '?$passgen' method = 'POST'>";
echo "Автообновление в чате:<br />";
echo "<input type = 'text' aria-invalid='false' class = 'invalid input-medium' name = 'set_time_chat' value = '$set[time_chat]' maxlength = '3' /><br />";
echo "Пунктов на страницу:<br />";
echo "<input type = 'text' aria-invalid='false' class = 'invalid input-medium' name = 'set_p_str' value = '$set[p_str]' maxlength = '3' /><br />";
echo "<div class = 'mtp'></div>";
echo "Добавление контактов:<br />";
echo "<select name='add_konts'>n";
echo "<option value='2'" . ($user['add_konts'] == 2 ? " selected='selected'" : null) . ">При чтении сообщений</option>n";
echo "<option value='1'" . ($user['add_konts'] == 1 ? " selected='selected'" : null) . ">При написании сообщения</option>n";
echo "<option value='0'" . ($user['add_konts'] == 0 ? " selected='selected'" : null) . ">Только вручную</option>n";
echo "</select><br />n";
echo "Тема (" . (IS_WEB ? 'WEB' : 'WAP') . "):<br/>";
echo "<select name = 'set_them" . (IS_WEB ? '2' : null) . "'>n";
$opendirthem = opendir(H . 'style/themes');
while ($themes = readdir($opendirthem)) {
#пропускаем корневые папки и файлы
if ($themes == '.' || $themes == '..' || !is_dir(H . "style/themes/$themes")) {
continue;
}
#пропускаем темы для определенных браузеров
if (file_exists(H . "style/themes/$themes/" . (IS_WEB ? 'wap' : 'web') . ".txt")) {
continue;
}
echo "<option value = '$themes'" . ($user['set_them' . (IS_WEB ? '2' : null)] == $themes ? " selected = 'selected'" : null) . ">" . trim(file_get_contents(H . 'style/themes/' . $themes . '/them.name')) . "</option>n";
}
closedir($opendirthem);
echo "</select><br />";
echo "Панель онлайн пользователей<br/>";
echo "<select name = 'set_online'>";
echo "<option value = '2'" . ($user['set_online'] == 2 ? " selected = 'selected'" : null) . ">Только данные</option>";
echo "<option value = '1'" . ($user['set_online'] == 1 ? " selected = 'selected'" : null) . ">Данные + аватары</option>";
echo "<option value = '0'" . ($user['set_online'] == 0 ? " selected = 'selected'" : null) . ">Не показывать</option>";
echo "</select><br />";
echo "Время<br/>";
echo "<select name = 'set_timesdvig'><br/>";
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><br />";
echo "<div class = 'mtp'></div>";
echo "<label><input type = 'checkbox'" . ($user['set_times'] ? " checked = 'checked'" : null) . " name = 'set_times' value = '1' />Время и дата в заголовке</label><br/>";
echo "<label><input type = 'checkbox'" . ($user['set_forum'] ? " checked = 'checked'" : null) . " name = 'set_forum' value = '1' />Посление темы форума</label><br/>";
echo "<label><input type = 'checkbox'" . ($user['set_files'] ? " checked = 'checked'" : null) . " name = 'set_files' value = '1' />Выгрузка файлов</label><br/>";
echo "<label><input type = 'checkbox'" . ($user['show_url'] ? " checked = 'checked'" : null) . " name = 'show_url' value = '1' />Местоположение</label><br/>";
if ($user['ank_mail']) {
echo "<label><input type = 'checkbox' name = 'set_news_to_mail' " . ($user['set_news_to_mail'] ? " checked = 'checked'" : null) . " value = '1' />Получать новости на E-mail</label><br/>";
}
echo "<div class = 'button_blue'>";
echo "<button name = 'save'>Сохранить изменения</button>";
echo "</div></form>";
echo "</div><div class = 'foot'>";
if (isset($_SESSION['refer']) && $_SESSION['refer'] != NULL && otkuda($_SESSION['refer'])) {
echo "<img src = '/style/icons/left.png' /> <a href = '$_SESSION[refer]'>" . otkuda($_SESSION['refer']) . "</a><br />";
}
echo "<img src = '/style/icons/left.png' /> <a href = '/umenu.php'>Кабинет</a><br />";
echo "</div>";
require_once '../sys/inc/tfoot.php';