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

Contents of /fenglin/www/rss.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.10 - (show annotations)
Thu Mar 6 07:39:50 2025 UTC (12 months, 1 week ago) by sysadm
Branch: MAIN
Changes since 1.9: +1 -1 lines
Remove BBS section class

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

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