This repository has been archived by the owner on Dec 2, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
syndication.php
86 lines (47 loc) · 1.4 KB
/
syndication.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
define('PATH_TO_ROOT', '.');
header("Content-Type: application/xml; charset=iso-8859-1");
define('NO_SESSION_LOCATION', true);
require_once PATH_TO_ROOT . '/kernel/begin.php';
require_once PATH_TO_ROOT . '/kernel/header_no_display.php';
import('content/syndication/feed');
$module_id = retrieve(GET, 'm', '');
if (!empty($module_id))
{
$feed_name = retrieve(GET, 'name', DEFAULT_FEED_NAME);
$category_id = retrieve(GET, 'cat', 0);
$feed = null;
switch (retrieve(GET, 'feed', 'rss'))
{
case 'atom':
import('content/syndication/atom');
$feed= new ATOM($module_id, $feed_name, $category_id);
break;
default:
import('content/syndication/rss');
$feed= new RSS($module_id, $feed_name, $category_id);
break;
}
if ($feed != null && $feed->is_in_cache())
{
echo $feed->read();
}
else
{
import('modules/modules_discovery_service');
$modules_discovery_service = new ModulesDiscoveryService();
$module = $modules_discovery_service->get_module($module_id);
if (is_object($module) && $module->got_error() == 0 && $module->has_functionality('get_feed_data_struct'))
{
$feed->load_data($module->get_feed_data_struct($category_id, $feed_name));
$feed->cache();
echo $feed->export();
}
else
{
redirect('member/error.php?e=e_uninstalled_module');
}
}
}
require_once PATH_TO_ROOT . '/kernel/footer_no_display.php';
?>