From: Roland Häder Date: Wed, 28 May 2008 16:57:36 +0000 (+0000) Subject: Style convention applied (incomplete), pre/post filters added for form handler X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b226bbefe6bc09bcd75432c3c3ba32bf7da45b71;p=shipsimu.git Style convention applied (incomplete), pre/post filters added for form handler --- diff --git a/.gitattributes b/.gitattributes index 8c469f2..62c4a88 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 diff --git a/application/selector/init.php b/application/selector/init.php index 08bd8ac..cf84d68 100644 --- a/application/selector/init.php +++ b/application/selector/init.php @@ -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] ?> diff --git a/application/ship-simu/class_ApplicationHelper.php b/application/ship-simu/class_ApplicationHelper.php index b5ad8ee..0e26385 100644 --- a/application/ship-simu/class_ApplicationHelper.php +++ b/application/ship-simu/class_ApplicationHelper.php @@ -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); diff --git a/application/ship-simu/config.php b/application/ship-simu/config.php index 7c924f2..b83f402 100644 --- a/application/ship-simu/config.php +++ b/application/ship-simu/config.php @@ -26,46 +26,46 @@ $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?}&page=do_form"); +$cfg->setConfigEntry('form_action', "index.php?app={?app_short_name?}&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] ?> diff --git a/application/ship-simu/init.php b/application/ship-simu/init.php index 00df8b6..3719970 100644 --- a/application/ship-simu/init.php +++ b/application/ship-simu/init.php @@ -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 index 0000000..3a42882 --- /dev/null +++ b/application/ship-simu/main/commands/.htaccess @@ -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 index 0000000..3a42882 --- /dev/null +++ b/application/ship-simu/main/commands/web/.htaccess @@ -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 index 0000000..0b41b4f --- /dev/null +++ b/application/ship-simu/main/commands/web/class_WebShipsimuRegisterCommand.php @@ -0,0 +1,81 @@ + + * @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 . + */ +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] +?> diff --git a/inc/classes/interfaces/request/class_Requestable.php b/inc/classes/interfaces/request/class_Requestable.php index 08dd5b1..a7b39bf 100644 --- a/inc/classes/interfaces/request/class_Requestable.php +++ b/inc/classes/interfaces/request/class_Requestable.php @@ -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); } // diff --git a/inc/classes/interfaces/resolver/class_ControllerResolver.php b/inc/classes/interfaces/resolver/class_ControllerResolver.php index e953cee..76ec16a 100644 --- a/inc/classes/interfaces/resolver/class_ControllerResolver.php +++ b/inc/classes/interfaces/resolver/class_ControllerResolver.php @@ -27,7 +27,7 @@ interface ControllerResolver extends FrameworkInterface { * * @return $controllerInstance A controller instance for the default command */ - function resolveDefaultController (); + function resolveCommandController (); } // diff --git a/inc/classes/interfaces/response/class_Responseable.php b/inc/classes/interfaces/response/class_Responseable.php index 7416b94..ae9f4ae 100644 --- a/inc/classes/interfaces/response/class_Responseable.php +++ b/inc/classes/interfaces/response/class_Responseable.php @@ -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); } // diff --git a/inc/classes/main/class_BaseFrameworkSystem.php b/inc/classes/main/class_BaseFrameworkSystem.php index 0db6d28..75b851f 100644 --- a/inc/classes/main/class_BaseFrameworkSystem.php +++ b/inc/classes/main/class_BaseFrameworkSystem.php @@ -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 "
\n";
+		debug_print_backtrace();
+		print "
"; + exit; + } } // [EOF] diff --git a/inc/classes/main/commands/web/class_WebDoFormCommand.php b/inc/classes/main/commands/web/class_WebDoFormCommand.php index 1b41b49..559c4bc 100644 --- a/inc/classes/main/commands/web/class_WebDoFormCommand.php +++ b/inc/classes/main/commands/web/class_WebDoFormCommand.php @@ -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 "This should never be executed!
";
+		debug_print_backtrace();
+		die("
Good bye..."); } } diff --git a/inc/classes/main/controller/class_BaseController.php b/inc/classes/main/controller/class_BaseController.php index 607e042..a2bf811 100644 --- a/inc/classes/main/controller/class_BaseController.php +++ b/inc/classes/main/controller/class_BaseController.php @@ -1,6 +1,8 @@ * @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); } } diff --git a/inc/classes/main/controller/default/class_WebDefaultController.php b/inc/classes/main/controller/default/class_WebDefaultController.php index d16713e..6b2b89d 100644 --- a/inc/classes/main/controller/default/class_WebDefaultController.php +++ b/inc/classes/main/controller/default/class_WebDefaultController.php @@ -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); diff --git a/inc/classes/main/controller/default/class_WebDefaultNewsController.php b/inc/classes/main/controller/default/class_WebDefaultNewsController.php index a6e2ebc..8781206 100644 --- a/inc/classes/main/controller/default/class_WebDefaultNewsController.php +++ b/inc/classes/main/controller/default/class_WebDefaultNewsController.php @@ -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); diff --git a/inc/classes/main/controller/form/class_WebDoFormController.php b/inc/classes/main/controller/form/class_WebDoFormController.php index 6c01d87..bbb1d9c 100644 --- a/inc/classes/main/controller/form/class_WebDoFormController.php +++ b/inc/classes/main/controller/form/class_WebDoFormController.php @@ -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(); } } diff --git a/inc/classes/main/filter/class_FilterChain.php b/inc/classes/main/filter/class_FilterChain.php index a335323..95450e7 100644 --- a/inc/classes/main/filter/class_FilterChain.php +++ b/inc/classes/main/filter/class_FilterChain.php @@ -79,6 +79,7 @@ class FilterChain extends BaseFrameworkSystem { */ public function processFilters (Requestable $requestInstance, Responseable $responseInstance) { // Run all filters + //* DEBUG */ echo "COUNT=".count($this->filters)."
\n"; foreach ($this->filters as $filterInstance) { // Execute this filter //* DEBUG */ echo "FILTER: ".$filterInstance->__toString().": Processing started.
\n"; diff --git a/inc/classes/main/filter/validator/class_UserNameValidatorFilter.php b/inc/classes/main/filter/validator/class_UserNameValidatorFilter.php index 9ec2251..6f18e6b 100644 --- a/inc/classes/main/filter/validator/class_UserNameValidatorFilter.php +++ b/inc/classes/main/filter/validator/class_UserNameValidatorFilter.php @@ -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)) { diff --git a/inc/classes/main/language/class_LanguageSystem.php b/inc/classes/main/language/class_LanguageSystem.php index 35db75c..47a7c0b 100644 --- a/inc/classes/main/language/class_LanguageSystem.php +++ b/inc/classes/main/language/class_LanguageSystem.php @@ -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; } } diff --git a/inc/classes/main/request/class_HttpRequest.php b/inc/classes/main/request/class_HttpRequest.php index 133f08a..2c1950a 100644 --- a/inc/classes/main/request/class_HttpRequest.php +++ b/inc/classes/main/request/class_HttpRequest.php @@ -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] diff --git a/inc/classes/main/resolver/class_BaseResolver.php b/inc/classes/main/resolver/class_BaseResolver.php index 91f5c3d..9345109 100644 --- a/inc/classes/main/resolver/class_BaseResolver.php +++ b/inc/classes/main/resolver/class_BaseResolver.php @@ -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 * diff --git a/inc/classes/main/resolver/web/class_WebCommandResolver.php b/inc/classes/main/resolver/web/class_WebCommandResolver.php index 05bcd65..edfcbe3 100644 --- a/inc/classes/main/resolver/web/class_WebCommandResolver.php +++ b/inc/classes/main/resolver/web/class_WebCommandResolver.php @@ -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 diff --git a/inc/classes/main/resolver/web/class_WebControllerResolver.php b/inc/classes/main/resolver/web/class_WebControllerResolver.php index 06d0bcf..788a03c 100644 --- a/inc/classes/main/resolver/web/class_WebControllerResolver.php +++ b/inc/classes/main/resolver/web/class_WebControllerResolver.php @@ -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; diff --git a/inc/classes/main/response/class_HttpResponse.php b/inc/classes/main/response/class_HttpResponse.php index 8172191..064b3c8 100644 --- a/inc/classes/main/response/class_HttpResponse.php +++ b/inc/classes/main/response/class_HttpResponse.php @@ -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] diff --git a/inc/config.php b/inc/config.php index a3ea28e..4bf0ab3 100644 --- a/inc/config.php +++ b/inc/config.php @@ -25,16 +25,16 @@ */ // 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äder"); +$cfg->setConfigEntry('meta_author', "Roland Häder"); // CFG: META-PUBLISHER -$cfg->setConfigEntry("meta_publisher", "Roland Häder"); +$cfg->setConfigEntry('meta_publisher', "Roland Hä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] ?> diff --git a/inc/config/config-hubmaster.php b/inc/config/config-hubmaster.php index 1ec81df..0c59d29 100644 --- a/inc/config/config-hubmaster.php +++ b/inc/config/config-hubmaster.php @@ -25,64 +25,64 @@ $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] ?> diff --git a/inc/database.php b/inc/database.php index ad29f0e..62e64fb 100644 --- a/inc/database.php +++ b/inc/database.php @@ -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))) { diff --git a/inc/database/lib-local.php b/inc/database/lib-local.php index 1551156..3430af5 100644 --- a/inc/database/lib-local.php +++ b/inc/database/lib-local.php @@ -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: %s
\n", $e->getMessage() diff --git a/inc/includes.php b/inc/includes.php index 52f8594..b699ea9 100644 --- a/inc/includes.php +++ b/inc/includes.php @@ -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 diff --git a/inc/language.php b/inc/language.php index 552dc45..60c9e28 100644 --- a/inc/language.php +++ b/inc/language.php @@ -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: %s", diff --git a/inc/output.php b/inc/output.php index 20f3fe8..7b9302a 100644 --- a/inc/output.php +++ b/inc/output.php @@ -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(""); diff --git a/inc/selector.php b/inc/selector.php index 2133c11..0267bfa 100644 --- a/inc/selector.php +++ b/inc/selector.php @@ -23,23 +23,23 @@ */ // 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') )); } } diff --git a/index.php b/index.php index 75926e2..8dd6132 100644 --- 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() diff --git a/tests/ConfigTest.php b/tests/ConfigTest.php index a5cc32d..4681f2f 100644 --- a/tests/ConfigTest.php +++ b/tests/ConfigTest.php @@ -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); diff --git a/tests/old/contract-test.php b/tests/old/contract-test.php index 4b205fc..3c56da5 100644 --- a/tests/old/contract-test.php +++ b/tests/old/contract-test.php @@ -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: %s
\n", $e->getMessage() diff --git a/tests/old/loader-test.php b/tests/old/loader-test.php index 0f415ee..a00440a 100644 --- a/tests/old/loader-test.php +++ b/tests/old/loader-test.php @@ -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: %s
\n", $e->getMessage() diff --git a/tests/old/personell-test.php b/tests/old/personell-test.php index 8ac3b71..43c2944 100644 --- a/tests/old/personell-test.php +++ b/tests/old/personell-test.php @@ -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: %s
\n", $e->getMessage()