diff options
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -876,7 +876,7 @@ class linkdb implements Iterator, Countable, ArrayAccess | |||
876 | } | 876 | } |
877 | 877 | ||
878 | // ------------------------------------------------------------------------------------------ | 878 | // ------------------------------------------------------------------------------------------ |
879 | // Ouput the last 50 links in RSS 2.0 format. | 879 | // Ouput the last N links in RSS 2.0 format. |
880 | function showRSS() | 880 | function showRSS() |
881 | { | 881 | { |
882 | header('Content-Type: application/rss+xml; charset=utf-8'); | 882 | header('Content-Type: application/rss+xml; charset=utf-8'); |
@@ -898,6 +898,7 @@ function showRSS() | |||
898 | if (!empty($_GET['searchterm'])) $linksToDisplay = $LINKSDB->filterFulltext($_GET['searchterm']); | 898 | if (!empty($_GET['searchterm'])) $linksToDisplay = $LINKSDB->filterFulltext($_GET['searchterm']); |
899 | elseif (!empty($_GET['searchtags'])) $linksToDisplay = $LINKSDB->filterTags(trim($_GET['searchtags'])); | 899 | elseif (!empty($_GET['searchtags'])) $linksToDisplay = $LINKSDB->filterTags(trim($_GET['searchtags'])); |
900 | else $linksToDisplay = $LINKSDB; | 900 | else $linksToDisplay = $LINKSDB; |
901 | $nblinksToDisplay = !empty($_GET['nb']) ? max($_GET['nb'] + 0, 1) : 50; | ||
901 | 902 | ||
902 | $pageaddr=htmlspecialchars(indexUrl()); | 903 | $pageaddr=htmlspecialchars(indexUrl()); |
903 | echo '<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">'; | 904 | echo '<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">'; |
@@ -912,7 +913,7 @@ function showRSS() | |||
912 | } | 913 | } |
913 | $i=0; | 914 | $i=0; |
914 | $keys=array(); foreach($linksToDisplay as $key=>$value) { $keys[]=$key; } // No, I can't use array_keys(). | 915 | $keys=array(); foreach($linksToDisplay as $key=>$value) { $keys[]=$key; } // No, I can't use array_keys(). |
915 | while ($i<50 && $i<count($keys)) | 916 | while ($i<$nblinksToDisplay && $i<count($keys)) |
916 | { | 917 | { |
917 | $link = $linksToDisplay[$keys[$i]]; | 918 | $link = $linksToDisplay[$keys[$i]]; |
918 | $guid = $pageaddr.'?'.smallHash($link['linkdate']); | 919 | $guid = $pageaddr.'?'.smallHash($link['linkdate']); |
@@ -945,7 +946,7 @@ function showRSS() | |||
945 | } | 946 | } |
946 | 947 | ||
947 | // ------------------------------------------------------------------------------------------ | 948 | // ------------------------------------------------------------------------------------------ |
948 | // Ouput the last 50 links in ATOM format. | 949 | // Ouput the last N links in ATOM format. |
949 | function showATOM() | 950 | function showATOM() |
950 | { | 951 | { |
951 | header('Content-Type: application/atom+xml; charset=utf-8'); | 952 | header('Content-Type: application/atom+xml; charset=utf-8'); |
@@ -968,13 +969,14 @@ function showATOM() | |||
968 | if (!empty($_GET['searchterm'])) $linksToDisplay = $LINKSDB->filterFulltext($_GET['searchterm']); | 969 | if (!empty($_GET['searchterm'])) $linksToDisplay = $LINKSDB->filterFulltext($_GET['searchterm']); |
969 | elseif (!empty($_GET['searchtags'])) $linksToDisplay = $LINKSDB->filterTags(trim($_GET['searchtags'])); | 970 | elseif (!empty($_GET['searchtags'])) $linksToDisplay = $LINKSDB->filterTags(trim($_GET['searchtags'])); |
970 | else $linksToDisplay = $LINKSDB; | 971 | else $linksToDisplay = $LINKSDB; |
972 | $nblinksToDisplay = !empty($_GET['nb']) ? max($_GET['nb'] + 0, 1) : 50; | ||
971 | 973 | ||
972 | $pageaddr=htmlspecialchars(indexUrl()); | 974 | $pageaddr=htmlspecialchars(indexUrl()); |
973 | $latestDate = ''; | 975 | $latestDate = ''; |
974 | $entries=''; | 976 | $entries=''; |
975 | $i=0; | 977 | $i=0; |
976 | $keys=array(); foreach($linksToDisplay as $key=>$value) { $keys[]=$key; } // No, I can't use array_keys(). | 978 | $keys=array(); foreach($linksToDisplay as $key=>$value) { $keys[]=$key; } // No, I can't use array_keys(). |
977 | while ($i<50 && $i<count($keys)) | 979 | while ($i<$nblinksToDisplay && $i<count($keys)) |
978 | { | 980 | { |
979 | $link = $linksToDisplay[$keys[$i]]; | 981 | $link = $linksToDisplay[$keys[$i]]; |
980 | $guid = $pageaddr.'?'.smallHash($link['linkdate']); | 982 | $guid = $pageaddr.'?'.smallHash($link['linkdate']); |