<!-- #include file="include/config.asp" -->
<!-- #include file="include/fir.asp" -->
<!-- #include file="include/main.asp" -->
<!-- #include file="../include/jk_pagecute.asp" -->
<!-- #include file="../include/jk_page_cute.asp" -->
<%
dim h1,max_num,nummer,nums,rssum,page,viewpage,thepages,username,sql_add,sql_order,pageurl
h1=0
max_num=200
iframe=true
nummer=dim_num(0)
nums=nummer
page=1
index_url="forum_action"
tit_fir="交流论坛"
if action="user" or action="user_join" then
  username=trim(request.querystring("username"))
  if symbol_name(username)=false then action=""
end if
select case action
case "my"
  tit="我发布的主题"
  h1=2
case "join"
  tit="我参与的主题"
  h1=2
case "user"
  max_num=0
  sql_add=" where username='"&username&"'"
  sql_order="id desc"
  tit="（"&username&"）发布的主题"
  h1=1
case "user_join"
  max_num=0
  sql_add=" where id in (select reply_id from bbs_data where username='"&username&"')"
  sql_order="id desc"
  tit="（"&username&"）参与的主题"
  h1=1
case "hot"
  sql_order="re_counter desc,id desc"
  tit="论坛热贴"
case "good"
  sql_add=" where isgood=1"
  sql_order="id desc"
  tit="论坛精华"
case "tim"
  tit="回复新贴"
  sql_order="re_tim desc,id desc"
case "top"
  sql_add=" where istop>0"
  sql_order="istop desc,id desc"
  tit="论坛置顶"
case else
  sql_order="id desc"
  tit="论坛新贴"
end select
call web_head(h1,0,h_var3,0,0)
ftit=tit
call forum_grade2()
select case action
case "my"
  max_num=0
  'sql_add=" where username='"&login_username&"'"
  sql_add=" where userid="&login_id
  sql_order="id desc"
  tit="我发布的主题"
case "join"
  max_num=0
  'sql_add=" where id in (select reply_id from bbs_data where username='"&login_username&"')"
  sql_add=" where id in (select reply_id from bbs_data where userid="&login_id&")"
  sql_order="id desc"
  tit="我参与的主题"
end select
%>

<table border=0 cellspacing=0 cellpadding=0 class=bbs_tablew>
<tr align=center valign=top>
<td width=200>
<%
call search_left()
%>
</td>
<td width=5></td>
<td width="*">
<%
'----------------------------中间 开始----------------------------
response.write replace(forum_main_head(),"bbs_table","bbs_tables")
%>
<tr  align=center>
<td class=bbs_td width=30>状态</td>
<td class=bbs_td width=*><%response.write img_skin("fk_plus")&"论坛主题（"&tit&"）"%></td>
<td class=bbs_td width=90>作者</td>
<td class=bbs_td width=70>回复/人气</td>
</tr>
<%
 if sql_add="" then
 sql_add=" where forum_id<>999999999 "
 else
 sql_add= sql_add & " and forum_id<>999999999 "
 end if
 
sql="select count(id) from bbs_topic "&sql_add
set rs=joekoe_cms.exec(sql,1)
rssum=rs(0)
rs.close
if rssum>max_num and max_num>0 then rssum=max_num
call format_pagecute()
sql="select top "&nummer*viewpage&" * from bbs_topic "&sql_add&" order by "&sql_order
call joekoe_cms.exec(sql,-1)
rs.open sql,conn,0,1
if rs.eof then
  nums=0
else
  if int(viewpage)>1 then rs.move (viewpage-1)*nummer
  if int(viewpage*nummer)>int(rssum) then nums=nummer-(viewpage*nummer-rssum)
end if
for i=1 to nums
  response.write vbcrlf&forum_topic_type(rs("id"),rs("forum_id"),joekoe_cms.code_html(rs("topic"),1,0),joekoe_cms.time_type(rs("tim"),2),rs("username"),rs("re_username"),joekoe_cms.time_type(rs("re_tim"),2),rs("counter"),rs("re_counter"),rs("istop"),rs("islock"),rs("isgood"),rs("isvote"),rs("vote_num"))
  rs.movenext
next
rs.close
pageurl="?action="&action&"&username="&username&"&"
%>
<tr><td class=bbs_trb colspan=9 height=<%response.write m_hei%>>
&nbsp;最近&nbsp;<font class=red><%response.write rssum%></font>&nbsp;贴<%response.write tit_fir%>
&nbsp;页次：<font class=red><%response.write viewpage%></font>/<font class=red><%response.write thepages%></font>&nbsp;
&nbsp;分页：<%response.write jk_pagecute(nummer,thepages,viewpage,pageurl,5,"#ff0000")%>
</td></tr>
<%
response.write forum_main_end()
response.write ukong
%>
<table align="center" width=100%><tr><td height=30><%response.write forum_img_topic%></td></tr></table>
<%

function forum_topic_type(t_id,t_forum_id,t_topic,t_tim,t_username,t_re_username,t_re_tim,t_counter,t_re_counter,t_istop,t_islock,t_isgood,t_isvote,t_vote_num)
  dim temp1
      dim isnew
  if topic_is_new(t_tim)="new" then 
  isnew="&nbsp;"&img_skin("ico_new")
  else
  isnew=""
  end if
  temp1=temp1&vbcrlf&"<tr class=bbs_tr align=center>" & _
              vbcrlf&"<td>"&base_forum_is(t_re_counter,t_islock,t_isvote,t_vote_num)&"</td>" & _
              vbcrlf&"<td align=left><a href='view.asp?forum_id="&t_forum_id&"&view_id="&t_id&"' target=_blank alt='<b>"&joekoe_cms.code_html(t_topic,1,0)&"</b><br>发表时间："&t_tim&"<br>最后回复："&t_re_username&"<br>回复时间："&t_re_tim&"'>"&joekoe_cms.code_html(t_topic,1,45)&isnew&"</td>" & _
              vbcrlf&"<td>"&format_user_name(t_username,0,"")&"</td>" & _
              vbcrlf&"<td class=tims>"&t_re_counter&"/"&t_counter&"</td>" & _
              vbcrlf&"</tr>"
  forum_topic_type=temp1
end function
'----------------------------中间 结束----------------------------
%>
</td></tr></table>
<%
call web_end(0,0)

function topic_is_new(t_time)
  dim isnew
  isnew=""
  if datediff("d",t_time,joekoe_cms.now_time)<2 then isnew="new"
  topic_is_new=isnew
end function
%>