]> git.mxchange.org Git - city.git/commitdiff
Now only use 'main_content' + added missing command classes (for possible customizati...
authorRoland Haeder <roland@mxchange.org>
Sat, 18 Apr 2015 01:07:08 +0000 (03:07 +0200)
committerRoland Haeder <roland@mxchange.org>
Sat, 18 Apr 2015 01:07:08 +0000 (03:07 +0200)
Signed-off-by: Roland Haeder <roland@mxchange.org>
17 files changed:
application/city/config.php
application/city/main/commands/html/class_CityHtmlCityGuestLoginCommand.php [new file with mode: 0644]
application/city/main/commands/html/class_CityHtmlCityMapCommand.php [new file with mode: 0644]
application/city/main/commands/html/class_CityHtmlCityRegisterCommand.php [new file with mode: 0644]
application/city/main/commands/html/class_CityHtmlCityUserLoginCommand.php [new file with mode: 0644]
application/city/main/commands/html/class_CityHtmlDoFormCommand.php [new file with mode: 0644]
application/city/main/commands/html/class_CityHtmlLoginAreaCommand.php [new file with mode: 0644]
application/city/main/commands/html/class_CityHtmlLoginCommand.php [new file with mode: 0644]
application/city/main/commands/html/class_CityHtmlLoginFailedCommand.php [new file with mode: 0644]
application/city/main/commands/html/class_HtmlCityGuestLoginCommand.php [deleted file]
application/city/main/commands/html/class_HtmlCityMapCommand.php [deleted file]
application/city/main/commands/html/class_HtmlCityRegisterCommand.php [deleted file]
application/city/main/commands/html/class_HtmlCityUserLoginCommand.php [deleted file]
application/city/main/controller/html/class_CityHtmlLoginFailedController.php [new file with mode: 0644]
application/city/main/database/frontend/city/class_CityInformationDatabaseWrapper.php
application/city/templates/de/code/city_main.ctp
application/city/templates/de/code/login_failed.ctp [new file with mode: 0644]

index 8c46d532019358442dda238c6797f673c348d378..c1fd59ae61b7a32cce52c3b0e7472edc27dbdbaa 100644 (file)
@@ -72,7 +72,10 @@ $cfg->setConfigEntry('city_html_cmd_home_resolver_class', 'CityHtmlCommandResolv
 $cfg->setConfigEntry('city_html_cmd_register_resolver_class', 'CityHtmlCommandResolver');
 
 // CFG: CITY-HTML-CMD-LOGIN-RESOLVER-CLASS
-$cfg->setConfigEntry('city_html_cmd_login_resolver_class', 'HtmlCommandResolver');
+$cfg->setConfigEntry('city_html_cmd_login_resolver_class', 'CityHtmlCommandResolver');
+
+// CFG: CITY-HTML-CMD-LOGIN-FAILED-RESOLVER-CLASS
+$cfg->setConfigEntry('city_html_cmd_login_failed_resolver_class', 'CityHtmlCommandResolver');
 
 // CFG: NEWS-READER-HOME-CLASS
 $cfg->setConfigEntry('news_reader_home_class', 'DefaultNewsReader');
@@ -294,19 +297,19 @@ $cfg->setConfigEntry('city_name_verifier_filter', 'CityNameVerifierFilter');
 $cfg->setConfigEntry('user_status_filter', 'UserStatusVerifierFilter');
 
 // CFG: CITY-HTML-CMD-DO-FORM-RESOLVER-CLASS
-$cfg->setConfigEntry('city_html_cmd_do_form_resolver_class', 'HtmlCommandResolver');
+$cfg->setConfigEntry('city_html_cmd_do_form_resolver_class', 'CityHtmlCommandResolver');
 
 // CFG: CITY-HTML-CMD-LOGIN-AREA-RESOLVER-CLASS
-$cfg->setConfigEntry('city_html_cmd_login_area_resolver_class', 'HtmlCommandResolver');
+$cfg->setConfigEntry('city_html_cmd_login_area_resolver_class', 'CityHtmlCommandResolver');
 
 // CFG: CITY-HTML-CMD-CONFIRM-RESOLVER-CLASS
-$cfg->setConfigEntry('city_html_cmd_confirm_resolver_class', 'HtmlCommandResolver');
+$cfg->setConfigEntry('city_html_cmd_confirm_resolver_class', 'CityHtmlCommandResolver');
 
 // CFG: CITY-HTML-CMD-PROBLEM-RESOLVER-CLASS
-$cfg->setConfigEntry('city_html_cmd_problem_resolver_class', 'HtmlCommandResolver');
+$cfg->setConfigEntry('city_html_cmd_problem_resolver_class', 'CityHtmlCommandResolver');
 
 // CFG: CITY-HTML-CMD-LOGOUT-RESOLVER-CLASS
-$cfg->setConfigEntry('city_html_cmd_logout_resolver_class', 'HtmlCommandResolver');
+$cfg->setConfigEntry('city_html_cmd_logout_resolver_class', 'CityHtmlCommandResolver');
 
 // CFG: EMAIL-CHANGE-ALLOWED
 $cfg->setConfigEntry('email_change_allowed', 'Y');
diff --git a/application/city/main/commands/html/class_CityHtmlCityGuestLoginCommand.php b/application/city/main/commands/html/class_CityHtmlCityGuestLoginCommand.php
new file mode 100644 (file)
index 0000000..98d42da
--- /dev/null
@@ -0,0 +1,112 @@
+<?php
+/**
+ * A command for guest logins
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2015 City Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.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 CityHtmlCityGuestLoginCommand extends BaseCommand implements Commandable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this command and sets the resolver instance
+        *
+        * @param       $resolverInstance       An instance of a command resolver
+        * @return      $commandInstance        The created command instance
+        */
+       public static final function createCityHtmlCityGuestLoginCommand (CommandResolver $resolverInstance) {
+               // Get a new instance
+               $commandInstance = new CityHtmlCityGuestLoginCommand();
+
+               // Set the resolver instance
+               $commandInstance->setResolverInstance($resolverInstance);
+
+               // Return the prepared instance
+               return $commandInstance;
+       }
+
+       /**
+        * Executes the command with given request and response objects
+        *
+        * @param       $requestInstance        An instance of a class with an Requestable interface
+        * @param       $responseInstance       An instance of a class with an Responseable interface
+        * @return      void
+        */
+       public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+               // First get a GuestLogin instance
+               $loginInstance = ObjectFactory::createObjectByConfiguredName('guest_login_class');
+
+               // First set request and response instance
+               $loginInstance->setRequestInstance($requestInstance);
+
+               // Encrypt the password
+               $loginInstance->encryptPassword('passwd');
+
+               // Do the login here
+               $loginInstance->doLogin($requestInstance, $responseInstance);
+
+               // Was the login fine? Then redirect here
+               if ($loginInstance->ifLoginWasSuccessfull()) {
+                       // Try to redirect here
+                       try {
+                               // Redirect...
+                               $responseInstance->redirectToConfiguredUrl('app_login');
+
+                               // Exit here
+                               exit();
+                       } catch (FrameworkException $e) {
+                               // Something went wrong here!
+                               $responseInstance->addFatalMessage($e->getMessage());
+                       }
+               } else {
+                       // Attach error message to the response
+                       $responseInstance->addFatalMessage('failed_user_login');
+               }
+       }
+
+       /**
+        * Adds extra filters to the given controller instance
+        *
+        * @param       $controllerInstance             A controller instance
+        * @param       $requestInstance                An instance of a class with an Requestable interface
+        * @return      void
+        * @todo        Add more filters
+        */
+       public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
+               // Add username verifier filter
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_guest_verifier_filter'));
+
+               // Add password verifier filter
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('passwd_guest_verifier_filter'));
+
+               // Add CAPTCHA verifier code
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_guest_verifier_filter'));
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/city/main/commands/html/class_CityHtmlCityMapCommand.php b/application/city/main/commands/html/class_CityHtmlCityMapCommand.php
new file mode 100644 (file)
index 0000000..53f66c8
--- /dev/null
@@ -0,0 +1,104 @@
+<?php
+/**
+ * A command for the city map
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2015 City Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.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 CityHtmlCityMapCommand extends BaseCommand implements Commandable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this command and sets the resolver instance
+        *
+        * @param       $resolverInstance       An instance of a command resolver
+        * @return      $commandInstance        The created command instance
+        */
+       public static final function createCityHtmlCityMapCommand (CommandResolver $resolverInstance) {
+               // Get a new instance
+               $commandInstance = new CityHtmlCityMapCommand();
+
+               // Set the resolver instance
+               $commandInstance->setResolverInstance($resolverInstance);
+
+               // Return the prepared instance
+               return $commandInstance;
+       }
+
+       /**
+        * Executes the command with given request and response objects
+        *
+        * @param       $requestInstance        An instance of a class with an Requestable interface
+        * @param       $responseInstance       An instance of a class with an Responseable interface
+        * @return      void
+        */
+       public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+               // First get a UserRegistration instance
+               $managerInstance = ManagerFactory::createManagerByType('city');
+
+               // First set request and response instance
+               $managerInstance->setRequestInstance($requestInstance);
+               $managerInstance->setResponseInstance($responseInstance);
+
+               // Is there already a city the user has founded?
+               if ($managerInstance->isCityAlreadyFounded()) {
+                       // Found 2nd,3rd,... city
+                       $managerInstance->foundNewCity();
+               } else {
+                       // Found first city
+                       $managerInstance->foundFirstCity();
+               }
+
+               // Redirect or login after registration
+               $managerInstance->doPostAction();
+       }
+
+       /**
+        * Adds extra filters to the given controller instance
+        *
+        * @param       $controllerInstance             A controller instance
+        * @param       $requestInstance                An instance of a class with an Requestable interface
+        * @return      void
+        * @todo        Add some more pre/post filters to the controller
+        */
+       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_filter'));
+
+               // Validate user status ('confirmed' no guest)
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter'));
+
+               // Check if city name is already used
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('city_name_verifier_filter'));
+
+               // Validate ...
+               //$controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('email_validator_filter'));
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/city/main/commands/html/class_CityHtmlCityRegisterCommand.php b/application/city/main/commands/html/class_CityHtmlCityRegisterCommand.php
new file mode 100644 (file)
index 0000000..1473ffc
--- /dev/null
@@ -0,0 +1,119 @@
+<?php
+/**
+ * A command for registration form (POST) handling
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2015 City Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.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 CityHtmlCityRegisterCommand extends BaseCommand implements Commandable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this command and sets the resolver instance
+        *
+        * @param       $resolverInstance       An instance of a command resolver
+        * @return      $commandInstance        The created command instance
+        */
+       public static final function createCityHtmlCityRegisterCommand (CommandResolver $resolverInstance) {
+               // Get a new instance
+               $commandInstance = new CityHtmlCityRegisterCommand();
+
+               // Set the resolver instance
+               $commandInstance->setResolverInstance($resolverInstance);
+
+               // Return the prepared instance
+               return $commandInstance;
+       }
+
+       /**
+        * Executes the command with given request and response objects
+        *
+        * @param       $requestInstance        An instance of a class with an Requestable interface
+        * @param       $responseInstance       An instance of a class with an Responseable interface
+        * @return      void
+        */
+       public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+               // First get a UserRegistration instance
+               $registerInstance = ObjectFactory::createObjectByConfiguredName('user_registration_class');
+
+               // First set request and response instance
+               $registerInstance->setRequestInstance($requestInstance);
+               $registerInstance->setResponseInstance($responseInstance);
+
+               // Encrypt the password
+               $registerInstance->encryptPassword('pass1');
+
+               // Do things before registration
+               $registerInstance->doPreRegistration();
+
+               // Register the new user
+               $registerInstance->registerNewUser();
+
+               /*
+                * Do things after registration like notifying partner pages or queueing
+                * them for notification
+                */
+               $registerInstance->doPostRegistration();
+
+               // Redirect or login after registration
+               $registerInstance->doPostAction();
+       }
+
+       /**
+        * Adds extra filters to the given controller instance
+        *
+        * @param       $controllerInstance             A controller instance
+        * @param       $requestInstance                An instance of a class with an Requestable interface
+        * @return      void
+        * @todo        Add some more pre/post filters to the controller
+        */
+       public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
+               // Validate email address (if configured: check on double email addresses)
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('email_validator_filter'));
+
+               // Validate username and check if it does not exist
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_validator_filter'));
+
+               // Validate if username is "guest" and not taken
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_is_guest_filter'));
+
+               // Validate if password is set
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('password_validator_filter'));
+
+               // Check if rules where accepted
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('rules_accepted_filter'));
+
+               // Validate CAPTCHA input
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_register_verifier_filter'));
+
+               // Validate birthday
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('birthday_register_verifier_filter'));
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/city/main/commands/html/class_CityHtmlCityUserLoginCommand.php b/application/city/main/commands/html/class_CityHtmlCityUserLoginCommand.php
new file mode 100644 (file)
index 0000000..d02eef0
--- /dev/null
@@ -0,0 +1,124 @@
+<?php
+/**
+ * A command for user login
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2015 City Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.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 CityHtmlCityUserLoginCommand extends BaseCommand implements Commandable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this command and sets the resolver instance
+        *
+        * @param       $resolverInstance       An instance of a command resolver
+        * @return      $commandInstance        The created command instance
+        */
+       public static final function createCityHtmlCityUserLoginCommand (CommandResolver $resolverInstance) {
+               // Get a new instance
+               $commandInstance = new CityHtmlCityUserLoginCommand();
+
+               // Set the resolver instance
+               $commandInstance->setResolverInstance($resolverInstance);
+
+               // Return the prepared instance
+               return $commandInstance;
+       }
+
+       /**
+        * Executes the command with given request and response objects
+        *
+        * @param       $requestInstance        An instance of a class with an Requestable interface
+        * @param       $responseInstance       An instance of a class with an Responseable interface
+        * @return      void
+        */
+       public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+               // First get a UserLogin instance
+               $loginInstance = ObjectFactory::createObjectByConfiguredName('user_login_class');
+
+               // First set request and response instance
+               $loginInstance->setRequestInstance($requestInstance);
+
+               // Encrypt the password
+               $loginInstance->encryptPassword('pass');
+
+               // Do the login here
+               $loginInstance->doLogin($requestInstance, $responseInstance);
+
+               // Was the login fine? Then redirect here
+               if ($loginInstance->ifLoginWasSuccessfull()) {
+                       // Try to redirect here
+                       try {
+                               // Redirect...
+                               $responseInstance->redirectToConfiguredUrl('app_login');
+
+                               // Exit here
+                               exit();
+                       } catch (FrameworkException $e) {
+                               // Something went wrong here!
+                               $responseInstance->addFatalMessage($e->getMessage());
+                       }
+               } else {
+                       // Attach error message to the response
+                       $responseInstance->addFatalMessage('failed_user_login');
+               }
+       }
+
+       /**
+        * Adds extra filters to the given controller instance
+        *
+        * @param       $controllerInstance             A controller instance
+        * @param       $requestInstance                An instance of a class with an Requestable interface
+        * @return      void
+        * @todo        Add more filters
+        */
+       public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
+               // Which login type do we have?
+               switch ($this->getConfigInstance()->getConfigEntry('login_type')) {
+                       case 'username': // Login via username
+                               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_verifier_filter'));
+                               break;
+
+                       case 'email': // Login via email
+                               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('email_verifier_filter'));
+                               break;
+
+                       default: // Wether username or email is set
+                               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_email_verifier_filter'));
+                               break;
+               }
+
+               // Password verifier filter
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('password_verifier_filter'));
+
+               // Add filter for CAPTCHA
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_user_verifier_filter'));
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/city/main/commands/html/class_CityHtmlDoFormCommand.php b/application/city/main/commands/html/class_CityHtmlDoFormCommand.php
new file mode 100644 (file)
index 0000000..36b9a11
--- /dev/null
@@ -0,0 +1,78 @@
+<?php
+/**
+ * A command for the form processor
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2015 City Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.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 CityHtmlDoFormCommand extends BaseCommand implements Commandable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this class
+        *
+        * @param       $resolverInstance       An instance of a command resolver class
+        * @return      $commandInstance        An instance a prepared command class
+        */
+       public static final function createCityHtmlDoFormCommand (CommandResolver $resolverInstance) {
+               // Get new instance
+               $commandInstance = new CityHtmlDoFormCommand();
+
+               // Set the application instance
+               $commandInstance->setResolverInstance($resolverInstance);
+
+               // Return the prepared instance
+               return $commandInstance;
+       }
+
+       /**
+        * Executes the given command with given request and response objects
+        *
+        * @param       $requestInstance        An instance of a class with an Requestable interface
+        * @param       $responseInstance       An instance of a class with an Responseable interface
+        * @return      void
+        */
+       public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+               // Should never be reached...
+               $this->debugBackTrace('This should never be reached.');
+       }
+
+       /**
+        * Adds extra filters to the given controller instance
+        *
+        * @param       $controllerInstance             A controller instance
+        * @param       $requestInstance                An instance of a class with an Requestable interface
+        * @return      void
+        */
+       public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
+               // Empty for now
+       }
+
+}
+
+// [EOF]
+?>
diff --git a/application/city/main/commands/html/class_CityHtmlLoginAreaCommand.php b/application/city/main/commands/html/class_CityHtmlLoginAreaCommand.php
new file mode 100644 (file)
index 0000000..8888a09
--- /dev/null
@@ -0,0 +1,203 @@
+<?php
+/**
+ * A command for the login area (member/gamer area)
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2015 City Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.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 CityHtmlLoginAreaCommand extends BaseCommand implements Commandable {
+       /**
+        * Name of the action
+        */
+       private $actionName = '';
+
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this class
+        *
+        * @param       $resolverInstance       An instance of a command resolver class
+        * @return      $commandInstance        An instance a prepared command class
+        */
+       public static final function createCityHtmlLoginAreaCommand (CommandResolver $resolverInstance) {
+               // Get new instance
+               $commandInstance = new CityHtmlLoginAreaCommand();
+
+               // Set the application instance
+               $commandInstance->setResolverInstance($resolverInstance);
+
+               // Load general data like user status and such
+               $commandInstance->prepareCommand();
+
+               // Return the prepared instance
+               return $commandInstance;
+       }
+
+       /**
+        * Prepares some general data which shall be displayed on every page
+        *
+        * @return      void
+        * @todo        Add some stuff here: Some personal data, app/game related data
+        */
+       protected function prepareCommand () {
+       }
+
+       /**
+        * Executes the given command with given request and response objects
+        *
+        * @param       $requestInstance        An instance of a class with an Requestable interface
+        * @param       $responseInstance       An instance of a class with an Responseable interface
+        * @return      void
+        */
+       public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+               // Get the action instance from registry
+               $actionInstance = Registry::getRegistry()->getInstance('action');
+
+               // Do we have an action here?
+               if ($actionInstance instanceof PerformableAction) {
+                       // Execute the action (shall not output anything, see below why)
+                       $actionInstance->execute($requestInstance, $responseInstance);
+               } // END - if
+
+               // Get the application instance
+               $applicationInstance = $this->getResolverInstance()->getApplicationInstance();
+
+               // Prepare a template instance
+               $templateInstance = $this->prepareTemplateInstance($applicationInstance);
+
+               // Assign base URL
+               $templateInstance->assignConfigVariable('base_url');
+
+               // Assign all the application's data with template variables
+               $templateInstance->assignApplicationData($applicationInstance);
+
+               // Load the master template
+               $masterTemplate = $applicationInstance->buildMasterTemplateName();
+
+               // Load header template
+               $templateInstance->loadCodeTemplate('header');
+
+               // Compile and assign it with a variable
+               $templateInstance->compileTemplate();
+               $templateInstance->assignTemplateWithVariable('header', 'header');
+
+               // Load footer template
+               $templateInstance->loadCodeTemplate('footer');
+
+               // Compile and assign it with a variable
+               $templateInstance->compileTemplate();
+               $templateInstance->assignTemplateWithVariable('footer', 'footer');
+
+               // Load the matching template
+               $templateInstance->loadCodeTemplate('action_' . $this->actionName);
+
+               // Assign the template with the master template as a content ... ;)
+               $templateInstance->compileTemplate();
+               $templateInstance->assignTemplateWithVariable('action_' . $this->actionName, 'login_content');
+
+               // Load main template
+               $templateInstance->loadCodeTemplate('login_main');
+
+               // Assign the main template with the master template as a content ... ;)
+               $templateInstance->compileTemplate();
+               $templateInstance->assignTemplateWithVariable('login_main', 'main_content');
+
+               // Load the master template
+               $templateInstance->loadCodeTemplate($masterTemplate);
+
+               // Set title
+               $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage($this->actionName . '_title'));
+
+               // Construct the menu in every command. We could do this in BaseCommand class. But this means
+               // *every* command has a navigation system and that is want we don't want.
+               $menuInstance = ObjectFactory::createObjectByConfiguredName('login_area_menu_class', array($applicationInstance));
+
+               // Render the menu
+               $menuInstance->renderMenu();
+
+               // Transfer it to the template engine instance
+               $menuInstance->transferContentToTemplateEngine($templateInstance);
+
+               /*
+                * ... and all variables. This should be merged together in a pattern
+                * to make things easier. A cache mechanism should be added between
+                * these two calls to cache compiled templates.
+                */
+               $templateInstance->compileVariables();
+
+               // Get the content back from the template engine and put it in response class
+               $templateInstance->transferToResponse($responseInstance);
+       }
+
+       /**
+        * Adds extra filters to the given controller instance. An corresponding action class must now exist!
+        *
+        * @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) {
+               // Default is no action
+               $actionInstance = NULL;
+
+               // Get registry
+               $registryInstance = Registry::getRegistry();
+
+               // Get our application instance from the registry
+               $applicationInstance = $registryInstance->getInstance('application');
+
+               // Default action is the one from configuration
+               $this->actionName = $this->convertDashesToUnderscores($applicationInstance->getAppShortName()) . '_login_' . $this->getConfigInstance()->getConfigEntry('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 = $this->convertDashesToUnderscores($applicationInstance->getAppShortName()) . '_login_' . $actReq;
+               } // END - if
+
+               // Get application instance
+               $applicationInstance = $this->getResolverInstance()->getApplicationInstance();
+
+               // Get a resolver
+               $actionResolver = HtmlActionResolver::createHtmlActionResolver($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);
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/city/main/commands/html/class_CityHtmlLoginCommand.php b/application/city/main/commands/html/class_CityHtmlLoginCommand.php
new file mode 100644 (file)
index 0000000..7d6f472
--- /dev/null
@@ -0,0 +1,138 @@
+<?php
+/**
+ * A command for the login form
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2015 City Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.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 CityHtmlLoginCommand extends BaseCommand implements Commandable, Registerable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this class
+        *
+        * @param       $resolverInstance       An instance of a command resolver class
+        * @return      $commandInstance        An instance a prepared command class
+        */
+       public static final function createCityHtmlLoginCommand (CommandResolver $resolverInstance) {
+               // Get new instance
+               $commandInstance = new CityHtmlLoginCommand();
+
+               // Set the application instance
+               $commandInstance->setResolverInstance($resolverInstance);
+
+               // Return the prepared instance
+               return $commandInstance;
+       }
+
+       /**
+        * Executes the given command with given request and response objects
+        *
+        * @param       $requestInstance        An instance of a class with an Requestable interface
+        * @param       $responseInstance       An instance of a class with an Responseable interface
+        * @return      void
+        */
+       public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+               // Set request instance as extra instance
+               Registry::getRegistry()->addInstance('extra', $this);
+
+               // Get the application instance
+               $applicationInstance = $this->getResolverInstance()->getApplicationInstance();
+
+               // Prepare a template instance
+               $templateInstance = $this->prepareTemplateInstance($applicationInstance);
+
+               // Assign application data with template engine
+               $templateInstance->assignApplicationData($applicationInstance);
+
+               // Assign base URL
+               $templateInstance->assignConfigVariable('base_url');
+
+               // Load the master template
+               $masterTemplate = $applicationInstance->buildMasterTemplateName();
+
+               // Load header template
+               $templateInstance->loadCodeTemplate('header');
+
+               // Compile and assign it with a variable
+               $templateInstance->compileTemplate();
+               $templateInstance->assignTemplateWithVariable('header', 'header');
+
+               // Load footer template
+               $templateInstance->loadCodeTemplate('footer');
+
+               // Compile and assign it with a variable
+               $templateInstance->compileTemplate();
+               $templateInstance->assignTemplateWithVariable('footer', 'footer');
+
+               // Load the home template
+               $templateInstance->loadCodeTemplate('login_form');
+
+               // Assign the home template with the master template as a content ... ;)
+               $templateInstance->assignTemplateWithVariable('login_form', 'main_content');
+
+               // Load the master template
+               $templateInstance->loadCodeTemplate($masterTemplate);
+
+               // Set title
+               $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage('page_login_title'));
+
+               // Construct the menu in every command. We could do this in BaseCommand class. But this means
+               // *every* command has a navigation system and that is want we don't want.
+               $menuInstance = ObjectFactory::createObjectByConfiguredName('login_menu_class', array($applicationInstance));
+
+               // Render the menu
+               $menuInstance->renderMenu();
+
+               // Transfer it to the template engine instance
+               $menuInstance->transferContentToTemplateEngine($templateInstance);
+
+               /*
+                * ... and all variables. This should be merged together in a pattern
+                * to make things easier. A cache mechanism should be added between
+                * these two calls to cache compiled templates.
+                */
+               $templateInstance->compileVariables();
+
+               // Get the content back from the template engine and put it in response class
+               $templateInstance->transferToResponse($responseInstance);
+       }
+
+       /**
+        * Adds extra filters to the given controller instance
+        *
+        * @param       $controllerInstance             A controller instance
+        * @param       $requestInstance                An instance of a class with an Requestable interface
+        * @return      void
+        */
+       public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
+               // Empty for now
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/city/main/commands/html/class_CityHtmlLoginFailedCommand.php b/application/city/main/commands/html/class_CityHtmlLoginFailedCommand.php
new file mode 100644 (file)
index 0000000..558091d
--- /dev/null
@@ -0,0 +1,135 @@
+<?php
+/**
+ * A command for the login failed page
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2015 City Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.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 CityHtmlLoginFailedCommand extends BaseCommand implements Commandable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this class
+        *
+        * @param       $resolverInstance       An instance of a command resolver class
+        * @return      $commandInstance        An instance a prepared command class
+        */
+       public static final function createCityHtmlLoginFailedCommand (CommandResolver $resolverInstance) {
+               // Get new instance
+               $commandInstance = new CityHtmlLoginFailedCommand();
+
+               // Set the application instance
+               $commandInstance->setResolverInstance($resolverInstance);
+
+               // Return the prepared instance
+               return $commandInstance;
+       }
+
+       /**
+        * Executes the given command with given request and response objects
+        *
+        * @param       $requestInstance        An instance of a class with an Requestable interface
+        * @param       $responseInstance       An instance of a class with an Responseable interface
+        * @return      void
+        */
+       public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+               // Get the application instance
+               $applicationInstance = $this->getResolverInstance()->getApplicationInstance();
+
+               // Prepare a template instance
+               $templateInstance = $this->prepareTemplateInstance($applicationInstance);
+
+               // Assign application data with template engine
+               $templateInstance->assignApplicationData($applicationInstance);
+
+               // Load the master template
+               $masterTemplate = $applicationInstance->buildMasterTemplateName();
+
+               // Load header template
+               $templateInstance->loadCodeTemplate('header');
+
+               // Compile and assign it with a variable
+               $templateInstance->compileTemplate();
+               $templateInstance->assignTemplateWithVariable('header', 'header');
+
+               // Load footer template
+               $templateInstance->loadCodeTemplate('footer');
+
+               // Compile and assign it with a variable
+               $templateInstance->compileTemplate();
+               $templateInstance->assignTemplateWithVariable('footer', 'footer');
+
+               // Load the login_failed template
+               $templateInstance->loadCodeTemplate('login_failed');
+
+               // Assign the login_failed template with the master template as a content ... ;)
+               $templateInstance->assignTemplateWithVariable('login_failed', 'main_content');
+
+               // Load the master template
+               $templateInstance->loadCodeTemplate($masterTemplate);
+
+               // Set title
+               $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage('login_failed_title'));
+
+               // Assign base URL
+               $templateInstance->assignConfigVariable('base_url');
+
+               // Construct the menu in every command. We could do this in BaseCommand class. But this means
+               // *every* command has a navigation system and that is want we don't want.
+               $menuInstance = ObjectFactory::createObjectByConfiguredName('login_failed_menu_class', array($applicationInstance));
+
+               // Render the menu
+               $menuInstance->renderMenu();
+
+               // Transfer it to the template engine instance
+               $menuInstance->transferContentToTemplateEngine($templateInstance);
+
+               /*
+                * ... and all variables. This should be merged together in a pattern
+                * to make things easier. A cache mechanism should be added between
+                * these two calls to cache compiled templates.
+                */
+               $templateInstance->compileVariables();
+
+               // Get the content back from the template engine and put it in response class
+               $templateInstance->transferToResponse($responseInstance);
+       }
+
+       /**
+        * Adds extra filters to the given controller instance
+        *
+        * @param       $controllerInstance             A controller instance
+        * @param       $requestInstance                An instance of a class with an Requestable interface
+        * @return      void
+        */
+       public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
+               // Empty for now
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/city/main/commands/html/class_HtmlCityGuestLoginCommand.php b/application/city/main/commands/html/class_HtmlCityGuestLoginCommand.php
deleted file mode 100644 (file)
index cc71d92..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-<?php
-/**
- * A command for guest logins
- *
- * @author             Roland Haeder <webmaster@shipsimu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2015 City Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.shipsimu.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 HtmlCityGuestLoginCommand extends BaseCommand implements Commandable {
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       protected function __construct () {
-               // Call parent constructor
-               parent::__construct(__CLASS__);
-       }
-
-       /**
-        * Creates an instance of this command and sets the resolver instance
-        *
-        * @param       $resolverInstance       An instance of a command resolver
-        * @return      $commandInstance        The created command instance
-        */
-       public static final function createHtmlCityGuestLoginCommand (CommandResolver $resolverInstance) {
-               // Get a new instance
-               $commandInstance = new HtmlCityGuestLoginCommand();
-
-               // Set the resolver instance
-               $commandInstance->setResolverInstance($resolverInstance);
-
-               // Return the prepared instance
-               return $commandInstance;
-       }
-
-       /**
-        * Executes the command with given request and response objects
-        *
-        * @param       $requestInstance        An instance of a class with an Requestable interface
-        * @param       $responseInstance       An instance of a class with an Responseable interface
-        * @return      void
-        */
-       public function execute (Requestable $requestInstance, Responseable $responseInstance) {
-               // First get a GuestLogin instance
-               $loginInstance = ObjectFactory::createObjectByConfiguredName('guest_login_class');
-
-               // First set request and response instance
-               $loginInstance->setRequestInstance($requestInstance);
-
-               // Encrypt the password
-               $loginInstance->encryptPassword('passwd');
-
-               // Do the login here
-               $loginInstance->doLogin($requestInstance, $responseInstance);
-
-               // Was the login fine? Then redirect here
-               if ($loginInstance->ifLoginWasSuccessfull()) {
-                       // Try to redirect here
-                       try {
-                               // Redirect...
-                               $responseInstance->redirectToConfiguredUrl('app_login');
-
-                               // Exit here
-                               exit();
-                       } catch (FrameworkException $e) {
-                               // Something went wrong here!
-                               $responseInstance->addFatalMessage($e->getMessage());
-                       }
-               } else {
-                       // Attach error message to the response
-                       $responseInstance->addFatalMessage('failed_user_login');
-               }
-       }
-
-       /**
-        * Adds extra filters to the given controller instance
-        *
-        * @param       $controllerInstance             A controller instance
-        * @param       $requestInstance                An instance of a class with an Requestable interface
-        * @return      void
-        * @todo        Add more filters
-        */
-       public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
-               // Add username verifier filter
-               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_guest_verifier_filter'));
-
-               // Add password verifier filter
-               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('passwd_guest_verifier_filter'));
-
-               // Add CAPTCHA verifier code
-               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_guest_verifier_filter'));
-       }
-}
-
-// [EOF]
-?>
diff --git a/application/city/main/commands/html/class_HtmlCityMapCommand.php b/application/city/main/commands/html/class_HtmlCityMapCommand.php
deleted file mode 100644 (file)
index 965accd..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-<?php
-/**
- * A command for adding cities
- *
- * @author             Roland Haeder <webmaster@shipsimu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2015 City Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.shipsimu.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 HtmlCityMapCommand extends BaseCommand implements Commandable {
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       protected function __construct () {
-               // Call parent constructor
-               parent::__construct(__CLASS__);
-       }
-
-       /**
-        * Creates an instance of this command and sets the resolver instance
-        *
-        * @param       $resolverInstance       An instance of a command resolver
-        * @return      $commandInstance        The created command instance
-        */
-       public static final function createHtmlCityMapCommand (CommandResolver $resolverInstance) {
-               // Get a new instance
-               $commandInstance = new HtmlCityMapCommand();
-
-               // Set the resolver instance
-               $commandInstance->setResolverInstance($resolverInstance);
-
-               // Return the prepared instance
-               return $commandInstance;
-       }
-
-       /**
-        * Executes the command with given request and response objects
-        *
-        * @param       $requestInstance        An instance of a class with an Requestable interface
-        * @param       $responseInstance       An instance of a class with an Responseable interface
-        * @return      void
-        */
-       public function execute (Requestable $requestInstance, Responseable $responseInstance) {
-               // First get a UserRegistration instance
-               $managerInstance = ManagerFactory::createManagerByType('city');
-
-               // First set request and response instance
-               $managerInstance->setRequestInstance($requestInstance);
-               $managerInstance->setResponseInstance($responseInstance);
-
-               // Is there already a city the user has founded?
-               if ($managerInstance->isCityAlreadyFounded()) {
-                       // Found 2nd,3rd,... city
-                       $managerInstance->foundNewCity();
-               } else {
-                       // Found first city
-                       $managerInstance->foundFirstCity();
-               }
-
-               // Redirect or login after registration
-               $managerInstance->doPostAction();
-       }
-
-       /**
-        * Adds extra filters to the given controller instance
-        *
-        * @param       $controllerInstance             A controller instance
-        * @param       $requestInstance                An instance of a class with an Requestable interface
-        * @return      void
-        * @todo        Add some more pre/post filters to the controller
-        */
-       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_filter'));
-
-               // Validate user status ('confirmed' no guest)
-               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_filter'));
-
-               // Check if city name is already used
-               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('city_name_verifier_filter'));
-
-               // Validate ...
-               //$controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('email_validator_filter'));
-       }
-}
-
-// [EOF]
-?>
diff --git a/application/city/main/commands/html/class_HtmlCityRegisterCommand.php b/application/city/main/commands/html/class_HtmlCityRegisterCommand.php
deleted file mode 100644 (file)
index a683c42..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-<?php
-/**
- * A command for registration form (POST) handling
- *
- * @author             Roland Haeder <webmaster@shipsimu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2015 City Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.shipsimu.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 HtmlCityRegisterCommand extends BaseCommand implements Commandable {
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       protected function __construct () {
-               // Call parent constructor
-               parent::__construct(__CLASS__);
-       }
-
-       /**
-        * Creates an instance of this command and sets the resolver instance
-        *
-        * @param       $resolverInstance       An instance of a command resolver
-        * @return      $commandInstance        The created command instance
-        */
-       public static final function createHtmlCityRegisterCommand (CommandResolver $resolverInstance) {
-               // Get a new instance
-               $commandInstance = new HtmlCityRegisterCommand();
-
-               // Set the resolver instance
-               $commandInstance->setResolverInstance($resolverInstance);
-
-               // Return the prepared instance
-               return $commandInstance;
-       }
-
-       /**
-        * Executes the command with given request and response objects
-        *
-        * @param       $requestInstance        An instance of a class with an Requestable interface
-        * @param       $responseInstance       An instance of a class with an Responseable interface
-        * @return      void
-        */
-       public function execute (Requestable $requestInstance, Responseable $responseInstance) {
-               // First get a UserRegistration instance
-               $registerInstance = ObjectFactory::createObjectByConfiguredName('user_registration_class');
-
-               // First set request and response instance
-               $registerInstance->setRequestInstance($requestInstance);
-               $registerInstance->setResponseInstance($responseInstance);
-
-               // Encrypt the password
-               $registerInstance->encryptPassword('pass1');
-
-               // Do things before registration
-               $registerInstance->doPreRegistration();
-
-               // Register the new user
-               $registerInstance->registerNewUser();
-
-               /*
-                * Do things after registration like notifying partner pages or queueing
-                * them for notification
-                */
-               $registerInstance->doPostRegistration();
-
-               // Redirect or login after registration
-               $registerInstance->doPostAction();
-       }
-
-       /**
-        * Adds extra filters to the given controller instance
-        *
-        * @param       $controllerInstance             A controller instance
-        * @param       $requestInstance                An instance of a class with an Requestable interface
-        * @return      void
-        * @todo        Add some more pre/post filters to the controller
-        */
-       public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
-               // Validate email address (if configured: check on double email addresses)
-               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('email_validator_filter'));
-
-               // Validate username and check if it does not exist
-               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_validator_filter'));
-
-               // Validate if username is "guest" and not taken
-               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_is_guest_filter'));
-
-               // Validate if password is set
-               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('password_validator_filter'));
-
-               // Check if rules where accepted
-               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('rules_accepted_filter'));
-
-               // Validate CAPTCHA input
-               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_register_verifier_filter'));
-
-               // Validate birthday
-               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('birthday_register_verifier_filter'));
-       }
-}
-
-// [EOF]
-?>
diff --git a/application/city/main/commands/html/class_HtmlCityUserLoginCommand.php b/application/city/main/commands/html/class_HtmlCityUserLoginCommand.php
deleted file mode 100644 (file)
index 37c3d2d..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-<?php
-/**
- * A command for user login
- *
- * @author             Roland Haeder <webmaster@shipsimu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2015 City Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.shipsimu.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 HtmlCityUserLoginCommand extends BaseCommand implements Commandable {
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       protected function __construct () {
-               // Call parent constructor
-               parent::__construct(__CLASS__);
-       }
-
-       /**
-        * Creates an instance of this command and sets the resolver instance
-        *
-        * @param       $resolverInstance       An instance of a command resolver
-        * @return      $commandInstance        The created command instance
-        */
-       public static final function createHtmlCityUserLoginCommand (CommandResolver $resolverInstance) {
-               // Get a new instance
-               $commandInstance = new HtmlCityUserLoginCommand();
-
-               // Set the resolver instance
-               $commandInstance->setResolverInstance($resolverInstance);
-
-               // Return the prepared instance
-               return $commandInstance;
-       }
-
-       /**
-        * Executes the command with given request and response objects
-        *
-        * @param       $requestInstance        An instance of a class with an Requestable interface
-        * @param       $responseInstance       An instance of a class with an Responseable interface
-        * @return      void
-        */
-       public function execute (Requestable $requestInstance, Responseable $responseInstance) {
-               // First get a UserLogin instance
-               $loginInstance = ObjectFactory::createObjectByConfiguredName('user_login_class');
-
-               // First set request and response instance
-               $loginInstance->setRequestInstance($requestInstance);
-
-               // Encrypt the password
-               $loginInstance->encryptPassword('pass');
-
-               // Do the login here
-               $loginInstance->doLogin($requestInstance, $responseInstance);
-
-               // Was the login fine? Then redirect here
-               if ($loginInstance->ifLoginWasSuccessfull()) {
-                       // Try to redirect here
-                       try {
-                               // Redirect...
-                               $responseInstance->redirectToConfiguredUrl('app_login');
-
-                               // Exit here
-                               exit();
-                       } catch (FrameworkException $e) {
-                               // Something went wrong here!
-                               $responseInstance->addFatalMessage($e->getMessage());
-                       }
-               } else {
-                       // Attach error message to the response
-                       $responseInstance->addFatalMessage('failed_user_login');
-               }
-       }
-
-       /**
-        * Adds extra filters to the given controller instance
-        *
-        * @param       $controllerInstance             A controller instance
-        * @param       $requestInstance                An instance of a class with an Requestable interface
-        * @return      void
-        * @todo        Add more filters
-        */
-       public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
-               // Which login type do we have?
-               switch ($this->getConfigInstance()->getConfigEntry('login_type')) {
-                       case 'username': // Login via username
-                               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_verifier_filter'));
-                               break;
-
-                       case 'email': // Login via email
-                               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('email_verifier_filter'));
-                               break;
-
-                       default: // Wether username or email is set
-                               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_email_verifier_filter'));
-                               break;
-               }
-
-               // Password verifier filter
-               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('password_verifier_filter'));
-
-               // Add filter for CAPTCHA
-               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_user_verifier_filter'));
-       }
-}
-
-// [EOF]
-?>
diff --git a/application/city/main/controller/html/class_CityHtmlLoginFailedController.php b/application/city/main/controller/html/class_CityHtmlLoginFailedController.php
new file mode 100644 (file)
index 0000000..fd12355
--- /dev/null
@@ -0,0 +1,75 @@
+<?php
+/**
+ * A controller for login failed page
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2015 City Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.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 CityHtmlLoginFailedController extends BaseController implements Controller {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this class
+        *
+        * @param       $resolverInstance               An instance of a command resolver class
+        * @return      $controllerInstance             A prepared instance of this class
+        */
+       public static final function createCityHtmlLoginFailedController (CommandResolver $resolverInstance) {
+               // Create the instance
+               $controllerInstance = new CityHtmlLoginFailedController();
+
+               // Set the command resolver
+               $controllerInstance->setResolverInstance($resolverInstance);
+
+               // Return the prepared instance
+               return $controllerInstance;
+       }
+
+       /**
+        * Handles the given request and response
+        *
+        * @param       $requestInstance        An instance of a request class
+        * @param       $responseInstance       An instance of a response class
+        * @return      void
+        */
+       public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) {
+               // Get the command instance
+               $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance);
+
+               // This request was valid! :-D
+               $requestInstance->requestIsValid();
+
+               // Execute the command
+               $commandInstance->execute($requestInstance, $responseInstance);
+
+               // Flush the response out
+               $responseInstance->flushBuffer();
+       }
+}
+
+// [EOF]
+?>
index 2884e1e9194b673c65b7a4a877ac554ae5e1428a..8de393dbc975eaa3d6f965028ff279cbedead53a 100644 (file)
@@ -185,6 +185,7 @@ class CityInformationDatabaseWrapper extends BaseDatabaseWrapper implements City
 
                // Return result
                return $isTaken;
+       }
 
        /**
         * Creates a city from given request
index e053198035be58f23af208ee0d8935f89b03b13f..a83364fedd4efc44aca47daa959f9ab09517c1b5 100644 (file)
@@ -19,7 +19,6 @@
 
 <div id="main_content">
        {?main_content?}
-       {?content?}
 </div>
 
 <div id="main_footer">
diff --git a/application/city/templates/de/code/login_failed.ctp b/application/city/templates/de/code/login_failed.ctp
new file mode 100644 (file)
index 0000000..699b5a5
--- /dev/null
@@ -0,0 +1,46 @@
+<?php
+// Get helper instance
+$helperInstance = ObjectFactory::createObjectByConfiguredName('html_link_helper_class', array($this, 'login_retry'));
+
+// Set link text
+$helperInstance->addLinkWithTextById('login_retry');
+
+// Flush the content
+$helperInstance->flushContent();
+
+// [EOC]
+?>
+<div id="content_header">
+       Du bist nicht mehr im Spiel eingeloggt!
+</div>
+
+<div id="content_body">
+       <div id="login_failed_header">
+               Du bist nicht mehr in <span class="app_name">{?app_full_name?}</span> eingeloggt.
+               Dies kann verschiedene Gr&uuml;nde haben:
+       </div>
+
+       <ol id="login_failed_list">
+               <li>Dein Browser nimmt keine Cookies an.</li>
+               <li>Du hast den Loginbereich aus deinen Bookmarks/Favoriten aufgerufen
+                       und die Cookies sind gel&ouml;scht.</li>
+               <li>Es besteht ein Problem mit dem Server, wof&uuml;r du meistens nichts
+                       kannst. Bitte kontaktiere den Support, falls dieses Problem
+                       weiterhin besteht.</li>
+       </ol>
+
+       <div id="login_failed_footer">
+               Wenn du den Support kontaktierst, halte bitte s&auml;mtliche relevante
+               Informationen - <span class="important_note">nicht aber dein Passwort</span>
+               - bereit. Du kannst auch einen Screenshot dieser Seite anfertigen und dem
+               Support diesen senden!
+       </div>
+</div>
+
+<div id="content_footer">
+       <div id="login_retry">
+               {?login_retry?}
+       </div>
+
+       Vielen Dank f&uuml;r deine Mitarbeit! :-)
+</div>