public function deleteCommentAction() { $request = $this->getRequest(); $comment_id = $request->getRequest('comment_id'); $comment_info = Model_Pins::getComment($comment_id); if ($comment_info) { $pin = Model_Pins::getPin($comment_info['pin_id']); if ($comment_info['user_id'] == JO_Session::get('user[user_id]') || JO_Session::get('user[is_admin]') || JO_Session::get('user[user_id]') == $pin['board_data']['user_id']) { if (Model_Pins::deleteComment($comment_id)) { $this->view->ok = true; $this->view->stats = self::getPinStat($comment_info['pin_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')); } }