<!--#include file="base.asp"-->
<%
	sub menudb()
		dim id:id=eycms.getint(eycms.fget("id",0),0)
		dim user_lock:user_lock=eycms.db.dbloadone("islock","ey_admin_menu","title='会员'")
		data=eycms.db.dbload("","title,url","ey_admin_menu","id="&id&" and islock=1","ordnum,id")
		if ubound(data)<0 then
			exit sub
		end if
		dim title:title=data(0,0)
		dim url:url=data(1,0)
		dim arr:arr=split(url,"?")
		url=arr(0)
		if id=3 and title="内容" then
			dim get_pass
			data=eycms.categorydata
			if isarray(data) then
				gettree 0,""
			end if
			get_pass="{id:-2,pId:-1,name:""综合管理"",url:"""",target:""iframe_body"",open:true}"
			get_pass=get_pass&",{id:-3,pId:-2,name:""内容列表"",url:""ey_content.asp?act=list"",target:""iframe_body""}"
			if admingroupid=0 then	
				get_pass=get_pass&",{id:-3,pId:-2,name:""区块管理"",url:""ey_block.asp"",target:""iframe_body""}"
				if user_lock=1 Then get_pass=get_pass&",{id:-3,pId:-2,name:""投稿管理"",url:""ey_publish.asp"",target:""iframe_body""}"
				get_pass=get_pass&",{id:-3,pId:-2,name:""回收站"",url:""ey_recycle.asp"",target:""iframe_body""}"
			else
				if instr(","&admin_page_lever&",",",20,")>0 or instr(","&admin_page_lever&",",",21,")>0 or instr(","&admin_page_lever&",",",30,")>0 then
					if instr(","&admin_page_lever&",",",30,")>0 then
						get_pass=get_pass&",{id:-3,pId:-2,name:""区块管理"",url:""ey_block.asp"",target:""iframe_body""}"
					end if
					if instr(","&admin_page_lever&",",",21,")>0 then
						get_pass=get_pass&",{id:-3,pId:-2,name:""回收站"",url:""ey_recycle.asp"",target:""iframe_body""}"
					end if
				end if
			end if
			get_tree="["&get_pass&get_tree&"]"
			
			eycms.echo get_tree
		else
			if id=8 and webmode<3 then
				dim w:w=" and id=45"
			end if
			data=eycms.db.dbload("","title,url,id","ey_admin_menu","followid="&id&" and islock=1 "&w&" "&admin_lever_where&"","ordnum,id")
			if ubound(data)>0 then
				dim str,j
				str="["
				str=str&"{id:"&id&",pId:0,name:"""&title&""",open:true}"
				for j=0 to ubound(data,2)
					str=str&",{id:"&data(2,j)&",pId:"&id&",name:"""&data(0,j)&""",url:"""&eycms.iif(left(data(1,j),1)="?",url,"")&data(1,j)&""",target:""iframe_body""}"
				next
				if id=7 then
					dim fso,fsofolder,fsocontent,fsocount
					dim xml,versions,author,website,plugkey
					set fso=createobject("scripting.filesystemobject")
					set fsofolder=fso.getfolder(server.mappath("../plug/"))
					set fsocontent=fsofolder.files
					for each fsocount in fsofolder.subfolders
						if eycms.isfile("../plug/"&fsocount.name&"/config.xml") then
						set xml=server.createobject("microsoft.xmldom")
						xml.async=false
						xml.load(server.mappath("../plug/"&fsocount.name&"/config.xml"))
						title=xml.documentelement.childnodes(0).text
						plugkey=xml.documentelement.childnodes(4).text
						if eycms.strlen(eycms.getsys(plugkey))>0 then
							str=str&",{id:1,pId:"&id&",name:"""&title&""",url:""../plug/"&fsocount.name&"/"",target:""iframe_body""}"
						end if
						end if
					next
					set xml=nothing
					set fsofolder=nothing
					set fsocontent=nothing
				end if
				str=str&"]"
				eycms.echo str
			end if
		end if	
	end sub
	
	sub gettree(byval t0,byval t1)
		dim i,isdim
		for i=0 to ubound(data,2)
			If data(10,i)>-2 then
				if admingroupid=0 then
					get_tree=get_tree&",{"
					get_tree=get_tree&"id:"&data(0,i)&""
					get_tree=get_tree&",pId:"&eycms.iif(data(3,i)=0,"-1",data(3,i))&""
					get_tree=get_tree&",name:"""&Replace(data(1,i),"&amp;","&")&""""
					get_tree=get_tree&",url:"""
					select case data(10,i)
						case "-1"
							if eycms.strlen(data(9,i))=0 Then 
								isdim=eycms.iif(len(data(21,i))=0,"yes",(data(21,i)))
								if isdim="model/page/eycms_page.asp" then isdim="yes"
								if isdim="yes" then 
									get_tree=get_tree&"ey_model_page.asp?classid="&data(0,i)
								else
									get_tree=get_tree&"ey_model_page.asp?act=html&classid="&data(0,i)
								end if
							end if
						case "-2":get_tree=get_tree&""
						case else:get_tree=get_tree&"ey_content.asp?classid="&data(0,i)
					end select
					get_tree=get_tree&""""
					get_tree=get_tree&",target:""iframe_body"""
					get_tree=get_tree&"}"
				else
					if instr(","&admin_cate_array&",",","&data(0,i)&",")>0 then
						get_tree=get_tree&",{"
						get_tree=get_tree&"id:"&data(0,i)&""
						get_tree=get_tree&",pId:"&eycms.iif(data(3,i)=0,"-1",data(3,i))&""
						get_tree=get_tree&",name:"""&Replace(data(1,i),"&amp;","&")&""""
						get_tree=get_tree&",url:"""
						select case data(10,i)
							case "-1"
								if eycms.strlen(data(9,i))=0 Then 
									isdim=eycms.iif(len(data(21,i))=0,"yes",(data(21,i)))
									if isdim="model/page/eycms_page.asp" then isdim="yes"
									if isdim="yes" then 
										get_tree=get_tree&"ey_model_page.asp?classid="&data(0,i)
									else
										get_tree=get_tree&"ey_model_page.asp?act=html&classid="&data(0,i)
									end if
								end if
							case "-2":get_tree=get_tree&""
							case else:get_tree=get_tree&"ey_content.asp?classid="&data(0,i)
						end select
						get_tree=get_tree&""""
						get_tree=get_tree&",target:""iframe_body"""
						get_tree=get_tree&"}"
					end if
				end If
			End if
		next
	end sub
	
	islogin
	dim act:act=lcase(eycms.fget("act",0))
	dim data,get_tree
	select case act
		case "right"
			dim thisdate:thisdate=clng(year(now())&right("0"&month(now()),2)&right("0"&day(now()),2))
			dim user_lock:user_lock=eycms.db.dbloadone("islock","ey_admin_menu","title='会员'")
			if user_lock=1 then
				dim sys_0:sys_0=eycms.db.dbloadone("count(id)","ey_content","islock=-1")
				dim sys_1:sys_1=eycms.db.dbloadone("count(id)","ey_content","islock=-2")
				dim sys_2:sys_2=eycms.db.dbloadone("count(id)","ey_user","islock=0")
				dim sys_3:sys_3=eycms.db.dbloadone("count(id)","ey_user","isvip=1 and overdate<"&thisdate&"")
				dim sys_4:sys_4=eycms.db.dbloadone("count(id)","ey_user_order","ispay=0")
				dim sys_5:sys_5=eycms.db.dbloadone("count(id)","ey_user_order","ispay=1 and postway=0")
				dim sys_6:sys_6=eycms.db.dbloadone("count(id)","ey_user_order","ispay=1 and postway=1 and isover=0")
				dim sys_7:sys_7=eycms.db.dbloadone("count(id)","ey_expand_link","islock=0")
			end if
			dim sys_8:sys_8=eycms.db.dbloadone("count(id)","ey_expand_book","islock=0")
			dim sys_9:sys_9=eycms.db.dbloadone("count(id)","ey_expand_book","reply is null or reply=''")
			dim sys_10:sys_10=eycms.db.dbloadone("count(commentid)","ey_expand_comment","islock=0")
			dim sys_11:sys_11=eycms.db.dbloadone("count(commentid)","ey_expand_comment","reply is null or reply=''")

			dim sitedata,cdata
			sitedata=eycms.db.dbload(1,"setvalue","ey_config","setname='eycms.expand' and setkey='expand.comment'","")
			cdata=eval(sitedata(0,0))
			load theme_right
		case "menu":menudb
		case else
			dim s:s=eycms.strlen(eycms.getsys("qq.login"))
			load theme_frame
	end select
	eycms.db.dbclose
%>
