📄 rss.php
字号:
<?php
error_reporting(0);
$fid=(int)$fid;
$Rss_newnum=20;
$Rss_listnum=20;
$Rss_updatetime=10;
$cache_path='./data/bbscache/rss_'.$fid.'_cache.php';
if(time()-@filemtime($cache_path) > $Rss_updatetime*60){
require_once('./global.php');
require_once('require/rss.php');
require_once(R_P.'data/bbscache/forum_cache.php');
if($fid){
$rt=$db->get_one("SELECT allowvisit,f_type FROM pw_forums WHERE fid='$fid'");
if($rt['allowvisit'] != '' || $rt['f_type'] == 'hidden'){
echo"<META HTTP-EQUIV='Refresh' CONTENT='0; URL=rss.php'>";exit;
}
}
if($fid){
$description="Latest $Rss_newnum article of ".$forum[$fid]['name'];
$sql="WHERE t.fid='$fid' AND ifcheck=1 ORDER BY postdate LIMIT $Rss_listnum";
} else{
$fids=$extra='';
$query=$db->query("SELECT fid FROM pw_forums WHERE allowvisit='' AND f_type!='hidden'");
while($rt=$db->fetch_array($query)){
$fids.=$extra."'".$rt['fid']."'";
$extra=',';
}
$description="Latest $Rss_newnum article of all forums";
$sql="WHERE fid IN($fids) AND ifcheck=1 ORDER BY postdate LIMIT $Rss_newnum";
}
$channel=array(
'title' => $db_bbsname,
'link' => $db_bbsurl,
'description' => $description,
'copyright' => "Copyright(C) $db_bbsname",
'generator' => "PHPWind BLOG by PHPWind Studio",
'lastBuildDate' => date('r'),
);
$image = array(
'url' => "$db_bbsurl/$imgpath/rss.gif",
'title' => 'PHPWind Board',
'link' => $db_bbsurl,
'description' => $db_bbsname,
);
Add_S($channel);
Add_S($image);
$Rss = new Rss();
$Rss->channel($channel);
$Rss->image($image);
$query=$db->query("SELECT t.tid,t.fid,t.subject,t.author,t.postdate,tm.content FROM pw_threads t LEFT JOIN pw_tmsgs tm ON tm.tid=t.tid $sql");
while($rt=$db->fetch_array($query)){
$rt['content']=substrs($rt['content'],300);
$rt['content']=preg_replace("/\[post\](.+?)\[\/post\]/eis","",$rt['content']);
$rt['content']=preg_replace("/\[hide=(.+?)\](.+?)\[\/hide\]/eis","",$rt['content']);
$rt['content']=preg_replace("/\[sell=(.+?)\](.+?)\[\/sell\]/eis","",$rt['content']);
$item = array(
'title' => $rt['subject'],
'description' => $rt['content'],
'link' => "$db_bbsurl/read.php?tid=$rt[tid]",
'author' => $rt['author'],
'category' => $forum[$rt['fid']]['name'],
'pubdate' => date('r',$rt['postdate']),
);
Add_S($item);
$Rss->item($item);
}
$Rss->generate($cache_path);
}
include_once($cache_path);
header("Content-type: application/xml");
echo $xml;exit;
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -