/** * 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(); } }