From: Roland Häder Date: Fri, 19 Sep 2008 20:04:17 +0000 (+0000) Subject: Word 'money' removed because you can not just even refill ingame-money X-Git-Url: https://git.mxchange.org/?p=shipsimu.git;a=commitdiff_plain;h=173a20fb725d49bf6de24a4afa43001f86375683 Word 'money' removed because you can not just even refill ingame-money --- diff --git a/.gitattributes b/.gitattributes index aaa38f0..5dbb67a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -105,7 +105,7 @@ application/ship-simu/main/actions/ship-simu/class_ShipSimuProfileAction.php -te application/ship-simu/main/actions/web/.htaccess -text application/ship-simu/main/actions/web/class_WebLogin -text application/ship-simu/main/actions/web/class_WebLoginCompanyAction.php -text -application/ship-simu/main/actions/web/class_WebLoginMoneyRefillAction.php -text +application/ship-simu/main/actions/web/class_WebLoginRefillAction.php -text application/ship-simu/main/bank/.htaccess -text application/ship-simu/main/bank/class_MoneyBank.php -text application/ship-simu/main/class_ -text @@ -115,7 +115,7 @@ application/ship-simu/main/class_Merchant.php -text application/ship-simu/main/class_WorksContract.php -text application/ship-simu/main/commands/.htaccess -text application/ship-simu/main/commands/web/.htaccess -text -application/ship-simu/main/commands/web/class_WebMoneyRefillFormCommand.php -text +application/ship-simu/main/commands/web/class_WebRefillFormCommand.php -text application/ship-simu/main/commands/web/class_WebShipsimuGuestLoginCommand.php -text application/ship-simu/main/commands/web/class_WebShipsimuProfileCommand.php -text application/ship-simu/main/commands/web/class_WebShipsimuRegisterCommand.php -text @@ -142,9 +142,9 @@ application/ship-simu/main/factories/.htaccess -text application/ship-simu/main/factories/class_ShipSimuWebNewsFactory.php -text application/ship-simu/main/filter/.htaccess -text application/ship-simu/main/filter/page/.htaccess -text -application/ship-simu/main/filter/page/class_MoneyRefillPageFilter.php -text +application/ship-simu/main/filter/page/class_RefillPageFilter.php -text application/ship-simu/main/filter/validator/.htaccess -text -application/ship-simu/main/filter/validator/class_MoneyRefillRequestValidatorFilter.php -text +application/ship-simu/main/filter/validator/class_RefillRequestValidatorFilter.php -text application/ship-simu/main/goverment/.htaccess -text application/ship-simu/main/goverment/class_SimplifiedGoverment.php -text application/ship-simu/main/login/.htaccess -text diff --git a/application/ship-simu/config.php b/application/ship-simu/config.php index 84c14b6..f2dc84a 100644 --- a/application/ship-simu/config.php +++ b/application/ship-simu/config.php @@ -146,7 +146,7 @@ $cfg->setConfigEntry('user_status_confirmed_class', "UserStatusConfimedUpdateFil $cfg->setConfigEntry('captcha_encrypt_validator_class', "CaptchaEncryptFilter"); // CFG: REFILL-REQUEST-VALIDATOR-CLASS -$cfg->setConfigEntry('refill_request_validator_class', "MoneyRefillRequestValidatorFilter"); +$cfg->setConfigEntry('refill_request_validator_class', "RefillRequestValidatorFilter"); // CFG: CAPTCHA-GUEST-VERIFIER-CLASS $cfg->setConfigEntry('captcha_guest_verifier_class', "GraphicalCodeCaptchaVerifierFilter"); @@ -164,7 +164,7 @@ $cfg->setConfigEntry('captcha_refill_verifier_class', "GraphicalCodeCaptchaVerif $cfg->setConfigEntry('confirm_code_verifier_class', "ConfirmCodeVerifierFilter"); // CFG: REFILL-PAGE-FILTER -$cfg->setConfigEntry('refill_page_class', "MoneyRefillPageFilter"); +$cfg->setConfigEntry('refill_page_class', "RefillPageFilter"); // CFG: NEWS-HOME-LIMIT $cfg->setConfigEntry('news_home_limit', 10); @@ -217,8 +217,8 @@ $cfg->setConfigEntry('shipsimu_user_login_captcha', "GraphicalCodeCaptcha"); // CFG: SHIPSIMU-GUEST-LOGIN-CAPTCHA $cfg->setConfigEntry('shipsimu_guest_login_captcha', "GraphicalCodeCaptcha"); -// CFG: MONEY-REFILL-FORM-CAPTCHA -$cfg->setConfigEntry('money_refill_form_captcha', "GraphicalCodeCaptcha"); +// CFG: REFILL-FORM-CAPTCHA +$cfg->setConfigEntry('refill_form_captcha', "GraphicalCodeCaptcha"); // CFG: CAPTCHA-STRING-LENGTH $cfg->setConfigEntry('captcha_string_length', 5); @@ -238,8 +238,8 @@ $cfg->setConfigEntry('shipsimu_user_login_captcha_secured', "Y"); // CFG: SHIPSIMU-GUEST-LOGIN-CAPTCHA-SECURED $cfg->setConfigEntry('shipsimu_guest_login_captcha_secured', "Y"); -// CFG: MONEY-REFILL-FORM-CAPTCHA-SECURED -$cfg->setConfigEntry('money_refill_form_captcha_secured', "Y"); +// CFG: REFILL-FORM-CAPTCHA-SECURED +$cfg->setConfigEntry('refill_form_captcha_secured', "Y"); // CFG: BLOCK-SHOWS-REGISTRATION $cfg->setConfigEntry('block_shows_registration', "Y"); @@ -295,5 +295,8 @@ $cfg->setConfigEntry('bank_class', "MoneyBank"); // CFG: REFILL-PAGE-ACTIVE $cfg->setConfigEntry('refill_page_active', "Y"); +// CFG: REFILL-PAGE-MIN-CURRENCY-AMOUNT +$cfg->setConfigEntry('refill_page_min_currency_amount', 1000); + // [EOF] ?> diff --git a/application/ship-simu/main/actions/web/class_WebLoginMoneyRefillAction.php b/application/ship-simu/main/actions/web/class_WebLoginMoneyRefillAction.php deleted file mode 100644 index 543d3fe..0000000 --- a/application/ship-simu/main/actions/web/class_WebLoginMoneyRefillAction.php +++ /dev/null @@ -1,81 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class WebLoginMoneyRefillAction extends BaseAction implements Commandable, Registerable { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this action - * - * @param $resolverInstance An instance of an action resolver - * @return $actionInstance An instance of this action class - */ - public final static function createWebLoginMoneyRefillAction (ActionResolver $resolverInstance) { - // Get a new instance - $actionInstance = new WebLoginMoneyRefillAction(); - - // Set the resolver instance - $actionInstance->setResolverInstance($resolverInstance); - - // Return the instance - return $actionInstance; - } - - /** - * Executes the command with given request and response objects - * - * @param $requestInstance An instance of a class with an Requestable interface - * @param $responseInstance An instance of a class with an Responseable interface - * @return void - * @todo Maybe add fetching company list of current user here? - */ - public function execute (Requestable $requestInstance, Responseable $responseInstance) { - // Unfinished method - } - - /** - * Adds extra filters to the given controller instance - * - * @param $controllerInstance A controller instance - * @param $requestInstance An instance of a class with an Requestable interface - * @return void - */ - public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { - // Add user status filter here - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_class')); - - // Is the refill page active? - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('refill_page_class')); - } -} - -// [EOF] -?> diff --git a/application/ship-simu/main/actions/web/class_WebLoginRefillAction.php b/application/ship-simu/main/actions/web/class_WebLoginRefillAction.php new file mode 100644 index 0000000..543d3fe --- /dev/null +++ b/application/ship-simu/main/actions/web/class_WebLoginRefillAction.php @@ -0,0 +1,81 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class WebLoginMoneyRefillAction extends BaseAction implements Commandable, Registerable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this action + * + * @param $resolverInstance An instance of an action resolver + * @return $actionInstance An instance of this action class + */ + public final static function createWebLoginMoneyRefillAction (ActionResolver $resolverInstance) { + // Get a new instance + $actionInstance = new WebLoginMoneyRefillAction(); + + // Set the resolver instance + $actionInstance->setResolverInstance($resolverInstance); + + // Return the instance + return $actionInstance; + } + + /** + * Executes the command with given request and response objects + * + * @param $requestInstance An instance of a class with an Requestable interface + * @param $responseInstance An instance of a class with an Responseable interface + * @return void + * @todo Maybe add fetching company list of current user here? + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Unfinished method + } + + /** + * Adds extra filters to the given controller instance + * + * @param $controllerInstance A controller instance + * @param $requestInstance An instance of a class with an Requestable interface + * @return void + */ + public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { + // Add user status filter here + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_class')); + + // Is the refill page active? + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('refill_page_class')); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/main/commands/web/class_WebMoneyRefillFormCommand.php b/application/ship-simu/main/commands/web/class_WebMoneyRefillFormCommand.php deleted file mode 100644 index 9039d56..0000000 --- a/application/ship-simu/main/commands/web/class_WebMoneyRefillFormCommand.php +++ /dev/null @@ -1,94 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class WebMoneyRefillFormCommand extends BaseCommand implements Commandable { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - - // Clean up a little - $this->removeNumberFormaters(); - $this->removeSystemArray(); - } - - /** - * Creates an instance of this command and sets the resolver instance - * - * @param $resolverInstance An instance of a command resolver - * @return $commandInstance The created command instance - */ - public final static function createWebMoneyRefillFormCommand (CommandResolver $resolverInstance) { - // Get a new instance - $commandInstance = new WebMoneyRefillFormCommand(); - - // Set the resolver instance - $commandInstance->setResolverInstance($resolverInstance); - - // Return the prepared instance - return $commandInstance; - } - - /** - * Executes the command with given request and response objects - * - * @param $requestInstance An instance of a class with an Requestable interface - * @param $responseInstance An instance of a class with an Responseable interface - * @return void - * @todo 0% done - */ - public function execute (Requestable $requestInstance, Responseable $responseInstance) { - $this->partialStub("Please implement this method."); - } - - /** - * Adds extra filters to the given controller instance - * - * @param $controllerInstance A controller instance - * @param $requestInstance An instance of a class with an Requestable interface - * @return void - */ - public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { - // Add user auth filter (we don't need an update of the user here because it will be redirected) - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_auth_class')); - - // Add user status filter here - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_class')); - - // Is the refill page active? - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('refill_page_class')); - - // Verify CAPTCHA code - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_refill_verifier_class')); - - // Verify refill request - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('refill_request_validator_class')); - } -} - -// [EOF] -?> diff --git a/application/ship-simu/main/commands/web/class_WebRefillFormCommand.php b/application/ship-simu/main/commands/web/class_WebRefillFormCommand.php new file mode 100644 index 0000000..9039d56 --- /dev/null +++ b/application/ship-simu/main/commands/web/class_WebRefillFormCommand.php @@ -0,0 +1,94 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class WebMoneyRefillFormCommand extends BaseCommand implements Commandable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + + // Clean up a little + $this->removeNumberFormaters(); + $this->removeSystemArray(); + } + + /** + * Creates an instance of this command and sets the resolver instance + * + * @param $resolverInstance An instance of a command resolver + * @return $commandInstance The created command instance + */ + public final static function createWebMoneyRefillFormCommand (CommandResolver $resolverInstance) { + // Get a new instance + $commandInstance = new WebMoneyRefillFormCommand(); + + // Set the resolver instance + $commandInstance->setResolverInstance($resolverInstance); + + // Return the prepared instance + return $commandInstance; + } + + /** + * Executes the command with given request and response objects + * + * @param $requestInstance An instance of a class with an Requestable interface + * @param $responseInstance An instance of a class with an Responseable interface + * @return void + * @todo 0% done + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + $this->partialStub("Please implement this method."); + } + + /** + * Adds extra filters to the given controller instance + * + * @param $controllerInstance A controller instance + * @param $requestInstance An instance of a class with an Requestable interface + * @return void + */ + public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { + // Add user auth filter (we don't need an update of the user here because it will be redirected) + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_auth_class')); + + // Add user status filter here + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_class')); + + // Is the refill page active? + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('refill_page_class')); + + // Verify CAPTCHA code + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_refill_verifier_class')); + + // Verify refill request + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('refill_request_validator_class')); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/main/filter/page/class_MoneyRefillPageFilter.php b/application/ship-simu/main/filter/page/class_MoneyRefillPageFilter.php deleted file mode 100644 index 98ed3d2..0000000 --- a/application/ship-simu/main/filter/page/class_MoneyRefillPageFilter.php +++ /dev/null @@ -1,75 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class MoneyRefillPageFilter extends BaseFrameworkSystem implements Filterable { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - - // Clean up a little - $this->removeNumberFormaters(); - $this->removeSystemArray(); - } - - /** - * Creates an instance of this filter class - * - * @return $filterInstance An instance of this filter class - */ - public final static function createMoneyRefillPageFilter () { - // Get a new instance - $filterInstance = new MoneyRefillPageFilter(); - - // Return the instance - return $filterInstance; - } - - /** - * Executes the filter with given request and response objects - * - * @param $requestInstance An instance of a class with an Requestable interface - * @param $responseInstance An instance of a class with an Responseable interface - * @return void - */ - public function execute (Requestable $requestInstance, Responseable $responseInstance) { - // Is the configuration variable set? - if ($this->getConfigInstance()->readConfig('refill_page_active') === "N") { - // Password is empty - $requestInstance->requestIsValid(false); - - // Add a message to the response - $responseInstance->addFatalMessage('refill_page_not_active'); - - // Abort here - return false; - } // END - if - } -} - -// [EOF] -?> diff --git a/application/ship-simu/main/filter/page/class_RefillPageFilter.php b/application/ship-simu/main/filter/page/class_RefillPageFilter.php new file mode 100644 index 0000000..98ed3d2 --- /dev/null +++ b/application/ship-simu/main/filter/page/class_RefillPageFilter.php @@ -0,0 +1,75 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class MoneyRefillPageFilter extends BaseFrameworkSystem implements Filterable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + + // Clean up a little + $this->removeNumberFormaters(); + $this->removeSystemArray(); + } + + /** + * Creates an instance of this filter class + * + * @return $filterInstance An instance of this filter class + */ + public final static function createMoneyRefillPageFilter () { + // Get a new instance + $filterInstance = new MoneyRefillPageFilter(); + + // Return the instance + return $filterInstance; + } + + /** + * Executes the filter with given request and response objects + * + * @param $requestInstance An instance of a class with an Requestable interface + * @param $responseInstance An instance of a class with an Responseable interface + * @return void + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Is the configuration variable set? + if ($this->getConfigInstance()->readConfig('refill_page_active') === "N") { + // Password is empty + $requestInstance->requestIsValid(false); + + // Add a message to the response + $responseInstance->addFatalMessage('refill_page_not_active'); + + // Abort here + return false; + } // END - if + } +} + +// [EOF] +?> diff --git a/application/ship-simu/main/filter/validator/class_MoneyRefillRequestValidatorFilter.php b/application/ship-simu/main/filter/validator/class_MoneyRefillRequestValidatorFilter.php deleted file mode 100644 index 1bcd932..0000000 --- a/application/ship-simu/main/filter/validator/class_MoneyRefillRequestValidatorFilter.php +++ /dev/null @@ -1,77 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class MoneyRefillRequestValidatorFilter extends BaseFrameworkSystem implements Filterable { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - - // Clean up a little - $this->removeNumberFormaters(); - $this->removeSystemArray(); - } - - /** - * Creates an instance of this filter class - * - * @return $filterInstance An instance of this filter class - */ - public final static function createMoneyRefillRequestValidatorFilter () { - // Get a new instance - $filterInstance = new MoneyRefillRequestValidatorFilter(); - - // Return the instance - return $filterInstance; - } - - /** - * Executes the filter with given request and response objects - * - * @param $requestInstance An instance of a class with an Requestable interface - * @param $responseInstance An instance of a class with an Responseable interface - * @return void - * @todo 0% done - */ - public function execute (Requestable $requestInstance, Responseable $responseInstance) { - // Are all required request fields set? - if ((!$requestInstance->isRequestElementSet('type')) || (!$requestInstance->isRequestElementSet('amount'))) { - // Something important is missing - $requestInstance->requestIsValid(false); - - // Add a message to the response - $responseInstance->addFatalMessage('refill_page_required_fields_missing'); - - // Abort here - return false; - } // END - if - die("OK!"); - } -} - -// [EOF] -?> diff --git a/application/ship-simu/main/filter/validator/class_RefillRequestValidatorFilter.php b/application/ship-simu/main/filter/validator/class_RefillRequestValidatorFilter.php new file mode 100644 index 0000000..1bcd932 --- /dev/null +++ b/application/ship-simu/main/filter/validator/class_RefillRequestValidatorFilter.php @@ -0,0 +1,77 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class MoneyRefillRequestValidatorFilter extends BaseFrameworkSystem implements Filterable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + + // Clean up a little + $this->removeNumberFormaters(); + $this->removeSystemArray(); + } + + /** + * Creates an instance of this filter class + * + * @return $filterInstance An instance of this filter class + */ + public final static function createMoneyRefillRequestValidatorFilter () { + // Get a new instance + $filterInstance = new MoneyRefillRequestValidatorFilter(); + + // Return the instance + return $filterInstance; + } + + /** + * Executes the filter with given request and response objects + * + * @param $requestInstance An instance of a class with an Requestable interface + * @param $responseInstance An instance of a class with an Responseable interface + * @return void + * @todo 0% done + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Are all required request fields set? + if ((!$requestInstance->isRequestElementSet('type')) || (!$requestInstance->isRequestElementSet('amount'))) { + // Something important is missing + $requestInstance->requestIsValid(false); + + // Add a message to the response + $responseInstance->addFatalMessage('refill_page_required_fields_missing'); + + // Abort here + return false; + } // END - if + die("OK!"); + } +} + +// [EOF] +?>