diff options
author | ArthurHoaro <arthur@hoa.ro> | 2020-06-13 13:08:01 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2020-07-23 21:19:21 +0200 |
commit | 9c75f877935fa6adec951a4d8d32b328aaab314f (patch) | |
tree | 1cdd09ddfc00c6cebb92bb2b90381a06fd31246d /application/front/ShaarliMiddleware.php | |
parent | 818b3193ffabec57501e3bdfa997206e3c0671ef (diff) | |
download | Shaarli-9c75f877935fa6adec951a4d8d32b328aaab314f.tar.gz Shaarli-9c75f877935fa6adec951a4d8d32b328aaab314f.tar.zst Shaarli-9c75f877935fa6adec951a4d8d32b328aaab314f.zip |
Use multi-level routes for existing controllers instead of 1 level everywhere
Also prefix most admin routes with /admin/
Diffstat (limited to 'application/front/ShaarliMiddleware.php')
-rw-r--r-- | application/front/ShaarliMiddleware.php | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/application/front/ShaarliMiddleware.php b/application/front/ShaarliMiddleware.php index 47aa61bb..7ad610c7 100644 --- a/application/front/ShaarliMiddleware.php +++ b/application/front/ShaarliMiddleware.php | |||
@@ -38,9 +38,9 @@ class ShaarliMiddleware | |||
38 | */ | 38 | */ |
39 | public function __invoke(Request $request, Response $response, callable $next) | 39 | public function __invoke(Request $request, Response $response, callable $next) |
40 | { | 40 | { |
41 | try { | 41 | $this->container->basePath = rtrim($request->getUri()->getBasePath(), '/'); |
42 | $this->container->basePath = rtrim($request->getUri()->getBasePath(), '/'); | ||
43 | 42 | ||
43 | try { | ||
44 | $response = $next($request, $response); | 44 | $response = $next($request, $response); |
45 | } catch (ShaarliFrontException $e) { | 45 | } catch (ShaarliFrontException $e) { |
46 | $this->container->pageBuilder->assign('message', $e->getMessage()); | 46 | $this->container->pageBuilder->assign('message', $e->getMessage()); |
@@ -54,7 +54,7 @@ class ShaarliMiddleware | |||
54 | $response = $response->withStatus($e->getCode()); | 54 | $response = $response->withStatus($e->getCode()); |
55 | $response = $response->write($this->container->pageBuilder->render('error')); | 55 | $response = $response->write($this->container->pageBuilder->render('error')); |
56 | } catch (UnauthorizedException $e) { | 56 | } catch (UnauthorizedException $e) { |
57 | return $response->withRedirect($request->getUri()->getBasePath() . '/login'); | 57 | return $response->withRedirect($this->container->basePath . '/login'); |
58 | } | 58 | } |
59 | 59 | ||
60 | return $response; | 60 | return $response; |