From ae7dbe3c11ebcdedb30ea0acbe152a4bb244af56 Mon Sep 17 00:00:00 2001
From: Kazhnuz <kazhnuz@kobold.cafe>
Date: Sat, 25 Jan 2025 13:11:42 +0100
Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20(content):=20use=20the=20p?=
 =?UTF-8?q?ublished=20state=20for=20list=20building?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 bl-kernel/archives.class.php   | 2 +-
 bl-kernel/authors.class.php    | 2 +-
 bl-kernel/boot/variables.php   | 3 ---
 bl-kernel/categories.class.php | 6 +-----
 bl-kernel/tags.class.php       | 2 +-
 5 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/bl-kernel/archives.class.php b/bl-kernel/archives.class.php
index 98243561..7fe60172 100644
--- a/bl-kernel/archives.class.php
+++ b/bl-kernel/archives.class.php
@@ -18,7 +18,7 @@ class Archives extends dbList {
 		$db = $pages->getDB($onlyKeys=false);
 		$archiveIndex = array();
 		foreach ($db as $pageKey=>$pageFields) {
-			if (in_array($pageFields['type'], $GLOBALS['DB_TAGS_TYPES']) && $pageFields['state'] == "published") {
+			if ($pageFields['type'] == "article" && $pageFields['state'] == "published") {
 				$date = $pageFields['date'];
                 $year = mb_substr($date, 0, 4);
                 $month = mb_substr($date, 0, 7);
diff --git a/bl-kernel/authors.class.php b/bl-kernel/authors.class.php
index 6f169927..7b4a5856 100644
--- a/bl-kernel/authors.class.php
+++ b/bl-kernel/authors.class.php
@@ -18,7 +18,7 @@ class Authors extends dbList {
 		$db = $pages->getDB($onlyKeys=false);
 		$authorsIndex = array();
 		foreach ($db as $pageKey=>$pageFields) {
-			if (in_array($pageFields['type'], $GLOBALS['DB_TAGS_TYPES']) && $pageFields['state'] == "published") {
+			if ($pageFields['type'] == "article" && $pageFields['state'] == "published") {
 				$authorName = $pageFields['username'];
 				if (isset($authorsIndex[$authorName])) {
 					array_push($authorsIndex[$authorName]['list'], $pageKey);
diff --git a/bl-kernel/boot/variables.php b/bl-kernel/boot/variables.php
index fbc3c915..e17f7708 100644
--- a/bl-kernel/boot/variables.php
+++ b/bl-kernel/boot/variables.php
@@ -103,9 +103,6 @@ define('MEDIA_MANAGER_SORT_BY_DATE', true);
 
 // Constant arrays using define are not allowed in PHP 5.6 or earlier
 
-// Type of pages included in the tag database
-$GLOBALS['DB_TAGS_TYPES'] = array('article','static','sticky');
-
 // Allowed image extensions
 $GLOBALS['ALLOWED_IMG_EXTENSION'] = array('gif', 'png', 'jpg', 'jpeg', 'svg', 'webp');
 
diff --git a/bl-kernel/categories.class.php b/bl-kernel/categories.class.php
index 10f040f1..05e2354a 100644
--- a/bl-kernel/categories.class.php
+++ b/bl-kernel/categories.class.php
@@ -27,11 +27,7 @@ class Categories extends dbList {
 			if (!empty($pageFields['category'])) {
 				$categoryKey = $pageFields['category'];
 				if (isset($this->db[$categoryKey]['list'])) {
-					if (
-						(($db[$pageKey]['type']=='article') ||
-						($db[$pageKey]['type']=='static')) &&
-						($db[$pageKey]['state']=='published')
-					) {
+					if ($db[$pageKey]['state']=='published') {
 						array_push($this->db[$categoryKey]['list'], $pageKey);
 					}
 				}
diff --git a/bl-kernel/tags.class.php b/bl-kernel/tags.class.php
index 204b009f..ae148066 100644
--- a/bl-kernel/tags.class.php
+++ b/bl-kernel/tags.class.php
@@ -18,7 +18,7 @@ class Tags extends dbList {
 		$db = $pages->getDB($onlyKeys=false);
 		$tagsIndex = array();
 		foreach ($db as $pageKey=>$pageFields) {
-			if (in_array($pageFields['type'], $GLOBALS['DB_TAGS_TYPES'])) {
+			if ($pageFields['state'] == "published") {
 				$tags = $pageFields['tags'];
 				foreach ($tags as $tagKey=>$tagName) {
 					if (isset($tagsIndex[$tagKey])) {