Пример #1
0
 public function deleteMultiCommentsAction()
 {
     $this->setInvokeArg('noViewRenderer', true);
     if (!WM_Users::allow('delete', $this->getRequest()->getController())) {
         echo $this->translate('You do not have permission to this action');
     } else {
         $action_check = $this->getRequest()->getPost('action_check');
         if ($action_check && is_array($action_check)) {
             foreach ($action_check as $record_id) {
                 Model_Events::deleteComment($record_id);
             }
         }
     }
 }
Пример #2
0
 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'));
     }
 }