From f88977cfbd4636933c5016c2035b77e5639f6c7e Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Tue, 18 Aug 2015 22:03:46 +0200 Subject: claim_id: Support multiple upload batches If the user has multiple tabs open, but is not logged in this will be called multiple times (unless he logs in after the first upload batch) and earlier uploads would be lost. Signed-off-by: Florian Pritz --- application/controllers/file.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/application/controllers/file.php b/application/controllers/file.php index 868366af0..a78f89bb0 100644 --- a/application/controllers/file.php +++ b/application/controllers/file.php @@ -516,11 +516,19 @@ class File extends MY_Controller { if (!$this->muser->logged_in()) { $this->muser->require_session(); // keep the upload but require the user to login - $this->session->set_userdata("last_upload", array( - "ids" => $ids, - "lexer" => $lexer - )); - $this->session->set_flashdata("uri", "file/claim_id"); + $last_upload = $this->session->userdata("last_upload"); + if ($last_upload === false) { + $last_upload = array( + "ids" => [], + "lexer" => "", + ); + } + $last_upload = array( + "ids" => array_merge($last_upload['ids'], $ids), + "lexer" => "", + ); + $this->session->set_userdata("last_upload", $last_upload); + $this->data["redirect_uri"] = "file/claim_id"; $this->muser->require_access("basic"); } -- cgit v1.2.3-24-g4f1b