]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - application/front/controller/visitor/ShaarliVisitorController.php
Initialize admin Slim controllers
[github/shaarli/Shaarli.git] / application / front / controller / visitor / ShaarliVisitorController.php
similarity index 91%
rename from application/front/controllers/ShaarliController.php
rename to application/front/controller/visitor/ShaarliVisitorController.php
index bfff5fcf636ccd64942176655293e346ce702fa3..655b3baa294ce2f639163e6ab9a820b744ae4cf7 100644 (file)
@@ -2,13 +2,14 @@
 
 declare(strict_types=1);
 
-namespace Shaarli\Front\Controller;
+namespace Shaarli\Front\Controller\Visitor;
 
 use Shaarli\Bookmark\BookmarkFilter;
 use Shaarli\Container\ShaarliContainer;
+use Slim\Http\Request;
 use Slim\Http\Response;
 
-abstract class ShaarliController
+abstract class ShaarliVisitorController
 {
     /** @var ShaarliContainer */
     protected $container;
@@ -89,9 +90,13 @@ abstract class ShaarliController
      * @param array $loopTerms   Terms to remove from path and query string to prevent direction loop.
      * @param array $clearParams List of parameter to remove from the query string of the referrer.
      */
-    protected function redirectFromReferer(Response $response, array $loopTerms = [], array $clearParams = []): Response
-    {
-        $defaultPath = './';
+    protected function redirectFromReferer(
+        Request $request,
+        Response $response,
+        array $loopTerms = [],
+        array $clearParams = []
+    ): Response {
+        $defaultPath = $request->getUri()->getBasePath();
         $referer = $this->container->environment['HTTP_REFERER'] ?? null;
 
         if (null !== $referer) {