Rework articles handling #35
5 changed files with 4 additions and 11 deletions
|
@ -18,7 +18,7 @@ class Archives extends dbList {
|
||||||
$db = $pages->getDB($onlyKeys=false);
|
$db = $pages->getDB($onlyKeys=false);
|
||||||
$archiveIndex = array();
|
$archiveIndex = array();
|
||||||
foreach ($db as $pageKey=>$pageFields) {
|
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'];
|
$date = $pageFields['date'];
|
||||||
$year = mb_substr($date, 0, 4);
|
$year = mb_substr($date, 0, 4);
|
||||||
$month = mb_substr($date, 0, 7);
|
$month = mb_substr($date, 0, 7);
|
||||||
|
|
|
@ -18,7 +18,7 @@ class Authors extends dbList {
|
||||||
$db = $pages->getDB($onlyKeys=false);
|
$db = $pages->getDB($onlyKeys=false);
|
||||||
$authorsIndex = array();
|
$authorsIndex = array();
|
||||||
foreach ($db as $pageKey=>$pageFields) {
|
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'];
|
$authorName = $pageFields['username'];
|
||||||
if (isset($authorsIndex[$authorName])) {
|
if (isset($authorsIndex[$authorName])) {
|
||||||
array_push($authorsIndex[$authorName]['list'], $pageKey);
|
array_push($authorsIndex[$authorName]['list'], $pageKey);
|
||||||
|
|
|
@ -103,9 +103,6 @@ define('MEDIA_MANAGER_SORT_BY_DATE', true);
|
||||||
|
|
||||||
// Constant arrays using define are not allowed in PHP 5.6 or earlier
|
// 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
|
// Allowed image extensions
|
||||||
$GLOBALS['ALLOWED_IMG_EXTENSION'] = array('gif', 'png', 'jpg', 'jpeg', 'svg', 'webp');
|
$GLOBALS['ALLOWED_IMG_EXTENSION'] = array('gif', 'png', 'jpg', 'jpeg', 'svg', 'webp');
|
||||||
|
|
||||||
|
|
|
@ -27,11 +27,7 @@ class Categories extends dbList {
|
||||||
if (!empty($pageFields['category'])) {
|
if (!empty($pageFields['category'])) {
|
||||||
$categoryKey = $pageFields['category'];
|
$categoryKey = $pageFields['category'];
|
||||||
if (isset($this->db[$categoryKey]['list'])) {
|
if (isset($this->db[$categoryKey]['list'])) {
|
||||||
if (
|
if ($db[$pageKey]['state']=='published') {
|
||||||
(($db[$pageKey]['type']=='article') ||
|
|
||||||
($db[$pageKey]['type']=='static')) &&
|
|
||||||
($db[$pageKey]['state']=='published')
|
|
||||||
) {
|
|
||||||
array_push($this->db[$categoryKey]['list'], $pageKey);
|
array_push($this->db[$categoryKey]['list'], $pageKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ class Tags extends dbList {
|
||||||
$db = $pages->getDB($onlyKeys=false);
|
$db = $pages->getDB($onlyKeys=false);
|
||||||
$tagsIndex = array();
|
$tagsIndex = array();
|
||||||
foreach ($db as $pageKey=>$pageFields) {
|
foreach ($db as $pageKey=>$pageFields) {
|
||||||
if (in_array($pageFields['type'], $GLOBALS['DB_TAGS_TYPES'])) {
|
if ($pageFields['state'] == "published") {
|
||||||
$tags = $pageFields['tags'];
|
$tags = $pageFields['tags'];
|
||||||
foreach ($tags as $tagKey=>$tagName) {
|
foreach ($tags as $tagKey=>$tagName) {
|
||||||
if (isset($tagsIndex[$tagKey])) {
|
if (isset($tagsIndex[$tagKey])) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue