Nuked the shitty blog for now.

This commit is contained in:
flash 2022-09-25 22:17:54 +00:00
parent b2b666e4d7
commit e4a2ed2228
5 changed files with 8 additions and 108 deletions

View file

@ -1,94 +0,0 @@
<?php
namespace Makai;
$router->get('/blog.php', function() {
header('Location: /old-blog/' . (int)filter_input(INPUT_GET, 'p', FILTER_SANITIZE_NUMBER_INT));
return 302;
});
$router->get('/blog-post.php', function() {
header('Location: /old-blog/' . (int)filter_input(INPUT_GET, 'p', FILTER_SANITIZE_NUMBER_INT));
return 302;
});
$router->get('/blog/:id', function(string $id) {
header('Location: /old-blog/' . intval($id));
return 302;
});
$router->get('/old-blog', function() {
$blogInfo = json_decode(file_get_contents(MKI_DIR_PUB . '/old_blog_posts.json'));
$body = fm_component('header', [
'title' => 'flash.moe / old blog posts',
]);
$body .= <<<HTML
<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; text-align: center;">List of old blog posts to enjoy while I Eventually make the new script.</div>
</div>
HTML;
$body .= '<div class="ob-wrapper"><div class="ob-blogs">';
foreach($blogInfo as $postInfo) {
$preview = trim(explode("\n", $postInfo->post_text)[0]);
$dateCustom = date('Y-m-d @ H:i:s T', $postInfo->post_published);
$dateISO = date('c', $postInfo->post_published);
$body .= <<<HTML
<div class="ob-blog ob-preview">
<h1><a href="/old-blog/{$postInfo->post_id}" data-fm-dynload="">{$postInfo->post_title}</a></h1>
<time datetime="{$dateISO}">{$dateCustom}</time>
<p>{$preview}</p>
<a class="ob-continue" href="/old-blog/{$postInfo->post_id}" data-fm-dynload="">Continue reading</a>
</div>\r\n
HTML;
}
$body .= '</div></div>';
$body .= fm_component('footer');
return $body;
});
$router->get('/old-blog/:id', function(string $id) {
if(!is_numeric($id))
return 404;
$postId = intval($id);
$blogInfo = json_decode(file_get_contents(MKI_DIR_PUB . '/old_blog_posts.json'));
foreach($blogInfo as $postInfo) {
if($postInfo->post_id !== $postId)
continue;
$dateCustom = date('Y-m-d @ H:i:s T', $postInfo->post_published);
$dateISO = date('c', $postInfo->post_published);
$preview = trim(explode("\n", $postInfo->post_text)[0]);
$body = fm_component('header', [
'title' => 'flash.moe / ' . $postInfo->post_title,
]);
$body .= '<div class="ob-wrapper"><div class="ob-blog"><div class="ob-blog">';
if(!empty($postInfo->post_new_url))
$body .= "<a href=\"{$postInfo->post_new_url}\" style=\"display: block; text-align: center; color: #fff; text-decoration: none; font-size: 2em; line-height: 1.5em; padding: 20px 10px; margin: 10px 0; font-weight: bold; background-color: #222; border-radius: 5px\">This post has a new url, please go here instead!</a>";
$body .= "<h1>{$postInfo->post_title}</h1>";
$body .= "<time datetime=\"{$dateISO}\">{$dateCustom}</time>";
$splitLines = explode("\n", $postInfo->post_text);
foreach ($splitLines as $paragraph)
if(!empty($paragraph))
$body .= '<p>' . trim($paragraph) . '</p>';
$body .= '</div></div></div>';
$body .= fm_component('footer');
return $body;
}
return 404;
});

View file

@ -3,9 +3,8 @@ namespace Makai;
$router->get('/contact.php', mkiRedirect('/contact')); $router->get('/contact.php', mkiRedirect('/contact'));
$router->get('/contact.html', mkiRedirect('/contact')); $router->get('/contact.html', mkiRedirect('/contact'));
$router->get('/nintendo', mkiRedirect('/contact'));
$router->get('/nintendo', mkiRedirect('/contact#gaming')); $router->get('/nintendo.php', mkiRedirect('/contact'));
$router->get('/nintendo.php', mkiRedirect('/contact#gaming'));
$router->get('/contact', function() { $router->get('/contact', function() {
$contact = [ $contact = [

View file

@ -21,11 +21,13 @@ $router->get('/misc', mkiRedirect('/'));
$router->get('/misc.html', mkiRedirect('/')); $router->get('/misc.html', mkiRedirect('/'));
$router->get('/misc.php', mkiRedirect('/')); $router->get('/misc.php', mkiRedirect('/'));
$router->get('/etc', mkiRedirect('/')); $router->get('/etc', mkiRedirect('/'));
$router->get('/365', mkiRedirect('/'));
$router->get('/365', mkiRedirect('/?fw365'));
//$router->get('/donate', mkiRedirect('https://paypal.me/flashwave'));
$router->get('/donate', mkiRedirect('/')); $router->get('/donate', mkiRedirect('/'));
$router->get('/blog.php', mkiRedirect('/'));
$router->get('/blog-post.php', mkiRedirect('/'));
$router->get('/blog/:id', mkiRedirect('/'));
$router->get('/old-blog', mkiRedirect('/'));
$router->get('/old-blog/:id', mkiRedirect('/'));
$router->get('/header-bgs.json', function() { $router->get('/header-bgs.json', function() {
return json_encode(FM_BGS); return json_encode(FM_BGS);
@ -154,10 +156,6 @@ $router->get('/', function() use ($db) {
} }
} }
$is365 = isset($_GET['fw365']);
$blogInfo = json_decode(file_get_contents(MKI_DIR_PUB . '/old_blog_posts.json'));
$projects = (new Projects($db))->getFeatured(); $projects = (new Projects($db))->getFeatured();
$languages = new Languages($db); $languages = new Languages($db);
@ -188,7 +186,6 @@ $router->get('/', function() use ($db) {
$body = fm_component('header', [ $body = fm_component('header', [
'title' => 'flash.moe', 'title' => 'flash.moe',
'is_index' => true, 'is_index' => true,
'is_365' => $is365,
]); ]);
$body .= '<div class="index-menu">'; $body .= '<div class="index-menu">';

View file

@ -170,7 +170,6 @@ function mkiRedirect(string $to): callable {
}; };
} }
require_once MKI_DIR_PAGES . '/blog.php';
require_once MKI_DIR_PAGES . '/contact.php'; require_once MKI_DIR_PAGES . '/contact.php';
require_once MKI_DIR_PAGES . '/index.php'; require_once MKI_DIR_PAGES . '/index.php';
require_once MKI_DIR_PAGES . '/projects.php'; require_once MKI_DIR_PAGES . '/projects.php';

File diff suppressed because one or more lines are too long