/**
  * Обновляет юзера
  *
  * @param ModuleUser_EntityUser $oUser Объект пользователя
  * @return bool
  */
 public function Update(ModuleUser_EntityUser $oUser)
 {
     $sql = "UPDATE " . Config::Get('db.table.user') . "\n      SET\n        user_password = ? ,\n        user_mail = ? ,\n        user_skill = ? ,\n        user_date_activate = ? ,\n        user_date_comment_last = ? ,\n        user_rating = ? ,\n        user_count_vote = ? ,\n        user_activate = ? ,\n                user_activate_key = ? ,\n        user_profile_name = ? ,\n        user_profile_sex = ? ,\n        user_profile_country = ? ,\n        user_profile_region = ? ,\n        user_profile_city = ? ,\n        user_profile_birthday = ? ,\n        user_profile_about = ? ,\n        user_profile_date = ? ,\n        user_profile_avatar = ?  ,\n        user_profile_foto = ? ,\n        user_settings_notice_new_topic = ?  ,\n        user_settings_notice_new_comment = ? ,\n        user_settings_notice_new_talk = ?  ,\n        user_settings_notice_reply_comment = ? ,\n        user_settings_notice_new_friend = ? ,\n        user_settings_timezone = ?\n      WHERE user_id = ?\n    ";
     if ($this->oDb->query($sql, $oUser->getPassword(), $oUser->getMail(), $oUser->getSkill(), $oUser->getDateActivate(), $oUser->getDateCommentLast(), $oUser->getRating(), $oUser->getCountVote(), $oUser->getActivate(), $oUser->getActivateKey(), $oUser->getProfileName(), $oUser->getProfileSex(), $oUser->getProfileCountry(), $oUser->getProfileRegion(), $oUser->getProfileCity(), $oUser->getProfileBirthday(), $oUser->getProfileAbout(), $oUser->getProfileDate(), $oUser->getProfileAvatar(), $oUser->getProfileFoto(), $oUser->getSettingsNoticeNewTopic(), $oUser->getSettingsNoticeNewComment(), $oUser->getSettingsNoticeNewTalk(), $oUser->getSettingsNoticeReplyComment(), $oUser->getSettingsNoticeNewFriend(), $oUser->getSettingsTimezone(), $oUser->getId())) {
         return true;
     }
     return false;
 }
예제 #2
0
 /**
  * Авторизация юзера
  *
  * @param   ModuleUser_EntityUser $oUser       - Объект пользователя
  * @param   bool                  $bRemember   - Запоминать пользователя или нет
  * @param   string                $sSessionKey - Ключ сессии
  *
  * @return  bool
  */
 public function Authorization(ModuleUser_EntityUser $oUser, $bRemember = true, $sSessionKey = null)
 {
     if (!$oUser->getId() || !$oUser->getActivate()) {
         return false;
     }
     // * Получаем ключ текущей сессии
     if (is_null($sSessionKey)) {
         $sSessionKey = E::ModuleSession()->GetKey();
     }
     // * Создаём новую сессию
     if (!$this->CreateSession($oUser, $sSessionKey)) {
         return false;
     }
     // * Запоминаем в сесси юзера
     E::ModuleSession()->Set('user_id', $oUser->getId());
     $this->oUserCurrent = $oUser;
     // * Ставим куку
     if ($bRemember) {
         E::ModuleSession()->SetCookie($this->GetKeyName(), $sSessionKey, Config::Get('sys.cookie.time'));
     }
     return true;
 }
예제 #3
0
 /**
  * Авторизовывает юзера
  *
  * @param ModuleUser_EntityUser $oUser
  * @return unknown
  */
 public function Authorization(ModuleUser_EntityUser $oUser, $bRemember = true, $sKey = null)
 {
     if (!$oUser->getId() or !$oUser->getActivate()) {
         return false;
     }
     /**
      * Генерим новый ключ авторизаии для куков
      */
     if (is_null($sKey)) {
         $sKey = md5(func_generator() . time() . $oUser->getLogin());
     }
     /**
      * Создаём новую сессию
      */
     if (!$this->CreateSession($oUser, $sKey)) {
         return false;
     }
     /**
      * Запоминаем в сесси юзера
      */
     $this->Session_Set('user_id', $oUser->getId());
     $this->oUserCurrent = $oUser;
     /**
      * Ставим куку
      */
     if ($bRemember) {
         setcookie('key', $sKey, time() + 60 * 60 * 24 * 3, Config::Get('sys.cookie.path'), Config::Get('sys.cookie.host'));
     }
 }
예제 #4
0
 /**
  * Авторизовывает юзера
  *
  * @param ModuleUser_EntityUser $oUser Объект пользователя
  * @param bool $bRemember Запоминать пользователя или нет
  * @param string $sKey Уникальный ключ сессии
  * @return bool
  */
 public function Authorization(ModuleUser_EntityUser $oUser, $bRemember = true, $sKey = null)
 {
     if (!$oUser->getId() or !$oUser->getActivate()) {
         return false;
     }
     /**
      * Создаём новую сессию
      */
     if (!$this->CreateSession($oUser, $sKey)) {
         return false;
     }
     /**
      * Запоминаем в сесси юзера
      */
     $this->Session_Set('user_id', $oUser->getId());
     $this->Session_Set('session_key', $this->oSession->getKey());
     $this->oUserCurrent = $oUser;
     /**
      * Ставим куку
      */
     if ($bRemember) {
         $this->Session_SetCookie('key', $this->oSession->getKey(), time() + Config::Get('module.user.time_login_remember'), false, true);
     }
     return true;
 }