Typos fixed and special command resolver are now possible
authorRoland Häder <roland@mxchange.org>
Sun, 16 Nov 2008 01:13:24 +0000 (01:13 +0000)
committerRoland Häder <roland@mxchange.org>
Sun, 16 Nov 2008 01:13:24 +0000 (01:13 +0000)
- Two typos fixed: In terms like "if the" and "in the" >the< has been removed
- If a special "page" depending web command resolver is found it will be used
- Otherwise the default command resolver WebCommandResolver will be used as fall-back
- Some minor fixes
- TODO extended with a good "naming convention idea"

80 files changed:
.gitattributes
application/admin/main/login/class_AdminUserLogin.php
application/ship-simu/config.php
application/ship-simu/exceptions/class_ItemNotInPriceListException.php
application/ship-simu/main/actions/web/class_WebShipSimuLoginGovermentStartupHelpAction.php [new file with mode: 0644]
application/ship-simu/main/companies/class_ShippingCompany.php
application/ship-simu/main/controller/.htaccess [new file with mode: 0644]
application/ship-simu/main/controller/web/.htaccess [new file with mode: 0644]
application/ship-simu/main/controller/web/class_WebGovermentFailedController.php [new file with mode: 0644]
application/ship-simu/main/filter/goverment/class_ShipSimuGovermentPaysStartupHelpFilter.php [new file with mode: 0644]
application/ship-simu/main/filter/goverment/class_ShipSimuGovermentPaysTrainingFilter.php
application/ship-simu/main/login/class_ShipSimuGuestLogin.php
application/ship-simu/main/login/class_ShipSimuUserLogin.php
application/ship-simu/main/registration/class_ShipSimuRegistration.php
application/ship-simu/main/resolver/.htaccess [new file with mode: 0644]
application/ship-simu/main/resolver/web/.htaccess [new file with mode: 0644]
application/ship-simu/main/resolver/web/class_WebGovermentFailedCommandResolver.php [new file with mode: 0644]
application/ship-simu/main/user/class_ShipSimuBaseUser.php
application/ship-simu/main/user/extended/class_ShipSimuGuest.php
application/ship-simu/main/user/extended/class_ShipSimuMember.php
docs/TODO
inc/classes/exceptions/main/class_InvalidInterfaceException.php
inc/classes/exceptions/result/class_ResultUpdateException.php
inc/classes/interfaces/crypto/class_Cryptable.php
inc/classes/interfaces/registration/class_UserRegister.php
inc/classes/interfaces/registry/class_Register.php
inc/classes/interfaces/request/class_Requestable.php
inc/classes/interfaces/resolver/actions/class_ActionResolver.php
inc/classes/interfaces/resolver/commands/class_CommandResolver.php
inc/classes/interfaces/user/class_ManageableAccount.php
inc/classes/main/actions/class_BaseAction.php
inc/classes/main/cache/class_MemoryCache.php
inc/classes/main/class_BaseFrameworkSystem.php
inc/classes/main/class_FrameworkArrayObject.php
inc/classes/main/commands/web/class_ [new file with mode: 0644]
inc/classes/main/commands/web/class_WebConfirmCommand.php
inc/classes/main/commands/web/class_WebHomeCommand.php
inc/classes/main/commands/web/class_WebLoginAreaCommand.php
inc/classes/main/commands/web/class_WebLoginCommand.php
inc/classes/main/commands/web/class_WebLoginFailedCommand.php
inc/classes/main/commands/web/class_WebLogoutDoneCommand.php
inc/classes/main/commands/web/class_WebRegisterCommand.php
inc/classes/main/controller/form/class_WebDoFormController.php
inc/classes/main/controller/web/class_ [new file with mode: 0644]
inc/classes/main/criteria/class_SearchCriteria.php
inc/classes/main/crypto/class_CryptoHelper.php
inc/classes/main/database/databases/class_LocalFileDatabase.php
inc/classes/main/filter/crypto/class_CaptchaEncryptFilter.php
inc/classes/main/filter/guest/class_UserNameIsGuestFilter.php
inc/classes/main/filter/validator/class_EmailValidatorFilter.php
inc/classes/main/filter/validator/class_UserNameValidatorFilter.php
inc/classes/main/filter/verifier/class_ConfirmCodeVerifierFilter.php
inc/classes/main/filter/verifier/class_UserGuestVerifierFilter.php
inc/classes/main/filter/verifier/class_UserNameVerifierFilter.php
inc/classes/main/filter/verifier/class_UserStatusVerifierFilter.php
inc/classes/main/filter/verifier/class_UserUnconfirmedVerifierFilter.php
inc/classes/main/helper/captcha/images/class_ImageHelper.php
inc/classes/main/helper/web/forms/class_WebFormHelper.php
inc/classes/main/io/class_FrameworkDirectoryPointer.php
inc/classes/main/io/class_FrameworkFileInputPointer.php
inc/classes/main/io/class_FrameworkFileOutputPointer.php
inc/classes/main/mailer/debug/class_DebugMailer.php
inc/classes/main/registration/class_BaseRegistration.php
inc/classes/main/registry/class_Registry.php
inc/classes/main/request/class_HttpRequest.php
inc/classes/main/resolver/action/class_BaseActionResolver.php
inc/classes/main/resolver/action/web/class_WebActionResolver.php
inc/classes/main/resolver/command/class_BaseCommandResolver.php
inc/classes/main/resolver/command/image/class_ImageCommandResolver.php
inc/classes/main/resolver/command/web/class_ [new file with mode: 0644]
inc/classes/main/resolver/command/web/class_WebCommandResolver.php
inc/classes/main/resolver/controller/class_BaseControllerResolver.php
inc/classes/main/resolver/controller/image/class_ImageControllerResolver.php
inc/classes/main/resolver/controller/web/class_WebControllerResolver.php
inc/classes/main/result/class_DatabaseResult.php
inc/classes/main/template/class_BaseTemplateEngine.php
inc/classes/main/user/class_BaseUser.php
inc/classes/main/user/guest/class_Guest.php
inc/classes/main/user/member/class_Member.php
inc/config/class_FrameworkConfiguration.php

index 01097e3585d52241e4ef574b92f30bf6dcb78abb..6ae7adf3abf873bcccc22f081283c2f042ef615d 100644 (file)
@@ -165,6 +165,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_WebShipSimuLogin -text
 application/ship-simu/main/actions/web/class_WebShipSimuLoginCompanyAction.php -text
+application/ship-simu/main/actions/web/class_WebShipSimuLoginGovermentStartupHelpAction.php -text
 application/ship-simu/main/actions/web/class_WebShipSimuLoginGovermentTrainingAction.php -text
 application/ship-simu/main/actions/web/class_WebShipSimuLoginLogoutAction.php -text
 application/ship-simu/main/actions/web/class_WebShipSimuLoginProfileAction.php -text
@@ -198,6 +199,9 @@ application/ship-simu/main/constructions/terminals/.htaccess -text
 application/ship-simu/main/constructions/terminals/class_Terminal.php -text
 application/ship-simu/main/constructions/yards/.htaccess -text
 application/ship-simu/main/constructions/yards/class_Shipyard.php -text
+application/ship-simu/main/controller/.htaccess -text
+application/ship-simu/main/controller/web/.htaccess -text
+application/ship-simu/main/controller/web/class_WebGovermentFailedController.php -text
 application/ship-simu/main/drives/.htaccess -text
 application/ship-simu/main/drives/class_BaseDrive.php -text
 application/ship-simu/main/drives/motor/.htaccess -text
@@ -206,6 +210,7 @@ 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/goverment/.htaccess -text
+application/ship-simu/main/filter/goverment/class_ShipSimuGovermentPaysStartupHelpFilter.php -text
 application/ship-simu/main/filter/goverment/class_ShipSimuGovermentPaysTrainingFilter.php -text
 application/ship-simu/main/filter/page/.htaccess -text
 application/ship-simu/main/filter/page/class_RefillPageFilter.php -text
@@ -228,6 +233,9 @@ application/ship-simu/main/personell/company/.htaccess -text
 application/ship-simu/main/personell/company/class_CompanyEmployee.php -text
 application/ship-simu/main/registration/.htaccess -text
 application/ship-simu/main/registration/class_ShipSimuRegistration.php -text
+application/ship-simu/main/resolver/.htaccess -text
+application/ship-simu/main/resolver/web/.htaccess -text
+application/ship-simu/main/resolver/web/class_WebGovermentFailedCommandResolver.php -text
 application/ship-simu/main/ships/.htaccess -text
 application/ship-simu/main/ships/class_BaseShip.php -text
 application/ship-simu/main/ships/passenger/.htaccess -text
@@ -627,6 +635,7 @@ inc/classes/main/commands/class_BaseCommand.php -text
 inc/classes/main/commands/image/.htaccess -text
 inc/classes/main/commands/image/class_ImageCodeCaptchaCommand.php -text
 inc/classes/main/commands/web/.htaccess -text
+inc/classes/main/commands/web/class_ -text
 inc/classes/main/commands/web/class_WebConfirmCommand.php -text
 inc/classes/main/commands/web/class_WebDoFormCommand.php -text
 inc/classes/main/commands/web/class_WebHomeCommand.php -text
@@ -656,6 +665,7 @@ inc/classes/main/controller/image/class_ImageDefaultController.php -text
 inc/classes/main/controller/login/.htaccess -text
 inc/classes/main/controller/login/class_WebLoginAreaController.php -text
 inc/classes/main/controller/web/.htaccess -text
+inc/classes/main/controller/web/class_ -text
 inc/classes/main/controller/web/class_WebConfirmController.php -text
 inc/classes/main/controller/web/class_WebDefaultController.php -text
 inc/classes/main/controller/web/class_WebDefaultNewsController.php -text
@@ -803,6 +813,7 @@ inc/classes/main/resolver/command/class_BaseCommandResolver.php -text
 inc/classes/main/resolver/command/image/.htaccess -text
 inc/classes/main/resolver/command/image/class_ImageCommandResolver.php -text
 inc/classes/main/resolver/command/web/.htaccess -text
+inc/classes/main/resolver/command/web/class_ -text
 inc/classes/main/resolver/command/web/class_WebCommandResolver.php -text
 inc/classes/main/resolver/controller/.htaccess -text
 inc/classes/main/resolver/controller/class_BaseControllerResolver.php -text
index 3cf2678d65df4a2e063069388ac72363649e1f13..a4187a5e843b0ae9a0796f4dcc481b1f882775a7 100644 (file)
@@ -106,7 +106,7 @@ class AdminUserLogin extends BaseFrameworkSystem implements LoginableUser {
        }
 
        /**
-        * Determines wether the login was fine. This is done by checking if the 'login' instance is in registry
+        * Determines wether the login was fine. This is done by checking if 'login' instance is in registry
         *
         * @return      $loginDone      Wether the login was fine or not
         */
@@ -119,14 +119,14 @@ class AdminUserLogin extends BaseFrameworkSystem implements LoginableUser {
        }
 
        /**
-        * Encrypt the given request key or throw an exception if the key was not
-        * found in the request
+        * Encrypt given request key or throw an exception if key was not found in
+        * request
         *
         * @param       $requestKey             Key in request class
         * @return      void
         */
        public function encryptPassword ($requestKey) {
-               // Check if the password is found in the request
+               // Check if password is found in request
                if ($this->getRequestInstance()->isRequestElementSet($requestKey)) {
                        // So encrypt the password and store it for later usage in
                        // the request:
@@ -140,7 +140,7 @@ class AdminUserLogin extends BaseFrameworkSystem implements LoginableUser {
                        // Get a crypto helper and hash the password
                        $this->hashedPassword = ObjectFactory::createObjectByConfiguredName('crypto_class')->hashString($plainPassword, $userInstance->getPasswordHash());
 
-                       // Store the hash back in the request
+                       // Store the hash back in request
                        $this->getRequestInstance()->setRequestElement('pass_hash', $this->hashedPassword);
                } // END - if
        }
index 24f8cd7676b6f27113af6d9f8f3da5cc5f812eee..72c01ec956cdfb38b3ab1d590f45d8a890e63c29 100644 (file)
@@ -121,6 +121,12 @@ $cfg->setConfigEntry('confirm_code_invalid_url', "index.php?app={?app_short_name
 // CFG: USER-NOT-FOUND-URL
 $cfg->setConfigEntry('user_not_found_url', "index.php?app={?app_short_name?}&page=status&status=user_not_found");
 
+// CFG: LOGIN-GOVERMENT-STARTUP-FAILED-URL
+$cfg->setConfigEntry('login_goverment_startup_failed_url', "index.php?app={?app_short_name?}&page=goverment_failed&failed=startup");
+
+// CFG: LOGIN-GOVERMENT-TRAINING-FAILED-URL
+$cfg->setConfigEntry('login_goverment_training_failed_url', "index.php?app={?app_short_name?}&page=goverment_failed&failed=training");
+
 // CFG: LOGIN-DEFAULT-ACTION
 $cfg->setConfigEntry('login_default_action', "welcome");
 
@@ -178,6 +184,9 @@ $cfg->setConfigEntry('payment_discovery_filter', "PaymentDiscoveryFilter");
 // CFG: GOVERMENT-PAYS-TRAINING-FILTER
 $cfg->setConfigEntry('goverment_pays_training_filter', "ShipSimuGovermentPaysTrainingFilter");
 
+// CFG: GOVERMENT-PAYS-STARTUP-HELP-FILTER
+$cfg->setConfigEntry('goverment_pays_startup_help_filter', "ShipSimuGovermentPaysStartupHelpFilter");
+
 // CFG: NEWS-HOME-LIMIT
 $cfg->setConfigEntry('news_home_limit', 10);
 
@@ -334,5 +343,8 @@ $cfg->setConfigEntry('web_form_helper', "WebFormHelper");
 // CFG: WEB-LINK-HELPER
 $cfg->setConfigEntry('web_link_helper', "WebLinkHelper");
 
+// CFG: WEB-CMD-GOVERMENT-FAILED-RESOLVER-CLASS
+$cfg->setConfigEntry('web_cmd_goverment_failed_resolver_class', "WebGovermentFailedCommandResolver");
+
 // [EOF]
 ?>
index 03268ee9dc86e1efb47c931c2cc38a8584d95042..8daaa2426bb4260c93d5c605626045fdcdc34d6e 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * An exception thrown when the requested item is not in the pricing list
+ * An exception thrown when the requested item is not in pricing list
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
diff --git a/application/ship-simu/main/actions/web/class_WebShipSimuLoginGovermentStartupHelpAction.php b/application/ship-simu/main/actions/web/class_WebShipSimuLoginGovermentStartupHelpAction.php
new file mode 100644 (file)
index 0000000..5ecc924
--- /dev/null
@@ -0,0 +1,82 @@
+<?php
+/**
+ * An action for goverment startup help form
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+class WebShipSimuLoginGovermentStartupHelpAction 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 createWebShipSimuLoginGovermentStartupHelpAction (ActionResolver $resolverInstance) {
+               // Get a new instance
+               $actionInstance = new WebShipSimuLoginGovermentStartupHelpAction();
+
+               // 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        0% done
+        */
+       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
+        * @todo        Add some filters here
+        */
+       public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
+               // Check for user status by default
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter'));
+
+               // Check if goverment can pay startup help
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('goverment_pays_startup_help_filter'));
+       }
+}
+
+// [EOF]
+?>
index 1d6877b7a92a847a62fe171130832ccfa1dad16e..24603fd86b1309381305e1b132eb44c6c1f5e6b2 100644 (file)
@@ -519,7 +519,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                // Get it's real class name
                $shipType = $shipInstance->__toString();
 
-               // Now check if the ship type is in any list and return the result
+               // Now check if ship type is in any list and return the result
                return ($this->isShipTypeConstructable($shipType));
        }
 
@@ -556,7 +556,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                                throw new ClassMismatchException(array($shipyard->__toString(), "Shipyard"), self::EXCEPTION_CLASSES_NOT_MATCHING);
                        }
 
-                       // Validate if the first found shipyard can construct the requested type
+                       // Validate if first found shipyard can construct the requested type
                        $result = $shipyard->isShipTypeConstructable($shipType);
 
                        // Does this shipyard construct the requested ship type?
diff --git a/application/ship-simu/main/controller/.htaccess b/application/ship-simu/main/controller/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/ship-simu/main/controller/web/.htaccess b/application/ship-simu/main/controller/web/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/ship-simu/main/controller/web/class_WebGovermentFailedController.php b/application/ship-simu/main/controller/web/class_WebGovermentFailedController.php
new file mode 100644 (file)
index 0000000..79fe215
--- /dev/null
@@ -0,0 +1,103 @@
+<?php
+/**
+ * Controller for failed goverment requests
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+class WebGovermentFailedController extends BaseController implements Controller {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this class
+        *
+        * @param       $resolverInstance               An instance of a command resolver class
+        * @return      $controllerInstance             A prepared instance of this class
+        * @todo        Add some filters to this controller
+        */
+       public final static function createWebGovermentFailedController (CommandResolver $resolverInstance) {
+               // Create the instance
+               $controllerInstance = new WebGovermentFailedController();
+
+               // Set the command resolver
+               $controllerInstance->setResolverInstance($resolverInstance);
+
+               // User auth filter
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_auth_filter'));
+
+               // User update filter
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_update_filter'));
+
+               // News fetcher filter
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_download_filter'));
+
+               // News proccess/display-preparation
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_process_filter'));
+
+               // Return the prepared instance
+               return $controllerInstance;
+       }
+
+       /**
+        * Handles the given request and response
+        *
+        * @param       $requestInstance        An instance of a request class
+        * @param       $responseInstance       An instance of a response class
+        * @return      void
+        */
+       public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) {
+               // Get the command instance from the resolver by sending a request instance to the resolver
+               $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance);
+
+               // Add more filters by the command
+               $commandInstance->addExtraFilters($this, $requestInstance);
+
+               // Try to run the pre filters, if auth exceptions come through redirect here
+               try {
+                       // Run the pre filters
+                       $this->executePreFilters($requestInstance, $responseInstance);
+               } catch (UserAuthorizationException $e) {
+                       // Redirect to main page
+                       $responseInstance->redirectToConfiguredUrl('login_failed_url');
+               }
+
+               // This request was valid! :-D
+               $requestInstance->requestIsValid();
+
+               // Execute the command
+               $commandInstance->execute($requestInstance, $responseInstance);
+
+               // Run the pre filters
+               $this->executePostFilters($requestInstance, $responseInstance);
+
+               // Flush the response out
+               $responseInstance->flushBuffer();
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/ship-simu/main/filter/goverment/class_ShipSimuGovermentPaysStartupHelpFilter.php b/application/ship-simu/main/filter/goverment/class_ShipSimuGovermentPaysStartupHelpFilter.php
new file mode 100644 (file)
index 0000000..3d02ad9
--- /dev/null
@@ -0,0 +1,79 @@
+<?php
+/**
+ * A filter for checking if goverment can pay startup helps
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+class ShipSimuGovermentPaysStartupHelpFilter 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 createShipSimuGovermentPaysStartupHelpFilter () {
+               // Get a new instance
+               $filterInstance = new ShipSimuGovermentPaysStartupHelpFilter();
+
+               // 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) {
+               // Get the user instance from registry
+               $userInstance = Registry::getRegistry()->getInstance('user');
+
+               // Now simply check for it
+               if (($userInstance instanceof ManageableMember) || ($userInstance->ifGovermentPaysStartupHelp() === false)) {
+                       // Request is invalid
+                       $requestInstance->requestIsValid(false);
+
+                       // Redirect to configured URL
+                       $responseInstance->redirectToConfiguredUrl('login_goverment_startup_failed_url');
+
+                       // Stop processing here
+                       exit();
+               } // END - if
+       }
+}
+
+// [EOF]
+?>
index febd4bd2c8594c458b69f7892ff88043191ced31..466059c7c9b22ca8972ad1180f4bcd6d51b6b457 100644 (file)
@@ -66,11 +66,11 @@ class ShipSimuGovermentPaysTrainingFilter extends BaseFrameworkSystem implements
                        // Request is invalid
                        $requestInstance->requestIsValid(false);
 
-                       // Add a message to the response
-                       $responseInstance->addFatalMessage('goverment_pays_no_training');
+                       // Redirect to configured URL
+                       $responseInstance->redirectToConfiguredUrl('login_goverment_training_failed_url');
 
-                       // Abort here
-                       return false;
+                       // Stop processing here
+                       exit();
                } // END - if
        }
 }
index 7336865d406b767c48adaab4dfd8f26ee2c26f9c..d4b0365c4d58e40b7dcb986c81bb76cde983d2a4 100644 (file)
@@ -118,7 +118,7 @@ class ShipSimuGuestLogin extends BaseFrameworkSystem implements LoginableUser {
        }
 
        /**
-        * Determines wether the login was fine. This is done by checking if the 'login' instance is in registry
+        * Determines wether the login was fine. This is done by checking if 'login' instance is in registry
         *
         * @return      $loginDone      Wether the login was fine or not
         */
@@ -131,14 +131,14 @@ class ShipSimuGuestLogin extends BaseFrameworkSystem implements LoginableUser {
        }
 
        /**
-        * Encrypt the given request key or throw an exception if the key was not
-        * found in the request
+        * Encrypt given request key or throw an exception if key was not found in
+        * request
         *
         * @param       $requestKey             Key in request class
         * @return      void
         */
        public function encryptPassword ($requestKey) {
-               // Check if the password is found in the request
+               // Check if password is found in request
                if ($this->getRequestInstance()->isRequestElementSet($requestKey)) {
                        // So encrypt the password and store it for later usage in
                        // the request:
@@ -152,7 +152,7 @@ class ShipSimuGuestLogin extends BaseFrameworkSystem implements LoginableUser {
                        // Get a crypto helper and hash the password
                        $this->hashedPassword = ObjectFactory::createObjectByConfiguredName('crypto_class')->hashString($plainPassword, $userInstance->getPasswordHash());
 
-                       // Store the hash back in the request
+                       // Store the hash back in request
                        $this->getRequestInstance()->setRequestElement('pass_hash', $this->hashedPassword);
                } // END - if
        }
index 541e18810234714cf464e1fcc9d7b34965b5a06b..178c4088a7b81c744c685834d2775599c9fb835c 100644 (file)
@@ -106,7 +106,7 @@ class ShipSimuUserLogin extends BaseFrameworkSystem implements LoginableUser {
        }
 
        /**
-        * Determines wether the login was fine. This is done by checking if the 'login' instance is in registry
+        * Determines wether the login was fine. This is done by checking if 'login' instance is in registry
         *
         * @return      $loginDone      Wether the login was fine or not
         */
@@ -119,14 +119,14 @@ class ShipSimuUserLogin extends BaseFrameworkSystem implements LoginableUser {
        }
 
        /**
-        * Encrypt the given request key or throw an exception if the key was not
-        * found in the request
+        * Encrypt given request key or throw an exception if key was not found in
+        * request
         *
         * @param       $requestKey             Key in request class
         * @return      void
         */
        public function encryptPassword ($requestKey) {
-               // Check if the password is found in the request
+               // Check if password is found in request
                if ($this->getRequestInstance()->isRequestElementSet($requestKey)) {
                        // So encrypt the password and store it for later usage in
                        // the request:
@@ -140,7 +140,7 @@ class ShipSimuUserLogin extends BaseFrameworkSystem implements LoginableUser {
                        // Get a crypto helper and hash the password
                        $this->hashedPassword = ObjectFactory::createObjectByConfiguredName('crypto_class')->hashString($plainPassword, $userInstance->getPasswordHash());
 
-                       // Store the hash back in the request
+                       // Store the hash back in request
                        $this->getRequestInstance()->setRequestElement('pass_hash', $this->hashedPassword);
                } // END - if
        }
index 1ad97313716eb84008af5695ac96c2f0939e7c10..5778665388ab19a56880d639541ed25f3eb703de 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * A user registration specially for Ship-Simu
+ * A user registration class specially for Ship-Simu
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
@@ -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 ShipSimuRegistration extends BaseRegistration {
+class ShipSimuRegistration extends BaseRegistration implements UserRegister {
        /**
         * Hashed password
         */
@@ -73,14 +73,14 @@ class ShipSimuRegistration extends BaseRegistration {
        }
 
        /**
-        * Encrypt the given request key or throw an exception if the key was not
-        * found in the request
+        * Encrypt given request key or throw an exception if key was not found in
+        * request
         *
         * @param       $requestKey             Key in request class
         * @return      void
         */
        public function encryptPassword ($requestKey) {
-               // Check if the password is found in the request
+               // Check if password is found in request
                if ($this->getRequestInstance()->isRequestElementSet($requestKey)) {
                        // So encrypt the password and store it for later usage in
                        // the request:
@@ -91,7 +91,7 @@ class ShipSimuRegistration extends BaseRegistration {
                        // 2. Get a crypto helper and hash the password
                        $this->hashedPassword = ObjectFactory::createObjectByConfiguredName('crypto_class')->hashString($plainPassword);
 
-                       // 3. Store the hash back in the request
+                       // 3. Store the hash back in request
                        $this->getRequestInstance()->setRequestElement('pass_hash', $this->hashedPassword);
                }
        }
@@ -101,6 +101,7 @@ class ShipSimuRegistration extends BaseRegistration {
         * before registration
         *
         * @return      void
+        * @todo        Maybe add more things to perform
         */
        public function doPreRegistration () {
                // First run all pre filters
@@ -112,6 +113,7 @@ class ShipSimuRegistration extends BaseRegistration {
         * database and paying some start credits or throw exceptions if this fails
         *
         * @return      void
+        * @todo        Maybe add more things to perform
         */
        public function registerNewUser () {
                // Get a user database wrapper
@@ -125,6 +127,7 @@ class ShipSimuRegistration extends BaseRegistration {
         * Perform things like notifying partner websites after registration is done
         *
         * @return      void
+        * @todo        Maybe add more things to perform
         */
        public function doPostRegistration () {
                // First run all post filters
diff --git a/application/ship-simu/main/resolver/.htaccess b/application/ship-simu/main/resolver/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/ship-simu/main/resolver/web/.htaccess b/application/ship-simu/main/resolver/web/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/ship-simu/main/resolver/web/class_WebGovermentFailedCommandResolver.php b/application/ship-simu/main/resolver/web/class_WebGovermentFailedCommandResolver.php
new file mode 100644 (file)
index 0000000..a7e5b38
--- /dev/null
@@ -0,0 +1,186 @@
+<?php
+/**
+ * A command resolver for local (non-hubbed) web commands including the failed goverment request
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+class WebGovermentFailedCommandResolver extends BaseCommandResolver implements CommandResolver {
+       /**
+        * Last successfull resolved command
+        */
+       private $lastCommandInstance = null;
+
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Set prefix to "Web"
+               $this->setCommandPrefix("Web");
+       }
+
+       /**
+        * Creates an instance of a Web command resolver with a given default command
+        *
+        * @param       $commandName                            The default command we shall execute
+        * @param       $appInstance                            An instance of a manageable application helper class
+        * @return      $resolverInstance                       The prepared command resolver instance
+        * @throws      EmptyVariableException          Thrown if default command is not set
+        * @throws      InvalidInterfaceException       Thrown if command does not implement interface Commandable
+        */
+       public final static function createWebGovermentFailedCommandResolver ($commandName, ManageableApplication $appInstance) {
+               // Create the new instance
+               $resolverInstance = new WebGovermentFailedCommandResolver();
+
+               // Get request instance
+               $requestInstance = $appInstance->getRequestInstance();
+
+               // Is the variable $commandName set and the command is valid?
+               if (empty($commandName)) {
+                       // Then thrown an exception here
+                       throw new EmptyVariableException(array($resolverInstance, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+               } elseif (!$resolverInstance->resolveCommandByRequest($requestInstance) instanceof Commandable) {
+                       // Invalid command found (missing interface?)
+                       throw new InvalidInterfaceException(array($userInstance, 'ManageableMember'), self::EXCEPTION_REQUIRED_INTERFACE_MISSING);
+               }
+
+               // Set the application instance
+               $resolverInstance->setApplicationInstance($appInstance);
+
+               // Return the prepared instance
+               return $resolverInstance;
+       }
+
+       /**
+        * Returns an command instance for a given request class or null if
+        * it was not found
+        *
+        * @param       $requestInstance        An instance of a request class
+        * @return      $commandInstance        An instance of the resolved command
+        * @throws      InvalidCommandException                         Thrown if $commandName is
+        *                                                                                              invalid
+        * @throws      InvalidCommandInstanceException         Thrown if $commandInstance
+        *                                                                                              is an invalid instance
+        */
+       public function resolveCommandByRequest (Requestable $requestInstance) {
+               // Init instance
+               $commandInstance = null;
+
+               // This goes fine so let's resolv the command
+               $commandName = $requestInstance->getRequestElement('page');
+
+               // Is there a "failed" request?
+               if ($requestInstance->isRequestElementSet('failed')) {
+                       // Then include with within the command name
+                       $commandName = sprintf("%s_%s", $commandName, $requestInstance->getRequestElement('failed'));
+               } // END - if
+
+               // Is the command empty? Then fall back to default command
+               if (empty($commandName)) $commandName = $this->getConfigInstance()->readConfig('default_web_command');
+
+               // Check if command is valid
+               if ($this->isCommandValid($commandName) === false) {
+                       // This command is invalid!
+                       throw new InvalidCommandException(array($this, $commandName), self::EXCEPTION_INVALID_COMMAND);
+               } // END - if
+
+               // Get the command
+               $commandInstance = $this->loadCommand($commandName);
+
+               // And validate it
+               if ((!is_object($commandInstance)) || (!$commandInstance instanceof Commandable)) {
+                       // This command has an invalid instance!
+                       throw new InvalidCommandInstanceException(array($this, $commandName), self::EXCEPTION_INVALID_COMMAND);
+               } // END - if
+
+               // Set last command
+               $this->lastCommandInstance = $commandInstance;
+
+               // Return the resolved command instance
+               return $commandInstance;
+       }
+
+       /**
+        * Resolves the command by its direct name and returns an instance of its class
+        *
+        * @param       $commandName            The direct command name we shall resolve
+        * @return      $commandInstance        An instance of the command class
+        * @throws      InvalidCommandException         Thrown if $commandName is invalid
+        */
+       public function resolveCommand ($commandName) {
+               // Initiate the instance variable
+               $commandInstance = null;
+
+               // Is the command empty? Then fall back to default command
+               if (empty($commandName)) $commandName = $this->getConfigInstance()->readConfig('default_web_command');
+
+               // Check if command is valid
+               if ($this->isCommandValid($commandName) === false) {
+                       // This command is invalid!
+                       throw new InvalidCommandException(array($this, $commandName), self::EXCEPTION_INVALID_COMMAND);
+               }
+
+               // Get the command
+               $commandInstance = $this->loadCommand($commandName);
+
+               // Return the instance
+               return $commandInstance;
+       }
+
+       /**
+        * "Loads" a given command and instances it if not yet cached
+        *
+        * @param       $commandName                            A command name we shall look for
+        * @return      $commandInstance                        A loaded command instance
+        * @throws      InvalidCommandException         Thrown if even the default
+        *                                                                              command class is missing (bad!)
+        */
+       private function loadCommand ($commandName) {
+               // Cache default command
+               $defaultCommand = $this->getConfigInstance()->readConfig('default_web_command');
+
+               // Init command instance
+               $commandInstance = null;
+
+               // Create command class name
+               $this->setClassName(sprintf("Web%sCommand",
+                       $this->convertToClassName($commandName)
+               ));
+
+               // Is this class loaded?
+               if (!class_exists($this->getClassName())) {
+                       // Class not found, so throw an exception
+                       throw new InvalidCommandException(array($this, $defaultCommand), self::EXCEPTION_INVALID_COMMAND);
+               } // END - if
+
+               // Initiate the command
+               $commandInstance = ObjectFactory::createObjectByName($this->getClassName(), array($this));
+
+               // Return the result
+               return $commandInstance;
+       }
+}
+
+// [EOF]
+?>
index 61feb281fb6c692228661361bf7414db6f56a4a6..63c9b8d290ea5b00f71ffdb9fb1783e7212e078c 100644 (file)
@@ -90,9 +90,9 @@ class ShipSimuBaseUser extends BaseUser implements Registerable, Updateable {
        }
 
        /**
-        * Determines if the goverment can still pay a "virtual training course" in general
+        * Determines if goverment can still pay a "virtual training course" in general
         *
-        * @return      $ifGovHelps             Wether if the goverment helps the user with a virtual training course
+        * @return      $ifGovHelps             Wether if goverment helps the user with a virtual training course
         */
        public function ifGovermentPaysTraining () {
                // By default they want to help.
@@ -121,9 +121,9 @@ class ShipSimuBaseUser extends BaseUser implements Registerable, Updateable {
        }
 
        /**
-        * Determines if the goverment can still pay a "startup help" to the user
+        * Determines if goverment can still pay a "startup help" to the user
         *
-        * @return      $ifGovHelps             Wether if the goverment helps the user with some startup money
+        * @return      $ifGovHelps             Wether if goverment helps the user with some startup money
         */
        public function ifGovermentPaysStartupHelp () {
                // By default they want to help.
index 1f7ec5505faac9c659d9fb65011258d89314a6fc..7009d3a5ddefc33296a2f52053d756e6d979ae22 100644 (file)
@@ -40,7 +40,7 @@ class ShipSimuGuest extends ShipSimuBaseUser implements ManageableGuest {
 
        /**
         * Creates an instance of this user class by a provided username. This
-        * factory method will check if the username is already taken and if not
+        * factory method will check if username is already taken and if not
         * so it will throw an exception.
         *
         * @param       $userName               Username we need a class instance for
@@ -54,7 +54,7 @@ class ShipSimuGuest extends ShipSimuBaseUser implements ManageableGuest {
                // Set the username
                $userInstance->setUserName($userName);
 
-               // Check if the username exists
+               // Check if username exists
                if ($userInstance->ifUsernameExists() === false) {
                        // Throw an exception here
                        throw new UsernameMissingException(array($userInstance, $userName), self::EXCEPTION_USERNAME_NOT_FOUND);
@@ -66,7 +66,7 @@ class ShipSimuGuest extends ShipSimuBaseUser implements ManageableGuest {
 
        /**
         * Creates an instance of this user class by a provided email address. This
-        * factory method will not check if the email address is there.
+        * factory method will not check if email address is there.
         *
         * @param       $email                  Email address of the user
         * @return      $userInstance   An instance of this user class
index 46fb2ed7bfa5d790ee37eab70b054e33eb926446..98e7a2a5976168cd04757126bd56e8386a8a3f0f 100644 (file)
@@ -48,7 +48,7 @@ class ShipSimuMember extends ShipSimuBaseUser implements ManageableMember {
 
        /**
         * Creates an instance of this user class by a provided username. This
-        * factory method will check if the username is already taken and if not
+        * factory method will check if username is already taken and if not
         * so it will throw an exception.
         *
         * @param       $userName               Username we need a class instance for
@@ -62,7 +62,7 @@ class ShipSimuMember extends ShipSimuBaseUser implements ManageableMember {
                // Set the username
                $userInstance->setUserName($userName);
 
-               // Check if the username exists
+               // Check if username exists
                if ($userInstance->ifUsernameExists() === false) {
                        // Throw an exception here
                        throw new UsernameMissingException(array($userInstance, $userName), self::EXCEPTION_USERNAME_NOT_FOUND);
@@ -74,7 +74,7 @@ class ShipSimuMember extends ShipSimuBaseUser implements ManageableMember {
 
        /**
         * Creates an instance of this user class by a provided email address. This
-        * factory method will not check if the email address is there.
+        * factory method will not check if email address is there.
         *
         * @param       $email                  Email address of the user
         * @return      $userInstance   An instance of this user class
index 77521c063579fef275d3bacf90a9a7d701746461..70e41b1f55beaf0c583068a649c8659e69266790 100644 (file)
--- a/docs/TODO
+++ b/docs/TODO
@@ -1,6 +1,8 @@
 TODO:
 =====
 
+- Rename all FooNotFoundException to NoBarException
+
 - Hub and MXChange 0.3.0 must be ported to new framework changes:
        + ClassLoader::includeAllClasses() removed
        + FrameworkArrayObject::__construct($className) requires class name
index c6285422be0196dcdc009c3a63c9197e7d89e1b7..93958ed29eb9e581358492de873a36a25ca1d2dc 100644 (file)
@@ -31,7 +31,7 @@ class InvalidInterfaceException extends FrameworkException {
         */
        public function __construct (array $classArray, $code) {
                // Add a message around the missing class
-               $message = sprintf("[%s:%d] Object does not implement expected interface <span class=\"exception_reason\">.",
+               $message = sprintf("[%s:%d] Object does not implement expected interface <span class=\"exception_reason\">%s</span>.",
                        $classArray[0]->__toString(),
                        $this->getLine(),
                        $classArray[1]
index da2ec8f5f4425e110a952b4229884f93d80a7717..e58ab045c5347772a8924040fbd25ed1ca67ab23 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * An exception thrown if the result was not updated
+ * An exception thrown if result was not updated.
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
index 3d6f600006866c9308d21aa4d641b0865a9b647e..9bb607587d9ee0b9e212714f0cab056ce885a3f4 100644 (file)
@@ -25,8 +25,8 @@ interface Cryptable extends FrameworkInterface {
        /**
         * Hashes a string with salt and returns the hash. If an old previous hash
         * is supplied the method will use the first X chars of that hash for hashing
-        * the password. This is useful if you want to check if the password is
-        * identical for authorization purposes.
+        * the password. This is useful if you want to check if password is identical
+        * for authorization purposes.
         *
         * @param       $str            Unhashed string
         * @param       $oldHash        A hash from previous hashed string
index aa29b1acb047ad1f09793f2f0dc3102cbbf29383..cc15f8e244d7d7d91f6505a0bc13b34b530eead2 100644 (file)
@@ -23,8 +23,8 @@
  */
 interface UserRegister extends FrameworkInterface {
        /**
-        * Encrypt the given request key or throws an exception if the key was not
-        * found in the request
+        * Encrypt given request key or throws an exception if key was not found in
+        * request.
         *
         * @param       $requestKey             Key in request class
         * @return      void
index 37da8761893c5a5a9c9a6a6faf32adec0b20ac3e..d59051f39215af151e0da364500898b2baab252f 100644 (file)
@@ -25,8 +25,8 @@ interface Register extends FrameworkInterface {
        /**
         * Checks wether an instance key was found
         *
-        * @param       $instanceKey    The key holding an instance in the registry
-        * @return      $exists                 Wether the key exists in the registry
+        * @param       $instanceKey    The key holding an instance in registry
+        * @return      $exists                 Wether the key exists in registry
         */
        function instanceExists ($instanceKey);
 
index 5be733c818327fd758cc726ffb3db0bc6579e5ef..e5f9fa641b9ae50a0bc5e222b00b91a4541c19de 100644 (file)
@@ -40,7 +40,7 @@ interface Requestable extends FrameworkInterface {
        function isRequestElementSet ($element);
 
        /**
-        * Getter for request element or 'null' if the element was not found
+        * Getter for request element or 'null' if element was not found
         *
         * @param       $element        Name of the request element we want to check
         * @return      $value          Value of the found request element or 'null' if the
@@ -56,7 +56,7 @@ interface Requestable extends FrameworkInterface {
        function getParameterNames ();
 
        /**
-        * Getter for a header element or 'null' if the header was not found
+        * Getter for a header element or 'null' if header was not found
         *
         * @param       $headerName             Name of the header
         * @return      $headerValue    Value of the header or 'null' if not found
index 956d2b8cc2f84620495e53615b7e5f196295ec3d..7a12f3d0c94518c8fc626b33bc2eaf3307d120a8 100644 (file)
@@ -42,7 +42,7 @@ interface ActionResolver extends Resolver {
         *
         * @param       $actionName             The default action we shall execute
         * @return      $isValid                Wether the given action is valid
-        * @throws      EmptyVariableException  Thrown if the given action is not set
+        * @throws      EmptyVariableException  Thrown if given action is not set
         */
        function isActionValid ($actionName);
 }
index dd2ff064182896331a52777a7c0ed00002bf1441..d7f3976a655a752f1ed473d3bee73b213d00ca0e 100644 (file)
@@ -35,7 +35,7 @@ interface CommandResolver extends Resolver {
         *
         * @param       $commandName    The default command we shall execute
         * @return      $isValid                Wether the given command is valid
-        * @throws      EmptyVariableException  Thrown if the given command is not set
+        * @throws      EmptyVariableException  Thrown if given command is not set
         */
        function isCommandValid ($commandName);
 }
index 3e88853898be460170b5506a1655e807d507b61e..2dd07067be760c533a928f945b95cec21a880295 100644 (file)
@@ -37,8 +37,8 @@ interface ManageableAccount extends FrameworkInterface {
        function ifEmailAddressExists ();
 
        /**
-        * Checks if the supplied password hash in request matches with the stored
-        * in database.
+        * Checks if supplied password hash in request matches with stored in
+        * database.
         *
         * @param       $requestInstance        A requestable class instance
         * @return      $matches                        Wether the supplied password hash matches
index 0b2cd81865c9eb044f01d8a4ca2a023199ca80f0..a2b1665bb200983936a2532a192828b221e72576 100644 (file)
@@ -1,6 +1,8 @@
 <?php
 /**
- * A general action class
+ * A general action class. You shall extend this class if you are going to write
+ * your own action classes even when this class has no real content in it. We
+ * just handle the removal of some attributed here which you really don't need.
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
index 840519d37fb3523c5c1c8bbdc02d7b0448f8542d..7e0dfd0014034b76dbe49dca186362131d551b2b 100644 (file)
@@ -82,7 +82,7 @@ class MemoryCache extends BaseFrameworkSystem implements Cacheable {
         * Setter for cache offset
         *
         * @param       $offset         The offset we shall set
-        * @param       $data           Data to store in the cache
+        * @param       $data           Data to store in cache
         * @return      void
         */
        public final function offsetSet ($offset, $data) {
@@ -93,7 +93,7 @@ class MemoryCache extends BaseFrameworkSystem implements Cacheable {
         * Getter for cache offset or "null" if not found
         *
         * @param       $offset         The offset we shall set
-        * @return      $data           Data to store in the cache
+        * @return      $data           Data to store in cache
         */
        public final function offsetGet ($offset) {
                // Default is offset not found
index ee34a87f628414f57064e4df0b46ea53a3300b40..0c490f1ee7d1d7362552cd75eb3a2548df527264 100644 (file)
@@ -192,7 +192,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                // Set real class
                $this->setRealClass($className);
 
-               // Initialize the class if the class Registry is there
+               // Initialize the class if class Registry is there
                if ((class_exists('Registry')) && (Registry::isInitialized() === false)) {
                        // Initialize the registry automatically
                        $this->initInstance();
index e7becaee4fa6b5149141001f8b8b031fab02bb93..167423cf5cfe485331bfb0e35195679c6ca200c2 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /**
  * Class for saving arrays as an object. We need this little extension for
- * some common methods used in the whole application. Please see below if you
+ * some common methods used in whole application. Please see below if you
  * need more details.
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
diff --git a/inc/classes/main/commands/web/class_ b/inc/classes/main/commands/web/class_
new file mode 100644 (file)
index 0000000..d5c0bc0
--- /dev/null
@@ -0,0 +1,77 @@
+<?php
+/**
+ * A command for 
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+class Web???Command extends BaseCommand implements Commandable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this class
+        *
+        * @param       $resolverInstance       An instance of a command resolver class
+        * @return      $commandInstance        An instance a prepared command class
+        */
+       public final static function createWeb???Command (CommandResolver $resolverInstance) {
+               // Get new instance
+               $commandInstance = new Web???Command();
+
+               // Set the application instance
+               $commandInstance->setResolverInstance($resolverInstance);
+
+               // Return the prepared instance
+               return $commandInstance;
+       }
+
+       /**
+        * Executes the given 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("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) {
+               // Empty for now
+       }
+}
+
+// [EOF]
+?>
index db15067cc0e8306c3f37da4ab7f06aa5f8074f81..ca44f8b619a91f4d2fb107b5e7241e397b7fecab 100644 (file)
@@ -109,7 +109,7 @@ class WebConfirmCommand extends BaseCommand implements Commandable {
                // these two calls to cache compiled templates.
                $templateInstance->compileVariables();
 
-               // Get the content back from the template engine and put it in the response class
+               // Get the content back from the template engine and put it in response class
                $templateInstance->transferToResponse($responseInstance);
        }
 
index 14a7a9c6ff69029d31875c0b292b043753500d7c..6aad8cfb7f91b926bd8e2b3476141d8e8e324356 100644 (file)
@@ -100,7 +100,7 @@ class WebHomeCommand extends BaseCommand implements Commandable {
                // these two calls to cache compiled templates.
                $templateInstance->compileVariables();
 
-               // Get the content back from the template engine and put it in the response class
+               // Get the content back from the template engine and put it in response class
                $templateInstance->transferToResponse($responseInstance);
        }
 
index 98f76cd104db292415ac67d0358bd206958f0886..749de17491a02c983d10bdf7ae17423844da1b83 100644 (file)
@@ -137,7 +137,7 @@ class WebLoginAreaCommand extends BaseCommand implements Commandable {
                // these two calls to cache compiled templates.
                $templateInstance->compileVariables();
 
-               // Get the content back from the template engine and put it in the response class
+               // Get the content back from the template engine and put it in response class
                $templateInstance->transferToResponse($responseInstance);
        }
 
index e02e2b5b8435dd1c0cec7e121cd9b3d2a9b7c918..9726e847897f836ebd31443cbfa97771a613f6b8 100644 (file)
@@ -103,7 +103,7 @@ class WebLoginCommand extends BaseCommand implements Commandable {
                // these two calls to cache compiled templates.
                $templateInstance->compileVariables();
 
-               // Get the content back from the template engine and put it in the response class
+               // Get the content back from the template engine and put it in response class
                $templateInstance->transferToResponse($responseInstance);
        }
 
index 7c74d7bd2735a999fe68dcf75743a5834f1b9c3d..f2b6b81017c1d6d68078a8b10f42acbe099436b4 100644 (file)
@@ -103,7 +103,7 @@ class WebLoginFailedCommand extends BaseCommand implements Commandable {
                // these two calls to cache compiled templates.
                $templateInstance->compileVariables();
 
-               // Get the content back from the template engine and put it in the response class
+               // Get the content back from the template engine and put it in response class
                $templateInstance->transferToResponse($responseInstance);
        }
 
index bbb7f2f702f93e2afe91c0a63dc9f62b7394af2c..8dfdee365d72be677b3365bcce3f2a77fbed74e4 100644 (file)
@@ -103,7 +103,7 @@ class WebLogoutDoneCommand extends BaseCommand implements Commandable {
                // these two calls to cache compiled templates.
                $templateInstance->compileVariables();
 
-               // Get the content back from the template engine and put it in the response class
+               // Get the content back from the template engine and put it in response class
                $templateInstance->transferToResponse($responseInstance);
        }
 
index 42f9379bb4d80ffc97131c4919a59006b40b1528..c23b6476ea84b27982ca5408ebdec5e8694d04bc 100644 (file)
@@ -107,7 +107,7 @@ class WebRegisterCommand extends BaseCommand implements Commandable, Registerabl
                // these two calls to cache compiled templates.
                $templateInstance->compileVariables();
 
-               // Get the content back from the template engine and put it in the response class
+               // Get the content back from the template engine and put it in response class
                $templateInstance->transferToResponse($responseInstance);
        }
 
index e760492fcbfa4b8dd3addb09320826f256836f5b..021057ba7bc12409de39883ac0348ace53ae6e6a 100644 (file)
@@ -45,7 +45,7 @@ class WebDoFormController extends BaseController implements Controller {
                // Set resolver instance
                $controllerInstance->setResolverInstance($resolverInstance);
 
-               // We need the controller instance in the resolver class so set it here
+               // We need the controller instance in resolver class so set it here
                $resolverInstance->setControllerInstance($controllerInstance);
 
                // Return the prepared instance
diff --git a/inc/classes/main/controller/web/class_ b/inc/classes/main/controller/web/class_
new file mode 100644 (file)
index 0000000..4e5bdee
--- /dev/null
@@ -0,0 +1,85 @@
+<?php
+/**
+ * Controller for 
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+class Web???Controller extends BaseController implements Controller {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this class
+        *
+        * @param       $resolverInstance               An instance of a command resolver class
+        * @return      $controllerInstance             A prepared instance of this class
+        * @todo        Add some filters to this controller
+        */
+       public final static function createWeb???Controller (CommandResolver $resolverInstance) {
+               // Create the instance
+               $controllerInstance = new Web???Controller();
+
+               // Set the command resolver
+               $controllerInstance->setResolverInstance($resolverInstance);
+
+               // Add filters
+               //$controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_confirmed_filter'));
+
+               // Return the prepared instance
+               return $controllerInstance;
+       }
+
+       /**
+        * Handles the given request and response
+        *
+        * @param       $requestInstance        An instance of a request class
+        * @param       $responseInstance       An instance of a response class
+        * @return      void
+        */
+       public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) {
+               // Get the command instance from the resolver by sending a request instance to the resolver
+               $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance);
+
+               // Run the pre filters
+               $this->executePreFilters($requestInstance, $responseInstance);
+
+               // This request was valid! :-D
+               $requestInstance->requestIsValid();
+
+               // Execute the command
+               $commandInstance->execute($requestInstance, $responseInstance);
+
+               // Run the pre filters
+               $this->executePostFilters($requestInstance, $responseInstance);
+
+               // Flush the response out
+               $responseInstance->flushBuffer();
+       }
+}
+
+// [EOF]
+?>
index 0e76ede72519815213c2d9375d16c15e8ab0a5b9..faeb8be698188dfb71d383405a4c2bee9b24d3ea 100644 (file)
@@ -201,7 +201,7 @@ class SearchCriteria extends BaseFrameworkSystem implements LocalSearchCriteria
                        } // END - foreach
                } // END - foreach
 
-               // Now check if the criteria matches
+               // Now check if expected criteria counts match
                $matches = ($counted == count($this->searchCriteria));
 
                // Return the result
index 1ccdaae901b0712c8644e6001b8de53598cd050d..0456e10dae2e1f8cb3c5a0929f9a1d7e66def337 100644 (file)
@@ -119,8 +119,8 @@ class CryptoHelper extends BaseFrameworkSystem implements Cryptable {
        /**
         * Hashes a string with salt and returns the hash. If an old previous hash
         * is supplied the method will use the first X chars of that hash for hashing
-        * the password. This is useful if you want to check if the password is
-        * identical for authorization purposes.
+        * the password. This is useful if you want to check if password is identical
+        * for authorization purposes.
         *
         * @param       $str            Unhashed string
         * @param       $oldHash        A hash from previous hashed string
index 29e2e5e0f397f3dab498d8dc80ce70565a1598ce..dc4371efd13fcb5a08bbb64a1bb185ddcd5726fd 100644 (file)
@@ -273,7 +273,7 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
        }
 
        /**
-        * Getter for table information file contents or an empty if the info file was not created
+        * Getter for table information file contents or an empty if info file was not created
         *
         * @param       $dataSetInstance        An instance of a database set class
         * @return      $infoArray                      An array with all table informations
index b399a8917ccef5358e2fbf19385c17942dee14c5..01774b7cff7102f24648cbc259fffb58ec3f3f1f 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * A filter for checking if the "encrypt" value is set and fine
+ * A filter for checking if value "encrypt" is set and fine
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
index fc11b737f34b588f5a5fd6209ed456a66c7b8585..e40f1e345838a6d755b6527483e161412ab5ae67 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /**
- * A filter for checking if the username "guest" has been choosen as configured.
- * If so the password will be set to the configured password.
+ * A filter for checking if username "guest" has been choosen as configured. If
+ * so the password will be set to the configured password.
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
index 264c4e16a6c20d4c2a300b2c3626c763e1ecd9c3..819ec8993dfc1fead093de861847c5fde54f2000 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 /**
  * A concrete filter for validating the email address. This filter may intercept
- * the filter chain if no email address is given or if the supplied email has an
- * invalid form. It could also intercept the filter chain if the email address
- * is already used by some one if configuration requires this.
+ * the filter chain if no email address is given or if supplied email has an
+ * invalid form. It could also intercept our filter chain if email address is
+ * already used by some one if configuration requires this.
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
index 39bfee2736d404067a34b7b6aaa37ad664e813f3..534823b746ef176826f3bc1e4aae9318eefbb5b4 100644 (file)
@@ -1,9 +1,8 @@
 <?php
 /**
  * A concrete filter for validating the username. This filter may intercept the
- * filter chain if no username is given or if the supplied username has an
- * invalid form. It could also intercept the filter chain if the username is
- * already taken.
+ * filter chain if no username is given or if supplied username has an invalid
+ * form. It could also intercept our filter chain if username is already taken.
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
index 98fc1e67ce0a66798950b822aa1d221270048441..eb6ca979350ddd4a8d5e27d663f00be4a2539d82 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * A filter for checking if the the supplied confirmation code is valid
+ * A filter for checking if supplied confirmation code is valid.
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
index cf44e53ae48442ac14b12f0fe399fc43409e45ab..4506a2813f446936468e22577cc2dbe35d3db2ea 100644 (file)
@@ -1,9 +1,8 @@
 <?php
 /**
  * A concrete filter for verfying the guest username. This filter may intercept the
- * filter chain if no username is given or if the supplied username has an
- * invalid form. It could also intercept the filter chain if the username was
- * not found.
+ * filter chain if no username is given or if supplied username has an invalid
+ * form. It could also intercept our filter chain if username was not found.
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
index cab4380cb94b381965ac4b9b21960e9e30505e24..b61db662e2aa0cbbe05d3d2e8c14656263d8b490 100644 (file)
@@ -1,9 +1,8 @@
 <?php
 /**
  * A concrete filter for verfying the username. This filter may intercept the
- * filter chain if no username is given or if the supplied username has an
- * invalid form. It could also intercept the filter chain if the username was
- * not found.
+ * filter chain if no username is given or if supplied username has an invalid
+ * form. It could also intercept our filter chain if username was not found.
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
index 79e0aceb2b48efec86154b404258b188afdb0803..d2d53d83bf30816d55f7c0159b6cea7665d4938a 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * A filter for checking if the user status is GUEST or CONFIRMED
+ * A filter for checking if user status is GUEST or CONFIRMED.
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
index c87942bd997732c90328b635f6d0a9263de6e512..fd5bb60b269ed74b5c847b241fc1fef8639137ec 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * A filter for checking if the user status is UNCONFIRMED
+ * A filter for checking if user status is UNCONFIRMED.
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
index 0b5a76f03f45a4ecfee238f4bdab3d75b6d32a53..fa8bd8591e2d48f11cd7b44efdd8c1c71216a377 100644 (file)
@@ -270,7 +270,7 @@ class ImageHelper extends BaseCaptcha implements HelpableTemplate {
        /**
         * Setter for image message string
         *
-        * @param       $imageString    A message to display in the image
+        * @param       $imageString    A message to display in image
         * @return      void
         */
        public final function setImageString ($imageString) {
@@ -280,7 +280,7 @@ class ImageHelper extends BaseCaptcha implements HelpableTemplate {
        /**
         * Getter for image message string
         *
-        * @return      $imageString    A message to display in the image
+        * @return      $imageString    A message to display in image
         */
        public final function getImageString () {
                return $this->imageStrings[$this->currString]['string'];
index 539f025af8364ae1426e363ca67edf14eb1c6839..1fffb7af1d9c215d0de1850bce4190ee0bf92aa6 100644 (file)
@@ -426,7 +426,7 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
                        // Switch the state
                        $this->closePreviousGroupByContent($content);
 
-                       // All call it again if the group name is not empty
+                       // All call it again if group name is not empty
                        if ((!empty($groupId)) && ($groupId != $prevGroupId)) {
                                //* DEBUG: */ echo $groupId."/".$prevGroupId."<br />\n";
                                $this->addFormGroup($groupId, $groupText);
@@ -436,8 +436,8 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
 
        /**
         * Add a form sub group or close an already opened and open a new one or
-        * throws an exception if no group has been opened before or if the sub
-        * group name is empty.
+        * throws an exception if no group has been opened before or if sub group
+        * name is empty.
         *
         * @param       $subGroupId             Name of the group or last opened if empty
         * @param       $subGroupText   Text including HTML to show above this group
index e19b0675bee732ca2deb47affbe8f8990404a4e6..ccbb545e276c32227c1c2a4925728cf8257bbad2 100644 (file)
@@ -195,7 +195,7 @@ class FrameworkDirectoryPointer extends BaseFrameworkSystem {
         * @return      void
         */
        public final function setPointer ($dirPointer) {
-               // Sanity-check if the pointer is a valid directory resource
+               // Sanity-check if pointer is a valid directory resource
                if (is_resource($dirPointer) || is_null($dirPointer)) {
                        // Is a valid resource
                        $this->dirPointer = $dirPointer;
index 172c02f700c366475b4d51eb89a53c1c5ef180aa..35376e96c5f561072e2225fd39a7223a275d9efc 100644 (file)
@@ -178,7 +178,7 @@ class FrameworkFileInputPointer extends BaseFrameworkSystem {
         * @return      void
         */
        public final function setPointer ($filePointer) {
-               // Sanity-check if the pointer is a valid file resource
+               // Sanity-check if pointer is a valid file resource
                if (is_resource($filePointer) || is_null($filePointer)) {
                        // Is a valid resource
                        $this->filePointer = $filePointer;
index 37c2285ead758a95e3dbebcd3e8cc3c167c754f5..84c8ed4078b30080b7cf05ebb135d4ff0df4e167 100644 (file)
@@ -148,7 +148,7 @@ class FrameworkFileOutputPointer extends BaseFrameworkSystem {
         * @return      void
         */
        public final function setPointer ($filePointer) {
-               // Sanity-check if the pointer is a valid file resource
+               // Sanity-check if pointer is a valid file resource
                if (is_resource($filePointer) || is_null($filePointer)) {
                        // Is a valid resource
                        $this->filePointer = $filePointer;
index 042ee69194122982abbf123343e0e495f9a0bfd4..14bdd412db4a536714a6ac233d0be29f3cd2c0fc 100644 (file)
@@ -101,7 +101,7 @@ class DebugMailer extends BaseMailer implements DeliverableMail {
                                        // Get the field from the value instance
                                        $fieldValue = $recipientList['values'][$variable]->getField($variable);
 
-                                       // Set it in the template engine
+                                       // Set it in template engine
                                        $templateInstance->assignVariable($variable, $fieldValue);
                                }
 
index 0cc004045eaa29f768ced529fe417ddc8b324c3e..1ebf7e5b8d52eba657c6c8d6fc1481a823a01e40 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * A general registration class
+ * A general registration class.
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
@@ -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/>.
  */
-abstract class BaseRegistration extends BaseFrameworkSystem implements UserRegister {
+class BaseRegistration extends BaseFrameworkSystem {
        /**
         * Pre-registration filter chain
         */
index 2ca0382d328a447891e68a4ff7295ef6606bed2a..9a8b648376ab6db4770ef4f0d3ff14a098e45e1c 100644 (file)
@@ -86,8 +86,8 @@ class Registry extends BaseFrameworkSystem implements Register {
        /**
         * Checks wether an instance key was found
         *
-        * @param       $instanceKey    The key holding an instance in the registry
-        * @return      $exists                 Wether the key exists in the registry
+        * @param       $instanceKey    The key holding an instance in registry
+        * @return      $exists                 Wether the key exists in registry
         */
        public function instanceExists ($instanceKey) {
                // Does this key exists?
@@ -115,7 +115,7 @@ class Registry extends BaseFrameworkSystem implements Register {
         * @return      $objectInstance         An instance we shall store
         */
        public function getInstance ($instanceKey) {
-               // By default the instance is not in the registry
+               // By default the instance is not in registry
                $objectInstance = null;
 
                // Is the instance there?
index bd31476d634c83a473f664811bed26b266f69d21..0538512a324aa43dde466f516aa23875728566f6 100644 (file)
@@ -83,17 +83,14 @@ class HttpRequest extends BaseFrameworkSystem implements Requestable {
         */
        public function isRequestElementSet ($element) {
                // Is this element found?
-               if (!isset($this->requestData[$element])) {
-                       // Then return false
-                       return false;
-               } // END - if
+               $isSet = isset($this->requestData[$element]);
 
-               // All clear
-               return true;
+               // Return result
+               return $isSet;
        }
 
        /**
-        * Getter for request element or 'null' if the element was not found
+        * Getter for request element or 'null' if element was not found
         *
         * @param       $element        Name of the request element we want to check
         * @return      $value          Value of the found request element or 'null' if the
@@ -137,7 +134,7 @@ class HttpRequest extends BaseFrameworkSystem implements Requestable {
        }
 
        /**
-        * Getter for a header element or 'null' if the header was not found
+        * Getter for a header element or 'null' if header was not found
         *
         * @param       $headerName             Name of the header
         * @return      $headerValue    Value of the header or 'null' if not found
index 250fa014044db78476de073e4152888d7695d556..7e462cc5c29f0013d6564a05d433d8a4b5befb92 100644 (file)
@@ -77,7 +77,7 @@ class BaseActionResolver extends BaseResolver {
         *
         * @param       $actionName     The default action we shall execute
         * @return      $isValid                Wether the given action is valid
-        * @throws      EmptyVariableException  Thrown if the given action is not set
+        * @throws      EmptyVariableException  Thrown if given action is not set
         */
        public function isActionValid ($actionName) {
                // By default nothing shall be valid
index 4d86ee0e7e4b9ec6e158fbde2132bf1ced30ed1d..6276b11d694e39e28b24f2f89751f38442acc917 100644 (file)
@@ -46,8 +46,8 @@ class WebActionResolver extends BaseActionResolver implements ActionResolver {
         * @param       $actionName                             The default action we shall execute
         * @param       $appInstance                    An instance of a manageable application helper class
         * @return      $resolverInstance               The prepared action resolver instance
-        * @throws      EmptyVariableException  Thrown if the default action is not set
-        * @throws      InvalidActionException  Thrown if the default action is invalid
+        * @throws      EmptyVariableException  Thrown if default action is not set
+        * @throws      InvalidActionException  Thrown if default action is invalid
         */
        public final static function createWebActionResolver ($actionName, ManageableApplication $appInstance) {
                // Create the new instance
@@ -91,7 +91,7 @@ class WebActionResolver extends BaseActionResolver implements ActionResolver {
                // Is the action empty? Then fall back to default action
                if (empty($actionName)) $actionName = $this->getConfigInstance()->readConfig('default_action');
 
-               // Check if the action is valid
+               // Check if action is valid
                if ($this->isActionValid($actionName) === false) {
                        // This action is invalid!
                        throw new InvalidActionException(array($this, $actionName), self::EXCEPTION_INVALID_ACTION);
@@ -129,7 +129,7 @@ class WebActionResolver extends BaseActionResolver implements ActionResolver {
                // Is the action empty? Then fall back to default action
                if (empty($actionName)) $actionName = $this->getConfigInstance()->readConfig('default_action');
 
-               // Check if the action is valid
+               // Check if action is valid
                if ($this->isActionValid($actionName) === false) {
                        // This action is invalid!
                        throw new InvalidActionException(array($this, $actionName), self::EXCEPTION_INVALID_ACTION);
index d1fa003a380d07015beb28a2dd86ef061f271449..465ee5c9d210d330de7c7d927f1d588853af1cc6 100644 (file)
@@ -101,7 +101,7 @@ class BaseCommandResolver extends BaseResolver {
         *
         * @param       $commandName    The default command we shall execute
         * @return      $isValid                Wether the given command is valid
-        * @throws      EmptyVariableException  Thrown if the given command is not set
+        * @throws      EmptyVariableException  Thrown if given command is not set
         */
        public function isCommandValid ($commandName) {
                // By default nothing shall be valid
index 4a74091ec220e570c0474c5dd2ff40879c351bf5..dc104e6a387fb68f1c48cd0b15140a16ef0317ec 100644 (file)
@@ -46,8 +46,8 @@ class ImageCommandResolver extends BaseCommandResolver implements CommandResolve
         * @param       $commandName                            The default command we shall execute
         * @param       $appInstance                            An instance of a manageable application helper class
         * @return      $resolverInstance                       The prepared command resolver instance
-        * @throws      EmptyVariableException          Thrown if the default command is not set
-        * @throws      InvalidCommandException         Thrown if the default command is invalid
+        * @throws      EmptyVariableException          Thrown if default command is not set
+        * @throws      InvalidCommandException         Thrown if default command is invalid
         */
        public final static function createImageCommandResolver ($commandName, ManageableApplication $appInstance) {
                // Create the new instance
@@ -91,7 +91,7 @@ class ImageCommandResolver extends BaseCommandResolver implements CommandResolve
                // Is the command empty? Then fall back to default command
                if (empty($commandName)) $commandName = $this->getConfigInstance()->readConfig('default_image_command');
 
-               // Check if the command is valid
+               // Check if command is valid
                if ($this->isCommandValid($commandName) === false) {
                        // This command is invalid!
                        throw new InvalidCommandException(array($this, $commandName), self::EXCEPTION_INVALID_COMMAND);
@@ -127,7 +127,7 @@ class ImageCommandResolver extends BaseCommandResolver implements CommandResolve
                // Is the command empty? Then fall back to default command
                if (empty($commandName)) $commandName = $this->getConfigInstance()->readConfig('default_image_command');
 
-               // Check if the command is valid
+               // Check if command is valid
                if ($this->isCommandValid($commandName) === false) {
                        // This command is invalid!
                        throw new InvalidCommandException(array($this, $commandName), self::EXCEPTION_INVALID_COMMAND);
diff --git a/inc/classes/main/resolver/command/web/class_ b/inc/classes/main/resolver/command/web/class_
new file mode 100644 (file)
index 0000000..4808086
--- /dev/null
@@ -0,0 +1,178 @@
+<?php
+/**
+ * A command resolver for local (non-hubbed) web commands
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+class Web???CommandResolver extends BaseCommandResolver implements CommandResolver {
+       /**
+        * Last successfull resolved command
+        */
+       private $lastCommandInstance = null;
+
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Set prefix to "Web"
+               $this->setCommandPrefix("Web");
+       }
+
+       /**
+        * Creates an instance of a Web command resolver with a given default command
+        *
+        * @param       $commandName                            The default command we shall execute
+        * @param       $appInstance                            An instance of a manageable application helper class
+        * @return      $resolverInstance                       The prepared command resolver instance
+        * @throws      EmptyVariableException          Thrown if the default command is not set
+        * @throws      InvalidCommandException         Thrown if the default command is invalid
+        */
+       public final static function createWeb???CommandResolver ($commandName, ManageableApplication $appInstance) {
+               // Create the new instance
+               $resolverInstance = new Web???CommandResolver();
+
+               // Is the variable $commandName set and the command is valid?
+               if (empty($commandName)) {
+                       // Then thrown an exception here
+                       throw new EmptyVariableException(array($resolverInstance, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+               } elseif ($resolverInstance->isCommandValid($commandName) === false) {
+                       // Invalid command found
+                       throw new InvalidCommandException(array($resolverInstance, $commandName), self::EXCEPTION_INVALID_COMMAND);
+               }
+
+               // Set the application instance
+               $resolverInstance->setApplicationInstance($appInstance);
+
+               // Return the prepared instance
+               return $resolverInstance;
+       }
+
+       /**
+        * Returns an command instance for a given request class or null if
+        * it was not found
+        *
+        * @param       $requestInstance        An instance of a request class
+        * @return      $commandInstance        An instance of the resolved command
+        * @throws      InvalidCommandException                         Thrown if $commandName is
+        *                                                                                              invalid
+        * @throws      InvalidCommandInstanceException         Thrown if $commandInstance
+        *                                                                                              is an invalid instance
+        */
+       public function resolveCommandByRequest (Requestable $requestInstance) {
+               // Init variables
+               $commandName = "";
+               $commandInstance = null;
+
+               // This goes fine so let's resolv the command
+               $commandName = $requestInstance->getRequestElement('page');
+
+               // Is the command empty? Then fall back to default command
+               if (empty($commandName)) $commandName = $this->getConfigInstance()->readConfig('default_web_command');
+
+               // Check if the command is valid
+               if ($this->isCommandValid($commandName) === false) {
+                       // This command is invalid!
+                       throw new InvalidCommandException(array($this, $commandName), self::EXCEPTION_INVALID_COMMAND);
+               } // END - if
+
+               // Get the command
+               $commandInstance = $this->loadCommand($commandName);
+
+               // And validate it
+               if ((!is_object($commandInstance)) || (!$commandInstance instanceof Commandable)) {
+                       // This command has an invalid instance!
+                       throw new InvalidCommandInstanceException(array($this, $commandName), self::EXCEPTION_INVALID_COMMAND);
+               } // END - if
+
+               // Set last command
+               $this->lastCommandInstance = $commandInstance;
+
+               // Return the resolved command instance
+               return $commandInstance;
+       }
+
+       /**
+        * Resolves the command by its direct name and returns an instance of its class
+        *
+        * @param       $commandName            The direct command name we shall resolve
+        * @return      $commandInstance        An instance of the command class
+        * @throws      InvalidCommandException         Thrown if $commandName is invalid
+        */
+       public function resolveCommand ($commandName) {
+               // Initiate the instance variable
+               $commandInstance = null;
+
+               // Is the command empty? Then fall back to default command
+               if (empty($commandName)) $commandName = $this->getConfigInstance()->readConfig('default_web_command');
+
+               // Check if the command is valid
+               if ($this->isCommandValid($commandName) === false) {
+                       // This command is invalid!
+                       throw new InvalidCommandException(array($this, $commandName), self::EXCEPTION_INVALID_COMMAND);
+               }
+
+               // Get the command
+               $commandInstance = $this->loadCommand($commandName);
+
+               // Return the instance
+               return $commandInstance;
+       }
+
+       /**
+        * "Loads" a given command and instances it if not yet cached
+        *
+        * @param       $commandName                            A command name we shall look for
+        * @return      $commandInstance                        A loaded command instance
+        * @throws      InvalidCommandException         Thrown if even the default
+        *                                                                              command class is missing (bad!)
+        */
+       private function loadCommand ($commandName) {
+               // Cache default command
+               $defaultCommand = $this->getConfigInstance()->readConfig('default_web_command');
+
+               // Init command instance
+               $commandInstance = null;
+
+               // Create command class name
+               $this->setClassName(sprintf("Web%sCommand",
+                       $this->convertToClassName($commandName)
+               ));
+
+               // Is this class loaded?
+               if (!class_exists($this->getClassName())) {
+                       // Class not found, so throw an exception
+                       throw new InvalidCommandException(array($this, $defaultCommand), self::EXCEPTION_INVALID_COMMAND);
+               } // END - if
+
+               // Initiate the command
+               $commandInstance = ObjectFactory::createObjectByName($this->getClassName(), array($this));
+
+               // Return the result
+               return $commandInstance;
+       }
+}
+
+// [EOF]
+?>
index ba8097492c1a51b8a33e31f3906d5695b8594c21..42ae37a845abc678fac4d93699f19f5e6c3d3a41 100644 (file)
@@ -46,8 +46,8 @@ class WebCommandResolver extends BaseCommandResolver implements CommandResolver
         * @param       $commandName                            The default command we shall execute
         * @param       $appInstance                            An instance of a manageable application helper class
         * @return      $resolverInstance                       The prepared command resolver instance
-        * @throws      EmptyVariableException          Thrown if the default command is not set
-        * @throws      InvalidCommandException         Thrown if the default command is invalid
+        * @throws      EmptyVariableException          Thrown if default command is not set
+        * @throws      InvalidCommandException         Thrown if default command is invalid
         */
        public final static function createWebCommandResolver ($commandName, ManageableApplication $appInstance) {
                // Create the new instance
@@ -91,7 +91,7 @@ class WebCommandResolver extends BaseCommandResolver implements CommandResolver
                // Is the command empty? Then fall back to default command
                if (empty($commandName)) $commandName = $this->getConfigInstance()->readConfig('default_web_command');
 
-               // Check if the command is valid
+               // Check if command is valid
                if ($this->isCommandValid($commandName) === false) {
                        // This command is invalid!
                        throw new InvalidCommandException(array($this, $commandName), self::EXCEPTION_INVALID_COMMAND);
@@ -127,7 +127,7 @@ class WebCommandResolver extends BaseCommandResolver implements CommandResolver
                // Is the command empty? Then fall back to default command
                if (empty($commandName)) $commandName = $this->getConfigInstance()->readConfig('default_web_command');
 
-               // Check if the command is valid
+               // Check if command is valid
                if ($this->isCommandValid($commandName) === false) {
                        // This command is invalid!
                        throw new InvalidCommandException(array($this, $commandName), self::EXCEPTION_INVALID_COMMAND);
index 21694a849d34925b79b9f14102c196244048fd6a..a667fe6cf2724fb5d52a5a2fbda87db5b8f2e3e9 100644 (file)
@@ -77,8 +77,8 @@ class BaseControllerResolver extends BaseResolver {
         *
         * @param       $controllerName         The default controller we shall execute
         * @return      $isValid                        Wether the given controller is valid
-        * @throws      EmptyVariableException  Thrown if the given controller is not set
-        * @throws      DefaultControllerException      If the default controller was not found
+        * @throws      EmptyVariableException          Thrown if given controller is not set
+        * @throws      DefaultControllerException      Thrown if default controller was not found
         */
        public function isControllerValid ($controllerName) {
                // By default nothing shall be valid
index 10005434bed189bc2edf2706b8e1609143a177e7..39d88d16728dc4dd3067e504e2a4940c33111ef6 100644 (file)
@@ -51,8 +51,8 @@ class ImageControllerResolver extends BaseControllerResolver implements Controll
         * @param       $controllerName                         The controller we shall resolve
         * @param       $appInstance                            An instance of a manageable application helper class
         * @return      $resolverInstance                       The prepared controller resolver instance
-        * @throws      EmptyVariableException          Thrown if the default command is not set
-        * @throws      InvalidControllerException      Thrown if the default controller is invalid
+        * @throws      EmptyVariableException          Thrown if default command is not set
+        * @throws      InvalidControllerException      Thrown if default controller is invalid
         */
        public final static function createImageControllerResolver ($controllerName, ManageableApplication $appInstance) {
                // Create the new instance
index 22933936c49252118fce86f5aa8c3da1ec18da11..5378006099a8c964f98d01ab13826f24133866bb 100644 (file)
@@ -51,8 +51,8 @@ class WebControllerResolver extends BaseControllerResolver implements Controller
         * @param       $controllerName                         The controller we shall resolve
         * @param       $appInstance                            An instance of a manageable application helper class
         * @return      $resolverInstance                       The prepared controller resolver instance
-        * @throws      EmptyVariableException          Thrown if the default command is not set
-        * @throws      InvalidControllerException      Thrown if the default controller is invalid
+        * @throws      EmptyVariableException          Thrown if default command is not set
+        * @throws      InvalidControllerException      Thrown if default controller is invalid
         */
        public final static function createWebControllerResolver ($controllerName, ManageableApplication $appInstance) {
                // Create the new instance
@@ -151,11 +151,26 @@ class WebControllerResolver extends BaseControllerResolver implements Controller
                        throw new InvalidControllerException(array($this, $controllerName), self::EXCEPTION_INVALID_CONTROLLER);
                } // END - if
 
+               // Set default resolver config name
+               $resolverConfigEntry = "";
+
+               // Try to read a config entry for our resolver including controller name... ;-)
+               try {
+                       // Create the resolver name
+                       $resolverConfigEntry = sprintf("web_cmd_%s_resolver_class", strtolower($controllerName));
+
+                       // Get the config, this will throw an exception if there is no special command resolver
+                       $resolverClass = $this->getConfigInstance()->readConfig($resolverConfigEntry);
+               } catch (ConfigEntryNotFoundException $e) {
+                       // Use default resolver entry
+                       $resolverConfigEntry = "web_cmd_resolver_class";
+               }
+
                // Initiate the resolver and controller
-               $resolverInstance = ObjectFactory::createObjectByConfiguredName('web_cmd_resolver_class', array($controllerName, $this->getApplicationInstance()));
+               $resolverInstance = ObjectFactory::createObjectByConfiguredName($resolverConfigEntry, array($controllerName, $this->getApplicationInstance()));
                $controllerInstance = ObjectFactory::createObjectByName($this->getClassName(), array($resolverInstance));
 
-               // Remove resolver
+               // Remove resolver (we don't need it anymore)
                unset($resolverInstance);
 
                // Return the result
index 603f8cb3f94be26356f199fd4bcbd8797a80dab6..94fe3b5deff55a2f96fac4aaba5bde59197b32a0 100644 (file)
@@ -119,7 +119,7 @@ class DatabaseResult extends BaseFrameworkSystem implements SearchableResult, Up
 
        /**
         * "Iterator" method next() to advance to the next valid entry. This method
-        * does also check if the result is invalid
+        * does also check if result is invalid
         *
         * @return      $nextValid      Wether the next entry is valid
         */
@@ -223,7 +223,7 @@ class DatabaseResult extends BaseFrameworkSystem implements SearchableResult, Up
        }
 
        /**
-        * Searches for an entry in the data result and returns it
+        * Searches for an entry in data result and returns it
         *
         * @param       $criteriaInstance       The criteria to look inside the data set
         * @return      $result                         Found result entry
index 2bbec445b092f3c9dcc661f14ef3ff3037f2c4f8..8690db6fe519d8f038307dbe7684e8712eb56d71 100644 (file)
@@ -1172,7 +1172,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
         * @return      void
         */
        public function transferToResponse (Responseable $responseInstance) {
-               // Get the content and set it in the response class
+               // Get the content and set it in response class
                $responseInstance->writeToBody($this->getCompiledData());
        }
 
index 0e3dba9eebad03f3eda5152a232ec2278da47f18..b00a0730f4cfe6b1d4da5cc1057e25730e8f87bf 100644 (file)
@@ -213,8 +213,8 @@ class BaseUser extends BaseFrameworkSystem {
        }
 
        /**
-        * Checks if the supplied password hash in request matches with the stored
-        * in database.
+        * Checks if supplied password hash in request matches with the stored in
+        * database.
         *
         * @param       $requestInstance        A requestable class instance
         * @return      $matches                        Wether the supplied password hash matches
index 3f45a4fcbe4d031b996e13a7042908f58c0c6210..2362921bea088be66907c83b6f8c8a2161dbaddc 100644 (file)
@@ -39,8 +39,8 @@ class Guest extends BaseUser implements ManageableGuest, Registerable {
 
        /**
         * Creates an instance of this user class by a provided username. This
-        * factory method will check if the username is already taken and if not
-        * so it will throw an exception.
+        * factory method will check if username is already taken and if not so it
+        * will throw an exception.
         *
         * @param       $userName               Username we need a class instance for
         * @return      $userInstance   An instance of this user class
@@ -53,7 +53,7 @@ class Guest extends BaseUser implements ManageableGuest, Registerable {
                // Set the username
                $userInstance->setUserName($userName);
 
-               // Check if the username exists
+               // Check if username exists
                if ($userInstance->ifUsernameExists() === false) {
                        // Throw an exception here
                        throw new UsernameMissingException(array($userInstance, $userName), self::EXCEPTION_USERNAME_NOT_FOUND);
@@ -65,7 +65,7 @@ class Guest extends BaseUser implements ManageableGuest, Registerable {
 
        /**
         * Creates an instance of this user class by a provided email address. This
-        * factory method will not check if the email address is there.
+        * factory method will not check if email address is there.
         *
         * @param       $email                  Email address of the user
         * @return      $userInstance   An instance of this user class
index 6c84ec95e4340ad16fcabfd690c2030299aefa05..b67ad88b9274bbc1f2ebc48759a49ab2ac47663f 100644 (file)
@@ -47,8 +47,8 @@ class Member extends BaseUser implements ManageableMember, Registerable, Updatea
 
        /**
         * Creates an instance of this user class by a provided username. This
-        * factory method will check if the username is already taken and if not
-        * so it will throw an exception.
+        * factory method will check if username is already taken and if not so it
+        * will throw an exception.
         *
         * @param       $userName               Username we need a class instance for
         * @return      $userInstance   An instance of this user class
@@ -61,7 +61,7 @@ class Member extends BaseUser implements ManageableMember, Registerable, Updatea
                // Set the username
                $userInstance->setUserName($userName);
 
-               // Check if the username exists
+               // Check if username exists
                if ($userInstance->ifUsernameExists() === false) {
                        // Throw an exception here
                        throw new UsernameMissingException(array($userInstance, $userName), self::EXCEPTION_USERNAME_NOT_FOUND);
@@ -73,7 +73,7 @@ class Member extends BaseUser implements ManageableMember, Registerable, Updatea
 
        /**
         * Creates an instance of this user class by a provided email address. This
-        * factory method will not check if the email address is there.
+        * factory method will not check if email address is there.
         *
         * @param       $email                  Email address of the user
         * @return      $userInstance   An instance of this user class
index 2261c0f2a71d6a03629ca02e5d41c25b9c1cf55a..e3202603aba1317a735a0bfbf02dcc37b2206f3a 100644 (file)
@@ -2,8 +2,8 @@
 /**
  * A class for the configuration stuff implemented in a singleton design paddern
  *
- * NOTE: We cannot put this in inc/classes/ because it would be loaded (again)
- * in the class loader. See inc/loader/class_ClassLoader.php for instance
+ * NOTE: We cannot put this in inc/classes/ because it would be loaded (again) in
+ * class loader. See inc/loader/class_ClassLoader.php for instance
  *
  * @see                        ClassLoader
  * @author             Roland Haeder <webmaster@ship-simu.org>