<!--#include file="conn.asp"-->
<!--#include file="inc/const.asp"-->
<!--#include file="inc/dv_clsother.asp"-->
<!--#include file="inc/dv_ubbcode.asp"-->
<%
If Dvbbs.BoardID < 1 Then
	Response.Write "参数错误"
	Response.End 
End If
Dvbbs.LoadTemplates("dispbbs")
Dim AnnounceID,ReplyID,Star,Skin,followup
Dim CanReply,IsTop,IsVote,TopicCount,PollID,TotaluseTable,ViewNum,Topic,TopicMode
Dim PostBuyUser,abgcolor,bgcolor,UserName,CanRead,PostUserName
Dim T_GetMoney,T_UseTools,T_GetMoneyType,TopicInfo,IsTopicUser
Dim FoundUseMagic,iMagicFace
Dim ReplyID_a,AnnounceID_a,RootID_a	'当前贴子相关ID，给出售贴用 by 轻飘飘
FoundUseMagic = 0
Chk_Topic_Err
Dvbbs.Showerr()
Dvbbs.Nav()
Dvbbs.Showerr()
Dvbbs.Head_var 1,"","",""
GetForumTextAd(2)
Dvbbs.ActiveOnline()
Dim Page,LockTopic,action,TopicNum,n,SplitPageNum,EmotPath

EmotPath=Split(Dvbbs.Forum_emot,"|||")(0)		'em心情路径
action=Request("action")
Page=Request("Page")
If isNumeric(Page) = 0 or Page="" Then Page=1
Page=Clng(Page)
Show_Topic_Top()
Dvbbs.ShowErr()

Dim dv_ubb
Set dv_ubb=new Dvbbs_UbbCode
dv_ubb.PostType=1
Show_Topic_HTML()
Set dv_ubb=Nothing
If Skin=1 and CanRead Then showtree()
If CanReply Then Show_Topic_FastRe
If Dvbbs.UserID>0 Then Show_Topic_ManageAction
Dvbbs.NewPassword()
Dvbbs.Footer()

Sub Chk_Topic_Err
	AnnounceID=Request("ID")
	If AnnounceID="" Or Not IsNumeric(AnnounceID) Then Dvbbs.AddErrCode(30)
	ReplyID=Request("ReplyID")
	If ReplyID="" Or Not IsNumeric(ReplyID) Then ReplyID=AnnounceID
	Star=Request("Star")
	If Star="" Or Not IsNumeric(Star) Then Star=1
	Star=Clng(Star)
	Skin=Request("Skin")
	If Skin="" Or Not IsNumeric(Skin) Then Skin=Dvbbs.Board_setting(42)
	If Dvbbs.ErrCodes<>"" Then Exit Sub
	Dim SQl,Rs
	Dim MyCanReply
	'浏览购买帖权限
	CanRead=False
	If Dvbbs.Master or Dvbbs.SuperBoardMaster or Dvbbs.BoardMaster Then CanRead=True

	Set Rs=Server.CreateObject("Adodb.RecordSet")
	SQL="Select title,istop,isbest,PostUserName,PostUserid,hits,isvote,child,pollid,LockTopic,PostTable,BoardID,TopicMode,GetMoney,UseTools,GetMoneyType,DateAndTime,Expression From DV_topic where topicID="&Announceid
	If Not IsObject(Conn) Then ConnectionDatabase
	Rs.Open SQL,Conn,3,2
	Dvbbs.SqlQueryNum=Dvbbs.SqlQueryNum+1
	'Set Rs=Dvbbs.Execute(SQL)
	If Not(Rs.BOF and Rs.EOF) then
		If Rs(11)<>Dvbbs.BoardID Then Dvbbs.AddErrCode(29)
		Rs(5)=Rs(5)+1
		Rs.Update
		Topic=Rs(0)
		istop=Rs(1)
		isVote=Rs(6)
		TopicCount=Rs(7)+1
		pollid=Rs(8)
		'锁定多少天前的帖子判断 2004-9-16 Dv.Yz
		If Not Ubound(Dvbbs.Board_Setting) > 70 Then
			Locktopic = Rs(9)
		Else
			If Not Clng(Dvbbs.Board_Setting(71)) = 0 And Datediff("d", Rs(16), Now()) > Clng(Dvbbs.Board_Setting(71)) Then
				Locktopic = 1
			Else
				Locktopic = Rs(9)
			End If
		End If
		TotalUseTable=rs(10)
		TopicMode=rs(12)
		ViewNum=Rs(5)
		T_GetMoney = cCur(Rs(13))
		T_UseTools = Rs(14)
		T_GetMoneyType = Cint(Rs(15))
		PostUserName = Rs(3)
		
		If Rs(4)=Dvbbs.UserID then
			IsTopicUser = True	'是楼主
			MyCanReply=Dvbbs.GroupSetting(4)
			CanRead=True
		Else
			MyCanReply=Dvbbs.GroupSetting(5)
			If Cint(Dvbbs.GroupSetting(2))=0 Then Dvbbs.AddErrcode(31)
		End If
		
		If Len(Topic) > Cint(Dvbbs.Board_Setting(25)) And Not TopicMode>0 Then
			Topic=Left(Topic,Dvbbs.Board_Setting(25))&"..."
		End If
		If TopicMode>0 Then
			If TopicMode=1 Then
				Topic = Replace(Topic,"<!--","&lt;!--")		
			Else
				Topic = Replace(Topic,"<","&lt;")
				Topic = Replace(Topic,">","&gt;")	
				Topic=Dvbbs_TopicMode(Topic,TopicMode)
			End If
		Else
			Topic = Replace(Topic,"<","&lt;")
			Topic = Replace(Topic,">","&gt;")
		End If
		Topic=Dvbbs.ChkBadWords(Topic)
		Dvbbs.Stats=Topic
		iMagicFace = Split(Rs(17),"|")
		If Ubound(iMagicFace) = 1 Then FoundUseMagic = iMagicFace(0)
	Else
		Dvbbs.AddErrcode(32)
	End If
	Rs.Close
	Set Rs=Nothing
	CanReply=False
	If (Not Dvbbs.Board_Setting(0)="1" And Cint(mycanreply)=1 And Cint(locktopic)=0) Or (Dvbbs.master Or Dvbbs.superboardmaster Or Dvbbs.boardmaster) Then
		CanReply=True
	End If
End Sub

Function Show_Topic_Top()
	 
	Dim TempStr,MyTempStr,ViewUrl
	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
		MyTempStr=Split(template.html(1),"||")
		TempStr=Replace(MyTempStr(0),"{$pic_newpost}",Dvbbs.mainpic(7))
		TempStr=Replace(TempStr,"{$pic_newvote}",Dvbbs.mainpic(8))
	Else
		If Dvbbs.Board_Setting(0)="1" Then TempStr=template.Strings(0)
	End If
	ViewUrl = "View_TopicInfo.asp?action=View&BoardId="&Dvbbs.BoardID&"&ID="&Announceid
	'帖子信息类型
	Select Case T_GetMoneyType
		Case 1
			TopicInfo = Replace(Template.Strings(17),"{$SendMoney}",T_GetMoney)
			TopicInfo = Replace(TopicInfo,"{$Stats}","")
		Case 2
			TopicInfo = Replace(Template.Strings(18),"{$GetMoney}",T_GetMoney)
		Case 3
			TopicInfo = Replace(Template.Strings(19),"{$PayMoney}",T_GetMoney)
		Case 5
			TopicInfo = Replace(Template.Strings(17),"{$SendMoney}",T_GetMoney)
			TopicInfo = Replace(TopicInfo,"{$Stats}",Template.Strings(21))
	End Select
	TopicInfo = Replace(TopicInfo,"{$ViewUrl}",ViewUrl)
	
	Response.Write "<Script Language=JavaScript>" 
	Response.Write "var TopicMoneyInfo='"&Replace(Replace(TopicInfo,"'","\'"),VbCrLf,"")&"';"
	Response.Write "</Script>"

	TopicInfo = Replace(TopicInfo,"{$alertcolor}",Dvbbs.Mainsetting(1)) 
	TempStr=Replace(template.html(0),"{$topicpostinfo}",TempStr)
	TempStr=Replace(TempStr,"{$width}",Dvbbs.mainsetting(0))
	TempStr=Replace(TempStr,"{$boardid}",Dvbbs.BoardID)
	TempStr=Replace(TempStr,"{$page}",page)
	TempStr=Replace(TempStr,"{$replyid}",ReplyID)
	TempStr=Replace(TempStr,"{$star}",Star)
	TempStr=Replace(TempStr,"{$announceid}",AnnounceID)
	TempStr=Replace(TempStr,"{$viewnum}",ViewNum)
	
	Dim Skinpic,Skinname,nskin
	If Skin="1" Then
		nskin=0
		Skinpic=template.pic(1)
		Skinname=template.Strings(2)
	Else
		nskin=1
		Skinpic=template.pic(0)
		Skinname=template.Strings(1)
	End If
	TempStr=Replace(TempStr,"{$skin}",nskin)
	TempStr=Replace(TempStr,"{$skinname}",skinname)
	TempStr=Replace(TempStr,"{$skinpic}",skinpic)
	TempStr=Replace(TempStr,"{$topic}",Topic)
	If IsVote=1 Then
		TempStr=Replace(TempStr,"{$voteinfo}",Show_Topic_Vote)
	Else
		TempStr=Replace(TempStr,"{$voteinfo}","")
	End If
	'魔法表情部分
	TempStr=Replace(TempStr,"{$dispmagicface}",Split(template.html(14),"||")(0))
	If Clng(FoundUseMagic) > 0 Then
		Dim MagicFaceCookies
		MagicFaceCookies = Request.Cookies("DvbbsMagicFace")
		If MagicFaceCookies = "" Or Not IsNumeric(MagicFaceCookies) Then
			TempStr=Replace(TempStr,"{$isdispmagic}",Split(template.html(14),"||")(2))
			TempStr=Replace(TempStr,"{$magicfaceid}",FoundUseMagic)
			Response.Cookies("DvbbsMagicFace") = AnnounceID
		ElseIf cCur(AnnounceID) <> cCur(MagicFaceCookies) Then
			TempStr=Replace(TempStr,"{$isdispmagic}",Split(template.html(14),"||")(2))
			TempStr=Replace(TempStr,"{$magicfaceid}",FoundUseMagic)
			Response.Cookies("DvbbsMagicFace") = AnnounceID
		Else
			Response.Cookies("DvbbsMagicFace") = AnnounceID
		End If
	End If
	TempStr=Replace(TempStr,"{$isdispmagic}","")
	'魔法表情部分
	Response.Write TempStr
	TopicInfo = TopicInfo & Replace(template.Strings(20),"{$SubmitUrl}","buypost.asp?Action=buy&PostTable="&TotalUseTable&"&boardid="&Dvbbs.Boardid&"&ID="&Announceid&"&ReplyID="&Announceid)
	TopicInfo = "<div class=info>"&TopicInfo&"</div>"
End Function
Function Topic_Ads()
	If Dvbbs.Forum_ads(7)="1" Then
		Randomize
		Topic_Ads=Dvbbs.Forum_ads(14)(CInt(UBound(Dvbbs.Forum_ads(14))*Rnd))
	Else
		Topic_Ads=""
	End If
End Function
Sub Show_Topic_HTML()
	If Dvbbs.Forum_ads(7)="1" Then
		Dvbbs.Forum_ads(14)=replace(Dvbbs.Forum_ads(14),Chr(13),"")
		Dvbbs.Forum_ads(14)=Split(Dvbbs.Forum_ads(14),Chr(10))
	End If
	Dim SQL,Rs,i
	Dim TopicPageList,Pcount,isagree
	TopicPageList=Dvbbs.Board_Setting(27)
	SQL="B.AnnounceID,B.BoardID,B.UserName,B.Topic,B.dateandtime,B.body,B.Expression,B.ip,B.RootID,B.signflag,B.isbest,B.PostUserid,B.layer,b.isagree,U.useremail,U.UserIM,U.UserMobile,U.Usersign,U.userclass,U.Usertitle,U.Userwidth,U.Userheight,U.UserPost,U.Userface,U.JoinDate,U.userWealth,U.userEP,U.userCP,U.Userbirthday,U.Usersex,U.UserGroup,U.LockUser,U.userPower,U.titlepic,U.UserGroupID,U.LastLogin,B.PostBuyUser,U.UserHidden,U.IsChallenge,B.Ubblist,B.LockTopic,B.GetMoney,B.UseTools,U.UserMoney,U.UserTicket,B.GetMoneyType,B.IsUpload"
	If Cint(skin)=1 and Clng(replyid)=Clng(Announceid) Then
		SQL="Select top 1 "&SQL&" From "&TotalUseTable&" B Inner Join [dv_user] U On U.UserID=B.PostUserID Where B.BoardID="&Dvbbs.BoardID&" And B.RootID="&AnnounceID&"  Order By B.AnnounceID, B.DateAndTime"
	ElseIf Cint(skin)=1 Then
		SQL="Select "&SQL&" From "&TotalUseTable&" B Inner Join [dv_user] U On U.UserID=B.PostUserID Where B.BoardID="&Dvbbs.BoardID&" And B.AnnounceID="&replyID
	Else
		Dim AnnounceIDlists
		AnnounceIDlists=AnnounceIDlist()
		SQL="Select "&SQL&" From "&TotalUseTable&" B Inner Join [dv_user] U On U.UserID=B.PostUserID Where B.BoardID="&Dvbbs.BoardID&" And B.RootID="&Announceid&" And  B.AnnounceID in ("&AnnounceIDlists&") Order BY B.AnnounceID, B.DateAndTime"
	End If
	Set Rs = Dvbbs.Execute(SQL)
	If Rs.EOF And Rs.BOF Then
		Dvbbs.AddErrCode(33)
		Dvbbs.ShowErr()
		Exit Sub
	End If
	'AnnounceID=0,BoardID=1,UserName=2,Topic=3,dateandtime=4,body=5,
	'Expression=6,ip=7,RootID=8,signflag=9,isbest=10,PostUserid=11,
	'layer=12,isagree=13,useremail=14,UserIM=15,UserMobile=16,sign=17,
	'userclass=18,title=19,width=20,height=21,article=22,face=23,JoinDate=24,
	'userWealth=25,userEP=26,userCP=27,birthday=28,sex=29,UserGroup=30,LockUser=31,
	'userPower=32,titlepic=33,UserGroupID=34,LastLogin=35,PostBuyUser=36,UserHidden=37,IsChallenge=38,Ubblists=39,LockTopic=40,
	'GetMoney=41,UseTools=42,UserMoney=43,UserTicket=44,GetMoneyType=45,IsUpload=46 
	Dim MyTempStr,ReplaceStr,userface,UserIM,TopicBody,Node,cnode,XMLDOM,XMLStyle,documentElement
	If Not(Rs.EOF And Rs.BOF) Then
		followup = Rs("AnnounceID")
		If TopicCount mod Cint(TopicPageList)=0 then
			Pcount= TopicCount \ Cint(TopicPageList)
		Else
			Pcount= TopicCount \ Cint(TopicPageList)+1
		End If
		If star > Pcount Then star = Pcount
		If star < 1 Then star = 1				
		Response.Write "<Script Language=JavaScript>"
		Response.Write  "var star='"&star&"';"
		Response.Write  "var alertcolor='"&Dvbbs.mainsetting(1)&"';"
		Response.Write  "var Board_Setting27='"&TopicPageList&"';"
		Response.Write  "var TopicNum='"&TopicCount&"';"
		Response.Write  "var TotalUseTable='"&TotalUseTable&"';"
		Response.Write  "var GetMoneyType="&T_GetMoneyType&";"
		Response.Write  Dvbbs.GroupSetting_UserName
		Response.Write  "</Script>"&vbNewLine
		Set XMLDOM=Server.CreateObject("Microsoft.FreeThreadedXMLDOM")
		Rs.Save XMLDOM,1
				
		XMLDOM.documentElement.removeChild(XMLDOM.documentElement.selectSingleNode("s:Schema"))
		Set documentElement=XMLDOM.documentElement
		Dim nodelist
		Dim BuyMoneyInfo,ShowForm

		Set nodelist=documentElement.selectNodes("rs:data/z:row")
		i=0
		For each node in nodelist
			PostBuyUser=Rs("PostBuyUser")
			UserName=Rs("UserName")
			ReplyID_a=Rs("AnnounceID")
			AnnounceID_a=Rs("AnnounceID")
			RootID_a=Rs("RootID")
			If (star = 1 And TopicMode=1 And i=0) Or Request("skin")="1" Then
				node.attributes.getNamedItem("Topic").text=replacehtml(node.attributes.getNamedItem("Topic").text)
			End If
			i=i+1

			If node.attributes.getNamedItem("GetMoneyType").text <>"3" Then
				CanRead=True
			Else
				If Not CanRead Then
					If Instr(node.attributes.getNamedItem("PostBuyUser").text,"|||"&Dvbbs.Membername&"|||") Then
						CanRead = True
					Else
						BuyMoneyInfo = Split(Split(node.attributes.getNamedItem("PostBuyUser").text,"|||",2)(0),"@@@")
						If Ubound(BuyMoneyInfo)>0 Then
							If BuyMoneyInfo(2) = 0 And Dvbbs.VipGroupUser Then
								CanRead = True
								ShowForm = True
							End If
						End If
					End If
				End If
			End If

			Ubblists=Rs("Ubblist")&""
			If Not CanRead Then
				TopicBody = TopicInfo
			Else
				If Not (node.attributes.getNamedItem("LockUser").text="2" Or (node.attributes.getNamedItem("isbest").text="1" And Dvbbs.GroupSetting(41)="0") Or node.attributes.getNamedItem("LockUser").text="1") Then
					If InStr(Ubblists,",39,") > 0  Then
						TopicBody = dv_ubb.Dv_UbbCode(node.attributes.getNamedItem("body").text,node.attributes.getNamedItem("UserGroupID").text,1,0)
					Else
						TopicBody = dv_ubb.Dv_UbbCode(node.attributes.getNamedItem("body").text,node.attributes.getNamedItem("UserGroupID").text,1,1)
					End If			
				End If
			End If
			If ShowForm Then
				TopicBody = TopicBody & TopicInfo
			End If
			node.attributes.getNamedItem("body").text=Dvbbs.ChkBadWords(TopicBody)
			If Not (node.attributes.getNamedItem("Usersign") is Nothing) Then
				TopicBody=node.attributes.getNamedItem("Usersign").text
				If node.attributes.getNamedItem("signflag").text="1" and node.attributes.getNamedItem("LockUser").text="0" And Dvbbs.forum_setting(42)="1" Then
					node.attributes.getNamedItem("Usersign").text=Dvbbs.ChkBadWords(Dv_ubb.Dv_SignUbbCode(TopicBody,node.attributes.getNamedItem("UserGroupID").text))
				End If
			End If
			Userface=split(Rs("Userface")&"","|")
			If UBound(Userface)>0 Then
				node.attributes.getNamedItem("Userface").text=Userface(1)
				Set CNode = XMLDOM.createNode(2,"UserMfface","")
				Cnode.text=Userface(0)
				node.attributes.setNamedItem(Cnode)
			ElseIf UBound(Userface)=0 Then 
				node.attributes.getNamedItem("Userface").text=Userface(0)
			End If
			userIM=Split(node.attributes.getNamedItem("UserIM").text,"|||")
			Set CNode = XMLDOM.createNode(2,"homepage","")
			Cnode.text=UserIM(0)
			node.attributes.setNamedItem(Cnode)
			Set CNode = XMLDOM.createNode(2,"oicq","")
			Cnode.text=UserIM(1)
			node.attributes.setNamedItem(Cnode)
			Set CNode = XMLDOM.createNode(2,"uc","")
			Cnode.text=UserIM(6)
			node.attributes.setNamedItem(Cnode)
			If Not (node.attributes.getNamedItem("isagree") is Nothing) Then
			isagree=Split(node.attributes.getNamedItem("isagree").text,"|")
			If UBound(isagree)>0 Then
				Set CNode = XMLDOM.createNode(2,"iAgree","")
				Cnode.text=isagree(1)
				node.attributes.setNamedItem(Cnode)
				node.attributes.getNamedItem("isagree").text=isagree(0)
			End If
			End If
			Set CNode = XMLDOM.createNode(2,"usernameencode","")
			Cnode.text=Server.urlencode(node.attributes.getNamedItem("UserName").text)
			node.attributes.setNamedItem(Cnode)
			'更新UserHidden,最后登录时候超过删除在线时间间隔的设置为1		
			If IsDate(Rs("LastLogin")) Then
				If DateDiff("s",Rs("LastLogin"),Now())>(Cint(dvbbs.Forum_Setting(8))*60) Then
					node.attributes.getNamedItem("UserHidden").text="1"
				End If
			Else
				node.attributes.getNamedItem("UserHidden").text="1"
			End If
			'========随机广告节点
			Set CNode = XMLDOM.createNode(2,"ads","")
			Cnode.text=Topic_Ads()
			node.attributes.setNamedItem(Cnode)
			Rs.MoveNext
			
		Next
		Set Rs=Nothing
		'===============settings论坛设置节点==============
		Set Node = XMLDOM.createNode(1,"settings","")
		documentElement.appendChild(node)
		'======================几个用户组名字颜色====================
		Set CNode = XMLDOM.createNode(2,"namestyle9","")
		Cnode.text=Dvbbs.mainsetting(9)
		node.attributes.setNamedItem(Cnode)
		Set CNode = XMLDOM.createNode(2,"namestyle7","")
		Cnode.text=Dvbbs.mainsetting(7)
		node.attributes.setNamedItem(Cnode)
		Set CNode = XMLDOM.createNode(2,"namestyle11","")
		Cnode.text=Dvbbs.mainsetting(11)
		node.attributes.setNamedItem(Cnode)
		Set CNode = XMLDOM.createNode(2,"namestyle5","")
		Cnode.text=Dvbbs.mainsetting(5)
		node.attributes.setNamedItem(Cnode)
		'===============================
		Set CNode = XMLDOM.createNode(2,"usetools","")'是否使用道具
		Cnode.text=Dvbbs.Forum_Setting(90)
		node.attributes.setNamedItem(Cnode)
		Set CNode = XMLDOM.createNode(2,"useray","")'是否开启阳光服务
		Cnode.text=Dvbbs.Forum_ChanSetting(0)
		node.attributes.setNamedItem(Cnode)
		Set CNode = XMLDOM.createNode(2,"fontsize","")'字体大小设置
		Cnode.text=Dvbbs.Board_setting(28)
		node.attributes.setNamedItem(Cnode)
		Set CNode = XMLDOM.createNode(2,"lineheight","")'行距设置
		Cnode.text=Dvbbs.Board_setting(29)
		node.attributes.setNamedItem(Cnode)
		Set CNode = XMLDOM.createNode(2,"posttable","")'数据表
		Cnode.text=TotalUseTable
		node.attributes.setNamedItem(Cnode)
		Set CNode = XMLDOM.createNode(2,"PageSize","")'每页显示多少贴
		Cnode.text=TopicPageList
		node.attributes.setNamedItem(Cnode)
		Set CNode = XMLDOM.createNode(2,"tablewidth","")'表格宽度
		Cnode.text=Dvbbs.mainsetting(0)
		node.attributes.setNamedItem(Cnode)
		Set CNode = XMLDOM.createNode(2,"altercolor","")'表格宽度
		Cnode.text=Dvbbs.mainsetting(1)
		node.attributes.setNamedItem(Cnode)
		'============postinfo 贴子信息节点======================
		Set Node = XMLDOM.createNode(1,"postinfo","")
		documentElement.appendChild(node)
		Set CNode = XMLDOM.createNode(2,"star","")
		Cnode.text=star
		node.attributes.setNamedItem(Cnode)
		Set CNode = XMLDOM.createNode(2,"skin","")
		Cnode.text=Skin
		node.attributes.setNamedItem(Cnode)
		Set CNode = XMLDOM.createNode(2,"page","")
		Cnode.text=Page
		node.attributes.setNamedItem(Cnode)
		Set CNode = XMLDOM.createNode(2,"boardtype","")
		Cnode.text=Dvbbs.boardtype
		node.attributes.setNamedItem(Cnode)
		Set CNode = XMLDOM.createNode(2,"topiccount","")
		Cnode.text=TopicCount
		node.attributes.setNamedItem(Cnode)
		Set CNode = XMLDOM.createNode(2,"boardid","")
		Cnode.text=Dvbbs.boardid
		node.attributes.setNamedItem(Cnode)
		Set CNode = XMLDOM.createNode(2,"replyid","")
		Cnode.text=replyid
		node.attributes.setNamedItem(Cnode)
		Set CNode = XMLDOM.createNode(2,"AnnounceID","")
		Cnode.text=AnnounceID
		node.attributes.setNamedItem(Cnode)
		Set CNode = XMLDOM.createNode(2,"magicfaceid","")
		Cnode.text=FoundUseMagic
		node.attributes.setNamedItem(Cnode)
		Set CNode = XMLDOM.createNode(2,"getmoneytype","")
		Cnode.text=T_GetMoneyType
		node.attributes.setNamedItem(Cnode)
		Set CNode = XMLDOM.createNode(2,"getmoney","")
		Cnode.text=T_GetMoney
		node.attributes.setNamedItem(Cnode)
		Set CNode = XMLDOM.createNode(2,"TopicUseTools","")
		Cnode.text=T_UseTools & ""
		node.attributes.setNamedItem(Cnode)
		Set CNode = XMLDOM.createNode(2,"PostUserName","")
		Cnode.text=Lcase(PostUserName)
		node.attributes.setNamedItem(Cnode)
		Set CNode = XMLDOM.createNode(2,"MemberName","")
		Cnode.text=Lcase(Dvbbs.Membername)
		node.attributes.setNamedItem(Cnode)
		'==================usersetings节点,浏览者的权限数据============
		Set Node = XMLDOM.createNode(1,"usersetings","")
		documentElement.appendChild(node)
		Set CNode = XMLDOM.createNode(2,"canreadbest","")
		Cnode.text=Dvbbs.GroupSetting(41)
		node.attributes.setNamedItem(Cnode)
		Set CNode = XMLDOM.createNode(2,"canlookip","")
		Cnode.text=Dvbbs.GroupSetting(30)
		node.attributes.setNamedItem(Cnode)
		Set Node = XMLDOM.createNode(1,"BoardList","")
		Node.text="if(this.options[this.selectedIndex].value!=''){location='index.asp?boardid='+this.options[this.selectedIndex].value;}"
		documentElement.appendChild(node)
		Dim xslt
		Set XSLT=Application(Dvbbs.CacheName&"_dispbbsemplate_"&Dvbbs.SkinID)
		Dim proc
		Set proc = XSLT.createProcessor()
		proc.input = XMLDOM
    	proc.transform()
   	 	Response.Write  proc.output
		Set XMLDOM=Nothing
		Set XMLStyle=Nothing
		Set XSLt=Nothing
	End If
End Sub

Function Show_Topic_FastRe()
	Dim TempStr
	Response.Write "<Script Language=JavaScript>"
	Response.Write "var Board_Setting5='"&Dvbbs.Board_Setting(5)&"';"
	Response.Write "var Board_Setting6='"&Dvbbs.Board_Setting(6)&"';"
	Response.Write "var Board_Setting7='"&Dvbbs.Board_Setting(7)&"';"
	Response.Write "var Board_Setting8='"&Dvbbs.Board_Setting(8)&"';"
	Response.Write "var Board_Setting9='"&Dvbbs.Board_Setting(9)&"';"
	Response.Write "var Board_Setting16='"&Dvbbs.Board_Setting(16)&"';"
	Response.Write "var Board_Setting44='"&Dvbbs.Board_Setting(44)&"';"
	Response.Write "var Forum_Setting3='"&Dvbbs.Forum_Setting(3)&"';"
	Response.Write "var Forum_PostFace='"&Dvbbs.Forum_PostFace&"';"
	Response.Write "var Forum_PostFace=Forum_PostFace.split(""|||"");"
	Response.Write "</Script>"
	TempStr = template.html(3)
	'TempStr = Replace(TempStr,"{$topic}",Topic)
	TempStr = Replace(TempStr,"{$boardid}",Dvbbs.BoardID)
	If Dvbbs.Board_Setting(4)="0" Then
		TempStr = Replace(TempStr,"{$getcode}","")
	Else
		TempStr = Replace(TempStr,"{$getcode}","&nbsp;<B>验证码：</B>"&Dvbbs.GetCode())
	End If
	If T_GetMoneyType = 2 and Not IsTopicUser Then
		TempStr = Replace(TempStr,"{$SendMoney}",template.html(16))
	Else
		TempStr = Replace(TempStr,"{$SendMoney}","")
	End If
	TempStr = Replace(TempStr,"{$membername}",Dvbbs.membername)
	TempStr = Replace(TempStr,"{$followup}",followup)
	TempStr = Replace(TempStr,"{$announceid}",AnnounceID)
	TempStr = Replace(TempStr,"{$star}",Star)
	TempStr = Replace(TempStr,"{$totalusetable}",TotalUseTable)
	TempStr = Replace(TempStr,"{$Forum_Emot}",Replace(Dvbbs.Forum_emot&"","|||","<><><>"))
	TempStr = Replace(TempStr,"{$MaxLength}",Clng(Dvbbs.Board_Setting(16)))
	Dim Dvbbs_Mode
	Dvbbs_Mode = Dvbbs.GroupSetting(67)
	If Dvbbs.Board_Setting(5) = "0" Then Dvbbs_Mode = 2
	TempStr = Replace(TempStr,"{$Dvbbs_Mode}",Dvbbs_Mode)
	Dim Content
	Content = Session(Dvbbs.CacheName & "UserID")
	If IsArray(Content) And Dvbbs.userID > 0 Then
		TempStr = Replace(TempStr,"{$content}",Server.HTMLEncode(Content(Dvbbs.UserInfoCount-1)))
	Else
		TempStr = Replace(TempStr,"{$content}","")
	End If 
	Response.Write TempStr
	TempStr = ""
	Response.Cookies("Dvbbs")=""
End Function

Function Show_Topic_ManageAction()
	Dim TempStr
	TempStr = template.html(4)
	If T_GetMoneyType = 1 Then
		TempStr = Replace(TempStr,"{$toolsm}","{$toolsm}" & template.Strings(23))
	End If
	If DVbbs.Forum_Setting(90)="1" and IsTopicUser Then
		TempStr = Replace(TempStr,"{$toolsm}",template.Strings(22))
	Else
		TempStr = Replace(TempStr,"{$toolsm}","")
	End If
	TempStr = Replace(TempStr,"{$width}",Dvbbs.mainsetting(0))
	TempStr = Replace(TempStr,"{$boardid}",Dvbbs.BoardID)
	TempStr = Replace(TempStr,"{$announceid}",AnnounceID)
	TempStr = Replace(TempStr,"{$replyid}",ReplyID)
	TempStr = Replace(TempStr,"{$PostTable}",TotalUseTable)
	If IsTop > 0 Then
		TempStr = Replace(TempStr,"{$topstr}",template.Strings(10))
	Else
		TempStr = Replace(TempStr,"{$topstr}",template.Strings(11))
	End If
	Response.Write TempStr
	TempStr = ""
End Function

Function Show_Topic_Vote()
	Dim TempStr,Rs,Trs
	Set Rs=Dvbbs.Execute("Select * From Dv_Vote Where VoteID="&PollID)
	If Not (Rs.Eof And Rs.Bof) Then
		Response.Write "<Script Language=JavaScript>"
		Response.Write "var vote='"&Rs("vote")&"';"
		Response.Write "var votenum='"&Rs("votenum")&"';"
		Response.Write "var votetype='"&Rs("votetype")&"';"
		Response.Write "var voters='"&Rs("voters")&"';"
		Response.Write "</Script>"
		TempStr = template.html(5)
		TempStr = Replace(TempStr,"{$topic}",Topic)
		TempStr = Replace(TempStr,"{$announceid}",AnnounceID)
		TempStr = Replace(TempStr,"{$votetype}",Rs("votetype"))
		If Dvbbs.UserID=0 Or datediff("d",rs("timeout"),Now())>0 Or locktopic=1 Then
			TempStr = Replace(TempStr,"{$uservoteinfo}",Split(template.html(6),"||")(0))
		Else
			Set Trs=Dvbbs.Execute("Select Count(*) From Dv_voteuser Where voteid="&PollID&" And userid="&Dvbbs.userid)
			If Trs(0)=0 Then 
				TempStr = Replace(TempStr,"{$uservoteinfo}",Split(template.html(6),"||")(1))
			Else
				TempStr = Replace(TempStr,"{$uservoteinfo}",Split(template.html(6),"||")(2))
			End If
			Set Trs=Nothing 
		End  If
		TempStr = Replace(TempStr,"{$timeout}",Rs("timeout"))
		TempStr = Replace(TempStr,"{$boardid}",Dvbbs.BoardID)
		TempStr = Replace(TempStr,"{$voteid}",PollID)
		TempStr = Replace(TempStr,"{$uarticle}",Rs("UArticle")&"")
		TempStr = Replace(TempStr,"{$uep}",Rs("UEP")&"")
		TempStr = Replace(TempStr,"{$ucp}",Rs("UCP")&"")
		TempStr = Replace(TempStr,"{$upower}",Rs("UPower")&"")
		TempStr = Replace(TempStr,"{$umoney}",Rs("UWealth")&"")
		'Response.Write TempStr
		Show_Topic_Vote = TempStr
		TempStr = ""
	End If
	Set Rs=Nothing
End Function

Function SimJsReplace(str)
	If IsNull(str) Or str="" Then Exit Function
	str=Replace(str,"\","\\")
	str=Replace(str,"'","\'")
	str=Replace(str,"$","&#36;")
	SimJsReplace=str
End Function
Function Dvbbs_TopicMode(str,tmode)
	Select Case tmode
	Case "1"
		Dvbbs_TopicMode=str
	Case "2"
		Dvbbs_TopicMode="<font color=red>"&Dvbbs.Htmlencode(str)&"</font>"
	Case "3"
		Dvbbs_TopicMode="<font color=blue>"&Dvbbs.Htmlencode(str)&"</font>"
	Case "4"
		Dvbbs_TopicMode="<font color=green>"&Dvbbs.Htmlencode(str)&"</font>"
	Case Else
		Dvbbs_TopicMode=Dvbbs.HtmlEncode(str)
	End Select
End Function
Sub Showtree()
	template.html(7) = Replace(template.html(7),"{$boardid}",Dvbbs.BoardID)
	template.html(7) = Replace(template.html(7),"{$replyid}",ReplyID)
	template.html(7) = Replace(template.html(7),"{$announceid}",AnnounceID)
	template.html(7) = Replace(template.html(7),"{$openid}",followup)
	Response.Write template.html(7)
End Sub
Function AnnounceIDlist()
	Dim Rs,SQL,i,starcount
	starcount=(Star-1)*Dvbbs.Board_Setting(27)
	SQL="Select Announceid From "&TotalUseTable&" Where BoardID="&Dvbbs.BoardID&" And RootID="&Announceid&" Order By AnnounceID"
	Set Rs=Dvbbs.Execute(SQL)
	If Not Rs.Eof Then
		Rs.Move Starcount
		REM 修正最后页面出错信息 2004-5-22 Dv.Yz
		If Rs.Eof Then
			Dvbbs.AddErrcode(33)
			Dvbbs.Showerr()
		End If
		AnnounceIDlist = Rs(0)
		Rs.Movenext
		For i = 1 To Dvbbs.Board_Setting(27)-1
			If Rs.Eof Then Exit For
			AnnounceIDlist = AnnounceIDlist & "," & Rs(0)
			Rs.Movenext
		Next
	Else
		Dvbbs.AddErrcode(32)
		Dvbbs.Showerr()
	End If 
	Set Rs=Nothing
End Function
Function replacehtml(Str)
	Dim re,s
	S=Str
	Set re=new RegExp
	re.IgnoreCase =True
	re.Global=True
	re.Pattern="<(.[^>]*)>"
	s=re.Replace(s,"")
	Set Re=Nothing
	replacehtml=s
End Function
Function DoTest(Str)
	Dim s,re
	s=Str
	Set re=new RegExp
	re.IgnoreCase =True
	re.Global=True
	re.Pattern="(<[^<>]*?)(\s+[^<=>\s]*=)([^""\s<>""']+)(\s?.*>)"
	Do While re.Test(s)
		s=re.Replace(s,"$1$2""$3""$4")
	Loop
	DoTest=s
	Set Re=Nothing
End Function
%>
