| @@ 700-721 (lines=22) @@ | ||
| 697 | $response = $this->getResponse(); |
|
| 698 | $post = $this->getGameService()->getPostvotePostMapper()->findById($postId); |
|
| 699 | ||
| 700 | if (!$this->zfcUserAuthentication()->hasIdentity()) { |
|
| 701 | $response->setContent(\Zend\Json\Json::encode(array( |
|
| 702 | 'success' => 0 |
|
| 703 | ))); |
|
| 704 | } else { |
|
| 705 | if ($request->isPost()) { |
|
| 706 | if ($this->getGameService()->addComment( |
|
| 707 | $this->user, |
|
| 708 | $this->getRequest()->getServer('REMOTE_ADDR'), |
|
| 709 | $post, |
|
| 710 | $this->params()->fromPost('comment') |
|
| 711 | )) { |
|
| 712 | $response->setContent(\Zend\Json\Json::encode(array( |
|
| 713 | 'success' => 1 |
|
| 714 | ))); |
|
| 715 | } else { |
|
| 716 | $response->setContent(\Zend\Json\Json::encode(array( |
|
| 717 | 'success' => 0 |
|
| 718 | ))); |
|
| 719 | } |
|
| 720 | } |
|
| 721 | } |
|
| 722 | ||
| 723 | //ajax call ? |
|
| 724 | if ($this->getRequest()->isXmlHttpRequest()) { |
|
| @@ 756-776 (lines=21) @@ | ||
| 753 | return $response; |
|
| 754 | } |
|
| 755 | ||
| 756 | if (!$this->zfcUserAuthentication()->hasIdentity()) { |
|
| 757 | $response->setContent(\Zend\Json\Json::encode(array( |
|
| 758 | 'success' => 0 |
|
| 759 | ))); |
|
| 760 | } else { |
|
| 761 | if ($request->isPost()) { |
|
| 762 | if ($this->getGameService()->removeComment( |
|
| 763 | $this->user, |
|
| 764 | $this->getRequest()->getServer('REMOTE_ADDR'), |
|
| 765 | $commentId |
|
| 766 | )) { |
|
| 767 | $response->setContent(\Zend\Json\Json::encode(array( |
|
| 768 | 'success' => 1 |
|
| 769 | ))); |
|
| 770 | } else { |
|
| 771 | $response->setContent(\Zend\Json\Json::encode(array( |
|
| 772 | 'success' => 0 |
|
| 773 | ))); |
|
| 774 | } |
|
| 775 | } |
|
| 776 | } |
|
| 777 | ||
| 778 | return $response; |
|
| 779 | } |
|