aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.php
diff options
context:
space:
mode:
authorVirtualTam <virtualtam@flibidi.net>2015-06-23 22:34:07 +0200
committernodiscc <nodiscc@gmail.com>2015-06-24 00:26:59 +0200
commit9f15ca9ee76bc36832f12a952005fdaf52e2559d (patch)
treeb29e109d2eccad7b13a6dd5d6f59571f4023686f /index.php
parentae630270109bf78b5f561c887d35b7b099d30271 (diff)
downloadShaarli-9f15ca9ee76bc36832f12a952005fdaf52e2559d.tar.gz
Shaarli-9f15ca9ee76bc36832f12a952005fdaf52e2559d.tar.zst
Shaarli-9f15ca9ee76bc36832f12a952005fdaf52e2559d.zip
LinkDB: add 'hidePublicLinks' parameter to the constructor
Fixes #236 Relates to #237 Signed-off-by: VirtualTam <virtualtam@flibidi.net>
Diffstat (limited to 'index.php')
-rw-r--r--index.php34
1 files changed, 26 insertions, 8 deletions
diff --git a/index.php b/index.php
index db2b7521..f116a87b 100644
--- a/index.php
+++ b/index.php
@@ -702,7 +702,11 @@ function showRSS()
702 $cached = $cache->cachedVersion(); if (!empty($cached)) { echo $cached; exit; } 702 $cached = $cache->cachedVersion(); if (!empty($cached)) { echo $cached; exit; }
703 703
704 // If cached was not found (or not usable), then read the database and build the response: 704 // If cached was not found (or not usable), then read the database and build the response:
705 $LINKSDB = new LinkDB(isLoggedIn() || $GLOBALS['config']['OPEN_SHAARLI']); // Read links from database (and filter private links if user it not logged in). 705 $LINKSDB = new LinkDB(
706 isLoggedIn() || $GLOBALS['config']['OPEN_SHAARLI'],
707 $GLOBALS['config']['HIDE_PUBLIC_LINKS']
708 );
709 // Read links from database (and filter private links if user it not logged in).
706 710
707 // Optionally filter the results: 711 // Optionally filter the results:
708 $linksToDisplay=array(); 712 $linksToDisplay=array();
@@ -777,8 +781,10 @@ function showATOM()
777 $cached = $cache->cachedVersion(); if (!empty($cached)) { echo $cached; exit; } 781 $cached = $cache->cachedVersion(); if (!empty($cached)) { echo $cached; exit; }
778 // If cached was not found (or not usable), then read the database and build the response: 782 // If cached was not found (or not usable), then read the database and build the response:
779 783
780 $LINKSDB = new LinkDB(isLoggedIn() || $GLOBALS['config']['OPEN_SHAARLI']); // Read links from database (and filter private links if used it not logged in). 784 $LINKSDB = new LinkDB(
781 785 isLoggedIn() || $GLOBALS['config']['OPEN_SHAARLI'],
786 $GLOBALS['config']['HIDE_PUBLIC_LINKS']
787 );
782 788
783 // Optionally filter the results: 789 // Optionally filter the results:
784 $linksToDisplay=array(); 790 $linksToDisplay=array();
@@ -859,7 +865,11 @@ function showDailyRSS()
859 $cache = new pageCache(pageUrl(),startsWith($query,'do=dailyrss') && !isLoggedIn()); 865 $cache = new pageCache(pageUrl(),startsWith($query,'do=dailyrss') && !isLoggedIn());
860 $cached = $cache->cachedVersion(); if (!empty($cached)) { echo $cached; exit; } 866 $cached = $cache->cachedVersion(); if (!empty($cached)) { echo $cached; exit; }
861 // If cached was not found (or not usable), then read the database and build the response: 867 // If cached was not found (or not usable), then read the database and build the response:
862 $LINKSDB = new LinkDB(isLoggedIn() || $GLOBALS['config']['OPEN_SHAARLI']); // Read links from database (and filter private links if used it not logged in). 868
869 $LINKSDB = new LinkDB(
870 isLoggedIn() || $GLOBALS['config']['OPEN_SHAARLI'],
871 $GLOBALS['config']['HIDE_PUBLIC_LINKS']
872 );
863 873
864 /* Some Shaarlies may have very few links, so we need to look 874 /* Some Shaarlies may have very few links, so we need to look
865 back in time (rsort()) until we have enough days ($nb_of_days). 875 back in time (rsort()) until we have enough days ($nb_of_days).
@@ -927,8 +937,10 @@ function showDailyRSS()
927// "Daily" page. 937// "Daily" page.
928function showDaily() 938function showDaily()
929{ 939{
930 $LINKSDB = new LinkDB(isLoggedIn() || $GLOBALS['config']['OPEN_SHAARLI']); // Read links from database (and filter private links if used it not logged in). 940 $LINKSDB = new LinkDB(
931 941 isLoggedIn() || $GLOBALS['config']['OPEN_SHAARLI'],
942 $GLOBALS['config']['HIDE_PUBLIC_LINKS']
943 );
932 944
933 $day=Date('Ymd',strtotime('-1 day')); // Yesterday, in format YYYYMMDD. 945 $day=Date('Ymd',strtotime('-1 day')); // Yesterday, in format YYYYMMDD.
934 if (isset($_GET['day'])) $day=$_GET['day']; 946 if (isset($_GET['day'])) $day=$_GET['day'];
@@ -993,7 +1005,10 @@ function showDaily()
993// Render HTML page (according to URL parameters and user rights) 1005// Render HTML page (according to URL parameters and user rights)
994function renderPage() 1006function renderPage()
995{ 1007{
996 $LINKSDB = new LinkDB(isLoggedIn() || $GLOBALS['config']['OPEN_SHAARLI']); // Read links from database (and filter private links if used it not logged in). 1008 $LINKSDB = new LinkDB(
1009 isLoggedIn() || $GLOBALS['config']['OPEN_SHAARLI'],
1010 $GLOBALS['config']['HIDE_PUBLIC_LINKS']
1011 );
997 1012
998 // -------- Display login form. 1013 // -------- Display login form.
999 if (isset($_SERVER["QUERY_STRING"]) && startswith($_SERVER["QUERY_STRING"],'do=login')) 1014 if (isset($_SERVER["QUERY_STRING"]) && startswith($_SERVER["QUERY_STRING"],'do=login'))
@@ -1571,7 +1586,10 @@ HTML;
1571function importFile() 1586function importFile()
1572{ 1587{
1573 if (!(isLoggedIn() || $GLOBALS['config']['OPEN_SHAARLI'])) { die('Not allowed.'); } 1588 if (!(isLoggedIn() || $GLOBALS['config']['OPEN_SHAARLI'])) { die('Not allowed.'); }
1574 $LINKSDB = new LinkDB(isLoggedIn() || $GLOBALS['config']['OPEN_SHAARLI']); // Read links from database (and filter private links if used it not logged in). 1589 $LINKSDB = new LinkDB(
1590 isLoggedIn() || $GLOBALS['config']['OPEN_SHAARLI'],
1591 $GLOBALS['config']['HIDE_PUBLIC_LINKS']
1592 );
1575 $filename=$_FILES['filetoupload']['name']; 1593 $filename=$_FILES['filetoupload']['name'];
1576 $filesize=$_FILES['filetoupload']['size']; 1594 $filesize=$_FILES['filetoupload']['size'];
1577 $data=file_get_contents($_FILES['filetoupload']['tmp_name']); 1595 $data=file_get_contents($_FILES['filetoupload']['tmp_name']);