web/www/newsletter/subscriptions/delete.php
2024-11-20 14:52:05 -06:00

32 lines
994 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?
try{
// We may use GET if we're called from an unsubscribe link in an email
HttpInput::ValidateRequestMethod([Enums\HttpMethod::Get, Enums\HttpMethod::Delete]);
$requestType = HttpInput::GetRequestType();
$subscription = NewsletterSubscription::Get(HttpInput::Str(GET, 'uuid'));
$subscription->Delete();
if($requestType == Enums\HttpRequestType::Rest){
exit();
}
}
catch(Exceptions\NewsletterSubscriptionNotFoundException){
if($requestType == Enums\HttpRequestType::Web){
Template::Emit404();
}
else{
http_response_code(Enums\HttpCode::NotFound->value);
exit();
}
}
?><?= Template::Header(['title' => 'Youve unsubscribed from the Standard Ebooks newsletter', 'highlight' => 'newsletter', 'description' => 'Youve unsubscribed from the Standard Ebooks newsletter.']) ?>
<main>
<article>
<h1>Youve been unsubscribed</h1>
<p>Youll no longer receive Standard Ebooks email newsletters. Sorry to see you go!</p>
</article>
</main>
<?= Template::Footer() ?>