gettotal("select count(*) as total from {$dbtbpre}enewszttype where ztid='$ztid' and tfile='$add[tfile]' limit 1");
if($filenum)
{
printerror("ZtTypeFileExist","history.go(-1)");
}
}
$sql=$empire->query("insert into {$dbtbpre}enewszttype(ztid,cname,myorder,islist,listtempid,maxnum,tnum,reorder,ttype,tfile) values('$ztid','$add[cname]','$add[myorder]','$add[islist]','$add[listtempid]','$add[maxnum]','$add[tnum]','$add[reorder]','$add[ttype]','$add[tfile]');");
$lastid=$empire->lastid();
$empire->query("insert into {$dbtbpre}enewszttypeadd(cid,classtext) values('$lastid','".eaddslashes2($add[classtext])."');");
//文件名
if(empty($add['tfile']))
{
$tfile='type'.$lastid;
$empire->query("update {$dbtbpre}enewszttype set tfile='$tfile' where cid='$lastid'");
}
//生成页面
ListHtmlIndex($lastid,'',1);
if($sql)
{
//操作日志
insert_dolog("ztid=".$ztid."
cid=".$lastid."&cname=".$add[cname]);
printerror("AddZtTypeSuccess","ZtType.php?ztid=$ztid".hReturnEcmsHashStrHref2(0));
}
else
{
printerror("DbError","history.go(-1)");
}
}
//修改子类
function EditZtType($add,$userid,$username){
global $empire,$dbtbpre;
$add=DoPostZtTypeVar($add);
$ztid=(int)$add['ztid'];
$cid=(int)$add['cid'];
if(!$ztid||!$cid||!$add[cname])
{
printerror("EmptyZtType","history.go(-1)");
}
//验证权限
//CheckLevel($userid,$username,$classid,"zt");
$r=$empire->fetch1("select * from {$dbtbpre}enewszttype where cid='$cid' and ztid='$ztid' limit 1");
if(!$r['ztid'])
{
printerror('ErrorUrl','');
}
//验证文件名
if($add['tfile']&&$add['tfile']<>$r['tfile'])
{
if($add['tfile']=='index')
{
printerror("ZtTypeFileExist","history.go(-1)");
}
$filenum=$empire->gettotal("select count(*) as total from {$dbtbpre}enewszttype where ztid='$ztid' and cid<>$cid and tfile='$add[tfile]' limit 1");
if($filenum)
{
printerror("ZtTypeFileExist","history.go(-1)");
}
}
if(empty($add['tfile']))
{
$add['tfile']='type'.$cid;
}
$sql=$empire->query("update {$dbtbpre}enewszttype set cname='$add[cname]',myorder='$add[myorder]',islist='$add[islist]',listtempid='$add[listtempid]',maxnum='$add[maxnum]',tnum='$add[tnum]',reorder='$add[reorder]',ttype='$add[ttype]',tfile='$add[tfile]' where cid='$cid'");
$empire->query("update {$dbtbpre}enewszttypeadd set classtext='".eaddslashes2($add[classtext])."' where cid='$cid'");
//改变文件名
if($add['tfile'].$add['ttype']<>$r['tfile'].$r['ttype'])
{
DelZtcFile($cid,$r);
}
//生成页面
ListHtmlIndex($cid,'',1);
if($sql)
{
//操作日志
insert_dolog("ztid=".$ztid."
cid=".$cid."
cname=".$add[cname]);
printerror("EditZtTypeSuccess","ZtType.php?ztid=$ztid".hReturnEcmsHashStrHref2(0));
}
else
{
printerror("DbError","history.go(-1)");
}
}
//删除子类
function DelZtType($add,$userid,$username){
global $empire,$dbtbpre;
$ztid=(int)$add['ztid'];
$cid=(int)$add['cid'];
if(!$ztid||!$cid)
{
printerror("EmptyZtTypeId","history.go(-1)");
}
//验证权限
//CheckLevel($userid,$username,$classid,"zt");
$r=$empire->fetch1("select * from {$dbtbpre}enewszttype where cid='$cid' and ztid='$ztid' limit 1");
if(!$r['ztid'])
{
printerror('ErrorUrl','');
}
$sql=$empire->query("delete from {$dbtbpre}enewszttype where cid='$cid'");
$empire->query("delete from {$dbtbpre}enewszttypeadd where cid='$cid'");
//删除页面
DelZtcFile($cid,$r);
$empire->query("update {$dbtbpre}enewsztinfo set cid=0 where cid='$cid'");
if($sql)
{
//操作日志
insert_dolog("ztid=".$ztid."
cid=".$cid."
cname=".$r[cname]);
printerror("DelZtTypeSuccess","ZtType.php?ztid=$ztid".hReturnEcmsHashStrHref2(0));
}
else
{
printerror("DbError","history.go(-1)");
}
}
$enews=$_POST['enews'];
if(empty($enews))
{$enews=$_GET['enews'];}
if($enews)
{
hCheckEcmsRHash();
include '../'.LoadLang('pub/fun.php');
include('../../class/t_functions.php');
include('../../data/dbcache/class.php');
include('../../data/dbcache/MemberLevel.php');
}
if($enews=="AddZtType")//增加子类
{
AddZtType($_POST,$logininid,$loginin);
}
elseif($enews=="EditZtType")//修改子类
{
EditZtType($_POST,$logininid,$loginin);
}
elseif($enews=="DelZtType")//删除子类
{
DelZtType($_GET,$logininid,$loginin);
}
else
{}
$ztr=$empire->fetch1("select ztid,ztname,ztpath,zturl,zttype from {$dbtbpre}enewszt where ztid='$ztid'");
if(!$ztr['ztid'])
{
printerror('ErrorUrl','');
}
if($ztr[zturl])
{
$ztlink=$ztr[zturl];
}
else
{
$ztlink=$public_r['newsurl'].$ztr[ztpath];
}
$sql=$empire->query("select cid,cname,ttype,tfile from {$dbtbpre}enewszttype where ztid='$ztid' order by cid");
?>
位置:管理专题 > =$ztr[ztname]?> > 管理专题子类 |
ID |
分类名称 |
页面地址 |
操作 |
=$r[cid]?>
|
=$r[cname]?>
|