tiki-forums_rss.php 1.51 KB
Newer Older
1
<?php
changi67's avatar
changi67 committed
2
// (c) Copyright 2002-2012 by authors of the Tiki Wiki CMS Groupware Project
changi67's avatar
changi67 committed
3
// 
4 5
// 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
6
// $Id$
7

8 9
require_once ('tiki-setup.php');
require_once ('lib/tikilib.php');
10
require_once ('lib/rss/rsslib.php');
11

12
$access->check_feature('feature_forums');
13

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

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

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

if ($output["data"]=="EMPTY") {
34 35
	$title = $prefs['feed_forums_title'];
	$desc = $prefs['feed_forums_desc'];
36
	$id = 'object';
37 38 39 40 41
	$param = "threadId";
	$descId = "data";
	$dateId = "commentDate";
	$authorId = "userName";
	$titleId = "title";
42
	$readrepl = 'tiki-view_forum_thread.php?forumId=%s&comments_parentId=%s';
43

44
	$changes = $tikilib -> list_all_forum_topics(0, $prefs['feed_forums_max'], $dateId.'_desc', '');
45 46
	$output = $rsslib->generate_feed($feed, $uniqueid, '', $changes, $readrepl, $param, $id, $title, $titleId, $desc, $descId, $dateId, $authorId);
}
47 48
header("Content-type: ".$output["content-type"]);
print $output["data"];