2020-08-20 00:02:37 +00:00
|
|
|
<?php
|
|
|
|
require_once __DIR__ . '/../_v4/includes.php';
|
|
|
|
|
|
|
|
define('FWH_STYLE', FWH_2020);
|
|
|
|
|
|
|
|
$blogMode = !empty($_GET['blog']);
|
|
|
|
$requireSafe = html_default_mode() === FWH_JVDG;
|
|
|
|
|
|
|
|
if(!$requireSafe) {
|
|
|
|
$getPosts = $pdo->prepare("
|
|
|
|
SELECT `post_id`, `post_title`, `post_text`, UNIX_TIMESTAMP(`post_published`) AS `post_published`
|
|
|
|
FROM `fm_blog_posts` AS bp
|
|
|
|
WHERE `post_published` IS NOT NULL
|
|
|
|
AND `post_published` < CURRENT_TIMESTAMP
|
|
|
|
AND `post_deleted` IS NULL
|
|
|
|
ORDER BY `post_published` DESC
|
|
|
|
");
|
|
|
|
$posts = $getPosts->execute() ? $getPosts->fetchAll(PDO::FETCH_OBJ) : false;
|
|
|
|
$posts = $posts ? $posts : [];
|
|
|
|
}
|
|
|
|
|
|
|
|
if(isset($_GET['blog_dump'])) {
|
|
|
|
header('Content-Type: application/json; charset=utf-8');
|
|
|
|
echo json_encode($posts ?? []);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-11-17 21:58:45 +00:00
|
|
|
if($blogMode) {
|
|
|
|
fm_component('header', [
|
|
|
|
'title' => 'flash.moe blog',
|
|
|
|
'styles' => [
|
|
|
|
'/css/2020.css'
|
|
|
|
],
|
|
|
|
]);
|
|
|
|
} else {
|
2020-08-20 00:02:37 +00:00
|
|
|
echo html_doctype();
|
|
|
|
?>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<?=html_charset();?>
|
|
|
|
<title><?=$_SERVER['HTTP_HOST'];?></title>
|
|
|
|
<?=html_stylesheet('2020.css');?>
|
|
|
|
<?=html_meta();?>
|
|
|
|
<?php if($requireSafe): ?>
|
|
|
|
<style type="text/css">
|
|
|
|
.wrapper { justify-content: center; }
|
|
|
|
</style>
|
|
|
|
<?php endif; ?>
|
|
|
|
</head>
|
|
|
|
<body>
|
2020-11-17 21:58:45 +00:00
|
|
|
<?php } ?>
|
2020-08-20 00:02:37 +00:00
|
|
|
<?php if($blogMode): ?>
|
|
|
|
<div style="max-width: 1000px; margin: 0 auto; font-size: 20px; line-height: 1.7em;">
|
|
|
|
<div style="margin: 5px; background-color: #222; border-radius: 5px; padding: 2px 5px;">New blog script is still work in progress, enjoy the old version!</div>
|
|
|
|
</div>
|
|
|
|
<?php endif; ?>
|
|
|
|
<div class="wrapper">
|
|
|
|
<?php if(!$blogMode) echo html_sidebar(); ?>
|
|
|
|
<?php if(!empty($posts)): ?>
|
|
|
|
<div class="blogs">
|
|
|
|
<?php
|
|
|
|
/*if(!$requireSafe) {
|
|
|
|
?>
|
|
|
|
<div class="banner">
|
|
|
|
<img src="/assets/misaka-2.png" alt=""/>
|
|
|
|
<h1>Blog</h1>
|
|
|
|
</div>
|
|
|
|
<?php
|
|
|
|
}*/
|
|
|
|
|
|
|
|
$urlSuffix = $blogMode ? '?blog=1' : '';
|
|
|
|
foreach($posts as $post) {
|
|
|
|
$preview = trim(explode("\n", $post->post_text)[0]);
|
|
|
|
$dateCustom = date('Y-m-d @ H:i:s T', $post->post_published);
|
|
|
|
$dateISO = date('c', $post->post_published);
|
|
|
|
|
|
|
|
echo <<<HTML
|
|
|
|
<div class="blog preview">
|
|
|
|
<h1><a href="/blog/{$post->post_id}">{$post->post_title}</a></h1>
|
|
|
|
<time datetime="{$dateISO}">{$dateCustom}</time>
|
|
|
|
<p>{$preview}</p>
|
|
|
|
<a class="continue" href="/blog/{$post->post_id}{$urlSuffix}">Continue reading</a>
|
|
|
|
</div>\r\n
|
|
|
|
HTML;
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</div>
|
|
|
|
<?php endif; ?>
|
2020-11-17 21:58:45 +00:00
|
|
|
<?php if($blogMode): fm_component('footer'); else: ?>
|
2020-08-20 00:02:37 +00:00
|
|
|
</div>
|
|
|
|
<?=html_script('/assets/lastfm2020.js');?>
|
|
|
|
<?php
|
|
|
|
if(!$requireSafe) {
|
|
|
|
if(html_old_ie()) {
|
|
|
|
?>
|
|
|
|
<?=html_script('/assets/fixpng.js');?>
|
|
|
|
<bgsound src="/assets/SMS-JBIOS-Demo.mid" loop="infinite"/>
|
|
|
|
<?php } elseif(html_netscape()) { ?>
|
|
|
|
<embed src="/assets/SMS-JBIOS-Demo.mid" autostart="true" hidden="true" loop="true"></embed>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</body>
|
|
|
|
</html>
|
2020-11-17 21:58:45 +00:00
|
|
|
<?php endif; ?>
|