Beispiel #1
0
 /**
  * Returns and initializes $this->sessionSection.
  * @return Nette\Http\SessionSection
  */
 protected function getSessionSection($need)
 {
     $ret = parent::getSessionSection($need);
     if (!is_null($ret)) {
         if ($ret->authenticated && $ret->identity->browser !== $this->browser->getName() && $ret->identity->browserVersion !== $this->browser->getVersion()) {
             $ret->authenticated = FALSE;
             $this->sessionHandler->regenerateId();
             $ret->reason = static::MANUAL;
             $ret->authTime = NULL;
         }
     }
     return $ret;
 }
 /**
  * @param string $event
  * @param array  $properties
  *
  * @internal param array $data
  */
 public function track($event, $properties = [])
 {
     $browserInfo = new Browser();
     $osInfo = new Os();
     $deviceInfo = new Device();
     $browserVersion = trim(str_replace('unknown', '', $browserInfo->getName() . ' ' . $browserInfo->getVersion()));
     $osVersion = trim(str_replace('unknown', '', $osInfo->getName() . ' ' . $osInfo->getVersion()));
     $hardwareVersion = trim(str_replace('unknown', '', $deviceInfo->getName()));
     $data = ['Url' => $this->request->getUri(), 'Operating System' => $osVersion, 'Hardware' => $hardwareVersion, '$browser' => $browserVersion, 'Referrer' => $this->request->header('referer'), '$referring_domain' => $this->request->header('referer') ? parse_url($this->request->header('referer'))['host'] : null, 'ip' => $this->request->ip()];
     $data = array_filter($data);
     $properties = array_filter($properties);
     if (!array_key_exists('$browser', $data) && $browserInfo->isRobot()) {
         $data['$browser'] = 'Robot';
     }
     parent::track($event, $data + $properties);
 }
 /**
  *
  * @param Model\Browser           $browser
  * @param BrowserDetector\Browser $browserRaw
  */
 private function hydrateBrowser(Model\Browser $browser, BrowserDetector\Browser $browserRaw)
 {
     $browser->setName($this->getRealResult($browserRaw->getName()));
     $browser->getVersion()->setComplete($this->getRealResult($browserRaw->getVersion()));
 }