query("insert into ".GetDoTemptb("enewstempvar",$gid)."(myvar,varname,varvalue,classid,isclose,myorder) values('$add[myvar]','$add[varname]','".eaddslashes2($add[varvalue])."',".$classid.",".$isclose.",$add[myorder]);");
$lastid=$empire->lastid();
//备份模板
AddEBakTemp('tempvar',$gid,$lastid,$add[myvar],$add[varvalue],$add[myorder],0,$add[varname],0,0,'',0,$classid,$isclose,$userid,$username);
if($sql)
{
//操作日志
insert_dolog("varid=".$lastid."
var=".$add[myvar]."&gid=$gid");
printerror("AddTempvarSuccess","AddTempvar.php?enews=AddTempvar&gid=$gid".hReturnEcmsHashStrHref2(0));
}
else
{printerror("DbError","history.go(-1)");}
}
//修改模板变量
function EditTempvar($add,$userid,$username){
global $empire,$dbtbpre;
$add[varid]=(int)$add['varid'];
if(!$add[varid]||!$add[myvar]||!$add[varvalue]||!$add[varname])
{printerror("EmptyTempvar","history.go(-1)");}
//验证权限
CheckLevel($userid,$username,$classid,"tempvar");
$add[myvar]=hRepPostStr($add[myvar],1);
$add[varname]=hRepPostStr($add[varname],1);
$add[varvalue]=RepPhpAspJspcode($add[varvalue]);
$classid=(int)$add[classid];
$isclose=(int)$add[isclose];
$add[myorder]=(int)$add[myorder];
$gid=(int)$add['gid'];
$sql=$empire->query("update ".GetDoTemptb("enewstempvar",$gid)." set myvar='$add[myvar]',varname='$add[varname]',varvalue='".eaddslashes2($add[varvalue])."',classid=$classid,isclose=$isclose,myorder=$add[myorder] where varid='$add[varid]'");
//备份模板
AddEBakTemp('tempvar',$gid,$add[varid],$add[myvar],$add[varvalue],$add[myorder],0,$add[varname],0,0,'',0,$classid,$isclose,$userid,$username);
if($sql)
{
//操作日志
insert_dolog("varid=".$add[varid]."
var=".$add[myvar]."&gid=$gid");
printerror("EditTempvarSuccess","ListTempvar.php?classid=$add[cid]&gid=$gid".hReturnEcmsHashStrHref2(0));
}
else
{printerror("DbError","history.go(-1)");}
}
//删除模板变量
function DelTempvar($varid,$cid,$userid,$username){
global $empire,$dbtbpre;
$varid=(int)$varid;
if(!$varid)
{printerror("NotDelTempvarid","history.go(-1)");}
//验证权限
CheckLevel($userid,$username,$classid,"tempvar");
$gid=(int)$_GET['gid'];
$r=$empire->fetch1("select myvar from ".GetDoTemptb("enewstempvar",$gid)." where varid='$varid'");
$sql=$empire->query("delete from ".GetDoTemptb("enewstempvar",$gid)." where varid='$varid'");
//删除备份记录
DelEbakTempAll('tempvar',$gid,$varid);
if($sql)
{
//操作日志
insert_dolog("varid=".$varid."
var=".$r[myvar]."&gid=$gid");
printerror("DelTempvarSuccess","ListTempvar.php?classid=$cid&gid=$gid".hReturnEcmsHashStrHref2(0));
}
else
{printerror("DbError","history.go(-1)");}
}
$enews=$_POST['enews'];
if(empty($enews))
{$enews=$_GET['enews'];}
if($enews)
{
hCheckEcmsRHash();
include("../../class/tempfun.php");
}
//增加模板变量
if($enews=="AddTempvar")
{
$add=$_POST;
AddTempvar($add,$logininid,$loginin);
}
//修改模板变量
elseif($enews=="EditTempvar")
{
$add=$_POST;
EditTempvar($add,$logininid,$loginin);
}
//删除模板变量
elseif($enews=="DelTempvar")
{
$varid=$_GET['varid'];
$cid=$_GET['cid'];
DelTempvar($varid,$cid,$logininid,$loginin);
}
$gid=(int)$_GET['gid'];
$gname=CheckTempGroup($gid);
$urlgname=$gname." > ";
$search="&gid=$gid".$ecms_hashur['ehref'];
$page=(int)$_GET['page'];
$page=RepPIntvar($page);
$start=0;
$line=25;//每页显示条数
$page_line=12;//每页显示链接数
$offset=$page*$line;//总偏移量
$query="select varid,myvar,varvalue,varname,isclose from ".GetDoTemptb("enewstempvar",$gid);
$totalquery="select count(*) as total from ".GetDoTemptb("enewstempvar",$gid);
//类别
$add="";
$classid=(int)$_GET['classid'];
if($classid)
{
$add=" where classid=$classid";
$search.="&classid=$classid";
}
$query.=$add;
$totalquery.=$add;
$num=$empire->gettotal($totalquery);//取得总条数
$query=$query." order by varid desc limit $offset,$line";
$sql=$empire->query($query);
$returnpage=page2($num,$line,$page_line,$start,$page,$search);
//类别
$cstr="";
$csql=$empire->query("select classid,classname from {$dbtbpre}enewstempvarclass order by classid");
while($cr=$empire->fetch($csql))
{
$select="";
if($cr[classid]==$classid)
{
$select=" selected";
}
$cstr.="";
}
?>
位置: =$urlgname?> 管理模板变量 |
选择类别: |
ID |
变量标识 |
模板变量名 |
开启 |
操作 |
=$r[varname]?>
|
|
=$isclose?> |
||
=$returnpage?> |