<!-- #include file="setup.asp" -->
<!-- #include file="ubb.asp" -->
<%
top
id=int(Request("id"))
forumid=Conn.Execute("Select forumid From forum where id="&id)(0)
sql="select * from bbsconfig where id="&forumid&""
Set Rs=Conn.Execute(sql)
bbsname=rs("bbsname")
moderated=rs("moderated")
followid=rs("followid")
pass=rs("pass")
password=rs("password")
userlist=rs("userlist")
Set Rs = Nothing


if Request("action")="next" then
sql="select top 1 * from forum where id > "&id&" and forumid="&forumid&" and deltopic<>1"
elseif Request("action")="Previous" then
sql="select top 1 * from forum where id < "&id&" and forumid="&forumid&" and deltopic<>1 order by id Desc"
else
sql="select * from forum where ID="&id&""
end if
Set Rs=Conn.Execute(sql)

if rs.eof or rs.bof then error"<li>系统不存在该帖子的资料"
if rs("deltopic")=1 and membercode<4 then error"<li>该主题不存在！"
topic=ReplaceText(rs("topic"),"<[^>]*>","")
%>
<!-- #include file="inc/validate.asp" -->
<!-- #include file="inc/validate.asp" -->
<!-- ＱＱ魔幻表情显示脚本 start-->
<script language="JavaScript">
document.write("<span id='QQFace' style='position:absolute; width:0px; height:0px; z-index:99999; background-color: transparent; display: none; left: 0; top: 0;'></span> ");

var sw //传递定时
var sWidth=500 //定义表情显示的宽度
var sHeight=500 //定义表情显示的高度
var sTime=5000 //定义表情显示的时间

//显示表情
function ShowQQ(theSmilie){
  clearTimeout(sw);

  document.getElementById("QQFace").style.width=sWidth
  document.getElementById("QQFace").style.height=sHeight

  document.getElementById("QQFace").style.left=document.body.scrollLeft+(document.body.clientWidth-sWidth)/2
  document.getElementById("QQFace").style.top=document.body.scrollTop+(document.body.clientHeight-sHeight)/2

  var QQStr="images/qqmt/swf/"+theSmilie+".swf"
  document.getElementById("QQFace").innerHTML = '<OBJECT codeBase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%"><PARAM NAME=movie VALUE="'+ QQStr +'"><param name=menu value=false><PARAM NAME=quality VALUE=high><PARAM NAME=play VALUE=false><param name="wmode" value="transparent"><embed src="' + QQStr +'" quality="high" wmode="transparent" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="100%" height="100%"></embed>';
  QQFace.style.display=""

  sw=window.setTimeout("CloseQQ();",sTime);
}

//关闭表情
function CloseQQ(){
  QQFace.style.display="none"
  clearTimeout(sw);
}
//-->
</script>
<!-- ＱＱ魔幻表情显示脚本 end-->
<script src="inc/birth.js"></script>
<script src="inc/postpc.js"></script>
<script src="inc/ybbcode.js"></script>
<script src="showad.asp"></script>
<title><%=topic%></title>
<script>
function copyText(obj) {var rng = document.body.createTextRange();rng.moveToElementText(obj);rng.select();rng.execCommand('Copy');}
var i=0;
var badlist= "<%=badlist%>|<%=Request.Cookies("badlist")%>";
var moderated= "|<%=moderated%>|";
function emoticon(theSmilie){document.form.content.value += theSmilie + ' ';document.form.content.focus();}

function copyText(obj) {var rng = document.body.createTextRange();rng.moveToElementText(obj);rng.select();rng.execCommand('Copy');}
var i=0;

function presskey(eventobject){
if(event.ctrlKey && window.event.keyCode==13){
document.form.submit1.disabled = true;
this.document.form.submit();
}
}
var topic="<%=rs("topic")%>"
var topicid="<%=Request("ID")%>" 
</script>

<table border=0 width=97% align=center cellspacing=1 cellpadding=4 class=a2>
<tr class=a3>
<td height=25>&nbsp;<img src=images/Forum_nav.gif>&nbsp; <%ClubTree%> → <%ForumTree(followid)%><%=ForumTreeList%> <a href=ShowForum.asp?forumid=<%=forumid%>><%=bbsname%></a> → <%=topic%></td>
</tr>
</table><br>

<table cellspacing="0" cellpadding="0" width="97%" align="center" border="0"><tr><td height="35" valign="bottom"><a href="newtopic.asp?forumid=<%=rs("forumid")%>"><img alt="发表一个新主题" src="images/skins/<%=Request.Cookies("skins")%>/post.gif" border="0"></a>　<a href="retopic.asp?id=<%=rs("id")%>&topic=<%=topic%>"><img alt="回复帖子" src="images/skins/<%=Request.Cookies("skins")%>/reply.gif" border="0"></a></td><td align="right" height="35" valign="bottom"><font color="333333">您是本帖第 <b><%=rs("views")%></b> 个阅读者</font>　　<a href="?action=Previous&id=<%=rs("id")%>" title=浏览上一篇主题>上一篇</a>　<a style="text-decoration: none" href="javascript:location.reload()">刷新</a>　<a href="?action=next&id=<%=rs("id")%>" title=浏览下一篇主题>下一篇</a></font></td></tr></table>

<SCRIPT>valigntop()</SCRIPT>

<table width="97%" border="0" cellspacing="1" class="a2" height="21" align="center"><tr class="a1">
	<td width="100%" height="18">

	<table border="0" width="100%" cellspacing="0">
		<tr class="a1">
			<td><b>&nbsp;主题</b>：<%=topic%></td>
				<td align="right"> 
<a target=_blank href=print.asp?id=<%=id%> title='适合打印机打印的版本'>打印</a>&nbsp; 
<script>document.write("<a target=_blank href='mailto:?subject=<%=topic%>&body="+location.href+"'>");</script><font title="通过电子邮件发送此页面" color=black>邮件</font></a>&nbsp; 
<a href="javascript:window.external.AddFavorite(location.href,document.title)" title="添加加到IE收藏夹">收藏</a>&nbsp; 
<script>document.write("<a style=cursor:hand onclick=\"javascript:open('message.asp?menu=post&report=1&moderated=<%=moderated%>&body=【问题帖子】："+location.href+"','','width=320,height=170')\">");</script><font title="把此问题贴报告给版主" color=black>报告</font></a>&nbsp; 
</td></tr></table>
</td></tr></table>


<%
if Request("topage")<2 then
content=rs("content")
'#########################################################################
'插件编号:szhotdog_sppost
'插件名称:简单特殊贴(加强版)for BBSXP5.12,BBSXP5.1
'插件介绍:回复贴、购买贴、经验贴、帮派贴
'插件作者:szhotdog(MVP)修改作者：有熊氏新郑 QQ:414689875
'任何问题请登陆http://myl318.fangwen.cn
'##########################################################################

if instr(lcase(content),"[replyview]")>0 then
content="<span id=szhotdog_sppost>Loading...</span><iframe width=0 height=0 src=sppost.asp?id="&id&"></iframe>"
elseif instr(lcase(content),"[buy=")>0 then
content="<span id=szhotdog_sppost>Loading...</span><iframe width=0 height=0 src=sppost.asp?id="&id&"></iframe>"
elseif instr(lcase(content),"[point=")>0 then
content="<span id=szhotdog_sppost>Loading...</span><iframe width=0 height=0 src=sppost.asp?id="&id&"></iframe>"
elseif instr(lcase(content),"[fact=")>0 then
content="<span id=szhotdog_sppost>Loading...</span><iframe width=0 height=0 src=sppost.asp?id="&id&"></iframe>"
elseif instr(lcase(content),"[money=")>0 then
content="<span id=szhotdog_sppost>Loading...</span><iframe width=0 height=0 src=sppost.asp?id="&id&"></iframe>"
elseif instr(lcase(content),"[power=")>0 then
content="<span id=szhotdog_sppost>Loading...</span><iframe width=0 height=0 src=sppost.asp?id="&id&"></iframe>"
elseif instr(lcase(content),"[magicpower=")>0 then
content="<span id=szhotdog_sppost>Loading...</span><iframe width=0 height=0 src=sppost.asp?id="&id&"></iframe>"
end if
'##########################################################################

'''''''投票''''''''
if rs("polltopic")<>"" then
if rs("multiplicity")=1 then
multiplicity="checkbox"
else
multiplicity="radio"
end if
content=""&content&"<form action=postvote.asp?id="&rs("id")&" method=POST><table><tr><td><table>"
vote=split(rs("polltopic"),"|")
for i = 0 to ubound(vote)
if not vote(i)="" then
content=""&content&"<tr><td height=22 valign=bottom>"&i+1&".<input type="&multiplicity&" value="&i&" name=postvote id=postvote"&i&"><label for=postvote"&i&">"&vote(i)&"</label></td></tr>"
end if
next
content=""&content&"</table></td><td><table>"
allticket=0
vote=split(rs("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>"
vote=split(rs("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/bar/0.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 colspan=5 align=center><a href=postvote.asp?menu=look&id="&id&">[查看近日参与投票的用户列表]</a></td></TR></table></form>"
end if


'''''''结束投票''''''''
if membercode<4  and Request.Cookies("username")<>rs("username") and instr(moderated,Request.Cookies("username"))<=1 then
content=UBBCode(content)
end if

sql="select * from [user] where username='"&rs("username")&"'"
Set Rs1=Conn.Execute(sql)

landtime=datediff("d",rs1("landtime"),now)
if landtime<0 then
landtime=landtime*(-1)
end if


userxz=""
if not conn.execute("select * from bbsxz where username='"&rs1("username")&"'").eof then
if conn.execute("select * from bbsxz where username='"&rs1("username")&"'")(0)>0 then
set rs3=server.createobject("adodb.recordset")
rs3.open "select * from bbsxz where username='"&rs1("username")&"'",conn,1,1
for i=1 to 5
xxz=rs3("xz"&i&"")

if xxz<>"" and xxz<>"0" then
bftime=rs3("bftime"&i&"")
passname=rs3("passname"&i&"")
liyou=rs3("liyou"&i&"")
if isnull(passname) then
passname="无人颁发"
end if
if isnull(liyou) then
liyou="没有理由"
end if
pic=conn.execute("select pic from bbsryxz where id="&xxz&"")(0)
xzname=conn.execute("select name from bbsryxz where id="&xxz&"")(0)
userxz=userxz&"<img src="&pic&" title=勋章名称:"&xzname&">"
end if
next
rs3.close
set rs3=nothing
end if
end if


building=rs1("building")
%>
<script>ShowPost('yuzi','<%=rs("username")%>','<%=content%>','<%=rs("posttime")%>','<%=rs1("honor")%>','<%=rs1("userface")%>','<%=rs1("sex")%>','<%=rs1("birthday")%>','<%=rs1("experience")%>','<%=rs1("membercode")%>','<%=rs1("faction")%>','<%=rs1("consort")%>','<%=rs1("magicpower")%>','<%=rs1("power")%>','<%=rs1("money")%>','<%=rs1("savemoney")%>','<%=rs1("mypet")%>','<%=rs1("posttopic")+rs1("postrevert")%>','<%=rs1("regtime")%>','<%=rs1("userlife")%>',"<%=building%>",'<%=rs1("usermail")%>','<%=rs1("userhome")%>','<%=rs1("sign")%>','<%=rs1("myshow")%>','<%=rs1("show")%>','<%=rs("lock")%>',"<%=landtime%>","<%=rs1("car")%>",'<%=userxz%>');</script>
<%
end if
Set Rs1 = Nothing

id=rs("id")
act=rs("topic")
replies=rs("replies")
locktopic=rs("locktopic")
goodtopic=rs("goodtopic")
toptopic=rs("toptopic")
ReList=rs("ReList")

rs.close


if replies > 0 then


pagesetup=15 '设定每页的显示数量
TotalPage=cint(replies/pagesetup)  '总页数
if TotalPage < replies/pagesetup then TotalPage=TotalPage+1
PageCount = cint(Request.QueryString("ToPage"))
if PageCount < 1 then PageCount = 1
if PageCount > TotalPage then PageCount = TotalPage


if PageCount<2 then
sql="select top "&pagesetup&" * from [reforum"&ReList&"] where topicid="&id&" order by id"
Set Rs=Conn.Execute(sql)
else
sql="select * from [reforum"&ReList&"] where topicid="&id&" order by id"
rs.Open sql,Conn,1
end if


on error resume next  '找不到回帖时候忽略错误
if TotalPage>1 then RS.Move (PageCount-1) * pagesetup


if RS.EOF then
replies=conn.execute("Select count(id)from [reforum"&ReList&"] where topicid="&id&"")(0)
conn.execute("update [forum] set replies="&replies&" where id="&id&"")
end if



i=0
Do While Not RS.EOF and i<pagesetup
i=i+1


sql="select * from [user] where username='"&rs("username")&"'"
Set Rs1=Conn.Execute(sql)
landtime=datediff("d",rs1("landtime"),now)
if landtime<0 then
landtime=landtime*(-1)
end if

userxz=""
if not conn.execute("select * from bbsxz where username='"&rs1("username")&"'").eof then
if conn.execute("select * from bbsxz where username='"&rs1("username")&"'")(0)>0 then
set rs3=server.createobject("adodb.recordset")
rs3.open "select * from bbsxz where username='"&rs1("username")&"'",conn,1,1
for iz=1 to 5
xxz=rs3("xz"&iz&"")

if xxz<>"" and xxz<>"0" then
bftime=rs3("bftime"&iz&"")
passname=rs3("passname"&iz&"")
liyou=rs3("liyou"&iz&"")
if isnull(passname) then
passname="无人颁发"
end if
if isnull(liyou) then
liyou="没有理由"
end if
pic=conn.execute("select pic from bbsryxz where id="&xxz&"")(0)
xzname=conn.execute("select name from bbsryxz where id="&xxz&"")(0)
userxz=userxz&"<img src="&pic&" title=勋章名称:"&xzname&">"
end if
next
rs3.close
set rs3=nothing
end if
end if


building=rs1("building")
'if RS.EOF then conn.execute("delete from [reforum"&ReList&"] where username='"&rs("username")&"'")
%><script>var i=<%=i+(PageCount-1)*pagesetup%>;ShowPost('<%=rs("id")%>','<%=rs("username")%>','<%=rs("content")%>','<%=rs("posttime")%>','<%=rs1("honor")%>','<%=rs1("userface")%>','<%=rs1("sex")%>','<%=rs1("birthday")%>','<%=rs1("experience")%>','<%=rs1("membercode")%>','<%=rs1("faction")%>','<%=rs1("consort")%>','<%=rs1("magicpower")%>','<%=rs1("power")%>','<%=rs1("money")%>','<%=rs1("savemoney")%>','<%=rs1("mypet")%>','<%=rs1("posttopic")+rs1("postrevert")%>','<%=rs1("regtime")%>','<%=rs1("userlife")%>',"<%=building%>",'<%=rs1("usermail")%>','<%=rs1("userhome")%>','<%=rs1("sign")%>','<%=rs1("myshow")%>','<%=rs1("show")%>','<%=rs("lock")%>',"<%=landtime%>","<%=rs1("car")%>",'<%=userxz%>');</script>
<%
Set Rs1 = Nothing


RS.MoveNext
loop
RS.Close


end if


if TotalPage=0 then
TotalPage=1
PageCount=1
end if
%>
<SCRIPT>


//function window.onload(){if(eval("div"+id+".scrollHeight")>100){eval("div"+id+".style.height=100")}}

valignbottom()</SCRIPT>

<table cellspacing="4" cellpadding="0" width="97%" border="0" style="border-collapse: collapse" align=center><tr><td width="61%"><b>本主题共有 <font color="990000"><%=TotalPage%></font> 页 
	[
<script>
ShowPage(<%=TotalPage%>,<%=PageCount%>,"id=<%=id%>")
</script>

 ]</b></td><td width="39%" align="right">
<a href="favorites.asp?menu=add&url=topic&name=<%=id%>">收藏帖子</a> | <a href="favorites.asp?menu=del&url=topic&name=<%=id%>">取消收藏</a> | <a href="#">返回页首</a>
<!----------论坛跳转代码开始------------>
<select onchange="if(this.options[this.selectedIndex].value!=''){location=this.options[this.selectedIndex].value;}">
<option selected>跳转论坛至...</option><%xpBBSList(0)%></select>
<!----------论坛跳转代码结束----------->
</td></tr></table>
<%if Request.Cookies("username")<>"" then%><form name="form" method="post" action="retopic.asp"><input type="hidden" value="<%=id%>" name="id">
<input type=hidden name=username value="<%=Request.Cookies("username")%>">
<input type=hidden name=userpass value="<%=Request.Cookies("userpass")%>">


<input type="hidden" value="<%=act%>" name="topic">
<SCRIPT>valigntop()</SCRIPT>

<table cellspacing="1" cellpadding="5" width="97%" border="0" class="a2" align=center><tr><td width="23%" height="20" class="a1"><b>&nbsp;快速回复主题</b>&nbsp;<a href=zt.asp target=_blank><font color=red><b>转贴工具</b></font></a></td><td class="a1" width="80%"><b><%=act%></b></td></tr><tr><td class="a4" valign="bottom"><b>&nbsp;用户名</b>：<%=Request.Cookies("username")%> [<a href="login.asp?menu=out"><font color="000000">退出</font></a>]<br></td>

<td valign="top" class="a4" rowspan="2">

<TEXTAREA onkeydown="presskey();" style="width:85%" id="TDcontent" name=content rows=9 cols=70><%=Request.Form("content")%></TEXTAREA>

<br><input tabindex="4" type="submit" value="Ctrl+Enter 回复主题" name="submit1">　　<input name=preview type="submit" value=" 预 览 ">　　<input type="reset" value=" 重 写 " name="reset" onclick="{if(confirm('该项操作要清除全部的内容，您确定要清除吗?')){return true;}return false;}">&nbsp;&nbsp;<script>
function admin_Size(num,objname)
{
    var obj=document.getElementById(objname)
    if (parseInt(obj.rows)+num>=3) {
        obj.rows = parseInt(obj.rows) + num;    
    }
    if (num>0)
    {
        obj.width="90%";
    }
}
  </script><a href="javascript:admin_Size(-5,'TDcontent')"><img src=images/ybb/minus.gif unselectable=on border=0 alt='缩小长度'></a><a href="javascript:admin_Size(5,'TDcontent')"><img src=images/ybb/plus.gif unselectable=on border=0 alt='增加长度'></a>&nbsp;&nbsp;
<img border=0 src=images\ybb\image.gif onclick=YBBimage() alt="插入图片">&nbsp;&nbsp;&nbsp; <select onchange=ybbsize(this.options[this.selectedIndex].value)>
<OPTION>大小</OPTION>

<OPTION value=1>1</OPTION>
<OPTION value=2>2</OPTION>
<OPTION value=3>3</OPTION>
<OPTION value=4>4</OPTION>
<OPTION value=5>5</OPTION>
<OPTION value=6>6</OPTION>
<OPTION value=7>7</OPTION>
</SELECT>
</td></tr><tr>
			<td class="a4">
			
<TABLE cellSpacing=1 cellPadding=3 border=0 width=100%>
<tr vAlign=top width=100% class=a3 align=center><td>
<img src="Images/ybb/Previous.gif" onClick="Uemotion(-1)" title="上一页"></a> <a style="cursor:hand" onClick="Uemotion(0)" title='点击展开发贴表情'>打开表情</a><img src="Images/ybb/Next.gif" onClick="Uemotion(1)" title="下一页" ></TD></TR>
<TR>
<TD align=center width=100%>
<div id="Emview" align="center" style="BORDER:1px;width:90%;height=100;line-height:120%"></div>
<script defer>
var Ue=2;
function Uemotion(ue){
Emview.style.border="1px outset";
var  ue;
if (ue!=0){Ue=Ue+ue;}
if (Ue==4){Ue=1;}
if (Ue==0){Ue=4;}
var UEmview="";
for (i=(Ue-1)*16+1;i<=Ue*16&&i<=80;i++){
UEmview+="<a href=javascript:emoticon('[em"+i+"]')><img border=0 src=images/Emotions/"+i+".gif></a> 	";
if (i%4==0){
UEmview+="<br>";
}
}
document.all.Emview.innerHTML="<br>"+UEmview;
}
</script>
<%if yanzhengma>1 then%>
<B>验证码</B><input size="8" name="addcode" value name="addcode">&nbsp; <%=getcode1()%><%end if%>
</TD></TR>
</TABLE>

</table>
<SCRIPT>valignbottom()</SCRIPT>
</form>
<form name=preview action=preview.asp method=post target=preview_page><input name="content" type="hidden"></form>


<table cellspacing="0" cellpadding="0" width="97%" align="center" border="0"><tr><td align="middle">管理选项: <%
response.write "<a href=manage.asp?menu=movenew&id="&id&">拉前主题</a> | "
if locktopic=1 then
response.write "<a href=manage.asp?menu=dellocktopic&id="&id&">开放主题</a>"
else
response.write "<a href=manage.asp?menu=locktopic&id="&id&">关闭主题</a>"
end if
response.write " | "
if toptopic=2 then
response.write "<a href=manage.asp?menu=untop&id="&id&">取消总置顶</a>"
else
response.write "<a href=manage.asp?menu=top&id="&id&">主题总置顶</a>"
end if
response.write " | "
if toptopic=1 then
response.write "<a href=manage.asp?menu=deltoptopic&id="&id&">取消置顶</a>"
else
response.write "<a href=manage.asp?menu=toptopic&id="&id&">主题置顶</a>"
end if
response.write " | "
if goodtopic=1 then
response.write "<a href=manage.asp?menu=delgoodtopic&id="&id&">移出精华区</a>"
else
response.write "<a href=manage.asp?menu=goodtopic&id="&id&">添加到精华区</a>"
end if
%>| <a href="move.asp?id=<%=id%>">移动主题</a> | <a href="manage.asp?menu=deltopic&id=<%=id%>">删除主题</a> </td></tr></table><%end if%> 
</form>
<%
conn.execute("update [forum] set Views=Views+1 where id="&id&"")
%>
<table align=center><tr align=center><td>
标题标色：<a href="manage.asp?menu=color&id=<%=id%>&color=FF4500" style='FONT-FAMILY: Webdings; color=FF4500; '>a</a><a href="manage.asp?menu=color&id=<%=id%>&color=teal" style='FONT-FAMILY: Webdings; color=teal; '>a</a><a href="manage.asp?menu=color&id=<%=id%>&color=grey" style='FONT-FAMILY: Webdings; color=grey; '>a</a><a href="manage.asp?menu=color&id=<%=id%>&color=orange" style='FONT-FAMILY: Webdings; color=ORANGE; '>a</a><a href="manage.asp?menu=color&id=<%=id%>&color=red" style='FONT-FAMILY: Webdings; color=red; '>a</a><a href="manage.asp?menu=color&id=<%=id%>&color=buddhi" >取消标色</a>
</td></tr></table>



<%
Function getcode1()
	Dim test
	On Error Resume Next
	Set test=Server.CreateObject("Adodb.Stream")
	Set test=Nothing
	If Err Then
		Dim zNum
		Randomize timer
		zNum = cint(8999*Rnd+1000)
		Session("GetCode") = zNum
		getcode1= Session("GetCode")		
	Else
		getcode1= "<img src=""nccode.asp"">"		
	End If
End Function
%>
<!-- #include file="inc/line.asp" -->
<%


htmlend
%>
