Skip to content

Commit

Permalink
Gallery: Fix errors with missing gallery and missing gallery box sett…
Browse files Browse the repository at this point in the history
…ings (#956)
  • Loading branch information
blackcoder87 authored Apr 7, 2024
1 parent 5b9b613 commit 1126a28
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions application/modules/gallery/boxes/Pictureofx.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ class Pictureofx extends Box
public function render()
{
$imageMapper = new ImageMapper();
$galleries = explode(',', $this->getConfig()->get('gallery_pictureOfXSource'));
$galleries = explode(',', $this->getConfig()->get('gallery_pictureOfXSource') ?? '');
$imageIds = $imageMapper->getListOfValidIds(['gallery_id' => $galleries]);

if (!empty($imageIds)) {
$currentPicOfX = explode(',', $this->getConfig()->get('gallery_currentPicOfX'));
$currentPicOfX = explode(',', $this->getConfig()->get('gallery_currentPicOfX') ?? '');

switch ($this->getConfig()->get('gallery_pictureOfXInterval')) {
case '1':
Expand All @@ -45,7 +45,7 @@ public function render()
$currentTime = new DateTime();
$currentIndex = (!empty($currentPicOfX[0])) ? $currentPicOfX[0] : 0;
$setAt = (!empty($currentPicOfX[1])) ? $currentPicOfX[1] : null;
$date = new DateTime($setAt);
$date = ($setAt) ? new DateTime($setAt) : $currentTime;

if (!empty($add)) {
$date->add(new DateInterval($add));
Expand Down
2 changes: 1 addition & 1 deletion application/modules/gallery/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Config extends Install
{
public $config = [
'key' => 'gallery',
'version' => '1.22.1',
'version' => '1.22.2',
'icon_small' => 'fa-regular fa-image',
'author' => 'Stantin, Thomas',
'link' => 'https://ilch.de',
Expand Down
2 changes: 1 addition & 1 deletion application/modules/gallery/controllers/admin/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function indexAction()
}
}

$oldItems = $galleryMapper->getGalleryItems();
$oldItems = $galleryMapper->getGalleryItems() ?? [];

// Delete no longer existing items.
foreach ($oldItems as $oldItem) {
Expand Down

0 comments on commit 1126a28

Please sign in to comment.