<!--#include file="base.asp"-->
<%
''' EYCMS 设置
''' ==================================================================

	sub sitedb()
		'on error resume next
		dim t0,t1,t2,t3,t4,t5,t6,t7
		t0=eycms.enhtml(eycms.fpost("t0",0))
		t1=eycms.enhtml(eycms.fpost("t1",0))
		t2=eycms.enhtml(eycms.fpost("t2",0))
		t3=eycms.enhtml(eycms.fpost("t3",0))
		t4=eycms.getint(eycms.fpost("t4",0),60)
		t5=eycms.enhtml(eycms.fpost("t5",0))
		t6=eycms.fpost("t6",0)
		t7=eycms.enhtml(eycms.fpost("t7",0))
		if eycms.strlen(t0)=0 then eycms.ajaxjson "&#32593;&#31449;&#21517;&#31216;&#19981;&#33021;&#20026;&#31354;",0:exit sub
		if eycms.strlen(t1)=0 then eycms.ajaxjson "&#36816;&#34892;&#27169;&#24335;&#19981;&#33021;&#20026;&#31354;",0:exit sub
		if eycms.strlen(t2)=0 then eycms.ajaxjson "&#39029;&#38754;&#21387;&#32553;&#19981;&#33021;&#20026;&#31354;",0:exit sub
		if eycms.strlen(t3)=0 then eycms.ajaxjson "&#26159;&#21542;&#32531;&#23384;&#19981;&#33021;&#20026;&#31354;",0:exit sub
		if eycms.strlen(t4)=0 then eycms.ajaxjson "&#32531;&#23384;&#26102;&#38388;&#19981;&#33021;&#20026;&#31354;",0:exit sub
	
		'写入数据库
		eycms.db.dbupdate "ey_config","setname='eycms.site' and setkey='webname'",array(array("setvalue",t0,50,1))
		eycms.db.dbupdate "ey_config","setname='eycms.site' and setkey='webmode'",array(array("setvalue",t1,50,1))
		eycms.db.dbupdate "ey_config","setname='eycms.site' and setkey='isgzip'",array(array("setvalue",t2,50,1))
		eycms.db.dbupdate "ey_config","setname='eycms.site' and setkey='iscache'",array(array("setvalue",t3,50,1))
		eycms.db.dbupdate "ey_config","setname='eycms.site' and setkey='cachedate'",array(array("setvalue",t4,9,1))
		eycms.db.dbupdate "ey_config","setname='eycms.site' and setkey='webicp'",array(array("setvalue",t5,20,1))
		eycms.db.dbupdate "ey_config","setname='eycms.site' and setkey='webcount'",array(array("setvalue",t6,0,1))
		eycms.db.dbupdate "ey_config","setname='eycms.site' and setkey='tempcache'",array(array("setvalue",t7,0,1))

	    '自定义设置
		dim fstr:fstr=deal_model_site(0)
		dim temp,jj
		temp=""
		fstr=split(fstr,"{eycms}")
		for jj=0 to ubound(fstr)
			temp=split(fstr(jj),"{|}")
			eycms.db.dbupdate "ey_config","setname='eycms.site' and setkey='"&temp(0)&"'",array(array("setvalue",temp(1),temp(2),temp(3)))
			'eycms.db.dbupdate "ey_plug_set","setName='"&temp(0)&"'",array(array("setValue",temp(1),temp(2),temp(3)))
		next

		eycms.clearcache
		if t1="2" then
			dim rewrite:rewrite=eycms.enhtml(eycms.fpost("rewrite",1))
			dim t8
			eycms.delfile "../httpd.ini"
			eycms.delfile "../httpd.parse.errors"
			eycms.delfile "../.htaccess"
			eycms.delfile "../web.config"
			if rewrite=1 then
				t8=eycms.loadfile("../lib/urlrule/httpd.ini")
				t8=replace(t8,"{admin}",replace(get_adminfolder,"/",""))
				eycms.newfile "../","httpd.ini",t8,"gb2312"
			end if

			if rewrite=2 then
				t8=eycms.loadfile("../lib/urlrule/.htaccess")
				t8=replace(t8,"{admin}",replace(get_adminfolder,"/",""))
				eycms.newfile "../",".htaccess",t8,""
			end if
			
			if rewrite=3 then
				t8=eycms.loadfile("../lib/urlrule/web.config")
				t8=replace(t8,"{admin}",replace(get_adminfolder,"/",""))
				eycms.newfile "../","web.config",t8,""
			end if
		else
			eycms.delfile "../httpd.ini"
			eycms.delfile "../httpd.parse.errors"
			eycms.delfile "../.htaccess"
			eycms.delfile "../web.config"
		end if
		eycms.ajaxjson "保存成功",1
		if err then
			eycms.errlog "文件：ey_set.asp<BR>函数：sitedb()<br>详情："&err.description,0
			err.clear
		End if
	end sub

	function getinable(t0)
		getinable=true
		dim xml,nodelist
		if eycms.isfile(""&webroot&"site/config.xml") then
			set xml=server.createobject("microsoft.xmldom")
			xml.async=false
			xml.load(server.mappath(""&webroot&"site/config.xml"))
			set nodelist = xml.documentelement.selectnodes("site[@tag='"&site_root&"_"&t0&"']")
			If nodelist.length>0 then 
				getinable=false
			end if
			set nodelist=nothing
			set xml=nothing
		end if
	end function

	sub langdb()
		dim t0,t1,t2,t3,qid,mlang,murl,mcolor,ncolor
		dim mysite:mysite=site_root
		if instr(mysite,"_") then mysite=split(mysite,"_")(0)
		t0=eycms.enhtml(eycms.fpost("t0",0))
		t1=eycms.enhtml(eycms.fpost("t1",0))&","
		t2=eycms.enhtml(eycms.fpost("t2",0))&","
		t3=eycms.enhtml(eycms.fpost("t3",0))&","
		t1=replace(t1," ","")
		t2=replace(t2," ","")
		t3=replace(t3," ","")
		dim str:str=""
		str=str&"<?xml version=""1.0"" encoding=""UTF-8""?>"&vbcrlf
		str=str&"<xml>"&vbcrlf
		str=str&"<set>"&t0&"</set>"&vbcrlf
		str=str&"<list>"&vbcrlf
		mlang=split(t1,",")
		murl=split(t2,",")
		mcolor=split(t3,",")
		if ubound(mlang)>=0 then
		dim i
		for i=0 to ubound(mlang)
			If eycms.strlen(murl(i))>0 then
				ncolor=mcolor(i)
				if ncolor="" Then ncolor="#333333"
				str=str&"<lang>"&vbcrlf
				str=str&"	<type>"&mlang(i)&"</type>"&vbcrlf
				str=str&"	<url>"&murl(i)&"</url>"&vbcrlf
				str=str&"	<color>"&ncolor&"</color>"&vbcrlf
				str=str&"	<id>"&i&"</id>"&vbcrlf
				str=str&"</lang>"&vbcrlf
			End if
		next
		end if
		str=str&"</list>"&vbcrlf
		str=str&"</xml>"
		eycms.newfile webroot&"lang/",mysite&".xml",str,"UTF-8"
		eycms.ajaxjson "保存成功",1
	end sub

	sub sitegroupadddb()
		on error resume Next
		dim t0,t1,t2,t3,t4,t5
		t0=eycms.enhtml(eycms.fpost("t0",0))
		t1=eycms.enhtml(eycms.fpost("t1",0))
		t2=eycms.enhtml(eycms.fpost("t2",0))
		t3=eycms.enhtml(eycms.fpost("t3",0))
		t4=eycms.getint(eycms.fpost("t4",0),0)
		t5=eycms.getint(eycms.fpost("t5",0),0)
		if eycms.strlen(t1)=0 then eycms.ajaxjson "站点名称不能为空",0:exit sub
		if eycms.strlen(t2)=0 then eycms.ajaxjson "绑定域名不能为空",0:exit Sub
		if datatype=false then eycms.ajaxjson "Mssql版 无法通过该功能安装",0:exit Sub
		If InStr(LCase(t2),"http://")>0 Then t2=Right(LCase(t2),Len(t2)-7)
		t2=replace(t2,"/","")


		dim xml,nodelist,item,node,config
		dim dbase,dsite,dtheme,ntheme,dlang
		dsite=site_root
		if instr(dsite,"_")>0 then dsite=split(dsite,"_")(0)
		dlang=split(t0,"_")(1)
		dtheme=theme_root
		if instr(dtheme,"_")>0 then dtheme=split(dtheme,"_")(0)
		ntheme=dtheme&"_"&dlang

		if eycms.isfile(webroot&"site/config.xml") then
			set xml=server.createobject("microsoft.xmldom")
			xml.async=false
			xml.load(server.mappath(webroot&"site/config.xml"))
			set nodelist = xml.documentelement.selectnodes("site[@tag='"&t0&"']")
			If nodelist.length>0 then 
				eycms.ajaxjson "添加失败，模板已经安装过",0:exit sub
			else
				eycms.newfolder "../site/"&t0
				eycms.copyfolder "../site/"&dsite&"/","../site/"&t0&"/"
				if eycms.isfolder("../theme/"&ntheme&"/")=false then
					eycms.newfolder "../theme/"&ntheme
					eycms.copyfolder "../theme/"&dtheme&"/","../theme/"&ntheme&"/"
					totrans "../theme/"&ntheme,dlang
				end if
				dbase="true{eycms}"&datapath&"{eycms}"&datadbname
				dbase=replace(dbase,dsite&"/",t0&"/")

				If t4=1 Then 
					set nodelist = xml.documentelement.selectnodes("site[@def=1]")
					If nodelist.length>0 then nodelist.item(0).setattribute "def", 0
				End if

				set item=xml.getElementsByTagName("site")
				set node=xml.createNode(1,"site","")
			    set nodeattr = xml.createattribute("group")
			    node.setattribute "group", t5
				set nodeattr = xml.createattribute("prefix")
				node.setattribute "prefix", t3
				set nodeattr = xml.createattribute("def")
				node.setattribute "def", t4
				set nodeattr = xml.createattribute("url")
				node.setattribute "url", t2
				set nodeattr = xml.createattribute("tag")
				node.setattribute "tag", t0
				set nodeattr = xml.createattribute("sname")
				node.setattribute "sname", t1
				set nodeattr = xml.createattribute("theme")
				node.setattribute "theme", ntheme
				xml.documentElement.appendChild(node)
				xml.save(server.mappath("../site/config.xml")) 
				set item=Nothing
				if eycms.isfile("../site.asp") Then
					config=eycms.loadfile("../site.asp")
					config=Replace(config,"'{nextsite}","sdt.add """&t0&""","""&dbase&""""&vbcrlf&"'{nextsite}")
					eycms.newfile "../","site.asp",config,"utf-8"
				End if

				eycms.dbconfig dbase,ntheme,t1,"",""
			end if
			set nodelist=nothing
			set xml=nothing
		else
			eycms.ajaxjson "添加失败，配置文件不存在",0:exit sub
		end if

		eycms.clearcache
		eycms.ajaxjson "添加成功",1
		if err then
			eycms.errlog "文件：ey_set.asp<BR>函数：sitegroupadddb()<br>详情："&err.description,0
			err.clear
		End if
	end sub

	Sub totrans(byval troot,byval tlang)
		on error resume Next
		dim temp, etrans
		dim fname,xml,i,item,seturl
		if eycms.isfile(troot&"/base.xml") Then
			set etrans=new eycms_lang
			set xml=server.createobject("microsoft.xmldom")
			xml.async=false
			xml.load(server.mappath(troot&"/base.xml"))
			set item=xml.getElementsByTagName("item")
			for i=0 to (item.length-1)
				set seturl=item.item(i).getElementsByTagName("seturl")
				fname=seturl.item(0).Text
				if eycms.isfile(troot&"/"&fname) Then
					temp=eycms.loadfile(troot&"/"&fname)
					select case tlang
					case "en":temp=etrans.toen(temp)
					case "jp":temp=etrans.tojp(temp)
					case "ko":temp=etrans.toko(temp)
					case "fr":temp=etrans.tofr(temp)
					end select
					eycms.newfile troot&"/",fname,temp,"utf-8"
				End if
			Next
			if eycms.isfolder(troot&"/mobile") Then
				dim fstr, fsarr
				fstr="mobile/eycms_index.asp|mobile/eycms_comment.asp|mobile/eycms_search.asp|" & _
				   "mobile/model/news/eycms_list.asp|mobile/model/news/eycms_show.asp|" & _
				   "mobile/model/page/eycms_page.asp|mobile/model/photo/eycms_list.asp|mobile/model/photo/eycms_show.asp|" & _
				   "mobile/model/pro/eycms_list.asp|mobile/model/pro/eycms_show.asp|" & _
				   "mobile/model/video/eycms_list.asp|mobile/model/video/eycms_show.asp|" & _
				   "mobile/model/down/eycms_list.asp|mobile/model/down/eycms_show.asp"
				fsarr=Split(fstr,"|")
				for i=0 To UBound(fsarr)
					if eycms.isfile(troot&"/"&fsarr(i)) Then
						temp=eycms.loadfile(troot&"/"&fsarr(i))
						select case tlang
						case "en":temp=etrans.toen(temp)
						case "jp":temp=etrans.tojp(temp)
						case "ko":temp=etrans.toko(temp)
						case "fr":temp=etrans.tofr(temp)
						end select
						eycms.newfile troot&"/",fsarr(i),temp,"utf-8"
					End if
				next
			End If
			set xml=nothing
			set item=Nothing
			set etrans=nothing
		End If
		if err then
			eycms.errlog "文件名：ey_set.asp<br>函数：totrans<br>详情："&err.description,0
			err.clear
		end if
	End Sub

	sub sitegroup_adddb()
		dim site:site=eycms.fpost("site",0)
		dim t0,t1,t2,t3,t4,t5,sdatadbname
		t0=eycms.enhtml(eycms.fpost("t0",0))
		t1=eycms.enhtml(eycms.fpost("t1",0))
		t2=eycms.enhtml(eycms.fpost("t2",0))
		t3=eycms.getint(eycms.fpost("t3",0),0)
		t4=eycms.getint(eycms.fpost("t4",0),0)
		t5=eycms.enhtml(eycms.fpost("t5",0))
		sdatadbname=get_datebasename(site)

		if eycms.strlen(t0)=0 then eycms.ajaxjson "站点名称不能为空",0:exit sub
		if eycms.strlen(t2)=0 then eycms.ajaxjson "变量前缀不能为空",0:exit Sub
		if datatype=false then eycms.ajaxjson "Mssql版 无法通过该功能安装",0:exit Sub
		if sdatadbname="" then eycms.ajaxjson "站点数据库文件不存在",0:exit Sub
		If InStr(LCase(t1),"http://")>0 Then t1=Right(LCase(t1),Len(t1)-7)
		if eycms.isfile(webroot&"site/config.xml") Then
			dim xml,nodelist,item,node,nodeattr,config
			set xml=server.createobject("microsoft.xmldom")
			xml.async=false
			xml.load(server.mappath(webroot&"site/config.xml"))

			dim dbase:dbase="true{eycms}site"&site&"/data{eycms}"&sdatadbname

			If t3=1 Then 
				set nodelist = xml.documentelement.selectnodes("site[@def=1]")
				If nodelist.length>0 then nodelist.item(0).setattribute "def", 0
			End if

			set item=xml.getElementsByTagName("site")
			set node=xml.createNode(1,"site","")
		    set nodeattr = xml.createattribute("group")
		    node.setattribute "group", t4
			set nodeattr = xml.createattribute("prefix")
			node.setattribute "prefix", t2
			set nodeattr = xml.createattribute("def")
			node.setattribute "def", t3
			set nodeattr = xml.createattribute("url")
			node.setattribute "url", t1
			set nodeattr = xml.createattribute("tag")
			node.setattribute "tag", site
			set nodeattr = xml.createattribute("sname")
			node.setattribute "sname", t0
			set nodeattr = xml.createattribute("theme")
			node.setattribute "theme", t5
			xml.documentElement.appendChild(node)
			xml.save(server.mappath("../site/config.xml")) 
			set item=Nothing
			if eycms.isfile("../site.asp") Then
				config=eycms.loadfile("../site.asp")
				config=Replace(config,"'{nextsite}","sdt.add """&site&""","""&dbase&""""&vbcrlf&"'{nextsite}")
				eycms.newfile "../","site.asp",config,"utf-8"
			End if

			set nodelist=Nothing
			set xml=nothing
			eycms.clearcache
		End If
		eycms.ajaxjson "保存成功",1
	end Sub

	sub sitegroupeditdb()
		dim setflag:setflag=false
		dim site:site=eycms.fget("site",0)
		if instr(http_host,"localhost")>0 or instr(http_host,"127.0.0.1")>0 then setflag=True
		if site=site_root then setflag=True
		If setflag then
			dim t0,t1,t2,t3,t4,t5
			t0=eycms.enhtml(eycms.fpost("t0",0))
			t1=eycms.enhtml(eycms.fpost("t1",0))
			t2=eycms.enhtml(eycms.fpost("t2",0))
			t3=eycms.getint(eycms.fpost("t3",0),0)
			t4=eycms.getint(eycms.fpost("t4",0),0)
			t5=eycms.enhtml(eycms.fpost("t5",0))

			if eycms.strlen(t0)=0 then eycms.ajaxjson "&#31449;&#28857;&#21517;&#31216;&#19981;&#33021;&#20026;&#31354;",0:exit sub
			if eycms.strlen(t2)=0 then eycms.ajaxjson "&#21464;&#37327;&#21069;&#32512;&#19981;&#33021;&#20026;&#31354;",0:exit Sub
			If InStr(LCase(t1),"http://")>0 Then t1=Right(LCase(t1),Len(t1)-7)
			if eycms.isfile(webroot&"site/config.xml") Then
				dim xml,nodelist
				set xml=server.createobject("microsoft.xmldom")
				xml.async=false
				xml.load(server.mappath(webroot&"site/config.xml"))
				If t3=1 Then 
					set nodelist = xml.documentelement.selectnodes("site[@def=1]")
					If nodelist.length>0 then nodelist.item(0).setattribute "def", 0
				End if
				set nodelist = xml.documentelement.selectnodes("site[@tag='"&site&"']")
				If nodelist.length>0 then 
					nodelist.item(0).setattribute "sname", t0
					nodelist.item(0).setattribute "url", t1
					nodelist.item(0).setattribute "prefix", t2
					nodelist.item(0).setattribute "def", t3
					nodelist.item(0).setattribute "group", t4
					nodelist.item(0).setattribute "theme", t5
					xml.save(server.mappath(webroot&"site/config.xml")) 
				End if
				set nodelist=Nothing
				set xml=nothing
				eycms.clearcache
			End If
			eycms.ajaxjson "保存成功",1
		Else
			eycms.ajaxjson "您没有权限修改该站点的配置",0
		end if
	end Sub

	sub getprefix()
		eycms.echo eycms.getrnd(5)
	end Sub

	sub seodb()
		dim t0,t1,t2
		t0=eycms.enhtml(eycms.fpost("t0",0))
		t1=eycms.enhtml(eycms.fpost("t1",0))
		t2=eycms.enhtml(eycms.fpost("t2",0))
		eycms.db.dbupdate "ey_config","setname='eycms.seo' and setkey='seotitle'",array(array("setvalue",t0,255,1))
		eycms.db.dbupdate "ey_config","setname='eycms.seo' and setkey='seokey'",array(array("setvalue",t1,255,1))
		eycms.db.dbupdate "ey_config","setname='eycms.seo' and setkey='seodesc'",array(array("setvalue",t2,255,1))
		eycms.delcache "eycmsdata"
		eycms.ajaxjson "保存成功",1
	end sub
	
	sub uploaddb()
		dim t0,t1,t2,t3,t4
		t0=eycms.enhtml(eycms.fpost("t0",0))
		t1=eycms.getint(eycms.fpost("t1",0),102400)
		t2=eycms.enhtml(eycms.fpost("t2",0))
		t3=eycms.enhtml(eycms.fpost("t3",0))
		t4=eycms.enhtml(eycms.fpost("t4",0))
		if eycms.strlen(t0)=0 then eycms.ajaxjson "&#19978;&#20256;&#30446;&#24405;&#19981;&#33021;&#20026;&#31354;",0:exit sub
		if eycms.strlen(t1)=0 then eycms.ajaxjson "&#22823;&#23567;&#38480;&#21046;&#19981;&#33021;&#20026;&#31354;",0:exit sub
		if eycms.strlen(t2)=0 then eycms.ajaxjson "&#25991;&#20214;&#31867;&#22411;&#19981;&#33021;&#20026;&#31354;",0:exit sub
		eycms.db.dbupdate "ey_config","setname='eycms.upload' and setkey='upfile'",array(array("setvalue",t0,50,1))
		eycms.db.dbupdate "ey_config","setname='eycms.upload' and setkey='upmaxsize'",array(array("setvalue",t1,11,1))
		eycms.db.dbupdate "ey_config","setname='eycms.upload' and setkey='uptype_pic'",array(array("setvalue",t2,255,1))
		eycms.db.dbupdate "ey_config","setname='eycms.upload' and setkey='uptype_video'",array(array("setvalue",t3,255,1))
		eycms.db.dbupdate "ey_config","setname='eycms.upload' and setkey='uptype_file'",array(array("setvalue",t4,255,1))
		eycms.delcache "eycmsdata"
		eycms.ajaxjson "保存成功",1
	end sub
	
	sub maildb()
		dim t0,t1,t2,t3,t4
		t0=eycms.enhtml(eycms.fpost("t0",0))
		t1=eycms.enhtml(eycms.fpost("t1",0))
		t2=eycms.enhtml(eycms.fpost("t2",0))
		t3=eycms.enhtml(eycms.fpost("t3",0))
		t4=eycms.enhtml(eycms.fpost("t4",0))
		if eycms.strlen(t0)>0 then
			if eycms.strlen(t1)=0 then eycms.ajaxjson "&#83;&#109;&#116;&#112;&#26381;&#21153;&#22120;&#19981;&#33021;&#20026;&#31354;":exit sub
			if eycms.strlen(t2)=0 then eycms.ajaxjson "&#37038;&#31665;&#36134;&#25143;&#19981;&#33021;&#20026;&#31354;",0:exit sub
			if eycms.strlen(t3)=0 then eycms.ajaxjson "&#37038;&#31665;&#23494;&#30721;&#19981;&#33021;&#20026;&#31354;",0:exit sub
		end if
		eycms.db.dbupdate "ey_config","setname='eycms.mail' and setkey='mailtype'",array(array("setvalue",t0,20,1))
		eycms.db.dbupdate "ey_config","setname='eycms.mail' and setkey='mailsmtp'",array(array("setvalue",t1,50,1))
		eycms.db.dbupdate "ey_config","setname='eycms.mail' and setkey='mailuser'",array(array("setvalue",t2,50,1))
		eycms.db.dbupdate "ey_config","setname='eycms.mail' and setkey='mailpass'",array(array("setvalue",t3,50,1))
		eycms.db.dbupdate "ey_config","setname='eycms.mail' and setkey='adminemail'",array(array("setvalue",t4,50,1))
		eycms.delcache "eycmsdata"
		eycms.ajaxjson "保存成功",1
	end sub
	
	sub smsdb()
		dim t0,t1,t2,t3
		t0=eycms.enhtml(eycms.fpost("t0",0))
		t1=eycms.enhtml(eycms.fpost("t1",0))
		t2=eycms.enhtml(eycms.fpost("t2",0))
		t3=eycms.enhtml(eycms.fpost("t3",0))
		if t0="true" then
			if eycms.strlen(t1)=0 then eycms.ajaxjson "&#29992;&#25143;&#21517;&#19981;&#33021;&#20026;&#31354;",0:exit sub
			if eycms.strlen(t2)=0 then eycms.ajaxjson "&#36890;&#35759;&#23494;&#38053;&#19981;&#33021;&#20026;&#31354;",0:exit sub
			if eycms.strlen(t3)=0 then eycms.ajaxjson "&#25163;&#26426;&#21495;&#30721;&#19981;&#33021;&#20026;&#31354;",0:exit sub
		end if
		eycms.db.dbupdate "ey_config","setname='eycms.sms' and setkey='smstype'",array(array("setvalue",t0,20,1))
		eycms.db.dbupdate "ey_config","setname='eycms.sms' and setkey='smsuser'",array(array("setvalue",t1,50,1))
		eycms.db.dbupdate "ey_config","setname='eycms.sms' and setkey='smskey'",array(array("setvalue",t2,50,1))
		eycms.db.dbupdate "ey_config","setname='eycms.sms' and setkey='mobile'",array(array("setvalue",t3,11,1))
		eycms.delcache "eycmsdata"
		eycms.ajaxjson "保存成功",1
	end sub
	
	sub aspjpegdb()
		dim t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13
		t0=eycms.enhtml(eycms.fpost("t0",0))
		t1=eycms.enhtml(eycms.fpost("t1",0))
		t2=eycms.enhtml(eycms.fpost("t2",0))
		t3=eycms.enhtml(eycms.fpost("t3",0))
		t4=eycms.enhtml(eycms.fpost("t4",0))
		t5=eycms.enhtml(eycms.fpost("t5",0))
		t6=eycms.enhtml(eycms.fpost("t6",0))
		t7=eycms.enhtml(eycms.fpost("t7",0))
		t8=eycms.getint(eycms.fpost("t8",0),200)
		t9=eycms.getint(eycms.fpost("t9",0),200)
		t10=eycms.enhtml(eycms.fpost("t10",0))
		t11=eycms.getint(eycms.fpost("t11",0),1)
		t12=eycms.getint(eycms.fpost("t12",0),0)
		t13=eycms.getint(eycms.fpost("t13",0),12)
		eycms.db.dbupdate "ey_config","setname='eycms.aspjpeg' and setkey='jpeg_name'",array(array("setvalue",t0,50,1))
		eycms.db.dbupdate "ey_config","setname='eycms.aspjpeg' and setkey='jpeg_type'",array(array("setvalue",t1,50,1))
		eycms.db.dbupdate "ey_config","setname='eycms.aspjpeg' and setkey='jpeg_text'",array(array("setvalue",t2,50,1))
		eycms.db.dbupdate "ey_config","setname='eycms.aspjpeg' and setkey='jpeg_textcolor'",array(array("setvalue",t3,50,1))
		eycms.db.dbupdate "ey_config","setname='eycms.aspjpeg' and setkey='jpeg_textfont'",array(array("setvalue",t4,50,1))
		eycms.db.dbupdate "ey_config","setname='eycms.aspjpeg' and setkey='jpeg_fontsize'",array(array("setvalue",t13,50,1))
		eycms.db.dbupdate "ey_config","setname='eycms.aspjpeg' and setkey='jpeg_bold'",array(array("setvalue",t5,50,1))
		eycms.db.dbupdate "ey_config","setname='eycms.aspjpeg' and setkey='jpeg_photo'",array(array("setvalue",t6,50,1))
		eycms.db.dbupdate "ey_config","setname='eycms.aspjpeg' and setkey='jpeg_bgcolor'",array(array("setvalue",t7,50,1))
		eycms.db.dbupdate "ey_config","setname='eycms.aspjpeg' and setkey='jpeg_minwidth'",array(array("setvalue",t8,50,1))
		eycms.db.dbupdate "ey_config","setname='eycms.aspjpeg' and setkey='jpeg_minheight'",array(array("setvalue",t9,50,1))
		eycms.db.dbupdate "ey_config","setname='eycms.aspjpeg' and setkey='jpeg_transparent'",array(array("setvalue",t10,50,1))
		eycms.db.dbupdate "ey_config","setname='eycms.aspjpeg' and setkey='jpeg_quality'",array(array("setvalue",t11,50,1))
		eycms.db.dbupdate "ey_config","setname='eycms.aspjpeg' and setkey='jpeg_position'",array(array("setvalue",t12,50,1))
		eycms.delcache "eycmsdata"
		delall t6,9999,0
		eycms.ajaxjson "保存成功",1
	end sub
	
	sub htmldb()
		dim t0,t1,t2,t3,t4,t5
		t0=eycms.enhtml(eycms.fpost("t0",0))
		t1=eycms.getint(eycms.fpost("t1",0),0)
		t2=eycms.getint(eycms.fpost("t2",0),0)
		t3=eycms.getint(eycms.fpost("t3",0),0)
		t4=eycms.getint(eycms.fpost("t4",0),0)
		if eycms.strlen(t0)>0 then
			if instr(t0,"//")>0 or not(eycms.checkstr(t0,"file")) or t0="/" or left(t0,1)="/" then
				eycms.ajaxjson "&#29983;&#25104;&#30446;&#24405;&#35774;&#32622;&#38169;&#35823;",0:exit sub
			end if
			if right(t0,1)<>"/" then
				t0=t0&"/"
			end if
		end if
		t1=eycms.iif(t1=0,false,true)
		t2=eycms.iif(t2=0,false,true)
		t3=eycms.iif(t3=0,false,true)
		
		eycms.db.dbupdate "ey_config","setname='eycms.html' and setkey='htmldir'",array(array("setvalue",t0,50,1))
		eycms.db.dbupdate "ey_config","setname='eycms.html' and setkey='htmlhome'",array(array("setvalue",t1,0,1))
		eycms.db.dbupdate "ey_config","setname='eycms.html' and setkey='htmlclass'",array(array("setvalue",t2,0,1))
		eycms.db.dbupdate "ey_config","setname='eycms.html' and setkey='htmlcontent'",array(array("setvalue",t3,0,1))
		eycms.db.dbupdate "ey_config","setname='eycms.html' and setkey='htmltotal'",array(array("setvalue",t4,10,1))
		eycms.delcache "eycmsdata"
		eycms.ajaxjson "保存成功",1
	end sub
	
	sub shopdb()
		dim t0,t1,t2
		t0=eycms.enhtml(eycms.fpost("t0",0))
		t1=eycms.enhtml(eycms.fpost("t1",0))
		t2=eycms.enhtml(eycms.fpost("t2",0))
		eycms.db.dbupdate "ey_config","setname='eycms.shop' and setkey='user_pay'",array(array("setvalue",t0,10,1))
		eycms.db.dbupdate "ey_config","setname='eycms.shop' and setkey='cash_pay'",array(array("setvalue",t1,10,1))
		eycms.db.dbupdate "ey_config","setname='eycms.shop' and setkey='fit_order'",array(array("setvalue",t2,10,1))
		eycms.clearcache
		eycms.ajaxjson "保存成功",1
	end sub
	
	sub sysdb()
		dim t0,t1
		t0=eycms.enhtml(eycms.fpost("t0",0))
		t1=eycms.enhtml(eycms.fpost("t1",0))
		eycms.db.dbupdate "ey_config","setname='eycms.sys' and setkey='sys_mobile'",array(array("setvalue",t0,50,1))
		eycms.db.dbupdate "ey_config","setname='eycms.sys' and setkey='sys_optional'",array(array("setvalue",t1,0,1))
		eycms.delcache "eycmsdata"
		eycms.ajaxjson "保存成功",1
	end Sub

	function get_rewritemode()
		get_rewritemode=1
		if eycms.isfile(webroot&"httpd.ini") Then get_rewritemode=1
		if eycms.isfile(webroot&".htaccess") Then get_rewritemode=2
		if eycms.isfile(webroot&"web.config") Then get_rewritemode=3
	end Function
	
	function get_sitestat(t0)
		get_sitestat=0
		if eycms.isfile(webroot&"site/config.xml") Then
			dim xml,nodelist
			set xml=server.createobject("microsoft.xmldom")
			xml.async=false
			xml.load(server.mappath(webroot&"site/config.xml"))
			set nodelist = xml.documentelement.selectnodes("site[@tag='"&t0&"']")
			If nodelist.length>0 then 
				get_sitestat=1
			End if
			set nodelist=Nothing
			set xml=nothing
		End If
	end Function

	function get_themestat(t0)
		get_themestat=0
		if eycms.isfile(webroot&"site/config.xml") Then
			dim xml,nodelist
			set xml=server.createobject("microsoft.xmldom")
			xml.async=false
			xml.load(server.mappath(webroot&"site/config.xml"))
			set nodelist = xml.documentelement.selectnodes("site[@theme='"&t0&"']")
			If nodelist.length>0 then 
				get_themestat=1
			End if
			set nodelist=Nothing
			set xml=nothing
		End If
	end Function

	function get_theme(t0,t1)
		dim fso,fsofolder,fsocount,isfirst
		set fso=createobject("scripting.filesystemobject")
		set fsofolder=fso.getfolder(server.mappath(""&webroot&"theme/"))
		for each fsocount in fsofolder.subfolders
		    if fsocount.name<>"admin" And fsocount.name<>"admin_leo" And fsocount.name<>"weixin" Then
		    	if lcase(t1)="edit" then
					If fsocount.name=t0 then
						get_theme=get_theme&"<option value='"&fsocount.name&"' selected>"&fsocount.name&"</option>"
					Else
						get_theme=get_theme&"<option value='"&fsocount.name&"'>"&fsocount.name&"</option>"
					End if
				elseif lcase(t1)="add" then
					If get_themestat(fsocount.name)=0 then
						get_theme=get_theme&"<option value='"&fsocount.name&"'>"&fsocount.name&"</option>"
					End if
				end if
		    end if
		next
		set fsofolder=nothing
	end Function

	function get_sitedisc()
		dim fso,fsofolder,fsocount,isfirst
		set fso=createobject("scripting.filesystemobject")
		set fsofolder=fso.getfolder(server.mappath(""&webroot&"site/"))
		for each fsocount in fsofolder.subfolders
			If get_sitestat(fsocount.name)=0 then
				get_sitedisc=get_sitedisc&"<option value='"&fsocount.name&"'>"&fsocount.name&"</option>"
			End if
		next
		set fsofolder=nothing
	end Function

	function get_datebasename(t0)
		dim fso,fsofolder,fsocontent,fsocount,isfirst
		set fso=createobject("scripting.filesystemobject")
		set fsofolder=fso.getfolder(server.mappath(""&webroot&"site/"&t0&"/data/"))
		set fsocontent=fsofolder.files
		for each fsocount in fsocontent
			get_datebasename=fsocount.name
		next
		set fsocontent=nothing
		set fsofolder=nothing
	end Function

	islogin
	dim act:act=lcase(eycms.fget("act",0))
	dim sitedata,ei
	dim sconfig:set sconfig=server.createobject("scripting.dictionary")
	select case act
		case "chgprefix":eycms.echo(eycms.getrnd(5))
		case "rnd":eycms.echo(eycms.getrnd(12))
		case "sitedb":sitedb
		case "site"
			checkpagelever 9
			'自定义系统设置
			dim field_data:field_data=eycms.get_model_site(0)
			dim editor_int:editor_int=""
			dim editor_get:editor_get=""
			if isarray(field_data) then
				for ei=0 to ubound(field_data,2)
					if field_data(2,ei)=6 then
						editor_int=editor_int&"UE.getEditor('"&field_data(0,ei)&"',editorOption);"
						editor_get=editor_get&"$(""#"&field_data(0,ei)&""").val(UE.getEditor('"&field_data(0,ei)&"').getContent());"
					end if
				next
			end if
			'end
			sitedata=eycms.db.dbload("","setkey,setvalue","ey_config","setname='eycms."&act&"' and left(setkey,3)<>'my_'","")
			if ubound(sitedata)>=0 then
				for ei=0 to ubound(sitedata,2)
					sconfig.add cstr(sitedata(0,ei)),sitedata(1,ei)
				next
			end if
			load eval("theme_set"&act)
		case "sitegroup"
			checkpagelever 9
			load eval("theme_set"&act)
		case "sitegroupedit","sitegroupadd","sitegroup_add","lang"
			checkpagelever 9
			dim site:site=lcase(eycms.fget("site",0))
			load eval("theme_set"&act)
		case "sitegeditdb":sitegroupeditdb
		case "siteg_adddb":sitegroup_adddb
		case "langdb":langdb
		case "sitegadddb":sitegroupadddb
		case "seo"
			checkpagelever 10
			sitedata=eycms.db.dbload("","setkey,setvalue","ey_config","setname='eycms."&act&"'","")
			if ubound(sitedata)>=0 then
				for ei=0 to ubound(sitedata,2)
					sconfig.add cstr(sitedata(0,ei)),sitedata(1,ei)
				next
			end if
			load eval("theme_set"&act)
		case "upload"
			checkpagelever 11
			sitedata=eycms.db.dbload("","setkey,setvalue","ey_config","setname='eycms."&act&"'","")
			if ubound(sitedata)>=0 then
				for ei=0 to ubound(sitedata,2)
					sconfig.add cstr(sitedata(0,ei)),sitedata(1,ei)
				next
			end if
			load eval("theme_set"&act)
		case "mail"
			checkpagelever 12
			sitedata=eycms.db.dbload("","setkey,setvalue","ey_config","setname='eycms."&act&"'","")
			if ubound(sitedata)>=0 then
				for ei=0 to ubound(sitedata,2)
					sconfig.add cstr(sitedata(0,ei)),sitedata(1,ei)
				next
			end if
			load eval("theme_set"&act)
		case "sms"
			checkpagelever 13
			sitedata=eycms.db.dbload("","setkey,setvalue","ey_config","setname='eycms."&act&"'","")
			if ubound(sitedata)>=0 then
				for ei=0 to ubound(sitedata,2)
					sconfig.add cstr(sitedata(0,ei)),sitedata(1,ei)
				next
			end if
			load eval("theme_set"&act)
		case "aspjpeg"
			checkpagelever 14
			sitedata=eycms.db.dbload("","setkey,setvalue","ey_config","setname='eycms."&act&"'","")
			if ubound(sitedata)>=0 then
				for ei=0 to ubound(sitedata,2)
					sconfig.add cstr(sitedata(0,ei)),sitedata(1,ei)
				next
			end if
			load eval("theme_set"&act)
		case "html"
			checkpagelever 15
			sitedata=eycms.db.dbload("","setkey,setvalue","ey_config","setname='eycms."&act&"'","")
			if ubound(sitedata)>=0 then
				for ei=0 to ubound(sitedata,2)
					sconfig.add cstr(sitedata(0,ei)),sitedata(1,ei)
				next
			end if
			load eval("theme_set"&act)
		case "shop"
			checkpagelever 62
			sitedata=eycms.db.dbload("","setkey,setvalue","ey_config","setname='eycms."&act&"'","")
			if ubound(sitedata)>=0 then
				for ei=0 to ubound(sitedata,2)
					sconfig.add cstr(sitedata(0,ei)),sitedata(1,ei)
				next
			end if
			load eval("theme_set"&act)
		case "sys"
			checkpagelever 64
			sitedata=eycms.db.dbload("","setkey,setvalue","ey_config","setname='eycms."&act&"'","")
			if ubound(sitedata)>=0 then
				for ei=0 to ubound(sitedata,2)
					sconfig.add cstr(sitedata(0,ei)),sitedata(1,ei)
				next
			end if
			load eval("theme_set"&act)
		case "sitedb":checkpagelever 9:sitedb
		case "prefix":checkpagelever 9:getprefix
		case "seodb":checkpagelever 10:seodb
		case "uploaddb":checkpagelever 11:uploaddb
		case "maildb":checkpagelever 12:maildb
		case "smsdb":checkpagelever 13:smsdb
		case "aspjpegdb":checkpagelever 14:aspjpegdb
		case "htmldb":checkpagelever 15:htmldb
		case "shopdb":checkpagelever 62:shopdb
		case "sysdb":checkpagelever 64:sysdb
	end select

	function get_setvalue(byval t0)
		get_setvalue=eycms.db.dbloadone("setvalue","ey_config","setkey='"&t0&"'")	
	end function
	set sconfig=nothing
	eycms.db.dbclose
%>
