<!--#include file="site.asp"-->
<%
''' EYCMS 系统配置
''' ==================================================================

'以下配置请勿随便更改

dim weburl
    weburl = "http://"&request.servervariables("http_host")

dim preurl
	preurl = request.servervariables("http_referer")

'伪静态模式下的规则类型，可选参数：httpd.ini和.htaccess
dim rulemode
	rulemode = "httpd.ini"
dim site_default
	site_default = application("site_default")
dim http_host
	http_host = lcase(request.servervariables("http_host"))

dim webismobi:webismobi=false
if instr(http_host,"mobi.") Then 
	webismobi=true
	weburl=Replace(weburl,"mobi.","")
	http_host=Replace(http_host,"mobi.","www.")
end If
dim webispc:webispc=false
if instr(http_host,"pc.") Then 
	webispc=True
	weburl=Replace(weburl,"pc.","")
	http_host=Replace(http_host,"pc.","")
End If

dim site_count, site_name, site_root, site_group, theme_root, prefix
dim datatype, datapath, datadbname
dim datahost, datauser, datapass, datasqlname

dim xml_site, site_tag
set xml_site = server.createobject("microsoft.xmldom")
xml_site.async = false
xml_site.load(server.mappath(webroot & "site/config.xml"))
site_count = xml_site.documentelement.selectnodes("site").length
if session("currentsite")="" then
	if instr(http_host,"localhost")>0 or instr(http_host,"127.0.0.1")>0 Then
		set site_tag = xml_site.documentelement.selectnodes("site[@def=1]")
	else
		set site_tag = xml_site.documentelement.selectnodes("site[@url='"&http_host&"']")
		If site_tag.length=0 then set site_tag = xml_site.documentelement.selectnodes("site[@def=1]")
	end If
else
	set site_tag = xml_site.documentelement.selectnodes("site[@tag='"&session("currentsite")&"']")
end If

'站点标签
site_root=site_tag.item(0).getAttribute("tag")
site_name=site_tag.item(0).getAttribute("sname")
site_group=site_tag.item(0).getAttribute("group")
theme_root=site_tag.item(0).getAttribute("theme")

'变量前缀，如一个空间下多次使用本程序的话，请每个程序配置不同的值
prefix=site_tag.item(0).getAttribute("prefix")

dim site_data
site_data=split(sdt.item(site_root),"{eycms}")
'数据库类型，true:Access，false:Mssql(即sql server)
if site_data(0)="true" then
	datatype=true
else
	datatype=false
end if

if datatype=True then
	'以下为Access配置，依次是：数据库目录，数据库名
	datapath=site_data(1)
	datadbname=site_data(2)
else
	If ubound(site_data)>=4 Then
		'以下为Mssql配置，依次是：主机IP,用户名，密码，数据库名
		datahost=site_data(1)
		datauser=site_data(2)
		datapass=site_data(3)
		datasqlname=site_data(4)
	else
		response.write "抱歉！您的站点配置信息错误！1"
		response.end()
	end if
end If
%>
