Ejemplo n.º 1
0
function MultiDel($dir, $file_list = "")
{
    //Coded By Windy2000 20031001 v1.0
    if (is_dir($dir)) {
        $mydir = opendir($dir);
        while (($file = readdir($mydir)) !== false) {
            if ($file != "." && $file != "..") {
                $the_name = $dir . "/" . $file;
                if (is_dir($the_name)) {
                    if (empty($file_list) || strpos($file_list, $file) !== false) {
                        MultiDel($the_name);
                    } else {
                        MultiDel($the_name, $file_list);
                    }
                } else {
                    if (empty($file_list) || strpos($file_list, $file) !== false) {
                        @unlink($the_name);
                    }
                }
                //is_dir($the_name) ? MultiDel($the_name) : @unlink($the_name);
            }
        }
        closedir($mydir);
        @rmdir($dir);
    } else {
        if (is_file($dir)) {
            unlink($dir);
        }
    }
    return;
}
Ejemplo n.º 2
0
    public static function uninstall()
    {
        global $db, $setting, $admin_cat;
        $info = self::info();
        $db->delete($setting['db']['pre'] . "topic");
        $db->exec("drop", "table", $setting['db']['pre'] . "topic");
        $db->delete($setting['db']['pre'] . "topic_link");
        $db->exec("drop", "table", $setting['db']['pre'] . "topic_link");
        $db->delete($setting['db']['pre'] . "admin_cat", array("file", "=", "topic.php"));
        $db->delete($setting['db']['pre'] . "plugin", array("idx", "=", $info['idx']));
        deleteCache("admin_cat");
        deleteCache("plugin");
        $err = array();
        if ($db->GetError($err)) {
            showInfo($setting['language']['plugin_err_uninstall'] . "\r\n\t\t\t<br />\r\n\t\t\t<pre>\r\n\t\t\t" . join("\n------------------------\n", $err) . "\r\n\t\t\t</pre>\r\n\t\t\t");
        } else {
            includeCache("admin_cat");
            $admin_cat = toJson($admin_cat, $setting['gen']['charset']);
            echo <<<mystep
<script language="javascript">
parent.admin_cat = {$admin_cat};
parent.setNav();
</script>
mystep;
            MultiDel(dirname(__FILE__) . "/topic/");
            MakeDir(dirname(__FILE__) . "/topic/");
            buildParaList("plugin");
            echo showInfo($setting['language']['plugin_uninstall_done'], false);
        }
    }
Ejemplo n.º 3
0
         $tbl_list = $db->GetTabs($setting['db']['name']);
         $max_count = count($tbl_list);
         $files = array();
         for ($i = 0; $i < $max_count; $i++) {
             $content = "DROP TABLE IF EXISTS `{$tbl_list[$i]}`;\n\n";
             $content .= $db->GetTabSetting($tbl_list[$i], $setting_sub['db']['name']) . "\n" . $db->GetTabData($setting_sub['db']['name'] . "." . $tbl_list[$i]);
             $files[$i] = $dir . $setting_sub['db']['name'] . "_" . $tbl_list[$i] . ".sql";
             WriteFile($files[$i], $content);
         }
         zip($files, $zipfile, $dir);
         header("Content-type: application/zip");
         header("Accept-Ranges: bytes");
         header("Accept-Length: " . filesize($zipfile));
         header("Content-Disposition: attachment; filename=" . basename($zipfile));
         $content = GetFile($zipfile);
         MultiDel($dir);
         unlink($zipfile);
     } else {
         $content = "DROP TABLE IF EXISTS `{$table_name}`;\n\n";
         $content .= $db->GetTabSetting($table_name) . "\n" . $db->GetTabData($table_name);
         header("Content-type: text/plain");
         header("Accept-Ranges: bytes");
         header("Accept-Length: " . strlen($content));
         header("Content-Disposition: attachment; filename=" . date("Ymd") . "_db_{$table_name}.sql");
     }
     echo $content;
 } elseif ($method == "optimize") {
     $log_info = $setting['language']['admin_func_backup_optimize'];
     $op_info = "<b>Optimize Table Done! </b><br /><br />";
     if ($table_name == "all") {
         $tbl_list = $db->GetTabs($setting_sub['db']['name']);
Ejemplo n.º 4
0
function delTplCache($tpl = "", $file = "")
{
    global $setting;
    $cache_pathe = ROOT_PATH . "/" . $setting['path']['template'] . "/cache/";
    if (empty($tpl)) {
        MultiDel($cache_pathe);
    } elseif (empty($file)) {
        MultiDel($cache_pathe . $tpl);
    } else {
        MultiDel($cache_pathe . $tpl . "/" . $file . ".php");
    }
}
Ejemplo n.º 5
0
         $log_info = $setting['language']['admin_art_content_delete'];
         $sql_list = array();
         $db->delete($setting['db']['pre_sub'] . "news_show", array("news_id", "n=", $news_id));
         $db->delete($setting['db']['pre_sub'] . "news_detail", array("news_id", "n=", $news_id));
         $db->select($setting['db']['pre_sub'] . "attachment", "*", array(array("web_id", "n=", $web_id), array("news_id", "n=", $news_id)));
         while ($record = $db->GetRS()) {
             $the_path = ROOT_PATH . "/" . $setting['path']['upload'] . date("/Y/m/d/", substr($record['file_time'], 0, 10));
             $the_ext = GetFileExt($record['file_name']);
             if ($the_ext == "php") {
                 $the_ext = "txt";
             }
             $the_file = $record['file_time'] . "." . $the_ext;
             MultiDel($the_path . $the_file);
             MultiDel($the_path . "cache/" . $the_file);
             MultiDel($the_path . "preview/" . $the_file);
             MultiDel($the_path . "preview/cache/" . $the_file);
             $sql_list[] = $db->delete($setting['db']['pre'] . "attachment", array("id", "n=", $record['id']), false);
         }
         $db->Free();
         $db->BatchExec($sql_list);
         delCacheFile($news_id, $setting_sub["info"]['web_id']);
     }
     break;
 case "unlock":
     if (!$op_mode) {
         $goto_url = $req->getServer("HTTP_REFERER");
     } else {
         $log_info = $setting['language']['admin_art_content_unlock'];
         $db->update($setting['db']['pre_sub'] . "news_show", array("add_date", "now()"), array("news_id", "n=", $news_id));
     }
     break;
Ejemplo n.º 6
0
    case "list":
    case "show":
        build_page($method);
        break;
    case "delete":
        $log_info = $setting['language']['admin_web_template_delete'];
        unlink($tpl_path . $idx . "/" . $req->getGet("file"));
        $idx .= "&file=" . $req->getGet("file");
        break;
    case "remove":
        $log_info = $setting['language']['admin_web_template_remove'];
        if ($idx == "default" || strpos($idx, "admin") !== false) {
            showInfo($setting['language']['admin_web_template_remove_error']);
        }
        MultiDel($tpl_path . $idx);
        MultiDel(ROOT_PATH . "/images/" . $idx);
        $idx = "";
        break;
    case "set":
        $log_info = $setting['language']['admin_web_template_set'];
        for ($i = 0, $m = count($_POST['web_id']); $i < $m; $i++) {
            $cfg_file = ROOT_PATH . "/include/config_" . $_POST['idx'][$i] . ".php";
            if (!is_file($cfg_file)) {
                continue;
            }
            include $cfg_file;
            $setting_sub['gen']['template'] = $_POST['tpl'][$i];
            $result = <<<mystep
<?php
\$setting_sub = array();
Ejemplo n.º 7
0
    @unlink($target_file);
    MultiDel($result_dir);
    sleep(1);
    mkdir($result_dir);
    $mypack = new MyPack($pack_dir, $pack_file);
    $mypack->AddIgnore(basename(dirname(__FILE__)), ".svn", "web.config", "aspnet_client", "include/install.lock", "Thumbs.db", "bak", "xcache", "_test", "config_test.php", "config-bak.php", "cfna_mis");
    if (!empty($cs)) {
        $mypack->setCharset("gbk", $cs, $lng_type, ".php,.tpl,.html,.htm,.sql");
    }
    $mypack->DoIt();
    //echo $mypack->GetResult();
    $result = "";
    $result .= GetFile("mypack.class.php");
    $result .= "\n";
    $result .= GetFile("setup.php");
    $result = str_replace("?>\n<?php", "", $result);
    WriteFile($target_file, $result, "wb");
    unset($result);
    copy("intro.txt", $result_dir . "/readme.txt");
    require "../source/class/myzip.class.php";
    rename($result_dir, "upload");
    zip("upload", "build/" . $result_dir . ".zip");
    MultiDel("upload");
}
?>
<script language="JavaScript">
location.href = "build/<?php 
echo $result_dir;
?>
.zip";
</script>
Ejemplo n.º 8
0
<?php

define('ROOT_PATH', str_replace("\\", "/", realpath(dirname(__FILE__) . "/../")));
require ROOT_PATH . "/include/config.php";
require ROOT_PATH . "/include/parameter.php";
require ROOT_PATH . "/source/function/global.php";
require ROOT_PATH . "/source/function/web.php";
if ($_SERVER['QUERY_STRING'] == "done") {
    MultiDel(ROOT_PATH . "/error.log");
    MultiDel(ROOT_PATH . "/" . $setting['path']['cache']);
    MultiDel(dirname(__FILE__));
}
if (is_file("../include/install.lock")) {
    header("location: ../");
    exit;
}
header("Expires: Tue, 1 Jan 1980 00:00:00 GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Pragma: no-cache");
header("Content-Type: text/html;charset=" . $setting['gen']['charset']);
date_default_timezone_set("PRC");
set_time_limit(30);
ini_set('memory_limit', '32M');
ini_set('magic_quotes_runtime', 0);
error_reporting(E_ALL ^ E_NOTICE);
$mystep = new MyStep();
$req = $mystep->getInstance("MyReq", $setting['cookie'], $setting['session']);
$step = $req->getReq("step");
switch ($step) {
    case 1:
        break;
Ejemplo n.º 9
0
 public function clean()
 {
     $thePath = array_shift(pathinfo($this->thePath)) . "/";
     if ($handle = opendir($thePath)) {
         while (false !== ($file = readdir($handle))) {
             if ($file != "." && $file != "..") {
                 MultiDel($thePath . $file);
             }
         }
         closedir($handle);
         return true;
     }
     return false;
 }
Ejemplo n.º 10
0
        if ($handle = opendir($cache_path)) {
            while (false !== ($file = readdir($handle))) {
                if ($file != "." && $file != "..") {
                    MultiDel($cache_path . $file);
                }
            }
            closedir($handle);
        }
    }
    if (strpos($ccList, ",8,") !== false) {
        $cache->clean();
        $cache_path = ROOT_PATH . "/" . $setting['path']['upload'] . "/tmp/";
        if ($handle = opendir($cache_path)) {
            while (false !== ($file = readdir($handle))) {
                if ($file != "." && $file != "..") {
                    MultiDel($cache_path . $file);
                }
            }
            closedir($handle);
        }
    }
    $goto_url = $setting['info']['self'];
} else {
    $tpl_info['idx'] = "web_cache";
    $tpl_tmp = $mystep->getInstance("MyTpl", $tpl_info);
    $tpl_tmp->allow_script = true;
    $tpl_tmp->Set_Variable('title', $setting['language']['admin_web_cache_title']);
    $i = 1;
    foreach ($expire_list as $key => $value) {
        $tpl_tmp->Set_Loop("expire", array("idx" => $i++, "page" => $key, "expire" => $value));
    }
Ejemplo n.º 11
0
         $db->delete($setting['db']['pre'] . "admin_cat", array(array("file", "=", 'custom_form.php?mid=' . $mid), array("pid", "n=", $catid)));
         unlink("setting/{$mid}_cf_submit_cn.tpl");
         unlink("setting/{$mid}_cf_submit_en.tpl");
         unlink("setting/{$mid}_cf_print_cn.tpl");
         unlink("setting/{$mid}_cf_print_en.tpl");
         unlink("setting/{$mid}_cf_list_cn.tpl");
         unlink("setting/{$mid}_cf_list_en.tpl");
         unlink("setting/{$mid}_block_cf_list_cn.tpl");
         unlink("setting/{$mid}_block_cf_list_en.tpl");
         unlink("setting/{$mid}_mail_cn.tpl");
         unlink("setting/{$mid}_mail_en.tpl");
         unlink("setting/{$mid}_edit_data.tpl");
         unlink("setting/{$mid}_list_data.tpl");
         unlink("setting/{$mid}_ext_script.php");
         unlink("setting/{$mid}.php");
         MultiDel("setting/{$mid}/");
         deleteCache("admin_cat");
     }
     $goto_url = $req->getServer("HTTP_REFERER");
     $goto_url = getSafeCode($goto_url, $setting['gen']['charset']);
     break;
 case "mail":
     if (function_exists("ext_func")) {
         ext_func();
     }
     if (!empty($_POST['sender_name'])) {
         $setting['web']['title'] = $_POST['sender_name'];
     }
     if (!empty($_POST['sender_email'])) {
         $setting['web']['email'] = $_POST['sender_email'];
     }