Ejemplo n.º 1
0
/**

	删除文件夹/删除目录
	@papram string $path;  要删除的文件夹路径
	@return void
*/
function kc_f_rd($path, $is = 0)
{
    $path = kc_f_iconv($path, 1);
    if (!is_dir(ROOT . $path)) {
        return;
    }
    $array = kc_f_getdir($path);
    foreach ($array as $val) {
        $file = $path . '/' . $val;
        if ($val != '') {
            if (is_dir(ROOT . $file)) {
                //目录
                kc_f_rd($file, 1);
                rmdir(ROOT . $file);
            } else {
                kc_f_delete($file);
            }
        }
    }
    if (!$is && is_dir(ROOT . $path)) {
        rmdir(ROOT . $path);
    }
}
Ejemplo n.º 2
0
/**
	删除文件或文件夹
*/
function king_ajax_delete()
{
    global $king;
    $king->access('webftp_delete');
    $isdir = kc_post('isdir', 2, 1);
    $path = kc_post('path');
    $file = kc_post('file', 0, 1);
    if ($isdir) {
        kc_f_rd($path . $file);
    } else {
        kc_f_delete($path . $file);
    }
    $js = "\$('#k_brow_right_" . _path2id($path . $file) . "').remove();";
    //删除右侧内容
    $js .= "\$('#k_brow_obj_" . _path2id($path . $file) . "').remove();";
    //同步删除左侧显示内容
    $cachepath = "system/filemanage/{$path}index";
    $king->cache->del($cachepath);
    //清理缓存
    kc_ajax('', kc_icon('a1'), '', $js);
}
Ejemplo n.º 3
0
 /**
 	删除缓存目录
 	@param string $path     路径
 */
 public function rd($path = null)
 {
     if ($path) {
         $path = strtolower($path);
         kc_f_rd(PATH_CACHE . '/' . $path);
     } else {
         kc_f_rd(PATH_CACHE);
     }
 }
Ejemplo n.º 4
0
function king_ajax_delete()
{
    global $king;
    $king->access('portal_list_delete');
    $_list = kc_getlist();
    $_array = explode(',', $_list);
    foreach ($_array as $val) {
        $listid = $val['listid'];
        $info = $king->portal->infoList($listid);
        $model = $king->portal->infoModel($info['modelid']);
        //删除栏目下面的内容
        if ($info['modelid'] > 0) {
            if ($info['npage'] == 0) {
                //删除静态页面
                if (!($res = $king->db->getRows("select kid,kpath from %s__{$model['modeltable']} where listid={$listid};"))) {
                    $res = array();
                }
                foreach ($res as $rs) {
                    //删除文件,不包含目录,目录用清理空目录的方式去处理
                    kc_f_delete($king->getfpath($rs['kpath']));
                    //删除缓存文件
                    $king->cache->del('portal/_' . $model['modeltable'] . '/' . ceil($rs['kid'] / 1024) . '/' . $rs['kid']);
                }
            }
            //删除数据库中的内容
            $king->db->query("delete from %s__{$model['modeltable']} where listid={$listid};");
            //删除单页文件列和表文件
            kc_f_delete($king->getfpath($info['klistpath']));
            kc_f_rd($info['klistpath']);
        }
        //删除缓存文件
        $king->cache->del('portal/list/' . $listid);
        //写log
        $king->log(6, 'ListName:' . $info['klistname']);
    }
    $king->db->query("delete from %s_list where listid in ({$_list}) and isexist=0;");
    //删除缓存
    $king->cache->del('portal/list/id');
    $king->cache->rd('system/cache');
    kc_ajax('OK', "<p class=\"k_ok\">" . $king->lang->get('system/ok/delete') . "</p>", 1);
}