]> git.mxchange.org Git - friendica.git/blobdiff - src/Core/Session.php
New function "isAuthenticated"
[friendica.git] / src / Core / Session.php
index db455d3a2592cb2bfbbb41342d4e7d2d467f4430..b44ff3e2ea2fa928a69c4213b63c3339a20c4303 100644 (file)
@@ -53,7 +53,7 @@ class Session
 
        /**
         * Retrieves a key from the session super global or the defaults if the key is missing or the value is falsy.
-        * 
+        *
         * Handle the case where session_start() hasn't been called and the super global isn't available.
         *
         * @param string $name
@@ -255,4 +255,18 @@ class Session
                }
                DBA::close($remote_contacts);
        }
+
+       /**
+        * Returns if the current visitor is authenticated
+        *
+        * @return boolean "true" when visitor is either a local or remote user
+        */
+       public static function isAuthenticated()
+       {
+               if (empty($_SESSION['authenticated'])) {
+                       return false;
+               }
+
+               return $_SESSION['authenticated'];
+       }
 }