]> git.mxchange.org Git - hub.git/commitdiff
Base updated from ship-simu code
authorRoland Häder <roland@mxchange.org>
Mon, 5 May 2008 23:22:08 +0000 (23:22 +0000)
committerRoland Häder <roland@mxchange.org>
Mon, 5 May 2008 23:22:08 +0000 (23:22 +0000)
42 files changed:
.gitattributes
inc/classes/exceptions/controller/.htaccess [new file with mode: 0644]
inc/classes/exceptions/controller/class_DefaultControllerException.php [new file with mode: 0644]
inc/classes/exceptions/main/class_EmptyVariableException.php [new file with mode: 0644]
inc/classes/exceptions/main/class_InvalidCommandException.php [new file with mode: 0644]
inc/classes/exceptions/main/class_InvalidCommandInstanceException.php [new file with mode: 0644]
inc/classes/exceptions/main/class_InvalidControllerException.php [new file with mode: 0644]
inc/classes/exceptions/main/class_ResponseHeadersAlreadySentException.php [new file with mode: 0644]
inc/classes/interfaces/class_ [new file with mode: 0644]
inc/classes/interfaces/commands/.htaccess [new file with mode: 0644]
inc/classes/interfaces/commands/class_Commandable.php [new file with mode: 0644]
inc/classes/interfaces/controller/.htaccess [new file with mode: 0644]
inc/classes/interfaces/controller/class_Controller.php [new file with mode: 0644]
inc/classes/interfaces/request/.htaccess [new file with mode: 0644]
inc/classes/interfaces/request/class_Requestable.php [new file with mode: 0644]
inc/classes/interfaces/resolver/.htaccess [new file with mode: 0644]
inc/classes/interfaces/resolver/class_CommandResolver.php [new file with mode: 0644]
inc/classes/interfaces/resolver/class_ControllerResolver.php [new file with mode: 0644]
inc/classes/interfaces/response/.htaccess [new file with mode: 0644]
inc/classes/interfaces/response/class_Responseable.php [new file with mode: 0644]
inc/classes/main/class_ [new file with mode: 0644]
inc/classes/main/commands/.htaccess [new file with mode: 0644]
inc/classes/main/commands/class_BaseCommand.php [new file with mode: 0644]
inc/classes/main/commands/local/.htaccess [new file with mode: 0644]
inc/classes/main/commands/local/class_LocalHomeCommand.php [new file with mode: 0644]
inc/classes/main/controller/.htaccess [new file with mode: 0644]
inc/classes/main/controller/class_ [new file with mode: 0644]
inc/classes/main/controller/class_BaseController.php [new file with mode: 0644]
inc/classes/main/controller/default/.htaccess [new file with mode: 0644]
inc/classes/main/controller/default/class_LocalDefaultController.php [new file with mode: 0644]
inc/classes/main/controller/default/class_LocalDefaultNewsController.php [new file with mode: 0644]
inc/classes/main/controller/registration/.htaccess [new file with mode: 0644]
inc/classes/main/controller/registration/class_DefaultRegistrationController.php [new file with mode: 0644]
inc/classes/main/request/.htaccess [new file with mode: 0644]
inc/classes/main/request/class_HttpRequest.php [new file with mode: 0644]
inc/classes/main/resolver/.htaccess [new file with mode: 0644]
inc/classes/main/resolver/class_BaseResolver.php [new file with mode: 0644]
inc/classes/main/resolver/local/.htaccess [new file with mode: 0644]
inc/classes/main/resolver/local/class_LocalCommandResolver.php [new file with mode: 0644]
inc/classes/main/resolver/local/class_LocalControllerResolver.php [new file with mode: 0644]
inc/classes/main/response/.htaccess [new file with mode: 0644]
inc/classes/main/response/class_HttpResponse.php [new file with mode: 0644]

index 9771ed95d19c717035c86b97dff22e437238da57..f2cc2248dcf256f0238f53a7c1b084657fdd1fb6 100644 (file)
@@ -61,6 +61,8 @@ inc/classes/exceptions/container/.htaccess -text
 inc/classes/exceptions/container/class_ContainerItemIsNoArrayException.php -text
 inc/classes/exceptions/container/class_ContainerItemIsNullException.php -text
 inc/classes/exceptions/container/class_ContainerMaybeDamagedException.php -text
+inc/classes/exceptions/controller/.htaccess -text
+inc/classes/exceptions/controller/class_DefaultControllerException.php -text
 inc/classes/exceptions/database/.htaccess -text
 inc/classes/exceptions/database/local_file/.htaccess -text
 inc/classes/exceptions/database/local_file/class_SavePathIsEmptyException.php -text
@@ -89,10 +91,14 @@ inc/classes/exceptions/main/class_ClassNotFoundException.php -text
 inc/classes/exceptions/main/class_ConfigEntryIsEmptyException.php -text
 inc/classes/exceptions/main/class_ConfigEntryNotFoundException.php -text
 inc/classes/exceptions/main/class_DimNotFoundInArrayException.php -text
+inc/classes/exceptions/main/class_EmptyVariableException.php -text
 inc/classes/exceptions/main/class_ExceptionNotChangedException.php -text
 inc/classes/exceptions/main/class_ExceptionNotFoundException.php -text
 inc/classes/exceptions/main/class_GetterNotFoundException.php -text
 inc/classes/exceptions/main/class_InvalidArrayCountException.php -text
+inc/classes/exceptions/main/class_InvalidCommandException.php -text
+inc/classes/exceptions/main/class_InvalidCommandInstanceException.php -text
+inc/classes/exceptions/main/class_InvalidControllerException.php -text
 inc/classes/exceptions/main/class_InvalidObjectException.php -text
 inc/classes/exceptions/main/class_MissingArrayElementsException.php -text
 inc/classes/exceptions/main/class_MissingDecimalsThousandsSeperatorException.php -text
@@ -101,6 +107,7 @@ inc/classes/exceptions/main/class_NoArrayCreatedException.php -text
 inc/classes/exceptions/main/class_NoArrayException.php -text
 inc/classes/exceptions/main/class_NoObjectException.php -text
 inc/classes/exceptions/main/class_NullPointerException.php -text
+inc/classes/exceptions/main/class_ResponseHeadersAlreadySentException.php -text
 inc/classes/exceptions/main/class_VariableIsNotSetException.php -text
 inc/classes/exceptions/template/.htaccess -text
 inc/classes/exceptions/template/class_BasePathIsEmptyException.php -text
@@ -114,9 +121,14 @@ inc/classes/exceptions/template/class_ViewHelperNotFoundException.php -text
 inc/classes/interfaces/.htaccess -text
 inc/classes/interfaces/application/.htaccess -text
 inc/classes/interfaces/application/class_ManageableApplication.php -text
+inc/classes/interfaces/class_ -text
 inc/classes/interfaces/class_FrameworkInterface.php -text
+inc/classes/interfaces/commands/.htaccess -text
+inc/classes/interfaces/commands/class_Commandable.php -text
 inc/classes/interfaces/compressor/.htaccess -text
 inc/classes/interfaces/compressor/class_Compressor.php -text
+inc/classes/interfaces/controller/.htaccess -text
+inc/classes/interfaces/controller/class_Controller.php -text
 inc/classes/interfaces/database/.htaccess -text
 inc/classes/interfaces/database/class_FrameworkDatabaseInterface.php -text
 inc/classes/interfaces/database/frontend/.htaccess -text
@@ -136,18 +148,38 @@ inc/classes/interfaces/io/output/.htaccess -text
 inc/classes/interfaces/io/output/class_OutputStreamer.php -text
 inc/classes/interfaces/language/.htaccess -text
 inc/classes/interfaces/language/class_ManageableLanguage.php -text
+inc/classes/interfaces/request/.htaccess -text
+inc/classes/interfaces/request/class_Requestable.php -text
+inc/classes/interfaces/resolver/.htaccess -text
+inc/classes/interfaces/resolver/class_CommandResolver.php -text
+inc/classes/interfaces/resolver/class_ControllerResolver.php -text
+inc/classes/interfaces/response/.htaccess -text
+inc/classes/interfaces/response/class_Responseable.php -text
 inc/classes/interfaces/template/.htaccess -text
 inc/classes/interfaces/template/class_CompileableTemplate.php -text
 inc/classes/interfaces/template/view/class_ViewHelper.php -text
 inc/classes/main/.htaccess -text
+inc/classes/main/class_ -text
 inc/classes/main/class_BaseFrameworkSystem.php -text
 inc/classes/main/class_FrameworkArrayObject.php -text
+inc/classes/main/commands/.htaccess -text
+inc/classes/main/commands/class_BaseCommand.php -text
+inc/classes/main/commands/local/.htaccess -text
+inc/classes/main/commands/local/class_LocalHomeCommand.php -text
 inc/classes/main/compressor/.htaccess -text
 inc/classes/main/compressor/class_Bzip2Compressor.php -text
 inc/classes/main/compressor/class_GzipCompressor.php -text
 inc/classes/main/compressor/class_NullCompressor.php -text
 inc/classes/main/console/.htaccess -text
 inc/classes/main/console/class_ConsoleTools.php -text
+inc/classes/main/controller/.htaccess -text
+inc/classes/main/controller/class_ -text
+inc/classes/main/controller/class_BaseController.php -text
+inc/classes/main/controller/default/.htaccess -text
+inc/classes/main/controller/default/class_LocalDefaultController.php -text
+inc/classes/main/controller/default/class_LocalDefaultNewsController.php -text
+inc/classes/main/controller/registration/.htaccess -text
+inc/classes/main/controller/registration/class_DefaultRegistrationController.php -text
 inc/classes/main/database/.htaccess -text
 inc/classes/main/database/class_BaseDatabaseFrontend.php -text
 inc/classes/main/database/classes/.htaccess -text
@@ -169,6 +201,15 @@ inc/classes/main/language/class_LanguageSystem.php -text
 inc/classes/main/output/.htaccess -text
 inc/classes/main/output/class_ConsoleOutput.php -text
 inc/classes/main/output/class_WebOutput.php -text
+inc/classes/main/request/.htaccess -text
+inc/classes/main/request/class_HttpRequest.php -text
+inc/classes/main/resolver/.htaccess -text
+inc/classes/main/resolver/class_BaseResolver.php -text
+inc/classes/main/resolver/local/.htaccess -text
+inc/classes/main/resolver/local/class_LocalCommandResolver.php -text
+inc/classes/main/resolver/local/class_LocalControllerResolver.php -text
+inc/classes/main/response/.htaccess -text
+inc/classes/main/response/class_HttpResponse.php -text
 inc/classes/main/template/.htaccess -text
 inc/classes/main/template/class_TemplateEngine.php -text
 inc/classes/middleware/.htaccess -text
diff --git a/inc/classes/exceptions/controller/.htaccess b/inc/classes/exceptions/controller/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/classes/exceptions/controller/class_DefaultControllerException.php b/inc/classes/exceptions/controller/class_DefaultControllerException.php
new file mode 100644 (file)
index 0000000..aead2d4
--- /dev/null
@@ -0,0 +1,45 @@
+<?php
+/**
+ * This exception is thrown when the default controller is missing
+ *
+ * @author             Roland Haeder <webmaster@mxchange.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 DefaultControllerException extends FrameworkException {
+       /**
+        * The super constructor for all exceptions
+        *
+        * @param               $resolverInstance       An instance of a resolver class
+        * @param               $code                           An optional code for better debugging
+        * @return      void
+        */
+       public function __construct(ControllerResolver $resolverInstance, $code) {
+               // Prepare the message
+               $message = sprintf("[%s:%d] Cannot resolv default controller. Maybe missing?",
+                       $resolverInstance->__toString(),
+                       $this->getLine()
+               );
+
+               // Call parent contructor with message
+               parent::__construct($message, $code);
+       }
+}
+
+// [EOF]
+?>
diff --git a/inc/classes/exceptions/main/class_EmptyVariableException.php b/inc/classes/exceptions/main/class_EmptyVariableException.php
new file mode 100644 (file)
index 0000000..a415276
--- /dev/null
@@ -0,0 +1,46 @@
+<?php
+/**
+ * This exception is thrown when a variable is unexpected empty
+ *
+ * @author             Roland Haeder <webmaster@mxchange.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 EmptyVariableException extends FrameworkException {
+       /**
+        * The constructor
+        *
+        * @param               $msgArray       Message array holding all needed data
+        * @param               $code           Code number for the exception
+        * @return      void
+        */
+       public function __construct (array $msgArray, $code) {
+               // Add a message around the missing class
+               $message = sprintf("[%s:%d] Variable <u>%s</u> is not set.",
+                       $msgArray[0]->__toString(),
+                       $this->getLine(),
+                       $msgArray[1]
+               );
+
+               // Call parent constructor
+               parent::__construct($message, $code);
+       }
+}
+
+// [EOF]
+?>
diff --git a/inc/classes/exceptions/main/class_InvalidCommandException.php b/inc/classes/exceptions/main/class_InvalidCommandException.php
new file mode 100644 (file)
index 0000000..b0bc623
--- /dev/null
@@ -0,0 +1,46 @@
+<?php
+/**
+ * This exception is thrown when a command is invalid
+ *
+ * @author             Roland Haeder <webmaster@mxchange.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 InvalidCommandException extends FrameworkException {
+       /**
+        * The constructor
+        *
+        * @param               $message        Message from the exception
+        * @param               $code           Code number for the exception
+        * @return      void
+        */
+       public function __construct (array $msgArray, $code) {
+               // Add a message around the missing class
+               $message = sprintf("[%s:%d] Invalid command <u>%s</u> detected.",
+                       $msgArray[0]->__toString(),
+                       $this->getLine(),
+                       htmlentities(strip_tags($msgArray[1]), ENT_QUOTES)
+               );
+
+               // Call parent constructor
+               parent::__construct($message, $code);
+       }
+}
+
+// [EOF]
+?>
diff --git a/inc/classes/exceptions/main/class_InvalidCommandInstanceException.php b/inc/classes/exceptions/main/class_InvalidCommandInstanceException.php
new file mode 100644 (file)
index 0000000..e802e9e
--- /dev/null
@@ -0,0 +1,46 @@
+<?php
+/**
+ * This exception is thrown when a command instance is invalid
+ *
+ * @author             Roland Haeder <webmaster@mxchange.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 InvalidCommandInstanceException extends FrameworkException {
+       /**
+        * The constructor
+        *
+        * @param               $message        Message from the exception
+        * @param               $code           Code number for the exception
+        * @return      void
+        */
+       public function __construct (array $msgArray, $code) {
+               // Add a message around the missing class
+               $message = sprintf("[%s:%d] Invalid command <u>%s</u> detected.",
+                       $msgArray[0]->__toString(),
+                       $this->getLine(),
+                       $msgArray[1]
+               );
+
+               // Call parent constructor
+               parent::__construct($message, $code);
+       }
+}
+
+// [EOF]
+?>
diff --git a/inc/classes/exceptions/main/class_InvalidControllerException.php b/inc/classes/exceptions/main/class_InvalidControllerException.php
new file mode 100644 (file)
index 0000000..3caf2a5
--- /dev/null
@@ -0,0 +1,46 @@
+<?php
+/**
+ * This exception is thrown when a controller instance is invalid
+ *
+ * @author             Roland Haeder <webmaster@mxchange.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 InvalidControllerInstanceException extends FrameworkException {
+       /**
+        * The constructor
+        *
+        * @param               $msgArray       Array with data from the exception point
+        * @param               $code           Code number for the exception
+        * @return      void
+        */
+       public function __construct (array $msgArray, $code) {
+               // Add a message around the missing class
+               $message = sprintf("[%s:%d] Invalid controller <u>%s</u> detected.",
+                       $msgArray[0]->__toString(),
+                       $this->getLine(),
+                       $msgArray[1]
+               );
+
+               // Call parent constructor
+               parent::__construct($message, $code);
+       }
+}
+
+// [EOF]
+?>
diff --git a/inc/classes/exceptions/main/class_ResponseHeadersAlreadySentException.php b/inc/classes/exceptions/main/class_ResponseHeadersAlreadySentException.php
new file mode 100644 (file)
index 0000000..72751d9
--- /dev/null
@@ -0,0 +1,45 @@
+<?php
+/**
+ * An exception thrown when an object instance is null
+ *
+ * @author             Roland Haeder <webmaster@mxchange.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 ResponseHeadersAlreadySentException extends FrameworkException {
+       /**
+        * The constructor
+        *
+        * @param               $message                Message from the exception
+        * @param               $code           Code number for the exception
+        * @return      void
+        */
+       public function __construct (BaseFrameworkSystem $class, $code) {
+               // Add a message around the missing class
+               $message = sprintf("[%s:%d] Headers are already sent!",
+                       $class->__toString(),
+                       $this->getLine()
+               );
+
+               // Call parent constructor
+               parent::__construct($message, $code);
+       }
+}
+
+// [EOF]
+?>
diff --git a/inc/classes/interfaces/class_ b/inc/classes/interfaces/class_
new file mode 100644 (file)
index 0000000..055ad90
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+/**
+ * 
+ *
+ * @author             Roland Haeder <webmaster@mxchange.org>
+ * @version            0.0.0
+ * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+interface  extends FrameworkInterface {
+}
+
+//
+?>
diff --git a/inc/classes/interfaces/commands/.htaccess b/inc/classes/interfaces/commands/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/classes/interfaces/commands/class_Commandable.php b/inc/classes/interfaces/commands/class_Commandable.php
new file mode 100644 (file)
index 0000000..4b3eaba
--- /dev/null
@@ -0,0 +1,36 @@
+<?php
+/**
+ * An interface for commands for the front controller
+ *
+ * @author             Roland Haeder <webmaster@mxchange.org>
+ * @version            0.0.0
+ * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+interface Commandable extends FrameworkInterface {
+       /**
+        * Executes the given command with given request and response objects
+        *
+        * @param       $requestInstance        An instance of a class with an Requestable interface
+        * @param       $responseInstance       An instance of a class with an Responseable interface
+        * @return      void
+        */
+       function execute (Requestable $requestInstance, Responseable $responseInstance);
+}
+
+//
+?>
diff --git a/inc/classes/interfaces/controller/.htaccess b/inc/classes/interfaces/controller/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/classes/interfaces/controller/class_Controller.php b/inc/classes/interfaces/controller/class_Controller.php
new file mode 100644 (file)
index 0000000..f06f583
--- /dev/null
@@ -0,0 +1,36 @@
+<?php
+/**
+ * An interface for controller
+ *
+ * @author             Roland Haeder <webmaster@mxchange.org>
+ * @version            0.0.0
+ * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+interface Controller extends FrameworkInterface {
+       /**
+        * Handles the given request and response
+        *
+        * @param       $requestInstance        An instance of a request class
+        * @param       $responseInstance       An instance of a response class
+        * @return      void
+        */
+       function handleRequest (Requestable $requestInstance, Responseable $responseInstance);
+}
+
+//
+?>
diff --git a/inc/classes/interfaces/request/.htaccess b/inc/classes/interfaces/request/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/classes/interfaces/request/class_Requestable.php b/inc/classes/interfaces/request/class_Requestable.php
new file mode 100644 (file)
index 0000000..08dd5b1
--- /dev/null
@@ -0,0 +1,68 @@
+<?php
+/**
+ * An interface for requests
+ *
+ * @author             Roland Haeder <webmaster@mxchange.org>
+ * @version            0.0.0
+ * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+interface Requestable extends FrameworkInterface {
+       /**
+        * Prepares the HTTP request data for usage by currently copying
+        * $_REQUEST into a private attribute. Later on we can add more
+        * things for initialization here.
+        *
+        * @return      void
+        */
+       function prepareRequestData ();
+
+       /**
+        * Checks wether a request element is set
+        * @param       $element        Name of the request element we want to check
+        * @return      $isSet          Wether the request element is set
+        * @throws      MissingArrayElementsException   Thrown if a request element is not set
+        */
+       function isRequestElementSet ($element);
+
+       /**
+        * Getter for request element or 'null' if the element was not found
+        *
+        * @param       $element        Name of the request element we want to check
+        * @return      $value          Value of the found request element or 'null' if the
+        *                                              element was not found
+        */
+       function getRequestElement ($element);
+
+       /**
+        * Wrapper method for array_key() function for the request data array
+        *
+        * @return      $array  An array containing all array keys to return
+        */
+       function getParameterNames ();
+
+       /**
+        * Getter for a header element or 'null' if the header was not found
+        *
+        * @param       $headerName             Name of the header
+        * @return      $headerValue    Value of the header or 'null' if not found
+        */
+       function getHeader ($headerName);
+}
+
+//
+?>
diff --git a/inc/classes/interfaces/resolver/.htaccess b/inc/classes/interfaces/resolver/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/classes/interfaces/resolver/class_CommandResolver.php b/inc/classes/interfaces/resolver/class_CommandResolver.php
new file mode 100644 (file)
index 0000000..2793eb5
--- /dev/null
@@ -0,0 +1,44 @@
+<?php
+/**
+ * An instance for command resolver classes
+ *
+ * @author             Roland Haeder <webmaster@mxchange.org>
+ * @version            0.0.0
+ * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+interface CommandResolver extends FrameworkInterface {
+       /**
+        * Returns an command instance for a given request class
+        *
+        * @param       $requestInstance        An instance of a request class
+        * @return      $commandInstance        An instance of the resolved command
+        */
+       function resolvCommandByRequest (Requestable $requestInstance);
+
+       /**
+        * Checks wether the given command is valid
+        *
+        * @param       $commandName    The default command we shall execute
+        * @return      $isValid                Wether the given command is valid
+        * @throws      EmptyVariableException  Thrown if the given command is not set
+        */
+       function isCommandValid ($commandName);
+}
+
+//
+?>
diff --git a/inc/classes/interfaces/resolver/class_ControllerResolver.php b/inc/classes/interfaces/resolver/class_ControllerResolver.php
new file mode 100644 (file)
index 0000000..e953cee
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+/**
+ * An instance for controller resolver classes
+ *
+ * @author             Roland Haeder <webmaster@mxchange.org>
+ * @version            0.0.0
+ * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+interface ControllerResolver extends FrameworkInterface {
+       /**
+        * Resolves the default controller of the given command
+        *
+        * @return      $controllerInstance             A controller instance for the default command
+        */
+        function resolveDefaultController ();
+}
+
+//
+?>
diff --git a/inc/classes/interfaces/response/.htaccess b/inc/classes/interfaces/response/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/classes/interfaces/response/class_Responseable.php b/inc/classes/interfaces/response/class_Responseable.php
new file mode 100644 (file)
index 0000000..d8fdaee
--- /dev/null
@@ -0,0 +1,63 @@
+<?php
+/**
+ * An interface for responses
+ *
+ * @author             Roland Haeder <webmaster@mxchange.org>
+ * @version            0.0.0
+ * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+interface Responseable extends FrameworkInterface {
+       /**
+        * Setter for status
+        *
+        * @param       $status         New response status
+        * @return      void
+        */
+       function setResponseStatus ($status);
+
+       /**
+        * Add header element
+        *
+        * @param       $name   Name of header element
+        * @param       $value  Value of header element
+        * @return      void
+        */
+       function addHeader ($name, $value);
+
+       /**
+        * "Writes" data to the response body
+        *
+        * @param       $output         Output we shall sent in the HTTP response
+        * @return      void
+        */
+       function writeToBody ($output);
+
+       /**
+        * Flushs the cached HTTP response to the outer world
+        *
+        * @param       $foce   Wether we shall force the output or abort if headers are
+        *                                      already sent with an exception
+        * @return      void
+        * @throws      ResponseHeadersAlreadySentException             Thrown if headers are
+        *                                                                                                      already sent
+        */
+       function flushResponse($force=false);
+}
+
+//
+?>
diff --git a/inc/classes/main/class_ b/inc/classes/main/class_
new file mode 100644 (file)
index 0000000..af4096f
--- /dev/null
@@ -0,0 +1,47 @@
+<?php
+/**
+ * 
+ *
+ * @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  extends BaseFrameworkSystem {
+       /**
+        * Private constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Set part description
+               $this->setObjectDescription("");
+
+               // Create unique ID number
+               $this->createUniqueID();
+
+               // Clean up a little
+               $this->removeNumberFormaters();
+               $this->removeSystemArray();
+       }
+}
+
+// [EOF]
+?>
diff --git a/inc/classes/main/commands/.htaccess b/inc/classes/main/commands/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/classes/main/commands/class_BaseCommand.php b/inc/classes/main/commands/class_BaseCommand.php
new file mode 100644 (file)
index 0000000..825b2b0
--- /dev/null
@@ -0,0 +1,85 @@
+<?php
+/**
+ * A general (base) command
+ *
+ * @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 BaseCommand extends BaseFrameworkSystem {
+       /**
+        * The controller we need for this command
+        */
+       private $controllerName = "";
+
+       /**
+        * Resolver instance
+        */
+       private $resolverInstance = null;
+
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct ($class) {
+               // Call parent constructor
+               parent::__construct($class);
+       }
+
+       /**
+        * Setter for controller name
+        *
+        * @param       $controllerName         Name of the controller assigned with this command
+        * @return      void
+        */
+       public final function setControllerName ($controllerName) {
+               $this->controllerName = (string) $controllerName;
+       }
+
+       /**
+        * Getter for controller name
+        *
+        * @return      $controllerName         Name of the controller assigned with this command
+        */
+       public final function getControllerName () {
+               return $this->controllerName;
+       }
+
+       /**
+        * Setter for resolver instance
+        *
+        * @param       $resolverInstance               Instance of a command resolver class
+        * @return      void
+        */
+       public final function setResolverInstance (CommandResolver $resolverInstance) {
+               $this->resolverInstance = $resolverInstance;
+       }
+
+       /**
+        * Getter for resolver instance
+        *
+        * @return      $resolverInstance               Instance of a command resolver class
+        */
+       public final function getResolverInstance () {
+               return $this->resolverInstance;
+       }
+}
+
+// [EOF]
+?>
diff --git a/inc/classes/main/commands/local/.htaccess b/inc/classes/main/commands/local/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/classes/main/commands/local/class_LocalHomeCommand.php b/inc/classes/main/commands/local/class_LocalHomeCommand.php
new file mode 100644 (file)
index 0000000..58e1a76
--- /dev/null
@@ -0,0 +1,117 @@
+<?php
+/**
+ * A command for the "home" page
+ *
+ * @author             Roland Haeder <webmaster@mxchange.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 LocalHomeCommand extends BaseCommand implements Commandable {
+       /**
+        * Private constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Set special description
+               $this->setObjectDescription("Home-Command");
+
+               // Create unique ID number
+               $this->createUniqueID();
+
+               // Clean up a little
+               $this->removeSystemArray();
+       }
+
+       /**
+        * Creates an instance of this class
+        *
+        * @param       $resolverInstance               An instance of a command resolver class
+        * @return      $commandInstance                An instance a prepared command class
+        */
+       public final static function createLocalHomeCommand (CommandResolver $resolverInstance) {
+               // Get new instance
+               $commandInstance = new LocalHomeCommand();
+
+               // Set the application instance
+               $commandInstance->setResolverInstance($resolverInstance);
+
+               // Return the prepared instance
+               return $commandInstance;
+       }
+
+       /**
+        * Executes the given command with given request and response objects
+        *
+        * @param       $requestInstance                An instance of a class with an Requestable interface
+        * @param       $responseInstance               An instance of a class with an Responseable interface
+        * @return      void
+        */
+       public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+               // Get the application instance
+               $appInstance = $this->getResolverInstance()->getApplicationInstance();
+
+               // Prepare a template instance
+               $templateInstance = $this->prepareTemplateEngine($appInstance);
+
+               // Load the master template
+               $masterTemplate = $appInstance->getMasterTemplate();
+
+               // Load header template
+               $templateInstance->loadCodeTemplate("header");
+
+               // Compile and assign it with a variable
+               $templateInstance->compileTemplate();
+               $templateInstance->assignTemplateWithVariable("header", "header");
+
+               // Load footer template
+               $templateInstance->loadCodeTemplate("footer");
+
+               // Compile and assign it with a variable
+               $templateInstance->compileTemplate();
+               $templateInstance->assignTemplateWithVariable("footer", "footer");
+
+               // Load the home template
+               $templateInstance->loadWebTemplate("home");
+
+               // Assign the home template with the master template as a content ... ;)
+               $templateInstance->assignTemplateWithVariable("home", "content");
+
+               // Load the master template
+               $templateInstance->loadCodeTemplate($masterTemplate);
+
+               // Set title
+               $title = ucfirst($requestInstance->getRequestElement($this->getConfigInstance()->readConfig("command_parameter")));
+               if (empty($title)) $title = "Home";
+               $templateInstance->assignVariable("title", $title);
+
+               // ... and all variables. This should be merged together in a pattern
+               // to make things easier. A cache mechanism should be added between
+               // these two calls to cache compiled templates.
+               $templateInstance->compileVariables();
+
+               // Get the content back from the template engine and put it in the response class
+               $templateInstance->transferToResponse($responseInstance);
+       }
+}
+
+// [EOF]
+?>
diff --git a/inc/classes/main/controller/.htaccess b/inc/classes/main/controller/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/classes/main/controller/class_ b/inc/classes/main/controller/class_
new file mode 100644 (file)
index 0000000..8ac8f48
--- /dev/null
@@ -0,0 +1,46 @@
+<?php
+/**
+ * 
+ *
+ * @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 Controller extends BaseController {
+       /**
+        * Private constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Set part description
+               $this->setObjectDescription("Ein spezieller Controller");
+
+               // Create unique ID number
+               $this->createUniqueID();
+
+               // Clean up a little
+               $this->removeSystemArray();
+       }
+}
+
+// [EOF]
+?>
diff --git a/inc/classes/main/controller/class_BaseController.php b/inc/classes/main/controller/class_BaseController.php
new file mode 100644 (file)
index 0000000..f7aea5c
--- /dev/null
@@ -0,0 +1,40 @@
+<?php
+/**
+ * A generic controller class
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class BaseController extends BaseFrameworkSystem {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct ($class) {
+               // Call parent constructor
+               parent::__construct($class);
+
+               // Clean up a little
+               $this->removeNumberFormaters();
+       }
+}
+
+// [EOF]
+?>
diff --git a/inc/classes/main/controller/default/.htaccess b/inc/classes/main/controller/default/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/classes/main/controller/default/class_LocalDefaultController.php b/inc/classes/main/controller/default/class_LocalDefaultController.php
new file mode 100644 (file)
index 0000000..a79243a
--- /dev/null
@@ -0,0 +1,96 @@
+<?php
+/**
+ * The default controller for all other requests
+ *
+ * @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 LocalLocalDefaultController extends BaseController implements Controller {
+       /**
+        * Instance of a CommandResolver class
+        */
+       private $resolverInstance = null;
+
+       /**
+        * Private constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Set part description
+               $this->setObjectDescription("Standart-Controller f&uuml;r alle &uuml;brigen Anfragen");
+
+               // Create unique ID number
+               $this->createUniqueID();
+
+               // Clean up a little
+               $this->removeSystemArray();
+       }
+
+       /**
+        * Creates an instance of this class
+        *
+        * @param       $resolverInstance               An instance of a command resolver class
+        * @return      $controllerInstance             A prepared instance of this class
+        */
+       public final static function createLocalDefaultController (CommandResolver $resolverInstance) {
+               // Create the instance
+               $controllerInstance = new LocalDefaultController();
+
+               // Set the command resolver
+               $controllerInstance->setResolverInstance($resolverInstance);
+
+               // Return the prepared instance
+               return $controllerInstance;
+       }
+
+       /**
+        * Setter for a command resolver instance
+        *
+        * @param       $resolverInstance       An instance of a command resolver class
+        * @return      void
+        */
+       public final function setResolverInstance (CommandResolver $resolverInstance) {
+               $this->resolverInstance = $resolverInstance;
+       }
+
+       /**
+        * Handles the given request and response
+        *
+        * @param       $requestInstance        An instance of a request class
+        * @param       $responseInstance       An instance of a response class
+        * @return      void
+        */
+       public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) {
+               // Get the command instance
+               $commandInstance = $this->resolverInstance->resolvCommandByRequest($requestInstance);
+
+               // Execute the command
+               $commandInstance->execute($requestInstance, $responseInstance);
+
+               // Flush the response out
+               $responseInstance->flushResponse();
+       }
+}
+
+// [EOF]
+?>
diff --git a/inc/classes/main/controller/default/class_LocalDefaultNewsController.php b/inc/classes/main/controller/default/class_LocalDefaultNewsController.php
new file mode 100644 (file)
index 0000000..90d3ec7
--- /dev/null
@@ -0,0 +1,111 @@
+<?php
+/**
+ * The default controller with news for e.g. home or news page
+ *
+ * @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 LocalDefaultNewsController extends BaseController implements Controller {
+       /**
+        * Instance of a CommandResolver class
+        */
+       private $resolverInstance = null;
+
+       /**
+        * Private constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Set part description
+               $this->setObjectDescription("Standart-Controller mit News-Auflistung");
+
+               // Create unique ID number
+               $this->createUniqueID();
+
+               // Clean up a little
+               $this->removeSystemArray();
+       }
+
+       /**
+        * Creates an instance of this class
+        *
+        * @param       $resolverInstance               An instance of a command resolver class
+        * @return      $controllerInstance             A prepared instance of this class
+        */
+       public final static function createLocalDefaultNewsController (CommandResolver $resolverInstance) {
+               // Create the instance
+               $controllerInstance = new LocalDefaultNewsController();
+
+               // Set the command resolver
+               $controllerInstance->setResolverInstance($resolverInstance);
+
+               // Return the prepared instance
+               return $controllerInstance;
+       }
+
+       /**
+        * Setter for a command resolver instance
+        *
+        * @param       $resolverInstance       An instance of a command resolver class
+        * @return      void
+        */
+       public final function setResolverInstance (CommandResolver $resolverInstance) {
+               $this->resolverInstance = $resolverInstance;
+       }
+
+       /**
+        * Handles the given request and response
+        *
+        * @param       $requestInstance        An instance of a request class
+        * @param       $responseInstance       An instance of a response class
+        * @return      void
+        */
+       public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) {
+               // Get the command instance
+               $commandInstance = $this->resolverInstance->resolvCommandByRequest($requestInstance);
+
+               // Get the news page variable from the request instance
+               $newsPage = $requestInstance->getRequestElement("news_page");
+
+               // Load the news here
+               $this->loadNews($newsPage);
+
+               // Execute the command
+               $commandInstance->execute($requestInstance, $responseInstance);
+
+               // Flush the response out
+               $responseInstance->flushResponse();
+       }
+
+       /**
+        * Loads news from the connected database for later usage
+        *
+        * @param       $newsPage       Page of listed news we want to read
+        * @return      void
+        */
+       private function loadNews ($newsPage) {
+       }
+}
+
+// [EOF]
+?>
diff --git a/inc/classes/main/controller/registration/.htaccess b/inc/classes/main/controller/registration/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/classes/main/controller/registration/class_DefaultRegistrationController.php b/inc/classes/main/controller/registration/class_DefaultRegistrationController.php
new file mode 100644 (file)
index 0000000..2f15e40
--- /dev/null
@@ -0,0 +1,71 @@
+<?php
+/**
+ * A default registration controller which is suitable for most applications
+ * with a registration form.
+ *
+ * @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 DefaultRegistrationController extends BaseController implements Controller {
+       /**
+        * Private constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Set part description
+               $this->setObjectDescription("Ein Standart-Anmelde-Controller");
+
+               // Create unique ID number
+               $this->createUniqueID();
+
+               // Clean up a little
+               $this->removeSystemArray();
+       }
+
+       /**
+        * Creates an instance of this class
+        *
+        * @return      $controllerInstance             A prepared instance of this class
+        */
+       public final static function createDefaultRegistrationController () {
+               // Create the instance
+               $controllerInstance = new DefaultRegistrationController();
+
+               // Return the prepared instance
+               return $controllerInstance;
+       }
+
+       /**
+        * Handles the given request and response
+        *
+        * @param       $requestInstance        An instance of a request class
+        * @param       $responseInstance       An instance of a response class
+        * @return      void
+        */
+       public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) {
+               die(__METHOD__.": Stub!");
+       }
+}
+
+// [EOF]
+?>
diff --git a/inc/classes/main/request/.htaccess b/inc/classes/main/request/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/classes/main/request/class_HttpRequest.php b/inc/classes/main/request/class_HttpRequest.php
new file mode 100644 (file)
index 0000000..6826d76
--- /dev/null
@@ -0,0 +1,151 @@
+<?php
+/**
+ * A concrete HTTP request class to make HTTP requests more abstract
+ *
+ * @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 HttpRequest extends BaseFrameworkSystem implements Requestable {
+       /**
+        * Array for the request data
+        */
+       private $requestData = array();
+
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Set part description
+               $this->setObjectDescription("HTTP-Anfrage");
+
+               // Create unique ID number
+               $this->createUniqueID();
+
+               // Clean up a little
+               $this->removeNumberFormaters();
+               $this->removeSystemArray();
+       }
+
+       /**
+        * Creates an instance of this class and prepares it a little
+        *
+        * @return      $httpInstance   An instance of this class
+        */
+       public final static function createHttpRequest () {
+               // Create an instance
+               $httpInstance = new HttpRequest();
+
+               // Prepare the HTTP request data for usage
+               $httpInstance->prepareRequestData();
+
+               // Return the prepared instance
+               return $httpInstance;
+       }
+
+       /**
+        * Prepares the HTTP request data for usage by currently copying
+        * $_REQUEST into a private attribute. Later on we can add more
+        * things for initialization here.
+        *
+        * @return      void
+        */
+       public function prepareRequestData () {
+               // Copy the $_REQUEST array
+               $this->requestData = $_REQUEST;
+       }
+
+       /**
+        * Checks wether a request element is set
+        * @param       $element        Name of the request element we want to check
+        * @return      $isSet          Wether the request element is set
+        * @throws      MissingArrayElementsException   Thrown if a request element is not set
+        */
+       public function isRequestElementSet ($element) {
+               // Is this element found?
+               if (!isset($this->requestData[$element])) {
+                       // Then throw an exception
+                       throw new MissingArrayElementsException(array($this, 'requestData', $element), self::EXCEPTION_MISSING_ELEMENT);
+               }
+
+               // All clear
+               return true;
+       }
+
+       /**
+        * Getter for request element or 'null' if the element was not found
+        *
+        * @param       $element        Name of the request element we want to check
+        * @return      $value          Value of the found request element or 'null' if the
+        *                                              element was not found
+        */
+       public function getRequestElement ($element) {
+               // Initialize value
+               $value = null;
+
+               try {
+                       if ($this->isRequestElementSet($element)) {
+                               $value = $this->requestData[$element];
+                       }
+               } catch (MissingArrayElementsException $e) {
+                       // Do nothing here
+               }
+
+               // Return the element's value
+               return $value;
+       }
+
+       /**
+        * Wrapper method for array_key() function for the request data array
+        *
+        * @return      $array  An array containing all array keys to return
+        */
+       public function getParameterNames () {
+               return array_keys($this->requestData);
+       }
+
+       /**
+        * Getter for a header element or 'null' if the header was not found
+        *
+        * @param       $headerName             Name of the header
+        * @return      $headerValue    Value of the header or 'null' if not found
+        */
+       public function getHeader ($headerName) {
+               // Default return value on error
+               $headerValue = null;
+
+               // Construct the name
+               $name = 'HTTP_' . strtolower(str_replace('-', '_', $headerName));
+
+               // Does this header exist?
+               if (isset($_SERVER[$name])) {
+                       $headerValue = $_SERVER[$name];
+               }
+
+               // Return the value
+               return $headerValue;
+       }
+}
+
+// [EOF]
+?>
diff --git a/inc/classes/main/resolver/.htaccess b/inc/classes/main/resolver/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/classes/main/resolver/class_BaseResolver.php b/inc/classes/main/resolver/class_BaseResolver.php
new file mode 100644 (file)
index 0000000..d442ef3
--- /dev/null
@@ -0,0 +1,115 @@
+<?php
+/**
+ * A generic resolver class
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class BaseResolver extends BaseFrameworkSystem {
+       /**
+        * Validated command name
+        */
+       private $commandName = "";
+
+       /**
+        * Prefix for local, remote or other resolver
+        */
+       private $commandPrefix = "";
+
+       /**
+        * Private constructor
+        *
+        * @return      void
+        */
+       protected function __construct ($class) {
+               // Call parent constructor
+               parent::__construct($class);
+
+               // Clean up a little
+               $this->removeSystemArray();
+       }
+
+       /**
+        * Setter for command name
+        *
+        * @param       $commandName    Last validated command name
+        * @return      void
+        */
+       protected final function setCommandName ($commandName) {
+               $this->commandName = $commandName;
+       }
+
+       /**
+        * Getter for command name
+        *
+        * @return      $commandName    Last validated command name
+        */
+       protected final function getCommandName () {
+               return $this->commandName;
+       }
+
+       /**
+        * Setter for command prefix
+        *
+        * @param       $commandPrefix  Last validated commandPrefix
+        * @return      void
+        */
+       protected final function setCommandPrefix ($commandPrefix) {
+               $this->commandPrefix = $commandPrefix;
+       }
+
+       /**
+        * Checks wether the given command is valid
+        *
+        * @param       $commandName    The default command we shall execute
+        * @return      $isValid                Wether the given command is valid
+        * @throws      EmptyVariableException  Thrown if the given command is not set
+        */
+       public function isCommandValid ($commandName) {
+               // By default nothing shall be valid
+               $isValid = false;
+
+               // Is a command set?
+               if (empty($commandName)) {
+                       // Then thrown an exception here
+                       throw new EmptyVariableException(array($this, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+               }
+
+               // Now, let us create the full name of the command class
+               $class = sprintf("%s%sCommand",
+                       $this->commandPrefix,
+                       ucfirst(strtolower($commandName))
+               );
+
+               // Is this class already loaded?
+               if (class_exists($class)) {
+                       // This class does exist. :-)
+                       $isValid = true;
+               }
+
+               // Set command name
+               $this->setCommandName($commandName);
+
+               // Return the result
+               return $isValid;
+       }
+}
+
+// [EOF]
+?>
diff --git a/inc/classes/main/resolver/local/.htaccess b/inc/classes/main/resolver/local/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/classes/main/resolver/local/class_LocalCommandResolver.php b/inc/classes/main/resolver/local/class_LocalCommandResolver.php
new file mode 100644 (file)
index 0000000..87e0d69
--- /dev/null
@@ -0,0 +1,184 @@
+<?php
+/**
+ * A command resolver for local (non-hubbed) commands
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class LocalCommandResolver extends BaseResolver implements CommandResolver {
+       /**
+        * Last successfull resolved command
+        */
+       private $lastCommandInstance = "";
+
+       /**
+        * Private constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Set part description
+               $this->setObjectDescription("Lokaler Kommandoaufl&ouml;ser");
+
+               // Create unique ID number
+               $this->createUniqueID();
+
+               // Clean up a little
+               $this->removeNumberFormaters();
+               $this->removeSystemArray();
+
+               // Set prefix to "Local"
+               $this->setCommandPrefix("Local");
+       }
+
+       /**
+        * Creates an instance of a local command resolver with a given default command
+        *
+        * @param       $defaultCommand                         The default command we shall execute
+        * @param       $appInstance                            An instance of a manageable application helper class
+        * @return      $resolverInstance                       The prepared command resolver instance
+        * @throws      EmptyVariableException          Thrown if the default command is not set
+        * @throws      InvalidCommandException         Thrown if the default command is invalid
+        */
+       public final static function createLocalCommandResolver ($defaultCommand, ManageableApplication $appInstance) {
+               // Create the new instance
+               $resolverInstance = new LocalCommandResolver();
+
+               // Is the variable $defaultCommand set and the command is valid?
+               if (empty($defaultCommand)) {
+                       // Then thrown an exception here
+                       throw new EmptyVariableException(array($resolverInstance, 'defaultCommand'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+               } elseif (!$resolverInstance->isCommandValid($defaultCommand)) {
+                       // Invalid command found
+                       throw new InvalidCommandException(array($resolverInstance, $defaultCommand), self::EXCEPTION_INVALID_COMMAND);
+               }
+
+               // Set the application instance
+               $resolverInstance->setApplicationInstance($appInstance);
+
+               // Return the prepared instance
+               return $resolverInstance;
+       }
+
+       /**
+        * Returns an command instance for a given request class or null if
+        * MissingArrayElementsException was thrown
+        *
+        * @param       $requestInstance        An instance of a request class
+        * @return      $commandInstance        An instance of the resolved command
+        * @throws      InvalidCommandException                         Thrown if $commandName is
+        *                                                                                              invalid
+        * @throws      InvalidCommandInstanceException         Thrown if $commandInstance
+        *                                                                                              is an invalid instance
+        */
+       public function resolvCommandByRequest (Requestable $requestInstance) {
+               // Init variables
+               $commandName = "";
+               $commandInstance = null;
+
+               // Test if the required parameter is set
+               try {
+                       // This goes fine so let's resolv the command
+                       $commandName = $requestInstance->getRequestElement($this->getConfigInstance()->readConfig("command_parameter"));
+
+                       // 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);
+
+                       // And validate it
+                       if ((!is_object($commandInstance)) || (!$commandInstance instanceof Commandable)) {
+                               // This command has an invalid instance!
+                               throw new InvalidCommandInstanceException(array($this, $commandName), self::EXCEPTION_INVALID_COMMAND);
+                       }
+
+                       // Set last command
+                       $this->lastCommandInstance = $commandInstance;
+               } catch (MissingArrayElementsException $e) {
+                       // Just catch it here...
+               }
+
+               // Return the resolved command instance
+               return $commandInstance;
+       }
+
+       /**
+        * "Loads" a given command and instances it if not yet cached
+        *
+        * @param       $commandName                            A command name we shall look for
+        * @return      $commandInstance                        A loaded command instance
+        * @throws      InvalidCommandException         Thrown if even the default
+        *                                                                              command class is missing (bad!)
+        */
+       private function loadCommand ($commandName) {
+               // Cache default command
+               $defaultCommand = $this->getConfigInstance()->readConfig("default_command");
+
+               // Init command instance
+               $commandInstance = null;
+
+               // Create command class name
+               $class = sprintf("Local%sCommand",
+                       ucfirst(strtolower($commandName))
+               );
+
+               // Is this class loaded?
+               if (!class_exists($class)) {
+                       // Class not found, so try the default one or throw exception
+                       if ($commandName != $defaultCommand) {
+                               // Try the default command
+                               return $this->loadCommand($defaultCommand);
+                       } else {
+                               // Still not found?
+                               throw new InvalidCommandException(array($this, $defaultCommand), self::EXCEPTION_INVALID_COMMAND);
+                       }
+               }
+
+               // Initiate the command
+               $eval = sprintf("\$commandInstance = %s::create%s(\$this);",
+                       $class,
+                       $class
+               );
+
+               // Run the command
+               eval($eval);
+
+               // Is the instance valid?
+               if ((!is_object($commandInstance)) || (!$commandInstance instanceof Commandable)) {
+                       // Something is wrong
+                       $commandInstance = null;
+               }
+
+               // Return the result
+               return $commandInstance;
+       }
+}
+
+// [EOF]
+?>
diff --git a/inc/classes/main/resolver/local/class_LocalControllerResolver.php b/inc/classes/main/resolver/local/class_LocalControllerResolver.php
new file mode 100644 (file)
index 0000000..9c94209
--- /dev/null
@@ -0,0 +1,189 @@
+<?php
+/**
+ * A resolver for resolving controllers locally
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class LocalControllerResolver extends BaseResolver implements ControllerResolver {
+       /**
+        * Last successfull resolved controller
+        */
+       private $lastControllerName = "";
+
+       /**
+        * Private constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Set part description
+               $this->setObjectDescription("");
+
+               // Create unique ID number
+               $this->createUniqueID();
+
+               // Clean up a little
+               $this->removeNumberFormaters();
+               $this->removeSystemArray();
+
+               // Set prefix to "Local"
+               $this->setCommandPrefix("Local");
+       }
+
+       /**
+        * Creates an instance of a resolver class with a given command
+        *
+        * @param       $commandName                            The default command we shall execute
+        * @param       $appInstance                            An instance of a manageable application helper class
+        * @return      $resolverInstance                       The prepared command resolver instance
+        * @throws      EmptyVariableException          Thrown if the default command is not set
+        * @throws      InvalidCommandException         Thrown if the default command is invalid
+        */
+       public final static function createLocalControllerResolver ($commandName, ManageableApplication $appInstance) {
+               // Create the new instance
+               $resolverInstance = new LocalControllerResolver();
+
+               // Is the variable $commandName set and the command is valid?
+               if (empty($commandName)) {
+                       // Then thrown an exception here
+                       throw new EmptyVariableException(array($resolverInstance, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+               } elseif (!$resolverInstance->isCommandValid($commandName)) {
+                       // Invalid command found
+                       throw new InvalidCommandException(array($resolverInstance, $commandName), self::EXCEPTION_INVALID_COMMAND);
+               }
+
+               // Set the application instance
+               $resolverInstance->setApplicationInstance($appInstance);
+
+               // Return the prepared instance
+               return $resolverInstance;
+       }
+
+       /**
+        * Resolves the default controller of the given command
+        *
+        * @return      $controllerInstance             A controller instance for the default
+        *                                                                      command
+        * @throws      InvalidCommandException                         Thrown if $commandName is
+        *                                                                                              invalid
+        * @throws      InvalidControllerInstanceException      Thrown if $commandInstance
+        *                                                                                              is invalid
+        */
+       public function resolveDefaultController () {
+               // Init variables
+               $commandName = "";
+               $controllerInstance = null;
+
+               // Try to resolv the command
+               try {
+                       // Get the command name 
+                       $commandName = $this->getCommandName();
+
+                       // Check if the command is valid
+                       if (!$this->isCommandValid($commandName)) {
+                               // This command is invalid!
+                               throw new InvalidCommandException(array($this, $commandName), self::EXCEPTION_INVALID_COMMAND);
+                       }
+
+                       // Get the command
+                       $controllerInstance = $this->loadController($commandName);
+
+                       // And validate it
+                       if ((!is_object($controllerInstance)) || (!$controllerInstance instanceof Controller)) {
+                               // This command has an invalid instance!
+                               throw new InvalidControllerInstanceException(array($this, $commandName), self::EXCEPTION_INVALID_CONTROLLER);
+                       }
+
+                       // Set last command
+                       $this->lastCommandInstance = $controllerInstance;
+               } catch (MissingArrayElementsException $e) {
+                       // Just catch it here...
+               }
+
+               // Return the maybe resolved instance
+               return $controllerInstance;
+       }
+
+       /**
+        * "Loads" a given controller and instances it if not yet cached
+        *
+        * @param       $commandName                    A controller name we shall look for
+        * @return      $controllerInstance             A loaded controller instance
+        * @throws      DefaultControllerException      Thrown if even the default
+        *                                                                              controller class is missing (bad!)
+        */
+       private function loadController ($commandName) {
+               // Cache default command
+               $defaultCommand = $this->getConfigInstance()->readConfig("default_command");
+
+               // Init controller instance
+               $controllerInstance = null;
+
+               // Default controller
+               $class = "LocalDefaultController";
+
+               // Generate the class name
+               if ($commandName != $defaultCommand) {
+                       // Create controller class name
+                       $class = sprintf("Local%sController",
+                               ucfirst(strtolower($commandName))
+                       );
+               } elseif ($this->getConfigInstance()->readConfig("home_with_news") == "Y") {
+                       // Yes, display news in home then set default controller with news
+                       $class = "LocalDefaultNewsController";
+               }
+
+               // Is this class loaded?
+               if (!class_exists($class)) {
+                       // Class not found, so try the default one or throw exception
+                       if ($commandName != $defaultCommand) {
+                               // Try the default controller
+                               return $this->loadController($defaultCommand);
+                       } else {
+                               // Still not found?
+                               throw new DefaultControllerException($this, self::EXCEPTION_DEFAUL_CONTROLLER_GONE);
+                       }
+               }
+
+               // Initiate the controller
+               $eval = sprintf("\$controllerInstance = %s::create%s(LocalCommandResolver::createLocalCommandResolver(\$commandName, \$this->getApplicationInstance()));",
+                       $class,
+                       $class
+               );
+
+               // Run the command
+               eval($eval);
+
+               // Is the instance valid?
+               if ((!is_object($controllerInstance)) || (!$controllerInstance instanceof Controller)) {
+                       // Something is wrong
+                       $controllerInstance = null;
+               }
+
+               // Return the result
+               return $controllerInstance;
+       }
+}
+
+// [EOF]
+?>
diff --git a/inc/classes/main/response/.htaccess b/inc/classes/main/response/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/classes/main/response/class_HttpResponse.php b/inc/classes/main/response/class_HttpResponse.php
new file mode 100644 (file)
index 0000000..3679fe9
--- /dev/null
@@ -0,0 +1,161 @@
+<?php
+/**
+ * A class for an HTTP response on an HTTP request
+ *
+ * @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 HttpResponse extends BaseFrameworkSystem implements Responseable {
+       /**
+        * Response status
+        */
+       private $responseStatus = "200 OK";
+
+       /**
+        * Array with all headers
+        */
+       private $responseHeaders = array();
+
+       /**
+        * Body of the response
+        */
+       private $responseBody = "";
+
+       /**
+        * Instance of the template engine
+        */
+       private $templateEngine = null;
+
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Set part description
+               $this->setObjectDescription("HTTP-Antwort");
+
+               // Create unique ID number
+               $this->createUniqueID();
+
+               // Clean up a little
+               $this->removeNumberFormaters();
+               $this->removeSystemArray();
+       }
+
+       /**
+        * Creates an object of this class
+        *
+        * @param       $appInstance            An instance of a manageable application
+        * @return      $responseInstance       A prepared instance of this class
+        */
+       public final static function createHttpResponse (ManageableApplication $appInstance) {
+               // Get a new instance
+               $responseInstance = new HttpResponse();
+
+               // Initialize the template engine here
+               $responseInstance->initTemplateEngine($appInstance);
+
+               // Return the prepared instance
+               return $responseInstance;
+       }
+
+       /**
+        * Setter for status
+        *
+        * @param       $status         New response status
+        * @return      void
+        */
+       public final function setResponseStatus ($status) {
+               $this->responseStatus = (string) $status;
+       }
+
+       /**
+        * Add header element
+        *
+        * @param       $name   Name of header element
+        * @param       $value  Value of header element
+        * @return      void
+        */
+       public final function addHeader ($name, $value) {
+               $this->responseHeaders[$name] = $value;
+       }
+
+       /**
+        * "Writes" data to the response body
+        *
+        * @param       $output         Output we shall sent in the HTTP response
+        * @return      void
+        */
+       public function writeToBody ($output) {
+               $this->responseBody .= $output;
+       }
+
+       /**
+        * Flushs the cached HTTP response to the outer world
+        *
+        * @param       $foce   Wether we shall force the output or abort if headers are
+        *                                      already sent with an exception
+        * @return      void
+        * @throws      ResponseHeadersAlreadySentException             Thrown if headers are
+        *                                                                                                      already sent
+        */
+       public function flushResponse ($force=false) {
+               if ((headers_sent()) && (!$force)) {
+                       // Headers are already sent!
+                       throw new ResponseHeadersAlreadySentException($this, self::EXCEPTION_HEADERS_ALREADY_SENT);
+               } elseif (!headers_sent()) {
+                       // Send headers out
+                       header("HTTP/1.0 {$this->responseStatus}");
+                       foreach ($this->responseHeaders as $name=>$value) {
+                               header("{$name}: {$value}");
+                       }
+               }
+
+               // Flush the output to the world
+               $this->getWebOutputInstance()->output($this->responseBody);
+               $this->reponseBody = "";
+               $this->responseHeaders = array();
+       }
+
+       /**
+        * Initializes the template engine instance
+        *
+        * @param       $appInstance    An instance of a manageable application
+        * @return      void
+        */
+       public final function initTemplateEngine (ManageableApplication $appInstance) {
+               $this->templateEngine = $this->prepareTemplateEngine($appInstance);
+       }
+
+       /**
+        * Getter for the template engine instance
+        *
+        * @return      $templateEngine         An instance of the used template engine
+        */
+       public final function getTemplateEngine () {
+               return $this->templateEngine;
+       }
+}
+
+// [EOF]
+?>