1<?php
2/**
3 * @package tikiwiki
4 */
5// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
6//
7// All Rights Reserved. See copyright.txt for details and a complete list of authors.
8// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
9// $Id$
10
11require_once('tiki-setup.php');
12require_once('lib/shoutbox/shoutboxlib.php');
13$rsslib = TikiLib::lib('rss');
14
15$access->check_feature('feature_shoutbox');
16
17if ($prefs['feed_shoutbox'] != 'y') {
18	$errmsg = tra("rss feed disabled");
19	require_once('tiki-rss_error.php');
20}
21
22$res = $access->authorize_rss(['tiki_p_view_shoutbox','tiki_p_admin_cms']);
23if ($res) {
24	if ($res['header'] == 'y') {
25		header('WWW-Authenticate: Basic realm="' . $tikidomain . '"');
26		header('HTTP/1.0 401 Unauthorized');
27	}
28	$errmsg = $res['msg'];
29	require_once('tiki-rss_error.php');
30}
31
32$feed = "shoutbox";
33$uniqueid = $feed;
34$output = $rsslib->get_from_cache($uniqueid);
35if ($output["data"] == "EMPTY") {
36	$title = $prefs['feed_shoutbox_title'];
37	$desc = $prefs['feed_shoutbox_desc'];
38
39	$id = "msgId";
40	$titleId = "msgId";
41	$descId = "message";
42	$dateId = "timestamp";
43	$authorId = "user";
44	$readrepl = "tiki-shoutbox.php?get=%s";
45
46	$changes = $shoutboxlib -> list_shoutbox(0, $prefs['feed_articles_max'], $id . '_desc', false);
47	$tmp = null;
48	$output = $rsslib->generate_feed($feed, $uniqueid, '', $changes, $readrepl, '', $id, $title, $titleId, $desc, $descId, $dateId, $authorId);
49}
50header("Content-type: " . $output["content-type"]);
51print $output["data"];
52