]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - application/LinkDB.php
Merge remote-tracking branch 'ArthurHoaro/input-escape' into next
[github/shaarli/Shaarli.git] / application / LinkDB.php
index 0f7c5bfed2d9c61bdf95acae617e05abf9000beb..2b3fb60bb47be7fe9bd09728044315e55289186a 100644 (file)
@@ -45,6 +45,9 @@ class LinkDB implements Iterator, Countable, ArrayAccess
     // Is the user logged in? (used to filter private links)
     private $loggedIn;
 
+    // Hide public links
+    private $hidePublicLinks;
+
     /**
      * Creates a new LinkDB
      *
@@ -52,10 +55,11 @@ class LinkDB implements Iterator, Countable, ArrayAccess
      *
      * @param $isLoggedIn is the user logged in?
      */
-    function __construct($isLoggedIn)
+    function __construct($isLoggedIn, $hidePublicLinks)
     {
         // FIXME: do not access $GLOBALS, pass the datastore instead
         $this->loggedIn = $isLoggedIn;
+        $this->hidePublicLinks = $hidePublicLinks;
         $this->checkDB();
         $this->readdb();
     }
@@ -210,7 +214,7 @@ class LinkDB implements Iterator, Countable, ArrayAccess
     {
 
         // Public links are hidden and user not logged in => nothing to show
-        if ($GLOBALS['config']['HIDE_PUBLIC_LINKS'] && !isLoggedIn()) {
+        if ($this->hidePublicLinks && !$this->loggedIn) {
             $this->links = array();
             return;
         }