aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/front/controllers/DailyController.php
diff options
context:
space:
mode:
Diffstat (limited to 'application/front/controllers/DailyController.php')
-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) {