tiki-blog_rss.php 2.27 KB
Newer Older
1
<?php
2 3
// (c) Copyright 2002-2009 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.
6
// $Id: /cvsroot/tikiwiki/tiki/tiki-blog_rss.php,v 1.35.2.1 2008-01-17 17:47:01 sylvieg Exp $
7
require_once ('tiki-setup.php');
8
require_once ('lib/tikilib.php');
9 10
require_once ('lib/blogs/bloglib.php');
require_once ('lib/rss/rsslib.php');
11
if ($prefs['rss_blogs'] != 'y') {
12 13
	$errmsg = tra("rss feed disabled");
	require_once ('tiki-rss_error.php');
14
}
15
if (!isset($_REQUEST["blogId"])) {
16 17
	$errmsg = tra("No blogId specified");
	require_once ('tiki-rss_error.php');
18
}
19
$smarty->assign('individual', 'n');
20 21
$tikilib->get_perm_object($_REQUEST["blogId"], 'blog');

22
if ($tiki_p_read_blog != 'y') {
23
	$smarty->assign('errortype', 401);
24
	$errmsg = tra("Permission denied you cannot view this section");
25
	require_once ('tiki-rss_error.php');
26
}
ohertel's avatar
ohertel committed
27
$feed = "blog";
28
$id = "blogId";
29
$uniqueid = "$feed.$id=" . $_REQUEST["$id"];
30
$output = $rsslib->get_from_cache($uniqueid);
31 32 33 34 35 36
if ($output["data"] == "EMPTY") {
	$tmp = $tikilib->get_blog($_REQUEST["$id"]);
	$title = (!empty($prefs['title_rss_' . $feed])) ? $prefs['title_rss_' . $feed] : tra('Tiki RSS feed for blog: ');
	$title.= $tmp['title'];
	$desc.= (!empty($prefs['desc_rss_' . $feed])) ? $prefs['desc_rss_' . $feed] : tra('Last modifications to the blog.');
	$desc.= $tmp["description"];
37 38 39 40
	$descId = "data";
	$dateId = "created";
	$authorId = "user";
	$titleId = "title";
41
	$readrepl = "tiki-view_blog_post.php?postId=%s";
42
	$changes = $bloglib->list_blog_posts($_REQUEST["$id"], 0, $prefs['max_rss_blog'], $dateId . '_desc', '', '', $tikilib->now);
43
	$tmp = array();
44 45 46 47 48 49
	include_once ('tiki-sefurl.php');
	foreach($changes["data"] as $data) {
		$data["$descId"] = $tikilib->parse_data($data[$descId], array(
			'print' => true
		));
		$data['sefurl'] = filter_out_sefurl(sprintf($readrepl, $data['postId']) , $smarty, 'blogpost', $data['title']);
50 51 52 53
		$tmp[] = $data;
	}
	$changes["data"] = $tmp;
	$tmp = null;
54
	$output = $rsslib->generate_feed($feed, $uniqueid, '', $changes, $readrepl, 'blogId', '', $title, $titleId, $desc, $descId, $dateId, $authorId, false);
ohertel's avatar
ohertel committed
55
}
56
header("Content-type: " . $output["content-type"]);
57
print $output["data"];