From c9fa3ed37fd1371ef24f6c3330995025295d7baf Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Tue, 6 Sep 2016 14:11:39 +0200 Subject: Allow creation of multipastes from upload history Signed-off-by: Florian Pritz --- application/controllers/file/file_default.php | 34 +++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'application/controllers/file/file_default.php') diff --git a/application/controllers/file/file_default.php b/application/controllers/file/file_default.php index 2b77866a0..3b5eb0ee4 100644 --- a/application/controllers/file/file_default.php +++ b/application/controllers/file/file_default.php @@ -683,6 +683,40 @@ class File_default extends MY_Controller { $this->load->view('footer', $this->data); } + public function handle_history_submit() + { + $this->muser->require_access("apikey"); + + $process = $this->input->post("process"); + + $dispatcher = [ + "delete" => function() { + return $this->do_delete(); + }, + "multipaste" => function() { + return $this->_append_multipaste_queue(); + }, + ]; + + if (isset($dispatcher[$process])) { + $dispatcher[$process](); + } else { + throw new \exceptions\UserInputException("file/handle_history_submit/invalid-process-value", "Value in process field not found in dispatch table"); + } + } + + private function _append_multipaste_queue() + { + $ids = $this->input->post("ids"); + if ($ids === false) { + $ids = []; + } + + $m = new \service\multipaste_queue(); + $m->append($ids); + redirect("file/multipaste/queue"); + } + function upload_history() { $this->muser->require_access("apikey"); -- cgit v1.2.3-24-g4f1b