<!--#include file="bbstop.asp"-->
<!--#include file="bbsinc/code.asp"-->
<script language="JavaScript" src="inc/coolbuttons.js"></script>
<%	dim AnnounceID
	dim RootID
	dim BoardID
	dim cname
	dim rs
	dim sql
	dim rsBoard
	dim boardsql
	dim FoundErr
	dim tabletitle
	dim tablefont
	dim strAllowForumCode
	dim strAllowHTML
	dim strIMGInPosts
	dim strIcons
	dim strflash
	dim Forumlogo
	
	dim ErrMsg,con,content
	dim boardtype
	dim guestlist
	if memberclass = user_level7 or memberclass = user_level8 or memberclass = user_level9 then
		guestlist=""
	else
		guestlist=" lockboard<>2 and "
	end if
   	set rs=server.createobject("adodb.recordset")
   	set rsBoard=server.createobject("adodb.recordset")

	if request("boardid")="" then
		founderr=true
		Errmsg=Errmsg+"<br>"+"<li>请指定论坛版面。"
	elseif not isInteger(request("boardid")) then
		founderr=true
		Errmsg=Errmsg+"<br>"+"<li>非法的版面参数。"
	else
		boardid=request("boardid")
	end if
	if request("id")="" then
		founderr=true
		Errmsg=Errmsg+"<br>"+"<li>请指定相关贴子。"
	elseif not isInteger(request("id")) then
		founderr=true
		Errmsg=Errmsg+"<br>"+"<li>非法的贴子参数。"
	else
		AnnounceID=request("id")
	end if
	if request("RootID")="" then
		founderr=true
		Errmsg=Errmsg+"<br>"+"<li>请指定相关贴子。"
	elseif not isInteger(request("RootID")) then
		founderr=true
		Errmsg=Errmsg+"<br>"+"<li>非法的贴子参数。"
	else
		RootID=request("RootID")
	end if

    	if foundErr then
		call Error()
	else

	sql="select boardtype,Tableback,Tabletitle,Tablebody,aTablebody,TableFont,TableContent,AlertFont,strAllowForumCode,strAllowHTML,strIMGInPosts,strIcons,strflash,Forumlogo from bbs_board where "&guestlist&" boardID="&BoardID
   	rs.open sql,conn,1,1
	if not(rs.bof and rs.eof) then
   		boardtype=rs("boardtype")
		Tableback=trim(rs("Tableback"))
		Tabletitle=trim(rs("Tabletitle"))
		Tablebody=trim(rs("Tablebody"))
		aTablebody=trim(rs("aTablebody"))
		TableFont=trim(rs("TableFont"))
		TableContent=trim(rs("TableContent"))
		AlertFont=trim(rs("AlertFont"))
		strAllowForumCode=rs("strAllowForumCode")
		strAllowHTML=rs("strAllowHTML")
		strIMGInPosts=rs("strIMGInPosts")
		strIcons=rs("strIcons")
		strflash=rs("strflash")
		Forumlogo=rs("Forumlogo")
	else
		foundErr = true
		ErrMsg=ErrMsg+"<br>"+"<li>您指定的论坛版面不存在或者您没有察看该版面权限</li>"
	end if
	rs.close

     	set rs=conn.execute("select topic from bbs_content where announceID="&rootID&"")
	if not(rs.bof and rs.eof) then
		topic=rs("topic")
	else
		foundErr = true
		ErrMsg=ErrMsg+"<br>"+"<li>您指定的贴子不存在</li>"
	end if
	rs.close

  	sql="select body,topic,locktopic from bbs_content where AnnounceID="&AnnounceID
   	rs.open sql,conn,1,1 
%>
<table cellpadding=4 cellspacing=1 border=0 width="762" align=center bgcolor="#f9f9f9" class=pian>
<tr><td height=25 bgcolor=#f9f9f9>&nbsp;现在时间是：<%=now%>&nbsp;&nbsp;您当前的位置：<a href=index.asp><font color=#666666>会员社区首页</font></a><font color="#666666">&nbsp;&gt;&gt;&nbsp;<a href="list.asp?boardid=<%=boardid%>"><%=boardtype%></a>&nbsp;&gt;&gt;&nbsp;<%=htmlencode(topic)%></font></td>
</tr>
</tr><tr><td height="1" bgcolor=#efefef></td></tr></TABLE> 
<!--#include file="bbsinc/Form1.asp"-->
<%		if rs("locktopic")=1 then
		founderr=true
		Errmsg=Errmsg+"<br>"+"<li>本主题已被锁定，不能发表回复。"
		else
   		con=rs("body")
		topic=rs("topic")
		call showReForm()
		end if
	rs.close
	'response.write "<hr width='95%'>"
		call showPage()
	end if

	sub showPage()
		'on error resume next
		if foundErr then
			call Error()
		else
			call announceinfo()
			if founderr then call Error()
		end if
		if err.number<>0 then err.clear
end sub

sub announceinfo()
	Rs.open "Select UserName,Topic,dateandtime,body,announceid from bbs_content where boardid="&boardid&" and rootid="&rootid&" order by announceid",conn,1,1
       	do while not rs.eof
%>
<TABLE border=0 width="762" align=center class=pian 
<%if Cint(rs("announceid"))=Cint(announceid) then%>bgcolor="#efefef"<%else%>bgcolor="#f9f9f9"<%end if%>>
<TR>
<TD valign=middle align=top width="100%">
--&nbsp;&nbsp;作者：<%=rs("username")%><br>
--&nbsp;&nbsp;发布时间：<%=rs("dateandtime")%><br><br>
--&nbsp;&nbsp;<%=htmlencode(rs("topic"))%><br>
<%=ubbcode(rs("body"))%>
<hr></TD></TR></TABLE> 
<%	rs.movenext
	loop	
	rs.close
	end sub
	set rs=nothing
%>
<!--#include file="bbsend.asp"-->