]> git.mxchange.org Git - shipsimu.git/commitdiff
Actions (so called sub-commands) may now have own pre/post filter, profile update...
authorRoland Häder <roland@mxchange.org>
Fri, 20 Jun 2008 21:25:48 +0000 (21:25 +0000)
committerRoland Häder <roland@mxchange.org>
Fri, 20 Jun 2008 21:25:48 +0000 (21:25 +0000)
64 files changed:
.gitattributes
application/ship-simu/class_ApplicationHelper.php
application/ship-simu/config.php
application/ship-simu/main/commands/web/class_WebShipsimuGuestLoginCommand.php
application/ship-simu/main/commands/web/class_WebShipsimuProfileCommand.php
application/ship-simu/main/commands/web/class_WebShipsimuRegisterCommand.php
application/ship-simu/main/commands/web/class_WebShipsimuUserLoginCommand.php
application/ship-simu/main/registration/class_ShipSimuRegistration.php
inc/classes/exceptions/actions/.htaccess [new file with mode: 0644]
inc/classes/exceptions/actions/class_InvalidActionException.php [new file with mode: 0644]
inc/classes/exceptions/controller/class_InvalidControllerException.php [new file with mode: 0644]
inc/classes/exceptions/user/class_AccountPasswordMismatchException.php [new file with mode: 0644]
inc/classes/interfaces/actions/commands/.htaccess [new file with mode: 0644]
inc/classes/interfaces/actions/commands/class_Commandable.php [new file with mode: 0644]
inc/classes/interfaces/commands/.htaccess [deleted file]
inc/classes/interfaces/commands/class_Commandable.php [deleted file]
inc/classes/interfaces/resolver/actions/.htaccess [new file with mode: 0644]
inc/classes/interfaces/resolver/actions/class_ActionResolver.php [new file with mode: 0644]
inc/classes/interfaces/resolver/class_Resolver.php [new file with mode: 0644]
inc/classes/interfaces/resolver/commands/.htaccess [new file with mode: 0644]
inc/classes/interfaces/resolver/commands/class_CommandResolver.php [new file with mode: 0644]
inc/classes/interfaces/resolver/controller/.htaccess [new file with mode: 0644]
inc/classes/interfaces/resolver/controller/class_ControllerResolver.php [new file with mode: 0644]
inc/classes/main/actions/web/.htaccess [new file with mode: 0644]
inc/classes/main/actions/web/class_WebLoginProfileAction.php [new file with mode: 0644]
inc/classes/main/class_BaseFrameworkSystem.php
inc/classes/main/commands/class_BaseCommand.php
inc/classes/main/commands/web/class_WebDoFormCommand.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/class_BaseController.php
inc/classes/main/controller/default/class_WebDefaultController.php
inc/classes/main/controller/default/class_WebDefaultNewsController.php
inc/classes/main/controller/default/class_WebLoginController.php
inc/classes/main/controller/default/class_WebLoginFailedController.php
inc/classes/main/controller/form/class_WebDoFormController.php
inc/classes/main/controller/login/class_WebLoginAreaController.php
inc/classes/main/filter/change/class_EmailChangeFilter.php
inc/classes/main/filter/change/class_PasswordChangeFilter.php
inc/classes/main/filter/validator/class_PasswordValidatorFilter.php
inc/classes/main/filter/verifier/class_AccountPasswordVerifierFilter.php [new file with mode: 0644]
inc/classes/main/filter/verifier/class_UserStatusVerifierFilter.php [new file with mode: 0644]
inc/classes/main/resolver/action/.htaccess [new file with mode: 0644]
inc/classes/main/resolver/action/class_BaseActionResolver.php [new file with mode: 0644]
inc/classes/main/resolver/action/web/.htaccess [new file with mode: 0644]
inc/classes/main/resolver/action/web/class_WebActionResolver.php [new file with mode: 0644]
inc/classes/main/resolver/class_BaseResolver.php
inc/classes/main/resolver/command/.htaccess [new file with mode: 0644]
inc/classes/main/resolver/command/class_BaseCommandResolver.php [new file with mode: 0644]
inc/classes/main/resolver/command/class_WebCommandResolver.php [new file with mode: 0644]
inc/classes/main/resolver/command/web/.htaccess [new file with mode: 0644]
inc/classes/main/resolver/command/web/class_WebCommandResolver.php [new file with mode: 0644]
inc/classes/main/resolver/controller/.htaccess [new file with mode: 0644]
inc/classes/main/resolver/controller/class_BaseControllerResolver.php [new file with mode: 0644]
inc/classes/main/resolver/controller/web/.htaccess [new file with mode: 0644]
inc/classes/main/resolver/controller/web/class_WebControllerResolver.php [new file with mode: 0644]
inc/classes/main/resolver/web/.htaccess [deleted file]
inc/classes/main/resolver/web/class_WebCommandResolver.php [deleted file]
inc/classes/main/resolver/web/class_WebControllerResolver.php [deleted file]
inc/config.php

index 360ab57292f2bb9e988f8a80d808f28df935f936..fe0f6a6c9f920e7e02ef84e06b7a2f0a7281c715 100644 (file)
@@ -165,6 +165,8 @@ inc/.htaccess -text
 inc/classes.php -text
 inc/classes/.htaccess -text
 inc/classes/exceptions/.htaccess -text
+inc/classes/exceptions/actions/.htaccess -text
+inc/classes/exceptions/actions/class_InvalidActionException.php -text
 inc/classes/exceptions/auth/.htaccess -text
 inc/classes/exceptions/auth/class_UserAuthorizationException.php -text
 inc/classes/exceptions/class_ -text
@@ -177,6 +179,7 @@ inc/classes/exceptions/container/class_ContainerItemIsNullException.php -text
 inc/classes/exceptions/container/class_ContainerMaybeDamagedException.php -text
 inc/classes/exceptions/controller/.htaccess -text
 inc/classes/exceptions/controller/class_DefaultControllerException.php -text
+inc/classes/exceptions/controller/class_InvalidControllerException.php -text
 inc/classes/exceptions/criteria/.htaccess -text
 inc/classes/exceptions/database/.htaccess -text
 inc/classes/exceptions/database/class_DatabaseException.php -text
@@ -251,12 +254,15 @@ inc/classes/exceptions/template/class_UnexpectedTemplateTypeException.php -text
 inc/classes/exceptions/template/class_UnsupportedTemplateEngineException.php -text
 inc/classes/exceptions/template/class_ViewHelperNotFoundException.php -text
 inc/classes/exceptions/user/.htaccess -text
+inc/classes/exceptions/user/class_AccountPasswordMismatchException.php -text
 inc/classes/exceptions/user/class_UserEmailMissingException.php -text
 inc/classes/exceptions/user/class_UserPasswordMismatchException.php -text
 inc/classes/exceptions/user/class_UsernameMissingException.php -text
 inc/classes/interfaces/.htaccess -text
 inc/classes/interfaces/actions/.htaccess -text
 inc/classes/interfaces/actions/class_PerformableAction.php -text
+inc/classes/interfaces/actions/commands/.htaccess -text
+inc/classes/interfaces/actions/commands/class_Commandable.php -text
 inc/classes/interfaces/application/.htaccess -text
 inc/classes/interfaces/application/class_ManageableApplication.php -text
 inc/classes/interfaces/auth/.htaccess -text
@@ -265,8 +271,6 @@ inc/classes/interfaces/cache/.htaccess -text
 inc/classes/interfaces/cache/class_Cacheable.php -text
 inc/classes/interfaces/class_ -text
 inc/classes/interfaces/class_FrameworkInterface.php -text
-inc/classes/interfaces/commands/.htaccess -text
-inc/classes/interfaces/commands/class_Commandable.php -text
 inc/classes/interfaces/compressor/.htaccess -text
 inc/classes/interfaces/compressor/class_Compressor.php -text
 inc/classes/interfaces/controller/.htaccess -text
@@ -310,8 +314,15 @@ inc/classes/interfaces/registry/class_Registerable.php -text
 inc/classes/interfaces/request/.htaccess -text
 inc/classes/interfaces/request/class_Requestable.php -text
 inc/classes/interfaces/resolver/.htaccess -text
+inc/classes/interfaces/resolver/actions/.htaccess -text
+inc/classes/interfaces/resolver/actions/class_ActionResolver.php -text
 inc/classes/interfaces/resolver/class_CommandResolver.php -text
 inc/classes/interfaces/resolver/class_ControllerResolver.php -text
+inc/classes/interfaces/resolver/class_Resolver.php -text
+inc/classes/interfaces/resolver/commands/.htaccess -text
+inc/classes/interfaces/resolver/commands/class_CommandResolver.php -text
+inc/classes/interfaces/resolver/controller/.htaccess -text
+inc/classes/interfaces/resolver/controller/class_ControllerResolver.php -text
 inc/classes/interfaces/response/.htaccess -text
 inc/classes/interfaces/response/class_Responseable.php -text
 inc/classes/interfaces/result/.htaccess -text
@@ -328,6 +339,8 @@ inc/classes/main/actions/class_ -text
 inc/classes/main/actions/class_BaseAction.php -text
 inc/classes/main/actions/post_registration/.htaccess -text
 inc/classes/main/actions/post_registration/class_LoginAfterRegistrationAction.php -text
+inc/classes/main/actions/web/.htaccess -text
+inc/classes/main/actions/web/class_WebLoginProfileAction.php -text
 inc/classes/main/auth/.htaccess -text
 inc/classes/main/auth/class_CookieAuth.php -text
 inc/classes/main/cache/.htaccess -text
@@ -422,9 +435,11 @@ inc/classes/main/filter/validator/class_EmailValidatorFilter.php -text
 inc/classes/main/filter/validator/class_PasswordValidatorFilter.php -text
 inc/classes/main/filter/validator/class_UserNameValidatorFilter.php -text
 inc/classes/main/filter/verifier/.htaccess -text
+inc/classes/main/filter/verifier/class_AccountPasswordVerifierFilter.php -text
 inc/classes/main/filter/verifier/class_EmailValidatorFilter.php -text
 inc/classes/main/filter/verifier/class_PasswordVerifierFilter.php -text
 inc/classes/main/filter/verifier/class_UserNameVerifierFilter.php -text
+inc/classes/main/filter/verifier/class_UserStatusVerifierFilter.php -text
 inc/classes/main/helper/.htaccess -text
 inc/classes/main/helper/class_ -text
 inc/classes/main/helper/class_BaseHelper.php -text
@@ -451,10 +466,20 @@ inc/classes/main/registry/class_Registry.php -text
 inc/classes/main/request/.htaccess -text
 inc/classes/main/request/class_HttpRequest.php -text
 inc/classes/main/resolver/.htaccess -text
+inc/classes/main/resolver/action/.htaccess -text
+inc/classes/main/resolver/action/class_BaseActionResolver.php -text
+inc/classes/main/resolver/action/web/.htaccess -text
+inc/classes/main/resolver/action/web/class_WebActionResolver.php -text
 inc/classes/main/resolver/class_BaseResolver.php -text
-inc/classes/main/resolver/web/.htaccess -text
-inc/classes/main/resolver/web/class_WebCommandResolver.php -text
-inc/classes/main/resolver/web/class_WebControllerResolver.php -text
+inc/classes/main/resolver/command/.htaccess -text
+inc/classes/main/resolver/command/class_BaseCommandResolver.php -text
+inc/classes/main/resolver/command/class_WebCommandResolver.php -text
+inc/classes/main/resolver/command/web/.htaccess -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
+inc/classes/main/resolver/controller/web/.htaccess -text
+inc/classes/main/resolver/controller/web/class_WebControllerResolver.php -text
 inc/classes/main/response/.htaccess -text
 inc/classes/main/response/class_HttpResponse.php -text
 inc/classes/main/result/.htaccess -text
index ab372a5f8cb3a0a6cc27b4609ba38a86b4171108..32bd7649120547a880d2563198ed87353a850153 100644 (file)
@@ -193,7 +193,7 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica
                $this->setResponseInstance($responseInstance);
 
                // Get the parameter from the request
-               $commandName = $requestInstance->getRequestElement("page");
+               $commandName = $requestInstance->getRequestElement('page');
 
                // If it is null then get default command
                if (is_null($commandName)) {
@@ -204,7 +204,7 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica
                $resolverInstance = WebControllerResolver::createWebControllerResolver($commandName, $this);
 
                // Get a controller instance as well
-               $this->controllerInstance = $resolverInstance->resolveCommandController();
+               $this->controllerInstance = $resolverInstance->resolveController();
 
                // Handle the request
                $this->controllerInstance->handleRequest($requestInstance, $responseInstance);
index cef723c99136cddd4954a6fc2118ebaa4723326e..6210fb067026fdd727fdf3ad0be8d5ca5e2911e8 100644 (file)
@@ -77,11 +77,14 @@ $cfg->setConfigEntry('user_login_class', "ShipSimuUserLogin");
 $cfg->setConfigEntry('guest_login_class', "ShipSimuGuestLogin");
 
 // CFG: USER-STATUS-REGISTER
-$cfg->setConfigEntry('user_status_register', "UNCONFIRMED");
+$cfg->setConfigEntry('user_status_unconfirmed', "UNCONFIRMED");
 
-// CFG: GUEST-STATUS
+// CFG: USER-STATUS-GUEST
 $cfg->setConfigEntry('user_status_guest', "GUEST");
 
+// CFG: USER-STATUS-CONFIRMED
+$cfg->setConfigEntry('user_status_confirmed', "CONFIRMED");
+
 // CFG: LOGIN-HELPER
 $cfg->setConfigEntry('login_helper_class', "ShipSimuLoginHelper");
 
@@ -97,6 +100,9 @@ $cfg->setConfigEntry('login_failed_url', "index.php?app=ship-simu&page=login_fai
 // CFG: LOGOUT-DONE-URL
 $cfg->setConfigEntry('logout_done_url', "index.php?app=ship-simu&page=logout_done");
 
+// CFG: LOGIN-USER-STATUS-URL
+$cfg->setConfigEntry('login_user_status_url', "index.php?app=ship-simu&page=login_status_problem");
+
 // CFG: LOGIN-DEFAULT-ACTION
 $cfg->setConfigEntry('login_default_action', "welcome");
 
index 2fd8165f7500c7f9cd33bf729ed46c26e5185a1d..0ed651a6957e8cdec1452707f6609001d0f8f4fe 100644 (file)
@@ -98,9 +98,10 @@ class WebShipsimuGuestLoginCommand extends BaseCommand implements Commandable {
         * 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
         */
-       function addExtraFilters (Controller $controllerInstance) {
+       public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
                // Which login type do we have?
                switch ($this->getConfigInstance()->readConfig('login_type')) {
                        case "username": // Login via username
index fe1f6c2c3d57e41813414f1743afc607a10ee7e6..320c1d5de17ddd4303072306485f40f2ef75f675 100644 (file)
@@ -120,14 +120,17 @@ class WebShipsimuProfileCommand extends BaseCommand implements Commandable {
         * 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
         */
-       function addExtraFilters (Controller $controllerInstance) {
+       public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
                // Add user auth filter (we don't need an update of the user here because it will be redirected)
                $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_auth_class'));
 
                /* @TODO Add some more pre/post filters to the controller */
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_class'));
                $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('rules_accepted_class'));
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('account_password_class'));
                $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('email_change_class'));
                $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('password_change_class'));
        }
index 61c537aa6d7bf8fdeaf666cc345a53b0b0fb610c..b8c7b612f7daf9f69ec01ccc80bf6cf5f5cf86f4 100644 (file)
@@ -95,9 +95,10 @@ class WebShipsimuRegisterCommand extends BaseCommand implements Commandable {
         * 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
         */
-       function addExtraFilters (Controller $controllerInstance) {
+       public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
                /* @TODO Add some more pre/post filters to the controller */
                $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('email_validator_class'));
                $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_validator_class'));
index 2eff7322c6eee3c463d1a38b5b66b40e9cdc1970..a9d252ef0491735be335504ce43b45e3383f05c6 100644 (file)
@@ -98,9 +98,10 @@ class WebShipsimuUserLoginCommand extends BaseCommand implements Commandable {
         * 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
         */
-       function addExtraFilters (Controller $controllerInstance) {
+       public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
                // Which login type do we have?
                switch ($this->getConfigInstance()->readConfig('login_type')) {
                        case "username": // Login via username
index eac7106f6a4944d74be64a6ea2f446fa60d772ee..9dc9fb372f3f7ccf59165919944b44d5249b316e 100644 (file)
@@ -157,7 +157,7 @@ class ShipSimuRegistration extends BaseRegistration {
         */
        public function addElementsToDataSet (StoreableCriteria $criteriaInstance) {
                // Default is user account!
-               $configEntry = 'user_status_register';
+               $configEntry = 'user_status_unconfirmed';
 
                // Add a lot elements to the dataset criteria
                foreach ($this->criteriaElements as $alias=>$element) {
diff --git a/inc/classes/exceptions/actions/.htaccess b/inc/classes/exceptions/actions/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/classes/exceptions/actions/class_InvalidActionException.php b/inc/classes/exceptions/actions/class_InvalidActionException.php
new file mode 100644 (file)
index 0000000..4aa1b96
--- /dev/null
@@ -0,0 +1,46 @@
+<?php
+/**
+ * This exception is thrown when a requested action is invalid
+ *
+ * @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 InvalidActionException extends FrameworkException {
+       /**
+        * The super constructor for all exceptions
+        *
+        * @param               $msgArray       An array with message parts
+        * @param               $code           An optional code for better debugging
+        * @return      void
+        */
+       public function __construct(array $msgArray, $code) {
+               // Prepare the message
+               $message = sprintf("[%s:%d] Cannot resolve action <u>%s</u>.",
+                       $msgArray[0]->__toString(),
+                       $this->getLine(),
+                       $msgArray[1]
+               );
+
+               // Call parent contructor with message
+               parent::__construct($message, $code);
+       }
+}
+
+// [EOF]
+?>
diff --git a/inc/classes/exceptions/controller/class_InvalidControllerException.php b/inc/classes/exceptions/controller/class_InvalidControllerException.php
new file mode 100644 (file)
index 0000000..f221696
--- /dev/null
@@ -0,0 +1,46 @@
+<?php
+/**
+ * This exception is thrown when the default controller is missing
+ *
+ * @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 InvalidControllerException extends FrameworkException {
+       /**
+        * The super constructor for all exceptions
+        *
+        * @param               $msgArray       An array with message parts
+        * @param               $code           An optional code for better debugging
+        * @return      void
+        */
+       public function __construct(array $msgArray, $code) {
+               // Prepare the message
+               $message = sprintf("[%s:%d] Cannot resolve controller <u>%s</u>.",
+                       $msgArray[0]->__toString(),
+                       $this->getLine(),
+                       $msgArray[1]
+               );
+
+               // Call parent contructor with message
+               parent::__construct($message, $code);
+       }
+}
+
+// [EOF]
+?>
diff --git a/inc/classes/exceptions/user/class_AccountPasswordMismatchException.php b/inc/classes/exceptions/user/class_AccountPasswordMismatchException.php
new file mode 100644 (file)
index 0000000..10b873b
--- /dev/null
@@ -0,0 +1,45 @@
+<?php
+/**
+ * A class for mismatching passwords
+ *
+ * @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 AccountPasswordMismatchException extends FrameworkException {
+       /**
+        * The super constructor for all exceptions
+        *
+        * @param               $filterInstance         A filterable class instance
+        * @param               $code                           An optional code for better debugging
+        * @return      void
+        */
+       public function __construct(Filterable $filterInstance, $code) {
+               // Create the message
+               $message = sprintf("[%s:%d] Supplied account password did not match with stored.",
+                       $filterInstance->__toString(),
+                       $this->getLine()
+               );
+
+               // Make sure everything is assigned properly
+               parent::__construct($message, $code);
+       }
+}
+
+// [EOF]
+?>
diff --git a/inc/classes/interfaces/actions/commands/.htaccess b/inc/classes/interfaces/actions/commands/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/classes/interfaces/actions/commands/class_Commandable.php b/inc/classes/interfaces/actions/commands/class_Commandable.php
new file mode 100644 (file)
index 0000000..7b5beea
--- /dev/null
@@ -0,0 +1,36 @@
+<?php
+/**
+ * An interface for commands for the front controller
+ *
+ * @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/>.
+ */
+interface Commandable extends PerformableAction {
+       /**
+        * 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
+        */
+       function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance);
+}
+
+//
+?>
diff --git a/inc/classes/interfaces/commands/.htaccess b/inc/classes/interfaces/commands/.htaccess
deleted file mode 100644 (file)
index 3a42882..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Deny from all
diff --git a/inc/classes/interfaces/commands/class_Commandable.php b/inc/classes/interfaces/commands/class_Commandable.php
deleted file mode 100644 (file)
index fa87963..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-/**
- * An interface for commands for the front controller
- *
- * @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/>.
- */
-interface Commandable extends FrameworkInterface {
-       /**
-        * 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
-        */
-       function execute (Requestable $requestInstance, Responseable $responseInstance);
-
-       /**
-        * Adds extra filters to the given controller instance
-        *
-        * @param       $controllerInstance             A controller instance
-        * @return      void
-        */
-       function addExtraFilters (Controller $controllerInstance);
-}
-
-//
-?>
diff --git a/inc/classes/interfaces/resolver/actions/.htaccess b/inc/classes/interfaces/resolver/actions/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/classes/interfaces/resolver/actions/class_ActionResolver.php b/inc/classes/interfaces/resolver/actions/class_ActionResolver.php
new file mode 100644 (file)
index 0000000..289d508
--- /dev/null
@@ -0,0 +1,51 @@
+<?php
+/**
+ * An instance for action resolver classes
+ *
+ * @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/>.
+ */
+interface ActionResolver extends Resolver {
+       /**
+        * Returns an action instance for the current action
+        *
+        * @return      $actionInstance         An instance of the resolved action
+        */
+       function resolveAction ();
+
+       /**
+        * Returns an action instance for a given request class
+        *
+        * @param       $requestInstance        An instance of a request class
+        * @return      $actionInstance         An instance of the resolved action
+        */
+       function resolveActionByRequest (Requestable $requestInstance);
+
+       /**
+        * Checks wether the given action is valid
+        *
+        * @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
+        */
+       function isActionValid ($actionName);
+}
+
+//
+?>
diff --git a/inc/classes/interfaces/resolver/class_Resolver.php b/inc/classes/interfaces/resolver/class_Resolver.php
new file mode 100644 (file)
index 0000000..8d4a533
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+/**
+ * An interface for all resolvers
+ *
+ * @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/>.
+ */
+interface Resolver extends FrameworkInterface {
+}
+
+//
+?>
diff --git a/inc/classes/interfaces/resolver/commands/.htaccess b/inc/classes/interfaces/resolver/commands/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/classes/interfaces/resolver/commands/class_CommandResolver.php b/inc/classes/interfaces/resolver/commands/class_CommandResolver.php
new file mode 100644 (file)
index 0000000..bab8903
--- /dev/null
@@ -0,0 +1,44 @@
+<?php
+/**
+ * An instance for command resolver classes
+ *
+ * @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/>.
+ */
+interface CommandResolver extends Resolver {
+       /**
+        * Returns an command instance for a given request class
+        *
+        * @param       $requestInstance        An instance of a request class
+        * @return      $commandInstance        An instance of the resolved command
+        */
+       function resolveCommandByRequest (Requestable $requestInstance);
+
+       /**
+        * Checks wether the given command is valid
+        *
+        * @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
+        */
+       function isCommandValid ($commandName);
+}
+
+//
+?>
diff --git a/inc/classes/interfaces/resolver/controller/.htaccess b/inc/classes/interfaces/resolver/controller/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/classes/interfaces/resolver/controller/class_ControllerResolver.php b/inc/classes/interfaces/resolver/controller/class_ControllerResolver.php
new file mode 100644 (file)
index 0000000..be95234
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+/**
+ * An instance for controller resolver classes
+ *
+ * @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/>.
+ */
+interface ControllerResolver extends Resolver {
+       /**
+        * Resolves the default controller of the given command
+        *
+        * @return      $controllerInstance             A controller instance for the default command
+        */
+        function resolveController ();
+}
+
+//
+?>
diff --git a/inc/classes/main/actions/web/.htaccess b/inc/classes/main/actions/web/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/classes/main/actions/web/class_WebLoginProfileAction.php b/inc/classes/main/actions/web/class_WebLoginProfileAction.php
new file mode 100644 (file)
index 0000000..8a8532f
--- /dev/null
@@ -0,0 +1,83 @@
+<?php
+/**
+ * An action for the profile page in login area
+ *
+ * @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 WebLoginProfileAction extends BaseAction implements Commandable, Registerable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Set description
+               $this->setObjectDescription("Web profile action");
+
+               // Generate unique key
+               $this->generateUniqueId();
+       }
+
+       /**
+        * 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 createWebLoginProfileAction (ActionResolver $resolverInstance) {
+               // Get a new instance
+               $actionInstance = new WebLoginProfileAction();
+
+               // 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
+        */
+       public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+               // Dummy method
+       }
+
+       /**
+        * Adds extra filters to the given controller instance
+        *
+        * @param       $controllerInstance             A controller instance
+        * @param       $requestInstance                An instance of a class with an Requestable interface
+        * @return      void
+        */
+       public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
+               // Add user status filter here
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_class'));
+       }
+}
+
+// [EOF]
+?>
index b725a85658143712d8edd560802c46ff2aad221b..a828dc7deee1be148fca3f1c390309cf2153d06a 100644 (file)
@@ -48,6 +48,16 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         */
        private $searchInstance = null;
 
+       /**
+        * The file I/O instance for the template loader
+        */
+       private $fileIoInstance = null;
+
+       /**
+        * Resolver instance
+        */
+       private $resolverInstance = null;
+
        /**
         * The real class name
         */
@@ -73,11 +83,6 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         */
        private $decimals  = ","; // German
 
-       /**
-        * The file I/O instance for the template loader
-        */
-       private $fileIoInstance = null;
-
        /***********************
         * Exception codes.... *
         ***********************/
@@ -130,14 +135,12 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
        const EXCEPTION_MISSING_LANGUAGE_HANDLER     = 0x02e;
        const EXCEPTION_MISSING_FILE_IO_HANDLER      = 0x02f;
        const EXCEPTION_MISSING_ELEMENT              = 0x030;
-       const EXCEPTION_INVALID_COMMAND              = 0x031;
-       const EXCEPTION_INVALID_CONTROLLER           = 0x032;
-       const EXCEPTION_HEADERS_ALREADY_SENT         = 0x033;
-       const EXCEPTION_DEFAUL_CONTROLLER_GONE       = 0x034;
-       const EXCEPTION_CLASS_NOT_FOUND              = 0x035;
-       const EXCEPTION_REQUIRED_INTERFACE_MISSING   = 0x036;
-       const EXCEPTION_FATAL_ERROR                  = 0x037;
-       const EXCEPTION_FILE_NOT_FOUND               = 0x038;
+       const EXCEPTION_HEADERS_ALREADY_SENT         = 0x031;
+       const EXCEPTION_DEFAUL_CONTROLLER_GONE       = 0x032;
+       const EXCEPTION_CLASS_NOT_FOUND              = 0x033;
+       const EXCEPTION_REQUIRED_INTERFACE_MISSING   = 0x034;
+       const EXCEPTION_FATAL_ERROR                  = 0x035;
+       const EXCEPTION_FILE_NOT_FOUND               = 0x036;
 
        /**
         * In the super constructor these system classes shall be ignored or else
@@ -992,6 +995,25 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
        public final function getSearchInstance () {
                return $this->searchInstance;
        }
+
+       /**
+        * Setter for resolver instance
+        *
+        * @param       $resolverInstance               Instance of a command resolver class
+        * @return      void
+        */
+       public final function setResolverInstance (Resolver $resolverInstance) {
+               $this->resolverInstance = $resolverInstance;
+       }
+
+       /**
+        * Getter for resolver instance
+        *
+        * @return      $resolverInstance               Instance of a command resolver class
+        */
+       public final function getResolverInstance () {
+               return $this->resolverInstance;
+       }
 }
 
 // [EOF]
index 825b2b052f7944346105cfae40f92fb2cbad5bd9..505d8adab68b3a7ba50f073614952ca01da88970 100644 (file)
@@ -27,11 +27,6 @@ class BaseCommand extends BaseFrameworkSystem {
         */
        private $controllerName = "";
 
-       /**
-        * Resolver instance
-        */
-       private $resolverInstance = null;
-
        /**
         * Protected constructor
         *
@@ -60,25 +55,6 @@ class BaseCommand extends BaseFrameworkSystem {
        public final function getControllerName () {
                return $this->controllerName;
        }
-
-       /**
-        * Setter for resolver instance
-        *
-        * @param       $resolverInstance               Instance of a command resolver class
-        * @return      void
-        */
-       public final function setResolverInstance (CommandResolver $resolverInstance) {
-               $this->resolverInstance = $resolverInstance;
-       }
-
-       /**
-        * Getter for resolver instance
-        *
-        * @return      $resolverInstance               Instance of a command resolver class
-        */
-       public final function getResolverInstance () {
-               return $this->resolverInstance;
-       }
 }
 
 // [EOF]
index dfd7b2cfc7ec4933058d8991fb50ead099435cd9..3dde736e3c61adf3564cfcf9dfb61c3b3f8b13c3 100644 (file)
@@ -74,9 +74,10 @@ class WebDoFormCommand extends BaseCommand implements Commandable {
         * 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
         */
-       function addExtraFilters (Controller $controllerInstance) {
+       public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
                // Empty for now
        }
 
index 704ee5fff950425a9c4d4d346480847c2f2453fb..d04e77a07e07282dc300a5747fb2b1a3baa70ee3 100644 (file)
@@ -114,9 +114,10 @@ class WebHomeCommand extends BaseCommand implements Commandable {
         * 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
         */
-       function addExtraFilters (Controller $controllerInstance) {
+       public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
                // Empty for now
        }
 }
index 146623d24ecae9e0aa4fef6fe792f3a86d597b56..1143d22136a2772fa8ddb6429d850e95e4abe252 100644 (file)
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 class WebLoginAreaCommand extends BaseCommand implements Commandable {
+       /**
+        * Name of the action
+        */
+       private $actionName = "";
+
        /**
         * Protected constructor
         *
@@ -78,22 +83,8 @@ class WebLoginAreaCommand extends BaseCommand implements Commandable {
         * @return      void
         */
        public function execute (Requestable $requestInstance, Responseable $responseInstance) {
-               // Default action is the one from configuration
-               $actionClass = sprintf("login_%s_action_class", $this->getConfigInstance()->readConfig('login_default_action'));
-               $action = sprintf("login_%s", $this->getConfigInstance()->readConfig('login_default_action'));
-
-               // Get "action" from request
-               $actReq = $requestInstance->getRequestElement('action');
-
-               // Do we have a "action" parameter set?
-               if (is_string($actReq)) {
-                       // Then use it with prefix
-                       $actionClass = sprintf("login_%s_action_class", $actReq);
-                       $action = sprintf("login_%s", $actReq);
-               } // END - if
-
-               // Get an action instance
-               $actionInstance = ObjectFactory::createObjectByConfiguredName($actionClass);
+               // Get the action instance from registry
+               $actionInstance = Registry::getRegistry()->getInstance('action');
 
                // Execute the action (shall not output anything, see below why)
                $actionInstance->execute($requestInstance, $responseInstance);
@@ -128,11 +119,11 @@ class WebLoginAreaCommand extends BaseCommand implements Commandable {
                $templateInstance->assignTemplateWithVariable("footer", "footer");
 
                // Load the matching template
-               $templateInstance->loadCodeTemplate($action);
+               $templateInstance->loadCodeTemplate($this->actionName);
 
                // Assign the template with the master template as a content ... ;)
                $templateInstance->compileTemplate();
-               $templateInstance->assignTemplateWithVariable($action, "login_content");
+               $templateInstance->assignTemplateWithVariable($this->actionName, "login_content");
 
                // Load main template
                $templateInstance->loadCodeTemplate("login_main");
@@ -145,7 +136,7 @@ class WebLoginAreaCommand extends BaseCommand implements Commandable {
                $templateInstance->loadCodeTemplate($masterTemplate);
 
                // Set title
-               $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage($action."_title"));
+               $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage($this->actionName."_title"));
 
                // ... and all variables. This should be merged together in a pattern
                // to make things easier. A cache mechanism should be added between
@@ -161,10 +152,44 @@ class WebLoginAreaCommand extends BaseCommand implements Commandable {
         * 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
         */
-       function addExtraFilters (Controller $controllerInstance) {
-               // Empty for now
+       public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
+               // Default is no action
+               $actionInstance = null;
+
+               // Default action is the one from configuration
+               $this->actionName = sprintf("login_%s", $this->getConfigInstance()->readConfig('login_default_action'));
+
+               // Get "action" from request
+               $actReq = $requestInstance->getRequestElement('action');
+
+               // Do we have a "action" parameter set?
+               if ((is_string($actReq)) && (!empty($actReq))) {
+                       // Then use it with prefix
+                       $this->actionName = sprintf("login_%s", $actReq);
+               } // END - if
+
+               // Get application instance
+               $applicationInstance = $this->getResolverInstance()->getApplicationInstance();
+
+               // Try to get an action resolver for the given action
+               try {
+                       // Get a resolver
+                       $actionResolver = WebActionResolver::createWebActionResolver($this->actionName, $applicationInstance);
+
+                       // Resolve the action
+                       $actionInstance = $actionResolver->resolveAction();
+
+                       // Add more action-specific filters
+                       $actionInstance->addExtraFilters($controllerInstance, $requestInstance);
+
+                       // Remember this action in registry
+                       Registry::getRegistry()->addInstance('action', $actionInstance);
+               } catch (InvalidActionException $e) {
+                       // Silently ignored because no special action was found
+               }
        }
 }
 
index b5a89acbfd72a0a33425f5b790d4be0a7d268349..6fadf047f33c010e7cd9594a1ff605289fe1d62d 100644 (file)
@@ -117,9 +117,10 @@ class WebLoginCommand extends BaseCommand implements Commandable {
         * 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
         */
-       function addExtraFilters (Controller $controllerInstance) {
+       public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
                // Empty for now
        }
 }
index c7baa753dfe3265bd5ffd5004b0d5c08f49acdab..eead89a417fcca894ed9dfca21192c27778a0189 100644 (file)
@@ -117,9 +117,10 @@ class WebLoginFailedCommand extends BaseCommand implements Commandable {
         * 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
         */
-       function addExtraFilters (Controller $controllerInstance) {
+       public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
                // Empty for now
        }
 }
index 5c38d0609c07910c2932b0209b7eb352d49ce101..3759b5ef4ddb636532692959239a516a77908b09 100644 (file)
@@ -117,9 +117,10 @@ class WebLogoutDoneCommand extends BaseCommand implements Commandable {
         * 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
         */
-       function addExtraFilters (Controller $controllerInstance) {
+       public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
                // Empty for now
        }
 }
index 2a50f5ecc247c1202919d37dc244f7c8fd1eade2..f4cc32548d184ba7a6de657f78bbb28349236fa1 100644 (file)
@@ -118,9 +118,10 @@ class WebRegisterCommand extends BaseCommand implements Commandable {
         * 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
         */
-       function addExtraFilters (Controller $controllerInstance) {
+       public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
                // Empty for now
        }
 }
index 4438cc216e60f0d61f44da6ed10b1928b31028c8..b2951f51e75fa7395297d14bff2963b5ea02c8d3 100644 (file)
  * 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 BaseController extends BaseFrameworkSystem {
-       /**
-        * Instance of a CommandResolver class
-        */
-       private $resolverInstance = null;
-
+class BaseController extends BaseFrameworkSystem implements Registerable {
        /**
         * Pre filter chain instance
         */
@@ -55,25 +50,9 @@ class BaseController extends BaseFrameworkSystem {
                // Initialize both filter chains
                $this->preFilterChain  = ObjectFactory::createObjectByConfiguredName('filter_chain_class');
                $this->postFilterChain = ObjectFactory::createObjectByConfiguredName('filter_chain_class');
-       }
 
-       /**
-        * Getter for a command resolver instance
-        *
-        * @return      $resolverInstance       An instance of a command resolver class
-        */
-       public final function getResolverInstance () {
-               return $this->resolverInstance;
-       }
-
-       /**
-        * Setter for a command resolver instance
-        *
-        * @param       $resolverInstance       An instance of a command resolver class
-        * @return      void
-        */
-       public final function setResolverInstance (CommandResolver $resolverInstance) {
-               $this->resolverInstance = $resolverInstance;
+               // Add this controller to the registry
+               Registry::getRegistry()->addInstance('controller', $this);
        }
 
        /**
index 59c51c3134964bb31c848b2dc500fb7a286e43a1..7f7e862f8ae24b1e28dcb8f7cf7d6b6bdb3489b6 100644 (file)
@@ -65,7 +65,7 @@ class WebDefaultController extends BaseController implements Controller {
         */
        public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) {
                // Get the command instance
-               $commandInstance = $this->getResolverInstance()->resolvCommandByRequest($requestInstance);
+               $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance);
 
                // This request was valid! :-D
                $requestInstance->requestIsValid();
index e0f506aacca7b99a0af62da8ce0952f8a744660e..03f29d2d3afb45cb790b5e92dd08f242e39b03d7 100644 (file)
@@ -68,10 +68,10 @@ class WebDefaultNewsController extends BaseController implements Controller {
         */
        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()->resolvCommandByRequest($requestInstance);
+               $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance);
 
                // Add more filters by the command
-               $commandInstance->addExtraFilters($this);
+               $commandInstance->addExtraFilters($this, $requestInstance);
 
                // Run the pre filters
                $this->executePreFilters($requestInstance, $responseInstance);
index 5bc762c89d419cc9e788e52f5866df68242f782e..0ec8c3bd4ec84404b48a12f62bd63b95a6ce54fe 100644 (file)
@@ -67,10 +67,10 @@ class WebLoginController extends BaseController implements Controller {
         */
        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()->resolvCommandByRequest($requestInstance);
+               $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance);
 
                // Add more filters by the command
-               $commandInstance->addExtraFilters($this);
+               $commandInstance->addExtraFilters($this, $requestInstance);
 
                // Run the pre filters
                $this->executePreFilters($requestInstance, $responseInstance);
index f3a7ce4cdf10f0c3fe265da750f563351c555397..3cd5d60634ea895f37f39d47496f4953c7ca95c3 100644 (file)
@@ -64,7 +64,7 @@ class WebLoginFailedController extends BaseController implements Controller {
         */
        public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) {
                // Get the command instance
-               $commandInstance = $this->getResolverInstance()->resolvCommandByRequest($requestInstance);
+               $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance);
 
                // This request was valid! :-D
                $requestInstance->requestIsValid();
index 42171a600a2618f2049446ec0652104f1af0f6ff..4d6a0b19e4a9290b94aca56dbe71164e0a9850ae 100644 (file)
@@ -73,7 +73,7 @@ class WebDoFormController extends BaseController implements Controller {
                $commandInstance = $this->getResolverInstance()->resolveCommand($formAction);
 
                // Add more filters by the command
-               $commandInstance->addExtraFilters($this);
+               $commandInstance->addExtraFilters($this, $requestInstance);
 
                // Try to run the pre filters, if auth exceptions come through redirect here
                try {
index 4bc6f29ec1ce17b4cbd7a019859b3b4a68c5f4c2..e14a0eee061cc5a2ce25ab9d36f4f961d1a56239 100644 (file)
@@ -78,10 +78,10 @@ class WebLoginAreaController extends BaseController implements Controller {
         */
        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()->resolvCommandByRequest($requestInstance);
+               $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance);
 
                // Add more filters by the command
-               $commandInstance->addExtraFilters($this);
+               $commandInstance->addExtraFilters($this, $requestInstance);
 
                // Try to run the pre filters, if auth exceptions come through redirect here
                try {
index 8005cc97119e563e696793f40964273a0fa68528..7e1dd57e94804216d81bf26e62b412a836c4fd6e 100644 (file)
@@ -63,8 +63,57 @@ class EmailChangeFilter extends BaseFrameworkSystem implements Filterable {
         * @return      void
         */
        public function execute (Requestable $requestInstance, Responseable $responseInstance) {
-               // Implement this!
-               $this->partialStub("Please implement this method.");
+               // Get both emails
+               $email1 = $requestInstance->getRequestElement('email1');
+               $email2 = $requestInstance->getRequestElement('email2');
+
+               // Is only first email set?
+               if ((!empty($email1)) && (empty($email2))) {
+                       // Request is invalid!
+                       $requestInstance->requestIsValid(false);
+
+                       // Email 2 is empty
+                       $responseInstance->addFatalMessage('email2_empty');
+
+                       // Stop processing here
+                       return false;
+               } // END - if
+
+               // Is only second email set?
+               if ((empty($email1)) && (!empty($email2))) {
+                       // Request is invalid!
+                       $requestInstance->requestIsValid(false);
+
+                       // Email 1 is empty
+                       $responseInstance->addFatalMessage('email1_empty');
+
+                       // Stop processing here
+                       return false;
+               } // END - if
+
+               // Do both match?
+               if ($email1 != $email2) {
+                       // Request is invalid!
+                       $requestInstance->requestIsValid(false);
+
+                       // Emails are mismatching
+                       $responseInstance->addFatalMessage('emails_mismatch');
+
+                       // Stop processing here
+                       return false;
+               } // END - if
+
+               // Now, get a user instance for comparison
+               $userInstance = Registry::getRegistry()->getInstance('user');
+
+               // Get the email field
+               $userEmail = $userInstance->getField('email');
+
+               // Are they different?
+               if ($email != $email1) {
+                       // Update the "new_email" field
+                       $this->partialStub("Unfinished part.");
+               } // END - if
        }
 }
 
index 353ad72f7c91092a38e130d03659ef6ec1887332..9c306bf94e3024028a1642f4d161b9b7979deb61 100644 (file)
@@ -63,8 +63,51 @@ class PasswordChangeFilter extends BaseFrameworkSystem implements Filterable {
         * @return      void
         */
        public function execute (Requestable $requestInstance, Responseable $responseInstance) {
-               // Implement this!
-               $this->partialStub("Please implement this method.");
+               // Get both passwords
+               $pass1 = $requestInstance->getRequestElement('pass1');
+               $pass2 = $requestInstance->getRequestElement('pass2');
+
+               // Is only first email set?
+               if ((!empty($pass1)) && (empty($pass2))) {
+                       // Request is invalid!
+                       $requestInstance->requestIsValid(false);
+
+                       // Email 2 is empty
+                       $responseInstance->addFatalMessage('pass2_empty');
+
+                       // Stop processing here
+                       return false;
+               } // END - if
+
+               // Is only second pass set?
+               if ((empty($pass1)) && (!empty($pass2))) {
+                       // Request is invalid!
+                       $requestInstance->requestIsValid(false);
+
+                       // Email 1 is empty
+                       $responseInstance->addFatalMessage('pass1_empty');
+
+                       // Stop processing here
+                       return false;
+               } // END - if
+
+               // Do both match?
+               if ($pass1 != $pass2) {
+                       // Request is invalid!
+                       $requestInstance->requestIsValid(false);
+
+                       // Emails are mismatching
+                       $responseInstance->addFatalMessage('pass_mismatch');
+
+                       // Stop processing here
+                       return false;
+               } // END - if
+
+               // Now, get a user instance for comparison
+               $userInstance = Registry::getRegistry()->getInstance('user');
+
+               // Update the "password" field
+               $this->partialStub("Unfinished part.");
        }
 }
 
index 1d371b1e82d14e7e31485b09d54fa5ce04503f67..b7092f9c649006a71f6bfd6e57a79d0d3220fe42 100644 (file)
@@ -81,13 +81,13 @@ class PasswordValidatorFilter extends BaseFilter implements Filterable {
                        // Is the password empty?
                        if (empty($password1)) {
                                // Add a message to the response
-                               $responseInstance->addFatalMessage('password1_empty');
+                               $responseInstance->addFatalMessage('pass1_empty');
                        } // END - if
 
                        // Is the confirmation empty?
                        if (empty($password2)) {
                                // Add a message to the response
-                               $responseInstance->addFatalMessage('password2_empty');
+                               $responseInstance->addFatalMessage('pass2_empty');
                        } // END - if
 
                        // Abort here
@@ -97,7 +97,7 @@ class PasswordValidatorFilter extends BaseFilter implements Filterable {
                        $requestInstance->requestIsValid(false);
 
                        // Add a message to the response
-                       $responseInstance->addFatalMessage('passwords_mismatching');
+                       $responseInstance->addFatalMessage('pass_mismatch');
 
                        // Abort here
                        return false;
diff --git a/inc/classes/main/filter/verifier/class_AccountPasswordVerifierFilter.php b/inc/classes/main/filter/verifier/class_AccountPasswordVerifierFilter.php
new file mode 100644 (file)
index 0000000..1525973
--- /dev/null
@@ -0,0 +1,106 @@
+<?php
+/**
+ * A concrete filter for validating the password. This filter may intercept
+ * the filter chain if no password is given or the password is invalid
+ *
+ * @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 AccountPasswordVerifierFilter extends BaseFilter implements Filterable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Set part description
+               $this->setObjectDescription("A filter for account password verification");
+
+               // Create unique ID number
+               $this->generateUniqueId();
+       }
+
+       /**
+        * Creates an instance of this filter class
+        *
+        * @return      $filterInstance         An instance of this filter class
+        */
+       public final static function createAccountPasswordVerifierFilter () {
+               // Get a new instance
+               $filterInstance = new AccountPasswordVerifierFilter();
+
+               // 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
+        * @throws      AccountPasswordMismatchException        If the account password does not match
+        */
+       public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+               // Get password
+               $password = $requestInstance->getRequestElement('pass_old');
+
+               // Is the password still not set?
+               if (is_null($password)) {
+                       // Not found in form so stop the filtering process
+                       $requestInstance->requestIsValid(false);
+
+                       // Add a message to the response
+                       $responseInstance->addFatalMessage('pass_old_unset');
+
+                       // Abort here
+                       return false;
+               } elseif (empty($password)) {
+                       // Password is empty
+                       $requestInstance->requestIsValid(false);
+
+                       // Add a message to the response
+                       $responseInstance->addFatalMessage('pass_old_empty');
+
+                       // Abort here
+                       return false;
+               }
+
+               // Get a user instance
+               $userInstance = Registry::getRegistry()->getInstance('user');
+
+               // Get old hash
+               $oldHash = $userInstance->getField('pass_hash');
+
+               // Get an encryption helper and encrypt the password
+               $passHash = ObjectFactory::createObjectByConfiguredName('crypto_class')->hashPassword($password, $oldHash);
+
+               // Does it match?
+               if ($oldHash != $passHash) {
+                       // Throw an exception here to stop the proccessing
+                       throw new AccountPasswordMismatchException($this, User::EXCEPTION_USER_PASS_MISMATCH);
+               } // END - if
+       }
+}
+
+// [EOF]
+?>
diff --git a/inc/classes/main/filter/verifier/class_UserStatusVerifierFilter.php b/inc/classes/main/filter/verifier/class_UserStatusVerifierFilter.php
new file mode 100644 (file)
index 0000000..a9ccbf0
--- /dev/null
@@ -0,0 +1,84 @@
+<?php
+/**
+ * A filter for checking if the user status is GUEST or CONFIRMED
+ *
+ * @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 UserStatusVerifierFilter extends BaseFrameworkSystem implements Filterable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Set part description
+               $this->setObjectDescription("A filter for email changes");
+
+               // Create unique ID number
+               $this->generateUniqueId();
+
+               // 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 createUserStatusVerifierFilter () {
+               // Get a new instance
+               $filterInstance = new UserStatusVerifierFilter();
+
+               // Return the instance
+               return $filterInstance;
+       }
+
+       /**
+        * Executes the filter with given request and response objects
+        *
+        * @param       $requestInstance        An instance of a class with an Requestable interface
+        * @param       $responseInstance       An instance of a class with an Responseable interface
+        * @return      void
+        */
+       public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+               // Get a user instance for comparison
+               $userInstance = Registry::getRegistry()->getInstance('user');
+
+               // Is the user account confirmed?
+               if (($userInstance->getField('user_status') != $this->getConfigInstance()->readConfig('user_status_confirmed')) && ($userInstance->getField('user_status') != $this->getConfigInstance()->readConfig('user_status_guest'))) {
+                       // Request is invalid!
+                       $requestInstance->requestIsValid(false);
+
+                       // Redirect to configured URL
+                       $responseInstance->redirectToConfiguredUrl('login_user_status_url');
+
+                       // Stop processing here
+                       exit();
+               } // END - if
+       }
+}
+
+// [EOF]
+?>
diff --git a/inc/classes/main/resolver/action/.htaccess b/inc/classes/main/resolver/action/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/classes/main/resolver/action/class_BaseActionResolver.php b/inc/classes/main/resolver/action/class_BaseActionResolver.php
new file mode 100644 (file)
index 0000000..2de5ec7
--- /dev/null
@@ -0,0 +1,138 @@
+<?php
+/**
+ * A generic action resolver class
+ *
+ * @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 BaseActionResolver extends BaseResolver {
+       /**
+        * Prefix for local, remote or other resolver
+        */
+       private $actionPrefix = "";
+
+       /**
+        * Validated action name
+        */
+       private $actionName = "";
+
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct ($className) {
+               // Call parent constructor
+               parent::__construct($className);
+       }
+
+       /**
+        * Setter for action prefix
+        *
+        * @param       $actionPrefix   Last validated actionPrefix
+        * @return      void
+        */
+       protected final function setActionPrefix ($actionPrefix) {
+               $this->actionPrefix = $actionPrefix;
+       }
+
+       /**
+        * Setter for action name
+        *
+        * @param       $actionName     Last validated action name
+        * @return      void
+        */
+       protected final function setActionName ($actionName) {
+               $this->actionName = $actionName;
+       }
+
+       /**
+        * Getter for action name
+        *
+        * @return      $actionName     Last validated action name
+        */
+       protected final function getActionName () {
+               return $this->actionName;
+       }
+
+       /**
+        * Checks wether the given action is valid
+        *
+        * @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
+        */
+       public function isActionValid ($actionName) {
+               // By default nothing shall be valid
+               $isValid = false;
+
+               // Is a action set?
+               if (empty($actionName)) {
+                       // Then thrown an exception here
+                       throw new EmptyVariableException(array($this, 'actionName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+               } // END - if
+
+               // Now, let us create the full name of the action class
+               $className = sprintf("%s%sAction",
+                       $this->actionPrefix,
+                       $this->convertToClassName($actionName)
+               );
+
+               // Is this class already loaded?
+               if (class_exists($className)) {
+                       // This class does exist. :-)
+                       $isValid = true;
+               } // END - if
+
+               // Debug output
+               //* DEBUG: */ $this->debugBacktrace();
+
+               // Set action name
+               $this->setActionName($actionName);
+
+               // Return the result
+               return $isValid;
+       }
+
+       /**
+        * "Loads" current action and instances it if not yet cached
+        *
+        * @return      $actionInstance                 A loaded action instance
+        * @throws      InvalidActionException  Thrown if even the default
+        *                                                                      action class is missing (bad!)
+        */
+       protected function loadAction () {
+               // Init action instance
+               $actionInstance = null;
+
+               // Create action class name
+               $className = sprintf("Web%sAction",
+                       $this->convertToClassName($this->getActionName())
+               );
+
+               // Initiate the action
+               $actionInstance = ObjectFactory::createObjectByName($className, array($this));
+
+               // Return the result
+               return $actionInstance;
+       }
+}
+
+// [EOF]
+?>
diff --git a/inc/classes/main/resolver/action/web/.htaccess b/inc/classes/main/resolver/action/web/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/classes/main/resolver/action/web/class_WebActionResolver.php b/inc/classes/main/resolver/action/web/class_WebActionResolver.php
new file mode 100644 (file)
index 0000000..43fda22
--- /dev/null
@@ -0,0 +1,153 @@
+<?php
+/**
+ * A action resolver for local (non-hubbed) actions
+ *
+ * @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 WebActionResolver extends BaseActionResolver implements ActionResolver {
+       /**
+        * Last successfull resolved action
+        */
+       private $lastActionInstance = "";
+
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Set part description
+               $this->setObjectDescription("Resolver for local web actions");
+
+               // Create unique ID number
+               $this->generateUniqueId();
+
+               // Set prefix to "Web"
+               $this->setActionPrefix("Web");
+       }
+
+       /**
+        * Creates an instance of a Web action resolver with a given default action
+        *
+        * @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
+        */
+       public final static function createWebActionResolver ($actionName, ManageableApplication $appInstance) {
+               // Create the new instance
+               $resolverInstance = new WebActionResolver();
+
+               // Is the variable $actionName set and the action is valid?
+               if (empty($actionName)) {
+                       // Then thrown an exception here
+                       throw new EmptyVariableException(array($resolverInstance, 'defaultAction'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+               } elseif (!$resolverInstance->isActionValid($actionName)) {
+                       // Invalid action found
+                       throw new InvalidActionException(array($resolverInstance, $actionName), self::EXCEPTION_INVALID_ACTION);
+               }
+
+               // Set the application instance
+               $resolverInstance->setApplicationInstance($appInstance);
+
+               // Return the prepared instance
+               return $resolverInstance;
+       }
+
+       /**
+        * Returns an action instance for a given request class or null if
+        * it was not found
+        *
+        * @param       $requestInstance        An instance of a request class
+        * @return      $actionInstance An instance of the resolved action
+        * @throws      InvalidActionException                          Thrown if $actionName is
+        *                                                                                              invalid
+        * @throws      InvalidActionInstanceException          Thrown if $actionInstance
+        *                                                                                              is an invalid instance
+        */
+       public function resolveActionByRequest (Requestable $requestInstance) {
+               // Init variables
+               $actionName = "";
+               $actionInstance = null;
+
+               // This goes fine so let's resolv the action
+               $actionName = $requestInstance->getRequestElement('action');
+
+               // 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
+               if (!$this->isActionValid($actionName)) {
+                       // This action is invalid!
+                       throw new InvalidActionException(array($this, $actionName), self::EXCEPTION_INVALID_ACTION);
+               } // END - if
+
+               // Get the action
+               $actionInstance = $this->loadAction();
+
+               // And validate it
+               if ((!is_object($actionInstance)) || (!$actionInstance instanceof Actionable)) {
+                       // This action has an invalid instance!
+                       throw new InvalidActionInstanceException(array($this, $actionName), self::EXCEPTION_INVALID_ACTION);
+               } // END - if
+
+               // Set last action
+               $this->lastActionInstance = $actionInstance;
+
+               // Return the resolved action instance
+               return $actionInstance;
+       }
+
+       /**
+        * Resolves the action by its direct name and returns an instance of its class
+        *
+        * @return      $actionInstance         An instance of the action class
+        * @throws      InvalidActionException  Thrown if $actionName is invalid
+        */
+       public function resolveAction () {
+               // Initiate the instance variable
+               $actionInstance = null;
+
+               // Get action name
+               $actionName = $this->getActionName();
+
+               // 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
+               if (!$this->isActionValid($actionName)) {
+                       // This action is invalid!
+                       throw new InvalidActionException(array($this, $actionName), self::EXCEPTION_INVALID_ACTION);
+               }
+
+               // Get the action
+               $actionInstance = $this->loadAction();
+
+               // Return the instance
+               return $actionInstance;
+       }
+}
+
+// [EOF]
+?>
index 6c9ebf724660db5e531d7954eb3f41048fafc44f..305b2798daac318839525c376ac273e6f2d6896c 100644 (file)
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 class BaseResolver extends BaseFrameworkSystem {
-       /**
-        * Validated command name
-        */
-       private $commandName = "";
-
-       /**
-        * Prefix for local, remote or other resolver
-        */
-       private $commandPrefix = "";
-
-       /**
-        * A controller instance
-        */
-       private $controllerInstance = null;
+       // Exception constants
+       const EXCEPTION_INVALID_COMMAND    = 0x0c0;
+       const EXCEPTION_INVALID_CONTROLLER = 0x0c1;
+       const EXCEPTION_INVALID_ACTION     = 0x0c2;
 
        /**
         * Protected constructor
         *
+        * @param       $className      Real name of the class
         * @return      void
         */
-       protected function __construct ($class) {
+       protected function __construct ($className) {
                // Call parent constructor
-               parent::__construct($class);
+               parent::__construct($className);
 
                // Clean up a little
                $this->removeNumberFormaters();
                $this->removeSystemArray();
        }
-
-       /**
-        * Setter for controller instance (this surely breaks a bit the MVC patterm)
-        *
-        * @param       $controllerInstance             An instance of the controller
-        * @return      void
-        */
-       public final function setControllerInstance (Controller $controllerInstance) {
-               $this->controllerInstance = $controllerInstance;
-       }
-
-       /**
-        * Getter for controller instance (this surely breaks a bit the MVC patterm)
-        *
-        * @return      $controllerInstance             An instance of the controller
-        */
-       public final function getControllerInstance () {
-               return $this->controllerInstance;
-       }
-
-       /**
-        * Setter for command name
-        *
-        * @param       $commandName    Last validated command name
-        * @return      void
-        */
-       protected final function setCommandName ($commandName) {
-               $this->commandName = $commandName;
-       }
-
-       /**
-        * Getter for command name
-        *
-        * @return      $commandName    Last validated command name
-        */
-       protected final function getCommandName () {
-               return $this->commandName;
-       }
-
-       /**
-        * Setter for command prefix
-        *
-        * @param       $commandPrefix  Last validated commandPrefix
-        * @return      void
-        */
-       protected final function setCommandPrefix ($commandPrefix) {
-               $this->commandPrefix = $commandPrefix;
-       }
-
-       /**
-        * Checks wether the given command is valid
-        *
-        * @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
-        */
-       public function isCommandValid ($commandName) {
-               // By default nothing shall be valid
-               $isValid = false;
-
-               // Is a command set?
-               if (empty($commandName)) {
-                       // Then thrown an exception here
-                       throw new EmptyVariableException(array($this, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
-               }
-
-               // Now, let us create the full name of the command class
-               $class = sprintf("%s%sCommand",
-                       $this->commandPrefix,
-                       $this->convertToClassName($commandName)
-               );
-
-               // Is this class already loaded?
-               if (class_exists($class)) {
-                       // This class does exist. :-)
-                       $isValid = true;
-               }
-
-               // Debug output
-               //* DEBUG: */ $this->debugBacktrace();
-
-               // Set command name
-               $this->setCommandName($commandName);
-
-               // Return the result
-               return $isValid;
-       }
 }
 
 // [EOF]
diff --git a/inc/classes/main/resolver/command/.htaccess b/inc/classes/main/resolver/command/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/classes/main/resolver/command/class_BaseCommandResolver.php b/inc/classes/main/resolver/command/class_BaseCommandResolver.php
new file mode 100644 (file)
index 0000000..34ccf71
--- /dev/null
@@ -0,0 +1,139 @@
+<?php
+/**
+ * A generic command resolver class
+ *
+ * @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 BaseCommandResolver extends BaseResolver {
+       /**
+        * Prefix for local, remote or other resolver
+        */
+       private $commandPrefix = "";
+
+       /**
+        * Validated command name
+        */
+       private $commandName = "";
+
+       /**
+        * A controller instance
+        */
+       private $controllerInstance = null;
+
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct ($className) {
+               // Call parent constructor
+               parent::__construct($className);
+       }
+
+       /**
+        * Setter for command prefix
+        *
+        * @param       $commandPrefix  Last validated commandPrefix
+        * @return      void
+        */
+       protected final function setCommandPrefix ($commandPrefix) {
+               $this->commandPrefix = $commandPrefix;
+       }
+
+       /**
+        * Setter for command name
+        *
+        * @param       $commandName    Last validated command name
+        * @return      void
+        */
+       protected final function setCommandName ($commandName) {
+               $this->commandName = $commandName;
+       }
+
+       /**
+        * Getter for command name
+        *
+        * @return      $commandName    Last validated command name
+        */
+       protected final function getCommandName () {
+               return $this->commandName;
+       }
+
+       /**
+        * Setter for controller instance (this surely breaks a bit the MVC patterm)
+        *
+        * @param       $controllerInstance             An instance of the controller
+        * @return      void
+        */
+       public final function setControllerInstance (Controller $controllerInstance) {
+               $this->controllerInstance = $controllerInstance;
+       }
+
+       /**
+        * Getter for controller instance (this surely breaks a bit the MVC patterm)
+        *
+        * @return      $controllerInstance             An instance of the controller
+        */
+       public final function getControllerInstance () {
+               return $this->controllerInstance;
+       }
+
+       /**
+        * Checks wether the given command is valid
+        *
+        * @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
+        */
+       public function isCommandValid ($commandName) {
+               // By default nothing shall be valid
+               $isValid = false;
+
+               // Is a command set?
+               if (empty($commandName)) {
+                       // Then thrown an exception here
+                       throw new EmptyVariableException(array($this, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+               }
+
+               // Now, let us create the full name of the command class
+               $className = sprintf("%s%sCommand",
+                       $this->commandPrefix,
+                       $this->convertToClassName($commandName)
+               );
+
+               // Is this class already loaded?
+               if (class_exists($className)) {
+                       // This class does exist. :-)
+                       $isValid = true;
+               } // END - if
+
+               // Debug output
+               //* DEBUG: */ $this->debugBacktrace();
+
+               // Set command name
+               $this->setCommandName($commandName);
+
+               // Return the result
+               return $isValid;
+       }
+}
+
+// [EOF]
+?>
diff --git a/inc/classes/main/resolver/command/class_WebCommandResolver.php b/inc/classes/main/resolver/command/class_WebCommandResolver.php
new file mode 100644 (file)
index 0000000..ba0eb15
--- /dev/null
@@ -0,0 +1,190 @@
+<?php
+/**
+ * A command resolver for local (non-hubbed) 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 WebCommandResolver extends BaseResolver implements CommandResolver {
+       /**
+        * Last successfull resolved command
+        */
+       private $lastCommandInstance = "";
+
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Set part description
+               $this->setObjectDescription("Resolver for local web commands");
+
+               // Create unique ID number
+               $this->generateUniqueId();
+
+               // 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 createWebCommandResolver ($commandName, ManageableApplication $appInstance) {
+               // Create the new instance
+               $resolverInstance = new WebCommandResolver();
+
+               // Is the variable $commandName set and the command is valid?
+               if (empty($commandName)) {
+                       // Then thrown an exception here
+                       throw new EmptyVariableException(array($resolverInstance, 'defaultCommand'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+               } elseif (!$resolverInstance->isCommandValid($commandName)) {
+                       // 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 resolvCommandByRequest (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_command');
+
+               // Check if the command is valid
+               if (!$this->isCommandValid($commandName)) {
+                       // 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_command');
+
+               // Check if the command is valid
+               if (!$this->isCommandValid($commandName)) {
+                       // 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_command');
+
+               // Init command instance
+               $commandInstance = null;
+
+               // Create command class name
+               $className = sprintf("Web%sCommand",
+                       $this->convertToClassName($commandName)
+               );
+
+               // Is this class loaded?
+               if (!class_exists($className)) {
+                       // Class not found, so try the default one or throw exception
+                       if ($commandName != $defaultCommand) {
+                               // Try the default command
+                               return $this->loadCommand($defaultCommand);
+                       } else {
+                               // Still not found?
+                               throw new InvalidCommandException(array($this, $defaultCommand), self::EXCEPTION_INVALID_COMMAND);
+                       }
+               } // END - if
+
+               // Initiate the command
+               $commandInstance = ObjectFactory::createObjectByName($className, array($this));
+
+               // Return the result
+               return $commandInstance;
+       }
+}
+
+// [EOF]
+?>
diff --git a/inc/classes/main/resolver/command/web/.htaccess b/inc/classes/main/resolver/command/web/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/classes/main/resolver/command/web/class_WebCommandResolver.php b/inc/classes/main/resolver/command/web/class_WebCommandResolver.php
new file mode 100644 (file)
index 0000000..d1ee1e6
--- /dev/null
@@ -0,0 +1,190 @@
+<?php
+/**
+ * A command resolver for local (non-hubbed) 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 WebCommandResolver extends BaseCommandResolver implements CommandResolver {
+       /**
+        * Last successfull resolved command
+        */
+       private $lastCommandInstance = "";
+
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Set part description
+               $this->setObjectDescription("Resolver for local web commands");
+
+               // Create unique ID number
+               $this->generateUniqueId();
+
+               // 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 createWebCommandResolver ($commandName, ManageableApplication $appInstance) {
+               // Create the new instance
+               $resolverInstance = new WebCommandResolver();
+
+               // Is the variable $commandName set and the command is valid?
+               if (empty($commandName)) {
+                       // Then thrown an exception here
+                       throw new EmptyVariableException(array($resolverInstance, 'defaultCommand'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+               } elseif (!$resolverInstance->isCommandValid($commandName)) {
+                       // 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_command');
+
+               // Check if the command is valid
+               if (!$this->isCommandValid($commandName)) {
+                       // 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_command');
+
+               // Check if the command is valid
+               if (!$this->isCommandValid($commandName)) {
+                       // 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_command');
+
+               // Init command instance
+               $commandInstance = null;
+
+               // Create command class name
+               $className = sprintf("Web%sCommand",
+                       $this->convertToClassName($commandName)
+               );
+
+               // Is this class loaded?
+               if (!class_exists($className)) {
+                       // Class not found, so try the default one or throw exception
+                       if ($commandName != $defaultCommand) {
+                               // Try the default command
+                               return $this->loadCommand($defaultCommand);
+                       } else {
+                               // Still not found?
+                               throw new InvalidCommandException(array($this, $defaultCommand), self::EXCEPTION_INVALID_COMMAND);
+                       }
+               } // END - if
+
+               // Initiate the command
+               $commandInstance = ObjectFactory::createObjectByName($className, array($this));
+
+               // Return the result
+               return $commandInstance;
+       }
+}
+
+// [EOF]
+?>
diff --git a/inc/classes/main/resolver/controller/.htaccess b/inc/classes/main/resolver/controller/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/classes/main/resolver/controller/class_BaseControllerResolver.php b/inc/classes/main/resolver/controller/class_BaseControllerResolver.php
new file mode 100644 (file)
index 0000000..f584975
--- /dev/null
@@ -0,0 +1,128 @@
+<?php
+/**
+ * A generic controller resolver class
+ *
+ * @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 BaseControllerResolver extends BaseResolver {
+       /**
+        * Prefix for local, remote or other resolver
+        */
+       private $controllerPrefix = "";
+
+       /**
+        * Validated controller name
+        */
+       private $controllerName = "";
+
+       /**
+        * Protected constructor
+        *
+        * @param       $className      Name of the real class
+        * @return      void
+        */
+       protected function __construct ($className) {
+               // Call parent constructor
+               parent::__construct($className);
+       }
+
+       /**
+        * Setter for controller prefix
+        *
+        * @param       $controllerPrefix       Last validated controllerPrefix
+        * @return      void
+        */
+       protected final function setControllerPrefix ($controllerPrefix) {
+               $this->controllerPrefix = $controllerPrefix;
+       }
+
+       /**
+        * Setter for controller name
+        *
+        * @param       $controllerName Last validated controller name
+        * @return      void
+        */
+       protected final function setControllerName ($controllerName) {
+               $this->controllerName = $controllerName;
+       }
+
+       /**
+        * Getter for controller name
+        *
+        * @return      $controllerName Last validated controller name
+        */
+       protected final function getControllerName () {
+               return $this->controllerName;
+       }
+
+       /**
+        * Checks wether the given controller is valid
+        *
+        * @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
+        */
+       public function isControllerValid ($controllerName) {
+               // By default nothing shall be valid
+               $isValid = false;
+
+               // Is a controller set?
+               if (empty($controllerName)) {
+                       // Then thrown an exception here
+                       throw new EmptyVariableException(array($this, 'controllerName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+               } // END - if
+
+               // Now, let us create the full name of the controller class
+               $className = sprintf("%s%sController",
+                       $this->controllerPrefix,
+                       $this->convertToClassName($controllerName)
+               );
+
+               // Try it hard to get an controller
+               while (!$isValid) {
+                       // Is this class already loaded?
+                       if (class_exists($className)) {
+                               // This class does exist. :-)
+                               $isValid = true;
+                       } elseif (($className != "WebDefaultController") && ($className != "WebDefaultNewsController")) {
+                               // Do we have news?
+                               if ($this->getConfigInstance()->readConfig('page_with_news') == $this->getApplicationInstance()->getRequestInstance()->getRequestElement('page')) {
+                                       // Yes, display news in home then set default controller with news
+                                       $className = "WebDefaultNewsController";
+                               } else {
+                                       // No news at "home" page or non-news page
+                                       $className = "WebDefaultController";
+                               }
+                       } else {
+                               // All is tried, give it up here
+                               throw new DefaultControllerException($this, self::EXCEPTION_DEFAUL_CONTROLLER_GONE);
+                       }
+               } // END - while
+
+               // Debug output
+               //* DEBUG: */ $this->debugBacktrace();
+
+               // Return the result
+               return $isValid;
+       }
+}
+
+// [EOF]
+?>
diff --git a/inc/classes/main/resolver/controller/web/.htaccess b/inc/classes/main/resolver/controller/web/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/classes/main/resolver/controller/web/class_WebControllerResolver.php b/inc/classes/main/resolver/controller/web/class_WebControllerResolver.php
new file mode 100644 (file)
index 0000000..eec9884
--- /dev/null
@@ -0,0 +1,182 @@
+<?php
+/**
+ * A resolver for resolving controllers locally
+ *
+ * @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 WebControllerResolver extends BaseControllerResolver implements ControllerResolver {
+       /**
+        * Last successfull resolved controller (name)
+        */
+       private $lastControllerName = "";
+
+       /**
+        * Last successfull resolved controller (instance)
+        */
+       private $lastControllerInstance = null;
+
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Set part description
+               $this->setObjectDescription("Resolver for local web controllers");
+
+               // Create unique ID number
+               $this->generateUniqueId();
+
+               // Set prefix to "Web"
+               $this->setControllerPrefix("Web");
+       }
+
+       /**
+        * Creates an instance of a resolver class with a given command
+        *
+        * @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
+        */
+       public final static function createWebControllerResolver ($controllerName, ManageableApplication $appInstance) {
+               // Create the new instance
+               $resolverInstance = new WebControllerResolver();
+
+               // Is the variable $controllerName set and the command is valid?
+               if (empty($controllerName)) {
+                       // Then thrown an exception here
+                       throw new EmptyVariableException(array($resolverInstance, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+               } elseif (!$resolverInstance->isControllerValid($controllerName)) {
+                       // Invalid command found
+                       throw new InvalidControllerException(array($resolverInstance, $controllerName), self::EXCEPTION_INVALID_COMMAND);
+               }
+
+               // Set the application instance
+               $resolverInstance->setApplicationInstance($appInstance);
+
+               // Set command name
+               $resolverInstance->setControllerName($controllerName);
+
+               // Return the prepared instance
+               return $resolverInstance;
+       }
+
+       /**
+        * Resolves the default controller of the given command
+        *
+        * @return      $controllerInstance             A controller instance for the default
+        *                                                                      command
+        * @throws      InvalidControllerInstanceException      Thrown if $controllerInstance
+        *                                                                                              is invalid
+        */
+       public function resolveController () {
+               // Init variables
+               $controllerName = "";
+               $controllerInstance = null;
+
+               // Get the command name 
+               $controllerName = $this->getControllerName();
+
+               // Get the command
+               $controllerInstance = $this->loadController($controllerName);
+
+               // And validate it
+               if ((!is_object($controllerInstance)) || (!$controllerInstance instanceof Controller)) {
+                       // This command has an invalid instance!
+                       throw new InvalidControllerInstanceException(array($this, $controllerName), self::EXCEPTION_INVALID_CONTROLLER);
+               } // END - if
+
+               // Set last controller
+               $this->lastControllerInstance = $controllerInstance;
+
+               // Return the maybe resolved instance
+               return $controllerInstance;
+       }
+
+       /**
+        * "Loads" a given controller and instances it if not yet cached. If the
+        * controller was not found one of the default controllers will be used
+        * depending on wether news shall be displayed.
+        *
+        * @param       $controllerName                 A controller name we shall look for
+        * @return      $controllerInstance             A loaded controller instance
+        * @throws      DefaultControllerException      Thrown if even the default
+        *                                                                              controller class is missing (bad!)
+        */
+       private function loadController ($controllerName) {
+                // Debug message
+                //* DEBUG: */ $this->debugBacktrace();
+
+               // Cache default command
+               $defaultController = $this->getConfigInstance()->readConfig('default_command');
+
+               // Init controller instance
+               $controllerInstance = null;
+
+               // Default controller
+               $className = "WebDefaultController";
+
+               // Generate the class name
+               //* DEBUG: */ echo __METHOD__.": Controller=".$controllerName;
+               if ($controllerName != $defaultController) {
+                       // Create controller class name
+                       $className = sprintf("Web%sController",
+                               $this->convertToClassName($controllerName)
+                       );
+               } elseif ($this->getConfigInstance()->readConfig('page_with_news') == $this->getApplicationInstance()->getRequestInstance()->getRequestElement('page')) {
+                       // Yes, display news in home then set default controller with news
+                       $className = "WebDefaultNewsController";
+               } else {
+                       // No news at "home" page or non-news page
+                       $className = "WebDefaultController";
+               }
+               //* DEBUG: */ echo ", controller=".$className."<br />\n";
+
+               // Is this class loaded?
+               if (!class_exists($className)) {
+                       // Class not found, so try the default one or throw exception
+                       if ($controllerName != $defaultController) {
+                               // Try the default controller
+                               return $this->loadController($defaultController);
+                       } else {
+                               // Still not found?
+                               throw new DefaultControllerException($this, self::EXCEPTION_DEFAUL_CONTROLLER_GONE);
+                       }
+               } // END - if
+
+               // Initiate the resolver and controller
+               $resolverInstance = ObjectFactory::createObjectByConfiguredName('web_cmd_resolver_class', array($controllerName, $this->getApplicationInstance()));
+               $controllerInstance = ObjectFactory::createObjectByName($className, array($resolverInstance));
+
+               // Remove resolver
+               unset($resolverInstance);
+
+               // Return the result
+               return $controllerInstance;
+       }
+}
+
+// [EOF]
+?>
diff --git a/inc/classes/main/resolver/web/.htaccess b/inc/classes/main/resolver/web/.htaccess
deleted file mode 100644 (file)
index 3a42882..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Deny from all
diff --git a/inc/classes/main/resolver/web/class_WebCommandResolver.php b/inc/classes/main/resolver/web/class_WebCommandResolver.php
deleted file mode 100644 (file)
index ba0eb15..0000000
+++ /dev/null
@@ -1,190 +0,0 @@
-<?php
-/**
- * A command resolver for local (non-hubbed) 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 WebCommandResolver extends BaseResolver implements CommandResolver {
-       /**
-        * Last successfull resolved command
-        */
-       private $lastCommandInstance = "";
-
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       protected function __construct () {
-               // Call parent constructor
-               parent::__construct(__CLASS__);
-
-               // Set part description
-               $this->setObjectDescription("Resolver for local web commands");
-
-               // Create unique ID number
-               $this->generateUniqueId();
-
-               // 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 createWebCommandResolver ($commandName, ManageableApplication $appInstance) {
-               // Create the new instance
-               $resolverInstance = new WebCommandResolver();
-
-               // Is the variable $commandName set and the command is valid?
-               if (empty($commandName)) {
-                       // Then thrown an exception here
-                       throw new EmptyVariableException(array($resolverInstance, 'defaultCommand'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
-               } elseif (!$resolverInstance->isCommandValid($commandName)) {
-                       // 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 resolvCommandByRequest (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_command');
-
-               // Check if the command is valid
-               if (!$this->isCommandValid($commandName)) {
-                       // 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_command');
-
-               // Check if the command is valid
-               if (!$this->isCommandValid($commandName)) {
-                       // 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_command');
-
-               // Init command instance
-               $commandInstance = null;
-
-               // Create command class name
-               $className = sprintf("Web%sCommand",
-                       $this->convertToClassName($commandName)
-               );
-
-               // Is this class loaded?
-               if (!class_exists($className)) {
-                       // Class not found, so try the default one or throw exception
-                       if ($commandName != $defaultCommand) {
-                               // Try the default command
-                               return $this->loadCommand($defaultCommand);
-                       } else {
-                               // Still not found?
-                               throw new InvalidCommandException(array($this, $defaultCommand), self::EXCEPTION_INVALID_COMMAND);
-                       }
-               } // END - if
-
-               // Initiate the command
-               $commandInstance = ObjectFactory::createObjectByName($className, array($this));
-
-               // Return the result
-               return $commandInstance;
-       }
-}
-
-// [EOF]
-?>
diff --git a/inc/classes/main/resolver/web/class_WebControllerResolver.php b/inc/classes/main/resolver/web/class_WebControllerResolver.php
deleted file mode 100644 (file)
index a02eeaa..0000000
+++ /dev/null
@@ -1,187 +0,0 @@
-<?php
-/**
- * A resolver for resolving controllers locally
- *
- * @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 WebControllerResolver extends BaseResolver implements ControllerResolver {
-       /**
-        * Last successfull resolved controller (name)
-        */
-       private $lastControllerName = "";
-
-       /**
-        * Last successfull resolved controller (instance)
-        */
-       private $lastControllerInstance = null;
-
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       protected function __construct () {
-               // Call parent constructor
-               parent::__construct(__CLASS__);
-
-               // Set part description
-               $this->setObjectDescription("Resolver for local web controllers");
-
-               // Create unique ID number
-               $this->generateUniqueId();
-
-               // Set prefix to "Web"
-               $this->setCommandPrefix("Web");
-       }
-
-       /**
-        * Creates an instance of a resolver class with a given 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 createWebControllerResolver ($commandName, ManageableApplication $appInstance) {
-               // Create the new instance
-               $resolverInstance = new WebControllerResolver();
-
-               // 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)) {
-                       // 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;
-       }
-
-       /**
-        * Resolves the default controller of the given command
-        *
-        * @return      $controllerInstance             A controller instance for the default
-        *                                                                      command
-        * @throws      InvalidCommandException                         Thrown if $commandName is
-        *                                                                                              invalid
-        * @throws      InvalidControllerInstanceException      Thrown if $commandInstance
-        *                                                                                              is invalid
-        */
-       public function resolveCommandController () {
-               // Init variables
-               $commandName = "";
-               $controllerInstance = null;
-
-               // Get the command name 
-               $commandName = $this->getCommandName();
-
-               // Check if the command is valid
-               if (!$this->isCommandValid($commandName)) {
-                       // This command is invalid!
-                       throw new InvalidCommandException(array($this, $commandName), self::EXCEPTION_INVALID_COMMAND);
-               } // END - if
-
-               // Get the command
-               $controllerInstance = $this->loadController($commandName);
-
-               // And validate it
-               if ((!is_object($controllerInstance)) || (!$controllerInstance instanceof Controller)) {
-                       // This command has an invalid instance!
-                       throw new InvalidControllerInstanceException(array($this, $commandName), self::EXCEPTION_INVALID_CONTROLLER);
-               } // END - if
-
-               // Set last controller
-               $this->lastControllerInstance = $controllerInstance;
-
-               // Return the maybe resolved instance
-               return $controllerInstance;
-       }
-
-       /**
-        * "Loads" a given controller and instances it if not yet cached. If the
-        * controller was not found one of the default controllers will be used
-        * depending on wether news shall be displayed.
-        *
-        * @param       $commandName                    A controller name we shall look for
-        * @return      $controllerInstance             A loaded controller instance
-        * @throws      DefaultControllerException      Thrown if even the default
-        *                                                                              controller class is missing (bad!)
-        */
-       private function loadController ($commandName) {
-                // Debug message
-                //* DEBUG: */ $this->debugBacktrace();
-
-               // Cache default command
-               $defaultCommand = $this->getConfigInstance()->readConfig('default_command');
-
-               // Init controller instance
-               $controllerInstance = null;
-
-               // Default controller
-               $class = "WebDefaultController";
-
-               // Generate the class name
-               //* DEBUG: */ echo __METHOD__.": Command=".$commandName;
-               if ($commandName != $defaultCommand) {
-                       // Create controller class name
-                       $class = sprintf("Web%sController",
-                               $this->convertToClassName($commandName)
-                       );
-               } elseif ($this->getConfigInstance()->readConfig('page_with_news') == $this->getApplicationInstance()->getRequestInstance()->getRequestElement('page')) {
-                       // Yes, display news in home then set default controller with news
-                       $class = "WebDefaultNewsController";
-               } else {
-                       // No news at "home" page or non-news page
-                       $class = "WebDefaultController";
-               }
-               //* DEBUG: */ echo ", controller=".$class."<br />\n";
-
-               // Is this class loaded?
-               if (!class_exists($class)) {
-                       // Class not found, so try the default one or throw exception
-                       if ($commandName != $defaultCommand) {
-                               // Try the default controller
-                               return $this->loadController($defaultCommand);
-                       } else {
-                               // Still not found?
-                               throw new DefaultControllerException($this, self::EXCEPTION_DEFAUL_CONTROLLER_GONE);
-                       }
-               } // END - if
-
-               // Initiate the resolver and controller
-               $resolverInstance = ObjectFactory::createObjectByConfiguredName('web_cmd_resolver_class', array($commandName, $this->getApplicationInstance()));
-               $controllerInstance = ObjectFactory::createObjectByName($class, array($resolverInstance));
-
-               // Remove resolver
-               unset($resolverInstance);
-
-               // Return the result
-               return $controllerInstance;
-       }
-}
-
-// [EOF]
-?>
index 131af0a98b43524884b8399c8e149f2135401665..0bdd034f669bb425790b721c8decbda180b5e55d 100644 (file)
@@ -185,7 +185,7 @@ $cfg->setConfigEntry('username_is_guest_class', "UserNameIsGuestFilter");
 // CFG: PASSWORD-VALIDATOR
 $cfg->setConfigEntry('password_validator_class', "PasswordValidatorFilter");
 
-// CFG: RULES-ACCEPTED-FILTER
+// CFG: RULES-ACCEPTED-CLASS
 $cfg->setConfigEntry('rules_accepted_class', "RulesAcceptedFilter");
 
 // CFG: USERNAME-VERIFIER
@@ -200,9 +200,15 @@ $cfg->setConfigEntry('password_verifier_class', "PasswordVerifierFilter");
 // CFG: EMAIL-CHANGE-CLASS
 $cfg->setConfigEntry('email_change_class', "EmailChangeFilter");
 
-// CFG: PASSWORD-CHANGE-FILTER
+// CFG: PASSWORD-CHANGE-CLASS
 $cfg->setConfigEntry('password_change_class', "PasswordChangeFilter");
 
+// CFG: ACCOUNT-PASSWORD-CLASS
+$cfg->setConfigEntry('account_password_class', "AccountPasswordVerifierFilter");
+
+// CFG: USER-STATUS-CLASS
+$cfg->setConfigEntry('user_status_class', "UserStatusVerifierFilter");
+
 // CFG: CRYPTO-HELPER
 $cfg->setConfigEntry('crypto_class', "CryptoHelper");