]> git.mxchange.org Git - city.git/commitdiff
Added a lot stuff from Ship-Simu for registration page and CAPTCHA, so basicly
authorRoland Haeder <roland@mxchange.org>
Mon, 6 Apr 2015 23:59:01 +0000 (01:59 +0200)
committerRoland Haeder <roland@mxchange.org>
Mon, 6 Apr 2015 23:59:01 +0000 (01:59 +0200)
two pages are "ready": home and register.

Signed-off-by: Roland Haeder <roland@mxchange.org>
25 files changed:
application/city/config.php
application/city/data.php
application/city/main/commands/html/class_CityHtmlRegisterCommand.php [new file with mode: 0644]
application/city/main/commands/html/class_HtmlCityRegisterCommand.php [new file with mode: 0644]
application/city/main/controller/html/class_CityHtmlRegisterController.php [new file with mode: 0644]
application/city/main/controller/html/form/.htaccess [new file with mode: 0644]
application/city/main/controller/html/form/class_CityHtmlDoFormController.php [new file with mode: 0644]
application/city/main/menu/class_CityRegisterMenu.php [new file with mode: 0644]
application/city/main/resolver/controller/console/class_CityConsoleControllerResolver.php
application/city/main/resolver/controller/html/class_CityHtmlControllerResolver.php
application/city/main/resolver/controller/image/.htaccess [new file with mode: 0644]
application/city/main/resolver/controller/image/class_CityImageControllerResolver.php [new file with mode: 0644]
application/city/main/states/city/class_
application/city/main/states/city/init/class_CityInitState.php
application/city/main/states/city/virgin/class_CityVirginState.php
application/city/templates/de/code/captch_graphic_code.ctp [new file with mode: 0644]
application/city/templates/de/code/home.ctp
application/city/templates/de/code/register_form.ctp [new file with mode: 0644]
application/city/templates/de/image/.htaccess [new file with mode: 0644]
application/city/templates/de/image/base_code.xml [new file with mode: 0644]
application/city/templates/de/image/code_captcha.img [new file with mode: 0644]
application/city/templates/de/image/emergency_exit.img [new file with mode: 0644]
core
templates/.htaccess [new file with mode: 0644]
templates/images/.htaccess [new file with mode: 0644]

index eef9f68c923e686dd87bee35b6d7d65117c12c90..40ffebb1bea52baaaa70ed761079c7723e45a9ef 100644 (file)
@@ -56,6 +56,12 @@ $cfg->setConfigEntry('default_html_command', 'home');
 // CFG: DEFAULT-CITY-HTML-COMMAND
 $cfg->setConfigEntry('default_city_html_command', 'home');
 
+// CFG: DEFAULT-HTML-CONTROLLER
+$cfg->setConfigEntry('default_html_controller', 'home');
+
+// CFG: DEFAULT-CITY-HTML-CONTROLLER
+$cfg->setConfigEntry('default_city_html_controller', 'home');
+
 // CFG: CITY-HTML-CMD-HOME-RESOLVER-CLASS
 $cfg->setConfigEntry('city_html_cmd_home_resolver_class', 'CityHtmlCommandResolver');
 
@@ -77,12 +83,144 @@ $cfg->setConfigEntry('news_register_limit', 5);
 // CFG: CITY-HOME-MENU-CLASS
 $cfg->setConfigEntry('city_home_menu_class', 'CityHomeMenu');
 
+// CFG: CITY-REGISTER-MENU-CLASS
+$cfg->setConfigEntry('city_register_menu_class', 'CityRegisterMenu');
+
 // CFG: MENU-TEMPLATE-CLASS
 $cfg->setConfigEntry('menu_template_class', 'MenuTemplateEngine');
 
 // CFG: MENU-TEMPLATE-EXTENSION
 $cfg->setConfigEntry('menu_template_extension', '.xml');
 
+// CFG: HTML-FORM-HELPER
+$cfg->setConfigEntry('html_form_helper', 'HtmlFormHelper');
+
+// CFG: FORM-ACTION
+$cfg->setConfigEntry('form_action', 'index.php?app={?app_short_name?}&amp;command=do_form');
+
+// CFG: FORM-METHOD
+$cfg->setConfigEntry('form_method', 'post');
+
+// CFG: FORM-TARGET
+$cfg->setConfigEntry('form_target', '_self');
+
+// CFG: REGISTER-REQUIRES-EMAIL
+$cfg->setConfigEntry('register_requires_email', 'Y');
+
+// CFG: REGISTER-INCLUDES-PROFILE
+$cfg->setConfigEntry('register_includes_profile', 'Y');
+
+// CFG: REGISTER-PERSONAL-DATA
+$cfg->setConfigEntry('register_personal_data', 'Y');
+
+// CFG: REGISTER-EMAIL-UNIQUE
+$cfg->setConfigEntry('register_email_unique', 'Y');
+
+// CFG: PROFILE-INCLUDES-BIRTHDAY
+$cfg->setConfigEntry('profile_includes_birthday', 'Y');
+
+// CFG: CHAT-ENABLED-ICQ
+$cfg->setConfigEntry('chat_enabled_icq', 'Y');
+
+// CFG: CHAT-ENABLED-JABBER
+$cfg->setConfigEntry('chat_enabled_jabber', 'Y');
+
+// CFG: CHAT-ENABLED-YAHOO
+$cfg->setConfigEntry('chat_enabled_yahoo', 'Y');
+
+// CFG: CHAT-ENABLED-AOL
+$cfg->setConfigEntry('chat_enabled_aol', 'Y');
+
+// CFG: CHAT-ENABLED-MSN
+$cfg->setConfigEntry('chat_enabled_msn', 'Y');
+
+// CFG: CITY-REGISTER-CAPTCHA-SECURED
+$cfg->setConfigEntry('city_register_captcha_secured', 'Y');
+
+// CFG: CITY-USER-LOGIN-CAPTCHA-SECURED
+$cfg->setConfigEntry('city_user_login_captcha_secured', 'Y');
+
+// CFG: CITY-GUEST-LOGIN-CAPTCHA-SECURED
+$cfg->setConfigEntry('city_guest_login_captcha_secured', 'Y');
+
+// CFG: CITY-PROFILE-CAPTCHA-SECURED
+$cfg->setConfigEntry('city_profile_captcha_secured', 'Y');
+
+// CFG: CITY-REFILL-CAPTCHA-SECURED
+$cfg->setConfigEntry('city_refill_captcha_secured', 'Y');
+
+// CFG: CITY-GOVERNMENT-STARTUP-CAPTCHA-SECURED
+$cfg->setConfigEntry('city_government_startup_captcha_secured', 'Y');
+
+// CFG: CITY-GOVERNMENT-TRAINING-CAPTCHA-SECURED
+$cfg->setConfigEntry('city_government_training_captcha_secured', 'Y');
+
+// CFG: CITY-REGISTER-CAPTCHA-CLASS
+$cfg->setConfigEntry('city_register_captcha_class', 'GraphicalCodeCaptcha');
+
+// CFG: CITY-USER-LOGIN-CAPTCHA-CLASS
+$cfg->setConfigEntry('city_user_login_captcha_class', 'GraphicalCodeCaptcha');
+
+// CFG: CITY-GUEST-LOGIN-CAPTCHA-CLASS
+$cfg->setConfigEntry('city_guest_login_captcha_class', 'GraphicalCodeCaptcha');
+
+// CFG: CITY-PROFILE-CAPTCHA-CLASS
+$cfg->setConfigEntry('city_profile_captcha_class', 'GraphicalCodeCaptcha');
+
+// CFG: CITY-REFILL-CAPTCHA-CLASS
+$cfg->setConfigEntry('city_refill_captcha_class', 'GraphicalCodeCaptcha');
+
+// CFG: CITY-GOVERNMENT-STARTUP-CAPTCHA-CLASS
+$cfg->setConfigEntry('city_government_startup_captcha_class', 'GraphicalCodeCaptcha');
+
+// CFG: CITY-GOVERNMENT-TRAINING-CAPTCHA-CLASS
+$cfg->setConfigEntry('city_government_training_captcha_class', 'GraphicalCodeCaptcha');
+
+// CFG: CAPTCHA-STRING-LENGTH
+$cfg->setConfigEntry('captcha_string_length', 5);
+
+// CFG: CAPTCHA-SEARCH-CHARS
+$cfg->setConfigEntry('captcha_search_chars', '+/=');
+
+// CFG: RANDOM-STRING-LENGTH
+$cfg->setConfigEntry('random_string_length', 100);
+
+// CFG: IMAGE-TEMPLATE-CLASS
+$cfg->setConfigEntry('image_template_class', 'ImageTemplateEngine');
+
+// CFG: CAPTCHA-ENCRYPT-VALIDATOR-FILTER
+$cfg->setConfigEntry('captcha_encrypt_validator_filter', 'CaptchaEncryptFilter');
+
+// CFG: CITY-HTML-CMD-DO-FORM-RESOLVER-CLASS
+$cfg->setConfigEntry('city_html_cmd_do_form_resolver_class', 'HtmlCommandResolver');
+
+// CFG: CAPTCHA-GUEST-VERIFIER-FILTER
+$cfg->setConfigEntry('captcha_guest_verifier_filter', 'GraphicalCodeCaptchaVerifierFilter');
+
+// CFG: CAPTCHA-USER-VERIFIER-FILTER
+$cfg->setConfigEntry('captcha_user_verifier_filter', 'GraphicalCodeCaptchaVerifierFilter');
+
+// CFG: CAPTCHA-REGISTER-VERIFIER-FILTER
+$cfg->setConfigEntry('captcha_register_verifier_filter', 'GraphicalCodeCaptchaVerifierFilter');
+
+// CFG: CAPTCHA-REFILL-VERFIER-FILTER
+$cfg->setConfigEntry('captcha_refill_verifier_filter', 'GraphicalCodeCaptchaVerifierFilter');
+
+// CFG: CAPTCHA-GOVERNMENT-VERFIER-FILTER
+$cfg->setConfigEntry('captcha_government_verifier_filter', 'GraphicalCodeCaptchaVerifierFilter');
+
+// CFG: CAPTCHA-PROFILE-VERFIER-FILTER
+$cfg->setConfigEntry('captcha_profile_verifier_filter', 'GraphicalCodeCaptchaVerifierFilter');
+
+// CFG: CONFIRM-CODE-VERIFIER-FILTER
+$cfg->setConfigEntry('confirm_code_verifier_filter', 'ConfirmCodeVerifierFilter');
+
+// CFG: BIRTHDAY-REGISTER-VERIFIER-FILTER
+$cfg->setConfigEntry('birthday_register_verifier_filter', 'BirthdayVerifierFilter');
+
+// CFG: BIRTHDAY-PROFILE-VERIFIER-FILTER
+$cfg->setConfigEntry('birthday_profile_verifier_filter', 'BirthdayVerifierFilter');
+
 /******************************************************************************
  *                              Console client                                *
  ******************************************************************************/
index 80bef1c83c9c031535bcb85d3968ed5d6956d73d..c656060655ca92c3ddee66e9345f0de7fde82aa7 100644 (file)
@@ -35,7 +35,7 @@ $app = call_user_func_array(
 );
 
 // Set application name and version
-$app->setAppName('Simple City Grow Simulation');
+$app->setAppName('Simple City Growth Simulation');
 $app->setAppVersion('0.0.0');
 $app->setAppShortName('city');
 
diff --git a/application/city/main/commands/html/class_CityHtmlRegisterCommand.php b/application/city/main/commands/html/class_CityHtmlRegisterCommand.php
new file mode 100644 (file)
index 0000000..ad43a76
--- /dev/null
@@ -0,0 +1,80 @@
+<?php
+/**
+ * A command for registration handling
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2015 Ship-Simu 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 CityHtmlRegisterCommand 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 createCityHtmlRegisterCommand (CommandResolver $resolverInstance) {
+               // Get a new instance
+               $commandInstance = new CityHtmlRegisterCommand();
+
+               // 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) {
+               /*
+                * This is a generic HTML request, this means that a regular page with
+                * header, menu, content and footer shall be send to the client.
+                */
+               $this->sendGenericGetResponse($requestInstance, $responseInstance, '_form');
+       }
+
+       /**
+        * 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) {
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/city/main/commands/html/class_HtmlCityRegisterCommand.php b/application/city/main/commands/html/class_HtmlCityRegisterCommand.php
new file mode 100644 (file)
index 0000000..4b82e51
--- /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 Ship-Simu 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/controller/html/class_CityHtmlRegisterController.php b/application/city/main/controller/html/class_CityHtmlRegisterController.php
new file mode 100644 (file)
index 0000000..fd4f4b8
--- /dev/null
@@ -0,0 +1,72 @@
+<?php
+/**
+ * Controller for register 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 CityHtmlRegisterController extends BaseController implements Controller {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Init additional filter chains
+               foreach (array('shutdown') as $filterChain) {
+                       $this->initFilterChain($filterChain);
+               } // END - foreach
+       }
+
+       /**
+        * Creates an instance of this class
+        *
+        * @param       $resolverInstance               An instance of a command resolver class
+        * @return      $controllerInstance             A prepared instance of this class
+        * @todo        Add some filters to this controller
+        */
+       public static final function createCityHtmlRegisterController (CommandResolver $resolverInstance) {
+               // Create the instance
+               $controllerInstance = new CityHtmlRegisterController();
+
+               // 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) {
+               // Generic pre-post command execution
+               $this->executeGenericPrePostCommand($requestInstance, $responseInstance);
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/city/main/controller/html/form/.htaccess b/application/city/main/controller/html/form/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/city/main/controller/html/form/class_CityHtmlDoFormController.php b/application/city/main/controller/html/form/class_CityHtmlDoFormController.php
new file mode 100644 (file)
index 0000000..be5c413
--- /dev/null
@@ -0,0 +1,102 @@
+<?php
+/**
+ * A controller for handling sent forms
+ *
+ * @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 CityHtmlDoFormController 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 resolver class
+        * @return      $controllerInstance             A prepared instance of this class
+        */
+       public static final function createCityHtmlDoFormController (CommandResolver $resolverInstance) {
+               // Create the instance
+               $controllerInstance = new CityHtmlDoFormController();
+
+               // Set resolver instance
+               $controllerInstance->setResolverInstance($resolverInstance);
+
+               // We need the controller instance in resolver class so set it here
+               $resolverInstance->setControllerInstance($controllerInstance);
+
+               // 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 "form action"
+               $formAction = $requestInstance->getRequestElement('form');
+
+               // Get command instance from resolver
+               $commandInstance = $this->getResolverInstance()->resolveCommand($formAction);
+
+               // Add more filters by the command
+               $commandInstance->addExtraFilters($this, $requestInstance);
+
+               // Try to run the pre filters, if auth exceptions come through redirect here
+               try {
+                       // Run the pre filters
+                       $this->executePreFilters($requestInstance, $responseInstance);
+               } catch (UserAuthorizationException $e) {
+                       // Redirect to main page
+                       $responseInstance->redirectToConfiguredUrl('login_failed');
+
+                       // Exit here
+                       exit();
+               }
+
+               /*
+                * Is the request still valid? Post filters shall only be executed of
+                * the request is valid
+                */
+               if ($requestInstance->isRequestValid()) {
+                       // Execute the command
+                       $commandInstance->execute($requestInstance, $responseInstance);
+
+                       // Execute *very* generic ppost filters
+                       $this->executePostFilters($requestInstance, $responseInstance);
+               } // END - if
+
+               // Flush the buffer out
+               $responseInstance->flushBuffer();
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/city/main/menu/class_CityRegisterMenu.php b/application/city/main/menu/class_CityRegisterMenu.php
new file mode 100644 (file)
index 0000000..5205c00
--- /dev/null
@@ -0,0 +1,50 @@
+<?php
+/**
+ * A menu class for City registration
+ *
+ * @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 CityRegisterMenu extends BaseMenu implements RenderableMenu {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this class
+        *
+        * @return      $menuInstance   An instance of this class
+        */
+       public static final function createCityRegisterMenu () {
+               // Get a new instance
+               $menuInstance = new CityRegisterMenu();
+
+               // Return the prepared instance
+               return $menuInstance;
+       }
+}
+
+// [EOF]
+?>
index 7245db0f20ee17012d3db2f54b3aa198b448bcd4..8bc4aed95a0b9924c3a4c5e64ef320d3bdbc14c0 100644 (file)
@@ -36,68 +36,36 @@ class CityConsoleControllerResolver extends BaseControllerResolver implements Co
        }
 
        /**
-        * Creates an instance of a resolver class with a given command
+        * Creates an instance of a resolver class with a given controller
         *
         * @param       $controllerName                         The controller we shall resolve
         * @param       $applicationInstance            An instance of a manageable application helper class
         * @return      $resolverInstance                       The prepared controller resolver instance
-        * @throws      EmptyVariableException          Thrown if default command is not set
+        * @throws      EmptyVariableException          Thrown if default controller is not set
         * @throws      InvalidControllerException      Thrown if default controller is invalid
         */
        public static final function createCityConsoleControllerResolver ($controllerName, ManageableApplication $applicationInstance) {
                // Create the new instance
                $resolverInstance = new CityConsoleControllerResolver();
 
-               // Is the variable $controllerName set and the command is valid?
+               // Is the variable $controllerName set and the controller is valid?
                if (empty($controllerName)) {
                        // Then thrown an exception here
-                       throw new EmptyVariableException(array($resolverInstance, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+                       throw new EmptyVariableException(array($resolverInstance, 'controllerName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
                } elseif ($resolverInstance->isControllerValid($controllerName) === FALSE) {
-                       // Invalid command found
+                       // Invalid controller found
                        throw new InvalidControllerException(array($resolverInstance, $controllerName), self::EXCEPTION_INVALID_CONTROLLER);
                }
 
                // Set the application instance
                $resolverInstance->setApplicationInstance($applicationInstance);
 
-               // Set command name
+               // Set controller 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->setResolvedInstance($controllerInstance);
-
-               // Return the maybe resolved instance
-               return $controllerInstance;
-       }
 }
 
 // [EOF]
index 4164595b260f05756d013d9141ba73a742ac480c..ea84e320a39a66aa7fdaf5b99823e2ca2e92e99b 100644 (file)
@@ -36,68 +36,36 @@ class CityHtmlControllerResolver extends BaseControllerResolver implements Contr
        }
 
        /**
-        * Creates an instance of a resolver class with a given command
+        * Creates an instance of a resolver class with a given controller
         *
         * @param       $controllerName                         The controller we shall resolve
         * @param       $applicationInstance            An instance of a manageable application helper class
         * @return      $resolverInstance                       The prepared controller resolver instance
-        * @throws      EmptyVariableException          Thrown if default command is not set
+        * @throws      EmptyVariableException          Thrown if default controller is not set
         * @throws      InvalidControllerException      Thrown if default controller is invalid
         */
        public static final function createCityHtmlControllerResolver ($controllerName, ManageableApplication $applicationInstance) {
                // Create the new instance
                $resolverInstance = new CityHtmlControllerResolver();
 
-               // Is the variable $controllerName set and the command is valid?
+               // Is the variable $controllerName set and the controller is valid?
                if (empty($controllerName)) {
                        // Then thrown an exception here
-                       throw new EmptyVariableException(array($resolverInstance, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+                       throw new EmptyVariableException(array($resolverInstance, 'controllerName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
                } elseif ($resolverInstance->isControllerValid($controllerName) === FALSE) {
-                       // Invalid command found
+                       // Invalid controller found
                        throw new InvalidControllerException(array($resolverInstance, $controllerName), self::EXCEPTION_INVALID_CONTROLLER);
                }
 
                // Set the application instance
                $resolverInstance->setApplicationInstance($applicationInstance);
 
-               // Set command name
+               // Set controller 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->setResolvedInstance($controllerInstance);
-
-               // Return the maybe resolved instance
-               return $controllerInstance;
-       }
 }
 
 // [EOF]
diff --git a/application/city/main/resolver/controller/image/.htaccess b/application/city/main/resolver/controller/image/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/city/main/resolver/controller/image/class_CityImageControllerResolver.php b/application/city/main/resolver/controller/image/class_CityImageControllerResolver.php
new file mode 100644 (file)
index 0000000..c6d302b
--- /dev/null
@@ -0,0 +1,72 @@
+<?php
+/**
+ * A resolver for resolving controllers locally
+ *
+ * @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 CityImageControllerResolver extends BaseControllerResolver implements ControllerResolver {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Set prefix to 'image'
+               $this->setClassPrefix('image');
+       }
+
+       /**
+        * Creates an instance of a resolver class with a given controller
+        *
+        * @param       $controllerName                         The controller we shall resolve
+        * @param       $applicationInstance            An instance of a manageable application helper class
+        * @return      $resolverInstance                       The prepared controller resolver instance
+        * @throws      EmptyVariableException          Thrown if default controller is not set
+        * @throws      InvalidControllerException      Thrown if default controller is invalid
+        */
+       public static final function createCityImageControllerResolver ($controllerName, ManageableApplication $applicationInstance) {
+               // Create the new instance
+               $resolverInstance = new CityImageControllerResolver();
+
+               // Is the variable $controllerName set and the controller is valid?
+               if (empty($controllerName)) {
+                       // Then thrown an exception here
+                       throw new EmptyVariableException(array($resolverInstance, 'controllerName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+               } elseif ($resolverInstance->isControllerValid($controllerName) === FALSE) {
+                       // Invalid controller found
+                       throw new InvalidControllerException(array($resolverInstance, $controllerName), self::EXCEPTION_INVALID_CONTROLLER);
+               }
+
+               // Set the application instance
+               $resolverInstance->setApplicationInstance($applicationInstance);
+
+               // Set controller name
+               $resolverInstance->setControllerName($controllerName);
+
+               // Return the prepared instance
+               return $resolverInstance;
+       }
+}
+
+// [EOF]
+?>
index 5df9aa593ac11c22a31a72db7651d5e4f7d7fa62..250c39dfd542ecb1a771a3cd719ecbfb191eaf7d 100644 (file)
@@ -48,9 +48,6 @@ class City???State extends BaseCityState implements Stateable {
                // Debug message
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CITY-STATE: Has changed from ' . $cityInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . '.');
 
-               // Set the city instance
-               $stateInstance->setCityInstance($cityInstance);
-
                // Return the prepared instance
                return $stateInstance;
        }
index 28584cd8d3feaab64c441f622ca68f8c0fb867ec..ea9d5b8bace4e0bcaef0ccce24baf92153f643ba 100644 (file)
@@ -45,9 +45,6 @@ class CityInitState extends BaseCityState implements Stateable {
                // Get new instance
                $stateInstance = new CityInitState();
 
-               // Set the city instance
-               $stateInstance->setCityInstance($cityInstance);
-
                // Return the prepared instance
                return $stateInstance;
        }
index 97a3432335292835a31a0fe111d17ba52b2b00c5..14c53a59a4c10c2b75e73a403c4d5f1640cc6260 100644 (file)
@@ -45,9 +45,6 @@ class CityVirginState extends BaseCityState implements Stateable {
                // Get new instance
                $stateInstance = new CityVirginState();
 
-               // Set the city instance
-               $stateInstance->setCityInstance($cityInstance);
-
                // Return the prepared instance
                return $stateInstance;
        }
diff --git a/application/city/templates/de/code/captch_graphic_code.ctp b/application/city/templates/de/code/captch_graphic_code.ctp
new file mode 100644 (file)
index 0000000..942d94c
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+// Get a helper instance without a form tag
+$captchaHelper = ObjectFactory::createObjectByConfiguredName('html_form_helper', array($this, 'captcha_code', false, false));
+
+// Add input field with text for CAPTCHA code
+$captchaHelper->addFieldText('captcha_code', "Bitte wiederhole den Code:");
+$captchaHelper->addInputTextField('c_code');
+
+// Add hidden field with validation hash
+$captchaHelper->addInputHiddenField('hash', $this->readVariable('captcha_hash'));
+
+// Flush content
+$captchaHelper->flushContent();
+
+// [EOC]
+?>
+<div class="captcha_image">
+       <img src="{?base_url?}/index.php?app={?app_short_name?}&amp;command=code_captcha&amp;encrypt={?encrypted_code?}&amp;request=image"
+        alt="CAPTCHA-Bild" title="CAPTCHA-Bild" class="captcha_img" />
+</div>
+<div class="captcha_code">
+       {?captcha_code?}
+</div>
index 72fd839a7bd2b540b9c97668094e0694a8d93f19..fe5965567c67992f5c697e12f35a17b00c0eab93 100644 (file)
@@ -5,3 +5,7 @@
 <div id="news_frame">
        {?city_news?}
 </div>
+
+<div id="welcome">
+       Hier wird der Gast zum Spiel begr&uuml;sst.
+</div>
diff --git a/application/city/templates/de/code/register_form.ctp b/application/city/templates/de/code/register_form.ctp
new file mode 100644 (file)
index 0000000..3a9c354
--- /dev/null
@@ -0,0 +1,134 @@
+<?php
+// Get helper instance for web forms. This will add the opening form-tag to
+// the helper's render cache which is simply a small variable in the class
+// BaseHelper.
+$helperInstance = ObjectFactory::createObjectByConfiguredName('html_form_helper', array($this, 'city_register'));
+
+// Always ask at least for nickname and password
+$helperInstance->addFormGroup('login', "Bitte gebe hier gew&uuml;nschten Nickname und dein Zugangspasswort ein.");
+$helperInstance->addFormSubGroup('username', "Dein Nickname wird erst nach Absenden des Formulares gepr&uuml;ft. Sp&auml;ter bauen wir dann einen automatischen Test ein, der dir sofort zeigt, ob der Nickname bereits vergeben ist.");
+$helperInstance->addFieldText('username', "Nickname im Spiel:");
+$helperInstance->addInputTextField('username');
+$helperInstance->addFormSubGroup('pass', "Dein Passwort sollte nicht zu leicht erratbar sein. Sp&auml;ter bauen wir hier noch einen automatischen Test ein, der dir sofort die Passwortst&auml;rke anzeigt.");
+$helperInstance->addFieldText('pass1', "Passwort:");
+$helperInstance->addInputPasswordField('pass1');
+$helperInstance->addFieldText('pass2', "Passwortwiederholung:");
+$helperInstance->addInputPasswordField('pass2');
+
+// Does this registration require an email?
+if ($helperInstance->ifRegisterRequiresEmailVerification()) {
+       $helperInstance->addFormGroup('email', "Bitte gebe deine Email zweimal (ein zweites Mal zur Best&auml;tigung) ein, damit wir dir deinen Freischaltlink zusenden k&ouml;nnen.");
+       $helperInstance->addFieldText('email1', "Email-Adresse:");
+       $helperInstance->addInputTextField('email1');
+       $helperInstance->addFieldText('email2', "Wiederholung Email-Adresse:");
+       $helperInstance->addInputTextField('email2');
+
+       // Must the email address be unique in this system?
+       if ($helperInstance->ifEmailMustBeUnique()) {
+               $helperInstance->addFormNote('email', "Die von dir eingegebene Email-Adresse darf nur einmal im Spiel verwendet worden sein.");
+       } // END - if
+} // END - if
+
+// Shall we also ask some personal data to complete the profile?
+if ($helperInstance->ifRegisterIncludesProfile()) {
+       $helperInstance->addFormGroup('profile', "Hier kannst du zus&auml;tzlich deine Profildaten vorweg eingeben, du kannst sie aber auch nach dem Login vervollst&auml;ndigen!");
+
+       if (!$helperInstance->ifRegisterRequiresEmailVerification()) {
+               $helperInstance->addFormSubGroup('email', "Die Angabe deiner Email-Adresse ist nur dann n&ouml;tig, wenn du auch Email-Benachrichtigungen (<span id=\"add_note\">*1</span>) haben m&ouml;chtest.");
+               $helperInstance->addFieldText('email1', "Email-Adresse:");
+               $helperInstance->addInputTextField('email1');
+
+               // Must the email address be unique in this system?
+               if ($helperInstance->ifEmailMustBeUnique()) {
+                       $helperInstance->addFormNote('email', "Die von dir eingegebene Email-Adresse darf nur einmal im Spiel verwendet worden sein.");
+               } // END - if
+       } // END - if
+
+       // Persoenliche Daten mit in der Anmeldung abfragen?
+       if ($helperInstance->ifRegisterIncludesPersonaData()) {
+               $helperInstance->addFormSubGroup('persona', "Wenn du magst, dann vervollst&auml;ndige deine komplette Adresse mit deinem Namen.");
+               $helperInstance->addFieldText('surname', "Dein Vorname:");
+               $helperInstance->addInputTextField('surname');
+               $helperInstance->addFieldText('family', "Dein Nachname:");
+               $helperInstance->addInputTextField('family');
+               $helperInstance->addFieldText('street', "Strasse und Hausnummer:");
+               $helperInstance->addInputTextField('street');
+               $helperInstance->addFieldText('city', "Wohnort:");
+               $helperInstance->addInputTextField('city');
+
+               // Include birthday?
+               if ($helperInstance->ifProfileIncludesBirthDay()) {
+                       $helperInstance->addFormSubGroup('birthday', "Verrate uns doch dein Geburtsdatum, als Dankesch&ouml;n erh&auml;lst du interessante Pr&auml;mien - ausschliesslich per Email - zum Geburtstag zugesandt! G&uuml;ltiges Format: TT.MM.JJJJ");
+                       $helperInstance->addInputTextField('birth_day');
+                       $helperInstance->addFieldText('birth_day', ".");
+                       $helperInstance->addInputTextField('birth_month');
+                       $helperInstance->addFieldText('birth_day', ".");
+                       $helperInstance->addInputTextField('birth_year');
+               } // END - if
+       } // END - if
+
+       $helperInstance->addFormSubGroup('zip', "Magst du uns auch deine Postleitzahl verraten?");
+       $helperInstance->addFieldText('zip', "Postleitzahl:");
+       $helperInstance->addInputTextField('zip');
+
+       $helperInstance->addFormSubGroup('chat', "Gebe hier deine Nicknames bzw. Nummern an:");
+
+       if ($helperInstance->ifChatEnabled('icq')) {
+               $helperInstance->addFieldText('icq', "ICQ-Nummer:");
+               $helperInstance->addInputTextField('icq');
+       } // END - if
+
+       if ($helperInstance->ifChatEnabled('jabber')) {
+               $helperInstance->addFieldText('jabber', "Jabber:");
+               $helperInstance->addInputTextField('jabber');
+       } // END - if
+
+       if ($helperInstance->ifChatEnabled('yahoo')) {
+               $helperInstance->addFieldText('yahoo', "Yahoo!:");
+               $helperInstance->addInputTextField('yahoo');
+       } // END - if
+
+       if ($helperInstance->ifChatEnabled('aol')) {
+               $helperInstance->addFieldText('aol', "AOL-Screenname:");
+               $helperInstance->addInputTextField('aol');
+       } // END - if
+
+       if ($helperInstance->ifChatEnabled('msn')) {
+               $helperInstance->addFieldText('msn', "MSN:");
+               $helperInstance->addInputTextField('msn');
+       } // END - if
+
+       if (!$helperInstance->ifRegisterRequiresEmailVerification()) {
+               $helperInstance->addFormExtraNote(1, "Die Benachrichtigungen per sind im Loginbereich verfeinerbar, welche du genau haben willst.");
+       } // END - Extra note
+
+} // END - ask profile data
+
+// Spielregeln abfragen
+$helperInstance->addFormGroup('rules', "Bitte lese dir die Spieleregeln gut durch und kreuze dann &quot;Ja, ich akzeptiere die aktuellen Spielregeln&quot; an.");
+$helperInstance->addFieldText('rules', "Ja, ich akzeptiere die aktuellen Spielregeln:");
+$helperInstance->addInputCheckboxField('rules', false);
+
+// Add CAPTCHA?
+if ($helperInstance->ifFormSecuredWithCaptcha()) {
+       $helperInstance->addFormGroup('captcha', "Bitte wiederhole den angezeigten Code damit die Anmeldung abgeschlossen werden kann.");
+       $helperInstance->addCaptcha();
+} // END - if
+
+// Final note and submit buttons
+$helperInstance->addFormGroup('buttons', "Wenn du alle ben&ouml;tigten Felder korrekt ausgef&uuml;t hast, kannst du die Anmeldung abschliessen.");
+
+$helperInstance->addInputResetButton("Alles nochmal eingeben");
+$helperInstance->addInputSubmitButton("Anmeldung zum Spiel abschliessen");
+$helperInstance->addFormNote('data_protection', "Deine Daten werden nach den g&uuml;ltigen Datenschutzgesetzen gespeichert und werden nicht an Dritte weitergegeben. Weiteres dazu siehe Link &quot;Datenschutz&quot;.");
+$helperInstance->flushContent();
+
+// [EOC]
+?>
+<div id="content_header">
+       Anmeldung bei <span class="app_name">{?app_full_name?}</span>
+</div>
+
+<div id="register_box">
+       {?city_register?}
+</div>
diff --git a/application/city/templates/de/image/.htaccess b/application/city/templates/de/image/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/city/templates/de/image/base_code.xml b/application/city/templates/de/image/base_code.xml
new file mode 100644 (file)
index 0000000..5de71be
--- /dev/null
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<image>
+       <type value="{?image_type?}" />
+       <base>
+               <name value="{?image_name?}" />
+       </base>
+       <resolution>
+               <width value="{?image_width?}" />
+               <height value="{?image_height?}" />
+       </resolution>
+       <background-color>
+               <red value="{?image_bg_red?}" />
+               <green value="{?image_bg_green?}" />
+               <blue value="{?image_bg_blue?}" />
+       </background-color>
+       <foreground-color>
+               <red value="{?image_fg_red?}" />
+               <green value="{?image_fg_green?}" />
+               <blue value="{?image_fg_blue?}" />
+       </foreground-color>
+       <image-string value="groupable">
+               <string-name value="{?image_string_name?}" />
+               <x value="{?image_x?}" />
+               <y value="{?image_y?}" />
+               <font-size value="{?image_size?}" />
+               <text value="{?image_string?}" />
+       </image-string>
+</image>
diff --git a/application/city/templates/de/image/code_captcha.img b/application/city/templates/de/image/code_captcha.img
new file mode 100644 (file)
index 0000000..223e4fb
--- /dev/null
@@ -0,0 +1,78 @@
+<?php
+// Needed in every image template to initialy set the image type
+$helper = ImageHelper::createImageHelper($this, 'png');
+$helper->setImageName('code_captcha');
+$helper->setBaseImage('base_code');
+
+// Set image dimensions
+$helper->setWidth(100);
+$helper->setHeight(50);
+
+// Get random number
+$rand = $helper->getRngInstance()->randomNumber(0, 6);
+
+// Background and foreground color
+switch ($rand) {
+       case 1:
+               // First varriant
+               $helper->setBackgroundColorRedGreenBlue('rand', 0x90  , 0x00  );
+               $helper->setForegroundColorRedGreenBlue(0x00  , 0xff  , 'rand');
+               break;
+
+       case 2:
+               // Second varriant
+               $helper->setBackgroundColorRedGreenBlue(0x90  , 'rand', 0x00  );
+               $helper->setForegroundColorRedGreenBlue(0xff  , 0x00  , 'rand');
+               break;
+
+       case 3:
+               // Third varriant
+               $helper->setBackgroundColorRedGreenBlue('rand', 0x00  , 0x90  );
+               $helper->setForegroundColorRedGreenBlue(0x00  , 'rand', 0xff  );
+               break;
+
+       case 4:
+               // Forth varriant
+               $helper->setBackgroundColorRedGreenBlue(0x00  , 0x90  , 'rand');
+               $helper->setForegroundColorRedGreenBlue(0x00  , 'rand', 0xa0  );
+               break;
+
+       case 5:
+               // Fith varriant
+               $helper->setBackgroundColorRedGreenBlue('rand', 0x00  , 0x90  );
+               $helper->setForegroundColorRedGreenBlue(0x00  , 0xe0  , 'rand');
+               break;
+
+       default:
+               // Last varriant
+               $helper->setBackgroundColorRedGreenBlue(0x00  , 'rand', 0x90  );
+               $helper->setForegroundColorRedGreenBlue(0xff  , 0x00  , 'rand');
+               break;
+}
+
+// Random X/Y factors...
+$xRand = $helper->getRngInstance()->randomNumber(0, 45);
+$yRand = $helper->getRngInstance()->randomNumber(0, 25);
+
+// Add code
+$helper->addTextLine('code');
+$helper->setCoord((5 + $xRand), (5 + $yRand));
+$helper->setFontSize('rand');
+$helper->setImageString('{?decrypted_code?}');
+
+// Only for debug!
+/*
+$helper->addTextLine('debug');
+$helper->setCoord(90, 35);
+$helper->setFontSize(3);
+$helper->setImageString($rand);
+*/
+
+// Flush content to the template engine
+$helper->flushContent();
+
+// Comment this out if image is done
+//$this->debugInstance();
+
+// [EOF]
+?>
diff --git a/application/city/templates/de/image/emergency_exit.img b/application/city/templates/de/image/emergency_exit.img
new file mode 100644 (file)
index 0000000..bf67aa7
--- /dev/null
@@ -0,0 +1,18 @@
+<?php
+// Needed in every image template to initialy set the image type
+$helper = ImageHelper::createImageHelper($this, 'png');
+$helper->setImageName('emergency_exit');
+$helper->setBaseImage('base_exit');
+
+// Set image dimensions
+$helper->setWidth(100);
+$helper->setHeight(50);
+
+// Flush content to the template engine
+//$helper->flushContent();
+
+// Comment this out if image is done
+$this->debugInstance();
+
+// [EOF]
+?>
diff --git a/core b/core
index 3b3947b86b38904aa1100b54846c14d3b31cb97d..bbb4031b65beb69a02f8c476ae4cdc36da851d84 160000 (submodule)
--- a/core
+++ b/core
@@ -1 +1 @@
-Subproject commit 3b3947b86b38904aa1100b54846c14d3b31cb97d
+Subproject commit bbb4031b65beb69a02f8c476ae4cdc36da851d84
diff --git a/templates/.htaccess b/templates/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/templates/images/.htaccess b/templates/images/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all