Вход Регистрация
Файл: user/settings/them.php
Строк: 66
<?php

/* Мод "Тема оформления"
 * Версия v0.0.1
 * Дата последнего редактирования 21.11.2014
 * Двиг DCMS Special
 * Модифицировал densnet
 * Файл them.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';

user::only_reg();

$set['title'] = 'Общие настройки';
require_once 
'../../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();
err();
aut();

#Навигация
echo "<div class = 'razd'><a href = '/index.php'>Главная</a> > <a href = '/umenu.php'>Кабинет</a> > <a href = '?'><b>Тема оформления</b></a></div>";

echo 
"<form name = 'settings' class = 'razd' action = '?$passgen' method = 'POST'>";

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 
"<button name = 'save' class = 'action'>";
echo 
"<span class = 'label'><span class = 'icon icon67' /> Сохранить</span>";
echo 
"</button></form>";

if (isset(
$_SESSION['refer']) && $_SESSION['refer'] != NULL && otkuda($_SESSION['refer'])) {
    echo 
"<div class = 'razd'>" . img('left.png') . " <a href = '$_SESSION[refer]'>" . otkuda($_SESSION['refer']) . "</a></div>";
}
echo 
"<div class = 'razd'>" . img('left.png') . " <a href = '/umenu.php'>Кабинет</a></div>";

require_once 
'../../sys/inc/tfoot.php';
Онлайн: 2
Реклама