Updated Composer packages; empty field fix

Composer dependencies were pretty old, so they needed to be upgraded to
the latest.

There was also a minor bug that was triggered when a new page was saved
with empty tags and no images or documents, so that's been patched as
well.
This commit is contained in:
Ro 2023-04-09 17:16:24 -07:00
parent f1850ce7f7
commit 4876c1336e
No known key found for this signature in database
GPG key ID: 29B551CDBD4D3B50
5 changed files with 280 additions and 245 deletions

View file

@ -120,9 +120,14 @@ class DashControl
} else { } else {
$views = (new Themes())->getCustomViews(); $views = (new Themes())->getCustomViews();
} }
$imageList = [];
$imageList = explode(',', $page['feature']); $fileList = [];
$fileList = explode(',', $page['files']); if (isset($page['feature'])) {
$imageList = explode(',', $page['feature']);
}
if (isset($page['files'])) {
$fileList = explode(',', $page['files']);
}
$images = []; $images = [];
$files = []; $files = [];

View file

@ -108,10 +108,14 @@ class Contents
]; ];
$sanitizer = $builder->build($detergent); $sanitizer = $builder->build($detergent);
$scrubbed = $sanitizer->sanitize($result->getContent());
if (isset($meta['feature'])) {
$featureList = explode(',', $meta['feature']);
} else {
$featureList = "";
}
$scrubbed = $sanitizer->sanitize($result->getContent()); $docs = '';
$featureList = explode(',', $meta['feature']);
$docs = '';
if (isset($meta['files'])) { if (isset($meta['files'])) {
$fileList = explode(',', $meta['files']); $fileList = explode(',', $meta['files']);
$docs = $meta['files']; $docs = $meta['files'];
@ -122,19 +126,23 @@ class Contents
$media = []; $media = [];
$files = []; $files = [];
foreach ($featureList as $file) { if ($featureList != '') {
$item = trim($file); foreach ($featureList as $file) {
$ext = pathinfo($item, PATHINFO_EXTENSION); $item = trim($file);
if ($item != null || $item != '') { $ext = pathinfo($item, PATHINFO_EXTENSION);
array_push($media, ['file' => $item, 'type' => trim($ext)]); if ($item != null || $item != '') {
array_push($media, ['file' => $item, 'type' => trim($ext)]);
}
} }
} }
foreach ($fileList as $file) { if ($fileList != "") {
$item = trim($file); foreach ($fileList as $file) {
$ext = pathinfo($item, PATHINFO_EXTENSION); $item = trim($file);
if ($item != null || $item != '') { $ext = pathinfo($item, PATHINFO_EXTENSION);
array_push($files, ['file' => $item, 'type' => trim($ext)]); if ($item != null || $item != '') {
array_push($files, ['file' => $item, 'type' => trim($ext)]);
}
} }
} }

View file

@ -23,15 +23,17 @@ class Sorting
$pages = (new Book('../content/pages'))->getContents(); $pages = (new Book('../content/pages'))->getContents();
foreach ($pages as $page) { foreach ($pages as $page) {
$temp = []; $temp = [];
$temp = explode(',', $page['tags']); if (isset($page['tags'])) {
foreach ($temp as $tag) { $temp = explode(',', $page['tags']);
$label = trim($tag); foreach ($temp as $tag) {
if (!find(self::$p_tags, ['tag_name' => $label])) { $label = trim($tag);
array_push(self::$p_tags, [ if (!find(self::$p_tags, ['tag_name' => $label])) {
'tag_name' => $label, array_push(self::$p_tags, [
'slug' => StringTools::safeString($label), 'tag_name' => $label,
'pages' => self::tagPages($label, $pages), 'slug' => StringTools::safeString($label),
]); 'pages' => self::tagPages($label, $pages),
]);
}
} }
} }
} }
@ -43,13 +45,15 @@ class Sorting
{ {
$tagged = []; $tagged = [];
foreach ($pages as $page) { foreach ($pages as $page) {
if (strpos($page['tags'], $tag) !== false) { if (isset($page['tags'])) {
array_push($tagged, [ if (strpos($page['tags'], $tag) !== false) {
'title' => $page['title'], array_push($tagged, [
'slug' => $page['slug'], 'title' => $page['title'],
'path' => $page['path'], 'slug' => $page['slug'],
'feature' => $page['feature'], 'path' => $page['path'],
]); 'feature' => $page['feature'],
]);
}
} }
} }
@ -124,15 +128,16 @@ class Sorting
'image' => $settings['global']['base_url'] . $settings['global']['background'], 'image' => $settings['global']['base_url'] . $settings['global']['background'],
'baseURL' => $settings['global']['base_url'], 'baseURL' => $settings['global']['base_url'],
]; ];
$tags = [];
$taglist = explode(',', $page['tags']); if (isset($page['tags'])) {
$tags = []; $taglist = explode(',', $page['tags']);
foreach ($taglist as $tag) { foreach ($taglist as $tag) {
$label = trim($tag); $label = trim($tag);
array_push($tags, [ array_push($tags, [
'label' => $label . ' ', 'label' => $label . ' ',
'slug' => StringTools::safeString($label), 'slug' => StringTools::safeString($label),
]); ]);
}
} }
$meta = [ $meta = [

View file

@ -1,7 +1,7 @@
{ {
"name": "are0h/fipamo", "name": "are0h/fipamo",
"descriptions": "The most chill no database blog framework ever.", "descriptions": "The most chill no database blog framework ever.",
"version": "2.5.1-beta", "version": "2.6.0-beta",
"homepage": "https://fipamo.blog", "homepage": "https://fipamo.blog",
"authors": [ "authors": [
{ {
@ -10,9 +10,9 @@
} }
], ],
"support": { "support": {
"source": "https://code.playvicio.us/Are0h/Fipamo", "source": "https://koodu.ubiqueros.com/are0h/Fipamo",
"wiki": "https://code.playvicio.us/Are0h/Fipamo/wiki/_pages", "wiki": "https://koodu.ubiqueros.com/are0h/Fipamo/wiki/?action=_pages",
"issues": "https://code.playvicio.us/Are0h/Fipamo/issues" "issues": "https://koodu.ubiqueros.com/are0h/Fipamo/issues"
}, },
"require": { "require": {
"slim/slim": "4.*", "slim/slim": "4.*",
@ -28,5 +28,10 @@
"symfony/yaml": "^5.4", "symfony/yaml": "^5.4",
"olegatro/html-sanitizer-relative": "^1.0", "olegatro/html-sanitizer-relative": "^1.0",
"nesbot/carbon": "^2.62" "nesbot/carbon": "^2.62"
} },
"scripts": {
"start": [
"@php -S localhost:8000 -t public/"
]
}
} }

410
composer.lock generated

File diff suppressed because it is too large Load diff