gettotal("select count(*) as total from {$dbtbpre}enewsmenuclass where classtype=1 limit 1");
if($showfastmenu)
{
echo"";
}
$showextmenu=$empire->gettotal("select count(*) as total from {$dbtbpre}enewsmenuclass where classtype=3 limit 1");
if($showextmenu)
{
echo"";
}
}
//增加菜单分类
function AddMenuClass($add,$userid,$username){
global $empire,$dbtbpre;
$classtype=(int)$add['classtype'];
if(!$add[classname])
{
printerror("EmptyMenuClass","history.go(-1)");
}
//验证权限
CheckLevel($userid,$username,$classid,"menu");
$myorder=(int)$add['myorder'];
$add['classname']=hRepPostStr($add['classname'],1);
$sql=$empire->query("insert into {$dbtbpre}enewsmenuclass(classname,myorder,classtype) values('".$add[classname]."','$myorder','$classtype');");
$lastid=$empire->lastid();
if($sql)
{
MenuClassToShow();
//操作日志
insert_dolog("classid=".$lastid."
classname=".$add[classname]);
printerror("AddMenuClassSuccess","MenuClass.php".hReturnEcmsHashStrHref2(1));
}
else
{printerror("DbError","history.go(-1)");}
}
//修改菜单分类
function EditMenuClass($add,$userid,$username){
global $empire,$dbtbpre;
$classid=$add['classid'];
$delclassid=$add['delclassid'];
$classname=$add['classname'];
$myorder=$add['myorder'];
$classtype=$add['classtype'];
$count=count($classid);
if(!$count)
{
printerror("EmptyMenuClass","history.go(-1)");
}
//验证权限
CheckLevel($userid,$username,$classid,"menu");
//删除
$del=0;
$ids='';
$delcount=count($delclassid);
if($delcount)
{
$dh='';
for($j=0;$j<$delcount;$j++)
{
$ids.=$dh.intval($delclassid[$j]);
$dh=',';
}
$empire->query("delete from {$dbtbpre}enewsmenuclass where classid in (".$ids.")");
$empire->query("delete from {$dbtbpre}enewsmenu where classid in (".$ids.")");
$del=1;
}
//修改
for($i=0;$i<$count;$i++)
{
$classid[$i]=(int)$classid[$i];
if(strstr(','.$ids.',',','.$classid[$i].','))
{
continue;
}
$myorder[$i]=(int)$myorder[$i];
$classtype[$i]=(int)$classtype[$i];
$classname[$i]=hRepPostStr($classname[$i],1);
$empire->query("update {$dbtbpre}enewsmenuclass set classname='".$classname[$i]."',myorder='".$myorder[$i]."',classtype='".$classtype[$i]."' where classid='".$classid[$i]."'");
}
MenuClassToShow();
//操作日志
insert_dolog("del=$del");
printerror("EditMenuClassSuccess","MenuClass.php".hReturnEcmsHashStrHref2(1));
}
//修改菜单分类用户权限
function EditMenuClassGroup($add,$userid,$username){
global $empire,$dbtbpre;
$classid=(int)$add['classid'];
if(!$classid)
{
printerror("EmptyMenuClass","history.go(-1)");
}
//验证权限
CheckLevel($userid,$username,$classid,"menu");
$cr=$empire->fetch1("select classid,classname from {$dbtbpre}enewsmenuclass where classid='$classid'");
if(!$cr['classid'])
{
printerror("EmptyMenuClass","history.go(-1)");
}
$groupid=$add['groupid'];
$groupids='';
$count=count($groupid);
if($count)
{
for($i=0;$i<$count;$i++)
{
$gid=(int)$groupid[$i];
if(!$gid)
{
continue;
}
$groupids.=','.$gid;
}
if($groupids)
{
$groupids.=',';
}
}
$sql=$empire->query("update {$dbtbpre}enewsmenuclass set groupids='$groupids' where classid='$classid';");
if($sql)
{
MenuClassToShow();
//操作日志
insert_dolog("classid=".$classid."
classname=".$cr[classname]);
printerror("EditMenuClassSuccess","ListMenu.php?classid=$classid".hReturnEcmsHashStrHref2(0));
}
else
{printerror("DbError","history.go(-1)");}
}
$enews=$_POST['enews'];
if(empty($enews))
{$enews=$_GET['enews'];}
if($enews)
{
hCheckEcmsRHash();
}
if($enews=="AddMenuClass")//增加菜单分类
{
AddMenuClass($_POST,$logininid,$loginin);
}
elseif($enews=="EditMenuClass")//修改菜单分类
{
EditMenuClass($_POST,$logininid,$loginin);
}
elseif($enews=="EditMenuClassGroup")//修改菜单分类用户权限
{
EditMenuClassGroup($_POST,$logininid,$loginin);
}
else
{}
$sql=$empire->query("select classid,classname,issys,myorder,classtype from {$dbtbpre}enewsmenuclass order by myorder,classid");
?>
位置:管理菜单 |