From 2ac8c3fa83440f191620b80687ff1aace6e56861 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Tue, 20 Sep 2022 20:36:00 +0100 Subject: [PATCH 1/3] Moved submission code to separate file --- issue.php | 54 +++++++++------------------------------------ php/submitIssue.php | 9 +++++++- 2 files changed, 19 insertions(+), 44 deletions(-) diff --git a/issue.php b/issue.php index c14e07a..a3eddfa 100644 --- a/issue.php +++ b/issue.php @@ -8,56 +8,24 @@ $body, - 'title' => $subject - ); - - $issueData = json_encode($rawData); - - // Prepare CURL - $curlConnection = curl_init('https://git.fjla.uk/api/v1/repos/fred.boniface/athena.fb-infra.uk/issues'); - curl_setopt($curlConnection, CURLOPT_POSTFIELDS, $issueData); - curl_setopt($curlConnection, CURLOPT_RETURNTRANSFER, true); - curl_setopt($curlConnection, CURLOPT_HTTPHEADER, $httpHeaders); - - // Get response and exit CURL - $giteaResponse = curl_exec($curlConnection); - curl_close($curlConnection); - } - - function validate($data) { - $data = trim($data); - $data = stripslashes($data); - $data = htmlspecialchars($data); - return $data; + // Call POST function + sendInput($title,$body); } ?> diff --git a/php/submitIssue.php b/php/submitIssue.php index e1cae27..e501c05 100644 --- a/php/submitIssue.php +++ b/php/submitIssue.php @@ -1,6 +1,6 @@ Date: Tue, 20 Sep 2022 20:38:20 +0100 Subject: [PATCH 2/3] Removed unused variables --- issue.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/issue.php b/issue.php index a3eddfa..73afc0d 100644 --- a/issue.php +++ b/issue.php @@ -62,12 +62,6 @@ -

You have submitted:

-

REQUEST DATA: -
-
- JSON REPLY: -

From 695fada5b95379c48c37571072af4d3aab6ee2de Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Tue, 20 Sep 2022 20:40:29 +0100 Subject: [PATCH 3/3] Fix var names --- issue.php | 4 ++-- php/submitIssue.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/issue.php b/issue.php index 73afc0d..54c9601 100644 --- a/issue.php +++ b/issue.php @@ -13,7 +13,7 @@ require './php/submitIssue.php'; // Set initial values - $subject = $detail = ""; + $title = $detail = ""; $ua_str = $_SERVER["HTTP_USER_AGENT"]; // If the page has been POSTed to then run this: @@ -42,7 +42,7 @@
" method="post"> Subject:
- +

Details: diff --git a/php/submitIssue.php b/php/submitIssue.php index e501c05..c73ac58 100644 --- a/php/submitIssue.php +++ b/php/submitIssue.php @@ -15,7 +15,7 @@ function sendInput($title,$body) { // Prepare the request $rawData = array( 'body' => $body, - 'title' => $subject + 'title' => $title ); $preparedData = json_encode($rawData);