aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/LinkDB.php
diff options
context:
space:
mode:
Diffstat (limited to 'application/LinkDB.php')
-rw-r--r--application/LinkDB.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/application/LinkDB.php b/application/LinkDB.php
index 137f42e5..47dbcaf3 100644
--- a/application/LinkDB.php
+++ b/application/LinkDB.php
@@ -45,6 +45,9 @@ class LinkDB implements Iterator, Countable, ArrayAccess
45 // Is the user logged in? (used to filter private links) 45 // Is the user logged in? (used to filter private links)
46 private $loggedIn; 46 private $loggedIn;
47 47
48 // Hide public links
49 private $hidePublicLinks;
50
48 /** 51 /**
49 * Creates a new LinkDB 52 * Creates a new LinkDB
50 * 53 *
@@ -52,10 +55,11 @@ class LinkDB implements Iterator, Countable, ArrayAccess
52 * 55 *
53 * @param $isLoggedIn is the user logged in? 56 * @param $isLoggedIn is the user logged in?
54 */ 57 */
55 function __construct($isLoggedIn) 58 function __construct($isLoggedIn, $hidePublicLinks)
56 { 59 {
57 // FIXME: do not access $GLOBALS, pass the datastore instead 60 // FIXME: do not access $GLOBALS, pass the datastore instead
58 $this->loggedIn = $isLoggedIn; 61 $this->loggedIn = $isLoggedIn;
62 $this->hidePublicLinks = $hidePublicLinks;
59 $this->checkDB(); 63 $this->checkDB();
60 $this->readdb(); 64 $this->readdb();
61 } 65 }
@@ -210,7 +214,7 @@ class LinkDB implements Iterator, Countable, ArrayAccess
210 { 214 {
211 215
212 // Public links are hidden and user not logged in => nothing to show 216 // Public links are hidden and user not logged in => nothing to show
213 if ($GLOBALS['config']['HIDE_PUBLIC_LINKS'] && !isLoggedIn()) { 217 if ($this->hidePublicLinks && !$this->loggedIn) {
214 $this->links = array(); 218 $this->links = array();
215 return; 219 return;
216 } 220 }