<!-- #include file="../conn.asp" -->
<link rel="stylesheet" rev="stylesheet" href="../skins/teams/bbs.css" type="text/css" media="all" />
<%
Server.ScriptTimeout= 9999
MyDbPath = "../"
Select Case Request("menu")
	Case "update"
		Update()
	Case "Upskins"
		Call Upskins
	Case Else
		Call main
End Select

Sub Update()
	Dim Rs,newx,i,p
	Response.Write"<body text=""#000000"" leftmargin=""10"" topmargin=""10""><Br><BR><div class=a3 style=""padding: 15px;width:600""><div class=a4>"
	If Not IsObject(Conn) Then ConnectionDatabase
	Set rs = conn.execute("select Allclass from Clubconfig")
	newx = Split(RS(0),"$$$")
	For i = 0 To UBound(newx)
		If p ="" then
			p = newx(0)
		ElseIf i = 8 Then
			p = P & "$$$TEAM 2.0.4 Release"
		Else
			p =  P & "$$$" & newx(i)
		End if
	Next
	rs.close
	Conn.execute("update [Clubconfig] set Allclass='"& p &"',agreement='[b]欢迎您加入【{$clubname} － TEAM论坛】参加交流和讨论，【{$clubname} － TEAM论坛】为公共论坛，为维护网上公共秩序和社会稳定，请您自觉遵守以下条款： [/b]"& vbcrlf&""& vbcrlf&" 不得利用本站危害国家安全、泄露国家秘密，不得侵犯国家社会集体的和公民的合法权益，不得利用本站制作、复制和传播下列信息"& vbcrlf&""& vbcrlf&"（一）煽动抗拒、破坏宪法和法律、行政法规实施的；"& vbcrlf&"（二）煽动颠覆国家政权，推翻社会主义制度的；"& vbcrlf&"（三）煽动分裂国家、破坏国家统一的；"& vbcrlf&"（四）煽动民族仇恨、民族歧视，破坏民族团结的；"& vbcrlf&"（五）捏造或者歪曲事实，散布谣言，扰乱社会秩序的；"& vbcrlf&"（六）宣扬封建迷信、淫秽、色情、赌博、暴力、凶杀、恐怖、教唆犯罪的；"& vbcrlf&"（七）公然侮辱他人或者捏造事实诽谤他人的，或者进行其他恶意攻击的；"& vbcrlf&"（八）损害国家机关信誉的；"& vbcrlf&"（九）其他违反宪法和法律行政法规的；"& vbcrlf&" "& vbcrlf&"'")
	Application.Contents.RemoveAll() 
	Response.Write " 更新OK，现在将转入论坛首页。请稍后。。。。<meta http-equiv=refresh content=0;url=../></div></body>"
End Sub



Dim mconn
Sub myConnectionDatabase
	Dim ConnStr
	ConnStr = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = " & Server.MapPath(MyDbPath & "skins/TM_Style.mdb")
	On Error Resume Next
	Set mconn = Server.CreateObject("ADODB.Connection")
	mconn.open ConnStr
	If Err Then
		err.Clear
		Set mconn = Nothing
		Response.Write "数据库连接出错，请检查连接字串。"
		Response.End
	End If
End Sub

Sub Upskins
	Dim tRs
	On Error Resume Next
	If Not IsObject(Conn) Then ConnectionDatabase
	conn.execute("delete from [style]")
	If Not IsObject(mConn) Then myConnectionDatabase
	Dim i
	Dim InsertName,InsertValue
	Set TRs= mconn.Execute("select * from [Style] where id = 1 ")
	Do while not TRs.eof
	InsertName=""
	InsertValue=""
		For i = 1 to TRs.Fields.Count-1
			InsertName=InsertName & TRs(i).Name
			InsertValue=InsertValue & "'" &checkStr(TRs(i)) & "'"
			If i<> TRs.Fields.Count-1 Then 
				InsertName	= InsertName & ","
				InsertValue	= InsertValue & ","
			End If
		Next
	conn.Execute("insert into [Style] ("&InsertName&") values ("&InsertValue&") ")
	TRs.movenext
	loop
	TRs.close
	set TRs=Nothing
	Application.Contents.RemoveAll()
	Response.Write"<body text=""#000000"" leftmargin=""10"" topmargin=""10""><Br><BR><div class=a3 style=""padding: 15px;width:600""><div class=a4><li>模版导入成功，现在将转入论坛首页<BR><meta http-equiv=refresh content=3;url=../></div></body>" 

End Sub

Function Checkstr(Str)
		If Isnull(Str) Then
			CheckStr = ""
			Exit Function 
		End If
		Str = Replace(Str,Chr(0),"")
		CheckStr = Replace(Str,"'","''")
End Function

Sub main

	%>
	<BR/><BR/>
	<body Style="background-color:#9EB6D8" text="#000000" leftmargin="10" topmargin="10">
	<div style="width:600px;background-color:#fff;padding:10px;text-align :left;">
	Team Board 升级程序

	<li> 升级到TEAM 2.0.4 此版本修正了验证码的显示机制，解决以前出现的验证错误。 
	</div><BR>
	<div style="width:600px;background-color:#fff;padding:10px;text-align :left;">
	<ul>
		点击下面的链接，可以将您的team 2.0.3版本升级到2.0.4版本 </li>
	</ul>
	<ul>
		<li> <a href="?menu=update" Style='cursor:hand;color:red;'> TEAM 论坛升级文件2.0.4升级-->> </a></li>
	</ul>
	<hr style="width:550px;text-align :center;">
	<ul>
		点击下面的链接，可以将您老的模版内容全部删除，并导入新的模版文件. </li>
	</ul>
	<ul>
		<li> <a href="?menu=Upskins" Style='cursor:hand;color:red;'> 官方模版升级 -->> </a></li>
	</ul>
	</div>
<%
End Sub
%>
