page stubs + fixed errors pages
This commit is contained in:
parent
f67096c538
commit
718fc88b09
17 changed files with 61 additions and 6 deletions
|
@ -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
2
public/about.php
Normal file
|
@ -0,0 +1,2 @@
|
|||
<?php
|
||||
require_once __DIR__ . '/index.php';
|
|
@ -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');
|
||||
|
|
BIN
public/assets/errors/403.jpg
Normal file
BIN
public/assets/errors/403.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
BIN
public/assets/errors/404.jpg
Normal file
BIN
public/assets/errors/404.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 29 KiB |
BIN
public/assets/errors/405.jpg
Normal file
BIN
public/assets/errors/405.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 46 KiB |
2
public/blog-post.php
Normal file
2
public/blog-post.php
Normal file
|
@ -0,0 +1,2 @@
|
|||
<?php
|
||||
require_once __DIR__ . '/index.php';
|
2
public/blog.php
Normal file
2
public/blog.php
Normal file
|
@ -0,0 +1,2 @@
|
|||
<?php
|
||||
require_once __DIR__ . '/index.php';
|
2
public/contact.php
Normal file
2
public/contact.php
Normal file
|
@ -0,0 +1,2 @@
|
|||
<?php
|
||||
require_once __DIR__ . '/index.php';
|
2
public/etc.php
Normal file
2
public/etc.php
Normal file
|
@ -0,0 +1,2 @@
|
|||
<?php
|
||||
require_once __DIR__ . '/index.php';
|
2
public/etcetera.php
Normal file
2
public/etcetera.php
Normal file
|
@ -0,0 +1,2 @@
|
|||
<?php
|
||||
require_once __DIR__ . '/index.php';
|
2
public/friends.php
Normal file
2
public/friends.php
Normal file
|
@ -0,0 +1,2 @@
|
|||
<?php
|
||||
require_once __DIR__ . '/index.php';
|
|
@ -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
2
public/misc.php
Normal file
|
@ -0,0 +1,2 @@
|
|||
<?php
|
||||
require_once __DIR__ . '/index.php';
|
2
public/projects.php
Normal file
2
public/projects.php
Normal file
|
@ -0,0 +1,2 @@
|
|||
<?php
|
||||
require_once __DIR__ . '/index.php';
|
2
public/related.php
Normal file
2
public/related.php
Normal file
|
@ -0,0 +1,2 @@
|
|||
<?php
|
||||
require_once __DIR__ . '/index.php';
|
2
public/utilities.php
Normal file
2
public/utilities.php
Normal file
|
@ -0,0 +1,2 @@
|
|||
<?php
|
||||
require_once __DIR__ . '/index.php';
|
Loading…
Reference in a new issue