/** * forum rss feed, 10 latest topics in the forum * @param $forum_id forum id */ function getRssForum($forum_id) { global $gConf; $gConf['topics_per_page'] = 10; $gConf['date_format'] = '%a, %e %b %Y %k:%i:%s GMT'; $fdb = new DbForum(); $f = $fdb->getForum($forum_id); if (!$f) { exit; } $a = $fdb->getTopics($forum_id, 0); reset($a); $items = ''; $lastBuildDate = ''; while (list(, $r) = each($a)) { $lp = $fdb->getTopicPost($r['topic_id'], 'last'); $td = strip_tags($fdb->getTopicDesc($r['topic_id'])); if (!$lastBuildDate) { $lastBuildDate = $lp['when']; } $items .= <<<EOF \t\t\t<item> \t\t\t\t<title>{$r['topic_title']}</title> \t\t\t\t<link>{$gConf['url']['base']}index.php?action=goto&topic_id={$r['topic_id']}</link> \t\t\t\t<description>{$td}</description> \t\t\t\t<pubDate>{$lp['when']}</pubDate> \t\t\t\t<guid>{$gConf['url']['base']}index.php?action=goto&topic_id={$r['topic_id']}</guid> \t\t\t</item> EOF; } return <<<EOF <rss version="2.0"> \t<channel> \t\t<title>{$f['forum_title']}</title> \t\t<link>{$gConf['url']['base']}index.php?action=goto&forum_id={$forum_id}</link> \t\t<description>{$f['forum_desc']}</description> \t\t<lastBuildDate>{$lastBuildDate}</lastBuildDate>\t \t\t{$items} \t</channel> </rss> EOF; }
/** * forum rss feed, 10 latest topics in the forum * @param $forum_id forum id */ function getRssForum($forum_uri) { global $gConf; $gConf['topics_per_page'] = 10; $gConf['date_format'] = '%a, %e %b %Y %k:%i:%s GMT'; $fdb = new DbForum(); $f = $fdb->getForumByUri($forum_uri); $forum_id = $f['forum_id']; if (!$f) { exit; } $a = $fdb->getTopics($forum_id, 0); reset($a); $items = ''; $lastBuildDate = ''; while (list(, $r) = each($a)) { $lp = $fdb->getTopicPost($r['topic_id'], 'last'); $td = strip_tags($fdb->getTopicDesc($r['topic_id'])); if (!$lastBuildDate) { $lastBuildDate = $lp['when']; } $items .= "\n\t\t\t<item>\n\t\t\t\t<title>{$r['topic_title']}</title>\n\t\t\t\t<link>" . $gConf['url']['base'] . sprintf($gConf['rewrite']['topic'], $r['topic_uri']) . "</link>\n\t\t\t\t<description>{$td}</description>\n\t\t\t\t<pubDate>{$lp['when']}</pubDate>\n\t\t\t\t<guid>" . $gConf['url']['base'] . sprintf($gConf['rewrite']['topic'], $r['topic_uri']) . "</guid>\n\t\t\t</item>"; } return "\n<rss version=\"2.0\">\n\t<channel>\n\t\t<title>{$f['forum_title']}</title>\n\t\t<link>" . $gConf['url']['base'] . sprintf($gConf['rewrite']['forum'], $f['forum_uri'], 0) . "</link>\n\t\t<description>{$f['forum_desc']}</description>\n\t\t<lastBuildDate>{$lastBuildDate}</lastBuildDate>\t\n\t\t{$items}\n\t</channel>\n</rss>"; }