From 0a6f614571e1c10594cd7b45090163ef943249cf Mon Sep 17 00:00:00 2001 From: Steve Bian Date: Wed, 5 Feb 2020 15:00:04 +1100 Subject: [PATCH] Use KANBOARD_URL to build URIs if specified --- app/Helper/UrlHelper.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/Helper/UrlHelper.php b/app/Helper/UrlHelper.php index bd54fd949..94cb161bc 100644 --- a/app/Helper/UrlHelper.php +++ b/app/Helper/UrlHelper.php @@ -171,9 +171,13 @@ class UrlHelper extends Base public function dir() { if ($this->directory === '' && $this->request->getMethod() !== '') { - $this->directory = str_replace('\\', '/', dirname($this->request->getServerVariable('PHP_SELF'))); - $this->directory = $this->directory !== '/' ? $this->directory.'/' : '/'; - $this->directory = str_replace('//', '/', $this->directory); + if (defined('KANBOARD_URL') && strlen(KANBOARD_URL) > 0) { + $this->directory = parse_url(KANBOARD_URL, PHP_URL_PATH); + } else { + $this->directory = str_replace('\\', '/', dirname($this->request->getServerVariable('PHP_SELF'))); + $this->directory = $this->directory !== '/' ? $this->directory.'/' : '/'; + $this->directory = str_replace('//', '/', $this->directory); + } } return $this->directory;