tiki-directories_rss.php 1.82 KB
Newer Older
1
<?php
2 3
// (c) Copyright 2002-2009 by authors of the Tiki Wiki/CMS/Groupware Project
// 
4 5
// 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.
6
// $Header$
7 8 9 10
require_once ('tiki-setup.php');
require_once ('lib/tikilib.php');
require_once ('lib/rss/rsslib.php');
if ($prefs['rss_directories'] != 'y') {
11
	$errmsg = tra("rss feed disabled");
12 13 14
	require_once ('tiki-rss_error.php');
}
if ($prefs['feature_directory'] != 'y') {
15 16
	$errmsg = tra("This feature is disabled") . ": feature_directory";
	require_once ('tiki-rss_error.php');
17
}
18 19 20 21 22 23 24 25 26 27 28
$res = $access->authorize_rss(array(
	'tiki_p_view_directory',
	'tiki_p_admin_directory'
));
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');
29 30 31 32
}
$feed = "directories";
$uniqueid = $feed;
$output = $rsslib->get_from_cache($uniqueid);
33 34 35
if ($output["data"] == "EMPTY") {
	$title = (!empty($desc_rss_directories)) ? $desc_rss_directories : tra("Tiki RSS feed for directory sites");
	$desc = (!empty($desc_rss_directories)) ? $desc_rss_directories : tra("Last sites.");
36 37 38 39 40
	$id = "siteId";
	$titleId = "name";
	$descId = "description";
	$dateId = "created";
	$readrepl = "tiki-directory_redirect.php?$id=%s";
41 42 43 44 45
	$tmp = $prefs['title_rss_' . $feed];
	if ($tmp <> '') $title = $tmp;
	$tmp = $prefs['desc_rss_' . $feed];
	if ($desc <> '') $desc = $tmp;
	$changes = $tikilib->dir_list_all_valid_sites2(0, $prefs['max_rss_directories'], $dateId . '_desc', '');
46 47
	$output = $rsslib->generate_feed($feed, $uniqueid, '', $changes, $readrepl, '', $id, $title, $titleId, $desc, $descId, $dateId, '');
}
48
header("Content-type: " . $output["content-type"]);
49
print $output["data"];