]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - application/LinkDB.php
Working on shaarli/Shaarli#224
[github/shaarli/Shaarli.git] / application / LinkDB.php
index 388002f666eff8f80608fd31a4d3423b80da6f57..0f7c5bfed2d9c61bdf95acae617e05abf9000beb 100644 (file)
@@ -208,6 +208,13 @@ class LinkDB implements Iterator, Countable, ArrayAccess
      */
     private function readdb()
     {
+
+        // Public links are hidden and user not logged in => nothing to show
+        if ($GLOBALS['config']['HIDE_PUBLIC_LINKS'] && !isLoggedIn()) {
+            $this->links = array();
+            return;
+        }
+
         // Read data
         // Note that gzinflate is faster than gzuncompress.
         // See: http://www.php.net/manual/en/function.gzdeflate.php#96439
@@ -238,6 +245,11 @@ class LinkDB implements Iterator, Countable, ArrayAccess
         foreach ($this->links as $link) {
             $this->urls[$link['url']] = $link['linkdate'];
         }
+
+        // Escape links data
+        foreach($this->links as &$link) { 
+            sanitizeLink($link); 
+        }
     }
 
     /**