tiki-shoutbox_rss.php 1.49 KB
Newer Older
1
<?php
changi67's avatar
changi67 committed
2 3 4
/**
 * @package tikiwiki
 */
5
// (c) Copyright 2002-2016 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.
9
// $Id$
10 11 12

require_once ('tiki-setup.php');
require_once ('lib/shoutbox/shoutboxlib.php');
13
$rsslib = TikiLib::lib('rss');
14 15 16

$access->check_feature('feature_shoutbox');

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

$res=$access->authorize_rss(array('tiki_p_view_shoutbox','tiki_p_admin_cms'));
23
if ($res) {
24 25 26 27 28 29
	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');
30 31 32 33 34 35
}

$feed = "shoutbox";
$uniqueid = $feed;
$output = $rsslib->get_from_cache($uniqueid);
if ($output["data"]=="EMPTY") {
36 37
	$title = $prefs['feed_shoutbox_title'];
	$desc = $prefs['feed_shoutbox_desc'];
38

39 40 41 42 43 44 45
	$id = "msgId";
	$titleId = "msgId";
	$descId = "message";
	$dateId = "timestamp";
	$authorId = "user";
	$readrepl = "tiki-shoutbox.php?get=%s";

changi67's avatar
changi67 committed
46
	$changes = $shoutboxlib -> list_shoutbox(0, $prefs['feed_articles_max'], $id.'_desc', false);
47 48 49 50 51
	$tmp = null;
	$output = $rsslib->generate_feed($feed, $uniqueid, '', $changes, $readrepl, '', $id, $title, $titleId, $desc, $descId, $dateId, $authorId);
}
header("Content-type: ".$output["content-type"]);
print $output["data"];