<!--#include file="conn.asp"-->
<!--#include file="inc/const.asp"-->
<!--#include file="inc/dv_clsother.asp"-->
<%
If Cint(Dvbbs.Board_Data(6,0)) > 0 Then
	Dvbbs.LoadTemplates("index")
Else
	Dvbbs.LoadTemplates("list")
End If
If Cint(Dvbbs.Board_Setting(43))=0 Then
	Dvbbs.Stats=Dvbbs.LanStr(7)
Else
	Dvbbs.Stats=Dvbbs.LanStr(8)
End If
Dvbbs.Nav()
GetBoardPermission
Dvbbs.Head_var 1,Dvbbs.Board_Data(4,0),"",""
Dvbbs.Showerr()
Dim Page
Dim action
Dim TopicNum,n,SplitPageNum
Dim Forum_AllTopNum
Forum_AllTopNum = 0
action=Request("action")
If Not(Dvbbs.boardmaster or Dvbbs.master or Dvbbs.superboardmaster) Then action=""
Page=Request("Page")
If isNumeric(Page) = 0 or Page="" Then Page=1
Page=Clng(Page)

'如果有下属版面，则显示
If Cint(Dvbbs.Board_Data(6,0)) > 0 Then
	GetChildBoardList
	Dvbbs.LoadTemplates("list")
End If

Dim BoardTopic,BoardTopicImg,BoardTopicMode,BoardTopicMode_a,iii,TopicMode,SelectBoardTopic
TopicMode=0
BoardTopic=Split(Dvbbs.Board_Setting(48),"$$")
BoardTopicImg=Split(Dvbbs.Board_Setting(49),"$$")

If Ubound(BoardTopic)>0 Then
	If Request("topicmode")<>"" and IsNumeric(Request("topicmode")) Then TopicMode=Cint(Request("topicmode"))
	For iii=0 to Ubound(BoardTopic)-1
		If BoardTopicImg(iii)<>"" and Instr(BoardTopicImg(iii),".gif") Then BoardTopicMode=BoardTopicMode+"<img src="&BoardTopicImg(iii)&" border=0  align=absmiddle>"
		BoardTopicMode=BoardTopicMode+"<a href=list.asp?boardid="&Dvbbs.boardid&"&topicmode="&iii+1&">["
		BoardTopicMode_a=BoardTopicMode_a+"<a href=list.asp?boardid="&Dvbbs.boardid&"&topicmode="&iii+1&">["
		If TopicMode=iii+1 Then
			BoardTopicMode=BoardTopicMode+"<font color="&Dvbbs.mainsetting(1)&">"&BoardTopic(iii)&"</font>"
			BoardTopicMode_a=BoardTopicMode_a+"<font color="&Dvbbs.mainsetting(1)&">"&BoardTopic(iii)&"</font>"
		Else 
			BoardTopicMode=BoardTopicMode+BoardTopic(iii)
			BoardTopicMode_a=BoardTopicMode_a+BoardTopic(iii)
		End If
		BoardTopicMode=BoardTopicMode+"]</a>"
		BoardTopicMode_a=BoardTopicMode_a+"]</a>"
		SelectBoardTopic=SelectBoardTopic+"<option value="&(iii+1)
		SelectBoardTopic=SelectBoardTopic+" >"&BoardTopic(iii)&"</option>"
		If iii<>(Ubound(BoardTopic)-1) Then
			BoardTopicMode=BoardTopicMode+ " | "
			BoardTopicMode_a=BoardTopicMode_a+ " | "
		End If
	Next
End If

If Cint(Dvbbs.Board_Setting(43))=0 Then
	News
	Board_Online
	Show_List_Top
	Show_List_TopTopic
	Show_List_Topic
	Show_List_Footer
Else
	Response.Write "<iframe width=""0"" height=""0"" src="""" name=""hiddenframe""></iframe>"
End If
Dvbbs.ActiveOnline()
Dvbbs.Footer()
Function news()
	Dim TempStr,SQL
	TempStr=Dvbbs.Board_Data(23,0)
	SQL=Split(TempStr,"|||")
	If UBound(SQL)< 2 Then
		Dvbbs.Name = "BoardInfo_" & Dvbbs.BoardID
		Dvbbs.LoadBoardNews_Paper Dvbbs.BoardID
		Dvbbs.Board_Data=Dvbbs.Value
		TempStr=Dvbbs.Board_Data(23,0)
		SQL=Split(TempStr,"|||")
	End If
	TempStr=template.html(0)
	TempStr=Replace(TempStr,"{$width}",Dvbbs.mainsetting(0))
	TempStr=Replace(TempStr,"{$boardid}",Dvbbs.BoardID)
	TempStr=Replace(TempStr,"{$news}",SQL(0))
	TempStr=Replace(TempStr,"{$newstime}",SQL(1))
	Response.Write TempStr
	TempStr="":SQL=Null
End Function
Function Board_online()
	Dim TempStr
	TempStr=template.html(1)
	TempStr=Replace(TempStr,"{$boardid}",Dvbbs.BoardID)
	TempStr=Replace(TempStr,"{$allonline}",MyBoardOnline.Forum_Online)
	TempStr=Replace(TempStr,"{$boardtype}",Dvbbs.Boardtype)
	TempStr=Replace(TempStr,"{$boardonline}",MyBoardOnline.Board_UserOnline)
	TempStr=Replace(TempStr,"{$boardguest}",MyBoardOnline.Board_GuestOnline)
	TempStr=Replace(TempStr,"{$todaynum}",Dvbbs.Board_Data(12,0))
	TempStr=Replace(TempStr,"{$alertcolor}",Dvbbs.mainsetting(1))
	Response.Write TempStr
	TempStr=""
	If Dvbbs.forum_setting(14)="1" Or Dvbbs.forum_setting(15)="1" Then 
		Response.Write "<iframe width=""0"" height=""0"" src=""Online.asp?action=1&Boardid="&Dvbbs.Boardid&""" name=""hiddenframe""></iframe>"
	Else
		Response.Write "<iframe width=""0"" height=""0"" src="""" name=""hiddenframe""></iframe>"
	End If
End Function

Function Show_List_Top()
	Dim TempStr,TempBoardMaster,BoardMaster,i
	If Dvbbs.BoardMaster="" Then
		BoardMaster=template.Strings(4)
	Else
		TempBoardMaster=Split(Dvbbs.BoardMasterList & "","|")
		For i=0 To Ubound(TempBoardMaster)
			BoardMaster = BoardMaster & "<a href=dispuser.asp?name="&TempBoardMaster(i)&">"&TempBoardMaster(i)&"</a>&nbsp;"
		Next
	End If
	If (Dvbbs.Board_Setting(43)="0" And Dvbbs.Board_Setting(0)="0") Or (Dvbbs.Board_Setting(43)="0" And Dvbbs.Board_Setting(0)="1" And (Dvbbs.Master Or Dvbbs.SuperBoardMaster Or Dvbbs.BoardMaster)) Then
		TempStr=template.html(3)
		TempStr=Replace(TempStr,"{$pic_postnew}",Dvbbs.mainpic(7))
		TempStr=Replace(TempStr,"{$pic_postvote}",Dvbbs.mainpic(8))
		TempStr=Replace(TempStr,"{$pic_postxzb}",Dvbbs.mainpic(9))
	Else
		If Dvbbs.Board_Setting(0)="1" Then TempStr=template.Strings(1)
	End If
	TempStr=Replace(template.html(2),"{$showpostinfo}",TempStr)
	TempStr=Replace(TempStr,"{$boardid}",Dvbbs.BoardID)
	TempStr=Replace(TempStr,"{$page}",page)
	TempStr=Replace(TempStr,"{$width}",Dvbbs.mainsetting(0))
	TempStr=Replace(TempStr,"{$alertcolor}",Dvbbs.mainsetting(1))
	TempStr=Replace(TempStr,"{$boardmasterlist}",BoardMaster)
	TempStr=Replace(TempStr,"{$smallpaper}",Split(Dvbbs.Board_Data(23,0),"|||")(2))
	If Cint(Dvbbs.Board_Setting(3))=1 Then
		Dim allaudit,rs
		Set rs=dvbbs.execute("select count(*) from "&Dvbbs.Nowusebbs&" where boardid=777 and locktopic="&Dvbbs.BoardID)
		allaudit=rs(0)
		If IsNull(allaudit) Then allaudit=0
		Set Rs=Nothing
		TempStr=Replace(TempStr,"{$isaudit}","| <a href=AccessTopic.asp?boardid="&Dvbbs.BoardID&" title="&Replace(template.Strings(3),"{$auditnum}",allaudit)&">"&template.Strings(2)&"</a>(<font color="&Dvbbs.mainsetting(1)&">"&allaudit&"</font>)")
	Else
		TempStr=Replace(TempStr,"{$isaudit}","")
	End If
	If BoardTopicMode="" Then
		TempStr=Replace(TempStr,"{$topictype}","")
	Else
		TempStr=Replace(TempStr,"{$topictype}",template.html(14))
		TempStr=Replace(TempStr,"{$TopicMode}",BoardTopicMode)
	End If
	Response.Write TempStr
	TempStr=""
End Function

Function Show_List_Footer()
	Dim TempStr
	TempStr=template.html(5)
	TempStr=Replace(TempStr,"{$boardid}",Dvbbs.BoardID)
	TempStr=Replace(TempStr,"{$width}",Dvbbs.mainsetting(0))
	TempStr=Replace(TempStr,"{$boardjump}",Dvbbs.BoardJumpList)
	TempStr=Replace(TempStr,"{$forumname}",Dvbbs.Forum_Info(0))
	TempStr=Replace(TempStr,"{$timestr}",Dvbbs.Forum_Info(9))
	TempStr=Replace(TempStr,"{$pic_toptopic}",Dvbbs.mainpic(1))
	TempStr=Replace(TempStr,"{$pic_atoptopic}",Dvbbs.mainpic(0))
	TempStr=Replace(TempStr,"{$pic_opentopic}",Dvbbs.mainpic(2))
	TempStr=Replace(TempStr,"{$pic_hottopic}",Dvbbs.mainpic(3))
	TempStr=Replace(TempStr,"{$pic_locktopic}",Dvbbs.mainpic(4))
	TempStr=Replace(TempStr,"{$pic_besttopic}",Dvbbs.mainpic(5))
	TempStr=Replace(TempStr,"{$pic_votetopic}",Dvbbs.mainpic(6))
	TempStr=Replace(TempStr,"{$pic_toptopic1}",Dvbbs.mainpic(19))
	Response.Write TempStr
	TempStr=""
End Function

Function Show_List_TopTopic()
	Response.Write "<Script Language=JavaScript>"
	Dim Chachedata
	Dvbbs.name="Page_List_Template"&Dvbbs.skinid'长时间的缓存数据
	If Dvbbs.ObjIsEmpty() Then
		Chachedata = Chachedata & template.html(11)
		Chachedata = Chachedata & "var TempStr='"&Replace(Replace(Replace(Replace(template.html(6),"\","\\"),"'","\'"),VbCrLf,"\n"),chr(13),"")&"';"
		Chachedata = Chachedata & "var TempStr_Page='"&Replace(Replace(Replace(Replace(template.html(7),"\","\\"),"'","\'"),VbCrLf,"\n"),chr(13),"")&"';"
		Chachedata = Chachedata & chr(10)
		Chachedata = Chachedata & "var TempStr_topicinfo='"&Replace(Replace(Replace(Replace(template.html(8),"\","\\"),"'","\'"),VbCrLf,"\n"),chr(13),"")&"';"
		Chachedata = Chachedata & chr(10)
		Chachedata = Chachedata & "var TempStr_load='"&Replace(Replace(Replace(Replace(template.html(9),"\","\\"),"'","\'"),VbCrLf,"\n"),chr(13),"")&"';"
		Chachedata = Chachedata & chr(10)
		Chachedata = Chachedata & "var topicpage='"&Dvbbs.Forum_Setting(44)&"';"
		Chachedata = Chachedata & "var alertcolor='"&Dvbbs.mainsetting(1)&"';"
		Chachedata = Chachedata & "var ztopic='"&Dvbbs.mainpic(0)&"';"
		Chachedata = Chachedata & "var istopic='"&Dvbbs.mainpic(1)&"';"
		Chachedata = Chachedata & "var opentopic='"&Dvbbs.mainpic(2)&"';"
		Chachedata = Chachedata & "var hottopic='"&Dvbbs.mainpic(3)&"';"
		Chachedata = Chachedata & "var ilocktopic='"&Dvbbs.mainpic(4)&"';"
		Chachedata = Chachedata & "var besttopic='"&Dvbbs.mainpic(5)&"';"
		Chachedata = Chachedata & "var votetopic='"&Dvbbs.mainpic(6)&"';"
		Chachedata = Chachedata & "var picnofollow='"&Dvbbs.mainpic(10)&"';"
		Chachedata = Chachedata & "var picfollow='"&Dvbbs.mainpic(11)&"';"
		Dvbbs.value = Chachedata
	End If
	Response.Write Dvbbs.value
	If TopicMode>0 Then
		Set Rs=Dvbbs.Execute("Select count(Topicid) From Dv_topic Where Boardid="&Dvbbs.Boardid&" and mode="&TopicMode)
		TopicNum=Rs(0)
		Rs.close:Set Rs=Nothing
	Else
		TopicNum=Dvbbs.Board_Data(10,0)
	End If
	SplitPageNum=Dvbbs.Board_Setting(26)
	Response.Write "var TopicNum='"&TopicNum&"';"
	Response.Write "var page='"&page&"';"
	Response.Write "var Board_Setting26='"&SplitPageNum&"';"
	Response.Write "var Board_Setting27='"&Dvbbs.Board_Setting(27)&"';"
	Response.Write "var BoardTopicMode='"&BoardTopicMode_a&"';"
	Response.Write "var TopicLimByte='"&Dvbbs.Board_Setting(25)&"';"
	Response.Write "var MyAction='"&action&"';"
	Response.Write "var GroupSetting45='"&Dvbbs.GroupSetting(45)&"';"
	Response.Write "var ListTopicMode='"&TopicMode&"';"
	Response.Write "var TrueBoardID="&Dvbbs.BoardID&";"
	If TopicMode>0 Then Response.Write "var BoardTopicMode='';"
	Forum_AllTopNum=Dvbbs.CacheData(28,0)
	If Trim(Dvbbs.Board_Data(20,0))<>"" Then
		If Trim(Forum_AllTopNum)<>"" Then
			Forum_AllTopNum = Forum_AllTopNum & "," & Dvbbs.Board_Data(20,0)
		Else
			Forum_AllTopNum = Dvbbs.Board_Data(20,0)
		End If
	End If
	If Trim(Forum_AllTopNum)<>"" And Page=1 Then
		Dim Rs,SQL,i,TopicTempStr
		Set Rs=Dvbbs.Execute("Select TopicID,boardid,title,postusername,postuserid,dateandtime,child,hits,votetotal,lastpost,lastposttime,istop,isvote,isbest,locktopic,Expression,TopicMode,Mode from dv_topic Where TopicID in ("&Forum_AllTopNum&") Order By istop desc, Lastposttime Desc")
		If Rs.Eof And Rs.Bof Then
		Forum_AllTopNum = 0
		Else
		SQL=Rs.GetRows(-1)
		Forum_AllTopNum = 0
		For i=0 To Ubound(SQL,2)
			'TopicTempStr = ",'"&Replace(SQL(2,i),"'","")&"','"&Replace(SQL(3,i),"'","")&"','"&Replace(SQL(9,i),"'","")&"','"&Replace(SQL(15,i),"'","")&"',"
			TopicTempStr = ",'"&Replace(Replace(SQL(2,i),"\","\\"),"'","\'")&"','"&Replace(Replace(SQL(3,i),"\","\\"),"'","\'")&"','"&Replace(Replace(SQL(9,i)&"","\","\\"),"'","\'")&"','"& SQL(15,i) &"',"
			TopicTempStr = Replace(Replace(Replace(Dvbbs.ChkBadWords(TopicTempStr),VbCrLf,"\n"),chr(13),""),chr(10),"")
			If SQL(16,i)=1 Then 
				TopicTempStr = Replace(TopicTempStr,"<!--","&lt;!--")
				If InStr(TopicTempStr,"script") >0 Or InStr(TopicTempStr,"&#")>0 Then TopicTempStr=Server.htmlencode(TopicTempStr)
			Else
				TopicTempStr=Server.htmlencode(TopicTempStr)
			End If
			Response.Write "document.write (dvbbs_topic_list(TempStr,'"
			Response.Write SQL(0,i)
			Response.Write "','"
			Response.Write SQL(1,i)
			Response.Write "' "
			Response.Write TopicTempStr
			Response.Write " '"
			Response.Write SQL(4,i)
			Response.Write "','"
			Response.Write SQL(5,i)
			Response.Write "','"
			Response.Write SQL(6,i)
			Response.Write "','"
			Response.Write SQL(7,i)
			Response.Write "','"
			Response.Write SQL(8,i)
			Response.Write "','"
			Response.Write SQL(10,i)
			Response.Write "','"
			Response.Write SQL(11,i)
			Response.Write "','"
			Response.Write SQL(12,i)
			Response.Write "','"
			Response.Write SQL(13,i)
			Response.Write "','"
			Response.Write SQL(14,i)
			Response.Write "','"
			Response.Write SQL(16,i)
			Response.Write "','"
			Response.Write SQL(17,i)
			Response.Write "'));"
			Response.Write chr(10)
			Response.Write "hiddentr('follow"
			Response.Write SQL(0,i)
			Response.Write "');"
			Response.Write chr(10)
			Forum_AllTopNum = Forum_AllTopNum + 1
		Next
		SQL=Null
		End If
		Rs.Close
		Set Rs=Nothing
	Else
		Forum_AllTopNum = 0
	End If
	Response.Write "</Script>"
End Function

Function Show_List_Topic()
	Dim Cmd,limitime,SQL,Rs,i,TempStr,ti,TopicTempStr
	If IsSqlDataBase=1 And IsBuss=1 Then
		Set Cmd = Server.CreateObject("ADODB.Command")
		Set Cmd.ActiveConnection=conn
		Cmd.CommandText="dv_list"
		Cmd.CommandType=4
		Cmd.Parameters.Append cmd.CreateParameter("@boardid",3)
		Cmd.Parameters.Append cmd.CreateParameter("@pagenow",3)
		Cmd.Parameters.Append cmd.CreateParameter("@pagesize",3)
		Cmd.Parameters.Append cmd.CreateParameter("@tl",3)
		Cmd.Parameters.Append cmd.CreateParameter("@topicmode",3)
		Cmd.Parameters.Append cmd.CreateParameter("@totalrec",3,2)
		Cmd("@boardid")=Dvbbs.BoardID
		Cmd("@pagenow")=page
		Cmd("@pagesize")=Cint(Dvbbs.Board_Setting(26))
		Cmd("@topicmode")=TopicMode
		If limitime="" Then
			Cmd("@tl")=0
		Else
			Cmd("@tl")=limitime
		End If
		set Rs=Cmd.Execute
	Else
		Set Rs = server.CreateObject ("adodb.recordset")
		If Cint(TopicMode)=0 Then
		Sql="Select TopicID,boardid,title,postusername,postuserid,dateandtime,child,hits,votetotal,lastpost,lastposttime,istop,isvote,isbest,locktopic,Expression,TopicMode,Mode From Dv_Topic Where BoardID="&Dvbbs.BoardID&" And IsTop=0 Order By LastPostTime Desc"
		Else
		Sql="Select TopicID,boardid,title,postusername,postuserid,dateandtime,child,hits,votetotal,lastpost,lastposttime,istop,isvote,isbest,locktopic,Expression,TopicMode,Mode From Dv_Topic Where BoardID="&Dvbbs.BoardID&" And IsTop=0 And Mode="&TopicMode&" Order By LastPostTime Desc"
		End If
		Rs.Open Sql,Conn,1,1
	End If
	Dvbbs.SqlQueryNum = Dvbbs.SqlQueryNum + 1
	If Not (Rs.Eof And Rs.Bof) Then
		If IsSqlDatabase = 1 And IsBuss=1 Then
			SQL=Rs.GetRows(-1)
		Else
			If TopicNum Mod Cint(Dvbbs.Board_Setting(27))=0 Then
				n = TopicNum \ Cint(Dvbbs.Board_Setting(27))
			Else
	     		n = TopicNum \ Cint(Dvbbs.Board_Setting(27))+1
  			End If
			Rs.MoveFirst
			If page > n Then page = n
			If page < 1 Then page = 1
			If page >1 Then 				
				Rs.Move (page-1) * Clng(Dvbbs.Board_Setting(26))
			End if
			If Rs.Eof Then Exit Function
			SQL=Rs.GetRows(Dvbbs.Board_Setting(26))
		End If
		'TopicID,boardid,title,postusername,postuserid,dateandtime,child,hits,votetotal,lastpost,lastposttime,istop,isvote,isbest,locktopic,Expression,TopicMode,Mode

		Response.Write "<Script Language=JavaScript>"
		For ti=0 To Ubound(SQL,2)
			TopicTempStr = ",'"&Replace(Replace(SQL(2,ti),"\","\\"),"'","\'")&"','"&Replace(Replace(SQL(3,ti),"\","\\"),"'","\'")&"','"&Replace(Replace(SQL(9,ti)&"","\","\\"),"'","\'")&"','"& SQL(15,ti) &"',"
			TopicTempStr = Replace(Replace(Replace(Dvbbs.ChkBadWords(TopicTempStr),VbCrLf,"\n"),chr(13),""),chr(10),"")
			If SQL(16,ti)=1 Then 
				TopicTempStr = Replace(TopicTempStr,"<!--","&lt;!--")
				If InStr(TopicTempStr,"script") >0 Or InStr(TopicTempStr,"&#")>0 Then TopicTempStr=Server.htmlencode(TopicTempStr)
			Else
				TopicTempStr=Server.htmlencode(TopicTempStr)
			End If
			Response.Write Chr(10)				
			Response.Write "document.write (dvbbs_topic_list(TempStr,'"
			Response.Write SQL(0,ti)
			Response.Write "','"
			Response.Write SQL(1,ti)
			Response.Write "' "
			Response.Write TopicTempStr
			Response.Write " '"
			Response.Write SQL(4,ti)
			Response.Write "','"
			Response.Write SQL(5,ti)
			Response.Write "','"
			Response.Write SQL(6,ti)
			Response.Write "','"
			Response.Write SQL(7,ti)
			Response.Write "','"
			Response.Write SQL(8,ti)
			Response.Write "','"
			Response.Write SQL(10,ti)
			Response.Write "','"
			Response.Write SQL(11,ti)
			Response.Write "','"
			Response.Write SQL(12,ti)
			Response.Write "','"
			Response.Write SQL(13,ti)
			Response.Write "','"
			Response.Write SQL(14,ti)
			Response.Write "','"
			Response.Write SQL(16,ti)
			Response.Write "','"
			Response.Write SQL(17,ti)
			Response.Write "'));"
			Response.Write chr(10)
			Response.Write "hiddentr('follow"
			Response.Write SQL(0,ti)
			Response.Write "');"
			Response.Write chr(10)
		Next
		SplitPageNum=Ubound(SQL,2)+1
		SQL=Null
		
		If TopicNum Mod Cint(SplitPageNum)=0 Then
			n = TopicNum \ Cint(SplitPageNum)
		Else
	     	n = TopicNum \ Cint(SplitPageNum)+1
  		End If
		Response.Write "</Script>"
		If action="batch" And Dvbbs.GroupSetting(45)=1 Then
			Dim Forum_Boards,Board_Datas,BoardJumpList,ii,Depth
			Forum_Boards=Split(Dvbbs.CacheData(27,0),",")
			For i=0 To Ubound(Forum_Boards)
				Dvbbs.Name="BoardInfo_" & Forum_Boards(i)
  				If Dvbbs.ObjIsEmpty() Then Dvbbs.ReloadBoardInfo(Forum_Boards(i))
				Board_Datas=Dvbbs.Value
				BoardJumpList = BoardJumpList & "<option value="""&Forum_Boards(i)&""" "
				BoardJumpList = BoardJumpList & ">"
				Depth=Board_Datas(4,0)
				Select Case Depth
				Case 0
					BoardJumpList = BoardJumpList & "╋"
				Case 1
					BoardJumpList = BoardJumpList & "&nbsp;&nbsp;├"
				End Select
				If Depth>1 Then
					For ii=2 To Depth
						BoardJumpList = BoardJumpList & "&nbsp;&nbsp;│"
					Next
					BoardJumpList = BoardJumpList & "&nbsp;&nbsp;├"
				End If
				BoardJumpList = BoardJumpList & Board_Datas(1,0)&"</option>"
			Next
			Board_Datas=Null
			Forum_Boards=Null
			TempStr=template.html(12)
			TempStr=Replace(TempStr,"{$boardjump}",BoardJumpList)
			TempStr=Replace(TempStr,"{$boardid}",Dvbbs.BoardID)
			TempStr=Replace(TempStr,"{$TopicMode}",SelectBoardTopic)
			Response.Write TempStr
		End If
		Response.Write "<Script Language=JavaScript>"
		TempStr=template.html(10)
		TempStr=Replace(TempStr,"{$nowpage}",page)
		TempStr=Replace(TempStr,"{$allpage}",n)
		TempStr=Replace(TempStr,"{$pagetopicnum}",SplitPageNum + Forum_AllTopNum)
		TempStr=Replace(TempStr,"{$topicnum}",TopicNum)
		TempStr=Replace(TempStr,"{$boardid}",Dvbbs.BoardID)
		TempStr=Replace(TempStr,"{$myaction}",action)
		TempStr=Replace(TempStr,"{$width}",Dvbbs.mainsetting(0))
		Response.Write TempStr
		Response.Write "</Script>"
	End If
	If Forum_AllTopNum = 0 And ti = 0 Then Response.Write template.html(4)
	SQL=Null
	Rs.Close
	Set Rs=Nothing
	Set Cmd=Nothing
End Function

Function Chk_List_Err
	If Dvbbs.BoardID=0 Then
		Dvbbs.AddErrCode(29)
		Exit Function
	End If
	If Cint(Dvbbs.Board_Setting(2))=1 Then
		If Dvbbs.UserID=0 Then
			Dvbbs.AddErrCode(24)
		Else
			If Dvbbs.Board_Setting(46)>0 And Chkboardlogin(Dvbbs.Boardid,dvbbs.Membername)=False Then Response.Redirect "pay_boardlimited.asp?boardid=" & Dvbbs.BoardID
			If Chkboardlogin(Dvbbs.Boardid,dvbbs.Membername)=False Then Dvbbs.AddErrCode(25)
		End If
	End If
	If Cint(Dvbbs.Board_Setting(1))=1 and Cint(Dvbbs.GroupSetting(37))=0 Then Dvbbs.AddErrCode(26)
	
	If Cint(Dvbbs.GroupSetting(0))=0  Then Dvbbs.AddErrCode(27)
	
	If action="batch" Then
		If CInt(Dvbbs.GroupSetting(45))<>1 Then Dvbbs.AddErrCode(28)
	End If
End Function

Sub GetChildBoardList()
	Dim TempListArray,havenew,loadboard,Board_Datas
	TempListArray = Split(template.html(8),"||")
	Response.Write Replace(Replace(template.html(7),"{$follow}",Dvbbs.mainpic(11)),"{$nofollow}",Dvbbs.mainpic(10))
	Response.Write "<script language=""javascript"">"
	Response.Write vbNewLine
	'传送图片变量到JS
	For i=0 to UBound(template.pic)-1
		Response.Write "piclist["&i&"]='"&template.pic(i)&"';"
		Response.Write vbNewLine		
	Next
	'传递论坛主设置数据到JS
	For i=0 to UBound(Dvbbs.mainsetting)
		Response.Write "mainsetting["&i&"]='"&Dvbbs.mainsetting(i)&"';"
		Response.Write vbNewLine	
	Next 
	'传送模板数据到JS以备调用
	Response.Write "template[template.length]='"&Replace(Replace(Replace(Replace(template.html(4),"\","\\"),"'","\'"),VbCrLf,"\n"),chr(13),"")&"';"
	Response.Write vbNewLine
	Response.Write "template[template.length]='"&Replace(Replace(Replace(Replace(TempListArray(0),"\","\\"),"'","\'"),VbCrLf,"\n"),chr(13),"")&"';"
	Response.Write vbNewLine
	Response.Write "template[template.length]='"&Replace(Replace(Replace(Replace(template.html(5),"\","\\"),"'","\'"),VbCrLf,"\n"),chr(13),"")&"';"
	Response.Write vbNewLine
	Response.Write "template[template.length]='"&Replace(Replace(Replace(Replace(TempListArray(1),"\","\\"),"'","\'"),VbCrLf,"\n"),chr(13),"")&"';"
	Response.Write vbNewLine
	Response.Write "template[template.length]='"&Replace(Replace(Replace(Replace(template.html(6),"\","\\"),"'","\'"),VbCrLf,"\n"),chr(13),"")&"';"
	Response.Write vbNewLine
	Response.Write "template[template.length]='"&Replace(Replace(Replace(Replace(TempListArray(2),"\","\\"),"'","\'"),VbCrLf,"\n"),chr(13),"")&"';"
	Response.Write vbNewLine
	Response.Write "template[template.length]='"&Replace(Replace(Replace(Replace(template.html(10),"\","\\"),"'","\'"),VbCrLf,"\n"),chr(13),"")&"';"
	Response.Write vbNewLine
	'传送字符串变量到JS
	For i=0 to 10
		Response.Write "Strings[Strings.length]='"& template.Strings(i)&"';"		
	Next
	Dim i,BoardID,Rs,ClassID
	Dim setings,lastposttime,depth,lastpost,BoardType,BoardReadme
	Set Rs=Dvbbs.Execute("select boardid,BoardType,ParentID,ParentStr,Depth,RootID,Child,readme,BoardMaster,PostNum,TopicNum,indexIMG,todayNum,boarduser,LastPost,Sid,Board_Setting,Board_Ads,Board_user,IsGroupSetting,BoardTopStr from Dv_board where ParentID="& Dvbbs.BoardID &" Or BoardID = "&Dvbbs.BoardID&" order by orders")
	If Not Rs.Eof Then Board_Datas=Rs.GetRows(-1)
	ClassID=""
	For i=0 To Ubound(Board_Datas,2)
		If Board_Datas(0,i)=Dvbbs.BoardID Then 
			If ClassID<>"" Then 
				Response.Write "classfooter();"		
			End If
			ClassID=Board_Datas(0,i)
			BoardType=Board_Datas(1,i)
			BoardType=Replace(BoardType,"\","\\")
			BoardType=Replace(BoardType,"'","\'")
			Response.Write "showclass("&Board_Datas(0,i)&",'"&BoardType&"','"&Board_Datas(16,i)&"','"&Request.Cookies("List")("list"&Board_Datas(0,i))&"',"&Board_Datas(6,i)&");"		
		Else
			havenew=0
			loadboard=True
			setings=split(Board_Datas(16,i),",")(1)
			lastpost=Board_Datas(14,i)
			lastpost=Server.HTMLEnCode(lastpost)
			lastpost=Replace(lastpost,"\","\\")
			lastpost=Replace(lastpost,CHR(10) & CHR(10),"\r")
			lastpost=Replace(lastpost,"\'","\'")
			lastpost=Replace(lastpost,Chr(10),"\n")
			lastpost=Replace(lastpost,Chr(13),"")
			lastposttime=split(Board_Datas(14,i),"$")(2)
			If Not IsDate(lastposttime) Then lastposttime=Now()
			If datediff("h",Dvbbs.Lastlogin,lastposttime)=0 Then havenew=1
			If CInt(setings)=1 And CInt(Dvbbs.GroupSetting(37))<>1 Then loadboard=False

			If loadboard Then
				BoardType=Board_Datas(1,i)
				BoardType=Replace(BoardType,"\","\\")
				BoardType=Replace(BoardType,"'","\'")
				BoardReadme=Board_Datas(7,i)&""
				'BoardReadme=Replace(BoardReadme,"\","\\")
				'BoardReadme=Replace(BoardReadme,CHR(10) & CHR(10),"\r")
				'BoardReadme=Replace(BoardReadme,"'","\'")
				'BoardReadme=Replace(BoardReadme,Chr(10),"\n")
				'BoardReadme=Replace(BoardReadme,Chr(13),"")
				Response.Write "showboard("&Board_Datas(0,i)&",'"&BoardType&"',"&Board_Datas(6,i)&",'"&BoardReadme&"','"&Board_Datas(8,i)&"',"&Board_Datas(9,i)&","&Board_Datas(10,i)&",'"&Board_Datas(11,i)&"',"&Board_Datas(12,i)&",'"&lastpost&"','"&Board_Datas(16,i)&"',"& havenew &");"
			End If
			If Board_Datas(6,i)>0 Or Not loadboard Then
				Response.Write "boardcount++;"
				Response.Write "Child=Child-1;"
				Response.Write "showcode('','');"
			End If
		End If	
		Response.Write vbNewLine
	Next
	If ClassID<>"" Then 
		Response.Write "classfooter();"		
	End If
	Set Rs=Nothing
	Board_Datas = Null
	Response.Write vbNewLine
	Response.Write "</script>" 
End Sub
%>
