Make session variable names follow boolean patterns

This commit is contained in:
Alex Cabal 2024-05-24 20:51:30 -05:00
parent 98f45ea4e0
commit fcca4fc417
8 changed files with 12 additions and 12 deletions

View file

@ -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;

View file

@ -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 */

View file

@ -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);

View file

@ -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;
}

View file

@ -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{

View file

@ -9,7 +9,7 @@ session_start();
$created = false;
if(isset($_SESSION['subscription-created'])){
if(isset($_SESSION['is-subscription-created'])){
$created = true;
session_unset();
}

View file

@ -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();

View file

@ -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);
}