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-22 05:02:41 +0300
committerMatthieu Aubry <mattab@users.noreply.github.com>2018-01-22 05:02:41 +0300
commit113099eb522b9ee439925d589bac84b8b7efb21b (patch)
treea51cd3bae965ac2016e82b773c06f3b8d9079f66 /plugins
parent76e5c26ea11e6027dca0f72835b2f02f3c2f1869 (diff)
Show error message if visitor in visitor profile could not be found instead of fatal error (#12396)
* Show error message if visitor in visitor profile could not be found instead of fatal error Eg happens when visitorId URL parameter is missing. * Update Controller.php * simplify idsite access
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Live/Controller.php21
1 files changed, 17 insertions, 4 deletions
diff --git a/plugins/Live/Controller.php b/plugins/Live/Controller.php
index ba6b152e42..2c8458435d 100644
--- a/plugins/Live/Controller.php
+++ b/plugins/Live/Controller.php
@@ -33,6 +33,8 @@ class Controller extends \Piwik\Plugin\Controller
public function widget()
{
+ Piwik::checkUserHasViewAccess($this->idSite);
+
$view = new View('@Live/index');
$view->idSite = $this->idSite;
$view = $this->setCounters($view);
@@ -44,6 +46,8 @@ class Controller extends \Piwik\Plugin\Controller
public function ajaxTotalVisitors()
{
+ Piwik::checkUserHasViewAccess($this->idSite);
+
$view = new View('@Live/ajaxTotalVisitors');
$view = $this->setCounters($view);
$view->idSite = $this->idSite;
@@ -59,6 +63,8 @@ class Controller extends \Piwik\Plugin\Controller
public function indexVisitorLog()
{
+ Piwik::checkUserHasViewAccess($this->idSite);
+
$view = new View('@Live/indexVisitorLog.twig');
$view->visitorLog = $this->renderReport('getLastVisitsDetails');
return $view->render();
@@ -112,12 +118,17 @@ class Controller extends \Piwik\Plugin\Controller
*/
public function getVisitorProfilePopup()
{
- $idSite = Common::getRequestVar('idSite', null, 'int');
+ Piwik::checkUserHasViewAccess($this->idSite);
+ $visitorData = Request::processRequest('Live.getVisitorProfile');
+ if (empty($visitorData)) {
+ throw new \Exception('Visitor could not be found'); // for example when URL parameter is not set
+ }
+
$view = new View('@Live/getVisitorProfilePopup.twig');
- $view->idSite = $idSite;
- $view->goals = APIGoals::getInstance()->getGoals($idSite);
- $view->visitorData = Request::processRequest('Live.getVisitorProfile');
+ $view->idSite = $this->idSite;
+ $view->goals = APIGoals::getInstance()->getGoals($this->idSite);
+ $view->visitorData = $visitorData;
$view->exportLink = $this->getVisitorProfileExportLink();
$this->setWidgetizedVisitorProfileUrl($view);
@@ -147,6 +158,8 @@ class Controller extends \Piwik\Plugin\Controller
public function getVisitList()
{
+ Piwik::checkUserHasViewAccess($this->idSite);
+
$filterLimit = Common::getRequestVar('filter_offset', 0, 'int');
$startCounter = Common::getRequestVar('start_number', 0, 'int');
$limit = Config::getInstance()->General['live_visitor_profile_max_visits_to_aggregate'];