Esempio n. 1
0
function DelFreeFile($userid, $username)
{
    global $empire, $dbtbpre;
    //操作权限
    CheckLevel($userid, $username, $classid, "file");
    //清理信息附件
    DelFileAllTable("cjid<>0 and (id=0 or cjid=id)");
    //会员附件
    DelFileOtherTable("cjid<>0 and (id=0 or cjid=id)", "member");
    //其他附件
    DelFileOtherTable("cjid<>0 and (id=0 or cjid=id)", "other");
    //操作日志
    insert_dolog("");
    printerror("DelFreeFileSuccess", $_SERVER['HTTP_REFERER']);
}
Esempio n. 2
0
function DelAd($adid, $userid, $username)
{
    global $empire, $time, $public_r, $dbtbpre;
    $adid = (int) $adid;
    if (!$adid) {
        printerror("NotDelAdid", "history.go(-1)");
    }
    //验证权限
    CheckLevel($userid, $username, $classid, "ad");
    $r = $empire->fetch1("select title from {$dbtbpre}enewsad where adid='{$adid}'");
    $sql = $empire->query("delete from {$dbtbpre}enewsad where adid='{$adid}'");
    $file = "../../../d/js/acmsd/" . $public_r[adfile] . $adid . ".js";
    DelFiletext($file);
    //删除附件
    DelFileOtherTable("modtype=3 and id='{$adid}'");
    if ($sql) {
        //操作日志
        insert_dolog("adid=" . $adid . "<br>title=" . $r[title]);
        printerror("DelAdSuccess", "ListAd.php?time={$time}" . hReturnEcmsHashStrHref2(0));
    } else {
        printerror("DbError", "history.go(-1)");
    }
}
Esempio n. 3
0
function DelClass1($classid)
{
    global $empire, $class_r, $dbtbpre;
    $r = $empire->fetch1("select * from {$dbtbpre}enewsclass where classid='{$classid}'");
    //外部栏目
    if ($r[wburl]) {
        $sql = $empire->query("delete from {$dbtbpre}enewsclass where classid='{$classid}'");
        $empire->query("delete from {$dbtbpre}enewsclassadd where classid='{$classid}'");
        $empire->query("delete from {$dbtbpre}enewsclass_stats where classid='{$classid}'");
        //删除栏目附件
        DelFileOtherTable("modtype=1 and id='{$classid}'");
        //删除缓存
        DelListEnews();
        return "";
    }
    //删除终极栏目
    if ($r[islast]) {
        //删除主表信息
        $indexsql = $empire->query("delete from {$dbtbpre}ecms_" . $r[tbname] . "_index where classid='{$classid}'");
        $sql = $empire->query("delete from {$dbtbpre}ecms_" . $r[tbname] . " where classid='{$classid}'");
        $empire->query("delete from {$dbtbpre}ecms_" . $r[tbname] . "_check where classid='{$classid}'");
        $empire->query("delete from {$dbtbpre}ecms_" . $r[tbname] . "_doc where classid='{$classid}'");
        //删除副表信息
        DelAllDataTbInfo($r['tbname'], "classid='{$classid}'", 1, 1);
        //删除存文本文件
        DelInfoSaveTxtfile($r['modid'], $r['tbname'], "classid='{$classid}'");
        //删除信息附加表与附件
        DelMoreInfoOtherData($classid, 0, 0);
        $filepath = "../../data/" . $r[classpath];
        $delf = DelPath($filepath);
        DelFileOtherTable("modtype=1 and id='{$classid}'");
        //删除栏目本身
        $sql1 = $empire->query("delete from {$dbtbpre}enewsclass where classid='{$classid}'");
        $empire->query("delete from {$dbtbpre}enewsclassadd where classid='{$classid}'");
        $empire->query("delete from {$dbtbpre}enewsclass_stats where classid='{$classid}'");
        $delpath = "../../" . $r[classpath];
        $del = DelPath($delpath);
        //更新大栏目的子栏目
        $where = ReturnClass($r[featherclass]);
        if (empty($where)) {
            $where = "classid=0";
        }
        $bsql = $empire->query("select sonclass,classid from {$dbtbpre}enewsclass where " . $where);
        while ($br = $empire->fetch($bsql)) {
            $newsonclass = str_replace("|" . $classid . "|", "|", $br[sonclass]);
            $usql = $empire->query("update {$dbtbpre}enewsclass set sonclass='{$newsonclass}' where classid='{$br['classid']}'");
        }
    } else {
        //删除栏目
        $where = ReturnClass($r[sonclass]);
        if (empty($where)) {
            $where = "classid=0";
        }
        $delcr = explode("|", $r[sonclass]);
        $count = count($delcr);
        for ($i = 1; $i < $count - 1; $i++) {
            $delcid = $delcr[$i];
            //删除主表信息
            $indexsql = $empire->query("delete from {$dbtbpre}ecms_" . $class_r[$delcid][tbname] . "_index where classid='{$delcid}'");
            $sql = $empire->query("delete from {$dbtbpre}ecms_" . $class_r[$delcid][tbname] . " where classid='{$delcid}'");
            $empire->query("delete from {$dbtbpre}ecms_" . $class_r[$delcid][tbname] . "_check where classid='{$delcid}'");
            $empire->query("delete from {$dbtbpre}ecms_" . $class_r[$delcid][tbname] . "_doc where classid='{$delcid}'");
            //删除副表信息
            DelAllDataTbInfo($class_r[$delcid][tbname], "classid='{$delcid}'", 1, 1);
            //删除存文本文件
            DelInfoSaveTxtfile($class_r[$delcid][modid], $class_r[$delcid][tbname], "classid='{$delcid}'");
            //删除信息附加表与附件
            DelMoreInfoOtherData($delcid, 0, 0);
        }
        //删除附件
        $filepath = "../../data/" . $r[classpath];
        $delf = DelPath($filepath);
        if ($where != 'classid=0') {
            DelFileOtherTable("modtype=1 and (" . str_replace('classid', 'id', $where) . ")");
        }
        //删除子栏目副表
        $fcsql = $empire->query("select classid from {$dbtbpre}enewsclass where featherclass like '%|" . $classid . "|%'");
        while ($fcr = $empire->fetch($fcsql)) {
            $empire->query("delete from {$dbtbpre}enewsclassadd where classid='{$fcr['classid']}'");
            $empire->query("delete from {$dbtbpre}enewsclass_stats where classid='{$fcr['classid']}'");
        }
        //删除子栏目
        $sql1 = $empire->query("delete from {$dbtbpre}enewsclass where featherclass like '%|" . $classid . "|%'");
        //改变父栏目的子类
        $where = ReturnClass($r[featherclass]);
        if (empty($where)) {
            $where = "classid=0";
        }
        $bbsql = $empire->query("select classid,sonclass from {$dbtbpre}enewsclass where " . $where);
        while ($bbr = $empire->fetch($bbsql)) {
            $newsonclass = str_replace($r[sonclass], "|", $bbr[sonclass]);
            $usql = $empire->query("update {$dbtbpre}enewsclass set sonclass='{$newsonclass}' where classid='{$bbr['classid']}'");
        }
        //删除栏目本身
        $sql2 = $empire->query("delete from {$dbtbpre}enewsclass where classid='{$classid}'");
        $empire->query("delete from {$dbtbpre}enewsclassadd where classid='{$classid}'");
        $empire->query("delete from {$dbtbpre}enewsclass_stats where classid='{$classid}'");
        //删除栏目附件
        DelFileOtherTable("modtype=1 and id='{$classid}'");
        $delpath = "../../" . $r[classpath];
        $del = DelPath($delpath);
    }
    //删除缓存
    DelListEnews();
}
Esempio n. 4
0
function DelSp($add, $userid, $username)
{
    global $empire, $dbtbpre;
    $spid = (int) $add[spid];
    if (!$spid) {
        printerror("NotDelSpid", "history.go(-1)");
    }
    //验证权限
    CheckLevel($userid, $username, $classid, "sp");
    $r = $empire->fetch1("select spname,sptype,refile,spfile from {$dbtbpre}enewssp where spid='{$spid}'");
    $sql = $empire->query("delete from {$dbtbpre}enewssp where spid='{$spid}'");
    if ($r[sptype] == 1) {
        $empire->query("delete from {$dbtbpre}enewssp_1 where spid='{$spid}'");
    } elseif ($r[sptype] == 2) {
        $empire->query("delete from {$dbtbpre}enewssp_2 where spid='{$spid}'");
    }
    if ($r[sptype] == 3) {
        $empire->query("delete from {$dbtbpre}enewssp_3 where spid='{$spid}'");
        $empire->query("delete from {$dbtbpre}enewssp_3_bak where spid='{$spid}'");
    }
    //删除碎片文件
    if ($r['refile']) {
        DelSpReFile($r['spfile']);
    }
    //删除附件
    DelFileOtherTable("modtype=7 and id='{$spid}'");
    if ($sql) {
        //操作日志
        insert_dolog("spid=" . $spid . "<br>spname=" . $r[spname]);
        printerror("DelSpSuccess", "ListSp.php?cid={$add['fcid']}&fclassid={$add['fclassid']}&fsptype={$add['fsptype']}" . hReturnEcmsHashStrHref2(0));
    } else {
        printerror("DbError", "history.go(-1)");
    }
}