Remove payment field from update form, allow uploads during the review period
This commit is contained in:
parent
cd7a18f5a0
commit
5d47b7814f
1 changed files with 18 additions and 25 deletions
|
|
@ -32,12 +32,17 @@ if (LOGGED_IN && isset($_GET["game"])) {
|
|||
]);
|
||||
$game = $stmt->fetch(PDO::FETCH_OBJ);
|
||||
|
||||
define("GAME_IS_OPEN", $game->status_id === STATUS_ENROLLING);
|
||||
|
||||
$title = "Update: {$game->name}";
|
||||
$description = "Update your submission for the " . $game->name . " vote.";
|
||||
}
|
||||
|
||||
define(
|
||||
"CAN_SUBMIT",
|
||||
$game->status_id === STATUS_ENROLLING ||
|
||||
($game->status_id === STATUS_REVIEW &&
|
||||
in_array($submission->status, [0, 2]))
|
||||
);
|
||||
|
||||
if ($_SERVER["REQUEST_METHOD"] === "POST"):
|
||||
define("NEW_MANUSCRIPT", $_POST["keep-manuscript"] === "0");
|
||||
define("EXISTING_MANUSCRIPT", $_POST["keep-manuscript"] === "1");
|
||||
|
|
@ -62,16 +67,16 @@ if ($_SERVER["REQUEST_METHOD"] === "POST"):
|
|||
$errors["game"] = "The chosen game doesn't exist.";
|
||||
}
|
||||
|
||||
if (GAME_IS_OPEN && NEW_MANUSCRIPT && !RULES_WERE_FOLLOWED) {
|
||||
if (CAN_SUBMIT && NEW_MANUSCRIPT && !RULES_WERE_FOLLOWED) {
|
||||
$errors["agreements"] =
|
||||
"Please accept the Terms & Conditions and the Submission Guidelines.";
|
||||
}
|
||||
|
||||
if (GAME_IS_OPEN && NEW_MANUSCRIPT && FILE_EMPTY) {
|
||||
if (CAN_SUBMIT && NEW_MANUSCRIPT && FILE_EMPTY) {
|
||||
$errors["filesize"] = "A file upload is required.";
|
||||
} elseif (NEW_MANUSCRIPT && FILE_TOO_BIG) {
|
||||
$errors["filesize"] = "Your document is too large.";
|
||||
} elseif (GAME_IS_OPEN && NEW_MANUSCRIPT) {
|
||||
} elseif (CAN_SUBMIT && NEW_MANUSCRIPT) {
|
||||
$finfo = finfo_open(FILEINFO_MIME_TYPE);
|
||||
$mime_type = finfo_file($finfo, $_FILES["manuscript"]["tmp_name"]);
|
||||
finfo_close($finfo);
|
||||
|
|
@ -83,19 +88,15 @@ if ($_SERVER["REQUEST_METHOD"] === "POST"):
|
|||
$errors["mimetype"] = "Only PDF submissions are allowed.";
|
||||
}
|
||||
|
||||
if (GAME_IS_OPEN && (!isset($_POST["title"]) || !trim($_POST["title"]))) {
|
||||
if (CAN_SUBMIT && (!isset($_POST["title"]) || !trim($_POST["title"]))) {
|
||||
$errors["title"] = "Please enter a title.";
|
||||
}
|
||||
|
||||
if (GAME_IS_OPEN && !isset($_SESSION["account"])) {
|
||||
if (CAN_SUBMIT && !isset($_SESSION["account"])) {
|
||||
$errors["account"] =
|
||||
"We can't upload a document without knowing which account it belongs to.";
|
||||
}
|
||||
|
||||
if (GAME_IS_OPEN && !isset($_POST["tx-id"])) {
|
||||
$errors["payment"] = "You must submit a payment.";
|
||||
}
|
||||
|
||||
if (count($errors) > 0) {
|
||||
http_response_code(400);
|
||||
define(
|
||||
|
|
@ -109,13 +110,13 @@ if ($_SERVER["REQUEST_METHOD"] === "POST"):
|
|||
}
|
||||
} else {
|
||||
$params = [
|
||||
"submission_id" => $submission->id,
|
||||
"submission_id" => $submission->id,
|
||||
"title" => $_POST["title"],
|
||||
"doc_is_public" => isset($_POST["public-doc"]) ? 1 : 0,
|
||||
"name_is_public" => isset($_POST["public-name"]) ? 1 : 0,
|
||||
];
|
||||
|
||||
if (GAME_IS_OPEN && NEW_MANUSCRIPT) {
|
||||
if (CAN_SUBMIT && NEW_MANUSCRIPT) {
|
||||
$basename =
|
||||
md5(microtime() . $game->id . $_SESSION["account"]->id) .
|
||||
".pdf";
|
||||
|
|
@ -175,7 +176,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST"):
|
|||
}
|
||||
}
|
||||
|
||||
if (GAME_IS_OPEN && EXISTING_MANUSCRIPT) {
|
||||
if (CAN_SUBMIT && EXISTING_MANUSCRIPT) {
|
||||
$stmt = $db["data"]
|
||||
->prepare("UPDATE submissions SET (title, doc_is_public, name_is_public)
|
||||
= (:title, :doc_is_public, :name_is_public) WHERE id = :submission_id");
|
||||
|
|
@ -185,7 +186,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST"):
|
|||
http_response_code(303);
|
||||
header("Location: /games/" . $_GET["game"]);
|
||||
}
|
||||
if (!GAME_IS_OPEN) {
|
||||
if ($game->status_id !== STATUS_ENROLLING) {
|
||||
$stmt = $db["data"]
|
||||
->prepare("UPDATE submissions SET (doc_is_public, name_is_public)
|
||||
= (:doc_is_public, :name_is_public) WHERE id = :submission_id");
|
||||
|
|
@ -213,7 +214,7 @@ include "partials/head.php";
|
|||
<?php if (!LOGGED_IN) {
|
||||
include "partials/login-form.php";
|
||||
} else {
|
||||
if (GAME_IS_OPEN) { ?>
|
||||
if (CAN_SUBMIT) { ?>
|
||||
<p><b>If you would like to withdraw your submission, please email us at <a href="mailto:sixfold@sixfold.org?subject=Withdraw Submission: <?= $game->name ?>">sixfold@sixfold.org</a>.</b></p>
|
||||
<?php } else { ?>
|
||||
<p><b>This game's submissions are now locked, and you may only edit your work's public visibility.</b></p>
|
||||
|
|
@ -264,7 +265,7 @@ include "partials/head.php";
|
|||
) { ?><p><mark><?= $errors[
|
||||
"account"
|
||||
] ?></mark></p><?php } ?>
|
||||
<?php if (GAME_IS_OPEN) { ?>
|
||||
<?php if (CAN_SUBMIT) { ?>
|
||||
<fieldset class="flow">
|
||||
<legend>Manuscript details</legend>
|
||||
<label>
|
||||
|
|
@ -354,14 +355,6 @@ include "partials/head.php";
|
|||
<span>Display my document in the public results</span>
|
||||
</label>
|
||||
</fieldset>
|
||||
<?php if (GAME_IS_OPEN) { ?>
|
||||
<fieldset>
|
||||
<legend>Payment</legend>
|
||||
<div class="flow">
|
||||
<p><b>You have already paid for this submission.</b> (Transaction ID: <?= $submission->transaction_id ?>)</p>
|
||||
<input type="hidden" name="tx-id" value="<?= $submission->transaction_id ?>"/>
|
||||
</fieldset>
|
||||
<?php } ?>
|
||||
<button type="submit">Update submission</button>
|
||||
</form>
|
||||
<?php
|
||||
|
|
|
|||
Loading…
Reference in a new issue