diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Http/Exceptions/HttpPermanentRedirect.php | 17 | ||||
-rw-r--r-- | src/Http/Exceptions/HttpRedirect.php | 23 | ||||
-rw-r--r-- | src/Http/Exceptions/HttpTemporaryRedirect.php | 17 | ||||
-rw-r--r-- | src/Middleware/LegacyMiddleware.php | 3 |
4 files changed, 57 insertions, 3 deletions
diff --git a/src/Http/Exceptions/HttpPermanentRedirect.php b/src/Http/Exceptions/HttpPermanentRedirect.php new file mode 100644 index 00000000..a1aa986f --- /dev/null +++ b/src/Http/Exceptions/HttpPermanentRedirect.php @@ -0,0 +1,17 @@ +<?php + +namespace Engelsystem\Http\Exceptions; + +class HttpPermanentRedirect extends HttpRedirect +{ + /** + * @param string $url + * @param array $headers + */ + public function __construct( + string $url, + array $headers = [] + ) { + parent::__construct($url, 301, $headers); + } +} diff --git a/src/Http/Exceptions/HttpRedirect.php b/src/Http/Exceptions/HttpRedirect.php new file mode 100644 index 00000000..0e7d0250 --- /dev/null +++ b/src/Http/Exceptions/HttpRedirect.php @@ -0,0 +1,23 @@ +<?php + +namespace Engelsystem\Http\Exceptions; + +class HttpRedirect extends HttpException +{ + /** + * @param string $url + * @param int $statusCode + * @param array $headers + */ + public function __construct( + string $url, + int $statusCode = 302, + array $headers = [] + ) { + $headers = array_merge([ + 'Location' => $url, + ], $headers); + + parent::__construct($statusCode, '', $headers); + } +} diff --git a/src/Http/Exceptions/HttpTemporaryRedirect.php b/src/Http/Exceptions/HttpTemporaryRedirect.php new file mode 100644 index 00000000..ece8d607 --- /dev/null +++ b/src/Http/Exceptions/HttpTemporaryRedirect.php @@ -0,0 +1,17 @@ +<?php + +namespace Engelsystem\Http\Exceptions; + +class HttpTemporaryRedirect extends HttpRedirect +{ + /** + * @param string $url + * @param array $headers + */ + public function __construct( + string $url, + array $headers = [] + ) { + parent::__construct($url, 302, $headers); + } +} diff --git a/src/Middleware/LegacyMiddleware.php b/src/Middleware/LegacyMiddleware.php index de16e557..bd3987d2 100644 --- a/src/Middleware/LegacyMiddleware.php +++ b/src/Middleware/LegacyMiddleware.php @@ -69,9 +69,6 @@ class LegacyMiddleware implements MiddlewareInterface $page = $appRequest->path(); $page = str_replace('-', '_', $page); } - if ($page == '/') { - $page = $this->auth->user() ? config('home_site') : 'login'; - } $title = $content = ''; if ( |