tiki-forums_rss.php 1.46 KB
Newer Older
1
<?php
changi67's avatar
changi67 committed
2 3 4
/**
 * @package tikiwiki
 */
5
// (c) Copyright 2002-2015 by authors of the Tiki Wiki CMS Groupware Project
6
//
7 8
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
changi67's avatar
changi67 committed
9
// $Id$
10

11
require_once ('tiki-setup.php');
12
$rsslib = TikiLib::lib('rss');
13

14
$access->check_feature('feature_forums');
15

16
if ($prefs['feed_forums'] != 'y') {
17 18
	$errmsg=tra("rss feed disabled");
	require_once ('tiki-rss_error.php');
19
}
20

m_stef's avatar
m_stef committed
21
$res=$access->authorize_rss(array('tiki_p_admin_forum','tiki_p_forum_read'));
22
if ($res) {
23 24 25 26 27 28
	if ($res['header'] == 'y') {
		header('WWW-Authenticate: Basic realm="'.$tikidomain.'"');
		header('HTTP/1.0 401 Unauthorized');
	}
	$errmsg=$res['msg'];
	require_once ('tiki-rss_error.php');
29 30
}

ohertel's avatar
ohertel committed
31
$feed = "forums";
mose's avatar
mose committed
32
$uniqueid = $feed;
33 34 35
$output = $rsslib->get_from_cache($uniqueid);

if ($output["data"]=="EMPTY") {
36 37
	$title = $prefs['feed_forums_title'];
	$desc = $prefs['feed_forums_desc'];
38
	$id = 'object';
39 40 41 42 43
	$param = "threadId";
	$descId = "data";
	$dateId = "commentDate";
	$authorId = "userName";
	$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 48
	$output = $rsslib->generate_feed($feed, $uniqueid, '', $changes, $readrepl, $param, $id, $title, $titleId, $desc, $descId, $dateId, $authorId);
}
49 50
header("Content-type: ".$output["content-type"]);
print $output["data"];