From fcca4fc417434d44b9fa9e57707dab91d41d12f1 Mon Sep 17 00:00:00 2001 From: Alex Cabal Date: Fri, 24 May 2024 20:51:30 -0500 Subject: [PATCH] Make session variable names follow boolean patterns --- www/artworks/get.php | 2 +- www/artworks/new.php | 2 +- www/artworks/post.php | 6 +++--- www/newsletter/subscriptions/get.php | 4 ++-- www/newsletter/subscriptions/post.php | 4 ++-- www/newsletter/subscriptions/success.php | 2 +- www/polls/votes/get.php | 2 +- www/polls/votes/post.php | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/www/artworks/get.php b/www/artworks/get.php index 806eec46..0e8eafbf 100644 --- a/www/artworks/get.php +++ b/www/artworks/get.php @@ -3,7 +3,7 @@ use function Safe\session_unset; session_start(); -$saved = HttpInput::Bool(SESSION, 'artwork-saved') ?? false; +$saved = HttpInput::Bool(SESSION, 'is-artwork-saved') ?? false; /** @var ?\Exception $exception */ $exception = $_SESSION['exception'] ?? null; diff --git a/www/artworks/new.php b/www/artworks/new.php index 9ddc3b81..fe73e34e 100644 --- a/www/artworks/new.php +++ b/www/artworks/new.php @@ -3,7 +3,7 @@ use function Safe\session_unset; session_start(); -$created = HttpInput::Bool(SESSION, 'artwork-created') ?? false; +$created = HttpInput::Bool(SESSION, 'is-artwork-created') ?? false; /** @var ?\Exception $exception */ $exception = $_SESSION['exception'] ?? null; /** @var ?Artwork $artwork */ diff --git a/www/artworks/post.php b/www/artworks/post.php index af2046f1..6b32c90e 100644 --- a/www/artworks/post.php +++ b/www/artworks/post.php @@ -38,7 +38,7 @@ try{ $artwork->Create(HttpInput::File('artwork-image')); $_SESSION['artwork'] = $artwork; - $_SESSION['artwork-created'] = true; + $_SESSION['is-artwork-created'] = true; http_response_code(303); header('Location: /artworks/new'); @@ -73,7 +73,7 @@ try{ $artwork->Save(HttpInput::File('artwork-image')); $_SESSION['artwork'] = $artwork; - $_SESSION['artwork-saved'] = true; + $_SESSION['is-artwork-saved'] = true; http_response_code(303); header('Location: ' . $artwork->Url); @@ -111,7 +111,7 @@ try{ $artwork->Save(); $_SESSION['artwork'] = $artwork; - $_SESSION['artwork-saved'] = true; + $_SESSION['is-artwork-saved'] = true; http_response_code(303); header('Location: ' . $artwork->Url); diff --git a/www/newsletter/subscriptions/get.php b/www/newsletter/subscriptions/get.php index 7290f523..6b842791 100644 --- a/www/newsletter/subscriptions/get.php +++ b/www/newsletter/subscriptions/get.php @@ -9,13 +9,13 @@ $updated = false; $confirmed = false; try{ - if(isset($_SESSION['subscription-created']) && $_SESSION['subscription-created'] == 0){ + if(isset($_SESSION['is-subscription-created']) && $_SESSION['is-subscription-created'] == 0){ $created = true; } else{ $subscription = NewsletterSubscription::Get(HttpInput::Str(GET, 'uuid')); - if(isset($_SESSION['subscription-created']) && $_SESSION['subscription-created'] == $subscription->UserId){ + if(isset($_SESSION['is-subscription-created']) && $_SESSION['is-subscription-created'] == $subscription->UserId){ $created = true; } diff --git a/www/newsletter/subscriptions/post.php b/www/newsletter/subscriptions/post.php index c290831c..30a1aff7 100644 --- a/www/newsletter/subscriptions/post.php +++ b/www/newsletter/subscriptions/post.php @@ -18,7 +18,7 @@ try{ $uuid = Uuid::uuid4(); $subscription->User = new User(); $subscription->User->Uuid = $uuid->toString(); - $_SESSION['subscription-created'] = 0; // 0 means 'bot' + $_SESSION['is-subscription-created'] = 0; // 0 means 'bot' header('Location: /newsletter/subscriptions/success'); } else{ @@ -45,7 +45,7 @@ try{ if($requestType == HttpRequestType::Web){ http_response_code(303); - $_SESSION['subscription-created'] = $subscription->UserId; + $_SESSION['is-subscription-created'] = $subscription->UserId; header('Location: /newsletter/subscriptions/success'); } else{ diff --git a/www/newsletter/subscriptions/success.php b/www/newsletter/subscriptions/success.php index 36311357..169e2153 100644 --- a/www/newsletter/subscriptions/success.php +++ b/www/newsletter/subscriptions/success.php @@ -9,7 +9,7 @@ session_start(); $created = false; -if(isset($_SESSION['subscription-created'])){ +if(isset($_SESSION['is-subscription-created'])){ $created = true; session_unset(); } diff --git a/www/polls/votes/get.php b/www/polls/votes/get.php index 19f3bf68..283201a3 100644 --- a/www/polls/votes/get.php +++ b/www/polls/votes/get.php @@ -9,7 +9,7 @@ $created = false; try{ $vote = PollVote::Get(HttpInput::Str(GET, 'pollurlname'), HttpInput::Int(GET, 'userid')); - if(isset($_SESSION['vote-created']) && $_SESSION['vote-created'] == $vote->UserId){ + if(isset($_SESSION['is-vote-created']) && $_SESSION['is-vote-created'] == $vote->UserId){ $created = true; http_response_code(201); session_unset(); diff --git a/www/polls/votes/post.php b/www/polls/votes/post.php index 502a6186..17664b5f 100644 --- a/www/polls/votes/post.php +++ b/www/polls/votes/post.php @@ -17,7 +17,7 @@ try{ session_unset(); if($requestType == HttpRequestType::Web){ - $_SESSION['vote-created'] = $vote->UserId; + $_SESSION['is-vote-created'] = $vote->UserId; http_response_code(303); header('Location: ' . $vote->Url); }