コード例 #1
0
 public function AddComment(ModuleComment_EntityComment $oComment)
 {
     $sql = "INSERT INTO " . Config::Get('db.table.comment') . " \n\t\t\t(comment_pid,\n\t\t\ttarget_id,\n\t\t\ttarget_type,\n\t\t\ttarget_parent_id,\n\t\t\tuser_id,\n\t\t\tcomment_text,\n\t\t\tcomment_date,\n\t\t\tcomment_user_ip,\n\t\t\tcomment_text_hash,\n            guest_name,\n            guest_email\t\t\n\t\t\t)\n\t\t\tVALUES(?, ?d, ?, ?d, ?d, ?, ?, ?, ?, ?, ?)\n\t\t";
     if ($iId = $this->oDb->query($sql, $oComment->getPid(), $oComment->getTargetId(), $oComment->getTargetType(), $oComment->getTargetParentId(), $oComment->getUserId(), $oComment->getText(), $oComment->getDate(), $oComment->getUserIp(), $oComment->getTextHash(), $oComment->getGuestName(), $oComment->getGuestEmail())) {
         return $iId;
     }
     return false;
 }
コード例 #2
0
 /**
  * Добавляет коммент
  *
  * @param  ModuleComment_EntityComment $oComment    Объект комментария
  *
  * @return bool|int
  */
 public function AddComment(ModuleComment_EntityComment $oComment)
 {
     $sql = "INSERT INTO ?_comment\n          (\n              comment_pid,\n              target_id,\n              target_type,\n              target_parent_id,\n              user_id,\n              comment_text,\n              comment_date,\n              comment_user_ip,\n              comment_publish,\n              comment_text_hash\n          )\n          VALUES (\n              ?, ?d, ?, ?d, ?d, ?, ?, ?, ?d, ?\n          )\n        ";
     $iId = $this->oDb->query($sql, $oComment->getPid(), $oComment->getTargetId(), $oComment->getTargetType(), $oComment->getTargetParentId(), $oComment->getUserId(), $oComment->getText(), $oComment->getDate(), $oComment->getUserIp(), $oComment->getPublish(), $oComment->getTextHash());
     return $iId ? $iId : false;
 }
コード例 #3
0
ファイル: ACL.class.php プロジェクト: Casper-SC/livestreet
 /**
  * Проверка на редактирование комментария
  *
  * @param ModuleComment_EntityComment $oComment
  * @param ModuleUser_EntityUser $oUser
  *
  * @return bool
  */
 public function IsAllowEditComment($oComment, $oUser)
 {
     if (!$oUser) {
         return false;
     }
     if (!in_array($oComment->getTargetType(), (array) Config::Get('module.comment.edit_target_allow'))) {
         return false;
     }
     if ($oUser->isAdministrator()) {
         return true;
     }
     if ($oComment->getUserId() == $oUser->getId() and $oUser->getRating() >= Config::Get('acl.update.comment.rating')) {
         /**
          * Проверяем на лимит времени
          */
         if (!Config::Get('acl.update.comment.limit_time') or time() - strtotime($oComment->getDate()) <= Config::Get('acl.update.comment.limit_time')) {
             return true;
         }
     }
     return false;
 }
コード例 #4
0
 /**
  * Добавляет коммент
  *
  * @param  ModuleComment_EntityComment $oComment Объект комментария
  * @return bool|int
  */
 public function AddComment(ModuleComment_EntityComment $oComment)
 {
     $sql = "INSERT INTO " . Config::Get('db.table.comment') . "\n      (comment_pid,\n      target_id,\n      target_type,\n      target_parent_id,\n      user_id,\n      comment_text,\n      comment_date,\n      comment_user_ip,\n      comment_publish,\n      comment_text_hash\n      )\n      VALUES(?, ?d, ?, ?d, ?d, ?, ?, ?, ?d, ?)\n    ";
     if ($iId = $this->oDb->query($sql, $oComment->getPid(), $oComment->getTargetId(), $oComment->getTargetType(), $oComment->getTargetParentId(), $oComment->getUserId(), $oComment->getText(), $oComment->getDate(), $oComment->getUserIp(), $oComment->getPublish(), $oComment->getTextHash())) {
         return $iId;
     }
     return false;
 }