<!-- #Include File="Include/Config.asp" -->
<!-- #include file="Include/Con_bbs_Fir.asp" -->
<%

'=======================================================
' 欢迎使用《阿赛大型门户网站系统V3.0》，简称“AsaiMHV3”
' 技术支持、商业版咨询、官方唯一指定联系QQ“4941172”
' 官方网站：http://77ya.com      程序负责人：阿赛
'=======================================================

tit_fir=Cls.ChannelName
Dim rss_true,tmp_title,tmp_url,tmp_urls
rss_true=0

Call DoWebHead(0,0)
Call Rss_Load()
'----------------------------中间 开始----------------------------
Call Rss_Head()
Select case int(rss_true)
case 1
  Call Rss_Error("论坛（ID："&Bbsid&"）不存在或出现异常！")
case 2
  Call Rss_Error("您没有浏览本论坛信息的权限！")
case 3
  Call Rss_Error("您没有浏览本认证论坛的权限！")
case else
  if int(Bbsid)>0 then
    if bbs_data(5)=true then
      Call Rss_Bbs()
    else
      Call Rss_Error("本论坛为不可发贴模式！")
    end if
  else
    Call Rss_Bbs()
  end if
end Select
Call Rss_End()
'----------------------------中间 结束----------------------------
Call bbs_end()
Call DoWebEnd()

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>"&Cls.now_time&"</pubDate>" & _
          vbcrlf&"</item>"
end sub

sub Rss_Load()
  tmp_title=tit_fir
  tmp_url=Cls.web_urls&Index_Url&"Xml.asp"
  'tmp_urls=Cls.web_urls&Index_Url
  if int(Bbsid)=0 then exit sub
  Call bbs_class_load()
  bbs_num=-1
  for i=0 to bbs_cnum
    if int(Bbsid)=int(Cls.cache_get("bbs_class")(1,i)) then
      bbs_num=i
      exit for
    end if
  next
  if bbs_num<0 then
    rss_true=1
    exit sub
  end if
  tmp_title=tmp_title&" - "&bbs_data(2)
  tmp_url=Cls.web_urls&Index_Url&"Xml.asp?fid="&Bbsid
  tmp_urls=Cls.web_urls&Index_Url&"List.asp?fid="&Bbsid
  if int(bbs_data(9))>0 then
    for i=0 to Dim_bbs_num
      if int(bbs_data(9))=int(i+1) then
        page_power=left(Dim_Bbs(i),instr(Dim_Bbs(i),":")-1)
        if Is_LoginTrue=true then
          if instr("."&page_power&".","."&login_modep&".")<1 then
            rss_true=2
            exit sub
          end if
        else
          if instr("."&page_power&".",".0.")<1 then
            rss_true=2
            exit sub
          end if
        end if
      end if
    next
  end if
  is_super=bbs_power_true(bbs_data(8))
  if int(bbs_data(9))=0 then
    if is_super=false and (login_username="" or instr(","&lcase(Cls.cache_get("bbs_class")(11,bbs_num))&",",","&lcase(login_username)&",")=0) then
      rss_true=3
      exit sub
    end if
  end if
end sub

sub Rss_Bbs()
  Dim tmp_topic,tmp_url
  sql="Select top 20 id,topic,username,tim,bbs_id from AsaiMHBbsTopic where"
  if int(Bbsid)>0 then
    sql=sql&" bbs_id="&Bbsid
  else
    sql=sql&" bbs_id<>999999999"
  end if
  sql=sql&" order by id desc"
  set rs=Cls.exec(sql,1)
  do while not rs.eof
    tmp_topic=Cls.code_word(rs(1))
    tmp_url=Index_Url&"View.asp?id="&rs(0)
    response.write vbcrlf&vbcrlf&"<item>" & _
          vbcrlf&"<title><![CDATA["&tmp_topic&"]]></title>" & _
          vbcrlf&"<link><![CDATA["&Cls.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&"<?xml-stylesheet type=""text/xsl"" href="""&Cls.Web_Dir&"style/rss.xsl"" version=""1.0""?>" & _
        vbcrlf&"<rss version=""2.0"">" & _
        vbcrlf&"<channel>" & _
        vbcrlf&"<title>"&Cls.web_name&" - "&tmp_title&"</title>" & _
        vbcrlf&"<description>"&Cls.web_name&"</description>" & _
        vbcrlf&"<link>"&tmp_urls&"</link>" & _
        vbcrlf&"<language>zh-cn</language>" & _
        vbcrlf&"<Currentlink><![CDATA["&tmp_url&"]]></Currentlink>" & _
        vbcrlf&"<docs>"&Cls.web_name&"</docs>" & _
        vbcrlf&"<generator>"&Cls.web_name&"</generator>" & _
        vbcrlf&"<image>" & _
        vbcrlf&"  <title><![CDATA["&Cls.web_name&"]]></title>" & _
        vbcrlf&"  <url>"&Cls.Web_Dir&"images/logo.gif</url>" & _
        vbcrlf&"  <link>"&Cls.Web_Dir&"</link>" & _
        vbcrlf&"</image>"
end sub

sub Rss_End()
  response.write vbcrlf&vbcrlf&"</channel>" & _
        vbcrlf&"</rss>"&vbcrlf
end sub
%>
