Ejemplo n.º 1
0
function EditClass($add, $userid, $username)
{
    global $empire, $class_r, $dbtbpre;
    //修改外部栏目
    if ($add[ecmsclasstype]) {
        EditWbClass($add, $userid, $username);
    }
    $add[classid] = (int) $add[classid];
    $add[classpath] = trim($add[classpath]);
    $checkclasspath = $add['classpath'];
    if ($add['oldclasspath'] != $add['pripath'] . $add['oldcpath']) {
        $add[classpath] = $add['oldcpath'];
    }
    if (!$add[classname] || !$add[classpath] || !$add[modid] || !$add[classid]) {
        printerror("EmptyClass", "");
    }
    if ($add[islast] && (!$add[newstempid] || !$add[listtempid])) {
        printerror("LastMustChange", "");
    }
    //操作权限
    CheckLevel($userid, $username, $classid, "class");
    $add = DoPostClassVar($add);
    $add[oldmodid] = (int) $add[oldmodid];
    //改变目录
    $classpath = $add[pripath] . $add[classpath];
    if ($add[oldclasspath] != $classpath && $checkclasspath == $add['oldcpath']) {
        if (file_exists("../../" . $classpath)) {
            //检测目录是否存在
            printerror("ReClasspath", "");
        }
    }
    //取得表名
    $tabler = GetModTable($add[modid]);
    $tabler[tid] = (int) $tabler[tid];
    //修改大栏目
    if (!$add[islast]) {
        //改变大栏目
        if ($add[bclassid] != $add[oldbclassid]) {
            //转到主栏目
            if (empty($add[bclassid])) {
                $sonclass = "";
                $featherclass = "";
                //取得本栏目的子栏目
                $r = $empire->fetch1("select sonclass,featherclass,classpath from {$dbtbpre}enewsclass where classid='{$add['classid']}'");
                //改变父栏目的子栏目
                $where = ReturnClass($r[featherclass]);
                if (empty($where)) {
                    $where = "classid=0";
                }
                $osql = $empire->query("select sonclass,classid from {$dbtbpre}enewsclass where " . $where);
                while ($o = $empire->fetch($osql)) {
                    $newsonclass = str_replace($r[sonclass], "|", $o[sonclass]);
                    $uosql = $empire->query("update {$dbtbpre}enewsclass set sonclass='{$newsonclass}' where classid='{$o['classid']}'");
                }
                //修改子栏目的父栏目
                $osql = $empire->query("select featherclass,classid,classpath from {$dbtbpre}enewsclass where featherclass like '%|" . $add[classid] . "%|'");
                while ($o = $empire->fetch($osql)) {
                    $newclasspath = str_replace($r[classpath] . "/", $classpath . "/", $o[classpath]);
                    $newfeatherclass = str_replace($r[featherclass], "|", $o[featherclass]);
                    $uosql = $empire->query("update {$dbtbpre}enewsclass set featherclass='{$newfeatherclass}',classpath='{$newclasspath}' where classid='{$o['classid']}'");
                }
            } else {
                //大栏目跟原栏目相同
                if ($add[classid] == $add[bclassid]) {
                    printerror("BclassIsself", "");
                }
                //取得现在大栏目的值
                $b = $empire->fetch1("select featherclass,sonclass,islast,wburl from {$dbtbpre}enewsclass where classid='{$add['bclassid']}'");
                //检测大栏目是否为终级栏目
                if ($b[islast]) {
                    printerror("BclassNotLast", "");
                }
                if ($b[wburl]) {
                    printerror("BclassNotWb", "");
                }
                //是否非法父栏目
                if ($b[featherclass]) {
                    $c_nb_r = explode("|" . $add[classid] . "|", $b[featherclass]);
                    if (count($c_nb_r) != 1) {
                        printerror("BclassIssmall", "");
                    }
                }
                if (empty($b[featherclass])) {
                    $b[featherclass] = "|";
                }
                $featherclass = $b[featherclass] . $add[bclassid] . "|";
                //取得现在栏目本身的值
                $o = $empire->fetch1("select featherclass,sonclass,classpath from {$dbtbpre}enewsclass where classid='{$add['classid']}'");
                //修改子栏目的父栏目
                $osql = $empire->query("select featherclass,classid,classpath from {$dbtbpre}enewsclass where featherclass like '%|" . $add[classid] . "|%'");
                while ($or = $empire->fetch($osql)) {
                    $newclasspath = str_replace($o[classpath] . "/", $classpath . "/", $or[classpath]);
                    if (empty($o[featherclass])) {
                        $newfeatherclass = $b[featherclass] . $add[bclassid] . $or[featherclass];
                    } else {
                        $newfeatherclass = str_replace($o[featherclass], $featherclass, $or[featherclass]);
                    }
                    $uosql = $empire->query("update {$dbtbpre}enewsclass set featherclass='{$newfeatherclass}',classpath='{$newclasspath}' where classid='{$or['classid']}'");
                }
                //改变旧大栏目的所有子栏目
                $owhere = ReturnClass($o[featherclass]);
                if (empty($owhere)) {
                    $owhere = "classid=0";
                }
                $oosql = $empire->query("select sonclass,classid from {$dbtbpre}enewsclass where " . $owhere);
                while ($oo = $empire->fetch($oosql)) {
                    $newsonclass = str_replace($o[sonclass], "|", $oo[sonclass]);
                    $usql = $empire->query("update {$dbtbpre}enewsclass set sonclass='{$newsonclass}' where classid='{$oo['classid']}'");
                }
                //改变新大栏目的子栏目
                $where = ReturnClass($featherclass);
                if (empty($where)) {
                    $where = "classid=0";
                }
                $nbsql = $empire->query("select sonclass,classid from {$dbtbpre}enewsclass where " . $where);
                while ($nb = $empire->fetch($nbsql)) {
                    if (empty($nb[sonclass])) {
                        $nb[sonclass] = "|";
                    }
                    $newsonclass = $nb[sonclass] . substr($o[sonclass], 1);
                    $usql = $empire->query("update {$dbtbpre}enewsclass set sonclass='{$newsonclass}' where classid='{$nb['classid']}'");
                }
            }
            $change = ",bclassid={$add['bclassid']},featherclass='{$featherclass}'";
        }
        //绑定域名应用于子栏目
        if ($add['UrlToSmall']) {
            UpdateSmallClassDomain($add['classid'], $add['classurl'], $classpath);
        }
        //wap模板应用于子栏目
        if ($add['wapstylesclass']) {
            $empire->query("update {$dbtbpre}enewsclass set wapstyleid='{$add['wapstyleid']}' where featherclass like '%|" . $add[classid] . "|%'");
        }
        //修改数据库资料
        $sql = $empire->query("update {$dbtbpre}enewsclass set classname='{$add['classname']}',classpath='{$classpath}',classtype='{$add['classtype']}',newline={$add['newline']},hotline={$add['hotline']},goodline={$add['goodline']},classurl='{$add['classurl']}',groupid={$add['groupid']},myorder={$add['myorder']},filename_qz='{$add['filename_qz']}',hotplline={$add['hotplline']},modid={$add['modid']},checked={$add['checked']},firstline={$add['firstline']},bname='{$add['bname']}',islist={$add['islist']},listtempid={$add['listtempid']},lencord={$add['lencord']},searchtempid={$add['searchtempid']},tid={$tabler['tid']},tbname='{$tabler['tbname']}',maxnum={$add['maxnum']},checkpl={$add['checkpl']},down_num={$add['down_num']},online_num={$add['online_num']},listorder='{$add['listorder']}',reorder='{$add['reorder']}',intro='{$add['intro']}',classimg='{$add['classimg']}',jstempid={$add['jstempid']},listdt={$add['listdt']},showclass={$add['showclass']},showdt={$add['showdt']},qaddgroupid='{$add['qaddgroupid']}',qaddshowkey={$add['qaddshowkey']},adminqinfo={$add['adminqinfo']},doctime={$add['doctime']},classpagekey='{$add['classpagekey']}',dtlisttempid='{$add['dtlisttempid']}',classtempid='{$add['classtempid']}',nreclass={$add['nreclass']},nreinfo={$add['nreinfo']},nrejs={$add['nrejs']},nottobq={$add['nottobq']},ipath='{$add['ipath']}',addreinfo={$add['addreinfo']},haddlist={$add['haddlist']},sametitle={$add['sametitle']},definfovoteid={$add['definfovoteid']},wburl='',qeditchecked={$add['qeditchecked']},openadd={$add['openadd']},wapstyleid='{$add['wapstyleid']}',repreinfo='{$add['repreinfo']}',pltempid='{$add['pltempid']}',cgroupid='{$add['cgroupid']}',yhid='{$add['yhid']}',wfid='{$add['wfid']}',cgtoinfo='{$add['cgtoinfo']}',bdinfoid='{$add['bdinfoid']}'" . $change . " where classid='{$add['classid']}'");
        //副表
        $ret_cr = ReturnClassAddF($add, 1);
        $empire->query("update {$dbtbpre}enewsclassadd set classtext='" . addslashes($add[classtext]) . "'" . $ret_cr[0] . " where classid='{$add['classid']}'");
        GetClass();
        //生成栏目文件
        if ($add[islist] == 0 || $add[islist] == 2) {
            $classtemp = $add[islist] == 2 ? GetClassText($add[classid]) : GetClassTemp($add['classtempid']);
            NewsBq($add[classid], $classtemp, 0, 1);
        } elseif ($add[islist] == 3) {
            ReClassBdInfo($add[classid]);
        }
        if ($add[islist] == 2) {
            //删除动态模板缓存文件
            DelOneTempTmpfile('classpage' . $add[classid]);
        }
    } else {
        if ($add[modid] != $add[oldmodid]) {
            $chmtbr = GetModTable($add[oldmodid]);
            if ($chmtbr[tid] != $tabler[tid] && $chmtbr[tbname]) {
                $chmchecknum = $empire->gettotal("select count(*) as total from {$dbtbpre}ecms_" . $chmtbr[tbname] . " where classid='{$add['classid']}'");
                if ($chmchecknum) {
                    printerror("ClassChangeModHaveInfo", "history.go(-1)");
                }
            }
        }
        //改变大栏目
        if ($add[bclassid] != $add[oldbclassid]) {
            //转到主栏目
            if (empty($add[bclassid])) {
                $sonclass = "";
                $featherclass = "";
                //取得栏目原本的大栏目
                $r = $empire->fetch1("select featherclass,classpath from {$dbtbpre}enewsclass where classid='{$add['classid']}'");
                //改变原本大栏目的子栏目
                $where = ReturnClass($r[featherclass]);
                if (empty($where)) {
                    $where = "classid=0";
                }
                $bsql = $empire->query("select classid,sonclass from {$dbtbpre}enewsclass where " . $where);
                while ($br = $empire->fetch($bsql)) {
                    $newsonclass = str_replace("|" . $add[classid] . "|", "|", $br[sonclass]);
                    $usql = $empire->query("update {$dbtbpre}enewsclass set sonclass='{$newsonclass}' where classid='{$br['classid']}'");
                }
            } else {
                //取得现在大栏目的值
                $b = $empire->fetch1("select featherclass,islast,wburl from {$dbtbpre}enewsclass where classid='{$add['bclassid']}'");
                //检测大栏目是否为终级栏目
                if ($b[islast]) {
                    printerror("BclassNotLast", "");
                }
                if ($b[wburl]) {
                    printerror("BclassNotWb", "");
                }
                if (empty($b[featherclass])) {
                    $b[featherclass] = "|";
                }
                $featherclass = $b[featherclass] . $add[bclassid] . "|";
                //改变新大栏目的子栏目
                $where = ReturnClass($featherclass);
                if (empty($where)) {
                    $where = "classid=0";
                }
                $bsql = $empire->query("select sonclass,classid from {$dbtbpre}enewsclass where " . $where);
                while ($nb = $empire->fetch($bsql)) {
                    if (empty($nb[sonclass])) {
                        $nb[sonclass] = "|";
                    }
                    $newsonclass = $nb[sonclass] . $add[classid] . "|";
                    $usql = $empire->query("update {$dbtbpre}enewsclass set sonclass='{$newsonclass}' where classid='{$nb['classid']}'");
                }
                //改变旧大栏目的子栏目
                $o = $empire->fetch1("select sonclass,featherclass from {$dbtbpre}enewsclass where classid='{$add['classid']}'");
                $where = ReturnClass($o[featherclass]);
                if (empty($where)) {
                    $where = "classid=0";
                }
                $osql = $empire->query("select sonclass,classid from {$dbtbpre}enewsclass where " . $where);
                while ($ob = $empire->fetch($osql)) {
                    $newsonclass = str_replace("|" . $add[classid] . "|", "|", $ob[sonclass]);
                    $usql = $empire->query("update {$dbtbpre}enewsclass set sonclass='{$newsonclass}' where classid='{$ob['classid']}'");
                }
            }
            $change = ",bclassid={$add['bclassid']},featherclass='{$featherclass}'";
        }
        //应用于已生成的信息
        if ($add['tobetempinfo']) {
            $upsql = $empire->query("update {$dbtbpre}ecms_" . $tabler[tbname] . " set newstempid={$add['newstempid']} where classid='{$add['classid']}'");
        }
        //文件前缀
        $add[filename_qz] = RepFilenameQz($add[filename_qz]);
        $sql = $empire->query("update {$dbtbpre}enewsclass set classname='{$add['classname']}',classpath='{$classpath}',classtype='{$add['classtype']}',link_num={$add['link_num']},lencord={$add['lencord']},newstempid={$add['newstempid']},listtempid={$add['listtempid']},newspath='{$add['newspath']}',filename={$add['filename']},filetype='{$add['filetype']}',openpl={$add['openpl']},openadd={$add['openadd']},newline={$add['newline']},hotline={$add['hotline']},goodline={$add['goodline']},classurl='{$add['classurl']}',groupid={$add['groupid']},myorder={$add['myorder']},filename_qz='{$add['filename_qz']}',hotplline={$add['hotplline']},modid={$add['modid']},checked={$add['checked']},firstline={$add['firstline']},bname='{$add['bname']}',searchtempid={$add['searchtempid']},tid={$tabler['tid']},tbname='{$tabler['tbname']}',maxnum={$add['maxnum']},checkpl={$add['checkpl']},down_num={$add['down_num']},online_num={$add['online_num']},listorder='{$add['listorder']}',reorder='{$add['reorder']}',intro='{$add['intro']}',classimg='{$add['classimg']}',jstempid={$add['jstempid']},addinfofen={$add['addinfofen']},listdt={$add['listdt']},showclass={$add['showclass']},showdt={$add['showdt']},checkqadd={$add['checkqadd']},qaddlist={$add['qaddlist']},qaddgroupid='{$add['qaddgroupid']}',qaddshowkey={$add['qaddshowkey']},adminqinfo={$add['adminqinfo']},doctime={$add['doctime']},classpagekey='{$add['classpagekey']}',dtlisttempid='{$add['dtlisttempid']}',classtempid='{$add['classtempid']}',nreclass={$add['nreclass']},nreinfo={$add['nreinfo']},nrejs={$add['nrejs']},nottobq={$add['nottobq']},ipath='{$add['ipath']}',addreinfo={$add['addreinfo']},haddlist={$add['haddlist']},sametitle={$add['sametitle']},definfovoteid={$add['definfovoteid']},wburl='',qeditchecked={$add['qeditchecked']},wapstyleid='{$add['wapstyleid']}',repreinfo='{$add['repreinfo']}',pltempid='{$add['pltempid']}',cgroupid='{$add['cgroupid']}',yhid='{$add['yhid']}',wfid='{$add['wfid']}',cgtoinfo='{$add['cgtoinfo']}',bdinfoid='{$add['bdinfoid']}'" . $change . " where classid='{$add['classid']}'");
        //副表
        $ret_cr = ReturnClassAddF($add, 1);
        $empire->query("update {$dbtbpre}enewsclassadd set classtext='" . addslashes($add[classtext]) . "'" . $ret_cr[0] . " where classid='{$add['classid']}'");
        GetClass();
    }
    //移动目录
    if ($add[bclassid] != $add[oldbclassid] || $add[oldclasspath] != $classpath && $add['classpath'] == $add['oldcpath']) {
        $opath = "../../" . $add[oldclasspath];
        $newpath = "../../" . $classpath;
        MovePath($opath, $newpath);
        $opath = "../../d/file/" . $add[oldclasspath];
        $npath = "../../d/file/" . $classpath;
        CopyPath($opath, $npath);
    } else {
        if ($add['oldcpath'] != $add['classpath']) {
            AlterClassPath($add['classid'], $add['islast'], $add['oldclasspath'], $classpath);
            GetClass();
        }
    }
    //删除缓存文件
    if ($add[oldclassname] != $add[classname] || $add[bclassid] != $add[oldbclassid]) {
        DelListEnews();
        GetSearch($add[modid]);
    } else {
        if ($add[oldclasspath] != $classpath && $add['classpath'] == $add['oldcpath'] || $add[listdt] != $add[oldlistdt]) {
            DelListEnews();
        }
        if ($add[openadd] != $add[oldopenadd] || $add[modid] != $add[oldmodid]) {
            GetSearch($add[modid]);
            if ($add[modid] != $add[oldmodid]) {
                GetSearch($add[oldmodid]);
            }
        }
    }
    //修改栏目扩展名
    if ($add[oldclasstype] != $add[classtype]) {
        $todaytime = date("Y-m-d H:i:s");
        if ($add[islast]) {
            $query = "select count(*) as total from {$dbtbpre}ecms_" . $class_r[$add[classid]][tbname] . " where checked=1 and classid='{$add['classid']}'";
            $lencord = $add[oldlencord];
            $num = $empire->gettotal($query);
        } else {
            $lencord = $add[oldlencord];
            if ($add[oldislist] == 1) {
                $where = ReturnClass($class_r[$add[classid]][sonclass]);
                $query = "select count(*) as total from {$dbtbpre}ecms_" . $class_r[$add[classid]][tbname] . " where checked=1 and (" . $where . ")";
                $num = $empire->gettotal($query);
            } else {
                $num = 1;
            }
        }
        RenameListfile($add[classid], $lencord, $num, $add[oldclasstype], $add[classtype], $classpath);
    }
    //来源
    if ($add['from']) {
        $returnurl = "ListPageClass.php";
    } else {
        $returnurl = "ListClass.php";
    }
    TogNotReClass(1);
    if ($sql) {
        insert_dolog("classid=" . $add[classid] . "<br>classname=" . $add[classname]);
        //操作日志
        printerror("EditClassSuccess", $returnurl);
    } else {
        printerror("DbError", "history.go(-1)");
    }
}
Ejemplo n.º 2
0
function DefIndexpage($tempid,$userid,$username){
	global $empire,$dbtbpre,$public_r;
	$tempid=(int)$tempid;
	if(empty($tempid))
	{
		printerror("NotChangeIndexpageid","history.go(-1)");
	}
	//验证权限
	CheckLevel($userid,$username,$classid,"template");
	$gid=(int)$_GET['gid'];
	$r=$empire->fetch1("select tempname,temptext from {$dbtbpre}enewsindexpage where tempid='$tempid'");
	if($tempid==$public_r['indexpageid'])
	{
		$def=0;
		$mess='NoDefIndexpageSuccess';
		$sql=$empire->query("update {$dbtbpre}enewspublic set indexpageid=0");
	}
	else
	{
		$def=1;
		$mess='DefIndexpageSuccess';
		$sql=$empire->query("update {$dbtbpre}enewspublic set indexpageid='$tempid'");
	}
	GetConfig();//更新缓存
	//刷新首页
	if($def)
	{
		NewsBq($classid,$r[temptext],1,0);
		//删除动态模板缓存文件
		DelOneTempTmpfile('indexpage');
	}
	else
	{
		$indextempr=$empire->fetch1("select indextemp from ".GetTemptb("enewspubtemp")." limit 1");
		$indextemp=$indextempr['indextemp'];
		NewsBq($classid,$indextemp,1,0);
		//删除动态模板缓存文件
		DelOneTempTmpfile('indexpage');
	}
	if($sql)
	{
		//操作日志
		insert_dolog("tempid=$tempid&tempname=$r[tempname]&def=$def");
		printerror($mess,"ListIndexpage.php?gid=$gid".hReturnEcmsHashStrHref2(0));
	}
	else
	{
		printerror("DbError","history.go(-1)");
	}
}
Ejemplo n.º 3
0
function DelListtemp($tempid, $add, $userid, $username)
{
    global $empire, $dbtbpre, $public_r;
    $tempid = (int) $tempid;
    if (!$tempid) {
        printerror("NotDelTemplateid", "history.go(-1)");
    }
    //操作权限
    CheckLevel($userid, $username, $classid, "template");
    $gid = (int) $add['gid'];
    $tr = $empire->fetch1("select tempname from " . GetDoTemptb("enewslisttemp", $gid) . " where tempid='{$tempid}'");
    $sql = $empire->query("delete from " . GetDoTemptb("enewslisttemp", $gid) . " where tempid='{$tempid}'");
    //删除备份记录
    DelEbakTempAll('listtemp', $gid, $tempid);
    if ($gid == $public_r['deftempid'] || !$public_r['deftempid'] && ($gid == 1 || $gid == 0)) {
        //删除动态模板缓存文件
        DelOneTempTmpfile('list' . $tempid);
    }
    if ($sql) {
        //操作日志
        insert_dolog("tempid=" . $tempid . "<br>tempname=" . $tr[tempname] . "&gid={$gid}");
        printerror("DelListTempSuccess", "ListListtemp.php?classid={$add['cid']}&modid={$add['mid']}&gid={$gid}" . hReturnEcmsHashStrHref2(0));
    } else {
        printerror("DbError", "history.go(-1)");
    }
}
Ejemplo n.º 4
0
function EditIndextemp($temptext, $userid, $username)
{
    global $empire, $dbtbpre, $public_r;
    if (!$temptext) {
        printerror("EmptyIndexTemp", "history.go(-1)");
    }
    CheckLevel($userid, $username, $classid, "template");
    //操作权限
    $temptext = RepPhpAspJspcode($temptext);
    $gid = (int) $_POST['gid'];
    $sql = $empire->query("update " . GetDoTemptb("enewspubtemp", $gid) . " set indextemp='" . eaddslashes2($temptext) . "'");
    //备份模板
    AddEBakTemp('pubindextemp', $gid, 1, '', $temptext, 0, 0, '', 0, 0, '', 0, 0, 0, $userid, $username);
    //刷新首页
    if ($gid == $public_r['deftempid'] || !$public_r['deftempid'] && ($gid == 1 || $gid == 0)) {
        NewsBq($classid, eaddslashes($temptext), 1, 0);
        //删除动态模板缓存文件
        DelOneTempTmpfile('indexpage');
    }
    if ($sql) {
        insert_dolog("gid={$gid}");
        //操作日志
        printerror("EditPublicTempSuccess", "template/EditPublicTemp.php?tname=indextemp&gid={$gid}" . hReturnEcmsHashStrHref2(0));
    } else {
        printerror("DbError", "history.go(-1)");
    }
}
Ejemplo n.º 5
0
function DelNewsTemp($tempid, $add, $userid, $username)
{
    global $empire, $dbtbpre, $public_r;
    $tempid = (int) $tempid;
    if (!$tempid) {
        printerror("NotDelTemplateid", "history.go(-1)");
    }
    //操作权限
    CheckLevel($userid, $username, $classid, "template");
    $gid = (int) $add['gid'];
    $r = $empire->fetch1("select tempname,modid from " . GetDoTemptb("enewsnewstemp", $gid) . " where tempid='{$tempid}'");
    $dotempname = $r['tempname'];
    $sql = $empire->query("delete from " . GetDoTemptb("enewsnewstemp", $gid) . " where tempid='{$tempid}'");
    //将信息设为未生成
    $mr = $empire->fetch1("select tbname from {$dbtbpre}enewsmod where mid='{$r['modid']}'");
    //$usql=$empire->query("update {$dbtbpre}ecms_".$mr[tbname]." set havehtml=0 where newstempid='$tempid'");
    //删除备份
    DelEbakTempAll('newstemp', $gid, $tempid);
    if ($gid == $public_r['deftempid'] || !$public_r['deftempid'] && ($gid == 1 || $gid == 0)) {
        //删除动态模板缓存文件
        DelOneTempTmpfile('text' . $tempid);
    }
    if ($sql) {
        //操作日志
        insert_dolog("tempid=" . $tempid . "<br>tempname=" . $dotempname . "&gid={$gid}");
        printerror("DelNewsTempSuccess", "ListNewstemp.php?classid={$add['cid']}&modid={$add['mid']}&gid={$gid}" . hReturnEcmsHashStrHref2(0));
    } else {
        printerror("DbError", "history.go(-1)");
    }
}
Ejemplo n.º 6
0
function DelClasstemp($add,$userid,$username){
	global $empire,$dbtbpre,$public_r;
	$tempid=(int)$add['tempid'];
	if(!$tempid)
	{
		printerror("EmptyClasstempid","history.go(-1)");
    }
	//验证权限
	CheckLevel($userid,$username,$classid,"template");
	$gid=(int)$add['gid'];
	$r=$empire->fetch1("select tempname from ".GetDoTemptb("enewsclasstemp",$gid)." where tempid=$tempid");
	$sql=$empire->query("delete from ".GetDoTemptb("enewsclasstemp",$gid)." where tempid=$tempid");
	//删除备份记录
	DelEbakTempAll('classtemp',$gid,$tempid);
	if($gid==$public_r['deftempid']||(!$public_r['deftempid']&&($gid==1||$gid==0)))
	{
		//删除动态模板缓存文件
		DelOneTempTmpfile('classtemp'.$tempid);
	}
	if($sql)
	{
		//操作日志
		insert_dolog("tempid=$tempid&tempname=$r[tempname]&gid=$gid");
		printerror("DelClasstempSuccess","ListClasstemp.php?classid=$add[cid]&gid=$gid".hReturnEcmsHashStrHref2(0));
	}
	else
	{
		printerror("DbError","history.go(-1)");
	}
}