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

Contents of /fenglin/www/rss.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.13 - (show annotations)
Fri Mar 28 05:50:18 2025 UTC (11 months, 2 weeks ago) by sysadm
Branch: MAIN
Changes since 1.12: +1 -2 lines
Refine

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

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