51 lines
1.8 KiB
PHP
51 lines
1.8 KiB
PHP
|
<?php
|
||
|
require_once __DIR__ . '/../startup.php';
|
||
|
|
||
|
$getNews = $database->query("SELECT * FROM `flashii_news`".(isset($_GET['id']) ? " WHERE `id`='".$database->real_escape_string($_GET['id'])."'" : null)." ORDER BY `id` DESC");
|
||
|
$getNews = $getNews->fetch_all(MYSQLI_ASSOC);
|
||
|
|
||
|
$mdparser = new Parsedown();
|
||
|
|
||
|
if(isset($_GET['xml'])) {
|
||
|
print '<?xml version="1.0" encoding="UTF-8"?>';
|
||
|
print '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">';
|
||
|
|
||
|
print '<channel>';
|
||
|
|
||
|
print '<title>Flashii News</title>';
|
||
|
print '<link>https://retro.flash.moe/</link>';
|
||
|
print '<description>News on Flashii.net updates and other shit.</description>';
|
||
|
print '<language>en-gb</language>';
|
||
|
print '<language><webMaster>admin@flashii.net (Flashii Administrator)</webMaster></language>';
|
||
|
print '<pubDate>'. date('D, d M Y G:i:s O') .'</pubDate>';
|
||
|
print '<lastBuildDate>'. date('D, d M Y G:i:s O') .'</lastBuildDate>';
|
||
|
|
||
|
foreach($getNews as $newsPost) {
|
||
|
print '<item>';
|
||
|
|
||
|
print '<title>'. $newsPost['title'] .'</title>';
|
||
|
print '<link>https://retro.flash.moe/news/'. $newsPost['id'] .'</link>';
|
||
|
print '<guid>https://retro.flash.moe/news/'. $newsPost['id'] .'</guid>';
|
||
|
print '<pubDate>'. date('D, d M Y G:i:s O', $newsPost['date']) .'</pubDate>';
|
||
|
print '<dc:publisher>'. $flashii->getUserdata($newsPost['uid'])['username'] .'</dc:publisher>';
|
||
|
print '<description><![CDATA['. $mdparser->text($newsPost['content']) .']]></description>';
|
||
|
|
||
|
print '</item>';
|
||
|
}
|
||
|
|
||
|
print '</channel>';
|
||
|
|
||
|
print '</rss>';
|
||
|
exit;
|
||
|
}
|
||
|
|
||
|
if(isset($_GET['id'])) {
|
||
|
if(isset($getNews[0]['title'])) {
|
||
|
$postExists = true;
|
||
|
} else {
|
||
|
$postExists = false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
require_once fiiSwitch_path();
|