51 lines
1.4 KiB
PHP
51 lines
1.4 KiB
PHP
|
<?php
|
||
|
require_once __DIR__ . '/../_v4/includes.php';
|
||
|
|
||
|
define('FWH_STYLE', FWH_2019);
|
||
|
|
||
|
$postId = !empty($_GET['p']) && is_string($_GET['p']) && ctype_digit($_GET['p']) ? (int)($_GET['p']) : 0;
|
||
|
|
||
|
if($postId < 1) {
|
||
|
header('Location: /2019');
|
||
|
exit;
|
||
|
}
|
||
|
|
||
|
$getBlogPost = $pdo->prepare('
|
||
|
SELECT `post_id`, `post_title`, `post_text`, `post_published`
|
||
|
FROM `fm_blog_posts`
|
||
|
WHERE `post_id` = :id
|
||
|
AND `post_published` IS NOT NULL
|
||
|
AND `post_published` < CURRENT_TIMESTAMP
|
||
|
AND `post_deleted` IS NULL
|
||
|
');
|
||
|
$getBlogPost->bindValue('id', $postId);
|
||
|
$getBlogPost->execute();
|
||
|
$blogPost = $getBlogPost->fetch(PDO::FETCH_OBJ);
|
||
|
|
||
|
if (empty($blogPost)) die('Couldn\'t find that post.');
|
||
|
|
||
|
echo html_open()
|
||
|
. '<head>'
|
||
|
. html_head($blogPost->post_title, HEAD_FLASHWAVE)
|
||
|
. '</head><body class="blog">'
|
||
|
. html_navigation(NAV_FLASHWAVE)
|
||
|
. '<div class="wrapper">';
|
||
|
|
||
|
?>
|
||
|
<div class="index__blog" style="margin: 10px 0 0;">
|
||
|
<h1 class="index__blog__title"><?=$blogPost->post_title;?></h1>
|
||
|
<?php
|
||
|
$splitLines = explode("\n", $blogPost->post_text);
|
||
|
|
||
|
foreach ($splitLines as $paragraph)
|
||
|
if(!empty($paragraph))
|
||
|
echo '<p class="index__blog__paragraph">' . trim($paragraph) . '</p>';
|
||
|
?>
|
||
|
<span class="index__blog__continue">Posted <?=$blogPost->post_published;?></span>
|
||
|
</div>
|
||
|
<?php
|
||
|
echo '</div>'
|
||
|
. html_footer()
|
||
|
. '</body>'
|
||
|
. html_close();
|