<!-- #include file="include/admin_onlogin.asp" -->
<%
index_url="rss"
tit_fir="RSS"
tit="RSS管理"
call admin_header(0,0)
%>
<tr><td align=center colspan=2 height=30>
  <table border=0>
  <tr>
  <td><a href='?'><%response.write tit%></a></td>
  </tr>
  </table>
</td></tr>
</table>
<%
call admin_table(1)

select case action
case "update"
  call joekoe_chk_update()
case else
  call joekoe_chk_main()
end select

sub joekoe_chk_update()
  dim inurl,temp1,tmp_title,tmp_img,tmp_record,tmp_table,tmp_where,tmp_url,tmp_topic
  sql="select top 1 m_id,m_index_url,m_mname,m_data_name,m_rss_record from admin_menu where m_on_rss=1 and m_id="&id
  set rs=joekoe_cms.exec(sql,1)
  if rs.eof then
    rs.close
    call admin_msg(tit_fir&"栏目（ID:"&id&"）不存在！","?",1)
    exit sub
  end if
  inurl=rs("m_index_url")
  tmp_img=inurl
  tmp_title=rs("m_mname")
  tmp_record=rs("m_rss_record")
  tmp_table=rs("m_data_name")
  tmp_where="hidden=1"
  select case inurl
  case "forum"
    tmp_table="bbs_topic"
    tmp_record="id,topic,username,tim,forum_id"
    tmp_where="forum_id<>999999999"
  end select
  sql="select top 20 "&tmp_record&" from "&tmp_table&" where "&tmp_where&" order by id desc"
  temp1="<?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>"&joekoe_cms.web_urls&"</link>" & _
        vbcrlf&"<language>zh-cn</language>" & _
        vbcrlf&"<docs>"&joekoe_cms.web_name&"</docs>" & _
        vbcrlf&"<generator>"&joekoe_cms.web_name&"</generator>"
  set rs=joekoe_cms.exec(sql,1)
  do while not rs.eof
    tmp_topic=rs(1)
    tmp_topic=replace(tmp_topic,"&","＆")
    tmp_topic=joekoe_cms.code_word(tmp_topic)
    tmp_url=inurl&"_view.asp?id="&rs(0)
    if inurl="forum" then
      tmp_url=inurl&"_view.asp?view_id="&rs(0)
    end if
    temp1=temp1&vbcrlf&vbcrlf&"<item>" & _
          vbcrlf&"<title>"&tmp_topic&"</title>" & _
          vbcrlf&"<link>"&joekoe_cms.web_urls&tmp_url&"</link>" & _
          vbcrlf&"<author>"&rs(2)&"</author>" & _
          vbcrlf&"<pubDate>"&rs(3)&"</pubDate>" & _
          vbcrlf&"</item>"
    rs.movenext
  loop
  rs.close
  temp1=temp1&vbcrlf&vbcrlf&"</channel>" & _
        vbcrlf&"</rss>"
  call create_file("xml/rss2_"&inurl&".xml",temp1)
  call admin_msg("成功更新栏目"&tit_fir&"（"&tmp_title&"）！","?",1)
end sub

sub joekoe_chk_main()
  dim m_index_url
  call admin_td(tit)
%>
<tr>
<td width='20%'>目前本系统支持<%response.write tit_fir%>的栏目</td>
<td width='80%'>
  <table cellspacing=1 cellpadding=3 class=table0>
  <tr align=center>
  <td class=td width='20%'>栏目名称</td>
  <td class=td width='65%'><%response.write tit_fir%>地址</td>
  <td class=td width='15%'>相关操作</td>
  </tr>
<%
  sql="select m_id,m_index_url,m_mname,m_data_name from admin_menu where m_on_rss=1 order by m_id"
  set rs=joekoe_cms.exec(sql,1)
  do while not rs.eof
    m_index_url=rs("m_index_url")
%>
  <tr align=center>
  <td><%response.write rs("m_mname")%></td>
  <td align=left><a href='xml/rss2_<%response.write m_index_url%>.xml' target=_blank><%response.write joekoe_cms.web_urls%>xml/rss2_<%response.write m_index_url%>.xml</a></td>
  <td><a href='?action=update&id=<%response.write rs("m_id")%>'>更新<%response.write tit_fir%></a></td>
  </tr>
<%
    rs.movenext
  loop
  rs.close
%>
  </table>
</td>
</tr>
<%
call admin_td("什么是"&tit_fir)
%>
<tr>
<td></td>
<td>
  <table border=0 cellspacing=0 cellpadding=2 width='100%'>
  <tr><td class=htd>　　RSS (Really Simple jkndication) 是一种用于发布和获取网络内容(例如头条新闻)的XML格式。使用RSS阅读器来阅读，你可以不用一个个去开页面，也能够很快地知道关注网络内容更新了没有。</td></tr>
  <tr><td class=htd>　　目前RSS有多个版本，如：0.90、0.91、0.92、0.93、0.94、1.0 和 2.0，而应用最广泛的有RSS 1.0 和 RSS 2.0 两个版本，本站遵循 <font class=red>RSS 2.0</font> 版本。</td></tr>
  </table>
</td>
</tr>
<%
end sub

%>