7e47ce238b
添加了管理后台所需的图片资源、Excel文件、安装程序以及设计相关的图片文件
114 lines
4.1 KiB
PHP
114 lines
4.1 KiB
PHP
<?php
|
|
if(THIS_IN!="edt_c")
|
|
exit("错误的访问!");
|
|
$uid=check_cookie();
|
|
$db=_mysql_connect();
|
|
$msg_login_user=get_db_msg("select * from ".$table_pre."user where id='".$uid."'");
|
|
$_title_=$_title_?$_title_:"目录";
|
|
$msg_mod=get_db_msg("select * from ".$table_pre."channel where id='".$_cid."'");
|
|
$_nav_="首页 > <a href=\"".$_SERVER[PHP_SELF]."?_cid=".$_cid."&_m=".$msg_mod["module"]."&s_gid=".$s_gid."\">".$msg_mod["title"]."</a> > <a href=\"".$_SERVER[PHP_SELF]."?_cid=".$_cid."&_m=".$_m."\">".$_title_."管理</a>";
|
|
switch($_a){
|
|
case "add" :
|
|
if($id){
|
|
$msg=get_db_msg("select * from ".$table_pre."path where id='".$id."'");
|
|
$_nav_.=" > 修改";
|
|
}else{
|
|
$_nav_.=" > 新增";
|
|
}
|
|
$content[]=array("名称","<input type=\"text\" name=\"title\" value=\"".$msg["title"]."\" style=\"width:400px\" maxlength=255>");
|
|
//js_code
|
|
$js_code="function ok(){
|
|
obj=document.form1;
|
|
if(obj.title.value==''){
|
|
alert('请输入名称!');
|
|
obj.title.focus();
|
|
return false;
|
|
}
|
|
return true;
|
|
}";
|
|
//
|
|
$form_property=" onsubmit=\"return ok()\"";
|
|
$form_hidden=array("id"=>$id,"_a"=>"save_add","_title_"=>$_title_,"http_pre"=>$_SERVER['HTTP_REFERER']);
|
|
include template("manage_add");
|
|
break;
|
|
case "save_add" :
|
|
//验证
|
|
$c=get_db_msg("select count(*) 'num' from ".$table_pre."path where title='".$title."' and id<>'".$id."' and module='".$msg_mod["module"]."'");
|
|
if($c["num"]>0)
|
|
alert_and_back("该目录已经存在,请重新输入一个!");
|
|
if($id){
|
|
$query="update ".$table_pre."path set title='".$title."' where id='".$id."'";
|
|
$db->query($query);
|
|
$log_action="修改";
|
|
}else{
|
|
//ord
|
|
$tmp=get_db_msg("select max(ord) 'num' from ".$table_pre."path where module='".$msg_mod["module"]."'");
|
|
if($tmp[num]>0)
|
|
$ord=$tmp[num]+1;
|
|
else
|
|
$ord=1;
|
|
//
|
|
$query="insert ".$table_pre."path (path,deep,ord,title,module) values ('0','1','".$ord."','".$title."','".$msg_mod["module"]."')";
|
|
$db->query($query);
|
|
$iid=$db->insert_id();
|
|
$log_action="新增";
|
|
}
|
|
$lid=$id?$id:$iid;
|
|
set_log($log_action.$msg_mod["title"].$_title_,$title."|".$lid);
|
|
url_redirect($http_pre);
|
|
break;
|
|
case "save_ord":
|
|
for($i=0;$i<count($id);$i++){
|
|
$q="update ".$table_pre."path set ord='".$ord[$i]."' where id='".$id[$i]."'";
|
|
$db->query($q);
|
|
}
|
|
url_redirect();
|
|
break;
|
|
case "delete" :
|
|
$num=count($id);
|
|
if($num==0)
|
|
alert_and_back("请至少选择一条记录!");
|
|
for($i=0;$i<$num;$i++){
|
|
$tmp=get_db_msg("select * from ".$table_pre."path where id='".$id[$i]."'");
|
|
$lid.=$tmp["title"]."|".$id[$i].", ";
|
|
$db->query("delete from ".$table_pre."path where id='".$id[$i]."'");
|
|
}
|
|
$lid=substr($lid,0,-2);
|
|
set_log("删除".$msg_mod["title"].$_title_,$lid);
|
|
url_redirect();
|
|
break;
|
|
default :
|
|
//
|
|
$sql_con="where module='".$msg_mod["module"]."'";
|
|
$tmp=get_db_msg("select count(*) 'total' from ".$table_pre."path ".$sql_con);
|
|
$total=$tmp["total"];
|
|
//
|
|
$form_hidden=array(
|
|
"s_keyword"=>$s_keyword,
|
|
"_title_"=>$_title_
|
|
);
|
|
//
|
|
$column=array(
|
|
"<input type=checkbox name=toggle onclick=\"checkAll(".$total.")\">名称 <a href='javascript:save_ord(".$total.")'><img src='images/save_order.png' border=0 alt='保存次序'></a>",
|
|
"ID"
|
|
);
|
|
$column_property=array("align=left","align=left width=70");
|
|
//
|
|
$act="<input type=\"button\" value=\"新增\" onclick=\"dadd()\" class=\"button_act\">";
|
|
$act.=" <input type=\"button\" value=\"删除\" onclick=\"ddel(".$total.")\" class=\"button_act\">";
|
|
//
|
|
$query="select * from ".$table_pre."path ".$sql_con."and deep='1' order by ord";
|
|
//echo $query."<br>";
|
|
$res=$db->query($query);
|
|
$count=0;
|
|
while($msg=$db->fetch_array($res)){
|
|
$content[$count][]="<input type=checkbox id='cb".$count."' name=id[] value=\"".$msg[id]."\"><input type=text name=ord[] value='".$msg[ord]."' class=text_area style='width:20px'> <a href=\"".$_SERVER[PHP_SELF]."?_m=".$_m."&_cid=".$_cid."&_a=add&id=".$msg[id]."&_title_=".urlencode($_title_)."\">".$msg[title]."</a>";
|
|
$content[$count][]=$msg[id];
|
|
$count++;
|
|
}
|
|
if(!$content)
|
|
$content[0]="暂无记录!";
|
|
include template("manage_list");
|
|
break;
|
|
}
|
|
?>
|