page stubs + fixed errors pages

This commit is contained in:
flash 2020-08-19 16:33:55 +02:00
parent f67096c538
commit 718fc88b09
17 changed files with 61 additions and 6 deletions

View file

@ -1,5 +1,6 @@
<?php
if($reqPath === '/projects.php' || $reqPath === '/projects.html') {
if($reqPath === '/projects.php' || $reqPath === '/projects.html'
|| $reqPath === '/utilities' || $reqPath === '/utilities.php' || $reqPath === '/utilities.html') {
if($reqMethod !== 'GET')
return FM_ERR | 405;
header('Location: /projects');

2
public/about.php Normal file
View file

@ -0,0 +1,2 @@
<?php
require_once __DIR__ . '/index.php';

View file

@ -660,6 +660,16 @@ body {
pointer-events: none;
}
.http-error {
text-align: center;
}
.http-error-head {
font-family: 'Electrolize', Verdana, 'Dejavu Sans', Arial, Helvetica, sans-serif;
font-size: 2.5em;
line-height: 2em;
font-weight: 400;
}
/** SPRITE SHIT START **/
.fmi {
background-image: url('sprite.png');

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

2
public/blog-post.php Normal file
View file

@ -0,0 +1,2 @@
<?php
require_once __DIR__ . '/index.php';

2
public/blog.php Normal file
View file

@ -0,0 +1,2 @@
<?php
require_once __DIR__ . '/index.php';

2
public/contact.php Normal file
View file

@ -0,0 +1,2 @@
<?php
require_once __DIR__ . '/index.php';

2
public/etc.php Normal file
View file

@ -0,0 +1,2 @@
<?php
require_once __DIR__ . '/index.php';

2
public/etcetera.php Normal file
View file

@ -0,0 +1,2 @@
<?php
require_once __DIR__ . '/index.php';

2
public/friends.php Normal file
View file

@ -0,0 +1,2 @@
<?php
require_once __DIR__ . '/index.php';

View file

@ -53,9 +53,24 @@ define('FM_FEET', [
]);
define('FM_ERRS' , [
403 => ['code' => 403, 'title' => 'Access Denied'],
404 => ['code' => 404, 'title' => 'Not Found'],
405 => ['code' => 405, 'title' => 'Method Not Supported'],
403 => [
'code' => 403,
'title' => 'Access Denied',
'image' => '/assets/errors/403.jpg',
'desc' => 'You are not supposed to be here.',
],
404 => [
'code' => 404,
'title' => 'Not Found',
'image' => '/assets/errors/404.jpg',
'desc' => 'Whatever you\'re looking for is no longer here, or might not have been here in the first place.',
],
405 => [
'code' => 405,
'title' => 'Method Not Supported',
'image' => '/assets/errors/405.jpg',
'desc' => 'You\'re up to something, aren\'t you?',
],
]);
function fm_component(string $name, array $vars = []) {
@ -115,7 +130,7 @@ $reqMethod = filter_input(INPUT_SERVER, 'REQUEST_METHOD', F
$reqPath = '/' . trim(parse_url(filter_input(INPUT_SERVER, 'REQUEST_URI', FILTER_SANITIZE_STRING), PHP_URL_PATH), '/');
if(substr($reqPath, 0, 7) === '/error/') {
$statusCode = intval(substr($reqPath, 8, 3));
$statusCode = intval(substr($reqPath, 7, 3));
} else {
foreach(glob(__DIR__ . '/../pages/*.php') as $page) {
$result = include_once $page;
@ -132,6 +147,13 @@ if(substr($reqPath, 0, 7) === '/error/') {
$errorInfo = FM_ERRS[$statusCode ?? 404] ?? FM_ERRS[404];
http_response_code($errorInfo['code']);
fm_component('header', ['title' => $errorInfo['title']]);
printf(" <h2>%s</h2>\r\n", $errorInfo['title']);
?>
<div class="http-error">
<h2 class="http-error-head"><?=$errorInfo['title'];?></h2>
<img src="<?=$errorInfo['image'];?>" alt="<?=$errorInfo['image'];?>" class="http-error-image"/>
<div class="http-error-desc"><?=$errorInfo['desc'];?></div>
</div>
<?php
fm_component('footer');

2
public/misc.php Normal file
View file

@ -0,0 +1,2 @@
<?php
require_once __DIR__ . '/index.php';

2
public/projects.php Normal file
View file

@ -0,0 +1,2 @@
<?php
require_once __DIR__ . '/index.php';

2
public/related.php Normal file
View file

@ -0,0 +1,2 @@
<?php
require_once __DIR__ . '/index.php';

2
public/utilities.php Normal file
View file

@ -0,0 +1,2 @@
<?php
require_once __DIR__ . '/index.php';