示例#1
0
文件: feed.php 项目: rasuldev/torino
 /**
  * Add a comment
  * @param array $params
  * @return array|false
  */
 public function add(array $params)
 {
     if (!$this->canAdd()) {
         $this->errorCollection->addOne(new Error(Loc::getMessage("FORUM_CM_RIGHTS1"), self::ERROR_PERMISSION));
     } else {
         if ($this->checkTopic()) {
             $comment = Comment::create($this);
             $comment->add($params);
             if ($comment->hasErrors()) {
                 $this->errorCollection->add($comment->getErrors());
             } else {
                 return $comment->getComment();
             }
         }
     }
     return false;
 }