This repository was archived by the owner on May 27, 2025. It is now read-only.
forked from theuni/Addon-Frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrss.php
More file actions
57 lines (50 loc) · 1.99 KB
/
rss.php
File metadata and controls
57 lines (50 loc) · 1.99 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
<?php
// ############## Include Files ################ //
require_once('includes/configuration.php');
require_once('includes/db_connection.php');
require_once('includes/functions.php');
// ############## Finish Includes ############### //
startup();
// ############### Prepare requested mode ######### //
$orderByProperty = 'created';
$feedTitle = 'Latest Kodi Add-Ons';
if (isset($_GET['mode']) && $_GET['mode'] == 'updated') {
$orderByProperty = 'updated';
$feedTitle = 'Recently updated Kodi Add-Ons';
}
// ############### Setup Queries ############### //
$queryResult = $db->get_results('SELECT * FROM addon WHERE 1=1 ' . $configuration['addonExcludeClause'] . ' ORDER BY ' . $orderByProperty . ' DESC LIMIT 10');
// ############## Finish Queries ############### //
// Build the Add-Ons list
$itemList = '';
foreach ($queryResult as $addon) {
$thumbnailExternalUrl = getAddonThumbnail($addon, 'addonThumbnail');
$thumbnailFilePath = str_replace($configuration['cache']['pathRead'], $configuration['cache']['pathWrite'], $thumbnailExternalUrl);
$thumbnailSize = 0;
if (file_exists($thumbnailFilePath) && is_file($thumbnailFilePath)) {
$thumbnailSize = filesize($thumbnailFilePath);
}
$itemList .= ' <item>
<guid>' . $addon->id . '</guid>
<title>' . htmlspecialchars($addon->name) . '</title>
<description><![CDATA[' . formatKodiString($addon->description) . ']]></description>
<date>' . $addon->updated . '</date>
<link>' . createLinkUrl('addon', $addon->id) . '</link>
<enclosure url="' . $configuration['baseUrl'] . $thumbnailExternalUrl . '" length="' . $thumbnailSize . '" type="image/png" />
</item>
';
}
shutdown();
// begin output
header('Content-type: text/xml');
echo '<?xml version="1.0" encoding="UTF-8"?>';
?>
<rss version="2.0">
<channel>
<title><?php echo $feedTitle; ?></title>
<link><?php echo $configuration['baseUrl']; ?></link>
<description><?php echo $feedTitle; ?></description>
<language>en-us</language>
<?php echo $itemList; ?>
</channel>
</rss>