mirror of
https://github.com/standardebooks/web.git
synced 2025-07-08 07:40:39 -04:00
32 lines
994 B
PHP
32 lines
994 B
PHP
<?
|
||
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' => 'You’ve unsubscribed from the Standard Ebooks newsletter', 'highlight' => 'newsletter', 'description' => 'You’ve unsubscribed from the Standard Ebooks newsletter.']) ?>
|
||
<main>
|
||
<article>
|
||
<h1>You’ve been unsubscribed</h1>
|
||
<p>You’ll no longer receive Standard Ebooks email newsletters. Sorry to see you go!</p>
|
||
</article>
|
||
</main>
|
||
<?= Template::Footer() ?>
|