<!--#include file="bbstop.asp"-->
<%	dim rs,sql
	dim boardtype
    	dim foundErr 
    	dim ErrMsg
	dim boardid
	dim announceid
	dim username
	dim rootid
	dim topic
	dim star
	dim totalrec
	dim p
	dim tableback
	dim tabletitle
	dim tablebody
	dim atablebody
	dim tablefont
	dim tablecontent
	dim alertfont
	dim strAllowForumCode
	dim strAllowHTML
	dim strIMGInPosts
	dim strIcons
	dim strflash
	dim Forumlogo
	dim bgcolor
	dim istop
	dim ztop
	dim guestlist
    	foundErr = false
    	ErrMsg = ""
   	set rs=server.createobject("adodb.recordset")
	if memberclass = user_level7 or memberclass = user_level8 or memberclass = user_level9 then
		guestlist=""
	else
		guestlist=" lockboard<>2 and "
	end if
    	Rem ------包括版面的ID和页次------
    	call chkInput()
     	conn.execute("update bbs_content set hits=hits+1 where announceID="&AnnounceID&"")
	'Rs.open "Select topic from bbs_content Where announceID="&AnnounceID&"",conn,1,1
     	set rs=conn.execute("select topic,istop,ztop,isbest from bbs_content where announceID="&rootID&"")
	if not(rs.bof and rs.eof) then
		topic=rs("topic")
		istop=rs("istop")
		isbest=rs("isbest")
		ztop=rs("ztop")
	else
		foundErr = true
		ErrMsg=ErrMsg+"<br>"+"<li>您指定的贴子不存在</li>"
	end if
	rs.close
	sql="select boardtype,boardskin,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")
		boardskin=rs("boardskin")
		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
	response.cookies("lgcookie")("stats")="在"&boardtype&"浏览：" & htmlencode(topic)
%>
<!--#include file="bbsinc/code.asp"-->
<%
'	response.write request.cookies("lgcookie")("userclass")
'	response.end

    	if foundErr then
		call error()
	else
		call showPage()
	end if

	sub showPage()
		'on error resume next
		if foundErr then
			call error()
		else
			call announceinfo()
			call listpage()
			if founderr then call error()
		end if
		if err.number<>0 then err.clear
end sub
sub announceinfo()
%>
<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=#6330ff>会员社区首页</font></a>&nbsp;&gt;&gt;&nbsp;<a href="list.asp?boardid=<%=boardid%>"><font color=#6330ff><%=boardtype%></font></a>&nbsp;&gt;&gt;&nbsp;<font color=#6330ff><%=htmlencode(topic)%></font></td></tr>
</tr><tr><td height="1" bgcolor=#ff9900></td></tr>
<tr bgcolor=#ffffff>
<td valign=middle height=30><a href='announce.asp?boardid=<%=boardid%>'><img src="images/post.gif" border=0 alt="发表一个新主题"><a href='reannounce.asp?boardid=<%=boardid%>&rootid=<%=rootid%>&id=<%=announceid%>'><img src="images/rethread.gif" border=0 alt="回复本主题"></td>
</tr>
<tr bgcolor=#66cc00><td align="left" valign="middle" height=25 >&nbsp;<b>* 贴子主题</B>：<%=htmlencode(topic)%></td>
</tr>
</table>
<%
	sql="Select bbs_content.username,bbs_content.AnnounceID,bbs_content.boardID,bbs_content.UserName,bbs_content.Topic,bbs_content.dateandtime,bbs_content.body,bbs_content.Expression,bbs_content.ip,bbs_content.rootid,bbs_content.signflag,bbs_content.isbest,[huiyuan].mail,[huiyuan].homepage,[huiyuan].oicq,[huiyuan].sign,[huiyuan].userclass,[huiyuan].article,[huiyuan].face,[huiyuan].sj,[huiyuan].width,[huiyuan].height,[huiyuan].jifen from bbs_content,[huiyuan] where bbs_content.boardid="&boardid&" and bbs_content.rootid="&rootid&" and bbs_content.username=[huiyuan].huiyuan order by bbs_content.announceid"
	rs.open sql,conn,1,1
	if rs.eof and rs.bof then

	else
      		totalrec=rs.recordcount 
      		if star<1 then 
          		star=1 
      		end if 

      		if (star-1)*Maxtitlelist>totalrec then 
	   		if (totalrec mod Maxtitlelist)=0 then 
	     			star= totalrec \ Maxtitlelist
	   		else 
	      			star= totalrec \ Maxtitlelist + 1 
	   		end if 
      		end if 
       		if star=1 then 
			call showannounce()
       		else 
          		if (star-1)*Maxtitlelist<totalrec then
            			rs.move  (star-1)*Maxtitlelist
				call showannounce()
        		else 
	        		star=1 
				call showannounce()
	      		end if 
	   	end if 
	rs.close
	end if
	end sub

	sub showannounce()
	dim i
		i=0
       	do while not rs.eof
	if isbgcolor(i)=false then
		bgcolor=tablebody
	else
		bgcolor=atablebody
	end if
%>
<table cellpadding=2 cellspacing=0 border=0 width="762" align=center bgcolor=#efefef class=pian>
<tr><td>
	<table width=100% cellpadding=0 cellspacing=1 bgcolor="#FF9900">
	<tr bgcolor=#ffffff>
	<td valign="top" width=20% rowspan=2><img src="" width=0 height=4><BR>
<B>&nbsp;&nbsp;<a name="<%=rs("announceid")%>"><%=htmlencode(rs("username"))%></a></B><BR>
<%	if isnull(rs("face")) or rs("face")="" then
	response.write "&nbsp;&nbsp;<img src='faces/image1.gif' width='100' height='100'><br>"
	else
	response.write "&nbsp;&nbsp;<img src='"&rs("face")&"' width='"&rs("width")&"' height='"&rs("height")&"'><br>"
	end if
	if rs("userclass")=user_level1 then response.write "&nbsp;&nbsp;<img src=images/"&level1_pic&">"
	if rs("userclass")=user_level2 then response.write "&nbsp;&nbsp;<img src=images/"&level2_pic&">"
	if rs("userclass")=user_level3 then response.write "&nbsp;&nbsp;<img src=images/"&level3_pic&">"
	if rs("userclass")=user_level4 then response.write "&nbsp;&nbsp;<img src=images/"&level4_pic&">"
	if rs("userclass")=user_level5 then response.write "&nbsp;&nbsp;<img src=images/"&level5_pic&">"
	if rs("userclass")=user_level6 then response.write "&nbsp;&nbsp;<img src=images/"&level6_pic&">"
	if rs("userclass")=user_level7 then response.write "&nbsp;&nbsp;<img src=images/"&level7_pic&">"
	if rs("userclass")=user_level8 then response.write "&nbsp;&nbsp;<img src=images/"&level8_pic&">"
	if rs("userclass")=user_level9 then response.write "&nbsp;&nbsp;<img src=images/"&level9_pic&">"
%><br>
&nbsp;&nbsp;用户等级: <%=rs("userclass")%><BR>&nbsp;&nbsp;注册日期:<%=year(rs("sj"))%>-<%=month(rs("sj"))%>-<%=day(rs("sj"))%><BR>&nbsp;&nbsp;您的积分:<font color=red> <%=rs("jifen")%></font><BR>&nbsp;&nbsp;发表文章: <%=rs("article")%><img src="" width=0 height=4><BR></td>
	<td valign=top width=* height=95%><img src="" width=0 height=4><BR>&nbsp;
<%if membername<>"" then
	if rs("username")=membername or memberclass = user_level8 or memberclass = user_level9  then
%><a href="editannounce.asp?boardid=<%=boardid%>&rootid=<%=rs("rootid")%>&id=<%=rs("announceid")%>"><img src="images/edit.gif" border=0 alt="编辑这个贴子"> 编辑</a>
<%	end if
	end if%>&nbsp;&nbsp;<a href='messanger.asp?action=new&touser=<%=HTMLEncode(rs("username"))%>' target=_blank><img src="images/message.gif" border=0 width=16 height=16 alt="给<%=HTMLEncode(rs("username"))%>发送一个短消息"> 短消息</a>&nbsp;&nbsp;&nbsp;
<a href='dispuser.asp?name=<%=HTMLEncode(rs("username"))%>' target=_blank><img src="images/profile.gif" border=0 width=16 height=16 alt="查看admin的个人资料"> 查看</a>&nbsp;&nbsp;&nbsp;
<%if rs("mail")<>"" then%>
<A href="mailto:<%=htmlencode(rs("mail"))%>"><IMG alt="点击这里发送电邮给<%=HTMLEncode(rs("username"))%>" border=0 src="images/email.gif"> 邮件</A>&nbsp;&nbsp;&nbsp;
<%end if%>
<%if rs("homepage")<>"" then%>
<A href="http://<%=htmlencode(rs("homepage"))%>" target=_blank><IMG alt="访问<%=HTMLEncode(rs("username"))%>的主页"  border=0 src="images/homepage.gif"> 主页</A>&nbsp;&nbsp;&nbsp;
<%end if%>
<%if rs("oicq")<>"" then%>
<a href='http://search.tencent.com/cgi-bin/friend/user_show_info?ln=<%=htmlencode(rs("oicq"))%>' target=_blank><img src="images/oicq.gif" border=0 width=16 height=16 alt='<%=HTMLEncode(rs("username"))%>的OICQ状态和号码：<%=htmlencode(rs("oicq"))%>'>OICQ</a>  &nbsp;&nbsp;
<%end if%>
<a href="reannounce.asp?boardid=<%=boardid%>&rootid=<%=rs("rootid")%>&id=<%=rs("announceid")%>&reply=true"><img src="images/reply.gif" border=0 width=16 height=16 alt="引用回复这个贴子"> 引用回复</a>&nbsp;&nbsp;<a href="reannounce.asp?boardid=<%=boardid%>&rootid=<%=rs("rootid")%>&id=<%=rs("announceid")%>"><img src="images/replynow.gif" border="0" alt="回复贴子" width=16 height=16> 直接回复</a> 
<BR><hr width=100% size=1 color=#ff9900>
    	<table cellpadding=0 cellspacing=0 width=95% style="TABLE-LAYOUT: fixed">
    	<tr><td width=32 align=left valign=top><%if instr(rs("Expression"),"face")>0 then%>
<img src="images/<%=rs("Expression")%>" border=0 alt="发贴心情"><%end if%>&nbsp;</td>
    		<td style="LEFT: 0px; WIDTH: 100%; WORD-WRAP: break-word"><b><%=htmlencode(rs("topic"))%></b><br>
<%=ubbcode(rs("body"))%>
<%
if rs("signflag")=1 then
	if rs("sign")<>"" then
%>
<p><img src=images/singline.gif><br>
	<%=ubbcode(rs("sign"))%>
<%
	end if
end if
%></font></td>
    	<td width=16></td>
	</tr>
	</table>
	</td>
	</tr>
	<tr bgcolor=#f9f9f9>
	<td>&nbsp;发贴时间： <%=rs("dateandtime")%>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="images/ip.gif" border=0 width=13 height=15 alt=""> IP:已设置保密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="admin_postings.asp?action=dele&boardID=<%=boardID%>&ID=<%=rs("announceID")%>&rootid=<%=rs("rootID")%>" title="注意：本操作将删除单个贴子，不能恢复">删</a>  |  
<a href="admin_postings.asp?action=copy&boardID=<%=boardID%>&ID=<%=rs("announceID")%>&rootid=<%=rs("rootID")%>" title="复制单个贴子到别的版面">复</a>  |  
<%if rs("isbest")=0 then%>
<a href="admin_postings.asp?action=isbest&boardID=<%=boardID%>&ID=<%=rs("announceID")%>&rootid=<%=rs("rootID")%>" title="将单个贴子加入精华">精</a>
<%else%>
<a href="admin_postings.asp?action=nobest&boardID=<%=boardID%>&ID=<%=rs("announceID")%>&rootid=<%=rs("rootID")%>" title="解除本贴子精华状态">解</a><%end if%></td>
	</tr>
	</table>
</td>
</tr>
</table>
<% 	i=i+1
	if i>=Maxtitlelist then exit do
        rs.movenext
        loop
end sub

sub listpage()
  	dim n
  	if totalrec mod Maxtitlelist=0 then
     		n= totalrec \ Maxtitlelist
  	else
     		n= totalrec \ Maxtitlelist+1
  	end if
%>
<table border="0" bgcolor=#efefef cellpadding="0" cellspacing="0" width="762" align="center" class=pian>
<tr>
<td valign="middle" nowrap height=30>&nbsp;页次：<b><%=star%></b>/<b><%=n%></b>页 每页<b><%=Maxtitlelist%></b> 本主题贴数<b><%=totalrec%></b></td>
<td valign="middle" nowrap align=right>分页：
<%	for p=1 to n
	if p=star then
	response.write "[<b>"+Cstr(p)+"</b>] "
	else
	response.write "<a href='dispbbs.asp?boardid="&boardid&"&rootid="&rootid&"&id="&announceid&"&star="+Cstr(p)+"'>[<b>"+Cstr(p)+"</b>]</a>"
	end if
	next%>&nbsp;</td>
</tr>
</table>
<TABLE cellSpacing=0 cellPadding=4 width="762" border=0 align=center bgcolor=#cccccc class=pian onkeydown='if(event.keyCode==13 && event.ctrlKey)frmAnnounce.submit()'>
<form action="SaveReAnnounce.asp?method=fastreply&boardID=<%=boardid%>" method="POST"  name="frmAnnounce" >
<tr><td height=25 bgcolor=#66cc00 valign=middle colspan=2>&nbsp;&nbsp;<b>* 快速回复</b></td>
</tr>
<TR bgcolor=#f0fee0><TD noWrap align=center width=175><b>注意事项</b></TD>
	<TD>你的用户名:&nbsp;&nbsp;<input maxlength=25 size=15 value="<%=membername%>" name=username>&nbsp;&nbsp;<A href="reg.asp"><u>还没注册?</u></A> 密码:
	  <INPUT type=password maxLength=13 size=15 value="<%=memberword%>" name=passwd>&nbsp;&nbsp;<A href="lostpass.asp"><u>忘记密码?</u></A><input type="hidden" name="followup" value="<%=AnnounceID%>"><input type="hidden" name="rootID" value="<%=RootID%>"><INPUT TYPE="hidden" name="boardtype" value="<%=htmlencode(boardtype)%>"></TD>
</TR>
<TR bgcolor=#f0fee0>
	<TD vAlign=top noWrap><br>
 在此论坛中<br>
<li>HTML标签： <%if strAllowHTML=0 then%>不可用<%else%><font color=ff3300>允许</font><%end if%>
 <li>UBB标签： <%if strAllowForumCode=0 then%>不可用<%else%><font color=ff3300>允许</font><%end if%>
 <li>贴图标签： <%if strIcons=0 then%>不可用<%else%><font color=ff3300>允许</font><%end if%>
 <li>Flash标签： <%if strflash=0 then%>不可用<%else%><font color=ff3300>允许</font><%end if%>
 <li>表情字符转换： <%if strIMGInPosts=0 then%>不可用<%else%><font color=ff3300>允许</font><%end if%>
 <li>上传图片： <%if Uploadpic=0 then%>不可用<%else%><font color=ff3300>允许</font><%end if%>
 <li>最多<%=AnnounceMaxBytes\1024%>KB</TD>
	<TD><TEXTAREA style="WIDTH: 100%" name="body" rows=12 wrap=VIRTUAL title="可以使用Ctrl+Enter直接提交贴子"></TEXTAREA></TD>
</TR>
	<TR bgcolor=#f0fee0>
	<TD noWrap><INPUT type=checkbox value="yes" name="emailflag"> 邮件回复 <INPUT type=checkbox CHECKED value="yes" name="signflag"> 显示签名</TD>
	<TD width="100%" align=center><input type=Submit value="发表回复" name=Submit class="go-wenbenkuang"> &nbsp; <input type="reset" name="Clear" value="清空" class="go-wenbenkuang">  [<font color="#ff0000">Ctrl+Enter直接提交贴子</font>]</TD>
</FORM></TR></TABLE>
<%
	if err.number<>0 then err.clear
end sub

sub chkInput
	'on error resume next
	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 request("star")="" then
		star=1
	elseif not isInteger(request("star")) then
		star=1
	else
		star=request("star")
	end if
    	end sub

	function isbgcolor(num)
	n=num mod 2
	if n=1 then
		isbgcolor=true
	else
		isbgcolor=false
	end if
	end function
	set rs=nothing
%>
<TABLE cellSpacing=0 cellPadding=0 width="762" border=0 align=center class=pian>
<tr bgcolor=#f9f9f9>
<td width =100% align=right height=30>
<a href="admin_postings.asp?action=lock&boardID=<%=boardID%>&ID=<%=announceID%>&rootid=<%=rootID%>" title="锁定本主题">锁定</a> | 
<a href="admin_postings.asp?action=unlock&boardID=<%=boardID%>&ID=<%=announceID%>&rootid=<%=rootID%>" title="将本主题解开锁定">解锁</a> | 
<a href="admin_postings.asp?action=delete&boardID=<%=boardID%>&ID=<%=announceID%>&rootid=<%=rootID%>" title="注意：本操作将删除本主题所有贴子，不能恢复">删除</a> | 
<a href="admin_postings.asp?action=move&boardID=<%=boardID%>&ID=<%=announceID%>&rootid=<%=rootID%>" title="移动主题">移动</a> | 
<%if istop=0 then%>
<a href="admin_postings.asp?action=istop&boardID=<%=boardID%>&ID=<%=announceID%>&rootid=<%=rootID%>" title="将本主题固顶">固顶</a>|
<%else%>
<a href="admin_postings.asp?action=notop&boardID=<%=boardID%>&ID=<%=announceID%>&rootid=<%=rootID%>" title="将本主题固顶状态解除">解固</a>|
<%end if%>
<%if ztop=0 then%>
<a href="admin_postings.asp?action=ztop&boardID=<%=boardID%>&ID=<%=announceID%>&rootid=<%=rootID%>" title="将本主题总固顶">总固顶</a>
<%else%>
<a href="admin_postings.asp?action=noztop&boardID=<%=boardID%>&ID=<%=announceID%>&rootid=<%=rootID%>" title="将本主题总固顶状态解除">解总固</a>
<%end if%>
&nbsp;</td>
</tr>
</table>
<!--#include file="bbsend.asp"-->