diff options
author | Igor Scheller <igor.scheller@igorshp.de> | 2018-08-25 21:16:20 +0200 |
---|---|---|
committer | Igor Scheller <igor.scheller@igorshp.de> | 2018-08-25 21:48:39 +0200 |
commit | a1bc763a16ee8be109de5c9053fbc5eded53824e (patch) | |
tree | 7253db0c8ea918e82253bef3926bcba461a7105d /src/Middleware/NotFoundResponse.php | |
parent | 73c9d923e7cc77847cfcbff4b90ad4815699a4fa (diff) |
Added nikic/fast-route as routing dispatcher
Diffstat (limited to 'src/Middleware/NotFoundResponse.php')
-rw-r--r-- | src/Middleware/NotFoundResponse.php | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/src/Middleware/NotFoundResponse.php b/src/Middleware/NotFoundResponse.php deleted file mode 100644 index f9431c1d..00000000 --- a/src/Middleware/NotFoundResponse.php +++ /dev/null @@ -1,56 +0,0 @@ -<?php - -namespace Engelsystem\Middleware; - -use Engelsystem\Http\Response; -use Psr\Http\Message\ResponseInterface; -use Psr\Http\Message\ServerRequestInterface; -use Psr\Http\Server\MiddlewareInterface; -use Psr\Http\Server\RequestHandlerInterface; - -class NotFoundResponse implements MiddlewareInterface -{ - /** - * Returns a 404: Page not found response - * - * Should be the last middleware - * - * @param ServerRequestInterface $request - * @param RequestHandlerInterface $handler - * @return ResponseInterface - */ - public function process( - ServerRequestInterface $request, - RequestHandlerInterface $handler - ): ResponseInterface { - $info = _('This page could not be found or you don\'t have permission to view it. You probably have to sign in or register in order to gain access!'); - - return $this->renderPage($info); - } - - /** - * @param string $content - * @return Response - * @codeCoverageIgnore - */ - protected function renderPage($content) - { - global $user; - $event_config = EventConfig(); - - return response(view(__DIR__ . '/../../templates/layout.html', [ - 'theme' => isset($user) ? $user['color'] : config('theme'), - 'title' => _('Page not found'), - 'atom_link' => '', - 'start_page_url' => page_link_to('/'), - 'credits_url' => page_link_to('credits'), - 'menu' => make_menu(), - 'content' => msg() . info($content), - 'header_toolbar' => header_toolbar(), - 'faq_url' => config('faq_url'), - 'contact_email' => config('contact_email'), - 'locale' => locale(), - 'event_info' => EventConfig_info($event_config) . ' <br />' - ]), 404); - } -} |