diff options
Diffstat (limited to 'rss.php')
| -rw-r--r-- | rss.php | 25 |
1 files changed, 10 insertions, 15 deletions
@@ -1,8 +1,8 @@ <?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); +include_once $_SERVER['DOCUMENT_ROOT'] . '/lib/post.php'; + +$posts = get_posts(); header('Content-Type: application/xml'); @@ -15,35 +15,30 @@ 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']); +if (!empty($posts)) { echo "<lastBuildDate>"; - echo $date->format('D, d M Y H:i:s O'); + echo date("D, d M Y H:i:s O", $posts[0]['time']); echo "</lastBuildDate>"; } -foreach ($statuses as $s) { - $date = new DateTime($s['posted_at']); - +foreach ($posts as $p) { echo "<item>"; echo "<title>"; - echo $s['title'] ?: '-NO TITLE-'; + echo $p['name'] ?: '-NO TITLE-'; echo "</title>"; echo '<guid isPermaLink="true">'; - echo "https://ilt.su/status/?id=" . $s['id']; + echo "https://ilt.su/blog/" . urlencode($p['name']); echo "</guid>"; echo "<pubDate>"; - echo $date->format('D, d M Y H:i:s O'); + echo date('D, d M Y H:i:s O', $p['time']); echo "</pubDate>"; echo "<content:encoded><![CDATA["; - echo $s['contents'] ?: '-NO CONTENT-'; + echo $p['contents'] ?: '-NO CONTENT-'; echo "]]></content:encoded>"; echo "</item>"; } echo "</channel></rss>"; -?>
\ No newline at end of file |
