aboutsummaryrefslogtreecommitdiffhomepage
path: root/application
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-05-17 11:29:17 +0200
committerArthurHoaro <arthur@hoa.ro>2020-07-23 21:19:21 +0200
commite3d28be9673a9f8404ff907b8191209729ad690c (patch)
tree545eb94208672c0c0195a4d8d354956c59b8d150 /application
parent07f99432b7b0c75935b758b20a30c3e0007bac13 (diff)
downloadShaarli-e3d28be9673a9f8404ff907b8191209729ad690c.tar.gz
Shaarli-e3d28be9673a9f8404ff907b8191209729ad690c.tar.zst
Shaarli-e3d28be9673a9f8404ff907b8191209729ad690c.zip
Slim daily: minor bugfix with empty data
Diffstat (limited to 'application')
-rw-r--r--application/front/controllers/DailyController.php18
1 files changed, 6 insertions, 12 deletions
diff --git a/application/front/controllers/DailyController.php b/application/front/controllers/DailyController.php
index c2fdaa55..271c0ee2 100644
--- a/application/front/controllers/DailyController.php
+++ b/application/front/controllers/DailyController.php
@@ -30,10 +30,13 @@ class DailyController extends ShaarliController
30 $nbAvailableDates = count($availableDates); 30 $nbAvailableDates = count($availableDates);
31 $index = array_search($day, $availableDates); 31 $index = array_search($day, $availableDates);
32 32
33 if ($index === false && $nbAvailableDates > 0) { 33 if ($index === false) {
34 // no bookmarks for day, but at least one day with bookmarks 34 // no bookmarks for day, but at least one day with bookmarks
35 $index = $nbAvailableDates - 1; 35 $day = $availableDates[$nbAvailableDates - 1] ?? $day;
36 $day = $availableDates[$index]; 36 $previousDay = $availableDates[$nbAvailableDates - 2] ?? '';
37 } else {
38 $previousDay = $availableDates[$index - 1] ?? '';
39 $nextDay = $availableDates[$index + 1] ?? '';
37 } 40 }
38 41
39 if ($day === date('Ymd')) { 42 if ($day === date('Ymd')) {
@@ -42,15 +45,6 @@ class DailyController extends ShaarliController
42 $this->assignView('dayDesc', t('Yesterday')); 45 $this->assignView('dayDesc', t('Yesterday'));
43 } 46 }
44 47
45 if ($index !== false) {
46 if ($index >= 1) {
47 $previousDay = $availableDates[$index - 1];
48 }
49 if ($index < $nbAvailableDates - 1) {
50 $nextDay = $availableDates[$index + 1];
51 }
52 }
53
54 try { 48 try {
55 $linksToDisplay = $this->container->bookmarkService->filterDay($day); 49 $linksToDisplay = $this->container->bookmarkService->filterDay($day);
56 } catch (\Exception $exc) { 50 } catch (\Exception $exc) {