tiki-forums_rss.php 1.73 KB
Newer Older
1
<?php
2
// $Id: /cvsroot/tikiwiki/tiki/tiki-forums_rss.php,v 1.27 2007-10-12 07:55:27 nyloth Exp $
3

4
// Copyright (c) 2002-2007, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
5 6
// 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.
7

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

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

17
if($tiki_p_admin_forum != 'y' && $tiki_p_forum_read != 'y') {
18 19 20
	$smarty->assign('errortype', 401);
	$errmsg=tra("Permission denied you cannot view this section");
	require_once ('tiki-rss_error.php');
21 22
}

ohertel's avatar
ohertel committed
23
$feed = "forums";
mose's avatar
mose committed
24
$uniqueid = $feed;
25 26 27 28 29 30 31 32 33 34 35 36 37
$output = $rsslib->get_from_cache($uniqueid);

if ($output["data"]=="EMPTY") {
	$title = (!empty($title_rss_forums)) ? $title_rss_forums :  tra("Tiki RSS feed for forums");
	$desc = (!empty($desc_rss_forums)) ? $desc_rss_forums : tra("Last topics in forums.");
	$id = "forumId";
	$param = "threadId";
	$descId = "data";
	$dateId = "commentDate";
	$authorId = "userName";
	$titleId = "title";
	$readrepl = "tiki-view_forum_thread.php?$id=%s&comments_parentId=%s";

38 39 40 41
        $tmp = $prefs['title_rss_'.$feed];
        if ($tmp<>'') $title = $tmp;
        $tmp = $prefs['desc_rss_'.$feed];
        if ($desc<>'') $desc = $tmp;
42

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

49
?>