tiki-forums_rss.php 1.81 KB
Newer Older
1
<?php
changi67's avatar
changi67 committed
2 3
// (c) Copyright 2002-2010 by authors of the Tiki Wiki/CMS/Groupware Project
// 
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 20 21 22 23 24 25 26
$res=$access->authorize_rss(array('tiki_p_admin_forum','tiki_p_forum_read'));
if($res) {
   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');
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") {
sampaioprimo's avatar
sampaioprimo committed
34 35
	$title = (!empty($prefs['feed_forums_title'])) ? $prefs['feed_forums_title'] :  tra("Tiki RSS feed for forums");
	$desc = (!empty($prefs['feed_forums_desc'])) ? $prefs['feed_forums_desc'] : tra("Last topics in forums.");
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
        $tmp = $prefs['feed_'.$feed.'_title'];
45
        if ($tmp<>'') $title = $tmp;
46
        $tmp = $prefs['feed_'.$feed.'_desc'];
47
        if ($desc<>'') $desc = $tmp;
48

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