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

Contents of /fenglin/www/rss.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.15 - (show annotations)
Fri Apr 11 12:47:39 2025 UTC (11 months ago) by sysadm
Branch: MAIN
Changes since 1.14: +2 -1 lines
Add session support

1 <?
2 require_once "../lib/db_open.inc.php";
3 require_once "../lib/common.inc.php";
4 require_once "../lib/lml.inc.php";
5 require_once "../bbs/session_init.inc.php";
6 ?>
7 <?
8 header ("Content-Type: text/xml; charset=UTF-8");
9 echo ("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
10 echo ("<?xml-stylesheet type='text/xsl' href='xml/rss.xsl' version='1.0'?>");
11 ?>
12 <?
13 $page_max_record=100;
14
15 $base_url = "http://" . $BBS_host_name;
16
17 if (isset($_GET["sid"]))
18 $sid=intval($_GET["sid"]);
19 else
20 $sid=0;
21
22 if (isset($_GET["view"]))
23 {
24 switch($_GET["view"])
25 {
26 case "normal":
27 $view="1=1";
28 break;
29 case "ex":
30 $view="excerption=1";
31 break;
32 default:
33 $view="1=1";
34 }
35 }
36 else
37 $view="1=1";
38
39 if (!isset($_GET["page"]))
40 $page=1;
41 else
42 $page=intval($_GET["page"]);
43
44 if ($page<1)
45 $page=1;
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/list.php?sid=".$sid; ?></link>
87 <language>zh-cn</language>
88 <docs></docs>
89 <generator>Rss Generator By <? echo $BBS_name; ?></generator>
90 <copyright>Copyright (C)<? echo $BBS_copyright_duration; ?> <? echo $BBS_host_name; ?>, All rights reserved</copyright>
91 <?
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 <title><? echo htmlspecialchars($row["title"], ENT_HTML401, 'UTF-8'); ?></title>
110 <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 <description><![CDATA[<? echo LML($content, true, false, 1024); ?>]]></description>
113 <author><? echo htmlspecialchars($row["username"], ENT_HTML401, 'UTF-8') ; ?> (<? echo htmlspecialchars($row["nickname"], ENT_HTML401, 'UTF-8'); ?>)</author>
114 <pubDate><? echo gmdate("D, d M Y H:i:s T",strtotime($row["sub_dt"])); ?></pubDate>
115 <annotate:reference><? echo $base_url."/bbs/view_article.php?id=".($row["TID"]==0?$row["AID"]:$row["TID"]); ?></annotate:reference>
116 </item>
117 <?
118 }
119 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