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:
authorThomas Steur <tsteur@users.noreply.github.com>2018-01-03 02:27:01 +0300
committerGitHub <noreply@github.com>2018-01-03 02:27:01 +0300
commit3a0762589c4771fbd63e34bf57300e08320314b3 (patch)
tree69f348803cbc6ff6dc670fa7abbe5ba12e9cd39a /plugins
parent889af9b97a7b06c2d345a0e28a566de459959d88 (diff)
Prevent fatal error message when accessing visitor log without access (#12393)
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Live/Controller.php9
1 files changed, 7 insertions, 2 deletions
diff --git a/plugins/Live/Controller.php b/plugins/Live/Controller.php
index 5ad68b809b..ba6b152e42 100644
--- a/plugins/Live/Controller.php
+++ b/plugins/Live/Controller.php
@@ -71,18 +71,23 @@ class Controller extends \Piwik\Plugin\Controller
{
return $this->renderReport('getLastVisitsDetails');
}
-
+
public function getLastVisitsStart()
{
+ Piwik::checkUserHasViewAccess($this->idSite);
+
// hack, ensure we load today's visits by default
$_GET['date'] = 'today';
\Piwik\Period\Factory::checkPeriodIsEnabled('day');
$_GET['period'] = 'day';
$view = new View('@Live/getLastVisitsStart');
- $view->idSite = $this->idSite;
+ $view->idSite = (int) $this->idSite;
$api = new Request("method=Live.getLastVisitsDetails&idSite={$this->idSite}&filter_limit=10&format=php&serialize=0&disable_generic_filters=1");
$visitors = $api->process();
+ if (!empty($visitors['result']) && $visitors['result'] === 'error' && !empty($visitors['message'])) {
+ throw new \Exception($visitors['message']);
+ }
$view->visitors = $visitors;
return $this->render($view);