Файл: user/settings/them.php
Строк: 79
<?php
/* DCMS S (Special)
* Версия файла 0.0.1
* Дата последнего редактирования 24.10.2015
* Модифицировал densnet
*/
require_once '../../sys/inc/start.php';
require_once H . 'sys/inc/compress.php';
require_once H . 'sys/inc/sess.php';
require_once H . 'sys/inc/settings.php';
require_once H . 'sys/inc/db_connect.php';
require_once H . 'sys/inc/ipua.php';
require_once H . 'sys/inc/fnc.php';
require_once H . 'sys/inc/user.php';
user::only_reg();
$set['title'] = 'Вид';
require_once H . 'sys/inc/thead.php';
if (isset($_POST['save'])) {
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($err)) {
msg('Изменения успешно приняты');
header("Location: them.php?" . SID);
exit;
}
}
title();
aut();
err();
echo '<div class="busi_switcher"><table><tr><td style = "width: 20%;">';
echo "<a href = '/user/settings.php' class = 'brd'>Общие</a>";
echo '</td><td style = "width: 20%;">';
echo "<a class = 'active brd'>Вид</a>";
echo '</td><td style = "width: 20%;">';
echo "<a href = '/user/settings/time.php' class = 'brd'>Время</a>";
echo '</td><td style = "width: 20%;">';
echo "<a href = '/user/settings/private.php' class = 'brd'>Приватность</a>";
echo '</td><td style = "width: 20%;">';
echo "<a href = '/user/settings/password.php' class = 'brd'>Пароль</a>";
echo '</td></tr></table></div>';
echo "<form name = 'settings' class = 'comm' action = '?$passgen' method = 'POST'>";
echo "<span style = 'float:right;'><img src = '/style/icons/Paint-Roller.png' /></span>";
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 "Тема оформления (" . (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 /><br />";
echo "<button name = 'save' class = 'button-green'>Сохранить</button>";
echo "</form>";
if (isset($_SESSION['refer']) && $_SESSION['refer'] != NULL && otkuda($_SESSION['refer'])) {
echo "<div class = 'comm'><a href = '$_SESSION[refer]' style = 'color: #88C057;'><img src = '/style/icons/left.png'/> " . otkuda($_SESSION['refer']) . "</a></div>";
}
echo "<div class = 'comm'><a href = '/umenu.php' style = 'color: #88C057;'><img src = '/style/icons/left.png'/> Кабинет</a></div>";
require_once H . 'sys/inc/tfoot.php';