aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'index.php')
-rw-r--r--index.php25
1 files changed, 23 insertions, 2 deletions
diff --git a/index.php b/index.php
index 80cf8bea..a547fbe8 100644
--- a/index.php
+++ b/index.php
@@ -946,8 +946,12 @@ function showRSS()
946 // Optionally filter the results: 946 // Optionally filter the results:
947 $linksToDisplay=array(); 947 $linksToDisplay=array();
948 if (!empty($_GET['searchterm'])) $linksToDisplay = $LINKSDB->filterFulltext($_GET['searchterm']); 948 if (!empty($_GET['searchterm'])) $linksToDisplay = $LINKSDB->filterFulltext($_GET['searchterm']);
949 elseif (!empty($_GET['searchtags'])) $linksToDisplay = $LINKSDB->filterTags(trim($_GET['searchtags'])); 949 else if (!empty($_GET['searchtags'])) $linksToDisplay = $LINKSDB->filterTags(trim($_GET['searchtags']));
950 else $linksToDisplay = $LINKSDB; 950 else $linksToDisplay = $LINKSDB;
951
952 if ($GLOBALS['config']['HIDE_PUBLIC_LINKS'] && !isLoggedIn())
953 $linksToDisplay = array();
954
951 $nblinksToDisplay = 50; // Number of links to display. 955 $nblinksToDisplay = 50; // Number of links to display.
952 if (!empty($_GET['nb'])) // In URL, you can specificy the number of links. Example: nb=200 or nb=all for all links. 956 if (!empty($_GET['nb'])) // In URL, you can specificy the number of links. Example: nb=200 or nb=all for all links.
953 { 957 {
@@ -1021,8 +1025,12 @@ function showATOM()
1021 // Optionally filter the results: 1025 // Optionally filter the results:
1022 $linksToDisplay=array(); 1026 $linksToDisplay=array();
1023 if (!empty($_GET['searchterm'])) $linksToDisplay = $LINKSDB->filterFulltext($_GET['searchterm']); 1027 if (!empty($_GET['searchterm'])) $linksToDisplay = $LINKSDB->filterFulltext($_GET['searchterm']);
1024 elseif (!empty($_GET['searchtags'])) $linksToDisplay = $LINKSDB->filterTags(trim($_GET['searchtags'])); 1028 else if (!empty($_GET['searchtags'])) $linksToDisplay = $LINKSDB->filterTags(trim($_GET['searchtags']));
1025 else $linksToDisplay = $LINKSDB; 1029 else $linksToDisplay = $LINKSDB;
1030
1031 if ($GLOBALS['config']['HIDE_PUBLIC_LINKS'] && !isLoggedIn())
1032 $linksToDisplay = array();
1033
1026 $nblinksToDisplay = 50; // Number of links to display. 1034 $nblinksToDisplay = 50; // Number of links to display.
1027 if (!empty($_GET['nb'])) // In URL, you can specificy the number of links. Example: nb=200 or nb=all for all links. 1035 if (!empty($_GET['nb'])) // In URL, you can specificy the number of links. Example: nb=200 or nb=all for all links.
1028 { 1036 {
@@ -1182,6 +1190,8 @@ function showDaily()
1182 } 1190 }
1183 1191
1184 $linksToDisplay=$LINKSDB->filterDay($day); 1192 $linksToDisplay=$LINKSDB->filterDay($day);
1193 if ($GLOBALS['config']['HIDE_PUBLIC_LINKS'] && !isLoggedIn())
1194 $linksToDisplay = array();
1185 // We pre-format some fields for proper output. 1195 // We pre-format some fields for proper output.
1186 foreach($linksToDisplay as $key=>$link) 1196 foreach($linksToDisplay as $key=>$link)
1187 { 1197 {
@@ -1260,6 +1270,10 @@ function renderPage()
1260 if (!empty($_GET['searchterm'])) $links = $LINKSDB->filterFulltext($_GET['searchterm']); 1270 if (!empty($_GET['searchterm'])) $links = $LINKSDB->filterFulltext($_GET['searchterm']);
1261 elseif (!empty($_GET['searchtags'])) $links = $LINKSDB->filterTags(trim($_GET['searchtags'])); 1271 elseif (!empty($_GET['searchtags'])) $links = $LINKSDB->filterTags(trim($_GET['searchtags']));
1262 else $links = $LINKSDB; 1272 else $links = $LINKSDB;
1273
1274 if ($GLOBALS['config']['HIDE_PUBLIC_LINKS'] && !isLoggedIn())
1275 $links = array();
1276
1263 $body=''; 1277 $body='';
1264 $linksToDisplay=array(); 1278 $linksToDisplay=array();
1265 1279
@@ -1274,6 +1288,7 @@ function renderPage()
1274 $linksToDisplay[]=$link; // Add to array. 1288 $linksToDisplay[]=$link; // Add to array.
1275 } 1289 }
1276 } 1290 }
1291
1277 $PAGE = new pageBuilder; 1292 $PAGE = new pageBuilder;
1278 $PAGE->assign('linkcount',count($LINKSDB)); 1293 $PAGE->assign('linkcount',count($LINKSDB));
1279 $PAGE->assign('linksToDisplay',$linksToDisplay); 1294 $PAGE->assign('linksToDisplay',$linksToDisplay);
@@ -1285,6 +1300,8 @@ function renderPage()
1285 if (isset($_SERVER["QUERY_STRING"]) && startswith($_SERVER["QUERY_STRING"],'do=tagcloud')) 1300 if (isset($_SERVER["QUERY_STRING"]) && startswith($_SERVER["QUERY_STRING"],'do=tagcloud'))
1286 { 1301 {
1287 $tags= $LINKSDB->allTags(); 1302 $tags= $LINKSDB->allTags();
1303 if ($GLOBALS['config']['HIDE_PUBLIC_LINKS'] && !isLoggedIn())
1304 $tags = array();
1288 // We sort tags alphabetically, then choose a font size according to count. 1305 // We sort tags alphabetically, then choose a font size according to count.
1289 // First, find max value. 1306 // First, find max value.
1290 $maxcount=0; foreach($tags as $key=>$value) $maxcount=max($maxcount,$value); 1307 $maxcount=0; foreach($tags as $key=>$value) $maxcount=max($maxcount,$value);
@@ -1884,12 +1901,16 @@ function buildLinkList($PAGE,$LINKSDB)
1884 if (isset($_GET['searchterm'])) // Fulltext search 1901 if (isset($_GET['searchterm'])) // Fulltext search
1885 { 1902 {
1886 $linksToDisplay = $LINKSDB->filterFulltext(trim($_GET['searchterm'])); 1903 $linksToDisplay = $LINKSDB->filterFulltext(trim($_GET['searchterm']));
1904 if ($GLOBALS['config']['HIDE_PUBLIC_LINKS'] && !isLoggedIn())
1905 $linksToDisplay = array();
1887 $search_crits=htmlspecialchars(trim($_GET['searchterm'])); 1906 $search_crits=htmlspecialchars(trim($_GET['searchterm']));
1888 $search_type='fulltext'; 1907 $search_type='fulltext';
1889 } 1908 }
1890 elseif (isset($_GET['searchtags'])) // Search by tag 1909 elseif (isset($_GET['searchtags'])) // Search by tag
1891 { 1910 {
1892 $linksToDisplay = $LINKSDB->filterTags(trim($_GET['searchtags'])); 1911 $linksToDisplay = $LINKSDB->filterTags(trim($_GET['searchtags']));
1912 if ($GLOBALS['config']['HIDE_PUBLIC_LINKS'] && !isLoggedIn())
1913 $linksToDisplay = array();
1893 $search_crits=explode(' ',trim($_GET['searchtags'])); 1914 $search_crits=explode(' ',trim($_GET['searchtags']));
1894 $search_type='tags'; 1915 $search_type='tags';
1895 } 1916 }