<!--#include file="base.asp"-->
<%
''' EYCMS 插件管理
''' ==================================================================

	sub installdb()
		dim config:config=eycms.enhtml(eycms.fget("config",0))
		dim root:root=eycms.enhtml(eycms.fget("root",0))
		if eycms.strlen(config)<=0 then
			eycms.echo "0参数错误"
			exit sub
		end if
		dim data:data=array(array("setname","eycms.plug",0),array("setkey",""&config&"",0),array("setvalue","true",0))
		if eycms.db.dbnew("ey_config",data,"setname='eycms.plug' and setkey='"&config&"'")=0 then
			eycms.echo "0插件已存在，请勿重复安装"
			exit sub
		else
			get_sql root,5
			eycms.echo "1插件安装成功！"
			eycms.delcache "eycmsdata"
		end if
	end sub
	
	sub uninstalldb()
		dim config:config=eycms.enhtml(eycms.fget("config",0))
		dim root:root=eycms.enhtml(eycms.fget("root",0))
		if eycms.strlen(config)<=0 then
			eycms.echo "0参数错误"
			exit sub
		end if
		eycms.db.dbdel "ey_config","setname='eycms.plug' and setkey='"&config&"'"
		get_sql root,6
		eycms.echo "1插件卸载成功"
		eycms.delcache "eycmsdata"
	end sub
	
	sub get_sql(byval t0,byval t1)
		dim xml,t2
		set xml=server.createobject("microsoft.xmldom")
			xml.async=false
			xml.load(server.mappath("../plug/"&t0&"/config.xml"))
			t2=xml.documentelement.childnodes(t1).text
		set xml=nothing
		if eycms.strlen(t2)<=0 then
			exit sub
		end if
		dim i,arr
		arr=split(t2,"@@")
		for i=0 to ubound(arr)
			eycms.db.exedb arr(i)
		next
	end sub
	
	islogin
	checkpagelever 29
	dim act:act=lcase(eycms.fget("act",0))
	select case act
		case "install":installdb
		case "uninstall":uninstalldb
		case else:load theme_plug
	end select
	eycms.db.dbclose
%>
