1
0
www.mikescher.com/www/pages/blog_view.php

56 lines
1.4 KiB
PHP
Raw Normal View History

2017-12-30 23:11:51 +01:00
<?php
2020-01-16 10:50:18 +01:00
require_once (__DIR__ . '/../internals/website.php');
2019-11-02 20:19:34 +01:00
2020-01-16 10:50:18 +01:00
/** @var PageFrameOptions $FRAME_OPTIONS */ global $FRAME_OPTIONS;
/** @var URLRoute $ROUTE */ global $ROUTE;
/** @var Website $SITE */ global $SITE;
2017-12-30 23:11:51 +01:00
?>
2019-12-02 14:57:01 +01:00
<?php
2020-01-16 10:50:18 +01:00
$id = $ROUTE->parameter['id'];
$subview = $ROUTE->parameter['subview'];
2017-12-30 23:11:51 +01:00
2020-01-16 10:50:18 +01:00
$post = $SITE->modules->Blog()->getFullBlogpost($id, $subview, $err);
if ($post === null) { $FRAME_OPTIONS->setForced404($err); return; }
2017-12-30 23:11:51 +01:00
2020-01-16 10:56:12 +01:00
$FRAME_OPTIONS->title = $post['title'];
2020-01-16 10:50:18 +01:00
$FRAME_OPTIONS->canonical_url = $post['canonical'];
2017-12-30 23:11:51 +01:00
2020-01-16 10:50:18 +01:00
if ($post['type'] == 'euler')
$FRAME_OPTIONS->activeHeader = 'euler';
2020-01-20 21:13:26 +01:00
else if ($post['type'] == 'aoc')
2020-01-16 10:50:18 +01:00
$FRAME_OPTIONS->activeHeader = 'aoc';
else
$FRAME_OPTIONS->activeHeader = 'blog';
?>
2019-11-02 20:19:34 +01:00
2017-12-30 23:11:51 +01:00
2020-01-16 10:50:18 +01:00
<div class="blockcontent">
<div class="contentheader"><h1><?php echo htmlspecialchars($post['title']); ?></h1><hr/></div>
<?php
if ($post['type'] === 'plain')
{
2020-01-17 00:25:29 +01:00
echo $SITE->fragments->BlogviewPlain($post);
2020-01-16 10:50:18 +01:00
}
elseif ($post['type'] === 'markdown')
{
2020-01-17 00:25:29 +01:00
echo $SITE->fragments->BlogviewMarkdown($post);
2020-01-16 10:50:18 +01:00
}
elseif ($post['type'] === 'euler')
{
2020-01-17 00:25:29 +01:00
if ($subview === '') echo $SITE->fragments->BlogviewEulerList($post);
else echo $SITE->fragments->BlogviewEulerSingle($post, $subview);
2020-01-16 10:50:18 +01:00
}
elseif ($post['type'] === 'aoc')
{
2020-01-17 00:25:29 +01:00
if ($subview === '') echo $SITE->fragments->BlogviewAdventOfCodeList($post);
else echo $SITE->fragments->BlogviewAdventOfCodeSingle($post, $subview);
2020-01-16 10:50:18 +01:00
}
?>
2017-12-30 23:11:51 +01:00
</div>