mirror of
https://github.com/standardebooks/web.git
synced 2025-07-23 07:44:49 -04:00
Define some constants to make HTTP input code less wordy
This commit is contained in:
parent
ee7c8343dd
commit
110c091a7b
36 changed files with 87 additions and 86 deletions
|
@ -4,7 +4,7 @@ session_start();
|
|||
$subscription = new NewsletterSubscription();
|
||||
|
||||
try{
|
||||
$subscription = NewsletterSubscription::Get(HttpInput::Str(HttpVariableSource::Get, 'uuid'));
|
||||
$subscription = NewsletterSubscription::Get(HttpInput::Str(GET, 'uuid'));
|
||||
|
||||
if(!$subscription->IsConfirmed){
|
||||
$subscription->Confirm();
|
||||
|
|
|
@ -5,7 +5,7 @@ try{
|
|||
|
||||
$requestType = HttpInput::RequestType();
|
||||
|
||||
$subscription = NewsletterSubscription::Get(HttpInput::Str(HttpVariableSource::Get, 'uuid'));
|
||||
$subscription = NewsletterSubscription::Get(HttpInput::Str(GET, 'uuid'));
|
||||
$subscription->Delete();
|
||||
|
||||
if($requestType == HttpRequestType::Rest){
|
||||
|
|
|
@ -13,7 +13,7 @@ try{
|
|||
$created = true;
|
||||
}
|
||||
else{
|
||||
$subscription = NewsletterSubscription::Get(HttpInput::Str(HttpVariableSource::Get, 'uuid'));
|
||||
$subscription = NewsletterSubscription::Get(HttpInput::Str(GET, 'uuid'));
|
||||
|
||||
if(isset($_SESSION['subscription-created']) && $_SESSION['subscription-created'] == $subscription->UserId){
|
||||
$created = true;
|
||||
|
|
|
@ -11,7 +11,7 @@ try{
|
|||
|
||||
$subscription = new NewsletterSubscription();
|
||||
|
||||
if(HttpInput::Str(HttpVariableSource::Post, 'automationtest')){
|
||||
if(HttpInput::Str(POST, 'automationtest')){
|
||||
// A bot filled out this form field, which should always be empty. Pretend like we succeeded.
|
||||
if($requestType == HttpRequestType::Web){
|
||||
http_response_code(303);
|
||||
|
@ -32,12 +32,12 @@ try{
|
|||
|
||||
|
||||
$subscription->User = new User();
|
||||
$subscription->User->Email = HttpInput::Str(HttpVariableSource::Post, 'email');
|
||||
$subscription->IsSubscribedToNewsletter = HttpInput::Bool(HttpVariableSource::Post, 'issubscribedtonewsletter') ?? false;
|
||||
$subscription->IsSubscribedToSummary = HttpInput::Bool(HttpVariableSource::Post, 'issubscribedtosummary') ?? false;
|
||||
$subscription->User->Email = HttpInput::Str(POST, 'email');
|
||||
$subscription->IsSubscribedToNewsletter = HttpInput::Bool(POST, 'issubscribedtonewsletter') ?? false;
|
||||
$subscription->IsSubscribedToSummary = HttpInput::Bool(POST, 'issubscribedtosummary') ?? false;
|
||||
|
||||
$expectedCaptcha = HttpInput::Str(HttpVariableSource::Session, 'captcha') ?? '';
|
||||
$receivedCaptcha = HttpInput::Str(HttpVariableSource::Post, 'captcha');
|
||||
$expectedCaptcha = HttpInput::Str(SESSION, 'captcha') ?? '';
|
||||
$receivedCaptcha = HttpInput::Str(POST, 'captcha');
|
||||
|
||||
$subscription->Create($expectedCaptcha, $receivedCaptcha);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue