[ PHPXref.com ] [ Generated: Sun Jul 20 20:01:31 2008 ] [ PHPWind 4.3.2 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/upload/ -> rss.php (source)

   1  <?php
   2  error_reporting(0);
   3  define('D_P',__FILE__ ? dirname(__FILE__).'/' : './');
   4  
   5  $fid=(int)$_GET['fid'];
   6  $Rss_newnum=20;
   7  $Rss_listnum=20;
   8  $Rss_updatetime=10;
   9  $cache_path=D_P.'data/bbscache/rss_'.$fid.'_cache.xml';
  10  
  11  if(time()-@filemtime($cache_path) > $Rss_updatetime*60){
  12  
  13      require_once ('global.php');
  14      require_once (R_P.'require/rss.php');
  15      require_once(D_P.'data/bbscache/forum_cache.php');
  16  
  17      if($fid){
  18          $rt=$db->get_one("SELECT allowvisit,f_type FROM pw_forums WHERE fid='$fid'");
  19          if($rt['allowvisit'] != '' || $rt['f_type'] == 'hidden'){
  20              echo"<META HTTP-EQUIV='Refresh' CONTENT='0; URL=rss.php'>";exit;
  21          }
  22      }
  23  
  24      if($fid){
  25          $description="Latest $Rss_newnum article of ".$forum[$fid]['name'];
  26          $sql="WHERE t.fid='$fid' AND ifcheck=1 ORDER BY postdate DESC LIMIT $Rss_listnum";
  27      } else{
  28          $fids=$extra='';
  29          $query=$db->query("SELECT fid FROM pw_forums WHERE allowvisit='' AND f_type!='hidden'");
  30          while($rt=$db->fetch_array($query)){
  31              $fids.=$extra."'".$rt['fid']."'";
  32              $extra=',';
  33          }
  34  
  35          $description="Latest $Rss_newnum article of all forums";
  36          $sql="WHERE fid IN($fids) AND ifcheck=1 ORDER BY postdate DESC LIMIT $Rss_newnum";
  37      }
  38  
  39      $channel=array(
  40          'title'            =>  $db_bbsname,
  41          'link'            =>  $db_bbsurl,
  42          'description'    =>  $description,
  43          'copyright'        =>  "Copyright(C) $db_bbsname",
  44          'generator'        =>  "PHPWind BLOG by PHPWind Studio",
  45          'lastBuildDate' =>  date('r'),
  46      );
  47  
  48      $image = array(
  49          'url'          =>  "$imgpath/rss.gif",
  50          'title'          =>  'PHPWind Board',
  51          'link'          =>  $db_bbsurl,
  52          'description' =>  $db_bbsname,
  53      );
  54      $Rss = new Rss(array('xml'=>"1.0",'rss'=>"2.0",'encoding'=>$db_charset));
  55      $Rss->channel($channel);
  56      $Rss->image($image);
  57  
  58      $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");
  59      while($rt=$db->fetch_array($query)){
  60          $rt['content']=preg_replace("/\[post\](.+?)\[\/post\]/is","",$rt['content']);
  61          $rt['content']=preg_replace("/\[hide=(.+?)\](.+?)\[\/hide\]/is","",$rt['content']);
  62          $rt['content']=preg_replace("/\[sell=(.+?)\](.+?)\[\/sell\]/is","",$rt['content']);
  63          $rt['content']=substrs($rt['content'],300);
  64          $item = array(
  65              'title'       =>  $rt['subject'],
  66              'description' =>  $rt['content'],
  67              'link'        =>  "$db_bbsurl/read.php?tid=$rt[tid]",
  68              'author'      =>  $rt['author'],
  69              'category'    =>  $forum[$rt['fid']]['name'],
  70              'pubdate'     =>  date('r',$rt['postdate']),
  71          );
  72          $Rss->item($item);
  73      }
  74  
  75      $Rss->generate($cache_path);
  76  }
  77  header("Content-type: application/xml");
  78  @readfile($cache_path);
  79  exit;
  80  ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]