♻️ (content): use the published state for list building

This commit is contained in:
Kazhnuz 2025-01-25 13:11:42 +01:00
parent 6291f97a72
commit ae7dbe3c11
5 changed files with 4 additions and 11 deletions

View file

@ -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);

View file

@ -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);

View file

@ -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');

View file

@ -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);
}
}

View file

@ -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])) {