From: VirtualTam Date: Wed, 8 Jul 2015 22:16:07 +0000 (+0200) Subject: Merge pull request #264 from ArthurHoaro/daily-nav X-Git-Tag: v0.5.0~15 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=46d83c20d77276e9e94c54e31b29222f762e13dd;hp=eee711c0a8583e1c2ea2186544795d59fa41d9f6;p=github%2Fshaarli%2FShaarli.git Merge pull request #264 from ArthurHoaro/daily-nav Fixes #260: previous/next day links in daily --- diff --git a/index.php b/index.php index bbe302a6..561f946e 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,12 +948,12 @@ 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 ($ifilterFulltext($_GET['searchterm']); elseif (!empty($_GET['searchtags'])) $links = $LINKSDB->filterTags(trim($_GET['searchtags'])); else $links = $LINKSDB; - + $body=''; $linksToDisplay=array(); @@ -1056,7 +1056,7 @@ function renderPage() $linksToDisplay[]=$link; // Add to array. } } - + $PAGE = new pageBuilder; $PAGE->assign('linkcount',count($LINKSDB)); $PAGE->assign('linksToDisplay',$linksToDisplay);