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');
12
13$imagegallib = TikiLib::lib('imagegal');
14$rsslib = TikiLib::lib('rss');
15
16if ($prefs['feed_image_gallery'] != 'y') {
17	$errmsg = tra('rss feed disabled');
18	require_once('tiki-rss_error.php');
19}
20
21if (! isset($_REQUEST['galleryId'])) {
22	$errmsg = tra('No gallery ID specified');
23	require_once('tiki-rss_error.php');
24}
25
26$tikilib->get_perm_object($_REQUEST['galleryId'], 'image gallery');
27
28if ($tiki_p_view_image_gallery != 'y') {
29	$smarty->assign('errortype', 401);
30	$errmsg = tra('You do not have permission to view this section');
31	require_once('tiki-rss_error.php');
32}
33
34$feed = 'imggal';
35$uniqueid = "$feed.id=" . $_REQUEST['galleryId'];
36$output = $rsslib->get_from_cache($uniqueid);
37
38if ($output['data'] == 'EMPTY') {
39	$tmp = $imagegallib->get_gallery($_REQUEST['galleryId']);
40	$title = $prefs['feed_image_gallery_title'] . $tmp['name'];
41	$desc = $prefs['feed_image_gallery_desc'] . $tmp['description'];
42	$id = 'imageId';
43	$titleId = 'name';
44	$descId = 'description';
45	$authorId = 'user';
46	$dateId = 'created';
47	$readrepl = 'tiki-browse_image.php?imageId=%s';
48
49	$changes = $imagegallib->get_images(0, $prefs['feed_image_gallery_max'], $dateId . '_desc', '', $_REQUEST['galleryId']);
50	$output = $rsslib->generate_feed($feed, $uniqueid, '', $changes, $readrepl, '', $id, $title, $titleId, $desc, $descId, $dateId, $authorId);
51}
52header('Content-type: ' . $output['content-type']);
53print $output['data'];
54