public function deleteCommentAction() { $request = $this->getRequest(); $comment_id = $request->getRequest('comment_id'); $comment_info = Model_Events::getComment($comment_id); if ($comment_info) { $event = Model_Events::getEvent($comment_info['event_id']); if ($comment_info['user_id'] == JO_Session::get('user[user_id]') || JO_Session::get('user[is_admin]')) { if (Model_Events::deleteComment($comment_id)) { $this->view->ok = true; $this->view->stats = self::getEventStat($comment_info['event_id']); } else { $this->view->error = $this->translate('An error occurred while deleting. Please try again'); } } else { $this->view->error = $this->translate('You are not authorized to delete this comment'); } } else { $this->view->error = $this->translate('Comment not found'); } if ($request->isXmlHttpRequest()) { echo $this->renderScript('json'); } else { $this->redirect($request->getServer('HTTP_REFERER')); } }