From 07fb834c906d2abf56f698bd70a9611a37295d51 Mon Sep 17 00:00:00 2001 From: Alexander Davis Date: Mon, 10 Aug 2020 18:16:50 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Creation=20of=20reopen=20request=20?= =?UTF-8?q?feature=20(#68)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Creation of button and SQL * Movement of buttons * Changes to authorisation requirements * Update to errors * :art: Tidy up a little Signed-off-by: Luke Tainton * :art: Fix comment Signed-off-by: Luke Tainton Co-authored-by: Luke Tainton --- app/public/actions/close.php | 6 +++- app/public/actions/reopen.php | 31 ++++++++++++++++++++ app/public/view.php | 53 ++++++++++++++++++----------------- 3 files changed, 63 insertions(+), 27 deletions(-) create mode 100644 app/public/actions/reopen.php diff --git a/app/public/actions/close.php b/app/public/actions/close.php index eb71ade..2ccbddf 100644 --- a/app/public/actions/close.php +++ b/app/public/actions/close.php @@ -4,7 +4,11 @@ $request = get_request($db, $_GET['rid']); $authorised_users = get_subscribers($db, $request); - $is_authorised = isAuthorised($_SESSION['uuid'], $authorised_users, $request); + if ($_SESSION['uuid'] == $request['created_by']) { + $is_authorised = true; + } else { + $is_authorised = false; + }; // Close request if ($is_authorised == true) { diff --git a/app/public/actions/reopen.php b/app/public/actions/reopen.php new file mode 100644 index 0000000..3aee5f5 --- /dev/null +++ b/app/public/actions/reopen.php @@ -0,0 +1,31 @@ +prepare($stmt); + $sql->bindParam(':uuid', $_GET['rid']); + $sql->execute(); + } catch (PDOException $e) { + $alert = array("danger", "Failed to reopen request: " . $e->getMessage()); + } + $newURL = "/"; + echo(""); + } else { + $alert = array("danger", "You are not authorised to reopen this request."); + $newURL = "/view?rid=" . $request['uuid']; + echo(""); + } + +?> diff --git a/app/public/view.php b/app/public/view.php index 1224e54..b026de4 100644 --- a/app/public/view.php +++ b/app/public/view.php @@ -51,37 +51,38 @@

- - Manage subscribers - Update the request Add attachment(s) - - + + Manage subscribers + +

+ + + + Reopen request +

- - -