A lot rewrites and fixes for weak redirect methods
[shipsimu.git] / application / ship-simu / main / commands / web / class_WebRefillFormCommand.php
index 9039d56e8718b2f9241d564f62c0ef543c84f8a7..4717e1eeb8d895c72705a196e10d0615fb525341 100644 (file)
@@ -21,7 +21,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
-class WebMoneyRefillFormCommand extends BaseCommand implements Commandable {
+class WebRefillFormCommand extends BaseCommand implements Commandable {
        /**
         * Protected constructor
         *
@@ -42,9 +42,9 @@ class WebMoneyRefillFormCommand extends BaseCommand implements Commandable {
         * @param       $resolverInstance       An instance of a command resolver
         * @return      $commandInstance        The created command instance
         */
-       public final static function createWebMoneyRefillFormCommand (CommandResolver $resolverInstance) {
+       public final static function createWebRefillFormCommand (CommandResolver $resolverInstance) {
                // Get a new instance
-               $commandInstance = new WebMoneyRefillFormCommand();
+               $commandInstance = new WebRefillFormCommand();
 
                // Set the resolver instance
                $commandInstance->setResolverInstance($resolverInstance);
@@ -74,19 +74,28 @@ class WebMoneyRefillFormCommand extends BaseCommand implements Commandable {
         */
        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'));
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_auth_filter', array($controllerInstance)));
 
                // Add user status filter here
-               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_class'));
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter', array($controllerInstance)));
 
                // Is the refill page active?
-               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('refill_page_class'));
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('refill_page_filter', array($controllerInstance)));
+
+               // Verify password
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('account_password_filter', array($controllerInstance)));
 
                // Verify CAPTCHA code
-               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_refill_verifier_class'));
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_refill_verifier_filter', array($controllerInstance)));
 
                // Verify refill request
-               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('refill_request_validator_class'));
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('refill_request_validator_filter', array($controllerInstance)));
+
+               // Prepare a filter based on the requested type we shall refill
+               $filterName = sprintf("refill_request_%s_book_filter", $requestInstance->getRequestElement('type'));
+
+               // Now, try to load that filter
+               $controllerInstance->addPostFilter(ObjectFactory::createObjectByConfiguredName($filterName));
        }
 }