aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorfeula <mr.pikzen@gmail.com>2015-05-11 19:55:59 +0200
committerfeula <mr.pikzen@gmail.com>2015-05-11 20:08:38 +0200
commit59c90f58086f6f1deab8d7a47296392d809652d2 (patch)
treeba77b9a892aec9b802934bdcc4f5d10ce5553247
parent569ffb59d4f7c41e5deabd8b2a163a952acb1957 (diff)
downloadShaarli-59c90f58086f6f1deab8d7a47296392d809652d2.tar.gz
Shaarli-59c90f58086f6f1deab8d7a47296392d809652d2.tar.zst
Shaarli-59c90f58086f6f1deab8d7a47296392d809652d2.zip
Properly hide all links
>searchtags
-rw-r--r--index.php25
1 files changed, 23 insertions, 2 deletions
diff --git a/index.php b/index.php
index 07aeaa5b..3cbea363 100644
--- a/index.php
+++ b/index.php
@@ -943,8 +943,12 @@ function showRSS()
943 // Optionally filter the results: 943 // Optionally filter the results:
944 $linksToDisplay=array(); 944 $linksToDisplay=array();
945 if (!empty($_GET['searchterm'])) $linksToDisplay = $LINKSDB->filterFulltext($_GET['searchterm']); 945 if (!empty($_GET['searchterm'])) $linksToDisplay = $LINKSDB->filterFulltext($_GET['searchterm']);
946 elseif (!empty($_GET['searchtags'])) $linksToDisplay = $LINKSDB->filterTags(trim($_GET['searchtags'])); 946 else if (!empty($_GET['searchtags'])) $linksToDisplay = $LINKSDB->filterTags(trim($_GET['searchtags']));
947 else $linksToDisplay = $LINKSDB; 947 else $linksToDisplay = $LINKSDB;
948
949 if ($GLOBALS['config']['HIDE_PUBLIC_LINKS'] && !isLoggedIn())
950 $linksToDisplay = array();
951
948 $nblinksToDisplay = 50; // Number of links to display. 952 $nblinksToDisplay = 50; // Number of links to display.
949 if (!empty($_GET['nb'])) // In URL, you can specificy the number of links. Example: nb=200 or nb=all for all links. 953 if (!empty($_GET['nb'])) // In URL, you can specificy the number of links. Example: nb=200 or nb=all for all links.
950 { 954 {
@@ -1018,8 +1022,12 @@ function showATOM()
1018 // Optionally filter the results: 1022 // Optionally filter the results:
1019 $linksToDisplay=array(); 1023 $linksToDisplay=array();
1020 if (!empty($_GET['searchterm'])) $linksToDisplay = $LINKSDB->filterFulltext($_GET['searchterm']); 1024 if (!empty($_GET['searchterm'])) $linksToDisplay = $LINKSDB->filterFulltext($_GET['searchterm']);
1021 elseif (!empty($_GET['searchtags'])) $linksToDisplay = $LINKSDB->filterTags(trim($_GET['searchtags'])); 1025 else if (!empty($_GET['searchtags'])) $linksToDisplay = $LINKSDB->filterTags(trim($_GET['searchtags']));
1022 else $linksToDisplay = $LINKSDB; 1026 else $linksToDisplay = $LINKSDB;
1027
1028 if ($GLOBALS['config']['HIDE_PUBLIC_LINKS'] && !isLoggedIn())
1029 $linksToDisplay = array();
1030
1023 $nblinksToDisplay = 50; // Number of links to display. 1031 $nblinksToDisplay = 50; // Number of links to display.
1024 if (!empty($_GET['nb'])) // In URL, you can specificy the number of links. Example: nb=200 or nb=all for all links. 1032 if (!empty($_GET['nb'])) // In URL, you can specificy the number of links. Example: nb=200 or nb=all for all links.
1025 { 1033 {
@@ -1179,6 +1187,8 @@ function showDaily()
1179 } 1187 }
1180 1188
1181 $linksToDisplay=$LINKSDB->filterDay($day); 1189 $linksToDisplay=$LINKSDB->filterDay($day);
1190 if ($GLOBALS['config']['HIDE_PUBLIC_LINKS'] && !isLoggedIn())
1191 $linksToDisplay = array();
1182 // We pre-format some fields for proper output. 1192 // We pre-format some fields for proper output.
1183 foreach($linksToDisplay as $key=>$link) 1193 foreach($linksToDisplay as $key=>$link)
1184 { 1194 {
@@ -1257,6 +1267,10 @@ function renderPage()
1257 if (!empty($_GET['searchterm'])) $links = $LINKSDB->filterFulltext($_GET['searchterm']); 1267 if (!empty($_GET['searchterm'])) $links = $LINKSDB->filterFulltext($_GET['searchterm']);
1258 elseif (!empty($_GET['searchtags'])) $links = $LINKSDB->filterTags(trim($_GET['searchtags'])); 1268 elseif (!empty($_GET['searchtags'])) $links = $LINKSDB->filterTags(trim($_GET['searchtags']));
1259 else $links = $LINKSDB; 1269 else $links = $LINKSDB;
1270
1271 if ($GLOBALS['config']['HIDE_PUBLIC_LINKS'] && !isLoggedIn())
1272 $links = array();
1273
1260 $body=''; 1274 $body='';
1261 $linksToDisplay=array(); 1275 $linksToDisplay=array();
1262 1276
@@ -1271,6 +1285,7 @@ function renderPage()
1271 $linksToDisplay[]=$link; // Add to array. 1285 $linksToDisplay[]=$link; // Add to array.
1272 } 1286 }
1273 } 1287 }
1288
1274 $PAGE = new pageBuilder; 1289 $PAGE = new pageBuilder;
1275 $PAGE->assign('linkcount',count($LINKSDB)); 1290 $PAGE->assign('linkcount',count($LINKSDB));
1276 $PAGE->assign('linksToDisplay',$linksToDisplay); 1291 $PAGE->assign('linksToDisplay',$linksToDisplay);
@@ -1282,6 +1297,8 @@ function renderPage()
1282 if (isset($_SERVER["QUERY_STRING"]) && startswith($_SERVER["QUERY_STRING"],'do=tagcloud')) 1297 if (isset($_SERVER["QUERY_STRING"]) && startswith($_SERVER["QUERY_STRING"],'do=tagcloud'))
1283 { 1298 {
1284 $tags= $LINKSDB->allTags(); 1299 $tags= $LINKSDB->allTags();
1300 if ($GLOBALS['config']['HIDE_PUBLIC_LINKS'] && !isLoggedIn())
1301 $tags = array();
1285 // We sort tags alphabetically, then choose a font size according to count. 1302 // We sort tags alphabetically, then choose a font size according to count.
1286 // First, find max value. 1303 // First, find max value.
1287 $maxcount=0; foreach($tags as $key=>$value) $maxcount=max($maxcount,$value); 1304 $maxcount=0; foreach($tags as $key=>$value) $maxcount=max($maxcount,$value);
@@ -1880,12 +1897,16 @@ function buildLinkList($PAGE,$LINKSDB)
1880 if (isset($_GET['searchterm'])) // Fulltext search 1897 if (isset($_GET['searchterm'])) // Fulltext search
1881 { 1898 {
1882 $linksToDisplay = $LINKSDB->filterFulltext(trim($_GET['searchterm'])); 1899 $linksToDisplay = $LINKSDB->filterFulltext(trim($_GET['searchterm']));
1900 if ($GLOBALS['config']['HIDE_PUBLIC_LINKS'] && !isLoggedIn())
1901 $linksToDisplay = array();
1883 $search_crits=htmlspecialchars(trim($_GET['searchterm'])); 1902 $search_crits=htmlspecialchars(trim($_GET['searchterm']));
1884 $search_type='fulltext'; 1903 $search_type='fulltext';
1885 } 1904 }
1886 elseif (isset($_GET['searchtags'])) // Search by tag 1905 elseif (isset($_GET['searchtags'])) // Search by tag
1887 { 1906 {
1888 $linksToDisplay = $LINKSDB->filterTags(trim($_GET['searchtags'])); 1907 $linksToDisplay = $LINKSDB->filterTags(trim($_GET['searchtags']));
1908 if ($GLOBALS['config']['HIDE_PUBLIC_LINKS'] && !isLoggedIn())
1909 $linksToDisplay = array();
1889 $search_crits=explode(' ',trim($_GET['searchtags'])); 1910 $search_crits=explode(' ',trim($_GET['searchtags']));
1890 $search_type='tags'; 1911 $search_type='tags';
1891 } 1912 }