From 36716c2d3bcb6bd22d3ab9ec8850af5bf0b202f1 Mon Sep 17 00:00:00 2001 From: Christian Tietze Date: Fri, 23 Aug 2019 18:02:25 +0200 Subject: [PATCH 1/5] fallback to reading a page for "/tags" --- bl-kernel/url.class.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/bl-kernel/url.class.php b/bl-kernel/url.class.php index b3e7a86f..f7a65628 100644 --- a/bl-kernel/url.class.php +++ b/bl-kernel/url.class.php @@ -56,12 +56,6 @@ class Url $subString = mb_substr($this->uri, 0, $filterFullLenght, CHARSET); - // Check coincidence without the last slash at the end, this case is notfound - if ($subString==$filterURIwoSlash) { - $this->setNotFound(); - return false; - } - // Check coincidence with complete filterURI if ($subString==$filterFull) { $this->slug = mb_substr($this->uri, $filterFullLenght); @@ -77,6 +71,9 @@ class Url $this->setWhereAmI('home'); } elseif (!empty($this->slug) && ($filterURI=='/')) { $this->setWhereAmI('page'); + } elseif (empty($this->slug) && ($filterName=='tag')) { + $this->slug = 'tag'; + $this->setWhereAmI('page'); } elseif ($filterName=='admin') { $this->slug = ltrim($this->slug, '/'); } From 08e4421c657e7b174d6560a160164acba4c4c693 Mon Sep 17 00:00:00 2001 From: Christian Tietze Date: Fri, 23 Aug 2019 18:08:11 +0200 Subject: [PATCH 2/5] use TAG_URI_FILTER for tag index --- bl-kernel/url.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bl-kernel/url.class.php b/bl-kernel/url.class.php index f7a65628..7d1e8e65 100644 --- a/bl-kernel/url.class.php +++ b/bl-kernel/url.class.php @@ -71,8 +71,8 @@ class Url $this->setWhereAmI('home'); } elseif (!empty($this->slug) && ($filterURI=='/')) { $this->setWhereAmI('page'); - } elseif (empty($this->slug) && ($filterName=='tag')) { - $this->slug = 'tag'; + } elseif (empty($this->slug) && ($filterName==TAG_URI_FILTER)) { + $this->slug = TAG_URI_FILTER; $this->setWhereAmI('page'); } elseif ($filterName=='admin') { $this->slug = ltrim($this->slug, '/'); From 2cf7339796c324d23f2fb778cc157ceb6e6947dc Mon Sep 17 00:00:00 2001 From: Christian Tietze Date: Fri, 23 Aug 2019 18:09:17 +0200 Subject: [PATCH 3/5] add category index page fallback --- bl-kernel/url.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bl-kernel/url.class.php b/bl-kernel/url.class.php index 7d1e8e65..de712ed4 100644 --- a/bl-kernel/url.class.php +++ b/bl-kernel/url.class.php @@ -74,6 +74,9 @@ class Url } elseif (empty($this->slug) && ($filterName==TAG_URI_FILTER)) { $this->slug = TAG_URI_FILTER; $this->setWhereAmI('page'); + } elseif (empty($this->slug) && ($filterName==CATEGORY_URI_FILTER)) { + $this->slug = CATEGORY_URI_FILTER; + $this->setWhereAmI('page'); } elseif ($filterName=='admin') { $this->slug = ltrim($this->slug, '/'); } From c968717dbfb06d559f726f33c00f337652b4fdd8 Mon Sep 17 00:00:00 2001 From: Christian Tietze Date: Fri, 23 Aug 2019 18:30:30 +0200 Subject: [PATCH 4/5] fix access to `CATEGORY_URI_FILTER` and `TAG_URI_FILTER` before define'd --- bl-kernel/url.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bl-kernel/url.class.php b/bl-kernel/url.class.php index de712ed4..2e65e58f 100644 --- a/bl-kernel/url.class.php +++ b/bl-kernel/url.class.php @@ -71,11 +71,11 @@ class Url $this->setWhereAmI('home'); } elseif (!empty($this->slug) && ($filterURI=='/')) { $this->setWhereAmI('page'); - } elseif (empty($this->slug) && ($filterName==TAG_URI_FILTER)) { - $this->slug = TAG_URI_FILTER; + } elseif (empty($this->slug) && ($filterName==$this->filters('tag'))) { + $this->slug = $this->filters('tag'); $this->setWhereAmI('page'); - } elseif (empty($this->slug) && ($filterName==CATEGORY_URI_FILTER)) { - $this->slug = CATEGORY_URI_FILTER; + } elseif (empty($this->slug) && ($filterName==$this->filters('category'))) { + $this->slug = $this->filters('category'); $this->setWhereAmI('page'); } elseif ($filterName=='admin') { $this->slug = ltrim($this->slug, '/'); From 72b22d1b014840a583ff625fe109d0c3fbfbab15 Mon Sep 17 00:00:00 2001 From: Christian Tietze Date: Fri, 23 Aug 2019 18:40:09 +0200 Subject: [PATCH 5/5] fix $filterName test wrongly taking the value from settings --- bl-kernel/url.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bl-kernel/url.class.php b/bl-kernel/url.class.php index 2e65e58f..c89e3963 100644 --- a/bl-kernel/url.class.php +++ b/bl-kernel/url.class.php @@ -71,10 +71,10 @@ class Url $this->setWhereAmI('home'); } elseif (!empty($this->slug) && ($filterURI=='/')) { $this->setWhereAmI('page'); - } elseif (empty($this->slug) && ($filterName==$this->filters('tag'))) { + } elseif (empty($this->slug) && ($filterName=='tag')) { $this->slug = $this->filters('tag'); $this->setWhereAmI('page'); - } elseif (empty($this->slug) && ($filterName==$this->filters('category'))) { + } elseif (empty($this->slug) && ($filterName=='category')) { $this->slug = $this->filters('category'); $this->setWhereAmI('page'); } elseif ($filterName=='admin') {