/** * Обновляет юзера * * @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; }
/** * Проверяет может ли пользователь создавать комментарии по времени(например ограничение максимум 1 коммент в 5 минут) * * @param Entity_User $oUser * @return bool */ public function CanPostCommentTime(ModuleUser_EntityUser $oUser) { if (Config::Get('acl.create.comment.limit_time') > 0 and $oUser->getDateCommentLast()) { $sDateCommentLast = strtotime($oUser->getDateCommentLast()); if ($oUser->getRating() < Config::Get('acl.create.comment.limit_time_rating') and time() - $sDateCommentLast < Config::Get('acl.create.comment.limit_time')) { return false; } } return true; }
/** * Проверяет может ли пользователь создавать комментарии по времени(например ограничение максимум 1 коммент в 5 минут) * * @param ModuleUser_EntityUser $oUser Пользователь * * @return bool */ public function CanPostCommentTime(ModuleUser_EntityUser $oUser) { if (!$oUser) { return false; } if ($oUser->isAdministrator() || $oUser->isModerator()) { return true; } if (Config::Get('acl.create.comment.limit_time') > 0 && $oUser->getDateCommentLast()) { $sDateCommentLast = strtotime($oUser->getDateCommentLast()); if ($oUser->getRating() < Config::Get('acl.create.comment.limit_time_rating') && time() - $sDateCommentLast < Config::Get('acl.create.comment.limit_time')) { return false; } } return true; }