Tweak some variable names for consistency

This commit is contained in:
Alex Cabal 2024-05-25 22:17:09 -05:00
parent fa323842f6
commit b2e6499865
3 changed files with 9 additions and 9 deletions

View file

@ -3,7 +3,7 @@ use function Safe\session_unset;
session_start(); session_start();
$saved = HttpInput::Bool(SESSION, 'is-artwork-saved') ?? false; $isSaved = HttpInput::Bool(SESSION, 'is-saved') ?? false;
/** @var ?\Exception $exception */ /** @var ?\Exception $exception */
$exception = $_SESSION['exception'] ?? null; $exception = $_SESSION['exception'] ?? null;
@ -22,7 +22,7 @@ try{
} }
// We got here because an artwork was successfully submitted // We got here because an artwork was successfully submitted
if($saved){ if($isSaved){
session_unset(); session_unset();
} }
@ -55,7 +55,7 @@ catch(Exceptions\InvalidPermissionsException){
<?= Template::Error(['exception' => $exception]) ?> <?= Template::Error(['exception' => $exception]) ?>
<? if($saved){ ?> <? if($isSaved){ ?>
<p class="message success">Artwork saved!</p> <p class="message success">Artwork saved!</p>
<? } ?> <? } ?>

View file

@ -3,7 +3,7 @@ use function Safe\session_unset;
session_start(); session_start();
$created = HttpInput::Bool(SESSION, 'is-artwork-created') ?? false; $isCreated = HttpInput::Bool(SESSION, 'is-created') ?? false;
/** @var ?\Exception $exception */ /** @var ?\Exception $exception */
$exception = $_SESSION['exception'] ?? null; $exception = $_SESSION['exception'] ?? null;
/** @var ?Artwork $artwork */ /** @var ?Artwork $artwork */
@ -19,7 +19,7 @@ try{
} }
// We got here because an artwork was successfully submitted // We got here because an artwork was successfully submitted
if($created){ if($isCreated){
http_response_code(201); http_response_code(201);
$artwork = null; $artwork = null;
session_unset(); session_unset();
@ -62,7 +62,7 @@ catch(Exceptions\InvalidPermissionsException){
<?= Template::Error(['exception' => $exception]) ?> <?= Template::Error(['exception' => $exception]) ?>
<? if($created){ ?> <? if($isCreated){ ?>
<p class="message success">Artwork submitted!</p> <p class="message success">Artwork submitted!</p>
<? } ?> <? } ?>

View file

@ -36,7 +36,7 @@ try{
$artwork->Create(HttpInput::File('artwork-image')); $artwork->Create(HttpInput::File('artwork-image'));
$_SESSION['artwork'] = $artwork; $_SESSION['artwork'] = $artwork;
$_SESSION['is-artwork-created'] = true; $_SESSION['is-created'] = true;
http_response_code(303); http_response_code(303);
header('Location: /artworks/new'); header('Location: /artworks/new');
@ -71,7 +71,7 @@ try{
$artwork->Save(HttpInput::File('artwork-image')); $artwork->Save(HttpInput::File('artwork-image'));
$_SESSION['artwork'] = $artwork; $_SESSION['artwork'] = $artwork;
$_SESSION['is-artwork-saved'] = true; $_SESSION['is-saved'] = true;
http_response_code(303); http_response_code(303);
header('Location: ' . $artwork->Url); header('Location: ' . $artwork->Url);
@ -109,7 +109,7 @@ try{
$artwork->Save(); $artwork->Save();
$_SESSION['artwork'] = $artwork; $_SESSION['artwork'] = $artwork;
$_SESSION['is-artwork-saved'] = true; $_SESSION['is-saved'] = true;
http_response_code(303); http_response_code(303);
header('Location: ' . $artwork->Url); header('Location: ' . $artwork->Url);