@@ 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'); |
@@ 521-530 (lines=10) @@ | ||
518 | ||
519 | $json = []; |
|
520 | ||
521 | if (!is_null($checkLike)) { |
|
522 | $json['message'] = __('You already like this article !'); |
|
523 | $json['error'] = true; |
|
524 | ||
525 | $this->set(compact('json')); |
|
526 | ||
527 | $this->set('_serialize', 'json'); |
|
528 | ||
529 | return; |
|
530 | } |
|
531 | ||
532 | //Check if the article exist. |
|
533 | $this->loadModel('BlogArticles'); |
|
@@ 542-550 (lines=9) @@ | ||
539 | ]) |
|
540 | ->first(); |
|
541 | ||
542 | if (is_null($checkArticle)) { |
|
543 | $json['message'] = __("This article doesn't exist !"); |
|
544 | $json['error'] = true; |
|
545 | ||
546 | $this->set(compact('json')); |
|
547 | $this->set('_serialize', 'json'); |
|
548 | ||
549 | return; |
|
550 | } |
|
551 | ||
552 | //Prepare data to be saved. |
|
553 | $data = []; |
|
@@ 615-624 (lines=10) @@ | ||
612 | ||
613 | $json = []; |
|
614 | ||
615 | if (is_null($like)) { |
|
616 | $json['message'] = __("You don't like this article !"); |
|
617 | $json['error'] = true; |
|
618 | ||
619 | $this->set(compact('json')); |
|
620 | ||
621 | $this->set('_serialize', 'json'); |
|
622 | ||
623 | return; |
|
624 | } |
|
625 | ||
626 | if ($this->BlogArticlesLikes->delete($like)) { |
|
627 | //Update the Statistics |
|
@@ 733-740 (lines=8) @@ | ||
730 | 'errorMessage' => '' |
|
731 | ]; |
|
732 | ||
733 | if (is_null($comment)) { |
|
734 | $json['error'] = true; |
|
735 | $json['errorMessage'] = __("This comment doesn't exist or has been deleted !"); |
|
736 | ||
737 | $this->set(compact('json')); |
|
738 | ||
739 | return; |
|
740 | } |
|
741 | ||
742 | //Current user. |
|
743 | $this->loadModel('Users'); |