From 7f5250421be4832b9679d8140bc4a71c8005dfa3 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Fri, 16 Oct 2020 12:47:11 +0200 Subject: Support using Shaarli without URL rewriting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Shaarli can be fully used by prefixing any URL with /index.php/ - {$base_path} used in templates already works with this configuration - Assets path (outside of theme's assets) must be prefixed with {$root_url}/ - Documentation section in « Server configuration » Fixes #1590 --- application/render/PageBuilder.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'application') diff --git a/application/render/PageBuilder.php b/application/render/PageBuilder.php index 41b357dd..2d6d2dbe 100644 --- a/application/render/PageBuilder.php +++ b/application/render/PageBuilder.php @@ -174,10 +174,12 @@ class PageBuilder } } + $rootPath = preg_replace('#/index\.php$#', '', $basePath); $this->assign('base_path', $basePath); + $this->assign('root_path', $rootPath); $this->assign( 'asset_path', - $basePath . '/' . + $rootPath . '/' . rtrim($this->conf->get('resource.raintpl_tpl', 'tpl'), '/') . '/' . $this->conf->get('resource.theme', 'default') ); -- cgit v1.2.3 From 3adbdc2a83e6b77a4ca62094c5d857524e39d211 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Fri, 16 Oct 2020 13:06:06 +0200 Subject: Inject ROOT_PATH in plugin instead of regenerating it everywhere --- application/front/controller/visitor/ShaarliVisitorController.php | 1 + application/plugin/PluginManager.php | 1 + 2 files changed, 2 insertions(+) (limited to 'application') diff --git a/application/front/controller/visitor/ShaarliVisitorController.php b/application/front/controller/visitor/ShaarliVisitorController.php index 55c075a2..54f9fe03 100644 --- a/application/front/controller/visitor/ShaarliVisitorController.php +++ b/application/front/controller/visitor/ShaarliVisitorController.php @@ -106,6 +106,7 @@ abstract class ShaarliVisitorController 'target' => $template, 'loggedin' => $this->container->loginManager->isLoggedIn(), 'basePath' => $this->container->basePath, + 'rootPath' => preg_replace('#/index\.php$#', '', $this->container->basePath), 'bookmarkService' => $this->container->bookmarkService ]; } diff --git a/application/plugin/PluginManager.php b/application/plugin/PluginManager.php index 1b2197c9..da66dea3 100644 --- a/application/plugin/PluginManager.php +++ b/application/plugin/PluginManager.php @@ -104,6 +104,7 @@ class PluginManager 'target' => '_PAGE_', 'loggedin' => '_LOGGEDIN_', 'basePath' => '_BASE_PATH_', + 'rootPath' => '_ROOT_PATH_', 'bookmarkService' => '_BOOKMARK_SERVICE_', ]; -- cgit v1.2.3