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 = [];
$fileList = [];
if (isset($page['feature'])) {
$imageList = explode(',', $page['feature']); $imageList = explode(',', $page['feature']);
}
if (isset($page['files'])) {
$fileList = explode(',', $page['files']); $fileList = explode(',', $page['files']);
}
$images = []; $images = [];
$files = []; $files = [];

View file

@ -108,9 +108,13 @@ class Contents
]; ];
$sanitizer = $builder->build($detergent); $sanitizer = $builder->build($detergent);
$scrubbed = $sanitizer->sanitize($result->getContent()); $scrubbed = $sanitizer->sanitize($result->getContent());
if (isset($meta['feature'])) {
$featureList = explode(',', $meta['feature']); $featureList = explode(',', $meta['feature']);
} else {
$featureList = "";
}
$docs = ''; $docs = '';
if (isset($meta['files'])) { if (isset($meta['files'])) {
$fileList = explode(',', $meta['files']); $fileList = explode(',', $meta['files']);
@ -122,6 +126,7 @@ class Contents
$media = []; $media = [];
$files = []; $files = [];
if ($featureList != '') {
foreach ($featureList as $file) { foreach ($featureList as $file) {
$item = trim($file); $item = trim($file);
$ext = pathinfo($item, PATHINFO_EXTENSION); $ext = pathinfo($item, PATHINFO_EXTENSION);
@ -129,7 +134,9 @@ class Contents
array_push($media, ['file' => $item, 'type' => trim($ext)]); array_push($media, ['file' => $item, 'type' => trim($ext)]);
} }
} }
}
if ($fileList != "") {
foreach ($fileList as $file) { foreach ($fileList as $file) {
$item = trim($file); $item = trim($file);
$ext = pathinfo($item, PATHINFO_EXTENSION); $ext = pathinfo($item, PATHINFO_EXTENSION);
@ -137,6 +144,7 @@ class Contents
array_push($files, ['file' => $item, 'type' => trim($ext)]); array_push($files, ['file' => $item, 'type' => trim($ext)]);
} }
} }
}
//sort attributes into page object //sort attributes into page object
$page = [ $page = [

View file

@ -23,6 +23,7 @@ class Sorting
$pages = (new Book('../content/pages'))->getContents(); $pages = (new Book('../content/pages'))->getContents();
foreach ($pages as $page) { foreach ($pages as $page) {
$temp = []; $temp = [];
if (isset($page['tags'])) {
$temp = explode(',', $page['tags']); $temp = explode(',', $page['tags']);
foreach ($temp as $tag) { foreach ($temp as $tag) {
$label = trim($tag); $label = trim($tag);
@ -35,6 +36,7 @@ class Sorting
} }
} }
} }
}
return self::$p_tags; return self::$p_tags;
} }
@ -43,6 +45,7 @@ class Sorting
{ {
$tagged = []; $tagged = [];
foreach ($pages as $page) { foreach ($pages as $page) {
if (isset($page['tags'])) {
if (strpos($page['tags'], $tag) !== false) { if (strpos($page['tags'], $tag) !== false) {
array_push($tagged, [ array_push($tagged, [
'title' => $page['title'], 'title' => $page['title'],
@ -52,6 +55,7 @@ class Sorting
]); ]);
} }
} }
}
return $tagged; return $tagged;
} }
@ -124,9 +128,9 @@ 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'],
]; ];
$taglist = explode(',', $page['tags']);
$tags = []; $tags = [];
if (isset($page['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, [
@ -134,6 +138,7 @@ class Sorting
'slug' => StringTools::safeString($label), 'slug' => StringTools::safeString($label),
]); ]);
} }
}
$meta = [ $meta = [
'who' => $page['author'], 'who' => $page['author'],

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