Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormattab <matthieu.aubry@gmail.com>2014-10-22 07:54:14 +0400
committermattab <matthieu.aubry@gmail.com>2014-10-22 07:54:14 +0400
commit9425c0f6d0134a65b0e22d9971923d03f83dcfa8 (patch)
treef1adb401876c81de41eb99e3afe6f3e2156d3ecc /core/Piwik.php
parenta10375e68a971accfc3921e22f64986c5fe52b58 (diff)
Refactor isUserIsAnonymous
Diffstat (limited to 'core/Piwik.php')
-rw-r--r--core/Piwik.php10
1 files changed, 8 insertions, 2 deletions
diff --git a/core/Piwik.php b/core/Piwik.php
index f8d6df175e..625a7cf9f8 100644
--- a/core/Piwik.php
+++ b/core/Piwik.php
@@ -189,7 +189,12 @@ class Piwik
*/
public static function getCurrentUserLogin()
{
- return Access::getInstance()->getLogin();
+ $login = Access::getInstance()->getLogin();
+
+ if(empty($login)) {
+ return 'anonymous';
+ }
+ return $login;
}
/**
@@ -296,7 +301,8 @@ class Piwik
*/
public static function isUserIsAnonymous()
{
- return Piwik::getCurrentUserLogin() == 'anonymous';
+ $currentUserLogin = Piwik::getCurrentUserLogin();
+ return $currentUserLogin == 'anonymous';
}
/**