]> git.mxchange.org Git - shipsimu.git/commitdiff
More patterns added, part description changed to object description
authorRoland Häder <roland@mxchange.org>
Fri, 11 Apr 2008 18:46:19 +0000 (18:46 +0000)
committerRoland Häder <roland@mxchange.org>
Fri, 11 Apr 2008 18:46:19 +0000 (18:46 +0000)
37 files changed:
.gitattributes
application/selector/class_ApplicationHelper.php
docs/THANKS
inc/classes/exceptions/main/class_InvalidObjectException.php
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/response/.htaccess [new file with mode: 0644]
inc/classes/interfaces/response/class_Responseable.php [new file with mode: 0644]
inc/classes/main/class_BaseFrameworkSystem.php
inc/classes/main/commands/extended/.htaccess [new file with mode: 0644]
inc/classes/main/commands/extended/class_ [new file with mode: 0644]
inc/classes/main/compressor/class_Bzip2Compressor.php
inc/classes/main/compressor/class_GzipCompressor.php
inc/classes/main/compressor/class_NullCompressor.php
inc/classes/main/console/class_ConsoleTools.php
inc/classes/main/database/classes/class_LocalFileDatabase.php
inc/classes/main/debug/class_DebugConsoleOutput.php
inc/classes/main/debug/class_DebugErrorLogOutput.php
inc/classes/main/debug/class_DebugWebOutput.php
inc/classes/main/extended/class_ObjectLimits.php
inc/classes/main/io/class_FileIOStream.php
inc/classes/main/io/class_FrameworkDirectoryPointer.php
inc/classes/main/io/class_FrameworkFileInputPointer.php
inc/classes/main/io/class_FrameworkFileOutputPointer.php
inc/classes/main/language/class_LanguageSystem.php
inc/classes/main/output/class_ConsoleOutput.php
inc/classes/main/output/class_WebOutput.php
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/response/.htaccess [new file with mode: 0644]
inc/classes/main/response/class_HttpResponse.php [new file with mode: 0644]
inc/classes/main/template/class_TemplateEngine.php
inc/classes/middleware/compressor/class_CompressorChannel.php
inc/classes/middleware/database/class_DatabaseConnection.php
inc/classes/middleware/debug/class_DebugMiddleware.php
inc/classes/middleware/io/class_FileIOHandler.php
inc/selector.php

index bf1e6d71e84cb09ad73146df26e80199ce19c165..f06da2f604f1f781a674397b4c560b29a4df7b7a 100644 (file)
@@ -214,12 +214,18 @@ 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/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_BaseFrameworkSystem.php -text
 inc/classes/main/class_FrameworkArrayObject.php -text
+inc/classes/main/commands/extended/.htaccess -text
+inc/classes/main/commands/extended/class_ -text
 inc/classes/main/compressor/.htaccess -text
 inc/classes/main/compressor/class_Bzip2Compressor.php -text
 inc/classes/main/compressor/class_GzipCompressor.php -text
@@ -247,6 +253,10 @@ 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/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
index 7655415228db01f0f4b8f040c19707f3f6d9d9da..9e62fc0c27edcc73c662509374b31616ab7a96a3 100644 (file)
@@ -106,7 +106,7 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica
        /**
         * Setter for the version number
         *
-        * @param               $appVersion     The application's version number
+        * @param       $appVersion     The application's version number
         * @return      void
         */
        public final function setAppVersion ($appVersion) {
@@ -127,7 +127,7 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica
        /**
         * Setter for human-readable name
         *
-        * @param               $appName        The application's human-readable name
+        * @param       $appName        The application's human-readable name
         * @return      void
         */
        public final function setAppName ($appName) {
@@ -148,7 +148,7 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica
        /**
         * Setter for short uni*-like name
         *
-        * @param               $shortName      The application's short uni*-like name
+        * @param       $shortName      The application's short uni*-like name
         * @return      void
         */
        public final function setAppShortName ($shortName) {
index bd56a2cfa2ef90786eb6c7f18380fb944de2c01e..91bd29d102f4618fcaa10952c0371bc90849b690 100644 (file)
@@ -1,6 +1,7 @@
 Special Thanks goes to:
  - Daff
  - toms
+ - Arne Brodowski (http://www.arnebrodowski.de/blog/)
  - And all the others I have not listed here.
 
 If you think your name is missing here please ICQ me: 8809296
index 9dca3438d830e1620b0e8bc96db312d83797b98e..76a4a4cb0449db53f19c5f0d5f52f841612d453b 100644 (file)
@@ -34,7 +34,7 @@ class InvalidObjectException extends FrameworkException {
                $message = sprintf("[%s:%d] Objekte sind nicht erlaubt. (Objekt: <u>%s</u>)",
                        $class->__toString(),
                        $this->getLine(),
-                       $class->getPartDescr()
+                       $class->getObjectDescription()
                );
 
                // Call parent constructor
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..7ef0f9a
--- /dev/null
@@ -0,0 +1,68 @@
+<?php
+/**
+ * An interface for requests
+ *
+ * @author             Roland Haeder <webmaster@mxchange.org>
+ * @version            0.3.0
+ * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.mxchange.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/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..22ee2cb
--- /dev/null
@@ -0,0 +1,63 @@
+<?php
+/**
+ * An interface for responses
+ *
+ * @author             Roland Haeder <webmaster@mxchange.org>
+ * @version            0.3.0
+ * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.mxchange.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);
+}
+
+//
+?>
index 8ac8d31fb01a35b584214311eea9a8538ec7537a..dbf69b14f3a7f50d3657fee3f306596409f8db5a 100644 (file)
@@ -61,7 +61,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
        /**
         * A human-readable description for this simulator part
         */
-       private $partDescr      = "Namenlose Framework-Einheit";
+       private $objectDescription      = "Namenlose Framework-Einheit";
 
        /**
         * The unique ID string for identifying all type of classes
@@ -139,6 +139,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
        const EXCEPTION_TEMPLATE_ENGINE_UNSUPPORTED  = 0x02d;
        const EXCEPTION_MISSING_LANGUAGE_HANDLER     = 0x02e;
        const EXCEPTION_MISSING_FILE_IO_HANDLER      = 0x02f;
+       const EXCEPTION_MISSING_ELEMENT              = 0x030;
 
        /**
         * In the super constructor these system classes shall be ignored or else
@@ -187,7 +188,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                        }
 
                        // Destroy all informations about this class but keep some text about it alive
-                       $this->setPartDescr(sprintf("Entferntes Objekt <em>%s</em>", $this->__toString()));
+                       $this->setObjectDescription(sprintf("Entferntes Objekt <em>%s</em>", $this->__toString()));
                        $this->setRealClass("DestructedObject");
                        $this->resetUniqueID();
                } elseif ((defined('DEBUG_DESTRUCTOR')) && (is_object($this->getDebugInstance()))) {
@@ -489,7 +490,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                        $this->__toString(),
                        md5(sprintf("%s:%s:%s:%s:%s:%s",
                                $this->__toString(),
-                               $this->getPartDescr(),
+                               $this->getObjectDescription(),
                                time(),
                                getenv('REMOTE_ADDR'),
                                getenv('SERVER_ADDR'),
@@ -548,14 +549,14 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
        /**
         * Getter for simulator description
         *
-        * @return      $partDescr      The description of this simulation part
+        * @return      $objectDescription      The description of this simulation part
         */
-       public final function getPartDescr () {
-               if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] getPartDescr erreicht.<br />\n",
+       public final function getObjectDescription () {
+               if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] getObjectDescription erreicht.<br />\n",
                        $this->__toString()
                ));
-               if (isset($this->partDescr)) {
-                       return $this->partDescr;
+               if (isset($this->objectDescription)) {
+                       return $this->objectDescription;
                } else {
                        return null;
                }
@@ -564,14 +565,14 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
        /**
         * Setter for simulation part description
         *
-        * @param               $partDescr      The description as string for this simulation part
+        * @param               $objectDescription      The description as string for this simulation part
         * @return      void
         */
-       public final function setPartDescr ($partDescr) {
-               $this->partDescr = (String) $partDescr;
+       public final function setObjectDescription ($objectDescription) {
+               $this->objectDescription = (String) $objectDescription;
                if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Teilbeschreibung wird auf <strong>%s</strong> gesetzt.<br />\n",
                        $this->__toString(),
-                       $this->partDescr
+                       $this->objectDescription
                ));
        }
 
@@ -597,7 +598,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                        (
                                $this->__toString()   == $itemInstance->__toString()
                        ) && (
-                               $this->getPartDescr() == $itemInstance->getPartDescr()
+                               $this->getObjectDescription() == $itemInstance->getObjectDescription()
                        )
                );
        }
diff --git a/inc/classes/main/commands/extended/.htaccess b/inc/classes/main/commands/extended/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/classes/main/commands/extended/class_ b/inc/classes/main/commands/extended/class_
new file mode 100644 (file)
index 0000000..919a549
--- /dev/null
@@ -0,0 +1,57 @@
+<?php
+/**
+ * 
+ *
+ * @author             Roland Haeder <webmaster@mxchange.org>
+ * @version            0.3.0
+ * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.mxchange.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 Command extends BaseCommand implements Commandable {
+       /**
+        * Private constructor
+        *
+        * @return      void
+        */
+       private function __construct () {
+               // Call parent constructor
+               parent::constructor(__CLASS__);
+
+               // Set special description
+               $this->setObjectDescription("Spezieller Command");
+
+               // Create unique ID number
+               $this->createUniqueID();
+
+               // Clean up a little
+               $this->removeNumberFormaters();
+               $this->removeSystemArray();
+       }
+
+       /**
+        * 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) {
+       }
+}
+
+// [EOF]
+?>
index c0c475f44264dce3754bdc9027ca664212d8d122..48eb84c6d1c087ea69aaaa54d26342d6bf3fd22a 100644 (file)
@@ -37,7 +37,7 @@ class Bzip2Compressor extends BaseFrameworkSystem implements Compressor {
                ));
 
                // Set description
-               $this->setPartDescr("BZIP2-Kompressor");
+               $this->setObjectDescription("BZIP2-Kompressor");
 
                // Create an unique ID
                $this->createUniqueID();
index 0caae9f8090384fb26bd742fd3f4fc9d1e1ea126..9d9fa034bbede98f70a6ad85cf0e37b96d79d71c 100644 (file)
@@ -37,7 +37,7 @@ class GzipCompressor extends BaseFrameworkSystem implements Compressor {
                ));
 
                // Set description
-               $this->setPartDescr("GZIP-Kompressor");
+               $this->setObjectDescription("GZIP-Kompressor");
 
                // Create an unique ID
                $this->createUniqueID();
@@ -75,8 +75,8 @@ class GzipCompressor extends BaseFrameworkSystem implements Compressor {
        /**
         * GZIP compression stream
         *
-        * @param               $streamData                     Mixed non-object stream data
-        * @return      $streamData                     The compressed stream data      
+        * @param       $streamData             Mixed non-object stream data
+        * @return      $streamData             The compressed stream data      
         * @throws      InvalidObjectException  If the stream is an object
         */
        public function compressStream ($streamData) {
@@ -92,8 +92,8 @@ class GzipCompressor extends BaseFrameworkSystem implements Compressor {
        /**
         * GZIP decompression stream
         *
-        * @param               $streamData                     Mixed non-object stream data
-        * @return      $streamData                     The decompressed stream data    
+        * @param       $streamData             Mixed non-object stream data
+        * @return      $streamData             The decompressed stream data    
         * @throws      InvalidObjectException  If the stream is an object
         */
        public function decompressStream ($streamData) {
index 56b2d5f4f8b529d763cf5782177bfc076d255b27..c432efeb9e705467b22863bdf60bc069419cbb29 100644 (file)
@@ -37,7 +37,7 @@ class NullCompressor extends BaseFrameworkSystem implements Compressor {
                ));
 
                // Set description
-               $this->setPartDescr("Null-Kompressor");
+               $this->setObjectDescription("Null-Kompressor");
 
                // Create an unique ID
                $this->createUniqueID();
@@ -59,8 +59,8 @@ class NullCompressor extends BaseFrameworkSystem implements Compressor {
        /**
         * Null compression stream
         *
-        * @param               $streamData                     Mixed non-object stream data
-        * @return      $streamData                     The compressed stream data      
+        * @param       $streamData             Mixed non-object stream data
+        * @return      $streamData             The compressed stream data      
         * @throws      InvalidObjectException  If the stream is an object
         */
        public function compressStream ($streamData) {
@@ -76,8 +76,8 @@ class NullCompressor extends BaseFrameworkSystem implements Compressor {
        /**
         * Null decompression stream
         *
-        * @param               $streamData                     Mixed non-object stream data
-        * @return      $streamData                     The decompressed stream data    
+        * @param       $streamData             Mixed non-object stream data
+        * @return      $streamData             The decompressed stream data    
         * @throws      InvalidObjectException  If the stream is an object
         */
        public function decompressStream ($streamData) {
@@ -93,7 +93,7 @@ class NullCompressor extends BaseFrameworkSystem implements Compressor {
        /**
         * Getter for the file extension of this compressor
         *
-        * @return      $string Returns always "bz2"
+        * @return      $string         Returns always "null"
         */
        public final function getCompressorExtension () {
                if ((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Dateierweiterung angefordert.<br />\n",
index 5ba9ae642c153a5da062da59fd33bbd9514f33f2..175102af605c370a3e5a325705572d0198ce79c9 100644 (file)
@@ -32,7 +32,7 @@ class ConsoleTools extends BaseFrameworkSystem {
                parent::constructor(__CLASS__);
 
                // Set description
-               $this->setPartDescr("Console-Tools");
+               $this->setObjectDescription("Console-Tools");
 
                // Create an unique ID
                $this->createUniqueID();
index 1734064864640c77dba01534e96753ccd7ae7474..3f207c8499a1e2686f3889516fc36efd382d9bc6 100644 (file)
@@ -55,7 +55,7 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
                parent::constructor(__CLASS__);
 
                // Set description
-               $this->setPartDescr("Dateidatenbankschicht");
+               $this->setObjectDescription("Dateidatenbankschicht");
 
                // Create unique ID
                $this->createUniqueID();
index 82bcd7f1fe8df8a9810456bc479847ae4af19f18..8efe0b56cd5aaac7f4c0a3e59619169d0f32154a 100644 (file)
@@ -32,7 +32,7 @@ class DebugConsoleOutput extends BaseFrameworkSystem implements Debugger, Output
                parent::constructor(__CLASS__);
 
                // Set description
-               $this->setPartDescr("Debug-Ausgabe auf Konsole");
+               $this->setObjectDescription("Debug-Ausgabe auf Konsole");
 
                // Create an unique ID
                $this->createUniqueID();
index c8e62936e528147977d4082e2f75d020a10fbcbe..a11a9f78444e9e9ecad0415634217d2148db15b2 100644 (file)
@@ -32,7 +32,7 @@ class DebugErrorLogOutput extends BaseFrameworkSystem implements Debugger, Outpu
                parent::constructor(__CLASS__);
 
                // Set description
-               $this->setPartDescr("Debug-Ausgabe in error_log()");
+               $this->setObjectDescription("Debug-Ausgabe in error_log()");
 
                // Create an unique ID
                $this->createUniqueID();
index ee3ae81b4c8fe373bd9ac46d490e16ef90f30e8a..844605fcd67c52eafd2506ccd08453a288e7be23 100644 (file)
@@ -32,7 +32,7 @@ class DebugWebOutput extends BaseFrameworkSystem implements Debugger, OutputStre
                parent::constructor(__CLASS__);
 
                // Set description
-               $this->setPartDescr("Debug-Ausgabe auf Konsole");
+               $this->setObjectDescription("Debug-Ausgabe auf Konsole");
 
                // Create an unique ID
                $this->createUniqueID();
index 91dc519f8a4d4ba7b11c2a0488fe09711ec73242..13a658ac63d338dd69177e8681f92ac42a2515ae 100644 (file)
@@ -39,7 +39,7 @@ class ObjectLimits extends BaseFrameworkSystem {
                parent::constructor(__CLASS__);
 
                // Set part description
-               $this->setPartDescr("Limitierungsobjekt");
+               $this->setObjectDescription("Limitierungsobjekt");
 
                // Create unique ID number
                $this->createUniqueID();
index 2eedf3c6aa17ea7edd2370dd96545ea2a51449c4..155774a1bb522e24f9e649059991dba8ba0fec78 100644 (file)
@@ -30,7 +30,7 @@ class FileIOStream extends BaseFrameworkSystem implements FileInputStreamer, Fil
                parent::constructor(__CLASS__);
 
                // Set part description
-               $this->setPartDescr("Universal Datei-Ein-/Ausgabesystem");
+               $this->setObjectDescription("Universal Datei-Ein-/Ausgabesystem");
 
                // Create unique ID
                $this->createUniqueID();
index e8af81719df5c2ad1d9ca228b26fc600b79cfabe..f02faf992390c00c784688b67b96e6a9783bbb48 100644 (file)
@@ -40,7 +40,7 @@ class FrameworkDirectoryPointer extends BaseFrameworkSystem {
                parent::constructor(__CLASS__);
 
                // Set part description
-               $this->setPartDescr("Verzeichnis-Handler");
+               $this->setObjectDescription("Verzeichnis-Handler");
 
                // Create unique ID
                $this->createUniqueID();
index 534650ab5a3a7ef3bf23d4bf9c28771816dfa97d..c66d76d6ec0b44b2a799becedb96f0c259f91980 100644 (file)
@@ -40,7 +40,7 @@ class FrameworkFileInputPointer extends BaseFrameworkSystem {
                parent::constructor(__CLASS__);
 
                // Set part description
-               $this->setPartDescr("Dateiausgabe-Handler");
+               $this->setObjectDescription("Dateiausgabe-Handler");
 
                // Create unique ID
                $this->createUniqueID();
index 59de4f6639d67a3ec9d0d2042cd951082ee4eee7..9705137b6075a85f24f473424cc59c5288434859 100644 (file)
@@ -40,7 +40,7 @@ class FrameworkFileOutputPointer extends BaseFrameworkSystem {
                parent::constructor(__CLASS__);
 
                // Set part description
-               $this->setPartDescr("Dateiausgabe-Handler");
+               $this->setObjectDescription("Dateiausgabe-Handler");
 
                // Create unique ID
                $this->createUniqueID();
index 419a85658052f91d3e217286395d856294f473af..baac159a95e4ba11a55a290e8228efd389ed8c84 100644 (file)
@@ -53,7 +53,7 @@ class LanguageSystem extends BaseFrameworkSystem implements ManageableLanguage {
                parent::constructor(__CLASS__);
 
                // Set part description
-               $this->setPartDescr("Sprachsystem");
+               $this->setObjectDescription("Sprachsystem");
 
                // Create unique ID number
                $this->createUniqueID();
index 374c2af4ae7182f3574f83847f5c779ea53221c3..3bf27fcedba482f43977c3c2806e65af35e6146e 100644 (file)
@@ -43,7 +43,7 @@ class ConsoleOutput extends BaseFrameworkSystem implements OutputStreamer {
                parent::constructor(__CLASS__);
 
                // Set description
-               $this->setPartDescr("Console-Ausgabe-Handler");
+               $this->setObjectDescription("Console-Ausgabe-Handler");
 
                // Create an unique ID
                $this->createUniqueID();
index 40d425c70fe8d9c5489edaca422da4e50ec104cb..27e5c83ddcd745718a1a2caae748e744120ea7e5 100644 (file)
@@ -38,7 +38,7 @@ class WebOutput extends BaseFrameworkSystem implements OutputStreamer {
                parent::constructor(__CLASS__);
 
                // Set description
-               $this->setPartDescr("Web-Ausgabe-Handler");
+               $this->setObjectDescription("Web-Ausgabe-Handler");
 
                // Create an unique ID
                $this->createUniqueID();
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..2a12d30
--- /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.3.0
+ * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.mxchange.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();
+
+       /**
+        * Private constructor
+        *
+        * @return      void
+        */
+       private final function __construct () {
+               // Call parent constructor
+               parent::constructor(__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/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..1ee74ca
--- /dev/null
@@ -0,0 +1,133 @@
+<?php
+/**
+ * A class for an HTTP response on an HTTP request
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.3.0
+ * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.mxchange.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 = "";
+
+       /**
+        * Private constructor
+        *
+        * @return      void
+        */
+       private function __construct () {
+               // Call parent constructor
+               parent::constructor(__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
+        *
+        * @return      $responseInstance       A prepared instance of this class
+        */
+       public final static function createHttpResponse () {
+               // Get a new instance
+               $responseInstance = new HttpResponse();
+
+               // 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();
+       }
+}
+
+// [EOF]
+?>
index 1dfb7ad29b64e22b09bfec2f0dc0d4bcd0478b1f..44f374fc9efc26fa6611c227e0f010eea7b6c36d 100644 (file)
@@ -123,7 +123,7 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate
                parent::constructor(__CLASS__);
 
                // Set part description
-               $this->setPartDescr("Template-Engine");
+               $this->setObjectDescription("Template-Engine");
 
                // Create unique ID number
                $this->createUniqueID();
index 5d5017c6e65b846b34c2ddd233bea283ae5d194e..8dae607bbfc0822031851f1f614da6274be9d2d1 100644 (file)
@@ -31,7 +31,7 @@ class CompressorChannel extends BaseMiddleware {
                parent::constructor(__CLASS__);
 
                // Set description
-               $this->setPartDescr("Komprimierungshandler");
+               $this->setObjectDescription("Komprimierungshandler");
 
                // Create an unique ID
                $this->createUniqueID();
index e6adbbe6778b8cfb44eb5ecd4175ddcb7d9fd3c9..d7db9d86975c88bc86b2c58d08df5c065ed9d18c 100644 (file)
@@ -37,7 +37,7 @@ class DatabaseConnection extends BaseMiddleware implements DatabaseConnector, Li
                parent::constructor(__CLASS__);
 
                // Set description
-               $this->setPartDescr("Datenbank-Mittelschicht");
+               $this->setObjectDescription("Datenbank-Mittelschicht");
 
                // Create an unique ID
                $this->createUniqueID();
index 5193532e1e0ee1cb1cca6bcd30a0094e2d8cc05c..2cc48823303bad3824e0e3f7803cf3a17aa09851 100644 (file)
@@ -44,7 +44,7 @@ class DebugMiddleware extends BaseMiddleware {
                parent::constructor(__CLASS__);
 
                // Set description
-               $this->setPartDescr("Debug-Ausgabe-Handler");
+               $this->setObjectDescription("Debug-Ausgabe-Handler");
 
                // Create an unique ID
                $this->createUniqueID();
index 7e624cccf7e2b6bfabf056e46f26551367e30dc1..7e0d35ad52d99f050d1091bd22662ed69c1b9cef 100644 (file)
@@ -48,7 +48,7 @@ class FileIOHandler extends BaseMiddleware {
                parent::constructor(__CLASS__);
 
                // Set description
-               $this->setPartDescr("Datei-Ein-/Ausgabe-Handler");
+               $this->setObjectDescription("Datei-Ein-/Ausgabe-Handler");
 
                // Create an unique ID
                $this->createUniqueID();
index 23acabec7e0b0762217fb48c040c449648d9dea1..7af8aa06056930c71b21265d9898aca8fb9c3539 100644 (file)
@@ -52,11 +52,11 @@ $application = preg_replace('/([^a-z_-])+/i', "", $application);
 $configAppIncludes = array(
        sprintf("class_%s", FrameworkConfiguration::getInstance()->readConfig("app_helper_class")), // The ApplicationHelper class
        "config",               // The application's own configuration
-       "init",         // The application initializer
-       "loader",       // The application's class loader
+       "init",                 // The application initializer
+       "loader",               // The application's class loader
        "debug",                // Some debugging stuff
        "exceptions",   // The application's own exception handler
-       "starter",      // The application starter (calls entryPoint(), etc.)
+       "starter",              // The application starter (calls entryPoint(), etc.)
 );
 
 // Load them all (try only)