$description = xmlEscape($description); $item = array('title' => $postTitle ? $postTitle : 'Re:' . $title, 'description' => $description, 'link' => $link, 'author' => $db_ceoemail . ' (' . $rt['author'] . ')', 'category' => strip_tags($rs['name']), 'pubDate' => date('r', $rt['postdate'])); $Rss->item($item); } $rssItems = ob_get_contents(); ob_end_clean(); $rssItems = $Rss->getItems(); $etag = md5($rssItems); if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && $etag == $_SERVER['HTTP_IF_NONE_MATCH']) { header("HTTP/1.0 304 Not Modified"); exit; } else { header('Etag:' . $etag); } header("Content-type: application/xml"); echo $Rss->getRss(); exit; } else { $cache_path = D_P . 'data/bbscache/rss_' . $fid . '_cache.xml'; if ($timestamp - pwFilemtime($cache_path) > $Rss_updatetime * 60) { L::loadClass('rss', 'utility', false); require_once D_P . 'data/bbscache/forum_cache.php'; if ($db_tlist) { @extract($db->get_one("SELECT MAX(tid) AS tid FROM pw_threads")); $pw_tmsgs = GetTtable($tid); } else { $pw_tmsgs = 'pw_tmsgs'; } if ($fid) { $rt = $db->get_one("SELECT allowvisit,f_type,password,forumsell\n\t\t\t\t\t\t\t\tFROM pw_forums \n\t\t\t\t\t\t\t\tWHERE fid=" . pwEscape($fid)); if (!$rt || $rt['allowvisit'] != '' || $rt['f_type'] == 'hidden' || trim($rt['password']) != '' || trim($rt['forumsell']) != '') {
public function classic() { $map = array("recommend" => array("commend.xml", "近期热点活动", "/board/recommend"), "bless" => array("bless.xml", "十大祝福", "/board/Blessing")); if (!isset($this->params['file'])) { $this->_stop(); } $key = strtolower(trim($this->params['file'])); if (!array_key_exists($key, $map)) { $this->_stop(); } $file = BBS_HOME . "/xml/" . $map[$key][0]; if (!file_exists($file)) { $this->_stop(); } $mTime = @filemtime($file); $this->cache(true, $mTime); $this->header("Content-Type: text/xml; charset=" . $this->encoding); $this->header("Content-Disposition: inline;filename={$key}.xml"); $this->_cache_read($key, $mTime); $channel = $items = array(); $channel['title'] = $map[$key][1]; $channel['description'] = $this->_siteName . $map[$key][1]; $channel['link'] = $this->_domain . $this->base . $map[$key][2]; $channel['language'] = "zh-cn"; $channel['generator'] = "nForum RSS Generator By xw"; if ($mTime > 0) { $channel['lastBuildDate'] = $mTime; } $ret = array(); $xml = simplexml_load_file($file); if ($xml == false) { return $ret; } foreach ($xml->hotsubject as $v) { $board = $v->o_board == "" ? $v->board : $v->o_board; $id = $v->o_groupid == 0 ? $v->groupid : $v->o_groupid; $link = $this->_domain . $this->base . '/article/' . $board . '/' . $id; $item = array("title" => nforum_fix_gbk(urldecode($v->title)), "link" => $link, "author" => $v->owner, "pubDate" => intval($v->time), "guid" => $link, "comments" => $link); try { $article = Article::getInstance(intval($v->groupid), Board::getInstance($v->board)); $item['description'] = "<![CDATA[" . XUBB::parse($article->getHtml()) . "]]>"; } catch (Exception $e) { } $items[] = $item; } $rss = new Rss($channel, $items); $out = $rss->getRss(); $this->_cache_write($key, $mTime, $out); echo $out; $this->_stop(); }