From 185ae093932d9f5638b8ccde542d5a6835b6cb59 Mon Sep 17 00:00:00 2001 From: Diego Najar Date: Thu, 7 Mar 2019 21:27:34 +0100 Subject: [PATCH] allow differents types of pages to the tag database --- bl-kernel/boot/variables.php | 4 +++- bl-kernel/tags.class.php | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/bl-kernel/boot/variables.php b/bl-kernel/boot/variables.php index 93f72a3f..e1786835 100644 --- a/bl-kernel/boot/variables.php +++ b/bl-kernel/boot/variables.php @@ -92,6 +92,9 @@ define('SESSION_GC_MAXLIFETIME', 3600); // The value 0 means until the browser is closed define('SESSION_COOKIE_LIFE_TIME', 0); +// Tags, type of pages included in the tag database +define('DB_TAGS_TYPES', array('published','static','sticky')); + // Alert notification dissappear in X seconds $GLOBALS['ALERT_DISSAPEAR_IN'] = 3; // Seconds @@ -100,4 +103,3 @@ $GLOBALS['MEDIA_MANAGER_NUMBER_OF_FILES'] = 5; // Sort the image by date $GLOBALS['MEDIA_MANAGER_SORT_BY_DATE'] = true; - diff --git a/bl-kernel/tags.class.php b/bl-kernel/tags.class.php index 6720f4e4..cb5fc21a 100644 --- a/bl-kernel/tags.class.php +++ b/bl-kernel/tags.class.php @@ -15,18 +15,18 @@ class Tags extends dbList { public function reindex() { global $pages; - - // Get a database with published pages - $db = $pages->getDB(false); + $db = $pages->getDB($onlyKeys=false); $tagsIndex = array(); foreach ($db as $pageKey=>$pageFields) { - $tags = $pageFields['tags']; - foreach ($tags as $tagKey=>$tagName) { - if (isset($tagsIndex[$tagKey])) { - array_push($tagsIndex[$tagKey]['list'], $pageKey); - } else { - $tagsIndex[$tagKey]['name'] = $tagName; - $tagsIndex[$tagKey]['list'] = array($pageKey); + if (in_array($pageFields['type'], DB_TAGS_TYPES)) { + $tags = $pageFields['tags']; + foreach ($tags as $tagKey=>$tagName) { + if (isset($tagsIndex[$tagKey])) { + array_push($tagsIndex[$tagKey]['list'], $pageKey); + } else { + $tagsIndex[$tagKey]['name'] = $tagName; + $tagsIndex[$tagKey]['list'] = array($pageKey); + } } } }