<!-- #include file="include/con_forum.asp" -->
<!-- #include file="include/con_forum_fir.asp" -->
<!-- #include file="include/con_forum_vote.asp" -->
<!-- #include file="include/jk_pagecute.asp" -->
<!-- #include file="include/jk_page_cute.asp" -->
<!-- #include file="include/jk_ip_sys.asp" -->
<!-- #include file="include/jk_ubb.asp" -->
<!-- #include file="include/jk_ubbtst.asp" -->
<!-- #include file="include/jk_val_code.asp" -->
<%
if not isnumeric(viewid) then
  call format_redirect("forum.asp")
end if

dim vdim,fir_topic,counter,re_counter,fir_istop,fir_isgood,fir_islock,fir_isvote,temp1,rnum,word,remark,ip,u_qq,u_email,u_url,u_popedom
dim nummer,nums,rssum,page,viewpage,thepages,pageurl,nnum,replyid,fm_15
pageurl="?forum_id=&view_id=&"
nummer=dim_num(1)
replyid=0
fm_15=format_mid_num(15)

sql="select top 1 forum_id,topic,counter,re_counter,islock,istop,isgood,isvote,vote_num from bbs_topic where id="&viewid
set rs=joekoe_cms.exec(sql,1)
if rs.eof then
  rs.close
  call format_redirect("forum_list.asp?forum_id="&forumid)
end if
forumid=rs(0)
fir_topic=joekoe_cms.code_html(rs(1),1,0)
counter=rs(2)
re_counter=rs(3)
fir_islock=rs(4)
fir_istop=rs(5)
fir_isgood=rs(6)
fir_isvote=rs(7)
fir_vote_num=rs(8)
rs.close


ftit="浏览主题 - "&joekoe_cms.code_html(fir_topic,1,20)&"" 
call forum_first()
call web_head(0,0,h_var3,0,0)
call forum_load(1,0,1,1)
response.write joekoe_cms.js_put("style/data_ads_txt_forum.js",0)
response.write joekoe_cms.js_put("style/ads_txt_function.js",0)

'----------------------------中间 开始----------------------------
call forum_grade()
call forum_top(tit)
if fir_isvote then call forum_vote_type()

sql="select bbs_data.id,bbs_data.topic,bbs_data.icon,bbs_data.word,bbs_data.tim,bbs_data.ip,bbs_data.sys," & _
    "user_data.username,user_data.nname,user_data.sex,user_data.whe,user_data.qq,user_data.email,user_data.url,user_data.face,user_data.face_w,user_data.face_h,user_data.tim as u_tim,user_data.remark,user_data.emoney,user_data.integral,user_data.power,user_data.last_tim,user_data.bbs_counter,user_data.popedom " & _
    "from user_data,bbs_data where user_data.id=bbs_data.userid and bbs_data.reply_id="&viewid&" order by bbs_data.id"
call joekoe_cms.exec("",-1)
rs.open sql,conn,1,1
if rs.eof then
  rs.close
  call format_redirect("forum_list.asp?forum_id="&forumid)
end if
rssum=re_counter+1	'rs.recordcount
call format_pagecute()
'rs.movefirst
nnum=(viewpage-1)*nummer
if int(viewpage)>1 then rs.move nnum
vdim=rs.getrows(nummer)
rs.close

response.write vbcrlf&forum_view_top

for i=0 to ubound(vdim,2)
  if replyid=0 then replyid=vdim(0,i)
  rnum=cint(joekoe_cms.rand_num(2))
  word=ubbtst(code_jk(vdim(3,i)))
  word=replace(word,"\n","<br>")
  remark=code_jk2(vdim(18,i))
  remark=replace(remark,"\n","<br>")
  u_popedom=vdim(24,i)
  if joekoe_cms.popedom_p(u_popedom,42)=1 then
    word="<table border=0><tr><td align=center class=htd><font class=gray>=========================<br><font class=red2><b>该用户的论坛发言已暂时被屏蔽！</b></font><br>=========================</font></td></tr></table>"
    remark=""
  end if
  ip=ip_types(vdim(5,i),"",0)
  if int(fm_15) then
    u_qq=vdim(11,i)
    u_email=joekoe_cms.code_html(vdim(12,i),1,0)
    u_url=joekoe_cms.code_html(vdim(13,i),1,0)
  else
    u_qq=""
    u_email=""
    u_url=""
  end if
  response.write vbcrlf&forum_view_body(nnum+i+1,rnum,vdim(0,i),joekoe_cms.code_html(vdim(1,i),1,0),vdim(2,i),word,joekoe_cms.time_type(vdim(4,i),1),ip,vdim(6,i),vdim(7,i),joekoe_cms.code_html(vdim(8,i),1,0),vdim(9,i),joekoe_cms.code_html(vdim(10,i),1,0),u_qq,u_email,u_url,joekoe_cms.code_html(vdim(14,i),1,0),vdim(15,i),vdim(16,i),joekoe_cms.time_type(vdim(17,i),1),remark,vdim(19,i),vdim(20,i),vdim(21,i),joekoe_cms.time_type(vdim(22,i),1),vdim(23,i))
next
erase vdim
call joekoe_cms.exec("update bbs_topic set counter=counter+1 where id="&viewid,0)

response.write vbcrlf&forum_view_end & _
	       vbcrlf&forum_view_reply(val_code_num("f_reply_"&forumid,1))
'----------------------------中间 结束----------------------------

call preview_form("write_frm","jk_word")
call forum_end()
call web_end(0,0)

function forum_view_top()
  dim temp1
  temp1=temp1&vbcrlf&"<table cellspacing=1 cellpadding=1 class=table>" & _
              vbcrlf&"<tr>" & _
              vbcrlf&"<td class=td width='80%'>&nbsp;主题："&fir_topic&"</td>" & _
              vbcrlf&"<td class=td wdith='20%' align=right valign=bottom>" & _
              vbcrlf&"  <table border=0 cellspacing=0 cellpadding=0>" & _
              vbcrlf&"  <tr>" & _
              vbcrlf&"  <td><a href='javascript:;' onclick=""javascript:open_win('forum_report.asp?forum_id="&forumid&"&view_id="&viewid&"','page_report',550,300,'no');""><img src='"&joekoe_cms.web_dir_skin&"forum/page_report.gif' alt='向版主报告本贴' border=0></a>&nbsp;&nbsp;</td>" & _
              vbcrlf&"  <td><a href='forum_print.asp?forum_id="&forumid&"&view_id="&viewid&"' target=_blank><img src='"&joekoe_cms.web_dir_skin&"forum/page_print.gif' alt='显示适合打印的页面' border=0></a>&nbsp;&nbsp;</td>" & _
              vbcrlf&"  <td><a href='javascript:;' onclick=""javascript:commend_friend2('"&tit&"','"&joekoe_cms.code_js(fir_topic,1)&"','"&server.urlencode("forum_view.asp?forum_id="&forumid&"&view_id="&viewid)&"');""><img src='"&joekoe_cms.web_dir_skin&"forum/page_commend.gif' alt='将本页推荐给我的好友' border=0></a>&nbsp;&nbsp;</td>" & _
              vbcrlf&"  <td><a href='javascript:;' onclick=""javascript:window.external.AddFavorite('"&joekoe_cms.web_url&"forum_view.asp?forum_id="&forumid&"&view_id="&viewid&"&','"&joekoe_cms.web_name&" - "&tit&" - "&joekoe_cms.code_js(fir_topic,1)&"');""><img src='"&joekoe_cms.web_dir_skin&"forum/page_fav.gif' alt='将本页加入收藏夹' border=0></a>&nbsp;&nbsp;</td>" & _
              vbcrlf&"  <td><a href='javascript:;' onclick=""javascript:document.location.reload();""><img src='"&joekoe_cms.web_dir_skin&"forum/page_refresh.gif' alt='刷新本页' border=0></a>&nbsp;&nbsp;</td>" & _
              vbcrlf&"  </tr>" & _
              vbcrlf&"  </table>" & _
              vbcrlf&"</td>" & _
              vbcrlf&"</tr>" & _
              vbcrlf&"</table>"
  forum_view_top=temp1
end function

function forum_view_body(v_i,v_rnum,v_id,v_topic,v_icon,v_word,v_tim,v_ip,v_sys,u_username,u_nname,u_sex,u_whe,u_qq,u_email,u_url,u_face,u_face_w,u_face_h,u_tim,u_remark,u_emoney,u_integral,u_power,u_last_time,u_bbs_counter)
  dim bg_var,n_user,temp1
  bg_var="bg_td"
  if (v_i mod 2)>1 then bg_var="bg_tds"
  n_user=joekoe_cms.code_html(u_username,1,0)
  temp1=temp1&vbcrlf&"<table cellspacing=1 cellpadding=1 class=table><tr class="&bg_var&">" & _
              vbcrlf&"<td width='20%' valign=top>" & _
              vbcrlf&"  <table border=0 width='98%'>" & _
              vbcrlf&"  <tr><td height=30><table border=0 class=tf width='100%'><tr align=center><td class=bw><font class=blue><b>"&n_user&"</b></font></td><td width=22>"&user_view_sex(u_sex,u_last_time)&"</td></tr></table></td></tr>" & _
              vbcrlf&"  <tr><td height=80 align=center>"&format_user_face(u_face,u_face_w,u_face_h)&"</td></tr>" & _
              vbcrlf&"  <tr><td>&nbsp;&nbsp;"&forum_user_power_grade(u_bbs_counter,u_power)
  if u_nname<>"" and var_null(u_nname)<>"" then temp1=temp1&"<br>&nbsp;&nbsp;头衔："&joekoe_cms.code_html(u_nname,1,0)
  temp1=temp1&"<br>&nbsp;&nbsp;贴子："&u_bbs_counter&"<br>&nbsp;&nbsp;积分："&u_integral&"<br>&nbsp;&nbsp;"&joekoe_cms.web_unit&"："&u_emoney
  if u_whe<>"" and var_null(u_whe)<>"" then temp1=temp1&"<br>&nbsp;&nbsp;来自："&joekoe_cms.code_html(u_whe,1,0)
  temp1=temp1&"<br>&nbsp;&nbsp;注册："&joekoe_cms.time_type(u_tim,4)&"</td></tr>"
  temp1=temp1&vbcrlf&"  <tr><td></td></tr>" & _
              vbcrlf&"  <tr><td></td></tr>" & _
              vbcrlf&"  </table>" & _
              vbcrlf&"</td>" & _
              vbcrlf&"<td width='80%'>" & _
              vbcrlf&"  <table border=0 width='99%' cellspacing=2 cellpadding=0 height='100%'>" & _
              vbcrlf&"  <tr height=25>" & _
              vbcrlf&"  <td width='85%'>"
  temp1=temp1&"<a target=_blank href='user_view.asp?username="&server.urlencode(u_username)&"'><img src='"&joekoe_cms.web_dir_skin&"forum/forum_profile.gif' alt='查看 "&n_user&" 的详细信息' border=0></a>&nbsp;"
  temp1=temp1&"<a target=_blank href='user_friend.asp?action=add&add_username="&n_user&"'><img src='"&joekoe_cms.web_dir_skin&"forum/forum_friend.gif' alt='将 "&n_user&" 加为我的好友' border=0></a>&nbsp;"
  temp1=temp1&"<a target=_blank href='user_mail.asp?action=msg_write&accept="&n_user&"'><img src='"&joekoe_cms.web_dir_skin&"forum/forum_message.gif' alt='给 "&n_user&" 发短信' border=0></a>&nbsp;"
  if u_email<>"" and var_null(u_email)<>"" then temp1=temp1&"<a target=_blank href='mailto:"&u_email&"'><img src='"&joekoe_cms.web_dir_skin&"forum/forum_email.gif' alt='给 "&n_user&" 发邮件' border=0></a>&nbsp;"
  if u_url<>"" and var_null(u_url)<>"" then temp1=temp1&"<a href='"&u_url&"' target=_blank><img src='"&joekoe_cms.web_dir_skin&"forum/forum_url.gif' alt='访问 "&n_user&" 的主页' border=0></a>&nbsp;"
  if u_qq<>"" and var_null(u_qq)<>"" then temp1=temp1&"<a href='http://wpa.qq.com/msgrd?V=1&Uin="&u_qq&"' target=_blank><img src='"&joekoe_cms.web_dir_skin&"forum/forum_qq.gif' alt='"&n_user&" 的QQ是："&u_qq&"' border=0></a>&nbsp;"
  temp1=temp1&"<a href='forum_edit.asp?forum_id="&forumid&"&view_id="&viewid&"&edit_id="&v_id&"'><img src='"&joekoe_cms.web_dir_skin&"forum/forum_edit.gif' alt='编辑这个贴子' border=0></a>&nbsp;"
  temp1=temp1&"<a href='forum_reply.asp?forum_id="&forumid&"&quote=yes&view_id="&viewid&"&reply_id="&v_id&"'><img src='"&joekoe_cms.web_dir_skin&"forum/forum_quote.gif' alt='引用并回复这个贴子' border=0></a>&nbsp;"
  temp1=temp1&"<a href='forum_reply.asp?forum_id="&forumid&"&view_id="&viewid&"&reply_id="&v_id&"'><img src='"&joekoe_cms.web_dir_skin&"forum/forum_reply.gif' alt='回复这个贴子' border=0></a>"
  temp1=temp1&"  </td>"
  temp1=temp1&vbcrlf&"  <td width='15%' align=center>第 <font class=red2><b>"&v_i&"</b></font> 楼</td>" & _
              vbcrlf&"  </tr>" & _
              vbcrlf&"  <tr><td colspan=2 height=1 class=bg_td></td></tr>" & _
              vbcrlf&"  <tr><td colspan=2 valign=top align=center>" & _
              vbcrlf&"    <table border=0 width='98%' class=tf>" & _
              vbcrlf&"    <tr><td height=30><img src='"&joekoe_cms.web_dir&"images/icon/"&v_icon&".gif' align=absMiddle border=0>&nbsp;<font class=red_3><b>"&joekoe_cms.code_html(v_topic,1,0)&"</b></font></td></tr>" & _
              vbcrlf&"    <tr><td class=bw><font class=htd>"&v_word&"</font></td></tr>" & _
              vbcrlf&"    </table>" & _
              vbcrlf&"  </td></tr>" & _
              vbcrlf&"  <tr><td colspan=2 height=20 align=right><img border=0 src='"&joekoe_cms.web_dir_skin&"forum/signature.gif' align=absmiddle>&nbsp;</td></tr>" & _
              vbcrlf&"  <tr><td colspan=2 height=30 align=center valign=top><table border=0 width='96%' class=tf><tr><td class=bw><font class=htd>"&u_remark&"</font></td></tr></table></td></tr>" & _
              vbcrlf&"  </table>" & _
              vbcrlf&"</td>" & _
              vbcrlf&"</tr>" & _
              vbcrlf&"<tr class="&bg_var&">" & _
              vbcrlf&"<td height=25>&nbsp;&nbsp;<img border=0 src='"&joekoe_cms.web_dir_skin&"forum/forum_tim.gif' align=absmiddle>&nbsp;<font class=gray>"&mid(v_tim,1,16)&"</font></td>" & _
              vbcrlf&"<td>" & _
              vbcrlf&"  <table border=0 width='100%'>" & _
              vbcrlf&"  <tr>" & _
              vbcrlf&"  <td>"&joekoe_cms.js_put("document.write (ads_txt_type("&v_rnum&",1));",1)&"</td>" & _
              vbcrlf&"  <td align=right>&nbsp;<a href='ip_address.asp?ip="&v_ip&"'><img src='"&joekoe_cms.web_dir_skin&"small/ip.gif' align=absMiddle alt='"&n_user&" 的IP是："&v_ip&"' border=0></a>&nbsp;&nbsp;<img src='"&joekoe_cms.web_dir_skin&"small/sys.gif' align=absMiddle alt='"&user_sys_type(v_sys)&"' border=0>&nbsp;"
  if v_i>1 and forum_power_true(forumpower)=true then temp1=temp1&"&nbsp;<a href='forum_isaction.asp?forum_id="&forumid&"&sel_id="&viewid&"&re_id="&v_id&"&action=del'><img src='"&joekoe_cms.web_dir_skin&"small/del2.gif' alt='删除此回贴' align=absMiddle border=0></a>&nbsp;"
  temp1=temp1&"</td>"
  temp1=temp1&vbcrlf&"  </tr>" & _
              vbcrlf&"  </table>" & _
              vbcrlf&"</td>" & _
              vbcrlf&"</tr>" & _
              vbcrlf&"</table>"
  forum_view_body=temp1
  call web_branch(0)
end function

function forum_view_end()
  dim temp1
  temp1=temp1&vbcrlf&"<table cellspacing=1 cellpadding=1 width='98%'>"
  if forum_power_true(forumpower) then
    temp1=temp1&vbcrlf&"<tr><td height=30 align=center>" & _
                vbcrlf&"  <table border=0 cellspacing=0 cellpadding=2>" & _
                vbcrlf&"  <form name=del_frm action='forum_isaction.asp' method=get onsubmit=""javascript:frm_submitonce(this);"">" & _
                vbcrlf&"  <input type=hidden name=forum_id value='"&forumid&"'>" & _
                vbcrlf&"  <input type=hidden name=sel_id value='"&viewid&"'>" & _
                vbcrlf&"  <tr>" & _
                vbcrlf&"  <td>状态：</td>" & _
                vbcrlf&"  <td>"&base_forum_isview(fir_isvote,fir_islock,re_counter,fir_istop,fir_isgood)&"</td>" & _
                vbcrlf&"  <td>管理：</td>" & _
                vbcrlf&"  <td><input type=radio name=action value='revert' checked>还原</td>" & _
                vbcrlf&"  <td><input type=radio name=action value='restore'>修复</td>" & _
                vbcrlf&"  <td><input type=radio name=action value='rap'>奖惩</td>" & _
                vbcrlf&"  <td><input type=radio name=action value='move'>转移</td>" & _
                vbcrlf&"  <td><input type=radio name=action value='istop'>固顶</td>" & _
                vbcrlf&"  <td><input type=radio name=action value='istops'>总固顶</td>" & _
                vbcrlf&"  <td><input type=radio name=action value='isgood'>精华</td>" & _
                vbcrlf&"  <td><input type=radio name=action value='islock'>锁定</td>" & _
                vbcrlf&"  <td><input type=radio name=action value='delete'>删除</td>" & _
                vbcrlf&"  <td width=5></td>" & _
                vbcrlf&"  <td><input type=submit value='执行操作'></td>" & _
                vbcrlf&"  </tr>" & _
                vbcrlf&"  </form>" & _
                vbcrlf&"  </table>" & _
                vbcrlf&"</td></tr>"
  end if
  temp1=temp1&vbcrlf&"<tr><td height=30>" & _
              vbcrlf&"  <table border=0 cellspacing=0 cellpadding=2 width='100%'>" & _
              vbcrlf&"  <tr>" & _
              vbcrlf&"  <td>本主题回复<font class=red>"&re_counter&"</font>贴，浏览<font class=red>"&counter&"</font>人次，分页："&jk_pagecute(nummer,thepages,viewpage,"?forum_id="&forumid&"&view_id="&viewid&"&",5,"#ff0000")&"</td>" & _
              vbcrlf&"  <td align=right>"&forum_go&"</td>" & _
              vbcrlf&"  </tr>" & _
              vbcrlf&"  </table>" & _
              vbcrlf&"</td></tr>" & _
              vbcrlf&"</table>"
  forum_view_end=temp1
  call web_branch(0)
end function

function forum_view_reply(vtext)
  dim temp1
  temp1=temp1&vbcrlf&"<table cellspacing=1 cellpadding=4 class=table>" & _
              vbcrlf&"<tr><td class=td0 colspan=2>&nbsp;→ 快速回复："&fir_topic&"</td></tr>"
  if login_mode="" then
    temp1=temp1&vbcrlf&"<tr><td class=bg_td colspan=2>&nbsp;&nbsp;"&web_nologin&"</td></tr>"
  elseif fir_islock=1 then
    temp1=temp1&vbcrlf&"<tr><td class=bg_td colspan=2>&nbsp;&nbsp;主题已被锁定，不能再对其进行回复。</td></tr>"
  else
    temp1=temp1&vbcrlf&"<form name=write_frm action='forum_reply.asp?forum_id="&forumid&"&view_id="&viewid&"&reply_id="&replyid&"' method=post onsubmit=""javascript:frm_submitonce(this);"">" & _
                vbcrlf&"<input type=hidden name=chk value='yes'>" & _
                vbcrlf&"<input type=hidden name=upid value=''>" & _
                vbcrlf&vtext & _
                vbcrlf&"<tr class=bg_td>" & _
                vbcrlf&"<td width='20%'>当前心情：</td>" & _
                vbcrlf&"<td width='80%'>"&jk_icon(0)&"</td>" & _
                vbcrlf&"</td>" & _
                vbcrlf&"</tr>" & _
                vbcrlf&"<tr class=bg_tds>" & _
                vbcrlf&"<td class=htd>贴子内容：<br>"&web_frm_word&"<br>长度<="&max_word&"KB</td>" & _
                vbcrlf&"<td><textarea name=jk_word rows=7 cols=93 alt='按 Ctrl+Enter 可直接发送' onkeydown=""javascript:frm_quicksubmit();""></textarea></td>" & _
                vbcrlf&"</tr>" & _
                vbcrlf&"<tr class=bg_td>" & _
                vbcrlf&"<td>E M 贴图：</td>" & _
                vbcrlf&"<td>&nbsp;"&jk_em("write_frm","jk_word")&"</td>" & _
                vbcrlf&"</tr>" & _
                vbcrlf&"<tr class=bg_tds>" & _
                vbcrlf&"<td>快速回复：</td>" & _
                vbcrlf&"<td><input type=submit value='快速发表我的回贴'>　&nbsp;"&preview_b("write_frm","jk_word","预览回复")&"　&nbsp;<input type=reset value='清除重写'>　&nbsp;（按 Ctrl + Enter 可快速回复）</td>" & _
                vbcrlf&"</tr>" & _
                vbcrlf&"</form>"
  end if
  temp1=temp1&vbcrlf&"</table>"
  forum_view_reply=temp1&ukong
end function
%>