hajime/public/yuuno_news.php

96 lines
4.3 KiB
PHP
Raw Normal View History

2023-08-11 22:16:32 +00:00
<?php
print desHeader(isset($_GET['id']) ? ($postExists ? $getNews[0]['title'] : 'Post does not exist') : 'Flashii News');
?>
<div class="content">
<div class="content-column news">
<?php
print '<div class="head">'. (isset($_GET['id']) ? ($postExists ? $getNews[0]['title'] : 'Post does not exist') : 'News <a href="/news.xml" class="fa fa-rss news-rss default"></a>') .'</div>';
foreach($getNews as $newsPost) {
print isset($_GET['id']) ? null : '<a href="/news/'.$newsPost['id'].'" class="news-head" id="'.$newsPost['id'].'">'.$newsPost['title'].'</a>';
print '<div class="news-body">';
print '<a href="/u/';
print $newsPost['uid'];
print '" class="default">';
print '<div class="news-poster">';
print '<img src="/a/';
print $newsPost['uid'];
print '" alt="';
print $flashii->getUserdata($newsPost['uid'])['username'];
print '" class="default-avatar-setting" />';
print '<h1 style="color: #';
print $flashii->getRankdata($flashii->getUserdata($newsPost['uid'])['userrole'])['colour'];
print '; text-shadow: 0px 0px 7px #888; padding: 0px 0px 10px;">';
print $flashii->getUserdata($newsPost['uid'])['username'];
print '</h1>';
print '</div>';
print '</a>';
print '<div class="markdown">';
print $mdparser->text($newsPost['content']);
print '</div>';
print '</div>';
print '<div class="clear"></div>';
print '<div class="news-post-time">Posted on ';
print date($fwSettings['dateFormat'], $newsPost['date']);
print isset($_GET['id']) ? null : ' <a class="default" href="/news/'.$newsPost['id'].'#disqus_thread">View comments</a>';
print '</div>';
}
if(isset($_GET['id'])) {
if($postExists) {
print "<div id=\"disqus_thread\"></div>
<script type=\"text/javascript\">
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = 'flashii';
var disqus_identifier = 'news_".$getNews[0]['id']."';
var disqus_title = '".$getNews[0]['title']."';
var disqus_url = 'http://".$_SERVER['HTTP_HOST']."/news/".$getNews[0]['id']."';
/* * * DON'T EDIT BELOW THIS LINE * * */
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href=\"http://disqus.com/?ref_noscript\">comments powered by Disqus.</a></noscript>
<a href=\"http://disqus.com\" class=\"dsq-brlink\">comments powered by <span class=\"logo-disqus\">Disqus</span></a>
";
} else {
print '<div style="padding: 20px;">';
print '<h1>The requested news post does not exist!</h1>';
print 'There are a few possible reasons for this:';
print '<ul>';
print '<li>The post may have been deleted due to irrelevancy.</li>';
print '<li>The post never existed.</li>';
print '</ul>';
print '</div>';
}
} else {
print "<script type=\"text/javascript\">
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = 'flashii';
/* * * DON'T EDIT BELOW THIS LINE * * */
(function () {
var s = document.createElement('script'); s.async = true;
s.type = 'text/javascript';
s.src = '//' + disqus_shortname + '.disqus.com/count.js';
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
}());
</script>
";
}
print '</div>';
?>
</div>
<?php
print desFooter();