/**
  * @see EventListener::execute()
  */
 public function execute($eventObj, $className, $eventName)
 {
     if (MODULE_USERS_ONLINE == 1) {
         if ($eventObj->frame->getUser()->isOnline()) {
             $data = array('userID' => $eventObj->frame->getUser()->userID, 'requestURI' => $eventObj->frame->getUser()->requestURI, 'requestMethod' => $eventObj->frame->getUser()->requestMethod);
             $location = new UsersOnlineLocation();
             $location->cacheLocation($data);
             $userLocation = $location->getLocation($data);
             if (!empty($userLocation)) {
                 $eventObj->generalInformation[] = array('icon' => StyleManager::getStyle()->getIconPath('onlineM.png'), 'title' => WCF::getLanguage()->get('wcf.user.profile.currentLocation'), 'value' => $userLocation);
             }
             // show ip address and user agent
             if (WCF::getUser()->getPermission('admin.general.canViewIpAddress')) {
                 if ($eventObj->frame->getUser()->ipAddress) {
                     $eventObj->generalInformation[] = array('icon' => StyleManager::getStyle()->getIconPath('ipAddressM.png'), 'title' => WCF::getLanguage()->get('wcf.usersOnline.ipAddress'), 'value' => StringUtil::encodeHTML($eventObj->frame->getUser()->ipAddress));
                 }
                 if ($eventObj->frame->getUser()->userAgent) {
                     $icon = UsersOnlineUtil::getUserAgentIcon($eventObj->frame->getUser()->userAgent);
                     $eventObj->generalInformation[] = array('icon' => $icon ? StyleManager::getStyle()->getIconPath('browsers/' . $icon . 'M.png') : '', 'title' => WCF::getLanguage()->get('wcf.usersOnline.userAgent'), 'value' => StringUtil::encodeHTML($eventObj->frame->getUser()->userAgent));
                 }
             }
         }
     }
 }
 /**
  * @see UsersOnline::handleRow()
  */
 protected function handleRow($row, User $user)
 {
     if ($row['userID']) {
         if ($this->isVisible($row, $user)) {
             // username
             $row['username'] = $this->getFormattedUsername($row, $user);
             // get icon
             if ($this->enableUserAgentIcons) {
                 $row['userAgentIcon'] = UsersOnlineUtil::getUserAgentIcon($row['userAgent']);
             }
             // add user
             $this->users[] = $row;
         }
     } else {
         if ($row['spiderID']) {
             if (USERS_ONLINE_SHOW_ROBOTS) {
                 // search engine robot
                 if ($this->spiderList == null) {
                     // get spider cache
                     $this->spiderList = WCF::getCache()->get('spiders');
                 }
                 // get icon
                 if ($this->enableUserAgentIcons) {
                     $row['userAgentIcon'] = 'browserRobot';
                 }
                 if (isset($this->spiderList[$row['spiderID']])) {
                     if ($this->detailedSpiderList) {
                         $row['count'] = 1;
                         $row['spiderName'] = $this->spiderList[$row['spiderID']]['spiderName'];
                         $row['spiderURL'] = $this->spiderList[$row['spiderID']]['spiderURL'];
                         $this->spiders[] = $row;
                     } else {
                         $identifier = $this->spiderList[$row['spiderID']]['spiderIdentifier'];
                         if (!isset($this->spiders[$identifier])) {
                             $row['count'] = 1;
                             $row['spiderName'] = $this->spiderList[$row['spiderID']]['spiderName'];
                             $row['spiderURL'] = $this->spiderList[$row['spiderID']]['spiderURL'];
                             $this->spiders[$identifier] = $row;
                         } else {
                             $this->spiders[$identifier]['count']++;
                             if ($row['lastActivityTime'] > $this->spiders[$identifier]['lastActivityTime']) {
                                 $this->spiders[$identifier]['lastActivityTime'] = $row['lastActivityTime'];
                                 $this->spiders[$identifier]['requestURI'] = $row['requestURI'];
                                 $this->spiders[$identifier]['requestMethod'] = $row['requestMethod'];
                             }
                         }
                     }
                 }
             }
         } else {
             // guest
             if (USERS_ONLINE_SHOW_GUESTS) {
                 if (!isset($this->guestIpAddresses[$row['ipAddress']])) {
                     // get icon
                     if ($this->enableUserAgentIcons) {
                         $row['userAgentIcon'] = UsersOnlineUtil::getUserAgentIcon($row['userAgent']);
                     }
                     // add guest
                     $this->guests[] = $row;
                     $this->guestIpAddresses[$row['ipAddress']] = true;
                 }
             }
         }
     }
 }