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

Annotation of /fenglin/www/rss.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations)
Sat Oct 8 18:12:33 2005 UTC (20 years, 5 months ago) by sysadm
Branch: MAIN
CVS Tags: fenglin_1-0-0-0_MIL
RSS

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