tiki-image_galleries_rss.php 2.07 KB
Newer Older
1
<?php
2
// $Id: /cvsroot/tikiwiki/tiki/tiki-image_galleries_rss.php,v 1.32 2007-10-12 07:55:28 nyloth Exp $
3

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

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

13 14 15 16 17 18
if ($prefs['feature_galleries'] != 'y') {
	$smarty->assign('msg', tra("This feature is disabled").": feature_galleries");
	$smarty->display("error.tpl");
	die;
}

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

m_stef's avatar
m_stef committed
24 25 26 27 28 29 30 31
$res=$access->authorize_rss(array('tiki_p_view_image_gallery','tiki_p_admin_galleries'));
if($res) {
   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');
32 33
}

ohertel's avatar
ohertel committed
34
$feed = "imggal";
mose's avatar
mose committed
35
$uniqueid = $feed;
36 37 38 39 40 41 42 43 44 45 46 47 48
$output = $rsslib->get_from_cache($uniqueid);

if ($output["data"]=="EMPTY") {
	$title = (!empty($title_rss_image_galleries)) ? $title_rss_image_galleries : tra("Tiki RSS feed for image galleries");
	$desc = (!empty($desc_rss_image_galleries)) ? $desc_rss_image_galleries : tra("Last images uploaded to the image galleries.");
	
	$id = "imageId";
	$titleId = "name";
	$descId = "description";
	$dateId = "created";
	$authorId = "user";
	$readrepl = "tiki-browse_image.php?imageId=%s";
	
49 50 51 52
        $tmp = $prefs['title_rss_'.$feed];
        if ($tmp<>'') $title = $tmp;
        $tmp = $prefs['desc_rss_'.$feed];
        if ($desc<>'') $desc = $tmp;
53
	
54
	$changes = $imagegallib->list_images(0,$prefs['max_rss_image_galleries'],$dateId.'_desc', '');
55 56
	$output = $rsslib->generate_feed($feed, $uniqueid, '', $changes, $readrepl, '', $id, $title, $titleId, $desc, $descId, $dateId, $authorId);
}
57 58
header("Content-type: ".$output["content-type"]);
print $output["data"];