Положительное голосование за комментарий

@param int $comment_id Номер комментария для голосования
@return array
@throws IncorrectUsageException
491996
public function votePlus($comment_id)
    {
        $this->checkId($comment_id);

        return $this->vote($comment_id, self::VOTE_PLUS);
    }
881094
public function newAction($postid)
    {
        $post = $this->getPost($postid);

        $entity = new Comment();
        $form   = $this->createForm(new CommentType(), $entity);

        return array(
            'entity' => $entity,
            'post'   => $post,
            'form'   => $form->createView(),
        );
    }
11549
public function hasAccessToComment($commentID)
    {

        $this->isLoggedIn();

        $userid = $this->di->get("session")->get("userid");
        $comment = new Comment();
        $comment->setDb($this->di->get("db"));
        $user = new User();
        $user->setDb($this->di->get("db"));

        $user->find("id", $userid);
        $comment->find("id", $commentID);

        if (($comment->user_id == $userid) || $this->isAdmin()) {
            return true;
        }
        $this->di->get("response")->redirect("user");
        return false;
    }
1279462
public function addComment($comment)
    {
        $comment->setPaymentId($this->getPaymentId());
        $comment->save();

        $this->load($this->getPaymentId());

        return $comment;
    }
1295319
private function getCommentModel($id=NULL)
	{
		if ($id === NULL)
			throw new CHttpException(400, Yii::t('Api.comment', 'Missing id'));

		$model = Comments::model()->findByPk($id);
		if ($model === NULL)
			throw new CHttpException(404, Yii::t('Api.comment', 'Comment #{{id}} was not found.', array('{{id}}' => $id)));

		return $model;
	}
185824
public function delete($commentid) {
        global $DB, $USER;
        $candelete = has_capability('moodle/comment:delete', $this->context);
        if (!$comment = $DB->get_record('comments', array('id'=>$commentid))) {
            throw new comment_exception('dbupdatefailed');
        }
        if (!($USER->id == $comment->userid || !empty($candelete))) {
            throw new comment_exception('nopermissiontocomment');
        }
        $DB->delete_records('comments', array('id'=>$commentid));
        // Trigger comment delete event.
        if (core_component::is_core_subsystem($this->component)) {
            $eventclassname = '\\core\\event\\' . $this->component . '_comment_deleted';
        } else {
            $eventclassname = '\\' . $this->component . '\\event\comment_deleted';
        }
        if (class_exists($eventclassname)) {
            $event = $eventclassname::create(
                    array(
                        'context' => $this->context,
                        'objectid' => $commentid,
                        'other' => array(
                            'itemid' => $this->itemid
                            )
                        ));
            $event->add_record_snapshot('comments', $comment);
            $event->trigger();
        }
        return true;
    }
1236069
public function serialize(Comment $comment, array $options = [])
    {
        return [
            'id' => $comment->getUuid(),
            'message' => $comment->getMessage(),
            'creationDate' => $comment->getCreationDate() ? DateNormalizer::normalize($comment->getCreationDate()) : null,
            'updateDate' => $comment->getUpdateDate() ? DateNormalizer::normalize($comment->getUpdateDate()) : null,
            'publicationDate' => $comment->getPublicationDate() ? DateNormalizer::normalize($comment->getPublicationDate()) : null,
            'author' => $comment->getAuthor() ? $this->userSerializer->serialize($comment->getAuthor()) : null,
            'authorName' => null !== $comment->getAuthor() ? $comment->getAuthor()->getFullName() : null,
            'authorPicture' => null !== $comment->getAuthor() ? $comment->getAuthor()->getPicture() : null,
            'isPublished' => $comment->isPublished(),
            'reported' => $comment->getReported(),
        ];
    }
188006
public function stripTags($comment_text, $comment)
    {
        $allowedTags = array(
            "<h1>", "<h2>", "<h3>", "<h4>",
            "<strong>","<b>",
            "<br>", "<hr>",
            "<em>",
            "<ol>","<ul>","<li>",
            "<p>", "<span>", "<a>", "<img>",
            "<del>", "<ins>",
            "<blockquote>"
        );

        $allowedAttributes = array('href', 'class', 'rel', 'id', 'src');

        return \Municipio\Helper\Html::stripTagsAndAtts($comment_text, $allowedTags, $allowedAttributes);
    }
687787
public static function add_comment(comment $comment) {
        global $DB;
        $comment->id = null;
        return $DB->insert_record('assignfeedback_editpdf_cmnt', $comment);
    }
1280954
public List<Comment> getComment(int id) {
        ClientResource resource = new ClientResource(Route.GET_COMMENT.url(id));
        try {
            String result = resource.get().getText();
            return mapper.readValue(result, new TypeReference<List<Comment>>() {});
        } catch (IOException ex) {
            LEX4JLogger.log(Level.WARNING, "Could not retrieve lot comments correctly!");
            return null;
        }
    }
433489
public function get($commentId, array $params = array())
    {
        $endpoint = '/admin/comments/'.$commentId.'.json';
        $response = $this->request($endpoint);
        return $this->createObject(Comment::class, $response['comment']);
    }
554617
public function parseComment($comment)
    {
        preg_match_all('/@([a-zA-Z]+) *(.*)\n/', $comment, $matches, PREG_SET_ORDER);
        $tags = new TagCollection();

        foreach ($matches as $match) {
            array_shift($match);
            list($tag, $body) = $match;

            $tags->addTag($this->getTagEntity($tag, $body));
        }

        return $tags;
    }
251162
public function edit(Comment $comment)
    {
        $this->authorize($comment);

        pageinfo([
            'title' => __('comments.edit_page'),
            'robots' => 'noindex,follow',
        ]);

        return $this->makeResponse('edit', compact('comment'));
    }
1219088
private function createComment()
	{
		$model = new Comments;
		$model->attributes = $_POST;

		$model->user_id = $this->user->id;
		if ($model->save())
			return $model->getApiAttributes();

		return $this->returnError(400, NULL, $model->getErrors());
	}
1313266
public function getCommentsForPost($post_id)
    {
        $this->checkId($post_id);

        return $this->adapter->get(sprintf('/comments/%d', $post_id));
    }
86609
public function Comment() {
      $this->Permission('Garden.Profiles.Edit');
      
      $Session = Gdn::Session();
      $this->Form->SetModel($this->ActivityModel);
      $NewActivityID = 0;
      
      // Form submitted
      if ($this->Form->IsPostBack()) {
         $Body = $this->Form->GetValue('Body', '');
         $ActivityID = $this->Form->GetValue('ActivityID', '');
         if (is_numeric($ActivityID) && $ActivityID > 0) {
            $ActivityComment = array(
                'ActivityID' => $ActivityID,
                'Body' => $Body,
                'Format' => 'Text');
            
            $ID = $this->ActivityModel->Comment($ActivityComment);
            
            if ($ID == SPAM || $ID == UNAPPROVED) {
               $this->StatusMessage = T('ActivityCommentRequiresApproval', 'Your comment will appear after it is approved.');
               $this->Render('Blank', 'Utility');
               return;
            }
            
            $this->Form->SetValidationResults($this->ActivityModel->ValidationResults());
            if ($this->Form->ErrorCount() > 0) {
               throw new Exception($this->ActivityModel->Validation->ResultsText());
               
               $this->ErrorMessage($this->Form->Errors());
            }
         }
      }
      
      // Redirect back to the sending location if this isn't an ajax request
      if ($this->_DeliveryType === DELIVERY_TYPE_ALL) {
         $Target = $this->Form->GetValue('Return');
         if (!$Target)
            $Target = '/activity';
         Redirect($Target);
      } else {
         // Load the newly added comment.
         $this->SetData('Comment', $this->ActivityModel->GetComment($ID));
         
         // Set it in the appropriate view.
         $this->View = 'comment';
      }

      // And render
      $this->Render();
   }
1160369
public function delete($commentId)
    {
        $db = $this->getDb();
        $db->startTransaction();

        $deleteResult = $db->execute('DELETE FROM `oepaypal_orderpaymentcomments` WHERE `oepaypal_commentid` = ' . $db->quote($commentId));

        $result = ($deleteResult !== false);

        if ($result) {
            $db->commitTransaction();
        } else {
            $db->rollbackTransaction();
        }

        return $result;
    }