Add 404 page

This commit is contained in:
osaajani 2020-02-20 03:53:15 +01:00
parent 4548c360f0
commit e7beafaa8b
6 changed files with 60 additions and 2 deletions

View File

@ -1,2 +1,2 @@
RewriteEngine on
RewriteRule "!\.(js|ico|ICO|gif|GIF|jpg|JPG|jpeg|JPEG|png|PNG|css|woff|woff2|ttf|wav|ogg|mp3)$" index.php
RewriteRule "!\.(js|ico|ICO|gif|GIF|jpg|JPG|jpeg|JPEG|png|PNG|css|woff|woff2|ttf|wav|ogg|mp3|svg)$" index.php

1
assets/img/404.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 21 KiB

0
confs/systemd/raspisms.service Executable file → Normal file
View File

View File

@ -0,0 +1,29 @@
<?php
/*
* This file is part of RaspiSMS.
*
* (c) Pierre-Lin Bonnemaison <plebwebsas@gmail.com>
*
* This source file is subject to the GPL-3.0 license that is bundled
* with this source code in the file LICENSE.
*/
namespace controllers\internals;
/**
* Handler for HTTP errors page
* Not a standard controller as it's not linked to a model in any way.
*/
class HttpError extends \descartes\InternalController
{
/**
* Return 404 error page
*/
public function _404 ()
{
http_response_code(404);
$this->render('error/404');
}
}

View File

@ -14,4 +14,12 @@
}
//Routing current query
descartes\Router::route(ROUTES, $_SERVER['REQUEST_URI']);
try
{
descartes\Router::route(ROUTES, $_SERVER['REQUEST_URI']);
}
catch (\descartes\exceptions\DescartesException404 $e)
{
$controller = new \controllers\internals\HttpError();
$controller->_404();
}

20
templates/error/404.php Normal file
View File

@ -0,0 +1,20 @@
<?php
//Template dashboard
$this->render('incs/head', ['title' => ''])
?>
<div class="container-fluid">
<div class="row">
<div class="col-xs-10 col-xs-offset-1 col-md-4 col-md-offset-4 text-center" style="color: #fff">
<h1>Erreur 404, cette page n'existe pas.</h1>
<br/>
<img src="<?= HTTP_PWD_IMG; ?>/404.svg" width="100%"/>
<br/><br/>
<br/><br/>
<a href="<?= HTTP_PWD; ?>" class="btn btn-default btn-lg">Retour à l'accueil</a>
<br/><br/>
</div>
</div>
</div>
<?php
$this->render('incs/footer');