Файл: plugins/user.settings.php
Строк: 145
<?
if ($level == 0){
header('Location: /index.php');
exit;
}
if (isset($_POST['view_news'])) {
$user['mail_send_files'] = (int) $_POST['mail_send_files'];
$user['view_avatar'] = (int) $_POST['view_avatar'];
$user['page_str'] = (int) $_POST['page_str'];
$user['view_news'] = (int) $_POST['view_news'];
$user['cash'] = (int) $_POST['cash'];
$user['count_goods'] = (int) $_POST['count_goods'];
$user['set_timesdvig'] = (int) $_POST['set_timesdvig'];
$user['design'] = $_POST['design'];
if ($user['design'] && !preg_match("#^([A-zА-я0-9-_., ])+$#ui", $user['design'])) {
$err[] = 'В названии темы присутствуют запрещенные символы';
}
if (!isset($err)) {
$sql -> update("UPDATE `users` SET `mail_send_files` = '$user[mail_send_files]', `view_avatar` = '$user[view_avatar]', `cash` = '$user[cash]', `page_str` = '$user[page_str]', `view_news` = '$user[view_news]', `count_goods` = '$user[count_goods]', `set_timesdvig` = '$user[set_timesdvig]', `design` = '$user[design]' WHERE `id` = '$user[id]' LIMIT 1");
$messages[] = 'Настройки успешно приняты';
} else {
$err[] = 'Ошибка при сохранении настроек';
}
}
$system['title'] = 'Личные настройки';
require SYS . 'header.php';
?>
<div class="nav2">
<form class="form-horizontal" action="?func=user.settings" method="POST" style="margin: 2px;">
<div class="control-group">
<label class="control-label" for="set_timesdvig">Сдвиг времени</label>
<div class="controls">
<select name="set_timesdvig" id="set_timesdvig" class="span1" style="width: auto;">
<?
for ($i = -12; $i < 12; $i++) {
?><option value='<?= $i?>' <?= ($user['set_timesdvig'] == $i ? " selected='selected'" : null)?>><?= date("G:i", $time + ($i * 60 * 60))?></option><?
}
?>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="page_str">Пунктов на страницу</label>
<div class="controls">
<select name="page_str" id="page_str" class="span1" style="width: auto;">
<?
for ($i = 5; $i <= 15; $i++) {
?><option value='<?= $i?>' <?= ($user['page_str'] == $i ? " selected='selected'" : null)?>><?= $i?></option><?
}
?>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="count_goods">Товаров на страницу</label>
<div class="controls">
<select name="count_goods" id="count_goods" class="span1" style="width: auto;">
<?
for ($i = 3; $i <= 9; $i++) {
?><option value='<?= $i?>' <?= ($user['count_goods'] == $i ? " selected='selected'" : null)?>><?= $i?></option><?
}
?>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="design">Тема оформления</label>
<div class="controls">
<select name="design" id="design" class="span1" style="width: auto;">
<?
$opendirthem = opendir(DIRTHEME);
while ($themes = readdir($opendirthem)) {
if ($themes == '.' || $themes == '..' || !is_dir(DIRTHEME . $themes))continue;
?>
<option value='<?= $themes?>'<?= ($user['design'] == $themes ? " selected='selected'" : null)?>>
<?= text(file_get_contents(DIRTHEME . $themes . '/them.name'))?>
</option>
<?
}
closedir($opendirthem);
?>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="view_news">Скрывать последнюю новость</label>
<div class="controls">
<select name="view_news" id="view_news" class="span1" style="width: auto;">
<option value='1' <?= ($user['view_news'] == 1 ? " selected='selected'" : null)?>>Да</option>
<option value='0' <?= ($user['view_news'] == 0 ? " selected='selected'" : null)?>>Нет</option>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="cash">Профиль</label>
<div class="controls">
<select name="cash" id="cash" class="span1" style="width: auto;">
<option value='1' <?= ($user['cash'] == 1 ? " selected='selected'" : null)?>>Исполнитель</option>
<option value='0' <?= ($user['cash'] == 0 ? " selected='selected'" : null)?>>Заказчик</option>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="view_avatar">Вывод аватаров</label>
<div class="controls">
<select name="view_avatar" id="view_avatar" class="span1" style="width: auto;">
<option value='1' <?= ($user['view_avatar'] == 1 ? " selected='selected'" : null)?>>Выводить</option>
<option value='0' <?= ($user['view_avatar'] == 0 ? " selected='selected'" : null)?>>Скрывать</option>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="mail_send_files">Прикрепление файлов в почте</label>
<div class="controls">
<select name="mail_send_files" id="mail_send_files" class="span1" style="width: auto;">
<option value='1' <?= ($user['mail_send_files'] == 1 ? " selected='selected'" : null)?>>Включено</option>
<option value='0' <?= ($user['mail_send_files'] == 0 ? " selected='selected'" : null)?>>Отключено</option>
</select>
</div>
</div>
<div class="control-group">
<div class="controls">
<button type="submit" class="btn">Сохранить</button>
</div>
</div>
</form>
</div>
<div class="foot">
« <a href="?func=user.main">Кабинет</a>
</div>