xml
This commit is contained in:
parent
36b2317da6
commit
f26a34c463
1 changed files with 39 additions and 1 deletions
|
@ -13,7 +13,45 @@ require_once '/var/www/flashii.net/_sakura/sakura.php';
|
||||||
$renderData['page'] = [
|
$renderData['page'] = [
|
||||||
'title' => 'Flashii News'
|
'title' => 'Flashii News'
|
||||||
];
|
];
|
||||||
$renderData['newsPosts'] = Main::getNewsPosts((isset($_GET['id']) && is_numeric($_GET['id'])) ? $_GET['id'] : null);
|
$renderData['newsPosts'] = Main::getNewsPosts((isset($_GET['id']) && !isset($_GET['xml']) && is_numeric($_GET['id'])) ? $_GET['id'] : null);
|
||||||
|
|
||||||
|
// News XML, don't really care so yeah
|
||||||
|
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>http://flashii.net/</link>';
|
||||||
|
print '<description>News on Flashii.net.</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($renderData['newsPosts'] as $newsPost) {
|
||||||
|
|
||||||
|
print '<item>';
|
||||||
|
|
||||||
|
print '<title>'. $newsPost['title'] .'</title>';
|
||||||
|
print '<link>http://flashii.net/news/'. $newsPost['id'] .'</link>';
|
||||||
|
print '<guid>http://flashii.net/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;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// Print page contents
|
// Print page contents
|
||||||
print Main::tplRender('main/news.tpl', $renderData);
|
print Main::tplRender('main/news.tpl', $renderData);
|
||||||
|
|
Reference in a new issue