public function UpdateEditCommentData(ModuleComment_EntityComment $oComment)
 {
     $sql = "UPDATE " . Config::Get('db.table.comment') . "\r\n        SET\r\n        comment_edit_count= ?d,\r\n        comment_edit_date=?\r\n        WHERE\r\n        comment_id = ?d\r\n        ";
     if ($this->oDb->query($sql, $oComment->getEditCount(), $oComment->getEditDate(), $oComment->getId()) !== false) {
         return true;
     }
     return false;
 }
 /**
  * Обновляет коммент
  *
  * @param  ModuleComment_EntityComment $oComment Объект комментария
  * @return bool
  */
 public function UpdateComment(ModuleComment_EntityComment $oComment)
 {
     $sql = "UPDATE " . Config::Get('db.table.comment') . "\n\t\t\tSET \n\t\t\t\tcomment_text= ?,\n\t\t\t\tcomment_text_source= ?,\n\t\t\t\tcomment_rating= ?f,\n\t\t\t\tcomment_count_vote= ?d,\n\t\t\t\tcomment_count_favourite= ?d,\n\t\t\t\tcomment_count_edit= ?d,\n\t\t\t\tcomment_date_edit= ?,\n\t\t\t\tcomment_delete = ?d ,\n\t\t\t\tcomment_publish = ?d ,\n\t\t\t\tcomment_text_hash = ?\n\t\t\tWHERE\n\t\t\t\tcomment_id = ?d\n\t\t";
     $res = $this->oDb->query($sql, $oComment->getText(), $oComment->getTextSource(), $oComment->getRating(), $oComment->getCountVote(), $oComment->getCountFavourite(), $oComment->getCountEdit(), $oComment->getDateEdit(), $oComment->getDelete(), $oComment->getPublish(), $oComment->getTextHash(), $oComment->getId());
     return $this->IsSuccessful($res);
 }
예제 #3
0
 public function UpdateComment(ModuleComment_EntityComment $oComment)
 {
     $sql = "UPDATE " . Config::Get('db.table.comment') . " \n\t\t\tSET \n\t\t\t\tcomment_text= ?,\n\t\t\t\tcomment_rating= ?f,\n\t\t\t\tcomment_count_vote= ?d,\n\t\t\t\tcomment_delete = ?d ,\n\t\t\t\tcomment_publish = ?d ,\n\t\t\t\tcomment_text_hash = ?\n\t\t\tWHERE\n\t\t\t\tcomment_id = ?d\n\t\t";
     if ($this->oDb->query($sql, $oComment->getText(), $oComment->getRating(), $oComment->getCountVote(), $oComment->getDelete(), $oComment->getPublish(), $oComment->getTextHash(), $oComment->getId())) {
         return true;
     }
     return false;
 }
예제 #4
0
 /**
  * Проверяет может ли пользователь голосовать за конкретный комментарий
  *
  * @param ModuleUser_EntityUser $oUser Пользователь
  * @param ModuleComment_EntityComment $oComment Комментарий
  * @return bool
  */
 public function CanVoteComment($oUser, $oComment)
 {
     $that = $this;
     // fix for PHP < 5.4
     return $this->Rbac_IsAllowUser($oUser, 'vote_comment', array('callback' => function ($oUser, $aParams) use($that, $oComment) {
         if (!$oUser) {
             return false;
         }
         /**
          * Голосует автор комментария?
          */
         if ($oComment->getUserId() == $oUser->getId()) {
             return $that->Lang_Get('vote.notices.error_self');
         }
         /**
          * Пользователь уже голосовал?
          */
         if ($oTopicCommentVote = $that->Vote_GetVote($oComment->getId(), 'comment', $oUser->getId())) {
             return $that->Lang_Get('vote.notices.error_already_voted');
         }
         /**
          * Ограничение по рейтингу
          */
         if ($oUser->getRating() < Config::Get('acl.vote.comment.rating')) {
             return $that->Lang_Get('vote.notices.error_acl');
         }
         /**
          * Время голосования истекло?
          */
         if (strtotime($oComment->getDate()) <= time() - Config::Get('acl.vote.comment.limit_time')) {
             return $that->Lang_Get('vote.notices.error_time');
         }
         return true;
     }));
 }
예제 #5
0
 /**
  * Обновляет коммент
  *
  * @param  ModuleComment_EntityComment $oComment    Объект комментария
  *
  * @return bool
  */
 public function UpdateComment(ModuleComment_EntityComment $oComment)
 {
     $sql = "UPDATE ?_comment\n\t\t\tSET \n\t\t\t\tcomment_text= ?,\n\t\t\t\tcomment_rating= ?f,\n\t\t\t\tcomment_count_vote= ?d,\n\t\t\t\tcomment_count_favourite= ?d,\n\t\t\t\tcomment_delete = ?d ,\n\t\t\t\tcomment_publish = ?d ,\n\t\t\t\tcomment_date_edit = CASE comment_text_hash WHEN ? THEN comment_date_edit ELSE ? END,\n\t\t\t\tcomment_text_hash = ?\n\t\t\tWHERE\n\t\t\t\tcomment_id = ?d\n\t\t";
     $bResult = $this->oDb->query($sql, $oComment->getText(), $oComment->getRating(), $oComment->getCountVote(), $oComment->getCountFavourite(), $oComment->getDelete(), $oComment->getPublish(), $oComment->getTextHash(), F::Now(), $oComment->getTextHash(), $oComment->getId());
     return $bResult !== false;
 }