/**
  * Method that permits to delete one or more comments at a time
  *
  * @access	private
  */
 private function delete()
 {
     if ((isset($_POST['empty']) || VRequest::action() == 'delete') && $this->_user['delete_content']) {
         if (isset($_POST['empty']) && VPost::comment_status() && in_array(VPost::comment_status(), array('spam', 'trash'))) {
             $to_delete['table'] = 'comment';
             $to_delete['condition_columns'][':status'] = 'comment_status';
             $to_delete['condition_values'][':status'] = VPost::comment_status();
             $to_delete['value_types'][':status'] = 'str';
             $global_result = $this->_db->delete($to_delete);
         } elseif (VPost::action() == 'delete' && VPost::comment_id()) {
             $results = array();
             $global_result = true;
             foreach (VPost::comment_id() as $id) {
                 try {
                     $comment = new Comment();
                     $comment->_id = $id;
                     $comment->delete();
                     unset($comment);
                     array_push($results, true);
                 } catch (Exception $e) {
                     array_push($results, false);
                 }
             }
             foreach ($results as $result) {
                 if ($result !== true) {
                     $global_result = false;
                 }
             }
         } elseif (VGet::action() == 'delete' && VGet::comment_id()) {
             try {
                 $comment = new Comment();
                 $comment->_id = VGet::comment_id();
                 $comment->delete();
                 $global_result = true;
             } catch (Exception $e) {
                 $global_result = false;
             }
         }
         if (isset($global_result)) {
             $this->_action_msg = ActionMessages::deleted($global_result);
         }
     } elseif ((isset($POST['empty']) || VRequest::action() == 'delete') && $this->_user['delete_content'] === false) {
         $this->_action_msg = ActionMessages::action_no_perm();
     }
 }
 /**
  * Create a comment
  *
  * @access	private
  */
 private function create()
 {
     if ($this->check_data()) {
         try {
             $class = '\\Library\\Models\\' . ucfirst($this->_data['type']);
             $el = new $class();
             $el->_id = $this->_data['id'];
             $el->read('_allow_comment');
             if ($el->_allow_comment == 'closed') {
                 throw new Exception('Comments are closed!');
             }
             $comment = new MComment();
             $comment->_name = $this->_data['name'];
             $comment->_email = $this->_data['email'];
             $comment->_content = $this->_data['content'];
             $comment->_rel_id = $this->_data['id'];
             $comment->_rel_type = $this->_data['type'];
             $comment->_status = 'pending';
             $comment->create();
             $this->_return_msg = array('message' => true);
         } catch (Exception $e) {
             $this->_return_msg = array('message' => $e->getMessage());
         }
     }
 }