Файл: user/settings/them.php
Строк: 66
<?php
/* Мод "Тема оформления"
* Версия v0.0.1
* Дата последнего редактирования 20.01.2015
* Двиг DCMS Special
* Модифицировал densnet
* Файл them.php
* Описание: настройки тем оформления
*/
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($err)) {
msg('Изменения успешно приняты');
header("Location: them.php?" . SID);
exit;
}
}
title();
aut();
err();
echo "<form name = 'settings' class = 'razd' action = '?$passgen' method = 'POST'>";
echo "Тема (" . (IS_WEB ? 'WEB' : 'WAP') . "):<br/>";
echo "<div class = 'inputs'>";
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 "<div class = 'input-icon'>" . img16('themes.png') . "</div>";
echo "</div>";
echo "<button name = 'save' class = 'button sign-ins'>" . img16('save.png') . " Сохранить";
echo "</button></form>";
if (isset($_SESSION['refer']) && $_SESSION['refer'] != NULL && otkuda($_SESSION['refer'])) {
echo "<div class = 'razd'><a class = 'add' href = '$_SESSION[refer]'>" . img16('left.png') . " " . otkuda($_SESSION['refer']) . "</a></div>";
}
echo "<div class = 'razd'><a class = 'add' href = '/umenu.php'>" . img16('left.png') . " Кабинет</a></div>";
require_once H . 'sys/inc/tfoot.php';