/**
  * Обновляет юзера
  *
  * @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;
 }
 /**
  * Вырезает из временной фотки область нужного размера, ту что задал пользователь
  */
 protected function EventResizeFoto()
 {
     /**
      * Устанавливаем формат Ajax ответа
      */
     $this->Viewer_SetResponseAjax('json');
     /**
      * Достаем из сессии временный файл
      */
     $sFile = $this->Session_Get('sFotoFileTmp');
     $sFilePreview = $this->Session_Get('sFotoFilePreviewTmp');
     if (!file_exists($sFile)) {
         $this->Message_AddErrorSingle($this->Lang_Get('system_error'));
         return;
     }
     /**
      * Определяем размер большого фото для подсчета множителя пропорции
      */
     $fRation = 1;
     if ($aSizeFile = getimagesize($sFile) and isset($aSizeFile[0])) {
         $fRation = $aSizeFile[0] / 200;
         // 200 - размер превью по которой пользователь определяет область для ресайза
         if ($fRation < 1) {
             $fRation = 1;
         }
     }
     /**
      * Получаем размер области из параметров
      */
     $aSize = array();
     $aSizeTmp = getRequest('size');
     if (isset($aSizeTmp['x']) and is_numeric($aSizeTmp['x']) and isset($aSizeTmp['y']) and is_numeric($aSizeTmp['y']) and isset($aSizeTmp['x2']) and is_numeric($aSizeTmp['x2']) and isset($aSizeTmp['y2']) and is_numeric($aSizeTmp['y2'])) {
         $aSize = array('x1' => round($fRation * $aSizeTmp['x']), 'y1' => round($fRation * $aSizeTmp['y']), 'x2' => round($fRation * $aSizeTmp['x2']), 'y2' => round($fRation * $aSizeTmp['y2']));
     }
     /**
      * Вырезаем аватарку
      */
     if ($sFileWeb = $this->User_UploadFoto($sFile, $this->oUserCurrent, $aSize)) {
         /**
          * Удаляем старые аватарки
          */
         $this->oUserCurrent->setProfileFoto($sFileWeb);
         $this->User_Update($this->oUserCurrent);
         $this->Image_RemoveFile($sFilePreview);
         /**
          * Удаляем из сессии
          */
         $this->Session_Drop('sFotoFileTmp');
         $this->Session_Drop('sFotoFilePreviewTmp');
         $this->Viewer_AssignAjax('sFile', $this->oUserCurrent->getProfileFoto());
         $this->Viewer_AssignAjax('sTitleUpload', $this->Lang_Get('settings_profile_photo_change'));
     } else {
         $this->Message_AddError($this->Lang_Get('settings_profile_avatar_error'), $this->Lang_Get('error'));
     }
 }
예제 #3
0
 /**
  * Delete user foto from server
  *
  * @param ModuleUser_EntityUser $oUser
  */
 public function DeleteFoto($oUser)
 {
     @unlink($this->Image_GetServerPath($oUser->getProfileFoto()));
 }
예제 #4
0
 /**
  * Удаляет фото пользователя
  *
  * @param ModuleUser_EntityUser $oUser
  */
 public function DeleteFoto($oUser)
 {
     $this->Image_RemoveFile($this->Image_GetServerPath($oUser->getProfileFoto()));
 }
예제 #5
0
 /**
  * Удаляет фото пользователя
  *
  * @param ModuleUser_EntityUser $oUser
  */
 public function DeleteProfilePhoto($oUser)
 {
     if ($oUser->getProfileFoto()) {
         $this->Image_RemoveFile($oUser->getProfileFoto());
         $oUser->setProfileFoto(null);
     }
 }