diff options
author | ArthurHoaro <arthur@hoa.ro> | 2015-07-08 17:11:06 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2015-07-08 17:12:06 +0200 |
commit | f3db3774f93b7aa01efeb5e9014b4f035d02efdb (patch) | |
tree | b838c7b04b0158358f2e101e789edf220caa0171 | |
parent | eee711c0a8583e1c2ea2186544795d59fa41d9f6 (diff) | |
download | Shaarli-f3db3774f93b7aa01efeb5e9014b4f035d02efdb.tar.gz Shaarli-f3db3774f93b7aa01efeb5e9014b4f035d02efdb.tar.zst Shaarli-f3db3774f93b7aa01efeb5e9014b4f035d02efdb.zip |
Fixes #260: previous/next day links in daily
The bug was occuring only if we tried to access to the first day.
-rw-r--r-- | index.php | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -709,7 +709,7 @@ function showRSS() | |||
709 | if (!empty($_GET['searchterm'])) $linksToDisplay = $LINKSDB->filterFulltext($_GET['searchterm']); | 709 | if (!empty($_GET['searchterm'])) $linksToDisplay = $LINKSDB->filterFulltext($_GET['searchterm']); |
710 | else if (!empty($_GET['searchtags'])) $linksToDisplay = $LINKSDB->filterTags(trim($_GET['searchtags'])); | 710 | else if (!empty($_GET['searchtags'])) $linksToDisplay = $LINKSDB->filterTags(trim($_GET['searchtags'])); |
711 | else $linksToDisplay = $LINKSDB; | 711 | else $linksToDisplay = $LINKSDB; |
712 | 712 | ||
713 | $nblinksToDisplay = 50; // Number of links to display. | 713 | $nblinksToDisplay = 50; // Number of links to display. |
714 | if (!empty($_GET['nb'])) // In URL, you can specificy the number of links. Example: nb=200 or nb=all for all links. | 714 | if (!empty($_GET['nb'])) // In URL, you can specificy the number of links. Example: nb=200 or nb=all for all links. |
715 | { | 715 | { |
@@ -789,7 +789,7 @@ function showATOM() | |||
789 | if (!empty($_GET['searchterm'])) $linksToDisplay = $LINKSDB->filterFulltext($_GET['searchterm']); | 789 | if (!empty($_GET['searchterm'])) $linksToDisplay = $LINKSDB->filterFulltext($_GET['searchterm']); |
790 | else if (!empty($_GET['searchtags'])) $linksToDisplay = $LINKSDB->filterTags(trim($_GET['searchtags'])); | 790 | else if (!empty($_GET['searchtags'])) $linksToDisplay = $LINKSDB->filterTags(trim($_GET['searchtags'])); |
791 | else $linksToDisplay = $LINKSDB; | 791 | else $linksToDisplay = $LINKSDB; |
792 | 792 | ||
793 | $nblinksToDisplay = 50; // Number of links to display. | 793 | $nblinksToDisplay = 50; // Number of links to display. |
794 | if (!empty($_GET['nb'])) // In URL, you can specificy the number of links. Example: nb=200 or nb=all for all links. | 794 | if (!empty($_GET['nb'])) // In URL, you can specificy the number of links. Example: nb=200 or nb=all for all links. |
795 | { | 795 | { |
@@ -948,12 +948,12 @@ function showDaily() | |||
948 | 948 | ||
949 | $days = $LINKSDB->days(); | 949 | $days = $LINKSDB->days(); |
950 | $i = array_search($day,$days); | 950 | $i = array_search($day,$days); |
951 | if ($i==false) { $i=count($days)-1; $day=$days[$i]; } | 951 | if ($i===false) { $i=count($days)-1; $day=$days[$i]; } |
952 | $previousday=''; | 952 | $previousday=''; |
953 | $nextday=''; | 953 | $nextday=''; |
954 | if ($i!==false) | 954 | if ($i!==false) |
955 | { | 955 | { |
956 | if ($i>1) $previousday=$days[$i-1]; | 956 | if ($i>=1) $previousday=$days[$i-1]; |
957 | if ($i<count($days)-1) $nextday=$days[$i+1]; | 957 | if ($i<count($days)-1) $nextday=$days[$i+1]; |
958 | } | 958 | } |
959 | 959 | ||
@@ -1041,7 +1041,7 @@ function renderPage() | |||
1041 | if (!empty($_GET['searchterm'])) $links = $LINKSDB->filterFulltext($_GET['searchterm']); | 1041 | if (!empty($_GET['searchterm'])) $links = $LINKSDB->filterFulltext($_GET['searchterm']); |
1042 | elseif (!empty($_GET['searchtags'])) $links = $LINKSDB->filterTags(trim($_GET['searchtags'])); | 1042 | elseif (!empty($_GET['searchtags'])) $links = $LINKSDB->filterTags(trim($_GET['searchtags'])); |
1043 | else $links = $LINKSDB; | 1043 | else $links = $LINKSDB; |
1044 | 1044 | ||
1045 | $body=''; | 1045 | $body=''; |
1046 | $linksToDisplay=array(); | 1046 | $linksToDisplay=array(); |
1047 | 1047 | ||
@@ -1056,7 +1056,7 @@ function renderPage() | |||
1056 | $linksToDisplay[]=$link; // Add to array. | 1056 | $linksToDisplay[]=$link; // Add to array. |
1057 | } | 1057 | } |
1058 | } | 1058 | } |
1059 | 1059 | ||
1060 | $PAGE = new pageBuilder; | 1060 | $PAGE = new pageBuilder; |
1061 | $PAGE->assign('linkcount',count($LINKSDB)); | 1061 | $PAGE->assign('linkcount',count($LINKSDB)); |
1062 | $PAGE->assign('linksToDisplay',$linksToDisplay); | 1062 | $PAGE->assign('linksToDisplay',$linksToDisplay); |