Beispiel #1
0
 public function outputResponse(Tracker $tracker)
 {
     if (!$tracker->shouldRecordStatistics()) {
         $this->outputApiResponse($tracker);
         Common::printDebug("Logging disabled, display transparent logo");
     } elseif (!$tracker->hasLoggedRequests()) {
         if (!$this->isHttpGetRequest() || !empty($_GET) || !empty($_POST)) {
             Common::sendResponseCode(400);
         }
         Common::printDebug("Empty request => Piwik page");
         echo "<a href='/'>Piwik</a> is a free/libre web <a href='http://piwik.org'>analytics</a> that lets you keep control of your data.";
     } else {
         $this->outputApiResponse($tracker);
         Common::printDebug("Nothing to notice => default behaviour");
     }
     Common::printDebug("End of the page.");
     if ($tracker->isDebugModeEnabled() && $tracker->isDatabaseConnected() && TrackerDb::isProfilingEnabled()) {
         $db = Tracker::getDatabase();
         $db->recordProfiling();
         Profiler::displayDbTrackerProfile($db);
     }
     if ($tracker->isDebugModeEnabled()) {
         Common::printDebug($_COOKIE);
         Common::printDebug((string) $this->timer);
     }
 }
Beispiel #2
0
 public function outputResponse(Tracker $tracker)
 {
     if (!$tracker->shouldRecordStatistics()) {
         $this->outputApiResponse($tracker);
         Common::printDebug("Logging disabled, display transparent logo");
     } elseif (!$tracker->hasLoggedRequests()) {
         if (!$this->isHttpGetRequest() || !empty($_GET) || !empty($_POST)) {
             Common::sendResponseCode(400);
         }
         Common::printDebug("Empty request => Piwik page");
         echo "This resource is part of Piwik. Keep full control of your data with the leading free and open source <a href='https://piwik.org' target='_blank'>digital analytics platform</a> for web and mobile.";
     } else {
         $this->outputApiResponse($tracker);
         Common::printDebug("Nothing to notice => default behaviour");
     }
     Common::printDebug("End of the page.");
     if ($tracker->isDebugModeEnabled() && $tracker->isDatabaseConnected() && TrackerDb::isProfilingEnabled()) {
         $db = Tracker::getDatabase();
         $db->recordProfiling();
         Profiler::displayDbTrackerProfile($db);
     }
     if ($tracker->isDebugModeEnabled()) {
         Common::printDebug($_COOKIE);
         Common::printDebug((string) $this->timer);
     }
 }
Beispiel #3
0
 public function outputResponse(Tracker $tracker)
 {
     if (!$tracker->shouldRecordStatistics()) {
         $this->outputApiResponse($tracker);
         Common::printDebug("Logging disabled, display transparent logo");
     } elseif (!$tracker->hasLoggedRequests()) {
         if (!$this->isHttpGetRequest() || !empty($_GET) || !empty($_POST)) {
             Common::sendResponseCode(400);
         }
         Common::printDebug("Empty request => Piwik page");
         //echo date('Y-m-d H:i:s');
     } else {
         $this->outputApiResponse($tracker);
         Common::printDebug("Nothing to notice => default behaviour");
     }
     Common::printDebug("End of the page.");
     if ($tracker->isDebugModeEnabled() && $tracker->isDatabaseConnected() && TrackerDb::isProfilingEnabled()) {
         $db = Tracker::getDatabase();
         $db->recordProfiling();
         Profiler::displayDbTrackerProfile($db);
     }
     if ($tracker->isDebugModeEnabled()) {
         Common::printDebug($_COOKIE);
         Common::printDebug((string) $this->timer);
     }
 }
Beispiel #4
0
 /**
  * Cleanup
  */
 protected function end()
 {
     if ($this->usingBulkTracking) {
         $result = array('status' => 'success', 'tracked' => $this->countOfLoggedRequests);
         Common::sendHeader('Content-Type: application/json');
         echo Common::json_encode($result);
         exit;
     }
     switch ($this->getState()) {
         case self::STATE_LOGGING_DISABLE:
             $this->outputTransparentGif();
             Common::printDebug("Logging disabled, display transparent logo");
             break;
         case self::STATE_EMPTY_REQUEST:
             Common::printDebug("Empty request => Piwik page");
             echo "<a href='/'>Piwik</a> is a free/libre web <a href='http://piwik.org'>analytics</a> that lets you keep control of your data.";
             break;
         case self::STATE_NOSCRIPT_REQUEST:
         case self::STATE_NOTHING_TO_NOTICE:
         default:
             $this->outputTransparentGif();
             Common::printDebug("Nothing to notice => default behaviour");
             break;
     }
     Common::printDebug("End of the page.");
     if ($GLOBALS['PIWIK_TRACKER_DEBUG'] === true) {
         if (isset(self::$db)) {
             self::$db->recordProfiling();
             Profiler::displayDbTrackerProfile(self::$db);
         }
     }
     self::disconnectDatabase();
 }