X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=index.php;h=5771dd8880043d48ada8b2aa1d36ea77d6fd18e0;hb=7f1dfd1c12a143b324fbe68213a49de0586febfa;hp=bbe302a63a4c9bb32ef85df27bd689432f14e286;hpb=9c8752a2061e67c719125edb6e0d6717d1af8553;p=github%2Fshaarli%2FShaarli.git diff --git a/index.php b/index.php index bbe302a6..5771dd88 100644 --- a/index.php +++ b/index.php @@ -709,7 +709,7 @@ function showRSS() if (!empty($_GET['searchterm'])) $linksToDisplay = $LINKSDB->filterFulltext($_GET['searchterm']); else if (!empty($_GET['searchtags'])) $linksToDisplay = $LINKSDB->filterTags(trim($_GET['searchtags'])); else $linksToDisplay = $LINKSDB; - + $nblinksToDisplay = 50; // Number of links to display. if (!empty($_GET['nb'])) // In URL, you can specificy the number of links. Example: nb=200 or nb=all for all links. { @@ -789,7 +789,7 @@ function showATOM() if (!empty($_GET['searchterm'])) $linksToDisplay = $LINKSDB->filterFulltext($_GET['searchterm']); else if (!empty($_GET['searchtags'])) $linksToDisplay = $LINKSDB->filterTags(trim($_GET['searchtags'])); else $linksToDisplay = $LINKSDB; - + $nblinksToDisplay = 50; // Number of links to display. if (!empty($_GET['nb'])) // In URL, you can specificy the number of links. Example: nb=200 or nb=all for all links. { @@ -948,16 +948,22 @@ function showDaily() $days = $LINKSDB->days(); $i = array_search($day,$days); - if ($i==false) { $i=count($days)-1; $day=$days[$i]; } + if ($i===false) { $i=count($days)-1; $day=$days[$i]; } $previousday=''; $nextday=''; if ($i!==false) { - if ($i>1) $previousday=$days[$i-1]; + if ($i>=1) $previousday=$days[$i-1]; if ($ifilterDay($day); + try { + $linksToDisplay = $LINKSDB->filterDay($day); + } catch (Exception $exc) { + error_log($exc); + $linksToDisplay = []; + } + // We pre-format some fields for proper output. foreach($linksToDisplay as $key=>$link) { @@ -1041,7 +1047,7 @@ function renderPage() if (!empty($_GET['searchterm'])) $links = $LINKSDB->filterFulltext($_GET['searchterm']); elseif (!empty($_GET['searchtags'])) $links = $LINKSDB->filterTags(trim($_GET['searchtags'])); else $links = $LINKSDB; - + $body=''; $linksToDisplay=array(); @@ -1056,7 +1062,7 @@ function renderPage() $linksToDisplay[]=$link; // Add to array. } } - + $PAGE = new pageBuilder; $PAGE->assign('linkcount',count($LINKSDB)); $PAGE->assign('linksToDisplay',$linksToDisplay);