@@ 566-573 (lines=8) @@ | ||
563 | 'errorMessage' => '' |
|
564 | ]; |
|
565 | ||
566 | if (is_null($message)) { |
|
567 | $json['error'] = true; |
|
568 | $json['errorMessage'] = __d('conversations', "This message doesn't exist or has been deleted !"); |
|
569 | ||
570 | $this->set(compact('json')); |
|
571 | ||
572 | return; |
|
573 | } |
|
574 | ||
575 | //Current user. |
|
576 | $this->loadModel('Users'); |
@@ 529-538 (lines=10) @@ | ||
526 | ||
527 | $json = []; |
|
528 | ||
529 | if (!is_null($checkLike)) { |
|
530 | $json['message'] = __('You already like this article !'); |
|
531 | $json['error'] = true; |
|
532 | ||
533 | $this->set(compact('json')); |
|
534 | ||
535 | $this->set('_serialize', 'json'); |
|
536 | ||
537 | return; |
|
538 | } |
|
539 | ||
540 | //Check if the article exist. |
|
541 | $this->loadModel('BlogArticles'); |
|
@@ 550-558 (lines=9) @@ | ||
547 | ]) |
|
548 | ->first(); |
|
549 | ||
550 | if (is_null($checkArticle)) { |
|
551 | $json['message'] = __("This article doesn't exist !"); |
|
552 | $json['error'] = true; |
|
553 | ||
554 | $this->set(compact('json')); |
|
555 | $this->set('_serialize', 'json'); |
|
556 | ||
557 | return; |
|
558 | } |
|
559 | ||
560 | //Prepare data to be saved. |
|
561 | $data = []; |
|
@@ 623-632 (lines=10) @@ | ||
620 | ||
621 | $json = []; |
|
622 | ||
623 | if (is_null($like)) { |
|
624 | $json['message'] = __("You don't like this article !"); |
|
625 | $json['error'] = true; |
|
626 | ||
627 | $this->set(compact('json')); |
|
628 | ||
629 | $this->set('_serialize', 'json'); |
|
630 | ||
631 | return; |
|
632 | } |
|
633 | ||
634 | if ($this->BlogArticlesLikes->delete($like)) { |
|
635 | //Update the Statistics |
|
@@ 741-748 (lines=8) @@ | ||
738 | 'errorMessage' => '' |
|
739 | ]; |
|
740 | ||
741 | if (is_null($comment)) { |
|
742 | $json['error'] = true; |
|
743 | $json['errorMessage'] = __("This comment doesn't exist or has been deleted !"); |
|
744 | ||
745 | $this->set(compact('json')); |
|
746 | ||
747 | return; |
|
748 | } |
|
749 | ||
750 | //Current user. |
|
751 | $this->loadModel('Users'); |