From 32feb642180fdbaab540a439617df104c0107973 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 22 May 2005 23:42:49 +0000 Subject: [PATCH] r195: Did the delete and kill DO-branches. --- admin/fields.php | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/admin/fields.php b/admin/fields.php index e42699a..313d9a2 100644 --- a/admin/fields.php +++ b/admin/fields.php @@ -35,14 +35,30 @@ if (empty($_REQUEST['do'])) if ($_REQUEST['do'] == 'kill') { - // run code to remove item in database + $field = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "bugfields WHERE fieldid = " . intval($bugsys->in['fieldid'])); + if (!$field) + { + $admin->error(phrase('error_invalid_id')); + } + + $db->query("DELETE FROM " . TABLE_PREFIX . "bugfields WHERE fieldid = $field[fieldid]"); + $db->query("ALTER TABLE " . TABLE_PREFIX . "bugvalues DROP $field[shortname]"); + $db->query("OPTIMIZE TABLE " . TABLE_PREFIX . "bugvalues"); + + $admin->redirect('fields.php?do=modify', 'The field has been successfully removed from the system.'); } // ################################################################### if ($_REQUEST['do'] == 'delete') { - + $field = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "bugfields WHERE fieldid = " . intval($bugsys->in['fieldid'])); + if (!$field) + { + $admin->error(phrase('error_invalid_id')); + } + + $admin->page_confirm('Are you sure you want to delete this bug field? Doing so will remove everything for this field and it cannot be undone!', "fields.php?do=kill&fieldid=$field[fieldid]"); } // ################################################################### -- 2.43.5