@@ 743-761 (lines=19) @@ | ||
740 | $response->setContent(\Zend\Json\Json::encode(array( |
|
741 | 'success' => 0 |
|
742 | ))); |
|
743 | } else { |
|
744 | if ($request->isPost()) { |
|
745 | if ($this->getGameService()->addComment( |
|
746 | $this->user, |
|
747 | $this->getRequest()->getServer('REMOTE_ADDR'), |
|
748 | $post, |
|
749 | $this->params()->fromPost('comment'), |
|
750 | $this->params()->fromPost('category') |
|
751 | )) { |
|
752 | $response->setContent(\Zend\Json\Json::encode(array( |
|
753 | 'success' => 1 |
|
754 | ))); |
|
755 | } else { |
|
756 | $response->setContent(\Zend\Json\Json::encode(array( |
|
757 | 'success' => 0 |
|
758 | ))); |
|
759 | } |
|
760 | } |
|
761 | } |
|
762 | ||
763 | //ajax call ? |
|
764 | if ($this->getRequest()->isXmlHttpRequest()) { |
|
@@ 831-851 (lines=21) @@ | ||
828 | return $response; |
|
829 | } |
|
830 | ||
831 | if (!$this->zfcUserAuthentication()->hasIdentity()) { |
|
832 | $response->setContent(\Zend\Json\Json::encode(array( |
|
833 | 'success' => 0 |
|
834 | ))); |
|
835 | } else { |
|
836 | if ($request->isPost()) { |
|
837 | if ($this->getGameService()->removeComment( |
|
838 | $this->user, |
|
839 | $this->getRequest()->getServer('REMOTE_ADDR'), |
|
840 | $commentId |
|
841 | )) { |
|
842 | $response->setContent(\Zend\Json\Json::encode(array( |
|
843 | 'success' => 1 |
|
844 | ))); |
|
845 | } else { |
|
846 | $response->setContent(\Zend\Json\Json::encode(array( |
|
847 | 'success' => 0 |
|
848 | ))); |
|
849 | } |
|
850 | } |
|
851 | } |
|
852 | ||
853 | return $response; |
|
854 | } |