-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrss.php
More file actions
50 lines (44 loc) · 1.55 KB
/
rss.php
File metadata and controls
50 lines (44 loc) · 1.55 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
<?php
include 'includes/config.php';
$link = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT topic_id, topic_title, topic_time FROM cS8856_topics WHERE forum_id=3 AND topic_id != 378 ORDER BY topic_time DESC LIMIT 20";
if ($result = mysqli_query($link, $query)) {
while ($line = mysqli_fetch_assoc($result)) {
$return[] = $line;
}
mysqli_free_result($result);
}
mysqli_close($link);
$now = date("D, d M Y H:i:s T");
$output = '<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<title>Universal Media Server News</title>
<link>https://www.universalmediaserver.com/rss/</link>
<description>The official news feed for Universal Media Server</description>
<language>en</language>
<pubDate>'.$now.'</pubDate>
<lastBuildDate>'.$now.'</lastBuildDate>
<docs>https://www.universalmediaserver.com/</docs>
';
foreach ($return as $line) {
$output .= "
<item>
<title>".htmlentities($line['topic_title'])."</title>
<link>https://www.universalmediaserver.com/forum/viewtopic.php?f=8&t=".$line['topic_id']."</link>
<description><a href=\"https://www.universalmediaserver.com/forum/viewtopic.php?f=8&t=".$line['topic_id']."\">Click to see more</a></description>
<guid>".$line['topic_id']."</guid>
<pubDate>".date('D, d M Y H:i:s T', $line['topic_time'])."</pubDate>
</item>
";
}
$output .= "
</channel>
</rss>";
header('Content-type: text/xml');
echo $output;
?>