-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrss.php
More file actions
86 lines (80 loc) · 2.73 KB
/
rss.php
File metadata and controls
86 lines (80 loc) · 2.73 KB
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
##################################################
#
# Copyright (c) 2004-2006 OIC Group, Inc.
# Written and Designed by Adam Kessler
#
# This file is part of Exponent
#
# Exponent is free software; you can redistribute
# it and/or modify it under the terms of the GNU
# General Public License as published by the Free
# Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# GPL: http://www.gnu.org/licenses/gpl.txt
#
##################################################
if (!defined("EXPONENT")) include_once('exponent.php');
if (!defined('SYS_RSS')) include_once('core_rss.php');
//$location = new Location($_REQUEST['module'],$_REQUEST['identifier'],$_REQUEST['internal']);
$location->mod = "";
$location->src = "";
$location->int = "";
if (isset($_REQUEST['module'])) $location->mod = $_REQUEST['module'];
if (isset($_REQUEST['src'])) $location->src = $_REQUEST['src'];
if (isset($_REQUEST['int'])) $location->int = $_REQUEST['int'];
$module = null;
if (isset($_REQUEST['module'])) {
$module = $_REQUEST['module']; // we passed something like '?module=news'
}
//echo "module: ".$module;
if (isset($module)) {
//get the RSS Items from the module
include_once('modules/'.$module.'/class.php');
$obj = new $module();
$rss_items = $obj->getRSSContent($location);
$itemdate = array();
foreach($rss_items as $item) {
$itemdate[] = strtotime($item->date);
}
$pubDate = date('r', max($itemdate));
//get the modules config data which should have the feed title & desc
$config = $db->selectObject($module."_config", "location_data='".serialize($location)."'");
$ttl = $config->rss_cachetime;
if ($ttl == 0) { $ttl = 1440; }
if ($config->enable_rss == true) {
$rss = new UniversalFeedCreator();
$rss->cssStyleSheet = "";
$rss->useCached();
$rss->title = $config->feed_title;
$rss->description = $config->feed_desc;
$rss->ttl = $ttl;
$rss->pubDate = $pubDate;
$rss->link = "http://".HOSTNAME.PATH_RELATIVE;
$rss->syndicationURL = "http://".HOSTNAME.PATH_RELATIVE.$_SERVER['PHP_SELF'];
if ($_REQUEST['module'] == "resourcesmodule") {
$rss->itunes->summary = $config->feed_desc;
$rss->itunes->author = ORGANIZATION_NAME;
$rss->itunes->category = '';
$rss->itunes->subcategory = '';
$rss->itunes->image = URL_FULL."framework/modules/filedownloads/assets/images/logo.png";
$rss->itunes->explicit = 0;
$rss->itunes->subtitle = 0;
$rss->itunes->keywords = 0;
$rss->itunes->owner_email = 0;
}
foreach ($rss_items as $item) {
$rss->addItem($item);
}
header("Content-type: text/xml");
if ($module == "resourcesmodule") {
echo $rss->createFeed("PODCAST");
} else {
echo $rss->createFeed("RSS2.0");
}
} else {
echo "This RSS feed has been disabled.";
}
}
?>