blob: 5a7c78cd6a838352be0b63c4a5874fca8da9903b (
plain)
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
|
<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/lib/time.php';
$db = new PDO("sqlite:{$_SERVER['DOCUMENT_ROOT']}/database.db");
$stmt = $db->query("SELECT * FROM statuses ORDER BY posted_at DESC");
$statuses = $stmt->fetchAll(PDO::FETCH_ASSOC);
header('Content-Type: application/xml');
echo "<?xml version='1.0' encoding='UTF-8'?>";
echo "<rss version='2.0' xmlns:content='http://purl.org/rss/1.0/modules/content/'>";
echo "<channel>";
echo "<title>ilt.su</title>";
echo "<link>https://ilt.su</link>";
echo "<description>ilotterytea's racist schizo thoughts. read and learn.</description>";
echo "<language>en-us</language>";
if (!empty($statuses)) {
$date = new DateTime($statuses[0]['posted_at']);
echo "<lastBuildDate>";
echo $date->format('D, d M Y H:i:s O');
echo "</lastBuildDate>";
}
foreach ($statuses as $s) {
$date = new DateTime($s['posted_at']);
echo "<item>";
echo "<title>";
echo $s['title'] ?: '-NO TITLE-';
echo "</title>";
echo '<guid isPermaLink="true">';
echo "https://ilt.su/statuses/?id=" . $s['id'];
echo "</guid>";
echo "<pubDate>";
echo $date->format('D, d M Y H:i:s O');
echo "</pubDate>";
echo "<content:encoded><![CDATA[";
echo $s['contents'] ?: '-NO CONTENT-';
echo "]]></content:encoded>";
echo "</item>";
}
echo "</channel></rss>";
?>
|