| @@ 653-666 (lines=14) @@ | ||
| 650 | if ($request->isPost()) { |
|
| 651 | $post = $this->getGameService()->getPostvotePostMapper()->findById($postId); |
|
| 652 | $comment = ($commentId !== null) ? $this->getGameService()->getPostVoteCommentMapper()->findById($commentId) : null; |
|
| 653 | if ($this->getGameService()->toggleVote( |
|
| 654 | $this->user, |
|
| 655 | $this->getRequest()->getServer('REMOTE_ADDR'), |
|
| 656 | $post, |
|
| 657 | $comment |
|
| 658 | )) { |
|
| 659 | $response->setContent(\Zend\Json\Json::encode(array( |
|
| 660 | 'success' => 1 |
|
| 661 | ))); |
|
| 662 | } else { |
|
| 663 | $response->setContent(\Zend\Json\Json::encode(array( |
|
| 664 | 'success' => 0 |
|
| 665 | ))); |
|
| 666 | } |
|
| 667 | } |
|
| 668 | } |
|
| 669 | ||
| @@ 764-780 (lines=17) @@ | ||
| 761 | $response->setContent(\Zend\Json\Json::encode(array( |
|
| 762 | 'success' => 0 |
|
| 763 | ))); |
|
| 764 | } else { |
|
| 765 | if ($request->isPost()) { |
|
| 766 | if ($this->getGameService()->removeComment( |
|
| 767 | $this->user, |
|
| 768 | $this->getRequest()->getServer('REMOTE_ADDR'), |
|
| 769 | $commentId |
|
| 770 | )) { |
|
| 771 | $response->setContent(\Zend\Json\Json::encode(array( |
|
| 772 | 'success' => 1 |
|
| 773 | ))); |
|
| 774 | } else { |
|
| 775 | $response->setContent(\Zend\Json\Json::encode(array( |
|
| 776 | 'success' => 0 |
|
| 777 | ))); |
|
| 778 | } |
|
| 779 | } |
|
| 780 | } |
|
| 781 | ||
| 782 | return $response; |
|
| 783 | } |
|