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

11 12
require_once ('tiki-setup.php');
require_once ('lib/directory/dirlib.php');
13
$rsslib = TikiLib::lib('rss');
14
if ($prefs['feed_directories'] != 'y') {
15 16 17 18
	$errmsg = tra("rss feed disabled");
	require_once ('tiki-rss_error.php');
}
if ($prefs['feature_directory'] != 'y') {
19
	$errmsg = tr("This feature is disabled: %0", 'feature_directory');
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
	require_once ('tiki-rss_error.php');
}
if ($tiki_p_view_directory != 'y') {
	$smarty->assign('errortype', 401);
	$errmsg = tra("Permission denied");
	require_once ('tiki-rss_error.php');
}
if (!isset($_REQUEST["parent"])) {
	$errmsg = tra("No parent specified");
	require_once ('tiki-rss_error.php');
}
$feed = "directory";
$uniqueid = $feed . "?parent=" . $_REQUEST["parent"];
$output = $rsslib->get_from_cache($uniqueid);
if ($output["data"] == "EMPTY") {
	$title = tra("Tiki RSS feed for directory sites");
	$rc = $dirlib->dir_get_category($_REQUEST["parent"]);
37
	$desc = tr("Last sites of directory %0.", $rc["name"]);
38 39 40 41 42
	$id = "siteId";
	$titleId = "name";
	$descId = "description";
	$dateId = "created";
	$readrepl = "tiki-directory_redirect.php?$id=%s";
43
	$tmp = $prefs['feed_' . $feed . '_title'];
44 45 46
	if ($tmp <> '') {
		$title = $tmp;
	}
47
	$tmp = $prefs['feed_' . $feed . '_desc'];
48 49 50
	if ($desc <> '') {
		$desc = $tmp;
	}
51
	$changes = $dirlib->dir_list_sites($_REQUEST["parent"], 0, $prefs['feed_directories_max'], $dateId . '_desc', '', 'y');
52 53 54 55
	$output = $rsslib->generate_feed($feed, $uniqueid, '', $changes, $readrepl, '', $id, $title, $titleId, $desc, $descId, $dateId, '');
}
header("Content-type: " . $output["content-type"]);
print $output["data"];