public function deleteCache()
 {
     DeleteDir(RUNTIME_PATH);
     DeleteDir('../Home/' . RUNTIME_PATH);
     DeleteDir('../Member/' . RUNTIME_PATH);
     $this->assign('jumpUrl', Cookie::get('_currentUrl_'));
     $this->success('删除成功!');
 }
Example #2
0
function DeleteDir($path)
{
    if (is_dir($path) === true) {
        $files = array_diff(scandir($path), array('.', '..'));
        foreach ($files as $file) {
            DeleteDir(realpath($path) . '/' . $file);
        }
        return rmdir($path);
    } else {
        if (is_file($path) === true) {
            return unlink($path);
        }
    }
    return false;
}
Example #3
0
function DeleteDir($switchArr, $dir, $name, &$p)
{
    if (!($dh = @opendir($dir))) {
        return;
    }
    while (false !== ($obj = readdir($dh))) {
        if ($obj == '.' || $obj == '..') {
            continue;
        }
        $newDir = $dir . '\\' . $obj;
        if (empty($name) || $obj == $name) {
            if (($switchArr['d'] || $switchArr['a']) && is_dir($newDir)) {
                if ($switchArr['v']) {
                    //echo "Removing dir: ".$newDir."                                                                                      \r";
                    $p++;
                }
                echo "Competed " . round($p * 3.4) . " %                                                                                              \r";
                RemoveDir($newDir, $switchArr['v']);
            } elseif (($switchArr['f'] || $switchArr['a']) && is_file($newDir)) {
                if ($switchArr['v']) {
                    //echo "Deleting file: ".$newDir."                                                                                      \r";
                    $p++;
                }
                echo "Competed " . round($p * 3.4) . " %                                                                                              \r";
                @unlink($newDir);
            } else {
                //				if ($switchArr['v'])
                //					echo "do nothing on: ".$newDir."\n";
                if ($switchArr['r'] && is_dir($newDir)) {
                    if ($switchArr['v']) {
                        //echo "Processing: ".$newDir."\n";
                        DeleteDir($switchArr, $newDir, $name, $p);
                    }
                }
            }
        } else {
            if ($switchArr['r'] && is_dir($newDir)) {
                if ($switchArr['v']) {
                    //echo "Processing: ".$newDir."\n";
                    DeleteDir($switchArr, $newDir, $name, $p);
                }
            }
        }
    }
}
/** Xóa plugin */
function drop_plugin($plugin_key = FALSE)
{
    disable_plugin('1', $plugin_key);
    $path = BASEPATH . '/' . HM_PLUGIN_DIR . '/' . $plugin_key;
    DeleteDir($path);
    $mes = $plugin_key . ' deleted';
    $args = array('status' => 'success', 'mes' => $mes);
    return json_encode($args);
}
Example #5
0
<body>

  <?php 
require_once './php/Common/DBConnect.php';
// DB接続用
require_once './php/Del/DelControl.php';
require_once './php/Del/DelModel.php';
echo '<br><br><br>';
// DBエラーの場合は終了させる。
if ($DelPhoto->getError != null) {
    echo $DelPhoto->getError;
    require_once './php/Common/ExitCode.html';
    exit;
}
$DelPhoto = new DelPhoto();
// データ削除系クラス
$Judge = false;
// 遷移先判定
// 削除系 ////////////////////////////////
// DBデータ削除
DeleteDB($DelPhoto->getSetDB(), $DelPhoto->getDelSql(), $DelPhoto->getPhotoNum());
// 画像データ削除
DeleteFile($DelPhoto->getPhotoPath());
// ディレクトリに画像がなければディレクトリも削除
DeleteDir($DelPhoto->getSetDB(), $DelPhoto->getSelSql(), $DelPhoto->getPhotoPath());
?>

  <script type="text/javascript" src="./js/Del/MainBack.js"></script>
</body>
</html>
/** Ajax xóa thư mục */
function del_media_group($args)
{
    $hmdb = new MySQL(true, DB_NAME, DB_HOST, DB_USER, DB_PASSWORD, DB_CHARSET);
    $id = $args['group_id'];
    if (is_numeric($id)) {
        /** Xóa thư mục */
        $path = BASEPATH . '/' . HM_CONTENT_DIR . '/uploads/' . get_media_group_part($id);
        DeleteDir($path);
        $tableName = DB_PREFIX . "media_groups";
        $whereArray = array('id' => MySQL::SQLValue($id));
        $hmdb->DeleteRows($tableName, $whereArray);
        /** Xóa các file trong thư mục */
        $tableName = DB_PREFIX . "media";
        $whereArray = array('media_group_id' => MySQL::SQLValue($id));
        $hmdb->SelectRows($tableName, $whereArray);
        if ($hmdb->HasRecords()) {
            while ($row = $hmdb->Row()) {
                $id_media_file = $row->id;
                delete_media($id_media_file);
            }
        }
        /** Xóa thư mục con */
        $tableName = DB_PREFIX . "media_groups";
        $whereArray = array('parent' => MySQL::SQLValue($id));
        $hmdb->SelectRows($tableName, $whereArray);
        if ($hmdb->HasRecords()) {
            while ($row = $hmdb->Row()) {
                $id_sub_folder = $row->id;
                del_media_group(array('group_id' => $id_sub_folder));
            }
        }
    }
}
Example #7
0
function aikiDeleteItem($form, $id)
{
    $Item = aikiReadItem($form, $id);
    $before = $form . "BeforeDeleteItem";
    if (is_callable($before)) {
        $Item = aikiReadItem($form, $id);
        $Item = $before($Item);
    }
    if ($_SESSION["settings"]["store"] == "on") {
        $datatype = "mysql";
    } else {
        $datatype = "file";
    }
    $res = array();
    $res["error"] = 0;
    $dir = formPathGet($_GET["form"], $_GET["item"]);
    if ($_GET["upl"] == "true" or !isset($_GET["ulp"])) {
        $res1 = DeleteDir($dir["uplitem"]);
    }
    $call = "{$datatype}DeleteItem";
    $del = $call($form, $id);
    if ($del == false) {
        $res["error"] = 1;
    }
    $after = $form . "AfterDeleteItem";
    if (is_callable($after)) {
        $Item = $after($Item);
    }
    return $res;
}