]> git.mxchange.org Git - shipsimu.git/commitdiff
Style convention applied (incomplete), pre/post filters added for form handler
authorRoland Häder <roland@mxchange.org>
Wed, 28 May 2008 16:57:36 +0000 (16:57 +0000)
committerRoland Häder <roland@mxchange.org>
Wed, 28 May 2008 16:57:36 +0000 (16:57 +0000)
38 files changed:
.gitattributes
application/selector/init.php
application/ship-simu/class_ApplicationHelper.php
application/ship-simu/config.php
application/ship-simu/init.php
application/ship-simu/main/commands/.htaccess [new file with mode: 0644]
application/ship-simu/main/commands/web/.htaccess [new file with mode: 0644]
application/ship-simu/main/commands/web/class_WebShipsimuRegisterCommand.php [new file with mode: 0644]
inc/classes/interfaces/request/class_Requestable.php
inc/classes/interfaces/resolver/class_ControllerResolver.php
inc/classes/interfaces/response/class_Responseable.php
inc/classes/main/class_BaseFrameworkSystem.php
inc/classes/main/commands/web/class_WebDoFormCommand.php
inc/classes/main/controller/class_BaseController.php
inc/classes/main/controller/default/class_WebDefaultController.php
inc/classes/main/controller/default/class_WebDefaultNewsController.php
inc/classes/main/controller/form/class_WebDoFormController.php
inc/classes/main/filter/class_FilterChain.php
inc/classes/main/filter/validator/class_UserNameValidatorFilter.php
inc/classes/main/language/class_LanguageSystem.php
inc/classes/main/request/class_HttpRequest.php
inc/classes/main/resolver/class_BaseResolver.php
inc/classes/main/resolver/web/class_WebCommandResolver.php
inc/classes/main/resolver/web/class_WebControllerResolver.php
inc/classes/main/response/class_HttpResponse.php
inc/config.php
inc/config/config-hubmaster.php
inc/database.php
inc/database/lib-local.php
inc/includes.php
inc/language.php
inc/output.php
inc/selector.php
index.php
tests/ConfigTest.php
tests/old/contract-test.php
tests/old/loader-test.php
tests/old/personell-test.php

index 8c469f262b313ffdefeb6ca6272715c7b90bd876..62c4a881dcf51736815f8df953a35ee23e9bbb49 100644 (file)
@@ -59,6 +59,9 @@ application/ship-simu/main/class_BasePersonell.php -text
 application/ship-simu/main/class_BaseSimulator.php -text
 application/ship-simu/main/class_Merchant.php -text
 application/ship-simu/main/class_WorksContract.php -text
+application/ship-simu/main/commands/.htaccess -text
+application/ship-simu/main/commands/web/.htaccess -text
+application/ship-simu/main/commands/web/class_WebShipsimuRegisterCommand.php -text
 application/ship-simu/main/companies/.htaccess -text
 application/ship-simu/main/companies/class_ShippingCompany.php -text
 application/ship-simu/main/constructions/.htaccess -text
index 08bd8ac29057882885b43df3516041c1c646cb43..cf84d6876a5d124d25ff887ce048e2a380ff8072 100644 (file)
@@ -38,13 +38,13 @@ $app->setAppVersion("0.1a");
 $app->setAppShortName(FrameworkConfiguration::getInstance()->readConfig("selector_name"));
 
 // Initialize output system
-require(PATH . "inc/output.php");
+require(PATH . 'inc/output.php');
 
 // Initialize file i/o system
-require(PATH . "inc/file_io.php");
+require(PATH . 'inc/file_io.php');
 
 // Include the language sub-system
-require(PATH . "inc/language.php");
+require(PATH . 'inc/language.php');
 
 // [EOF]
 ?>
index b5ad8ee96d39e0dcffe234699570ef283f5dccfa..0e263851817a3483f2dba932a10385bab033a000 100644 (file)
@@ -198,7 +198,7 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica
                $resolverInstance = WebControllerResolver::createWebControllerResolver($commandName, $this);
 
                // Get a new controller instance as well
-               $controllerInstance = $resolverInstance->resolveDefaultController();
+               $controllerInstance = $resolverInstance->resolveCommandController();
 
                // Handle the request
                $controllerInstance->handleRequest($requestInstance, $responseInstance);
index 7c924f268f4bea0c958bf58094af8568dece31ff..b83f402032d81bd2fd9f1cddba98e2d269c7d8c5 100644 (file)
 $cfg = FrameworkConfiguration::getInstance();
 
 // CFG: DEFAULT-COMMAND
-$cfg->setConfigEntry("default_command", "home");
+$cfg->setConfigEntry('default_command', "home");
 
 // CFG: HOME-WITH-NEWS
-$cfg->setConfigEntry("home_with_news", "Y");
+$cfg->setConfigEntry('home_with_news', "Y");
 
 // CFG: FORM-ACTION
-$cfg->setConfigEntry("form_action", "index.php?app={?app_short_name?}&amp;page=do_form");
+$cfg->setConfigEntry('form_action', "index.php?app={?app_short_name?}&amp;page=do_form");
 
 // CFG: FORM-METHOD
-$cfg->setConfigEntry("form_method", "post");
+$cfg->setConfigEntry('form_method', "post");
 
 // CFG: FORM-TARGET
-$cfg->setConfigEntry("form_target", "_self");
+$cfg->setConfigEntry('form_target', "_self");
 
 // CFG: REGISTRATION-REQUIRES-EMAIL
-$cfg->setConfigEntry("register_requires_email", "Y");
+$cfg->setConfigEntry('register_requires_email', "Y");
 
 // CFG: REGISTRATION-INCLUDES-PROFILE
-$cfg->setConfigEntry("register_includes_profile", "Y");
+$cfg->setConfigEntry('register_includes_profile', "Y");
 
 // CFG: REGISTRATION-PERSONAL-DATA
-$cfg->setConfigEntry("register_personal_data", "Y");
+$cfg->setConfigEntry('register_personal_data', "Y");
 
 // CFG: CHAT-ENABLED-ICQ
-$cfg->setConfigEntry("chat_enabled_icq", "Y");
+$cfg->setConfigEntry('chat_enabled_icq', "Y");
 
 // CFG: CHAT-ENABLED-JABBER
-$cfg->setConfigEntry("chat_enabled_jabber", "Y");
+$cfg->setConfigEntry('chat_enabled_jabber', "Y");
 
 // CFG: CHAT-ENABLED-YAHOO
-$cfg->setConfigEntry("chat_enabled_yahoo", "Y");
+$cfg->setConfigEntry('chat_enabled_yahoo', "Y");
 
 // CFG: CHAT-ENABLED-AOL
-$cfg->setConfigEntry("chat_enabled_aol", "Y");
+$cfg->setConfigEntry('chat_enabled_aol', "Y");
 
 // CFG: CHAT-ENABLED-MSN
-$cfg->setConfigEntry("chat_enabled_msn", "Y");
+$cfg->setConfigEntry('chat_enabled_msn', "Y");
 
 // CFG: COMMAND-PARAMETER
-$cfg->setConfigEntry("command_parameter", "page");
+$cfg->setConfigEntry('command_parameter', "page");
 
 // [EOF]
 ?>
index 00df8b66289d074a50e990aaab2c91d15e353803..3719970fa7ca9c6f5f0c0d46b58d6c75e18fd97e 100644 (file)
@@ -45,19 +45,19 @@ $app->setAppVersion("0.0.0");
 $app->setAppShortName("ship-simu");
 
 // Initialize output system
-require(PATH . "inc/output.php");
+require(PATH . 'inc/output.php');
 
 // Initialize file i/o system
-require(PATH . "inc/file_io.php");
+require(PATH . 'inc/file_io.php');
 $app->setFileIoInstance($io);
 
 // Include the language sub-system
-require(PATH . "inc/language.php");
+require(PATH . 'inc/language.php');
 $app->setLanguageInstance($lang);
 
 // This application needs a database connection then we have to simply include
 // the inc/database.php script
-require(PATH . "inc/database.php");
+require(PATH . 'inc/database.php');
 
 // [EOF]
 ?>
diff --git a/application/ship-simu/main/commands/.htaccess b/application/ship-simu/main/commands/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/ship-simu/main/commands/web/.htaccess b/application/ship-simu/main/commands/web/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/ship-simu/main/commands/web/class_WebShipsimuRegisterCommand.php b/application/ship-simu/main/commands/web/class_WebShipsimuRegisterCommand.php
new file mode 100644 (file)
index 0000000..0b41b4f
--- /dev/null
@@ -0,0 +1,81 @@
+<?php
+/**
+ * A command for registration handling
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class WebShipsimuRegisterCommand extends BaseCommand implements Commandable {
+       /**
+        * Private constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Set part description
+               $this->setObjectDescription("Registration handling command for Ship-Simu");
+
+               // Create unique ID number
+               $this->createUniqueID();
+
+               // Clean up a little
+               $this->removeNumberFormaters();
+               $this->removeSystemArray();
+       }
+
+       /**
+        * 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 final static function createWebShipsimuRegisterCommand (CommandResolver $resolverInstance) {
+               // Get a new instance
+               $commandInstance = new WebShipsimuRegisterCommand();
+
+               // Set the resolver instance
+               $commandInstance->setResolverInstance($resolverInstance);
+
+               // Get the controller instance from the resolver (breaks MVC pattern again)
+               $controllerInstance = $resolverInstance->getControllerInstance();
+
+               // @TODO Add some more pre/post filters to the controller
+               $controllerInstance->addPreFilter(UserNameValidatorFilter::createUserNameValidatorFilter());
+
+               // 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->partialStub();
+       }
+}
+
+// [EOF]
+?>
index 08dd5b170b13e4f7c32cf6fa74e4d878127794f9..a7b39bf581028251e4f728ac86160ab191edbbf4 100644 (file)
@@ -62,6 +62,14 @@ interface Requestable extends FrameworkInterface {
         * @return      $headerValue    Value of the header or 'null' if not found
         */
        function getHeader ($headerName);
+
+       /**
+        * Sets wether the request was valid (default: true)
+        *
+        * @param       $isValid                Wether the request is valid
+        * @return      void
+        */
+       function requestIsValid ($isValid = true);
 }
 
 //
index e953ceee2ecc60f0d666806efcc6f9f66dd4e1fb..76ec16a244cc42527ff8d05ed578cd40b12163da 100644 (file)
@@ -27,7 +27,7 @@ interface ControllerResolver extends FrameworkInterface {
         *
         * @return      $controllerInstance             A controller instance for the default command
         */
-        function resolveDefaultController ();
+        function resolveCommandController ();
 }
 
 //
index 7416b948ca056b16bc0cc53dace0b811d8edb671..ae9f4ae91f14f3f45d17a8ebb3f87ee836d2f4e7 100644 (file)
@@ -57,6 +57,15 @@ interface Responseable extends FrameworkInterface {
         *                                                                                                      already sent
         */
        function flushBuffer($force=false);
+
+       /**
+        * Adds a fatal message id to the response. The added messages can then be
+        * processed and outputed to the world
+        *
+        * @param       $messageId      The message id we shall add
+        * @return      void
+        */
+       function addFatalMessage ($messageId);
 }
 
 //
index 0db6d280177635b337afad2730293252e5513607..75b851f85ef69b80fd3b5f8d88a652e65d8c1259 100644 (file)
@@ -952,6 +952,19 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                }
                return $className;
        }
+
+       /**
+        * Outputs a debug backtrace and stops further script execution
+        *
+        * @return      void
+        */
+       public function debugBacktrace () {
+               // Sorry, there is no other way getting this nice backtrace
+               print "<pre>\n";
+               debug_print_backtrace();
+               print "</pre>";
+               exit;
+       }
 }
 
 // [EOF]
index 1b41b4916bcab1c5b7340479944d4c3e328356d7..559c4bc56b7021764e731a2d9e46e341988f772d 100644 (file)
@@ -32,7 +32,7 @@ class WebDoFormCommand extends BaseCommand implements Commandable {
                parent::__construct(__CLASS__);
 
                // Set special description
-               $this->setObjectDescription("Home-Command");
+               $this->setObjectDescription("DoForm-Command");
 
                // Create unique ID number
                $this->createUniqueID();
@@ -66,7 +66,10 @@ class WebDoFormCommand extends BaseCommand implements Commandable {
         * @return      void
         */
        public function execute (Requestable $requestInstance, Responseable $responseInstance) {
-               die(__METHOD__.": Stub!");
+               // Should never be executed...
+               echo "<strong>This should never be executed!</strong><pre>";
+               debug_print_backtrace();
+               die("</pre>Good bye...");
        }
 }
 
index 607e042af3541c0177bf87c042d6ee5c40ba3e23..a2bf81158444abaea1aef399342006ba2683eee4 100644 (file)
@@ -1,6 +1,8 @@
 <?php
 /**
- * A generic controller class
+ * A generic controller class. You should extend this base class if you want to
+ * write your own controller. You get the advantage that you can use the pre and
+ * post filters.
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
@@ -58,7 +60,6 @@ class BaseController extends BaseFrameworkSystem {
        /**
         * Getter for a command resolver instance
         *
-        * @
         * @return      $resolverInstance       An instance of a command resolver class
         */
        public final function getResolverInstance () {
@@ -105,6 +106,7 @@ class BaseController extends BaseFrameworkSystem {
         * @return      void
         */
        protected function executePreFilters (Requestable $requestInstance, Responseable $responseInstance) {
+               // Execute all pre filters
                $this->preFilterChain->processFilters($requestInstance, $responseInstance);
        }
 
@@ -116,6 +118,7 @@ class BaseController extends BaseFrameworkSystem {
         * @return      void
         */
        protected function executePostFilters (Requestable $requestInstance, Responseable $responseInstance) {
+               // Execute all post filters
                $this->postFilterChain->processFilters($requestInstance, $responseInstance);
        }
 }
index d16713e9759e1fce4923260fbdacd2e2fd799730..6b2b89df11018cd198486ce59ede64acc0ccd6b4 100644 (file)
@@ -66,6 +66,9 @@ class WebWebDefaultController extends BaseController implements Controller {
                // Get the command instance
                $commandInstance = $this->getResolverInstance()->resolvCommandByRequest($requestInstance);
 
+               // This request was valid! :-D
+               $requestInstance->requestIsValid();
+
                // Execute the command
                $commandInstance->execute($requestInstance, $responseInstance);
 
index a6e2ebcad6891a21cfb39e62501c74f205c2b5c9..8781206699eba2c35fa8093387fde9a57fd82578 100644 (file)
@@ -69,6 +69,9 @@ class WebDefaultNewsController extends BaseController implements Controller {
                // Load the news here
                $this->loadNewsByRequest($requestInstance);
 
+               // This request was valid! :-D
+               $requestInstance->requestIsValid();
+
                // Execute the command
                $commandInstance->execute($requestInstance, $responseInstance);
 
index 6c01d87a18b474462df565cb4effc9f49b0d7ca0..bbb1d9cfa7c217ca1fcde19f171631febf90d464 100644 (file)
@@ -51,8 +51,8 @@ class WebDoFormController extends BaseController implements Controller {
                // Set resolver instance
                $controllerInstance->setResolverInstance($resolverInstance);
 
-               // Generate some pre/post filters
-               $controllerInstance->addDoFormPrePostFilters();
+               // We need the controller instance in the resolver class so set it here
+               $resolverInstance->setControllerInstance($controllerInstance);
 
                // Return the prepared instance
                return $controllerInstance;
@@ -66,32 +66,26 @@ class WebDoFormController extends BaseController implements Controller {
         * @return      void
         */
        public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) {
-               // Run all pre filters
-               $this->executePreFilters($requestInstance, $responseInstance);
-               $requestInstance->debugInstance();
+               // Get the "form action"
+               $formAction = $requestInstance->getRequestElement('form');
 
                // Get command instance from resolver
-               $commandInstance = $this->getResolverInstance()->resolvCommandByRequest($requestInstance);
+               $commandInstance = $this->getResolverInstance()->resolveCommand($formAction);
+
+               // Execute *very* generic pre filters
+               $this->executePreFilters($requestInstance, $responseInstance);
+
+               // This request was valid! :-D
+               $requestInstance->requestIsValid();
 
                // Execute the command
                $commandInstance->execute($requestInstance, $responseInstance);
 
-               // Run all post filters
+               // Execute *very* generic ppost filters
                $this->executePostFilters($requestInstance, $responseInstance);
 
-               // Do something more here
-               die("OK");
-       }
-
-       /**
-        * Add some default pre/post filters for this controller to the matching
-        * filter chains
-        *
-        * @return      void
-        */
-       protected function addDoFormPrePostFilters () {
-               // Add a filter to check for missing user name
-               $this->addPreFilter(UserNameValidatorFilter::createUserNameValidatorFilter());
+               // Flush the buffer out
+               $responseInstance->flushBuffer();
        }
 }
 
index a3353231bc25c74efd070392c231245212a99f9d..95450e7171a1878d94b4dba1d2248d7a6b58edd2 100644 (file)
@@ -79,6 +79,7 @@ class FilterChain extends BaseFrameworkSystem {
         */
        public function processFilters (Requestable $requestInstance, Responseable $responseInstance) {
                // Run all filters
+               //* DEBUG */ echo "COUNT=".count($this->filters)."<br />\n";
                foreach ($this->filters as $filterInstance) {
                        // Execute this filter
                        //* DEBUG */ echo "FILTER: ".$filterInstance->__toString().": Processing started.<br />\n";
index 9ec225165648d120cc765c2c66b7b85212b51fc8..6f18e6b5ebd47f6e3f6fbd9f021381d1b6a31eb9 100644 (file)
@@ -67,7 +67,7 @@ class UserNameValidatorFilter extends BaseFrameworkSystem implements Filterable
         */
        public function execute (Requestable $requestInstance, Responseable $responseInstance) {
                // Get username from request
-               $userName = $requestInstance->getRequestElement("username");
+               $userName = $requestInstance->getRequestElement('username');
 
                // Is the username set?
                if (is_null($userName)) {
index 35db75c562c4a81abd44dac09078ed656249e1b7..47a7c0b4fa77cd3ff47cd394d606d6e945c4723d 100644 (file)
@@ -120,49 +120,46 @@ class LanguageSystem extends BaseFrameworkSystem implements ManageableLanguage {
        }
 
        /**
-        * Initialize the array-object for all later language strings
+        * Setter for base path
         *
+        * @param               $basePath               The local base path for all templates
         * @return      void
         */
-       public function initLanguageStrings () {
-               $this->langStrings = new FrameworkArrayObject();
+       protected final function setBasePath ($basePath) {
+               // And set it
+               $this->basePath = (string) $basePath;
        }
 
        /**
-        * Setter for base path
+        * Setter for language code
         *
-        * @param               $basePath               The local base path for all templates
+        * @param               $langCode               The language code for the current application
         * @return      void
         */
-       public final function setBasePath ($basePath) {
+       protected final function setLanguageCode ($langCode) {
                // Cast it
-               $basePath = (string) $basePath;
+               $langCode = (string) $langCode;
 
-               // And set it
-               $this->basePath = $basePath;
+               // And set it (only 2 chars)
+               $this->langCode = substr($langCode, 0, 2);
        }
 
        /**
-        * Getter for language code
+        * Initialize the array-object for all later language strings
         *
-        * @return      $langCode               The language code for the current application
+        * @return      void
         */
-       public final function getLanguageCode () {
-               return $this->langCode;
+       public function initLanguageStrings () {
+               $this->langStrings = new FrameworkArrayObject();
        }
 
        /**
-        * Setter for language code
+        * Getter for language code
         *
-        * @param               $langCode               The language code for the current application
-        * @return      void
+        * @return      $langCode               The language code for the current application
         */
-       public final function setLanguageCode ($langCode) {
-               // Cast it
-               $langCode = (string) $langCode;
-
-               // And set it (only 2 chars)
-               $this->langCode = substr($langCode, 0, 2);
+       public final function getLanguageCode () {
+               return $this->langCode;
        }
 }
 
index 133f08af01be22137aa36049f467040b695bf785..2c1950ac52c4b4d4c628fd6a735ab6b138d69cf3 100644 (file)
@@ -27,6 +27,11 @@ class HttpRequest extends BaseFrameworkSystem implements Requestable {
         */
        private $requestData = array();
 
+       /**
+        * Wether this request is valid and can be further processed
+        */
+       private $requestIsValid = false;
+
        /**
         * Protected constructor
         *
@@ -154,6 +159,16 @@ class HttpRequest extends BaseFrameworkSystem implements Requestable {
        public final function getRequestMethod () {
                return $_SERVER['REQUEST_METHOD'];
        }
+
+       /**
+        * Sets wether the request was valid (default: true)
+        *
+        * @param       $isValid                Wether the request is valid
+        * @return      void
+        */
+       public final function requestIsValid ($isValid = true) {
+               $this->requestIsValid = (bool) $isValid;
+       }
 }
 
 // [EOF]
index 91f5c3d522b625a1fbdaf6a10316fc2a4c9b7ec7..9345109a8ac24b99b46e841dc6daf41cd6cd7f60 100644 (file)
@@ -32,6 +32,11 @@ class BaseResolver extends BaseFrameworkSystem {
         */
        private $commandPrefix = "";
 
+       /**
+        * A controller instance
+        */
+       private $controllerInstance = null;
+
        /**
         * Protected constructor
         *
@@ -42,9 +47,29 @@ class BaseResolver extends BaseFrameworkSystem {
                parent::__construct($class);
 
                // Clean up a little
+               $this->removeNumberFormaters();
                $this->removeSystemArray();
        }
 
+       /**
+        * Setter for controller instance (this surely breaks a bit the MVC patterm)
+        *
+        * @param       $controllerInstance             An instance of the controller
+        * @return      void
+        */
+       public final function setControllerInstance (Controller $controllerInstance) {
+               $this->controllerInstance = $controllerInstance;
+       }
+
+       /**
+        * Getter for controller instance (this surely breaks a bit the MVC patterm)
+        *
+        * @return      $controllerInstance             An instance of the controller
+        */
+       public final function getControllerInstance () {
+               return $this->controllerInstance;
+       }
+
        /**
         * Setter for command name
         *
index 05bcd6509023136521c163ec8cf0310a3276549a..edfcbe3f7acd0edada98ab09790a79aacd75f6e3 100644 (file)
@@ -42,10 +42,6 @@ class WebCommandResolver extends BaseResolver implements CommandResolver {
                // Create unique ID number
                $this->createUniqueID();
 
-               // Clean up a little
-               $this->removeNumberFormaters();
-               $this->removeSystemArray();
-
                // Set prefix to "Web"
                $this->setCommandPrefix("Web");
        }
@@ -128,6 +124,33 @@ class WebCommandResolver extends BaseResolver implements CommandResolver {
                return $commandInstance;
        }
 
+       /**
+        * Resolves the command by its direct name and returns an instance of its class
+        *
+        * @param       $commandName            The direct command name we shall resolve
+        * @return      $commandInstance        An instance of the command class
+        * @throws      InvalidCommandException         Thrown if $commandName is invalid
+        */
+       public function resolveCommand ($commandName) {
+               // Initiate the instance variable
+               $commandInstance = null;
+
+               // Is the command empty? Then fall back to default command
+               if (empty($commandName)) $commandName = $this->getConfigInstance()->readConfig("default_command");
+
+               // Check if the command is valid
+               if (!$this->isCommandValid($commandName)) {
+                       // This command is invalid!
+                       throw new InvalidCommandException(array($this, $commandName), self::EXCEPTION_INVALID_COMMAND);
+               }
+
+               // Get the command
+               $commandInstance = $this->loadCommand($commandName);
+
+               // Return the instance
+               return $commandInstance;
+       }
+
        /**
         * "Loads" a given command and instances it if not yet cached
         *
@@ -144,12 +167,12 @@ class WebCommandResolver extends BaseResolver implements CommandResolver {
                $commandInstance = null;
 
                // Create command class name
-               $class = sprintf("Web%sCommand",
+               $className = sprintf("Web%sCommand",
                        $this->convertToClassName($commandName)
                );
 
                // Is this class loaded?
-               if (!class_exists($class)) {
+               if (!class_exists($className)) {
                        // Class not found, so try the default one or throw exception
                        if ($commandName != $defaultCommand) {
                                // Try the default command
@@ -162,8 +185,8 @@ class WebCommandResolver extends BaseResolver implements CommandResolver {
 
                // Initiate the command
                $eval = sprintf("\$commandInstance = %s::create%s(\$this);",
-                       $class,
-                       $class
+                       $className,
+                       $className
                );
 
                // Run the command
index 06d0bcfe57cdefdf7f0ddb2b61f38c3d9323175a..788a03c2cc73fb58f26f6c2889033c7419aa4401 100644 (file)
@@ -47,10 +47,6 @@ class WebControllerResolver extends BaseResolver implements ControllerResolver {
                // Create unique ID number
                $this->createUniqueID();
 
-               // Clean up a little
-               $this->removeNumberFormaters();
-               $this->removeSystemArray();
-
                // Set prefix to "Web"
                $this->setCommandPrefix("Web");
        }
@@ -94,7 +90,7 @@ class WebControllerResolver extends BaseResolver implements ControllerResolver {
         * @throws      InvalidControllerInstanceException      Thrown if $commandInstance
         *                                                                                              is invalid
         */
-       public function resolveDefaultController () {
+       public function resolveCommandController () {
                // Init variables
                $commandName = "";
                $controllerInstance = null;
index 8172191acf66aedd2b36cacce1658213a4b82c00..064b3c8dea7d126c76efbc44350e288e8cc60390 100644 (file)
@@ -45,6 +45,11 @@ class HttpResponse extends BaseFrameworkSystem implements Responseable {
         */
        private $templateEngine = null;
 
+       /**
+        * Fatal resolved messages from filters and so on
+        */
+       private $fatalMessages = array();
+
        /**
         * Protected constructor
         *
@@ -75,6 +80,9 @@ class HttpResponse extends BaseFrameworkSystem implements Responseable {
                // Get a new instance
                $responseInstance = new HttpResponse();
 
+               // Set the application instance
+               $responseInstance->setApplicationInstance($appInstance);
+
                // Initialize the template engine here
                $responseInstance->initTemplateEngine($appInstance);
 
@@ -171,6 +179,18 @@ class HttpResponse extends BaseFrameworkSystem implements Responseable {
        public final function getTemplateEngine () {
                return $this->templateEngine;
        }
+
+       /**
+        * Adds a fatal message id to the response. The added messages can then be
+        * processed and outputed to the world
+        *
+        * @param       $messageId      The message id we shall add
+        * @return      void
+        */
+       public final function addFatalMessage ($messageId) {
+               // Adds the resolved message id to the fatal message list
+               $this->fatalMessages[] = $this->getApplicationInstance()->getLanguageInstance()->getMessage($messageId);
+       }
 }
 
 // [EOF]
index a3ea28ec2b6cd6722a998cd2706fd3668478c616..4bf0ab3dc80e2c2b12cf04085cd4ccfbc30e6835 100644 (file)
  */
 
 // Load the class from inc/config direktory
-@require_once(dirname(__FILE__) . "/config/class_FrameworkConfiguration.php");
+@require_once(dirname(__FILE__) . '/config/class_FrameworkConfiguration.php');
 
 // Get a new configuration instance
 $cfg = FrameworkConfiguration::createFrameworkConfiguration();
 
 // CFG: SERVER-PATH
-$cfg->definePath(dirname(dirname(__FILE__)) . "/"); // DON'T MISS THE TRAILING SLASH!!!
+$cfg->definePath(dirname(dirname(__FILE__)) . '/'); // DON'T MISS THE TRAILING SLASH!!!
 
 // CFG: DATABASE-TYPE
-$cfg->defineDatabaseType("local");
+$cfg->defineDatabaseType('local');
 
 // CFG: TIME-ZONE
 $cfg->setDefaultTimezone("Europe/Berlin");
@@ -43,103 +43,103 @@ $cfg->setDefaultTimezone("Europe/Berlin");
 $cfg->setMagicQuotesRuntime(false);
 
 // CFG: PHP-SCRIPT-EXTENSION
-$cfg->setConfigEntry("php_extension", ".php");
+$cfg->setConfigEntry('php_extension', ".php");
 
 // CFG: CLASS-PREFIX
-$cfg->setConfigEntry("class_prefix", "class_");
+$cfg->setConfigEntry('class_prefix', "class_");
 
 // CFG: CLASS-SUFFIX
-$cfg->setConfigEntry("class_suffix", ".php");
+$cfg->setConfigEntry('class_suffix', ".php");
 
 // CFG: RAW-TEMPLATE-EXTENSION
-$cfg->setConfigEntry("raw_template_extension", ".tpl");
+$cfg->setConfigEntry('raw_template_extension', ".tpl");
 
 // CFG: CODE-TEMPLATE-EXTENSION
-$cfg->setConfigEntry("code_template_extension", ".ctp");
+$cfg->setConfigEntry('code_template_extension', ".ctp");
 
 // CFG: SELECTOR-GET
-$cfg->setConfigEntry("app_selector_get", "app");
+$cfg->setConfigEntry('app_selector_get', "app");
 
 // CFG: APPLICATION-HELPER
-$cfg->setConfigEntry("app_helper_class", "ApplicationHelper");
+$cfg->setConfigEntry('app_helper_class', "ApplicationHelper");
 
 // CFG: SELECTOR-PATH
-$cfg->setConfigEntry("selector_path", "selector");
+$cfg->setConfigEntry('selector_path', "selector");
 
 // CFG: TEMPLATE-BASE-PATH
-$cfg->setConfigEntry("tpl_base_path", "templates/"); // DON'T MISS THE TRAILING SLASH!
+$cfg->setConfigEntry('tpl_base_path', "templates/"); // DON'T MISS THE TRAILING SLASH!
 
 // CFG: LANGUAGE-BASE-PATH
-$cfg->setConfigEntry("lang_base_path", "inc/language/"); // DON'T MISS THE TRAILING SLASH!
+$cfg->setConfigEntry('lang_base_path', "inc/language/"); // DON'T MISS THE TRAILING SLASH!
 
 // CFG: COMPRESSOR-BASE-PATH
-$cfg->setConfigEntry("compressor_base_path", "inc/classes/main/compressor/"); // DON'T MISS THE TRAILING SLASH!
+$cfg->setConfigEntry('compressor_base_path', "inc/classes/main/compressor/"); // DON'T MISS THE TRAILING SLASH!
 
 // CFG: APPLICATION-PATH
-$cfg->setConfigEntry("application_path", "application");
+$cfg->setConfigEntry('application_path', "application");
 
 // CFG: COMPILE-OUTPUT-PATH
-$cfg->setConfigEntry("compile_output_path", "templates/_compiled/"); // DON'T MISS THE TRAILING SLASH!
+$cfg->setConfigEntry('compile_output_path', "templates/_compiled/"); // DON'T MISS THE TRAILING SLASH!
 
 // CFG: TEMPLATE-ENGINE
-$cfg->setConfigEntry("tpl_engine", "TemplateEngine");
+$cfg->setConfigEntry('tpl_engine', "TemplateEngine");
 
 // CFG: DEBUG-ENGINE
-$cfg->setConfigEntry("debug_engine", "DebugWebOutput");
+$cfg->setConfigEntry('debug_engine', "DebugWebOutput");
 
 // CFG: DEFAULT-LANGUAGE
-$cfg->setConfigEntry("default_lang", "de"); // A two-char language string: de for german, en for english and so on
+$cfg->setConfigEntry('default_lang', "de"); // A two-char language string: de for german, en for english and so on
 
 // CFG: WEB-TEMPLATE-TYPE
-$cfg->setConfigEntry("web_template_type", "html");
+$cfg->setConfigEntry('web_template_type', "html");
 
 // CFG: EMAIL-TEMPLATE-TYPE
-$cfg->setConfigEntry("email_template_type", "emails");
+$cfg->setConfigEntry('email_template_type', "emails");
 
 // CFG: CODE-TEMPLATE-TYPE
-$cfg->setConfigEntry("code_template_type", "code");
+$cfg->setConfigEntry('code_template_type', "code");
 
 // CFG: WEB-ENGINE
-$cfg->setConfigEntry("web_engine", "WebOutput");
+$cfg->setConfigEntry('web_engine', "WebOutput");
 
 // CFG: SELECTOR-TEMPLATE-PREFIX
-$cfg->setConfigEntry("tpl_selector_prefix", "selector");
+$cfg->setConfigEntry('tpl_selector_prefix', "selector");
 
 // CFG: WEB-CONTENT-TYPE
-$cfg->setConfigEntry("web_content_type", "text/html");
+$cfg->setConfigEntry('web_content_type', "text/html");
 
 // CFG: VALID-TEMPLATE-VARIABLE
-$cfg->setConfigEntry("tpl_valid_var", "content");
+$cfg->setConfigEntry('tpl_valid_var', "content");
 
 // CFG: META-AUTHOR
-$cfg->setConfigEntry("meta_author", "Roland H&auml;der");
+$cfg->setConfigEntry('meta_author', "Roland H&auml;der");
 
 // CFG: META-PUBLISHER
-$cfg->setConfigEntry("meta_publisher", "Roland H&auml;der");
+$cfg->setConfigEntry('meta_publisher', "Roland H&auml;der");
 
 // CFG: META-KEYWORDS
-$cfg->setConfigEntry("meta_keywords", "test,test,test");
+$cfg->setConfigEntry('meta_keywords', "test,test,test");
 
 // CFG: META-DESCRIPTION
-$cfg->setConfigEntry("meta_description", "A lame description for an application framework");
+$cfg->setConfigEntry('meta_description', "A lame description for an application framework");
 
 // CFG: LAUNCH-METHOD
-$cfg->setConfigEntry("entry_method", "entryPoint");
+$cfg->setConfigEntry('entry_method', "entryPoint");
 
 // CFG: SELECTOR-MAIN-TEMPLATE
-$cfg->setConfigEntry("selector_main_tpl", "selector_main");
+$cfg->setConfigEntry('selector_main_tpl', "selector_main");
 
 // CFG: SELECTOR-APPS-TEMPLATE
-$cfg->setConfigEntry("selector_apps_tpl", "selector_apps");
+$cfg->setConfigEntry('selector_apps_tpl', "selector_apps");
 
 // CFG: SELECTOR-NAME
-$cfg->setConfigEntry("selector_name", "selector");
+$cfg->setConfigEntry('selector_name', "selector");
 
 // CFG: DEFAULT-APPLICATION
-$cfg->setConfigEntry("default_application", "selector");
+$cfg->setConfigEntry('default_application', "selector");
 
 // CFG: VERBOSE-LEVEL
-$cfg->setConfigEntry("verbose_level", 0);
+$cfg->setConfigEntry('verbose_level', 0);
 
 // [EOF]
 ?>
index 1ec81dfae8b8509bc3fbe23cb14e31c282c77785..0c59d29df3eb4438e0f760c3c825d49bdeb91a46 100644 (file)
 $cfg = FrameworkConfiguration::getInstance();
 
 // CFG: HUB-LISTEN-ADDR
-$cfg->setConfigEntry("hub_listen_addr", "0.0.0.0");
+$cfg->setConfigEntry('hub_listen_addr', "0.0.0.0");
 
 // CFG: HUB-LISTEN-PORT (zero = auto-choose)
-$cfg->setConfigEntry("hub_listen_port", 9060);
+$cfg->setConfigEntry('hub_listen_port', 9060);
 
 // CFG: HUB-MAX-AUTH-TRIES
-$cfg->setConfigEntry("hub_max_auth_tries", 3);
+$cfg->setConfigEntry('hub_max_auth_tries', 3);
 
 // CFG: HUB-MSG-AUTH-TRIES
-$cfg->setConfigEntry("hub_msg_auth_tries", "AUTH_MAX_TRIES");
+$cfg->setConfigEntry('hub_msg_auth_tries', "AUTH_MAX_TRIES");
 
 // CFG: HUB-MSG-SPOOFING
-$cfg->setConfigEntry("hub_msg_spoofing", "SPOOFING");
+$cfg->setConfigEntry('hub_msg_spoofing', "SPOOFING");
 
 // CFG: HUB-MSG-AUTH-REPLY
-$cfg->setConfigEntry("hub_msg_auth_reply_timeout", "TIMEOUT_AUTH");
+$cfg->setConfigEntry('hub_msg_auth_reply_timeout', "TIMEOUT_AUTH");
 
 // CFG: HUB-MSG-BYE
-$cfg->setConfigEntry("hub_msg_bye", "BYE");
+$cfg->setConfigEntry('hub_msg_bye', "BYE");
 
 // CFG: HUB-MASTER-IP
-$cfg->setConfigEntry("hub_master_ip", "192.168.1.17");
+$cfg->setConfigEntry('hub_master_ip', "192.168.1.17");
 
 // CFG: HUB-MASTER-PORT
-$cfg->setConfigEntry("hub_master_port", 9060);
+$cfg->setConfigEntry('hub_master_port', 9060);
 
 // CFG: HUB-AUTH-REQUEST
-$cfg->setConfigEntry("hub_auth_request", "AUTH");
+$cfg->setConfigEntry('hub_auth_request', "AUTH");
 
 // CFG: HUB-AUTH-REQUEST-TIMEOUT (5 seconds for whole auth procedure shall be fine)
-$cfg->setConfigEntry("hub_auth_request_timeout", 5);
+$cfg->setConfigEntry('hub_auth_request_timeout', 5);
 
 // CFG: HUB-PEER-HELLO
-$cfg->setConfigEntry("hub_peer_hello", "HELLO");
+$cfg->setConfigEntry('hub_peer_hello', "HELLO");
 
 // CFG: HUB-HELLO-REPLY
-$cfg->setConfigEntry("hub_hello_reply", "ELHO");
+$cfg->setConfigEntry('hub_hello_reply', "ELHO");
 
 // CFG: HUB-HELLO-TIMEOUT
-$cfg->setConfigEntry("hub_hello_timeout", 30);
+$cfg->setConfigEntry('hub_hello_timeout', 30);
 
 // CFG: HUB-HELLO-RETRIES
-$cfg->setConfigEntry("hub_hello_retires", 3);
+$cfg->setConfigEntry('hub_hello_retires', 3);
 
 // CFG: HUB-PEER-PING
-$cfg->setConfigEntry("hub_peer_ping", "PING");
+$cfg->setConfigEntry('hub_peer_ping', "PING");
 
 // CFG: HUB-PING-REPLY
-$cfg->setConfigEntry("hub_ping_reply", "PONG");
+$cfg->setConfigEntry('hub_ping_reply', "PONG");
 
 // CFG: HUB-PING-TIMEOUT
-$cfg->setConfigEntry("hub_ping_timeout", 10);
+$cfg->setConfigEntry('hub_ping_timeout', 10);
 
 // CFG: HUB-PING-MAXDROPS
-$cfg->setConfigEntry("hub_ping_maxdrops", 3);
+$cfg->setConfigEntry('hub_ping_maxdrops', 3);
 
 // CFG: HUB-PEER-MISS-PONG
-$cfg->setConfigEntry("hub_peer_miss_pong", "PONG_MISS");
+$cfg->setConfigEntry('hub_peer_miss_pong', "PONG_MISS");
 
 // [EOF]
 ?>
index ad29f0e495bf58a3c731bd70e596c30de1701f8d..62e64fb92b36f3bdf108530c8bfdce742adc8690 100644 (file)
@@ -34,7 +34,11 @@ This will choose the local-file-based database type (layer)");
 }
 
 // Generate FQFN for the database layer
-$INC = sprintf("%sinc/database/lib-%s%s", PATH, _DB_TYPE, FrameworkConfiguration::getInstance()->readConfig("php_extension"));
+$INC = sprintf("%sinc/database/lib-%s%s",
+       PATH,
+       _DB_TYPE,
+       FrameworkConfiguration::getInstance()->readConfig('php_extension')
+);
 
 // Load the database layer include
 if ((file_exists($INC)) && (is_file($INC)) && (is_readable($INC))) {
index 15511567dd604c23e98818e5cf05635f274460fe..3430af52d36d36418d1b91df8aaa6b786e2ca648 100644 (file)
@@ -24,7 +24,7 @@
 
 // Zum Testen speichern wir in lokale Dateien (LocalFileDatabase)
 try {
-       $layer = LocalFileDatabase::createLocalFileDatabase(PATH . "db/", FileIoHandler::getInstance());
+       $layer = LocalFileDatabase::createLocalFileDatabase(PATH . 'db/', FileIoHandler::getInstance());
 } catch (SavePathIsEmptyException $e) {
        ApplicationEntryPoint::app_die(sprintf("[Main:] Debug-Instanz konnte nicht gesetzt werden. Reason: <strong>%s</strong><br />\n",
                $e->getMessage()
index 52f859473f78adc4d6fbeff9ff0760ba8c983573..b699ea9118090292564bfc7d27bea711be980266 100644 (file)
@@ -23,7 +23,7 @@
  */
 
 // Include the class loader function
-require(sprintf("%sinc/loader/class_ClassLoader%s", PATH, FrameworkConfiguration::getInstance()->readConfig("php_extension")));
+require(sprintf("%sinc/loader/class_ClassLoader%s", PATH, FrameworkConfiguration::getInstance()->readConfig('php_extension')));
 
 /**
  * Is the devel package included?
@@ -32,7 +32,7 @@ if (is_dir(sprintf("%sdevel", PATH))) {
        /**
         * Load all development includes
         */
-       ClassLoader::getInstance()->loadClasses("devel");
+       ClassLoader::getInstance()->loadClasses('devel');
 }
 
 // Shall we include additional configs where you can configure some things? Then
index 552dc45894955c2c4be3bdd27f58e03f0760b070..60c9e28ebc9bbc667a4d4796a5bbe57a74737088 100644 (file)
@@ -23,7 +23,7 @@
 try {
        $lang = LanguageSystem::createLanguageSystem(sprintf("%s%s",
                PATH,
-               FrameworkConfiguration::getInstance()->readConfig("lang_base_path")
+               FrameworkConfiguration::getInstance()->readConfig('lang_base_path')
        ));
 } catch (LanguagePathIsEmptyException $e) {
        ApplicationEntryPoint::app_die(sprintf("[Main:] The language sub-system could not be initialized for the following reason: <strong>%s</strong>",
index 20f3fe8f5b7741944e64a20680a6b2f86298bcd4..7b9302a0a6dc29516cd021f9095591e82e22caba 100644 (file)
@@ -23,7 +23,7 @@
  */
 
 // Get a debugger instance
-$debug = DebugMiddleware::createDebugMiddleware(FrameworkConfiguration::getInstance()->readConfig("debug_engine"));
+$debug = DebugMiddleware::createDebugMiddleware(FrameworkConfiguration::getInstance()->readConfig('debug_engine'));
 
 // Empty string should be ignored and used for testing the middleware
 DebugMiddleware::getInstance()->output("");
index 2133c11e742dbc7babcdf75dd93bd3f9d41e7e87..0267bfa8020864bda509c57adebd99c2815d1acb 100644 (file)
  */
 
 // Does the user has an application specified?
-if (!empty($_GET[FrameworkConfiguration::getInstance()->readConfig("app_selector_get")])) {
+if (!empty($_GET[FrameworkConfiguration::getInstance()->readConfig('app_selector_get')])) {
        // Set the application from string
-       $application = (string) $_GET[FrameworkConfiguration::getInstance()->readConfig("app_selector_get")];
+       $application = (string) $_GET[FrameworkConfiguration::getInstance()->readConfig('app_selector_get')];
 } elseif (!empty($_SERVER['argv'][1])) {
        // Set the application from string
        $application = (string) $_SERVER['argv'][1];
-       $app = explode("=", trim($application));
-       if ($app[0] == FrameworkConfiguration::getInstance()->readConfig("app_selector_get")) {
+       $app = explode('=', trim($application));
+       if ($app[0] == FrameworkConfiguration::getInstance()->readConfig('app_selector_get')) {
                // Application is valid!
                $application = trim($app[1]);
        } else {
                // Invalid entry found, first must be "app"!
-               $application = FrameworkConfiguration::getInstance()->readConfig("default_application");
+               $application = FrameworkConfiguration::getInstance()->readConfig('default_application');
        }
 } else {
        // Set the "application selector" application
-       $application = FrameworkConfiguration::getInstance()->readConfig("default_application");
+       $application = FrameworkConfiguration::getInstance()->readConfig('default_application');
 }
 
 // Secure it, by keeping out tags
@@ -70,20 +70,20 @@ foreach ($configAppIncludes as $inc) {
        // Generate a FQFN for the helper class
        $fqfn = sprintf("%s%s/%s/%s%s",
                PATH,
-               FrameworkConfiguration::getInstance()->readConfig("application_path"),
+               FrameworkConfiguration::getInstance()->readConfig('application_path'),
                $application,
                $inc,
-               FrameworkConfiguration::getInstance()->readConfig("php_extension")
+               FrameworkConfiguration::getInstance()->readConfig('php_extension')
        );
 
        // Does the include file exists?
        if ((file_exists($fqfn)) && (is_file($fqfn)) && (is_readable($fqfn))) {
                // Load it
                require_once($fqfn);
-       } elseif (FrameworkConfiguration::getInstance()->readConfig("verbose_level") > 0) {
+       } elseif (FrameworkConfiguration::getInstance()->readConfig('verbose_level') > 0) {
                // File is missing
                trigger_error(sprintf("Cannot load application script %s! File is missing or read-protected.",
-                       $inc . FrameworkConfiguration::getInstance()->readConfig("php_extension")
+                       $inc . FrameworkConfiguration::getInstance()->readConfig('php_extension')
                ));
        }
 }
index 75926e2c40eedfb0c75b96aaabff9bb4278d1f2c..8dd613285f43e9be1f2d36727d2c0e47c6cbf897 100644 (file)
--- a/index.php
+++ b/index.php
@@ -67,7 +67,7 @@ class ApplicationEntryPoint {
                }
 
                // Get some instances
-               $tpl = FrameworkConfiguration::getInstance()->readConfig("tpl_engine");
+               $tpl = FrameworkConfiguration::getInstance()->readConfig('tpl_engine');
                $lang = LanguageSystem::getInstance();
                $io = FileIoHandler::getInstance();
 
@@ -76,10 +76,10 @@ class ApplicationEntryPoint {
                        // Use the template engine for putting out (nicer look) the message
                        try {
                                $eval = sprintf("\$tplEngine = %s::create%s(\"%s%s\", \$lang, \$io);",
-                                       FrameworkConfiguration::getInstance()->readConfig("tpl_engine"),
-                                       FrameworkConfiguration::getInstance()->readConfig("tpl_engine"),
+                                       FrameworkConfiguration::getInstance()->readConfig('tpl_engine'),
+                                       FrameworkConfiguration::getInstance()->readConfig('tpl_engine'),
                                        PATH,
-                                       FrameworkConfiguration::getInstance()->readConfig("tpl_base_path")
+                                       FrameworkConfiguration::getInstance()->readConfig('tpl_base_path')
                                );
                                eval($eval);
                        } catch (BasePathIsEmptyException $e) {
@@ -111,11 +111,11 @@ class ApplicationEntryPoint {
                        }
 
                        // Assign variables
-                       $tplEngine->assignVariable("message", $message);
-                       $tplEngine->assignVariable("backtrace", $backtrace);
+                       $tplEngine->assignVariable('message', $message);
+                       $tplEngine->assignVariable('backtrace', $backtrace);
 
                        // Load the template
-                       $tplEngine->loadCodeTemplate("emergency_exit");
+                       $tplEngine->loadCodeTemplate('emergency_exit');
 
                        // Compile the template
                        $tplEngine->compileTemplate();
@@ -149,16 +149,16 @@ class ApplicationEntryPoint {
                global $_SERVER;
 
                // Load config file
-               require(dirname(__FILE__) . "/inc/config.php");
+               require(dirname(__FILE__) . '/inc/config.php');
 
                // Load all include files
-               require(PATH . "inc/includes.php");
+               require(PATH . 'inc/includes.php');
 
                // Load all framework classes
-               require(PATH . "inc/classes.php");
+               require(PATH . 'inc/classes.php');
 
                // Include the application selector
-               require(PATH . "inc/selector.php");
+               require(PATH . 'inc/selector.php');
 
        } // END - main()
 
index a5cc32d1f8f960bc4a29d15190f66c63b3405ca8..4681f2fb3828302649e03a988e7744da442baeb3 100644 (file)
@@ -3,22 +3,22 @@
 @chdir("..");
 
 // Load config file
-require(dirname(dirname(__FILE__)) . "/inc/config.php");
+require(dirname(dirname(__FILE__)) . '/inc/config.php');
 
 // Load all include files
-require(PATH . "inc/includes.php");
+require(PATH . 'inc/includes.php');
 
 // Load all game classes
-require(PATH . "inc/classes.php");
+require(PATH . 'inc/classes.php');
 
 // Set default application
-FrameworkConfiguration::getInstance()->setConfigEntry("default_application", "ship-simu");
+FrameworkConfiguration::getInstance()->setConfigEntry('default_application', 'ship-simu');
 
 // Set testing mode (no starter.php will be loaded!)
 define('TEST_MODE', true);
 
 // Load the PHPUnit framework
-require_once("PHPUnit/Framework.php");
+require_once('PHPUnit/Framework.php');
 
 /**
  * A test case for the configuration sub system
@@ -58,7 +58,7 @@ class ConfigTest extends PHPUnit_Framework_TestCase {
                        $cfg = FrameworkConfiguration::getInstance();
 
                        // Now find a configuration variable that does not exist
-                       $dummy = $cfg->readConfig("does_not_exist");
+                       $dummy = $cfg->readConfig('does_not_exist');
                } catch (ConfigEntryNotFoundException $expected) {
                        // This exception was expected, so it is fine
                        $testPassed = true;
@@ -116,7 +116,7 @@ class ConfigTest extends PHPUnit_Framework_TestCase {
                        $cfg = FrameworkConfiguration::getInstance();
 
                        // Try to read an empty configuration variable
-                       $cfg->setConfigEntry("", "will_never_be_set");
+                       $cfg->setConfigEntry("", 'will_never_be_set');
                } catch (ConfigEntryIsEmptyException $expected) {
                        // This exception was expected, so it is fine
                        $testPassed = true;
@@ -144,10 +144,10 @@ class ConfigTest extends PHPUnit_Framework_TestCase {
                        $cfg = FrameworkConfiguration::getInstance();
 
                        // Try to read an empty configuration variable
-                       $cfg->setConfigEntry("test_key", "{$value}");
+                       $cfg->setConfigEntry('test_key', "{$value}");
 
                        // Read the config entry we have just written
-                       $readValue = $cfg->readConfig("test_key");
+                       $readValue = $cfg->readConfig('test_key');
 
                        // Now test the values
                        $this->assertEquals($value, $readValue);
index 4b205fc7936c26aa8a7448c15f0a18639fede9fd..3c56da51a9a998944d566db13cac659d590acb68 100644 (file)
@@ -9,28 +9,28 @@ define('TEST_MODE', true);
 require(dirname(dirname(dirname(__FILE__))) . "/inc/config.php");
 
 // Load all include files
-require(PATH . "inc/includes.php");
+require(PATH . 'inc/includes.php');
 
 // Load all game classes
-require(PATH . "inc/classes.php");
+require(PATH . 'inc/classes.php');
 
 // Load file I/O handler
-require(PATH . "inc/file_io.php");
+require(PATH . 'inc/file_io.php');
 
 // Load database layer
-require(PATH . "inc/database.php");
+require(PATH . 'inc/database.php');
 
 // Set default application
-FrameworkConfiguration::getInstance()->setConfigEntry("default_application", "ship-simu");
-$application = "ship-simu";
+FrameworkConfiguration::getInstance()->setConfigEntry('default_application', 'ship-simu');
+$application = 'ship-simu';
 
 // Load more includes
-require(PATH . "application/ship-simu/loader.php");
+require(PATH . 'application/ship-simu/loader.php');
 
 // Wir tun hier so, als waere schon das Reederei-Objekt generiert und wir wollen
 // jetzt die Personalliste wiederherstellen
 try {
-       $personell = SimulatorPersonell::createSimulatorPersonellByID("SimulatorPersonell@829292aeca3f6bf78c16e25fc4f75c98");
+       $personell = SimulatorPersonell::createSimulatorPersonellByID('SimulatorPersonell@829292aeca3f6bf78c16e25fc4f75c98');
 } catch (InvalidIDFormatException $e) {
        die(sprintf("[Main:] Could  not create personal list for follwing reason: <strong>%s</strong><br />\n",
                $e->getMessage()
index 0f415eec40935ee26b2aaeef9220e6024bb488d6..a00440a810aa5e9cc79d22654ad799b978c12336 100644 (file)
@@ -9,28 +9,28 @@ define('TEST_MODE', true);
 require(dirname(dirname(dirname(__FILE__))) . "/inc/config.php");
 
 // Load all include files
-require(PATH . "inc/includes.php");
+require(PATH . 'inc/includes.php');
 
 // Load all game classes
-require(PATH . "inc/classes.php");
+require(PATH . 'inc/classes.php');
 
 // Load file I/O handler
-require(PATH . "inc/file_io.php");
+require(PATH . 'inc/file_io.php');
 
 // Load database layer
-require(PATH . "inc/database.php");
+require(PATH . 'inc/database.php');
 
 // Set default application
-FrameworkConfiguration::getInstance()->setConfigEntry("default_application", "ship-simu");
-$application = "ship-simu";
+FrameworkConfiguration::getInstance()->setConfigEntry('default_application', 'ship-simu');
+$application = 'ship-simu';
 
 // Load more includes
-require(PATH . "application/ship-simu/loader.php");
+require(PATH . 'application/ship-simu/loader.php');
 
 // Wir tun hier so, als waere schon das Reederei-Objekt generiert und wir wollen
 // jetzt die Personalliste wiederherstellen
 try {
-       $personell = SimulatorPersonell::createSimulatorPersonellByID("SimulatorPersonell@829292aeca3f6bf78c16e25fc4f75c98");
+       $personell = SimulatorPersonell::createSimulatorPersonellByID('SimulatorPersonell@829292aeca3f6bf78c16e25fc4f75c98');
 } catch (InvalidIDFormatException $e) {
        die(sprintf("[Main:] Could  not create personal list for follwing reason: <strong>%s</strong><br />\n",
                $e->getMessage()
index 8ac3b71d23e74bf0465498e173f4fe6009246a95..43c2944e1ca42bb5a98c53774aa6e59c9c4c9293 100644 (file)
@@ -9,28 +9,28 @@ define('TEST_MODE', true);
 require(dirname(dirname(dirname(__FILE__))) . "/inc/config.php");
 
 // Load all include files
-require(PATH . "inc/includes.php");
+require(PATH . 'inc/includes.php');
 
 // Load all game classes
-require(PATH . "inc/classes.php");
+require(PATH . 'inc/classes.php');
 
 // Load file I/O handler
-require(PATH . "inc/file_io.php");
+require(PATH . 'inc/file_io.php');
 
 // Load database layer
-require(PATH . "inc/database.php");
+require(PATH . 'inc/database.php');
 
 // Set default application
-FrameworkConfiguration::getInstance()->setConfigEntry("default_application", "ship-simu");
-$application = "ship-simu";
+FrameworkConfiguration::getInstance()->setConfigEntry('default_application', 'ship-simu');
+$application = 'ship-simu';
 
 // Load more includes
-require(PATH . "application/ship-simu/loader.php");
+require(PATH . 'application/ship-simu/loader.php');
 
 // Wir tun hier so, als waere schon das Reederei-Objekt generiert und wir wollen
 // jetzt die Personalliste wiederherstellen
 try {
-       $personell = SimulatorPersonell::createSimulatorPersonellByID("SimulatorPersonell@829292aeca3f6bf78c16e25fc4f75c98");
+       $personell = SimulatorPersonell::createSimulatorPersonellByID('SimulatorPersonell@829292aeca3f6bf78c16e25fc4f75c98');
 } catch (InvalidIDFormatException $e) {
        die(sprintf("[Main:] Could  not create personal list for follwing reason: <strong>%s</strong><br />\n",
                $e->getMessage()