From 4d92fa6063058d861ffd7b82d0fb8dd58ffc1d27 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 17 Feb 2023 05:00:07 +0100 Subject: [PATCH] Continued: - renamed method requestIsValid() to propper setter name - also renamed class field to proper name --- .../classes/controller/class_BaseController.php | 4 ++-- .../console/class_ConsoleDefaultController.php | 2 +- .../html/class_HtmlDefaultController.php | 2 +- .../html/class_HtmlLoginFailedController.php | 2 +- .../html/class_HtmlLogoutController.php | 2 +- .../html/class_HtmlStatusController.php | 2 +- .../image/class_ImageDefaultController.php | 2 +- .../filter/auth/class_UserAuthFilter.php | 2 +- .../filter/change/class_EmailChangeFilter.php | 6 +++--- .../change/class_PasswordChangeFilter.php | 6 +++--- .../checkboxes/class_RulesAcceptedFilter.php | 2 +- .../crypto/class_CaptchaEncryptFilter.php | 4 ++-- .../payment/class_PaymentDiscoveryFilter.php | 4 ++-- .../validator/class_EmailValidatorFilter.php | 10 +++++----- .../validator/class_PasswordValidatorFilter.php | 6 +++--- .../validator/class_UserNameValidatorFilter.php | 6 +++--- .../class_AccountPasswordVerifierFilter.php | 4 ++-- .../verifier/class_BirthdayVerifierFilter.php | 8 ++++---- .../class_ConfirmCodeVerifierFilter.php | 6 +++--- ...class_GraphicalCodeCaptchaVerifierFilter.php | 12 ++++++------ .../class_PasswordGuestVerifierFilter.php | 4 ++-- .../verifier/class_PasswordVerifierFilter.php | 4 ++-- .../verifier/class_UserGuestVerifierFilter.php | 6 +++--- .../verifier/class_UserNameVerifierFilter.php | 6 +++--- .../verifier/class_UserStatusVerifierFilter.php | 2 +- .../class_UserUnconfirmedVerifierFilter.php | 4 ++-- .../main/classes/request/class_BaseRequest.php | 12 ++++++------ .../interfaces/request/class_Requestable.php | 6 +++--- .../class_TestsConsoleDefaultNewsController.php | 17 +++++++++++++++-- 29 files changed, 83 insertions(+), 70 deletions(-) diff --git a/framework/main/classes/controller/class_BaseController.php b/framework/main/classes/controller/class_BaseController.php index 675e8736..8101dc46 100644 --- a/framework/main/classes/controller/class_BaseController.php +++ b/framework/main/classes/controller/class_BaseController.php @@ -89,7 +89,7 @@ abstract class BaseController extends BaseFrameworkSystem implements Registerabl $this->executePreFilters($requestInstance, $responseInstance); // This request was valid! :-D - $requestInstance->requestIsValid(); + $requestInstance->setIsRequestValid(TRUE); // Execute the command $commandInstance->execute($requestInstance, $responseInstance); @@ -175,7 +175,7 @@ abstract class BaseController extends BaseFrameworkSystem implements Registerabl } // This request was valid! :-D - $requestInstance->requestIsValid(); + $requestInstance->setIsRequestValid(TRUE); // Execute the command $commandInstance->execute($requestInstance, $responseInstance); diff --git a/framework/main/classes/controller/console/class_ConsoleDefaultController.php b/framework/main/classes/controller/console/class_ConsoleDefaultController.php index 689e565c..58541a62 100644 --- a/framework/main/classes/controller/console/class_ConsoleDefaultController.php +++ b/framework/main/classes/controller/console/class_ConsoleDefaultController.php @@ -71,7 +71,7 @@ class ConsoleDefaultController extends BaseController implements Controller { $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance); // This request was valid! :-D - $requestInstance->requestIsValid(); + $requestInstance->setIsRequestValid(TRUE); // Execute the command $commandInstance->execute($requestInstance, $responseInstance); diff --git a/framework/main/classes/controller/html/class_HtmlDefaultController.php b/framework/main/classes/controller/html/class_HtmlDefaultController.php index d5a55d28..ec431168 100644 --- a/framework/main/classes/controller/html/class_HtmlDefaultController.php +++ b/framework/main/classes/controller/html/class_HtmlDefaultController.php @@ -72,7 +72,7 @@ class HtmlDefaultController extends BaseController implements Controller { $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance); // This request was valid! :-D - $requestInstance->requestIsValid(); + $requestInstance->setIsRequestValid(TRUE); // Execute the command $commandInstance->execute($requestInstance, $responseInstance); diff --git a/framework/main/classes/controller/html/class_HtmlLoginFailedController.php b/framework/main/classes/controller/html/class_HtmlLoginFailedController.php index 364a4d93..9faa8f43 100644 --- a/framework/main/classes/controller/html/class_HtmlLoginFailedController.php +++ b/framework/main/classes/controller/html/class_HtmlLoginFailedController.php @@ -71,7 +71,7 @@ class HtmlLoginFailedController extends BaseController implements Controller { $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance); // This request was valid! :-D - $requestInstance->requestIsValid(); + $requestInstance->setIsRequestValid(TRUE); // Execute the command $commandInstance->execute($requestInstance, $responseInstance); diff --git a/framework/main/classes/controller/html/class_HtmlLogoutController.php b/framework/main/classes/controller/html/class_HtmlLogoutController.php index 8467dee0..f3519b99 100644 --- a/framework/main/classes/controller/html/class_HtmlLogoutController.php +++ b/framework/main/classes/controller/html/class_HtmlLogoutController.php @@ -79,7 +79,7 @@ class HtmlLogoutController extends BaseController implements Controller { $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance); // This request was valid! :-D - $requestInstance->requestIsValid(); + $requestInstance->setIsRequestValid(TRUE); // Execute the command $commandInstance->execute($requestInstance, $responseInstance); diff --git a/framework/main/classes/controller/html/class_HtmlStatusController.php b/framework/main/classes/controller/html/class_HtmlStatusController.php index 166025bd..9a40b5bb 100644 --- a/framework/main/classes/controller/html/class_HtmlStatusController.php +++ b/framework/main/classes/controller/html/class_HtmlStatusController.php @@ -72,7 +72,7 @@ class HtmlStatusController extends BaseController implements Controller { $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance); // This request was valid! :-D - $requestInstance->requestIsValid(); + $requestInstance->setIsRequestValid(TRUE); // Execute the command $commandInstance->execute($requestInstance, $responseInstance); diff --git a/framework/main/classes/controller/image/class_ImageDefaultController.php b/framework/main/classes/controller/image/class_ImageDefaultController.php index d8472d2a..d2ce0f12 100644 --- a/framework/main/classes/controller/image/class_ImageDefaultController.php +++ b/framework/main/classes/controller/image/class_ImageDefaultController.php @@ -71,7 +71,7 @@ class ImageDefaultController extends BaseController implements Controller { $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance); // This request was valid! :-D - $requestInstance->requestIsValid(); + $requestInstance->setIsRequestValid(TRUE); // Execute the command $commandInstance->execute($requestInstance, $responseInstance); diff --git a/framework/main/classes/filter/auth/class_UserAuthFilter.php b/framework/main/classes/filter/auth/class_UserAuthFilter.php index 8f908ad3..c45ac715 100644 --- a/framework/main/classes/filter/auth/class_UserAuthFilter.php +++ b/framework/main/classes/filter/auth/class_UserAuthFilter.php @@ -103,7 +103,7 @@ class UserAuthFilter extends BaseFilter implements Filterable { $authInstance->destroyAuthData(); // Mark the request as invalid - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Add fatal message $responseInstance->addFatalMessage('auth_data_incomplete'); diff --git a/framework/main/classes/filter/change/class_EmailChangeFilter.php b/framework/main/classes/filter/change/class_EmailChangeFilter.php index 944a9f7c..f5307e36 100644 --- a/framework/main/classes/filter/change/class_EmailChangeFilter.php +++ b/framework/main/classes/filter/change/class_EmailChangeFilter.php @@ -73,7 +73,7 @@ class EmailChangeFilter extends BaseFilter implements Filterable { // Is only first email set? if ((!empty($email1)) && (empty($email2))) { // Request is invalid! - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Email 2 is empty $responseInstance->addFatalMessage('email2_empty'); @@ -85,7 +85,7 @@ class EmailChangeFilter extends BaseFilter implements Filterable { // Is only second email set? if ((empty($email1)) && (!empty($email2))) { // Request is invalid! - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Email 1 is empty $responseInstance->addFatalMessage('email1_empty'); @@ -97,7 +97,7 @@ class EmailChangeFilter extends BaseFilter implements Filterable { // Do both match? if ($email1 != $email2) { // Request is invalid! - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Emails are mismatching $responseInstance->addFatalMessage('emails_mismatch'); diff --git a/framework/main/classes/filter/change/class_PasswordChangeFilter.php b/framework/main/classes/filter/change/class_PasswordChangeFilter.php index c1153632..49c7076a 100644 --- a/framework/main/classes/filter/change/class_PasswordChangeFilter.php +++ b/framework/main/classes/filter/change/class_PasswordChangeFilter.php @@ -74,7 +74,7 @@ class PasswordChangeFilter extends BaseFilter implements Filterable { // Is only first email set? if ((!empty($pass1)) && (empty($pass2))) { // Request is invalid! - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Email 2 is empty $responseInstance->addFatalMessage('pass2_empty'); @@ -86,7 +86,7 @@ class PasswordChangeFilter extends BaseFilter implements Filterable { // Is only second pass set? if ((empty($pass1)) && (!empty($pass2))) { // Request is invalid! - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Email 1 is empty $responseInstance->addFatalMessage('pass1_empty'); @@ -104,7 +104,7 @@ class PasswordChangeFilter extends BaseFilter implements Filterable { // Do both match? if ($pass1 != $pass2) { // Request is invalid! - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Emails are mismatching $responseInstance->addFatalMessage('pass_mismatch'); diff --git a/framework/main/classes/filter/checkboxes/class_RulesAcceptedFilter.php b/framework/main/classes/filter/checkboxes/class_RulesAcceptedFilter.php index 9fc1d3db..787a231b 100644 --- a/framework/main/classes/filter/checkboxes/class_RulesAcceptedFilter.php +++ b/framework/main/classes/filter/checkboxes/class_RulesAcceptedFilter.php @@ -72,7 +72,7 @@ class RulesAcceptedFilter extends BaseFilter implements Filterable { // Was the "rules" value found in form? And is it set? if (is_null($rules)) { // Not found in form so stop processing here - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Add a message to the response $responseInstance->addFatalMessage('rules_unchecked'); diff --git a/framework/main/classes/filter/crypto/class_CaptchaEncryptFilter.php b/framework/main/classes/filter/crypto/class_CaptchaEncryptFilter.php index a85c7817..13ea605e 100644 --- a/framework/main/classes/filter/crypto/class_CaptchaEncryptFilter.php +++ b/framework/main/classes/filter/crypto/class_CaptchaEncryptFilter.php @@ -72,7 +72,7 @@ class CaptchaEncryptFilter extends BaseFilter implements Filterable { // Is it there? if (is_null($encryptRequest)) { // Not found, so request is invalid - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Throw exception throw new EncryptMissingException($this, CryptoHelper::EXCEPTION_ENCRYPT_MISSING); @@ -87,7 +87,7 @@ class CaptchaEncryptFilter extends BaseFilter implements Filterable { // Is it the expected length? if (strlen($decryptedString) != FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('captcha_string_length')) { // Not found, so request is invalid - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Throw exception throw new EncryptInvalidLengthException($this, CryptoHelper::EXCEPTION_ENCRYPT_INVALID); diff --git a/framework/main/classes/filter/payment/class_PaymentDiscoveryFilter.php b/framework/main/classes/filter/payment/class_PaymentDiscoveryFilter.php index 0ff7d81e..c5843a4b 100644 --- a/framework/main/classes/filter/payment/class_PaymentDiscoveryFilter.php +++ b/framework/main/classes/filter/payment/class_PaymentDiscoveryFilter.php @@ -126,7 +126,7 @@ class PaymentDiscoveryFilter extends BaseFilter implements Filterable { GenericRegistry::getRegistry()->addInstance('payments', $discoveryInstance); } catch (NoConfigEntryException $e) { // Something bad happend - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Add a message to the response $responseInstance->addFatalMessage('payment_config_entry_error'); @@ -136,7 +136,7 @@ class PaymentDiscoveryFilter extends BaseFilter implements Filterable { throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); } catch (NoClassException $e) { // Something bad happend - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Add a message to the response $responseInstance->addFatalMessage('payment_class_error'); diff --git a/framework/main/classes/filter/validator/class_EmailValidatorFilter.php b/framework/main/classes/filter/validator/class_EmailValidatorFilter.php index 62b5647f..1c963ebc 100644 --- a/framework/main/classes/filter/validator/class_EmailValidatorFilter.php +++ b/framework/main/classes/filter/validator/class_EmailValidatorFilter.php @@ -81,7 +81,7 @@ class EmailValidatorFilter extends BaseFilter implements Filterable { // Is the email still not set? if ((is_null($email1)) || (is_null($email2))) { // Not found in form so stop the filtering process - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Add a message to the response $responseInstance->addFatalMessage('email_unset'); @@ -90,7 +90,7 @@ class EmailValidatorFilter extends BaseFilter implements Filterable { throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); } elseif ((empty($email1)) || (empty($email2))) { // Email is empty - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Is the email empty? if (empty($email1)) { @@ -108,7 +108,7 @@ class EmailValidatorFilter extends BaseFilter implements Filterable { throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); } elseif ($this->ifEmailIsTaken($email1)) { // Email is already taken - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Add a message to the response $responseInstance->addFatalMessage('email_taken'); @@ -117,7 +117,7 @@ class EmailValidatorFilter extends BaseFilter implements Filterable { throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); } elseif ($email1 != $email2) { // Emails didn't match - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Add a message to the response $responseInstance->addFatalMessage('emails_mismatch'); @@ -127,7 +127,7 @@ class EmailValidatorFilter extends BaseFilter implements Filterable { } } elseif (empty($email)) { // Empty field! - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Add a message to the response $responseInstance->addFatalMessage('email_empty'); diff --git a/framework/main/classes/filter/validator/class_PasswordValidatorFilter.php b/framework/main/classes/filter/validator/class_PasswordValidatorFilter.php index 90d72cb8..c2857b34 100644 --- a/framework/main/classes/filter/validator/class_PasswordValidatorFilter.php +++ b/framework/main/classes/filter/validator/class_PasswordValidatorFilter.php @@ -72,7 +72,7 @@ class PasswordValidatorFilter extends BaseFilter implements Filterable { // Is the password still not set? if ((is_null($password1)) || (is_null($password2))) { // Not found in form so stop the filtering process - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Add a message to the response $responseInstance->addFatalMessage('password_unset'); @@ -81,7 +81,7 @@ class PasswordValidatorFilter extends BaseFilter implements Filterable { throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); } elseif ((empty($password1)) || (empty($password2))) { // Password is empty - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Is the password empty? if (empty($password1)) { @@ -99,7 +99,7 @@ class PasswordValidatorFilter extends BaseFilter implements Filterable { throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); } elseif ($password1 != $password2) { // Passwords didn't match - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Add a message to the response $responseInstance->addFatalMessage('pass_mismatch'); diff --git a/framework/main/classes/filter/validator/class_UserNameValidatorFilter.php b/framework/main/classes/filter/validator/class_UserNameValidatorFilter.php index 70ea0016..c91d6a73 100644 --- a/framework/main/classes/filter/validator/class_UserNameValidatorFilter.php +++ b/framework/main/classes/filter/validator/class_UserNameValidatorFilter.php @@ -75,7 +75,7 @@ class UserNameValidatorFilter extends BaseFilter implements Filterable { // Is the username set? if (is_null($userName)) { // Not found in form so stop the filtering process - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Add a message to the response $responseInstance->addFatalMessage('username_unset'); @@ -84,7 +84,7 @@ class UserNameValidatorFilter extends BaseFilter implements Filterable { throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); } elseif (empty($userName)) { // Empty field! - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Add a message to the response $responseInstance->addFatalMessage('username_empty'); @@ -93,7 +93,7 @@ class UserNameValidatorFilter extends BaseFilter implements Filterable { throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); } elseif ($this->ifUserNameIsTaken($userName)) { // Username is already taken - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Add a message to the response $responseInstance->addFatalMessage('username_taken'); diff --git a/framework/main/classes/filter/verifier/class_AccountPasswordVerifierFilter.php b/framework/main/classes/filter/verifier/class_AccountPasswordVerifierFilter.php index 2623c7bd..db402537 100644 --- a/framework/main/classes/filter/verifier/class_AccountPasswordVerifierFilter.php +++ b/framework/main/classes/filter/verifier/class_AccountPasswordVerifierFilter.php @@ -81,7 +81,7 @@ class AccountPasswordVerifierFilter extends BaseFilter implements Filterable { // Is the password still not set? if (is_null($password)) { // Not found in form so stop the filtering process - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Add a message to the response $responseInstance->addFatalMessage('password_unset'); @@ -93,7 +93,7 @@ class AccountPasswordVerifierFilter extends BaseFilter implements Filterable { if (empty($password)) { // Password is empty - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Add a message to the response $responseInstance->addFatalMessage('password_empty'); diff --git a/framework/main/classes/filter/verifier/class_BirthdayVerifierFilter.php b/framework/main/classes/filter/verifier/class_BirthdayVerifierFilter.php index 9e2a9f11..c5b5bc03 100644 --- a/framework/main/classes/filter/verifier/class_BirthdayVerifierFilter.php +++ b/framework/main/classes/filter/verifier/class_BirthdayVerifierFilter.php @@ -66,7 +66,7 @@ class BirthdayVerifierFilter extends BaseFilter implements Filterable { // Day of birth set? if (!$requestInstance->isRequestElementSet('birth_day')) { // Day of birth isn't set - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Add a message to the response $responseInstance->addFatalMessage('day_of_birth_unset'); @@ -75,7 +75,7 @@ class BirthdayVerifierFilter extends BaseFilter implements Filterable { // Month of birth set? if (!$requestInstance->isRequestElementSet('birth_month')) { // Month of birth isn't set - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Add a message to the response $responseInstance->addFatalMessage('month_of_birth_unset'); @@ -84,7 +84,7 @@ class BirthdayVerifierFilter extends BaseFilter implements Filterable { // Year of birth set? if (!$requestInstance->isRequestElementSet('birth_year')) { // Year of birth isn't set - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Add a message to the response $responseInstance->addFatalMessage('year_of_birth_unset'); @@ -109,7 +109,7 @@ class BirthdayVerifierFilter extends BaseFilter implements Filterable { // Is there a number or such? (we don't care about the value itself here) if (empty($birthCheck)) { // Validation has failed - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Add a message to the response $responseInstance->addFatalMessage('birthday_invalid'); diff --git a/framework/main/classes/filter/verifier/class_ConfirmCodeVerifierFilter.php b/framework/main/classes/filter/verifier/class_ConfirmCodeVerifierFilter.php index e5e8cde8..928e481b 100644 --- a/framework/main/classes/filter/verifier/class_ConfirmCodeVerifierFilter.php +++ b/framework/main/classes/filter/verifier/class_ConfirmCodeVerifierFilter.php @@ -72,7 +72,7 @@ class ConfirmCodeVerifierFilter extends BaseFilter implements Filterable { // Is this code set? if (is_null($confirmCode)) { // Is not in request - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Add a message to the response $responseInstance->addFatalMessage('confirm_code_unset'); @@ -81,7 +81,7 @@ class ConfirmCodeVerifierFilter extends BaseFilter implements Filterable { throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); } elseif (empty($confirmCode)) { // Email is empty - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Add a message to the response $responseInstance->addFatalMessage('confirm_code_empty'); @@ -99,7 +99,7 @@ class ConfirmCodeVerifierFilter extends BaseFilter implements Filterable { // Do we have the same code or different? if ($userCode != $confirmCode) { // Email is empty - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Redirect to error page $responseInstance->redirectToConfiguredUrl('confirm_code_invalid'); diff --git a/framework/main/classes/filter/verifier/class_GraphicalCodeCaptchaVerifierFilter.php b/framework/main/classes/filter/verifier/class_GraphicalCodeCaptchaVerifierFilter.php index 5e92facf..e02d001f 100644 --- a/framework/main/classes/filter/verifier/class_GraphicalCodeCaptchaVerifierFilter.php +++ b/framework/main/classes/filter/verifier/class_GraphicalCodeCaptchaVerifierFilter.php @@ -69,7 +69,7 @@ class GraphicalCodeCaptchaVerifierFilter extends BaseFilter implements Filterabl // Is the form set? if (($requestInstance->getRequestElement('command') !== 'do_form') || (!$requestInstance->isRequestElementSet('form'))) { // Required field not set - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Add fatal message $responseInstance->addFatalMessage('command_form_invalid'); @@ -93,7 +93,7 @@ class GraphicalCodeCaptchaVerifierFilter extends BaseFilter implements Filterabl // Is this set? if (is_null($captchaCode)) { // Not set so request is invalid - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Add fatal message $responseInstance->addFatalMessage('captcha_code_unset'); @@ -102,7 +102,7 @@ class GraphicalCodeCaptchaVerifierFilter extends BaseFilter implements Filterabl throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); } elseif (empty($captchaCode)) { // Empty value so request is invalid - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Add fatal message $responseInstance->addFatalMessage('captcha_code_empty'); @@ -117,7 +117,7 @@ class GraphicalCodeCaptchaVerifierFilter extends BaseFilter implements Filterabl // Is this set? if (is_null($captchaHash)) { // Not set so request is invalid - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Add fatal message $responseInstance->addFatalMessage('captcha_hash_unset'); @@ -126,7 +126,7 @@ class GraphicalCodeCaptchaVerifierFilter extends BaseFilter implements Filterabl throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); } elseif (empty($captchaHash)) { // Empty value so request is invalid - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Add fatal message $responseInstance->addFatalMessage('captcha_hash_empty'); @@ -144,7 +144,7 @@ class GraphicalCodeCaptchaVerifierFilter extends BaseFilter implements Filterabl // Is this CAPTCHA valid? if ($hashedCode != $captchaHash) { // Not the same so request is invalid - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Add fatal message $responseInstance->addFatalMessage('captcha_hash_mismatch'); diff --git a/framework/main/classes/filter/verifier/class_PasswordGuestVerifierFilter.php b/framework/main/classes/filter/verifier/class_PasswordGuestVerifierFilter.php index 998ee5ce..3978bf50 100644 --- a/framework/main/classes/filter/verifier/class_PasswordGuestVerifierFilter.php +++ b/framework/main/classes/filter/verifier/class_PasswordGuestVerifierFilter.php @@ -71,7 +71,7 @@ class PasswordGuestVerifierFilter extends BaseFilter implements Filterable { // Is the password still not set? if (is_null($password)) { // Not found in form so stop the filtering process - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Add a message to the response $responseInstance->addFatalMessage('password_unset'); @@ -80,7 +80,7 @@ class PasswordGuestVerifierFilter extends BaseFilter implements Filterable { throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); } elseif (empty($password)) { // Password is empty - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Add a message to the response $responseInstance->addFatalMessage('password_empty'); diff --git a/framework/main/classes/filter/verifier/class_PasswordVerifierFilter.php b/framework/main/classes/filter/verifier/class_PasswordVerifierFilter.php index f74b455e..2b4e5240 100644 --- a/framework/main/classes/filter/verifier/class_PasswordVerifierFilter.php +++ b/framework/main/classes/filter/verifier/class_PasswordVerifierFilter.php @@ -70,7 +70,7 @@ class PasswordVerifierFilter extends BaseFilter implements Filterable { // Is the password still not set? if (is_null($password)) { // Not found in form so stop the filtering process - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Add a message to the response $responseInstance->addFatalMessage('password_unset'); @@ -79,7 +79,7 @@ class PasswordVerifierFilter extends BaseFilter implements Filterable { throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); } elseif (empty($password)) { // Password is empty - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Add a message to the response $responseInstance->addFatalMessage('password_empty'); diff --git a/framework/main/classes/filter/verifier/class_UserGuestVerifierFilter.php b/framework/main/classes/filter/verifier/class_UserGuestVerifierFilter.php index fecfce37..103ca592 100644 --- a/framework/main/classes/filter/verifier/class_UserGuestVerifierFilter.php +++ b/framework/main/classes/filter/verifier/class_UserGuestVerifierFilter.php @@ -74,7 +74,7 @@ class UserGuestVerifierFilter extends BaseFilter implements Filterable { // Is the username set? if (is_null($userName)) { // Not found in form so stop the filtering process - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Add a message to the response $responseInstance->addFatalMessage('username_guest_unset'); @@ -83,7 +83,7 @@ class UserGuestVerifierFilter extends BaseFilter implements Filterable { throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); } elseif (empty($userName)) { // Empty field! - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Add a message to the response $responseInstance->addFatalMessage('username_guest_empty'); @@ -92,7 +92,7 @@ class UserGuestVerifierFilter extends BaseFilter implements Filterable { throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); } elseif ($this->ifUserGuestIsTaken($userName) === false) { // Username is already taken - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Add a message to the response $responseInstance->addFatalMessage('username_guest_not_found'); diff --git a/framework/main/classes/filter/verifier/class_UserNameVerifierFilter.php b/framework/main/classes/filter/verifier/class_UserNameVerifierFilter.php index a5856458..4e31a976 100644 --- a/framework/main/classes/filter/verifier/class_UserNameVerifierFilter.php +++ b/framework/main/classes/filter/verifier/class_UserNameVerifierFilter.php @@ -75,7 +75,7 @@ class UserNameVerifierFilter extends BaseFilter implements Filterable { // Is the username set? if (is_null($userName)) { // Not found in form so stop the filtering process - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Add a message to the response $responseInstance->addFatalMessage('username_unset'); @@ -84,7 +84,7 @@ class UserNameVerifierFilter extends BaseFilter implements Filterable { throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); } elseif (empty($userName)) { // Empty field! - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Add a message to the response $responseInstance->addFatalMessage('username_empty'); @@ -93,7 +93,7 @@ class UserNameVerifierFilter extends BaseFilter implements Filterable { throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); } elseif ($this->ifUserNameIsTaken($userName) === false) { // Username is already taken - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Add a message to the response $responseInstance->addFatalMessage('username_not_found'); diff --git a/framework/main/classes/filter/verifier/class_UserStatusVerifierFilter.php b/framework/main/classes/filter/verifier/class_UserStatusVerifierFilter.php index 0d67e497..4ac0b26d 100644 --- a/framework/main/classes/filter/verifier/class_UserStatusVerifierFilter.php +++ b/framework/main/classes/filter/verifier/class_UserStatusVerifierFilter.php @@ -70,7 +70,7 @@ class UserStatusVerifierFilter extends BaseFilter implements Filterable { // Is the user account confirmed? if ((!$userInstance->isConfirmed()) && (!$userInstance->isGuest()) && ($requestInstance->getRequestElement('action') != FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('action_status_problem'))) { // Request is invalid! - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Redirect to configured URL $responseInstance->redirectToConfiguredUrl('login_user_status'); diff --git a/framework/main/classes/filter/verifier/class_UserUnconfirmedVerifierFilter.php b/framework/main/classes/filter/verifier/class_UserUnconfirmedVerifierFilter.php index 19b68b2a..a39fd695 100644 --- a/framework/main/classes/filter/verifier/class_UserUnconfirmedVerifierFilter.php +++ b/framework/main/classes/filter/verifier/class_UserUnconfirmedVerifierFilter.php @@ -72,7 +72,7 @@ class UserUnconfirmedVerifierFilter extends BaseFilter implements Filterable { // Is the email address valid? if ($userInstance->ifEmailAddressExists() === false) { // Request is invalid! - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Redirect to configured URL $responseInstance->redirectToConfiguredUrl('user_unconfirmed_email_missing'); @@ -84,7 +84,7 @@ class UserUnconfirmedVerifierFilter extends BaseFilter implements Filterable { // Is the user account confirmed? if ($userInstance->getField(UserDatabaseFrontend::DB_COLUMN_USER_STATUS) != FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('user_status_unconfirmed')) { // Request is invalid! - $requestInstance->requestIsValid(false); + $requestInstance->setIsRequestValid(FALSE); // Redirect to configured URL $responseInstance->redirectToConfiguredUrl('user_not_unconfirmed'); diff --git a/framework/main/classes/request/class_BaseRequest.php b/framework/main/classes/request/class_BaseRequest.php index 6736fea1..d52d9914 100644 --- a/framework/main/classes/request/class_BaseRequest.php +++ b/framework/main/classes/request/class_BaseRequest.php @@ -38,7 +38,7 @@ abstract class BaseRequest extends BaseFrameworkSystem { * valid so make sure your intercepting filters sets this attribute to false * when they need to intercept the data flow. */ - private $requestIsValid = true; + private $isRequestValid = true; /** * Protected constructor @@ -119,22 +119,22 @@ abstract class BaseRequest extends BaseFrameworkSystem { } /** - * Sets whether the request was valid (default: true) + * Sets whether the request was valid * * @param $isValid Whether the request is valid * @return void */ - public final function requestIsValid (bool $isValid = true) { - $this->requestIsValid = $isValid; + public final function setIsRequestValid (bool $isValid) { + $this->isRequestValid = $isValid; } /** * Returns whether this request is valid * - * @return $requestIsValid Whether this request is valid + * @return $isRequestValid Whether this request is valid */ public final function isRequestValid () { - return $this->requestIsValid; + return $this->isRequestValid; } } diff --git a/framework/main/interfaces/request/class_Requestable.php b/framework/main/interfaces/request/class_Requestable.php index 9d014664..d83bc5c3 100644 --- a/framework/main/interfaces/request/class_Requestable.php +++ b/framework/main/interfaces/request/class_Requestable.php @@ -70,17 +70,17 @@ interface Requestable extends FrameworkInterface { function getParameterNames (); /** - * Sets whether the request was valid (default: true) + * Sets whether the request was valid * * @param $isValid Whether the request is valid * @return void */ - function requestIsValid (bool $isValid = true); + function setIsRequestValid (bool $isValid); /** * Returns whether this request is valid * - * @return $requestIsValid Whether this request is valid + * @return $isRequestValid Whether this request is valid */ function isRequestValid (); diff --git a/framework/main/tests/controller/console/class_TestsConsoleDefaultNewsController.php b/framework/main/tests/controller/console/class_TestsConsoleDefaultNewsController.php index 8ed89f95..a4f48500 100644 --- a/framework/main/tests/controller/console/class_TestsConsoleDefaultNewsController.php +++ b/framework/main/tests/controller/console/class_TestsConsoleDefaultNewsController.php @@ -41,12 +41,17 @@ class TestsConsoleDefaultNewsController extends BaseController implements Contro */ private function __construct () { // Call parent constructor + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TEST-CONSOLE-DEFAULT-NEWS-CONTROLLER: CONSTRUCTED!'); parent::__construct(__CLASS__); // Init additional filter chains - foreach (array('bootstrap', 'tests', 'shutdown') as $filterChain) { + foreach (['bootstrap', 'tests', 'shutdown'] as $filterChain) { + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('TEST-CONSOLE-DEFAULT-NEWS-CONTROLLER: Initializing filterChain=%s ...', $filterChain)); $this->initFilterChain($filterChain); } + + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TEST-CONSOLE-DEFAULT-NEWS-CONTROLLER: EXIT!'); } /** @@ -57,6 +62,7 @@ class TestsConsoleDefaultNewsController extends BaseController implements Contro */ public static final function createTestsConsoleDefaultNewsController (CommandResolver $resolverInstance) { // Create the instance + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('TEST-CONSOLE-DEFAULT-NEWS-CONTROLLER: resolverInstance=%s - CALLED!', $resolverInstance->__toString())); $controllerInstance = new TestsConsoleDefaultNewsController(); // Set the command resolver @@ -67,6 +73,7 @@ class TestsConsoleDefaultNewsController extends BaseController implements Contro $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_process_filter_class')); // Return the prepared instance + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('TEST-CONSOLE-DEFAULT-NEWS-CONTROLLER: controllerInstance=%s - EXIT!', $controllerInstance->__toString())); return $controllerInstance; } @@ -79,6 +86,7 @@ class TestsConsoleDefaultNewsController extends BaseController implements Contro */ public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) { // Get the command instance from the resolver by sending a request instance to the resolver + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('TEST-CONSOLE-DEFAULT-NEWS-CONTROLLER: requestInstance=%s,responseInstance=%s - CALLED!', $requestInstance->__toString(), $responseInstance->__toString())); $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance); // Add more filters by the command @@ -88,7 +96,8 @@ class TestsConsoleDefaultNewsController extends BaseController implements Contro $this->executePreFilters($requestInstance, $responseInstance); // This request was valid! :-D - $requestInstance->requestIsValid(); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TEST-CONSOLE-DEFAULT-NEWS-CONTROLLER: Invoking requestInstance->setIsRequestValid(TRUE) ...'); + $requestInstance->setIsRequestValid(TRUE); // Execute the command $commandInstance->execute($requestInstance, $responseInstance); @@ -97,7 +106,11 @@ class TestsConsoleDefaultNewsController extends BaseController implements Contro $this->executePostFilters($requestInstance, $responseInstance); // Flush the response out + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TEST-CONSOLE-DEFAULT-NEWS-CONTROLLER: Invoking responseInstance->flushBuffer() ...'); $responseInstance->flushBuffer(); + + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TEST-CONSOLE-DEFAULT-NEWS-CONTROLLER: EXIT!'); } /** -- 2.39.5