From bb64fc9350d9159ea23f415de7964b6a4b2123d4 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sun, 19 Dec 2010 14:21:51 +0100 Subject: add deleteion support to the webui Signed-off-by: Florian Pritz --- system/application/controllers/file.php | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) (limited to 'system/application/controllers') diff --git a/system/application/controllers/file.php b/system/application/controllers/file.php index 40a5c9016..e42d1d3db 100644 --- a/system/application/controllers/file.php +++ b/system/application/controllers/file.php @@ -86,14 +86,38 @@ class File extends Controller { // Allow users to delete IDs if their password matches the one used when uploading function delete() { + $data = array(); $id = $this->uri->segment(3); $password = $this->input->post('password'); - if ($this->file_mod->delete_id($id, $password)) { - echo $id." deleted\n"; + $data["title"] = "Delete"; + $data["id"] = $id; + if ($password) { + if ($this->file_mod->delete_id($id, $password)) { + if ($this->var->cli_client) { + echo $id." deleted\n"; + die(); + } else { + $this->load->view('file/header', $data); + $this->load->view('file/deleted', $data); + $this->load->view('file/footer', $data); + return; + } + } else { + if ($this->var->cli_client) { + echo 'Couldn\'t delete '.$id."\n"; + die(); + } else { + $data["msg"] = "Deletion failed. Is the password correct?"; + } + } + } + if ($this->var->cli_client) { + die(); } else { - echo 'Couldn\'t delete '.$id."\n"; + $this->load->view('file/header', $data); + $this->load->view('file/delete_form', $data); + $this->load->view('file/footer', $data); } - die(); } // Take the content from post instead of a file -- cgit v1.2.3-24-g4f1b