public function delete()
{
$options = WebApp::post('options') === NULL ? array() : strgetcsv(WebApp::post('options'));
if (count($options) == 0) {
return new ActionResult($this, '/admin/core/option_view', 0, 'No option(s) were selected!', B_T_FAIL);
}
foreach ($options as $option) {
$validated = GUMP::is_valid(array('opt' => $option), array('opt' => 'integer'));
if ($validated !== true) {
return new ActionResult($this, '/admin/core/option_view', 0, 'No option(s) were selected!', B_T_FAIL);
}
}
$delete = $this->mySQL_w->prepare("DELETE FROM `core_options` WHERE `id`=?");
$affected_rows = 0;
foreach ($options as $id) {
$delete->bind_param('i', $id);
$delete->execute();
$delete->store_result();
$affected_rows += $delete->affected_rows;
}
if ($affected_rows == count($options)) {
$this->parent->parent->logEvent($this::name_space, 'Deleted options: ' . csvgetstr($options));
return new ActionResult($this, '/admin/core/option_view', 1, 'Successfully deleted selected option(s)!', B_T_SUCCESS);
} else {
$this->parent->parent->logEvent($this::name_space, 'Deleted some options: ' . csvgetstr($options));
return new ActionResult($this, '/admin/core/option_view', 1, 'Successfully deleted ' . $affected_rows . '/' . count($options) . ' selected option(s)!<br /><small>Possible cause: <code>Unknown</code></small>', B_T_WARNING);
}
}