From 71528b2e5cc9e4aa28f1b0d9ef3f14c192b2d7c5 Mon Sep 17 00:00:00 2001 From: Diego Najar Date: Tue, 6 Mar 2018 19:42:18 +0100 Subject: [PATCH] Remove url filter /blog/ #557 --- bl-kernel/admin/views/settings-advanced.php | 21 ++++++++++++++++++++- bl-kernel/boot/init.php | 4 ---- bl-kernel/dbsite.class.php | 21 ++++++++------------- bl-kernel/functions.php | 4 ++++ bl-themes/blogx/php/page.php | 2 +- 5 files changed, 33 insertions(+), 19 deletions(-) diff --git a/bl-kernel/admin/views/settings-advanced.php b/bl-kernel/admin/views/settings-advanced.php index ea6fa1c1..4f529d63 100644 --- a/bl-kernel/admin/views/settings-advanced.php +++ b/bl-kernel/admin/views/settings-advanced.php @@ -102,7 +102,8 @@ HTML::formOpen(array('class'=>'uk-form-horizontal')); 'label'=>$L->g('Blog'), 'value'=>$Site->uriFilters('blog'), 'class'=>'uk-width-1-2 uk-form-medium', - 'tip'=>DOMAIN_BLOG + 'tip'=>DOMAIN.$Site->uriFilters('blog'), + 'disabled'=>!$Site->uriFilters('blog') )); echo '
@@ -113,3 +114,21 @@ HTML::formOpen(array('class'=>'uk-form-horizontal'));
'; HTML::formClose(); + +?> + + \ No newline at end of file diff --git a/bl-kernel/boot/init.php b/bl-kernel/boot/init.php index 61469d34..67e35ca4 100644 --- a/bl-kernel/boot/init.php +++ b/bl-kernel/boot/init.php @@ -198,9 +198,6 @@ define('CATEGORY_URI_FILTER', $Url->filters('category')); // Page URI filter define('PAGE_URI_FILTER', $Url->filters('page')); -// Blog URI filter -define('BLOG_URI_FILTER', $Url->filters('blog')); - // Content order by: date / position define('ORDER_BY', $Site->orderBy()); @@ -234,7 +231,6 @@ define('DOMAIN_ADMIN', DOMAIN_BASE.ADMIN_URI_FILTER); define('DOMAIN_TAGS', Text::addSlashes(DOMAIN_BASE.TAG_URI_FILTER, false, true)); define('DOMAIN_CATEGORIES', Text::addSlashes(DOMAIN_BASE.CATEGORY_URI_FILTER, false, true)); define('DOMAIN_PAGES', Text::addSlashes(DOMAIN_BASE.PAGE_URI_FILTER, false, true)); -define('DOMAIN_BLOG', Text::addSlashes(DOMAIN_BASE.BLOG_URI_FILTER, false, true)); $ADMIN_CONTROLLER = ''; $ADMIN_VIEW = ''; diff --git a/bl-kernel/dbsite.class.php b/bl-kernel/dbsite.class.php index f813f67e..ae73e547 100644 --- a/bl-kernel/dbsite.class.php +++ b/bl-kernel/dbsite.class.php @@ -67,19 +67,10 @@ class dbSite extends dbJSON public function uriFilters($filter='') { $filters['admin'] = '/'.ADMIN_URI_FILTER; + $filters['page'] = $this->getField('uriPage'); + $filters['tag'] = $this->getField('uriTag'); + $filters['category'] = $this->getField('uriCategory'); - if ($this->getField('uriPage')) { - $filters['page'] = $this->getField('uriPage'); - } - - if ($this->getField('uriTag')) { - $filters['tag'] = $this->getField('uriTag'); - } - - if ($this->getField('uriCategory')) { - $filters['category'] = $this->getField('uriCategory'); - } - if ($this->getField('uriBlog')) { $filters['blog'] = $this->getField('uriBlog'); } @@ -88,7 +79,11 @@ class dbSite extends dbJSON return $filters; } - return $filters[$filter]; + if (isset($filters[$filter])) { + return $filters[$filter]; + } + + return false; } // Returns the URL of the rss.xml file diff --git a/bl-kernel/functions.php b/bl-kernel/functions.php index 830d42f3..0c3ff608 100644 --- a/bl-kernel/functions.php +++ b/bl-kernel/functions.php @@ -659,15 +659,19 @@ function editSettings($args) { if (isset($args['uriPage'])) { $args['uriPage'] = Text::addSlashes($args['uriPage']); } + if (isset($args['uriTag'])) { $args['uriTag'] = Text::addSlashes($args['uriTag']); } + if (isset($args['uriCategory'])) { $args['uriCategory'] = Text::addSlashes($args['uriCategory']); } if (isset($args['uriBlog'])) { $args['uriBlog'] = Text::addSlashes($args['uriBlog']); + } else { + $args['uriBlog'] = ''; } if ($Site->set($args)) { diff --git a/bl-themes/blogx/php/page.php b/bl-themes/blogx/php/page.php index b0d6959b..96f87d30 100644 --- a/bl-themes/blogx/php/page.php +++ b/bl-themes/blogx/php/page.php @@ -12,7 +12,7 @@

title(); ?>

- isStatic()): ?> + isStatic() && !$Url->notFound()): ?>
date(); ?> - get('Reading time') . ': ' . $page->readingTime() ?>