public function eventFinish($category, $eventName)
 {
     $eventId = $this->getIdByName($eventName);
     if (empty($this->info[$category]['events'][$eventId]['eventName'])) {
         $this->info[$category]['events'][$eventId]['eventName'] = $eventName;
     }
     $this->info[$category]['events'][$eventId]['finishTime'] = CoreUtils::getTimeMicroseconds() - $this->startTime;
 }
 public static function add($pointName = '')
 {
     if (self::$index == 0) {
         self::$timePoints = array();
     }
     self::$timePoints[self::$index] = array();
     $currentTime = CoreUtils::getTimeMicroseconds();
     self::$timePoints[self::$index]['diff'] = self::$index != 0 ? $currentTime - self::$timePoints[self::$index - 1]['time'] : 0;
     self::$timePoints[self::$index]['time'] = $currentTime;
     self::$timePoints[self::$index]['name'] = $pointName;
     self::$index++;
 }
 protected function updateLoginHistory($loginHistoryDAO, $type, $userId, $loginSuccessful)
 {
     $ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : null;
     $host = isset($_SERVER['REMOTE_HOST']) ? gethostbyaddr($_SERVER['REMOTE_HOST']) : ($ip ? gethostbyaddr($ip) : null);
     $record = $loginHistoryDAO->getRecordTemplate();
     $record['loginHistorySuccess'] = $loginSuccessful ? 1 : null;
     $record['loginHistoryTime'] = CoreUtils::getDateTime();
     $record['loginHistoryMicrotime'] = CoreUtils::getTimeMicroseconds();
     $record['loginHistoryIP'] = $ip;
     if ($host != $ip) {
         $record['loginHistoryHost'] = $host;
     }
     $record['loginHistoryPHPSessionId'] = CoreServices::get('request')->getSessionId();
     $record[$type . 'Id'] = $userId;
     $loginHistoryDAO->save($record);
 }
 public function getNewPasswordChangeCode(&$record)
 {
     return md5(CoreUtils::getTimeMicroseconds() . 'ly2bt94u6w') . 'G' . $record['id'];
 }