Вход Регистрация
Файл: adm_panel/them_installer.php
Строк: 95
<?php

/*
 * Панель управления
 * DCMS Special
 * Модифицировал densnet
 * Файл them_installer.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/adm_check.php';
require_once 
'../sys/inc/user.php';

user_access('adm_themes', null, 'index.php?' . SID);
adm_check();

$set['title'] = 'Установка тем';
require_once 
'../sys/inc/thead.php';

if (isset(
$_FILES['file']) && filesize($_FILES['file']['tmp_name']) != 0) {
    
$file = text::esc(stripcslashes(htmlspecialchars($_FILES['file']['name'])));
    
$file = preg_replace('#(#|?)#', NULL, $file);
    
$name = text::esc(trim(retranslit(preg_replace('#.[^.]*$#', NULL, $file)))); // имя файла без расширения
    
$ras = strtolower(preg_replace('#^.*.#i', NULL, $file));
    if (
$ras != 'zip') {
        
$err = 'Тема должна находиться в ZIP архиве';
    }
    if (!isset(
$err)) {

        
$zip = new PclZip($_FILES['file']['tmp_name']);
        
$them_default = new PclZip(H . 'style/themes/them.zip');
        
$content = $zip->extract(PCLZIP_OPT_BY_NAME, 'them.name', PCLZIP_OPT_EXTRACT_AS_STRING);
        
$them_name = trim(text::esc(@$content[0]['content']));
        if (
utf8_strlen($them_name) == null) {
            
$err = 'Файл "them.name" пуст или не найден';
        }

        
$content = $zip->extract(PCLZIP_OPT_BY_NAME, 'style.css', PCLZIP_OPT_EXTRACT_AS_STRING);
        
$css = trim(text::esc(@$content[0]['content']));
        if (
utf8_strlen($them_name) == null) {
            
$err = 'Файл "style.css" пуст или не найден';
        }
        @
mkdir(H . 'style/themes/' . $name, 0777);
        @
chmod(H . 'style/themes/' . $name, 0777);
        if (
$name != NULL) {
            @
delete_dir(PCLZIP_OPT_PATH, H . 'style/themes/' . $name);
        }
        
$zip->extract(PCLZIP_OPT_PATH, H . 'style/themes/' . $name, PCLZIP_OPT_SET_CHMOD, 0777, PCLZIP_OPT_BY_PREG, "#^[^.ht]+#ui");
        if (isset(
$_POST['add_of_default']) && $_POST['add_of_default'] == 1) {
            
$them_default->extract(PCLZIP_OPT_PATH, H . 'style/themes/' . $name, PCLZIP_OPT_SET_CHMOD, 0777);
        }

        @
chmod(H . 'style/themes/' . $name . '/images/', 0777);
    } else {
        
$err = 'Невозможно создать папку с темой';
    }
    if (!isset(
$err)) {
        
msg('Тема "' . $name . ' (' . $them_name . ')" успешно установлена');
    }
}
title();
err();
aut();

#Навигация
echo "<div class = 'razd'><a href = '/index.php'>Главная</a> > <a href = '/umenu.php'>Кабинет</a> > <a href = '/adm_panel/'>Панель управления</a> > <a href = '?'><b>Установка тем</b></a></div>";
echo 
"<div style = 'font-size: 18px;font-weight: bold;' class = 'razdel'>" . img('other.png') . " Установка тем</div>";

echo 
"<form class = 'razd' enctype = 'multipart/form-data' action = '?' method = 'post'>";
echo 
"Выгрузить:<br />n";
echo 
"<input name = 'file' type = 'file' accept = 'application/zip' /><br />n";
echo 
"<label><input type = 'checkbox' name = 'add_of_default' value = '1' /> Добавить недостающие файлы</label><br />n";
echo 
"<input class = 'submit' type = 'submit' value = 'Далее' /><br />n";
echo 
"Тема должна находится в zip архиве без папки<br />n";
echo 
"Присутствие файлов them.name и style.css обязательно<br />n";
echo 
"Название папки темы будет взято из названия архива<br />n";
echo 
"</form>";



echo 
"<a href = 'themes.php'><div class = 'razd'>" . img('left.png') . " Темы оформления</div></a>";

if (
user_access('adm_panel_show')) {
    echo 
"<a href = '/adm_panel/'><div class = 'razd'>" . img('left.png') . " Панель управления</div></a>";
}


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