<!-- #include file="include/config.asp" -->
<!-- #include file="include/fir.asp" -->
<%
h_var3=5
dim rss_true,tmp_title,tmp_urls
dim forum_cnum,forum_num,dim_forum_data,dim_forum_config
forum_cnum=-1
rss_true=0
if forumid="" then forumid=0
call web_head(0,0,h_var3,0,0)
call rss_load()
'----------------------------中间 开始----------------------------
call rss_head()
select case int(rss_true)
case 1
  call rss_error("论坛（ID："&forumid&"）不存在或出现异常！")
case 2
  call rss_error("您没有浏览本论坛或认证论坛信息的权限！")
case else
  if int(forumid)>0 then
    if forum_data(5)=true then
      call rss_forum()
    else
      call rss_error("本论坛为不可发贴模式！")
    end if
  else
    call rss_forum()
  end if
end select
call rss_end()
'----------------------------中间 结束----------------------------
call forum_end()
call web_end(0,h_var3)

sub rss_error(errstr)
  response.write vbcrlf&vbcrlf&"<item>" & _
          vbcrlf&"<title><![CDATA[错误提示信息："&errstr&"]]></title>" & _
          vbcrlf&"<link><![CDATA["&tmp_urls&"]]></link>" & _
          vbcrlf&"<author><![CDATA["&tmp_title&"]]></author>" & _
          vbcrlf&"<pubDate>"&joekoe_cms.now_time&"</pubDate>" & _
          vbcrlf&"</item>"
end sub

sub forum_class_load()
  if forum_cnum>-1 then
    exit sub
  end if
    sql="select class_id,forum_id,forum_name,forum_f,forum_n,forum_w,forum_star,forum_parent,forum_power,forum_type,forum_pro,forum_user,forum_config from bbs_forum where forum_hidden=0 order by class_id,forum_order,forum_star"
    set rs=joekoe_cms.exec(sql,1)
    if rs.eof then
      Response.Write (Vbcrlf&CMS_Skin.skukong)
    else
      dim_forum_data=rs.getrows()
    end if
    rs.close
  if isarray(dim_forum_data) then
    forum_cnum=ubound(dim_forum_data,2)
  end if
end sub

function forum_data(fd_num)
  forum_data=dim_forum_data(fd_num,forum_num)
end function

sub rss_load()
  call forum_load()
  tmp_title=tit_fir
  tmp_urls=joekoe_cms.web_urls&"index.asp"
  if int(forumid)=0 then exit sub
  call forum_class_load()
  forum_num=-1
  for i=0 to forum_cnum
    if int(forumid)=dim_forum_data(1,i) then
      forum_num=i
      exit for
    end if
  next
  if forum_num<0 then
    rss_true=1
    exit sub
  end if
  tmp_title=tmp_title&" - "&forum_data(2)
  tmp_urls=joekoe_cms.web_urls&"list.asp?forum_id="&forumid
  dim_forum_config=split(forum_data(12),"|")
  tit=forum_data(2)&"（"&ftit&"）"
  if int(forum_data(9))>0 then
    for i=0 to dim_forum_num
      if int(forum_data(9))=int(i+1) then
        page_power=left(dim_forum(i),instr(dim_forum(i),":")-1)
        if login_mode<>"" then
          if forum_new_view_true(forum_data(9),forum_data(11))=false then
            rss_true=2
            exit sub
          end if
        else
          if forum_new_view_true(forum_data(9),forum_data(11))=false then
            rss_true=2
            exit sub
          end if
        end if
      end if
    next
  end if
end sub

sub rss_forum()
  dim tmp_topic,tmp_url
  sql="select top 20 id,topic,username,tim,forum_id from bbs_topic where"
  if int(forumid)>0 then
    sql=sql&" forum_id="&forumid
  else
    sql=sql&" forum_id<>999999999"
  end if
  sql=sql&" order by id desc"
  set rs=joekoe_cms.exec(sql,1)
  do while not rs.eof
    tmp_topic=joekoe_cms.code_word(rs(1))
    tmp_url="view.asp?forum_id="&rs(4)&"&view_id="&rs(0)
    response.write vbcrlf&vbcrlf&"<item>" & _
          vbcrlf&"<title><![CDATA["&tmp_topic&"]]></title>" & _
          vbcrlf&"<link><![CDATA["&joekoe_cms.web_urls&tmp_url&"]]></link>" & _
          vbcrlf&"<author><![CDATA["&rs(2)&"]]></author>" & _
          vbcrlf&"<pubDate>"&rs(3)&"</pubDate>" & _
          vbcrlf&"</item>"
    rs.movenext
  loop
  rs.close
end sub

sub rss_head()
  response.clear
  response.ContentType="text/xml"
  response.write "<?xml version=""1.0"" encoding=""gb2312""?>" & _
        vbcrlf&"<rss version=""2.0"">" & _
        vbcrlf&"<channel>" & _
        vbcrlf&"<title>"&joekoe_cms.web_name&" - "&tmp_title&"</title>" & _
        vbcrlf&"<description>"&joekoe_cms.web_name&"</description>" & _
        vbcrlf&"<link>"&tmp_urls&"</link>" & _
        vbcrlf&"<language>zh-cn</language>" & _
        vbcrlf&"<docs>"&joekoe_cms.web_name&"</docs>" & _
        vbcrlf&"<generator>"&joekoe_cms.web_name&"</generator>"
end sub

sub rss_end()
  response.write vbcrlf&vbcrlf&"</channel>" & _
        vbcrlf&"</rss>"&vbcrlf
  if isarray(dim_forum_data) then erase dim_forum_data
  if isarray(dim_forum_config) then erase dim_forum_config
end sub
%>