Пример #1
0
    Systems::log('<span class="error_log">Не удалось загрузить модуль</span>');
    FunctionSystems::Error('Не удалось загрузить модуль');
} else {
    $zip = new ZipArchive();
    if ($zip->open($install_zip) === true) {
        //извлекаем новую конфигурацию
        $module = $zip->getFromName('info.xml');
        $info_module = new SimpleXMLElement($module);
        $info = array();
        $info["name"] = $info_module->info->name;
        // имя модуля для modules.store
        $info["dir"] = $info_module->info->dir;
        // имя модуля для modules.store
        $info["version"] = $info_module->info->version;
        // имя модуля для modules.store
        $power_module = Systems::local_store_modules("add", $info["dir"], "1");
        // заносим модуль в modules.local
        if ($power_module !== NULL) {
            // если модуль занесён в modules.local, то
            $zip->extractTo(ROOT);
            // распаковываем архив
            # подключаем инсталяционный файл модуля если он есть
            if (file_exists(ROOT . "install_module.php")) {
                require_once ROOT . "install_module.php";
            }
            if (file_exists(ROOT . "install_module.php")) {
                unlink(ROOT . "install_module.php");
            }
            if (file_exists(ROOT . "info.xml")) {
                unlink(ROOT . "info.xml");
            }