1<?php
2/**
3 * @package tikiwiki
4 */
5// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
6//
7// All Rights Reserved. See copyright.txt for details and a complete list of authors.
8// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
9// $Id$
10
11require_once('tiki-setup.php');
12$rsslib = TikiLib::lib('rss');
13
14$access->check_feature('feature_forums');
15
16if ($prefs['feed_forums'] != 'y') {
17	$errmsg = tra("rss feed disabled");
18	require_once('tiki-rss_error.php');
19}
20
21$res = $access->authorize_rss(['tiki_p_admin_forum','tiki_p_forum_read']);
22if ($res) {
23	if ($res['header'] == 'y') {
24		header('WWW-Authenticate: Basic realm="' . $tikidomain . '"');
25		header('HTTP/1.0 401 Unauthorized');
26	}
27	$errmsg = $res['msg'];
28	require_once('tiki-rss_error.php');
29}
30
31$feed = "forums";
32$uniqueid = $feed;
33$output = $rsslib->get_from_cache($uniqueid);
34
35if ($output["data"] == "EMPTY") {
36	$title = $prefs['feed_forums_title'];
37	$desc = $prefs['feed_forums_desc'];
38	$id = 'object';
39	$param = "threadId";
40	$descId = "data";
41	$dateId = "commentDate";
42	$authorId = "userName";
43	$titleId = "title";
44	$readrepl = 'tiki-view_forum_thread.php?forumId=%s&comments_parentId=%s';
45
46	$changes = $tikilib ->list_recent_forum_topics($prefs['feed_forums_max']);
47	$output = $rsslib->generate_feed($feed, $uniqueid, '', $changes, $readrepl, $param, $id, $title, $titleId, $desc, $descId, $dateId, $authorId);
48}
49header("Content-type: " . $output["content-type"]);
50print $output["data"];
51