This repository has been archived on 2026-06-20. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
wsh5485 7e47ce238b chore: 添加多个图片和资源文件
添加了管理后台所需的图片资源、Excel文件、安装程序以及设计相关的图片文件
2025-06-15 13:04:37 +08:00

133 lines
5.2 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_.=" > 新增";
}
//path_op
$path_op="<option value='0'>-根目录-</option>";
$r=$db->query("select * from ".$table_pre."path where module='".$msg_mod["module"]."' and deep='1' and id<>'".$id."' order by ord");
while($m=$db->fetch_array($r)){
$path_op.="<option value='".$m[path]."-".$m[id]."'";
if($m[path]."-".$m[id]==$msg["path"])
$path_op.=" selected";
$path_op.=">".$m["title"]."</option>";
}
$content[]=array("上级目录","<select name=\"path\">".$path_op."</select>");
$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 path='".$path."' and id<>'".$id."' and module='".$msg_mod["module"]."'");
if($c["num"]>0)
alert_and_back("该目录已经存在,请重新输入一个!");
$deep=get_deep($path);
if($id){
$query="update ".$table_pre."path set path='".$path."',deep='".$deep."',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"]."' and path='".$path."'");
if($tmp[num]>0)
$ord=$tmp[num]+1;
else
$ord=1;
//
$query="insert ".$table_pre."path (path,deep,ord,title,module) values ('".$path."','".$deep."','".$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_ord1('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];
//
$q="select * from ".$table_pre."path ".$sql_con."and path='0-".$msg[id]."' order by ord";
$r=$db->query($q);
$count++;
while($m=$db->fetch_array($r)){
$content[$count][]="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--<input type=checkbox id='cb".$count."' name=id[] value=\"".$m[id]."\"><input type=text name=ord[] value='".$m[ord]."' class=text_area style='width:20px'> <a href=\"".$_SERVER[PHP_SELF]."?_m=".$_m."&_cid=".$_cid."&_a=add&id=".$m[id]."&_title_=".urlencode($_title_)."\">".$m[title]."</a>";
$content[$count][]=$m[id];
$count++;
}
}
if(!$content)
$content[0]="暂无记录!";
include template("manage_list");
break;
}
?>