예제 #1
0
 /**
  * Increments and returns abuses counter.
  * The counter is stored in user's session.
  *
  * @return integer
  */
 public function incrementAndGetAbusesCounter()
 {
     $key = self::SESSION_KEY_ABUSES_COUNTER;
     $counter = 1;
     if ($this->userSessionDAO->contains($key)) {
         $counter += $this->userSessionDAO->get(self::SESSION_KEY_ABUSES_COUNTER);
     }
     $this->userSessionDAO->set(self::SESSION_KEY_ABUSES_COUNTER, $counter);
     return $counter;
 }
예제 #2
0
 /**
  * Resets tracking of the given event. Resets all events if event ID equals null.
  *
  * @param string $group Event group
  * @param string|null $id Event id
  *
  * @return null
  */
 public function resetEventTracker($group, $id = null)
 {
     $prefix = self::SESSION_KEY_EVENT_TIME . md5($group) . '_';
     if ($id !== null) {
         $sessionKey = $prefix . md5($id);
         if ($this->userSessionDAO->contains($sessionKey)) {
             $this->userSessionDAO->drop($sessionKey);
         }
     } else {
         $this->userSessionDAO->dropAllByPrefix($prefix);
     }
 }
예제 #3
0
 /**
  * Returns the original username if exists.
  *
  * @return string|null
  */
 public function getOriginalUserName()
 {
     if ($this->userSessionDAO->contains(self::SESSION_KEY_ORIGINAL_USERNAME)) {
         return $this->userSessionDAO->get(self::SESSION_KEY_ORIGINAL_USERNAME);
     } else {
         return null;
     }
 }