<%@ codepage ="936" %>
<!-- #include file="setup.asp" -->
<%
forumid=Request.querystring("forumid")
if isnumeric(""&forumid&"") = flase then
error("<li>非法操作")
end if
sql="select bbsname,PASS from bbsconfig where id="&forumid&""
rs.Open sql,Conn,0,1
if rs.eof then
message=message&"<li>数据库中不存在ID为 "&forumid&" 的数据"
error(""&message&"")
end if
bbsname=rs(0)
B_PASS=RS(1)
RS.close
b_id=Request.querystring("ID")
page=Request.querystring("page")
if page="" or page<0 then page=1
passre=Request.querystring("passre")
IF B_PASS<>"" and grade<>10 then
	IF passre="" THEN
		Conn.close
		set rs=nothing
		set rs1=nothing
		set conn=nothing
		response.write "<script>window.location.href='showtopic.asp?forumid=" & forumid & "&id=" & b_id & "&page=" & page & "&passre='+window.prompt('内部论坛 请输入访问密码\n※如果这是门派内部论坛请联系本门总掌门索取密码','')</script>"
		response.end
	ELSEIF B_PASS<>passre then
		error("拒绝访问：密码错误")
        end if
end if

if page="" then page=0

if b_id<>empty then
if isnumeric(b_id) = flase then
error("<li>非法操作")
end if
sql="select * from forum where ID="&b_id&" and forumid="&forumid&""
rs.Open sql,Conn,0,1
else
if isnumeric(""&page&"") = flase then
error("<li>非法操作")
end if
sql="select * from forum where forumid="&forumid&" and deltopic<>1 order by toptopic Desc,lasttime Desc"
rs.Open sql,Conn,0,1
RS.Move page
end if
if rs.eof or rs.bof then
error"<li>系统不存在该帖子的资料"
end if
if rs("deltopic")=1 then
error"<li>该主题已经被删除<li>该主题在回收站中"
end if
top
rusename=rs("username")
mypic2=rs("mypic2")
mpai2=rs("门派")
shenf2=rs("身份")
grade2=rs("管理")
dengj2=rs("战斗")
jhid=rs("jhid")
T_tviews=rs("views")
T_topic=rs("topic")
T_forumid=rs("forumid")
id=rs("id")
T_htmlcode=rs("htmlcode")
content=rs("content")
T_polltopic=rs("polltopic")
T_multiplicity=rs("multiplicity")
T_pollresult=rs("pollresult")
T_posttime=rs("posttime")
replies=rs("replies")
locktopic=rs("locktopic")
goodtopic=rs("goodtopic")
toptopic=rs("toptopic")
rs.close
'=========
%>
<title><%=T_topic%></title>
<script>
function copyText(obj,b_cmd) {var rng = document.body.createTextRange();rng.moveToElementText(obj);rng.select();rng.execCommand(b_cmd);}
function checkclick(msg){if(confirm(msg)){event.returnValue=true;}else{event.returnValue=false;}}
var i=0;
function formCheck(){
copyText(document.form.content,'Copy');document.form.submit1.disabled = true;
return true;
}
function presskey(eventobject){if(event.ctrlKey && window.event.keyCode==13){i++;if (i>1) {alert('帖子正在发出，请耐心等待！');return false;}this.document.form.submit();}}
</script>
<style>
TABLE{BORDER-TOP:0px;BORDER-LEFT:0px;BORDER-BOTTOM:1px}
TD{BORDER-RIGHT:0px;BORDER-TOP:0px}
.login {
	BORDER: #a4b6d7 1px solid;  FONT-SIZE: 9pt; BACKGROUND: #ffffff; 
}
</style>
<center>
<table width=100% align="center" border="0">
<tr>
<td vAlign="top" width="30%"></td>
<td vAlign="center" align="top">&nbsp;&nbsp;<img src="images/closedfold.gif" border="0">&nbsp;&nbsp;<a href="index.asp"><%=clubname%></a><br>
&nbsp;&nbsp;<img src="images/bar.gif" border="0"><img src="images/closedfold.gif" border="0">&nbsp;&nbsp;<a href="forumdisplay.asp?forumid=<%=forumid%>&passre=<%=passre%>"><%=bbsname%></a><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="images/bar.gif" border="0"><img src="images/openfold.gif" border="0">&nbsp;&nbsp;<%=T_topic%></td>
</tr>
</table>
<TABLE cellSpacing=0 cellPadding=0 width=100% align=center border=0>
<TBODY>
<TR>
<TD width=254 height=35>
<a href="newtopic.asp?forumid=<%=T_forumid%>">
<img alt="发表一个新主题" src="images/sbutton-post2.gif" border="0"></a>　<a href="retopic.asp?forumid=<%=T_forumid%>&id=<%=id%>"><img alt="回复帖子" src="images/newreply.gif" border="0"></a></TD>
<TD align=right width=496 height=35 valign="bottom"><font color="#333333">您是本帖第 <b><%=T_tviews%></b>
个阅读者</font>　&nbsp; 　
<a href="?forumid=<%=T_forumid%>&passre=<%=passre%>&page=<%=page-1%>"><img height="12" alt="浏览上一篇主题" src="images/prethread.gif" width="52" border="0"></a>　<a style="text-decoration: none" href="javascript:location.reload()"><img height="12" alt="刷新本主题" src="images/refresh.gif" width="40" border="0"></a>　<a href="?forumid=<%=T_forumid%>&passre=<%=passre%>&page=<%=page+1%>"><img height="12" alt="浏览下一篇主题" src="images/nextthread.gif" width="52" border="0"></a></font></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=100% align=center bgColor=a4b6d7 border=0>
<TBODY>
<TR>
<TD>
<TABLE cellSpacing=1 cellPadding=6 width="100%" border=0>
<TBODY></TBODY></TABLE></TD></TR></TBODY></TABLE>
<TABLE borderColor=a4b6d7 cellSpacing=0 cellPadding=0 width=100% align=center border=1>
<TBODY>
<TR bgColor=c4d4e5>
<TD width=532 bgColor=c4d4e5 height=25>
<table width="140%">
<tr>
<td>　<b>主题</B>：<%=T_topic%></td>
<td align="right">
<a href=javascript:window.print()><font color="#FFFFFF">[打印]</font></a>
<A href=javascript:window.external.AddFavorite(location.href,document.title)><font color="#FFFFFF">[收藏]</font></a>
</td>
</tr>
</table>
</TD></TR></TBODY></TABLE>
<%
if Request("topage")<2 then

if T_htmlcode=1 then
content="HTML代码如下:<BR><TEXTAREA cols=75 name=textfield rows=6>"&content&"</TEXTAREA><br><input type=""button""  value=""复制代码""  onclick=""copyText(document.all.textfield,'Copy');""  >"
end if
'''''''投票''''''''
if T_polltopic<>"" then
if T_multiplicity=1 then
multiplicity="checkbox"
else
multiplicity="radio"
end if
content=""&content&"<form action=postvote.asp?id="&id&" method=POST><input type=hidden value="&forumid&" name=forumid><table><tr><td><table width=220>"
vote=split(T_polltopic,"|")
for i = 0 to ubound(vote)
if not vote(i)="" then
content=""&content&"<tr><td height=22>"&i+1&".<input type="&multiplicity&" value="&i&" name=postvote>"&vote(i)&"</td></tr>"
end if
next
content=""&content&"</table></td><td><table width=100>"
allticket=0
vote=split(T_pollresult,"|")
for i = 0 to ubound(vote)
if not vote(i)="" then
content=""&content&"<tr><td height=22 valign=bottom>票数："&vote(i)&"</td></tr>"
allticket=vote(i)+allticket
end if
next
content=""&content&"</table></td><td><table width=200>"
vote=split(T_pollresult,"|")
for i = 0 to ubound(vote)
if not vote(i)="" and allticket<>0 then
content=""&content&"<tr><td height=22 valign=bottom><img src=images/red.gif width="&vote(i)/allticket*100&" height=10> ["&formatnumber(vote(i)/allticket*100)&"%]</td></tr>"
end if
next
content=""&content&"</table></td></tr><TR><TD align=center><INPUT type=submit value=' 投 票 '></TD><TD></TD><TD></TD></TR></table></form>"
end if
'''''''结束投票''''''''
%>
<TABLE borderColor=a4b6d7 cellSpacing=0 cellPadding=0 width=100% align=center border=1>
<TBODY>
<TR>
<TD vAlign=top align=left height=78>
<TABLE cellSpacing=0 cellPadding=3 width=100% border=0>
<TBODY>
<TR>
<TD vAlign=top width=150 bgColor=f2f8ff height=106>
<TABLE cellSpacing=0 cellPadding=0 width="90%" align=center border=0>
<TBODY>
<TR>
<TD align=left><br>
<table style="FILTER:glow(color=a4b6d7)">
<caption><b><font color=ffffff style=font-size:10pt><%=rusename%></font></b></caption>
</table></TD>
<TD align=left width=35></TD></TR>
<TR>
<TD align=left height=42 colspan="2"><IMG src="<%=mypic2%>"></TD></TR>
<TR>
<TD align=left height=17 colspan="2"><IMG src="pic/grade<%=grade2%>.gif"></TD></TR>
<TR>
<TD align=left height=54 colspan="2">门 派:<%=mpai2%><BR>身 份:<%=shenf2%><br>管 理 级:<%=grade2%><BR>战 斗 级:<%=dengj2%><BR></TD></TR></TBODY></TABLE></TD>
<TD vAlign=bottom align=middle width=9 bgColor=f2f8ff height=106>
<TABLE height="100%" cellSpacing=0 cellPadding=0 width=1 bgColor=a4b6d7>
<TBODY>
<TR>
<TD width=1></TD></TR></TBODY></TABLE></TD>
<TD vAlign=top align=left bgColor=f2f8ff height=106>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD colspan="3">
<IMG alt=查看<%=rusename%>的个人资料 src="images/profile.gif" border=0>
<img src="images/pm.gif" border="0" alt="发送短信息给<%=rusename%>">&nbsp;<a href="forumdisplay.asp?forumid=<%=T_forumid%>&passre=<%=passre%>&search=author&key=<%=rusename%>"><IMG alt="搜索<%=rusename%>在『<%=bbsname%> 』的所有主题" src="images/find.gif" border=0 ></a> 
<a href="javascript:copyText(document.all.yu,'Copy');">
<IMG alt=复制这个帖子 src="images/copy.gif" border=0></a>
<a href="retopic.asp?forumid=<%=T_forumid%>&id=<%=id%>&quote=1">
<IMG alt=引用回复这个帖子 src="images/reply.gif" border=0></a>&nbsp;<a href="retopic.asp?forumid=<%=T_forumid%>&id=<%=id%>"><img src="images/replynow.gif" border="0" alt="回复这个帖子"></a></TD></TR>
<TR>
<TD colspan="3">
<HR width="100%" color=#777777 SIZE=1>
</TD></TR>
<TR vAlign=top height=140>
<TD colspan="3" style=WIDTH:580;WORD-WRAP:break-word><br><span id=yu><%=content%></span><%=sign%></TD></TR>
<TR vAlign=top>
<TD height=7 colspan="3">
<HR width="100%" color=#777777 SIZE=1>
</TD></TR>
<TR vAlign=top>
<TD>
<a href="edittopic.asp?forumid=<%=T_forumid%>&id=<%=id%>">
<img src="images/edit.gif" border="0"></a>
<a onclick="checkclick('您确定要删除主题?')" style="text-decoration: none; color: #000000" href="manage.asp?menu=deltopic&id=<%=id%>&forumid=<%=forumid%>&bbsname=<%=bbsname%>">
<img src="images/del.gif" border="0"></a></TD>
<TD>
<img src=images/posttime.gif></font> 发表时间：<%=T_posttime%>　</TD>
<TD></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<%
end if

act=replace(T_topic," <font color=red>(荐)</font>","")
if len(act)>20 then act=left(act,20) & "..."
if replies > 0 then
pagesetup=15 '设定帖子每页的显示数量
sql="select * from reforum where topicid="&id&" order by id"
rs.Open sql,Conn,0,1
if rs.eof and replies<>0 then
conn.execute("update [forum] set replies=0 where id="&id&"")
htmlend
response.end
end if
If replies/pagesetup > (replies\pagesetup) then
TotalPage=(replies\pagesetup)+1
else TotalPage=(replies\pagesetup)
End If
PageCount= 0
RS.MoveFirst
if Request.QueryString("ToPage")<>"" then PageCount = cint(Request.QueryString("ToPage"))
if PageCount <=0 then PageCount = 1
if PageCount > TotalPage then PageCount = TotalPage
RS.Move (PageCount-1) * pagesetup
i=0
Do While Not RS.EOF and i<pagesetup
i=i+1
'=========
rusename=rs("username")
mypic2=rs("mypic2")
mpai2=rs("门派")
shenf2=rs("身份")
grade2=rs("管理")
dengj2=rs("战斗")
jhid=rs("jhid")
T_topic=rs("topic")
if rs("htmlcode")=1 then
content="<SCRIPT LANGUAGE=""JScript"">function copycode2(texx) {textRange = texx.createTextRange();textRange.execCommand(""Copy"");}</SCRIPT>HTML代码如下:<BR><TEXTAREA cols=75 name=textfield rows=6>"&rs("content")&"</TEXTAREA><br><input type=""button""  value=""复制代码""  onclick=""copycode2(textfield);""  >"
else
content=rs("content")
end if
%>
<TABLE borderColor=a4b6d7 cellSpacing=0 cellPadding=0 width=100% align=center border=1>
<TBODY>
<TR>
<TD vAlign=top align=left height=78>
<TABLE cellSpacing=0 cellPadding=3 width=100% border=0>
<TBODY>
<TR>
<TD vAlign=top width=150 bgColor=f2f8ff height=106>
<TABLE cellSpacing=0 cellPadding=0 width=90% align=center border=0>
<TBODY>
<TR>
<TD align=left><br>
<table style="FILTER:glow(color=a4b6d7)">
<caption><b><font color=ffffff style=font-size:10pt><%=rusename%></font></b></caption>
</table></TD>
<TD align=left width=35></TD></TR>
<TR>
<TD align=left height=42 colspan="2"><IMG src="<%=mypic2%>"></TD></TR>
<TR>
<TD align=left height=17 colspan="2"><IMG src="pic/grade<%=grade2%>.gif"></TD></TR>
<TR>
<TD align=left height=54 colspan="2">门 派:<%=mpai2%><BR>身 份:<%=shenf2%><br>管 理 级:<%=grade2%><BR>战 斗 级:<%=dengj2%><BR></TD></TR></TBODY></TABLE></TD>
<TD vAlign=bottom align=middle width=9 bgColor=f2f8ff height=106>
<TABLE height="100%" cellSpacing=0 cellPadding=0 width=1 bgColor=a4b6d7>
<TBODY>
<TR>
<TD width=1></TD></TR></TBODY></TABLE></TD>
<TD vAlign=top align=left  bgColor=f2f8ff height=106>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD colspan="3">
<IMG alt=查看<%=rusename%>的个人资料 src="images/profile.gif" border=0>
<img src="images/pm.gif" border="0" alt="发送短讯息给<%=rusename%>">&nbsp;<a href="forumdisplay.asp?forumid=<%=T_forumid%>&passre=<%=passre%>&search=author&key=<%=rusename%>"><IMG alt="搜索<%=rusename%>在『<%=bbsname%> 』的所有主题" src="images/find.gif" border=0 ></a>

<a href="javascript:copyText(document.all.yu<%=rs("id")%>,'Copy');">
<IMG alt=复制这个帖子 src="images/copy.gif" border=0></a>
<a href="retopic.asp?forumid=<%=T_forumid%>&id=<%=rs("topicid")%>&retopicid=<%=rs("id")%>&quote=1">
<IMG alt=引用回复这个帖子 src="images/reply.gif" border=0></a>&nbsp;<a href="retopic.asp?forumid=<%=T_forumid%>&id=<%=rs("topicid")%>&retopicid=<%=rs("id")%>"><img src="images/replynow.gif" border="0" alt="回复这个帖子"></a></TD></TR>
<TR>
<TD colspan=3>
<HR width="100%" color=777777 SIZE=1>
</TD></TR>
<TR vAlign=top>
<TD colspan=3> <font color=C0C0C0><%=T_topic%></font>
</TD></TR>
<TR vAlign=top height=120>
<TD colspan=3 style=WIDTH:580;WORD-WRAP:break-word><br><span id=yu<%=rs("id")%>><%=content%></span><%=sign%></TD></TR>
<TR vAlign=top>
<TD height=7 colspan="3">
<HR width="100%" color=#777777 SIZE=1>
</TD></TR>
<TR vAlign=top>
<TD>
<a href="edittopic.asp?forumid=<%=T_forumid%>&id=<%=id%>&retopicid=<%=rs("id")%>">
<img src="images/edit.gif" border="0"></a>
<a onclick="checkclick('您确定要删除回贴?')" style="text-decoration: none; color: #000000" href="manage.asp?menu=delretopic&id=<%=id%>&forumid=<%=forumid%>&retopicid=<%=rs("id")%>&bbsname=<%=bbsname%>">
<img src="images/del.gif" border="0"></a></TD>
<TD>
<img src=images/posttime.gif></font> 发表时间：<%=rs("posttime")%>　</TD>
<TD></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<%
RS.MoveNext
loop
RS.Close
end if

if TotalPage=0 then
TotalPage=1
PageCount=1
end if
%>
<div align="center">
<center>
<TABLE cellSpacing=4 cellPadding=0 width=100% border=0 style="border-collapse: collapse" bordercolor="#111111">
<TR>
<TD><b>本主题共有
<font color="#990000"><%=TotalPage%></font> 页</TD>
<TD align=right >页：[
<%
ii=PageCount-5
iii=PageCount+5
if ii < 1 then
ii=1
end if
if iii > TotalPage then
iii=TotalPage
end if
if PageCount > 6 then
Response.Write "<a href=?topage=1&"&passre="&passre&id="&id&"&forumid="&forumid&"&page="&Request("page")&">1</a> ... "
end if
for i=ii to iii
If i<>PageCount then
Response.Write " <a href=?topage="& i &"&passre="&passre&"&id="&id&"&forumid="&forumid&"&page="&Request("page")&">" & i & "</a> "
else
Response.Write " <font color=#000000><b>"&i&"</b></font> "
end if
next
if TotalPage > PageCount+5 then
Response.Write " ... <a href=?topage="&TotalPage&"&passre="&passre& "&id="&id&"&forumid="&forumid&"&page="&Request("page")&">"&TotalPage&"</a>"
end if
acturl= "showtopic.asp?forumid="&Request("forumid")& "&id="&id&"#" & bbsname & act
%>
]&nbsp;</TD></TR></TABLE>
</center>
</div>
<TABLE cellSpacing=0 width=100% align=center bgColor=a4b6d7 border=0>
<form name="form" method="post" action=addretopic.asp onsubmit="return formCheck()">
<input type="hidden" value="Re:<%=act%>" name=topic>
<input type="hidden" value="<%=id%>" name="id">
<input type="hidden" value="<%=forumid%>" name="forumid">
<TBODY>
<TR>
<TD height=1></TD></TR></TBODY></TABLE>
<div align="center">
<center>
<TABLE borderColor=a4b6d7 height=120 cellSpacing=0 cellPadding=5 width=100% border=1 style="border-collapse: collapse">
<TBODY>
<TR>
<TD width="158" bgColor=c4d4e5 height=20><B><FONT
color=#333333>&nbsp;快速回复主题</FONT></B></TD>
<TD width="585" bgColor=c4d4e5><B><FONT color=#333333>Re:<%=act%></FONT></B></TD></TR>
<TR>
<TD width="158" bgColor=e8f4ff height=20>&nbsp;用户名</TD>
<TD width="585" bgColor=e8f4ff>用户名：<%=nickname%></TD></TR>
<TR>
<TD width="158" bgColor=e8f4ff>
<INPUT type=checkbox value=1 name=htmlcode> HTML代码<BR>
<INPUT type=checkbox value=1 name=ybbcode> 禁止UBB代码<BR>
<INPUT type=checkbox value=1 name=autoURL checked> 分析网址<BR>
<INPUT type=checkbox value=1 name=autoEmail> 分析Email<BR>
</TD>
<TD vAlign=top align=middle width="585" bgColor=e8f4ff>
<TEXTAREA name=content rows=6 cols=79 onkeydown=presskey()></TEXTAREA> <BR><INPUT tabIndex=4 type=submit value="Ctrl+Enter 回 复 · 复 制" name=submit1>&nbsp; <INPUT type="button" onclick="javascript:copyText(document.form.content,'paste');" value=" 粘 贴 ">&nbsp; <INPUT type=reset value=" 重 写 " name=reset onclick="checkclick('该项操作要清除全部的内容，您确定要清除吗?')"></TD></TR></TBODY></TABLE>
</center>
</div>
</form>
<!-- #include file="inc/line.asp" -->
<%
if grade>4 then
%>
<TABLE cellSpacing=0 cellPadding=0 width=100% align=center border=0>
<TBODY>
<TR>
<TD align=middle>管理选项:
<%
response.write "<a href=manage.asp?menu=movenew&id="&id&"&forumid="&forumid&"&bbsname="&bbsname&">拉前主题</a> | "
if locktopic=1 then
response.write "<a href=manage.asp?menu=dellocktopic&id="&id&"&forumid="&forumid&"&bbsname="&bbsname&">开放主题</a>"
else
response.write "<a href=manage.asp?menu=locktopic&id="&id&"&forumid="&forumid&"&bbsname="&bbsname&">关闭主题</a>"
end if
response.write " | "
if toptopic=1 then
response.write "<a href=manage.asp?menu=deltoptopic&id="&id&"&forumid="&forumid&"&bbsname="&bbsname&">取消置顶</a>"
else
response.write "<a href=manage.asp?menu=toptopic&id="&id&"&forumid="&forumid&"&bbsname="&bbsname&">主题置顶</a>"
end if
response.write " | "
if instr(act," <font color=red>(荐)</font>")>0 then
response.write "<a href=manage.asp?menu=unrecommend&id="&id&"&forumid="&forumid&"&bbsname="&bbsname&">取消推荐</a>"
else
response.write "<a href=manage.asp?menu=recommend&id="&id&"&forumid="&forumid&"&bbsname="&bbsname&">推荐主题</a>"
end if
response.write " | "
if goodtopic=1 then
response.write "<a href=manage.asp?menu=delgoodtopic&id="&id&"&forumid="&forumid&"&bbsname="&bbsname&">移出精华区</a>"
else
response.write "<a href=manage.asp?menu=goodtopic&id="&id&"&forumid="&forumid&"&bbsname="&bbsname&">添加到精华区</a>"
end if
%>| <a href="move.asp?moveid=3&id=<%=id%>&forumid=<%=forumid%>">移动主题</a> |
<a onclick="checkclick('您确定要删除主题?')" href=manage.asp?menu=deltopic&id=<%=id%>&forumid=<%=forumid%>&bbsname=<%=bbsname%>>删除主题</a>
</TD></TR></TBODY></TABLE>
<%
end if
On Error Resume Next
conn.execute("update [forum] set views=views+1 where id="&id&"")
htmlend
%>