예제 #1
0
 */
if ($rec == 'del') {
    // 载入扩展功能
    include_once ROOT_PATH . ADMIN_PATH . '/include/cloud.class.php';
    $dou_cloud = new Cloud('cache');
    // CSRF防御令牌验证
    $firewall->check_token($_REQUEST['token'], 'module_uninstall');
    if ($check->is_extend_id($extend_id = $_REQUEST['extend_id'])) {
        $module_zip = $cache_dir . $extend_id . '.zip';
        // 模块压缩包
        $module_dir = $cache_dir . $extend_id;
        // 模块目录
        if ($dou_cloud->file_unzip($module_zip, $module_dir)) {
            $dou_cloud->modify_theme_dir($module_dir);
            // 将解压得到的扩展目录中的模板文件夹名改成当前启用的模板文件夹名
            $dou_cloud->clear_module($extend_id);
            $dou_cloud->change_updatedate('module', $extend_id, true);
            // 删除更新时间记录
            $dou->del_dir($module_dir);
            @unlink($module_zip);
            $dou->query("DELETE FROM " . $dou->table('nav') . " WHERE module = '{$extend_id}'");
            $dou->query("DELETE FROM " . $dou->table('nav') . " WHERE module = '{$extend_id}" . "_category'");
            $dou->create_admin_log($_LANG['module_uninstall_success'] . ': ' . $extend_id);
            $dou->dou_header('module.php?rec=uninstall');
        } else {
            $dou->dou_msg($_LANG['module_unzip_wrong'], 'module.php?rec=uninstall');
        }
    } else {
        $dou->dou_msg($_LANG['module_uninstall_wrong'], 'module.php?rec=uninstall');
    }
}