diff options
author | Matthieu Napoli <matthieu@mnapoli.fr> | 2014-12-08 07:11:24 +0300 |
---|---|---|
committer | Matthieu Napoli <matthieu@mnapoli.fr> | 2014-12-08 07:11:24 +0300 |
commit | 2308c4da096f3c6a1ba1027fd1b341fbc0ea453c (patch) | |
tree | b3264ab69c3d2dbe2a383f9b91dff14bfb9d6c28 /core/CronArchive.php | |
parent | 80ab3b99438bc0d64a9c689e5ad71f585b3c0227 (diff) | |
parent | 0e058f9cb3c6ca8b8331276e96fa56483015e590 (diff) |
Merge branch 'master' into log-refactoring-1
Diffstat (limited to 'core/CronArchive.php')
-rw-r--r-- | core/CronArchive.php | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/core/CronArchive.php b/core/CronArchive.php index b09493e8e6..4977fa5324 100644 --- a/core/CronArchive.php +++ b/core/CronArchive.php @@ -73,6 +73,7 @@ class CronArchive private $segments = array(); private $piwikUrl = false; private $token_auth = false; + private $validTokenAuths = array(); private $visitsToday = 0; private $requests = 0; private $output = ''; @@ -938,19 +939,25 @@ class CronArchive private function initTokenAuth() { - $token = ''; + $tokens = array(); /** * @ignore */ - Piwik::postEvent('CronArchive.getTokenAuth', array(&$token)); - - $this->token_auth = $token; + Piwik::postEvent('CronArchive.getTokenAuth', array(&$tokens)); + + $this->validTokenAuths = $tokens; + $this->token_auth = array_shift($tokens); } - public function getTokenAuth() + public function isTokenAuthSuperUserToken($token_auth) { - return $this->token_auth; + if(empty($token_auth) + || strlen($token_auth) != 32) { + return false; + } + + return in_array($token_auth, $this->validTokenAuths); } private function initPiwikHost($piwikUrl = false) |