/[LeafOK_CVS]/fenglin/www/rss.php
ViewVC logotype

Annotation of /fenglin/www/rss.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.12 - (hide annotations)
Tue Mar 18 07:11:18 2025 UTC (11 months, 4 weeks ago) by sysadm
Branch: MAIN
Changes since 1.11: +1 -8 lines
Refine

1 sysadm 1.1 <?
2     require_once "../lib/common.inc.php";
3 sysadm 1.10 require_once "../lib/lml.inc.php";
4 sysadm 1.1 ?>
5     <?
6 sysadm 1.8 header ("Content-Type: text/xml; charset=UTF-8");
7     echo ("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
8 sysadm 1.1 echo ("<?xml-stylesheet type='text/xsl' href='xml/rss.xsl' version='1.0'?>");
9     ?>
10     <?
11     $page_max_record=100;
12    
13     $base_url = "http://" . $BBS_host_name;
14    
15     if (isset($_GET["sid"]))
16     $sid=intval($_GET["sid"]);
17     else
18     $sid=0;
19    
20     if (isset($_GET["view"]))
21     {
22     switch($_GET["view"])
23     {
24     case "normal":
25     $view="1=1";
26     break;
27     case "ex":
28     $view="excerption=1";
29     break;
30     default:
31     $view="1=1";
32     }
33     }
34     else
35     $view="1=1";
36    
37     if (!isset($_GET["page"]))
38     $page=1;
39     else
40     $page=intval($_GET["page"]);
41    
42     if ($page<1)
43     $page=1;
44    
45     $db_conn=include "./db_open.inc.php";
46    
47     $rs=mysql_query("select section_config.* from section_config left join section_class".
48     " on section_config.CID=section_class.CID where SID=$sid and".
49     " section_config.enable and section_class.enable and".
50     " section_config.read_user_level<=1")
51     or die("Query section info error!");
52     if($row=mysql_fetch_array($rs))
53     {
54     $cid=$row["CID"];
55     $sid=$row["SID"];
56     $stitle=$row["title"];
57     }
58     else
59     {
60     exit();
61     }
62     mysql_free_result($rs);
63    
64     $rs=mysql_query("select count(*) as rec_count from bbs where SID=".
65     "$sid and visible and $view")
66     or die("Query section error!");
67    
68     $row=mysql_fetch_array($rs);
69     $toa=$row["rec_count"];
70    
71     mysql_free_result($rs);
72    
73     if ($toa==0)
74     $toa=1;
75    
76     $page_total=intval($toa/$page_max_record);
77     if (($toa % $page_max_record)>0)
78     $page_total++;
79     if ($page>$page_total)
80     $page=$page_total;
81     ?>
82     <rss version="2.0" xmlns:annotate="http://purl.org/rss/1.0/modules/annotate/">
83     <channel>
84     <title><? echo $stitle; ?></title>
85     <description><? echo $stitle; ?></description>
86     <link><? echo $base_url."/bbs/bbs.php?sid=".$sid; ?></link>
87     <language>zh-cn</language>
88     <docs></docs>
89     <generator>Rss Generator By FengLin</generator>
90 sysadm 1.8 <copyright>Copyright (C) 2003-2025 www.FengLin.info, All rights reserved</copyright>
91 sysadm 1.1 <?
92     $rs=mysql_query("SELECT * from bbs ".
93     "where SID=$sid and visible and ".
94     "$view order by sub_dt desc".
95     " limit ".($page-1)*$page_max_record.",$page_max_record")
96     or die("Query list error!");
97    
98     while($row=mysql_fetch_array($rs))
99     {
100     $rs_content=mysql_query("select content from bbs_content where CID=".$row["CID"])
101     or die("Read content error!");
102     if($row_content=mysql_fetch_array($rs_content))
103     $content=$row_content["content"];
104     else
105     $content="";
106     mysql_free_result($rs_content);
107     ?>
108     <item>
109 sysadm 1.11 <title><? echo htmlspecialchars($row["title"], ENT_HTML401, 'UTF-8'); ?></title>
110 sysadm 1.1 <link><? echo $base_url."/bbs/view_article.php?id=".($row["TID"]==0?$row["AID"]:$row["TID"]."#".$row["AID"]); ?></link>
111     <guid><? echo $base_url."/bbs/view_article.php?id=".($row["TID"]==0?$row["AID"]:$row["TID"]."#".$row["AID"]); ?></guid>
112 sysadm 1.12 <description><![CDATA[<? echo LML($content, true, false, 1024); ?>]]></description>
113 sysadm 1.11 <author><? echo htmlspecialchars($row["username"], ENT_HTML401, 'UTF-8') ; ?> (<? echo htmlspecialchars($row["nickname"], ENT_HTML401, 'UTF-8'); ?>)</author>
114 sysadm 1.7 <pubDate><? echo gmdate("D, d M Y H:i:s T",strtotime($row["sub_dt"])); ?></pubDate>
115 sysadm 1.1 <annotate:reference><? echo $base_url."/bbs/view_article.php?id=".($row["TID"]==0?$row["AID"]:$row["TID"]); ?></annotate:reference>
116     </item>
117 sysadm 1.11 <?
118     }
119 sysadm 1.1 mysql_free_result($rs);
120    
121     mysql_close($db_conn);
122     ?>
123     </channel>
124     </rss>

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1