Exemple #1
0
 /**
  * Получение уникального ключа для значения пользовательской сессии
  *
  * @static
  * @param  null   $hash_key
  * @return string
  *
  * @todo добавить возможность работы через прокси, когда у пользователя меняется конечный IP, но единый IP прокси
  */
 public static function session_cookie_value($hash_key = null)
 {
     $user_ip = joosRequest::user_ip();
     $user_browser = joosRequest::server('HTTP_USER_AGENT', 'none');
     $type = joosConfig::get2('session', 'type', 2);
     switch ($type) {
         case 1:
             $value = md5($hash_key . $user_ip);
             break;
         default:
             $value = joosCSRF::hash($hash_key . $user_ip . $user_browser);
             break;
     }
     return $value;
 }
Exemple #2
0
 public function before_store()
 {
     $comment_text = $this->comment_text;
     $comment_text = joosText::text_clean($comment_text);
     $comment_text = joosText::word_limiter($comment_text, 200);
     $this->comment_text = $comment_text;
     $this->user_id = joosCore::user()->id;
     $this->user_ip = joosRequest::user_ip();
     // высчитываем родителя и заполняем дерево
     if ($this->parent_id > 0) {
         $parent = new modelComments();
         $parent->load($this->parent_id);
         $this->level = $parent->level + 1;
         $this->path = $parent->path . ',' . $parent->id;
     } else {
         $this->path = 0;
     }
     $this->state = 1;
     return true;
 }