comments, bug fixes for buildpages by tags

This commit is contained in:
Diego Najar 2019-02-28 19:55:06 +01:00
parent c16741808f
commit e548d75e3e
7 changed files with 13 additions and 10 deletions

View File

@ -30,11 +30,9 @@ class dbJSON {
// Unserialize, JSON to Array
$array = $this->unserialize($implode);
if (empty($array)) {
$this->db = array();
$this->dbBackup = array();
Log::set(__METHOD__.LOG_SEP.'Error trying to read the JSON file: '.$file, LOG_TYPE_ERROR);
} else {
$this->db = $array;
$this->dbBackup = $array;
@ -100,7 +98,8 @@ class dbJSON {
{
// NULL is returned if the json cannot be decoded
$decode = json_decode($data, true);
if (empty($decode)) {
if ($decode===NULL) {
Log::set(__METHOD__.LOG_SEP.'Error trying to read the JSON file: '.$this->file, LOG_TYPE_ERROR);
return false;
}
return $decode;

View File

@ -126,7 +126,7 @@ class dbList extends dbJSON
}
// Sort the categories by "Natural order"
private function sortAlphanumeric()
public function sortAlphanumeric()
{
// Sort key alphanumeric strings, a01, a10, b10, c02
return ksort($this->db);

@ -1 +1 @@
Subproject commit e0b144877b87f41d08a634f812726da5c887918c
Subproject commit f616042ccc0eaa37dab6a0c3ad67bb022574952b

View File

@ -9,7 +9,7 @@ define('BLUDIT_BUILD', '20190228');
// Debug mode
// Change to FALSE, for prevent warning or errors on browser
define('DEBUG_MODE', TRUE);
define('DEBUG_TYPE', 'INFO'); // INFO, TRACE
define('DEBUG_TYPE', 'TRACE'); // INFO, TRACE
error_reporting(0); // Turn off all error reporting
if (DEBUG_MODE) {
// Turn on all error reporting

View File

@ -118,7 +118,12 @@ function buildPagesFor($for, $categoryKey=false, $tagKey=false) {
foreach ($list as $pageKey) {
try {
$page = new Page($pageKey);
array_push($content, $page);
if ( ($page->type()=='published') ||
($page->type()=='sticky') ||
($page->type()=='static')
) {
array_push($content, $page);
}
} catch (Exception $e) {
// continue
}

View File

@ -8,7 +8,7 @@ class Pages extends dbJSON {
'description'=>'',
'username'=>'',
'tags'=>array(),
'type'=>'published', // published, draft, sticky, scheduled
'type'=>'published', // published, static, draft, sticky, scheduled
'date'=>'',
'dateModified'=>'',
'position'=>0,

View File

@ -31,9 +31,8 @@ class Tags extends dbList {
}
}
// Sort database by alphabet
ksort($tagsIndex);
$this->db = $tagsIndex;
$this->sortAlphanumeric();
return $this->save();
}