]> git.mxchange.org Git - shipsimu.git/commitdiff
More class descriptions translated, generic user class added
authorRoland Häder <roland@mxchange.org>
Fri, 30 May 2008 21:29:07 +0000 (21:29 +0000)
committerRoland Häder <roland@mxchange.org>
Fri, 30 May 2008 21:29:07 +0000 (21:29 +0000)
44 files changed:
.gitattributes
application/ship-simu/class_ApplicationHelper.php
inc/classes/exceptions/user/.htaccess [new file with mode: 0644]
inc/classes/exceptions/user/class_UsernameMissingException.php [new file with mode: 0644]
inc/classes/interfaces/user/.htaccess [new file with mode: 0644]
inc/classes/interfaces/user/class_ManageableUser.php [new file with mode: 0644]
inc/classes/main/commands/web/class_WebDoFormCommand.php
inc/classes/main/commands/web/class_WebHomeCommand.php
inc/classes/main/commands/web/class_WebRegisterCommand.php
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/controller/default/class_WebDefaultController.php
inc/classes/main/controller/default/class_WebDefaultNewsController.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/extended/class_SerializationContainer.php
inc/classes/main/factories/objects/class_ObjectFactory.php
inc/classes/main/factories/web/class_NewsFactory.php [deleted file]
inc/classes/main/factories/web/class_WebNewsFactory.php [new file with mode: 0644]
inc/classes/main/filter/class_FilterChain.php
inc/classes/main/filter/validator/class_UserNameValidatorFilter.php
inc/classes/main/helper/class_BaseHelper.php
inc/classes/main/helper/web/class_WebFormHelper.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/class_HttpRequest.php
inc/classes/main/resolver/web/class_WebCommandResolver.php
inc/classes/main/resolver/web/class_WebControllerResolver.php
inc/classes/main/response/class_HttpResponse.php
inc/classes/main/template/class_TemplateEngine.php
inc/classes/main/user/.htaccess [new file with mode: 0644]
inc/classes/main/user/class_User.php [new file with mode: 0644]
inc/config.php
inc/database/lib-local.php

index 62c4a881dcf51736815f8df953a35ee23e9bbb49..4078b2195c09720863f59dcec2a29b1ad5f389c2 100644 (file)
@@ -210,6 +210,8 @@ inc/classes/exceptions/template/class_InvalidTemplateVariableNameException.php -
 inc/classes/exceptions/template/class_UnexpectedTemplateTypeException.php -text
 inc/classes/exceptions/template/class_UnsupportedTemplateEngineException.php -text
 inc/classes/exceptions/template/class_ViewHelperNotFoundException.php -text
+inc/classes/exceptions/user/.htaccess -text
+inc/classes/exceptions/user/class_UsernameMissingException.php -text
 inc/classes/interfaces/.htaccess -text
 inc/classes/interfaces/application/.htaccess -text
 inc/classes/interfaces/application/class_ManageableApplication.php -text
@@ -252,6 +254,8 @@ 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/interfaces/user/.htaccess -text
+inc/classes/interfaces/user/class_ManageableUser.php -text
 inc/classes/main/.htaccess -text
 inc/classes/main/class_ -text
 inc/classes/main/class_BaseFrameworkSystem.php -text
@@ -293,7 +297,7 @@ inc/classes/main/factories/class_BaseFactory.php -text
 inc/classes/main/factories/objects/.htaccess -text
 inc/classes/main/factories/objects/class_ObjectFactory.php -text
 inc/classes/main/factories/web/.htaccess -text
-inc/classes/main/factories/web/class_NewsFactory.php -text
+inc/classes/main/factories/web/class_WebNewsFactory.php -text
 inc/classes/main/filter/.htaccess -text
 inc/classes/main/filter/class_ -text
 inc/classes/main/filter/class_AbstractFilterDecorator.php -text
@@ -326,6 +330,8 @@ 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/main/user/.htaccess -text
+inc/classes/main/user/class_User.php -text
 inc/classes/middleware/.htaccess -text
 inc/classes/middleware/class_BaseMiddleware.php -text
 inc/classes/middleware/compressor/.htaccess -text
index 407b58804b7c42ad7e5cb4818ae1549ac49dee50..b925ebdff6c92f83ce317baef7a3880d9f0f68d9 100644 (file)
@@ -201,7 +201,7 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica
                // Get a resolver
                $resolverInstance = WebControllerResolver::createWebControllerResolver($commandName, $this);
 
-               // Get a new controller instance as well
+               // Get a controller instance as well
                $this->controllerInstance = $resolverInstance->resolveCommandController();
 
                // Handle the request
@@ -216,7 +216,10 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica
         * @return      void
         */
        public function handleFatalMessages (array $messageList) {
-               die("<pre>".print_r($messageList, true)."</pre>");
+               // Walk through all messages
+               foreach ($messageList as $message) {
+                       die("MSG:".$message);
+               }
        }
 }
 
diff --git a/inc/classes/exceptions/user/.htaccess b/inc/classes/exceptions/user/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/classes/exceptions/user/class_UsernameMissingException.php b/inc/classes/exceptions/user/class_UsernameMissingException.php
new file mode 100644 (file)
index 0000000..8016cf3
--- /dev/null
@@ -0,0 +1,46 @@
+<?php
+/**
+ * A class for non-existing usernames
+ *
+ * @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 UsernameMissingException extends FrameworkException {
+       /**
+        * The super constructor for all exceptions
+        *
+        * @param               $msgArray               The non-optional message for the exception
+        * @param               $code           An optional code for better debugging
+        * @return      void
+        */
+       public function __construct(array $msgArray, $code = 0) {
+               // Create the message
+               $message = sprintf("[%s:%d] Username <u>%s</u> was not found.",
+                       $msgArray[0]->__toString(),
+                       $this->getLine(),
+                       $msgArray[1]
+               );
+
+               // Make sure everything is assigned properly
+               parent::__construct($message, $code);
+       }
+}
+
+// [EOF]
+?>
diff --git a/inc/classes/interfaces/user/.htaccess b/inc/classes/interfaces/user/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/classes/interfaces/user/class_ManageableUser.php b/inc/classes/interfaces/user/class_ManageableUser.php
new file mode 100644 (file)
index 0000000..eef4ef8
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+/**
+ * An interface for manageable users
+ *
+ * @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 ManageableUser extends FrameworkInterface {
+}
+
+//
+?>
index 559c4bc56b7021764e731a2d9e46e341988f772d..e4c2300971bf671b419f4740d536bd0c27ff7386 100644 (file)
@@ -32,7 +32,7 @@ class WebDoFormCommand extends BaseCommand implements Commandable {
                parent::__construct(__CLASS__);
 
                // Set special description
-               $this->setObjectDescription("DoForm-Command");
+               $this->setObjectDescription("Command for handling forms on a centralized place");
 
                // Create unique ID number
                $this->createUniqueID();
index a0f95607bf5c9f2b74da35e8d048d3989f5bb419..0b7e9c41a39e5951d492abf5106bfda76a334c0f 100644 (file)
@@ -32,7 +32,7 @@ class WebHomeCommand extends BaseCommand implements Commandable {
                parent::__construct(__CLASS__);
 
                // Set special description
-               $this->setObjectDescription("Home-Command");
+               $this->setObjectDescription("Command for the &quot;home&quot; page");
 
                // Create unique ID number
                $this->createUniqueID();
index 8ed4a4416433dc77dbe52770c98a1c3aa08ff600..af1d7488b8d31b522ea8ec5924ab07502fadcfbd 100644 (file)
@@ -32,7 +32,7 @@ class WebRegisterCommand extends BaseCommand implements Commandable {
                parent::__construct(__CLASS__);
 
                // Set special description
-               $this->setObjectDescription("Anmeldeformular-Command");
+               $this->setObjectDescription("Command for the registration form");
 
                // Create unique ID number
                $this->createUniqueID();
index 88322b60c499484237dece225877fdf5fb1eb93e..24566b91d880cab3fcc3348ece9c26f5bff53c61 100644 (file)
@@ -32,7 +32,7 @@ class Bzip2Compressor extends BaseFrameworkSystem implements Compressor {
                parent::__construct(__CLASS__);
 
                // Set description
-               $this->setObjectDescription("BZIP2-Kompressor");
+               $this->setObjectDescription("BZIP2 compressor");
 
                // Create an unique ID
                $this->createUniqueID();
index 4e95f801f95ef6214b85777c0396e438d6a6e919..08b1a6ded09325ec2350f8b2056fbb7b61ebc611 100644 (file)
@@ -32,7 +32,7 @@ class GzipCompressor extends BaseFrameworkSystem implements Compressor {
                parent::__construct(__CLASS__);
 
                // Set description
-               $this->setObjectDescription("GZIP-Kompressor");
+               $this->setObjectDescription("GZIP compressor");
 
                // Create an unique ID
                $this->createUniqueID();
index a8a570c581487ca464c9f05002e2f2576dbe13ee..157dc1a9ea41d0c270adcae6552bed674ca35a2e 100644 (file)
@@ -32,7 +32,7 @@ class NullCompressor extends BaseFrameworkSystem implements Compressor {
                parent::__construct(__CLASS__);
 
                // Set description
-               $this->setObjectDescription("Null-Kompressor");
+               $this->setObjectDescription("Null compressor");
 
                // Create an unique ID
                $this->createUniqueID();
index 78dc94c90599370005620523741ce8311248bf40..054c8c7db37d8e003cf97bdb13aa34047f79ad61 100644 (file)
@@ -32,7 +32,7 @@ class ConsoleTools extends BaseFrameworkSystem {
                parent::__construct(__CLASS__);
 
                // Set description
-               $this->setObjectDescription("Console-Tools");
+               $this->setObjectDescription("General console tools");
 
                // Create an unique ID
                $this->createUniqueID();
index 6b2b89df11018cd198486ce59ede64acc0ccd6b4..9d60e6178668eea76ec086bc6b3fe76fca8d5188 100644 (file)
@@ -32,7 +32,7 @@ class WebWebDefaultController extends BaseController implements Controller {
                parent::__construct(__CLASS__);
 
                // Set part description
-               $this->setObjectDescription("Standart-Controller f&uuml;r alle &uuml;brigen Anfragen");
+               $this->setObjectDescription("Default controller for all other requests");
 
                // Create unique ID number
                $this->createUniqueID();
index 8781206699eba2c35fa8093387fde9a57fd82578..b8bbc05544c0ea0d7482b47de98ed63e1f52d9e8 100644 (file)
@@ -32,7 +32,7 @@ class WebDefaultNewsController extends BaseController implements Controller {
                parent::__construct(__CLASS__);
 
                // Set part description
-               $this->setObjectDescription("Standart-Controller mit News-Auflistung");
+               $this->setObjectDescription("Default controller with news");
 
                // Create unique ID number
                $this->createUniqueID();
@@ -87,7 +87,7 @@ class WebDefaultNewsController extends BaseController implements Controller {
         */
        private function loadNewsByRequest (Requestable $requestInstance) {
                // Generate a new news object but not carring about which concrete we have
-               $newsInstance = NewsFactory::createFactoryByRequest($requestInstance)->createNewsObject();
+               $newsInstance = WebNewsFactory::createFactoryByRequest($requestInstance)->createNewsObject();
        }
 }
 
index b23dbc51e8566b9a2bb02285aa4f02e48e772d1c..dbe55ac36d4690125e36dfa9f74569cfaca4ccf9 100644 (file)
@@ -55,7 +55,7 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
                parent::__construct(__CLASS__);
 
                // Set description
-               $this->setObjectDescription("Dateidatenbankschicht");
+               $this->setObjectDescription("Class for local file databases");
 
                // Create unique ID
                $this->createUniqueID();
index dfcfd36b4dbd22bcff7b182587f9b3a0ce983247..e9be4a5910b617e06daa63f632f94a8614829f6b 100644 (file)
@@ -32,7 +32,7 @@ class DebugConsoleOutput extends BaseFrameworkSystem implements Debugger, Output
                parent::__construct(__CLASS__);
 
                // Set description
-               $this->setObjectDescription("Debug-Ausgabe auf Konsole");
+               $this->setObjectDescription("Debug output for the console");
 
                // Create an unique ID
                $this->createUniqueID();
index 26b099d4134f229405717659190c14993ddb6d65..1a1723fd698e39683722a131711225e44d3ca429 100644 (file)
@@ -32,7 +32,7 @@ class DebugErrorLogOutput extends BaseFrameworkSystem implements Debugger, Outpu
                parent::__construct(__CLASS__);
 
                // Set description
-               $this->setObjectDescription("Debug-Ausgabe in error_log()");
+               $this->setObjectDescription("Debug output to error_log()");
 
                // Create an unique ID
                $this->createUniqueID();
index 17faa197707408781efadb98fa0e3d3083ce863b..0c763e010b73f25e34262271779be9e7034ac9ca 100644 (file)
@@ -32,7 +32,7 @@ class DebugWebOutput extends BaseFrameworkSystem implements Debugger, OutputStre
                parent::__construct(__CLASS__);
 
                // Set description
-               $this->setObjectDescription("Debug-Ausgabe auf Konsole");
+               $this->setObjectDescription("Debug output for webpages");
 
                // Create an unique ID
                $this->createUniqueID();
index 75925c64820cdb87489453e5e44e33f5e5b2f051..3c23f805ae64cd44ea00bce911c10436983efa5f 100644 (file)
@@ -39,7 +39,7 @@ class ObjectLimits extends BaseFrameworkSystem {
                parent::__construct(__CLASS__);
 
                // Set part description
-               $this->setObjectDescription("Limitierungsobjekt");
+               $this->setObjectDescription("Class for &quot;limiting&quot; other classes. See description for details.");
 
                // Create unique ID number
                $this->createUniqueID();
index a0980e3d61f93fec58993f7ed775f3cbe1303ba4..7924d4c92e38cde0c25c68bea0ef53057e4ee0e7 100644 (file)
@@ -44,7 +44,7 @@ class SerializationContainer extends FrameworkArrayObject {
         * @return      $containerInstance              An instance of SerializationContainer
         * @throws      GetterNotFoundException If a getter was not found
         */
-       public final static function createSerializationContainer (ObjectLimits $limitInstance, $object) {
+       public final static function createSerializationContainer (ObjectLimits $limitInstance, FrameworkInterface $object) {
                // Get an instance
                $containerInstance = new SerializationContainer();
 
index fd983cac70f5da31b2ee42980200fc46a741960a..5dda5fb904b8e177b3f7a70286a2d693ee1dee04 100644 (file)
@@ -33,7 +33,7 @@ class ObjectFactory extends BaseFactory {
                parent::__construct(__CLASS__);
 
                // Set object description
-               $this->setObjectDescription("Objekte-Fabrik");
+               $this->setObjectDescription("Simple generic object factory");
        }
 
        /**
diff --git a/inc/classes/main/factories/web/class_NewsFactory.php b/inc/classes/main/factories/web/class_NewsFactory.php
deleted file mode 100644 (file)
index 032f3ce..0000000
+++ /dev/null
@@ -1,117 +0,0 @@
-<?php
-/**
- * A news factory for web pages
- *
- * @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 NewsFactory extends BaseFactory {
-       /**
-        * Instance of a request class
-        */
-       private $requestInstance = null;
-
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       protected function __construct () {
-               // Call parent constructor
-               parent::__construct(__CLASS__);
-
-               // Set part description
-               $this->setObjectDescription("News-Fabrik f&uuml;r Webseiten");
-       }
-
-       /**
-        * Singleton getter for a special factory instance depending on the given
-        * request
-        *
-        * @param       $requestInstance        An instance of a request class
-        * @return      $factoryInstance        An instance of a NewsFactory class
-        */
-       public final static function createFactoryByRequest (Requestable $requestInstance) {
-               // Generate the new instance
-               $factoryInstance = new NewsFactory();
-
-               // Get the element name from configuration
-               $element = FrameworkConfiguration::getInstance()->readConfig('app_selector_get');
-
-               // Analyze the request, first get the Uni* application name (short one from URL)
-               $appName = $requestInstance->getRequestElement($element);
-
-               // Initialize some variables
-               $className = "";
-               $className2 = $appName;
-
-               // Then construct the class name
-               foreach (array("_", "-") as $exp) {
-                       $array = explode($exp, $className2);
-                       foreach ($array as $el) {
-                               $className .= ucfirst(strtolower($el));
-                       }
-
-                       // Copy it back and clear the class name
-                       $className2 = $className;
-                       $className = "";
-               }
-
-               // After all is done, copy it back and add this class' name
-               $className = $className2 . $factoryInstance->__toString();
-
-               // Once we have that name, try to load initialize it
-               $realFactoryInstance = ObjectFactory::createObjectByName($className);
-
-               // And assign it with the factory
-               $factoryInstance->setRealFactoryInstance($realFactoryInstance);
-
-               // Remember the request we have used for later usage
-               $factoryInstance->setRequestInstance($requestInstance);
-
-               // Return the prepared factory instance
-               return $factoryInstance;
-       }
-
-       /**
-        * Setter for the request instance
-        *
-        * @param       $requestInstance        An instance of a request object
-        * @return      void
-        */
-       public final function setRequestInstance (Requestable $requestInstance) {
-               $this->requestInstance = $requestInstance;
-       }
-
-       /**
-        * Creates a new object instance and returns it
-        *
-        * @return      $newsInstance   An instance of a news object
-        */
-       public function createNewsObject () {
-               // Ask the real factory class for doing this
-               $newsInstance = $this->getRealFactoryInstance()->createNewObject($this->requestInstance);
-
-               // And return it
-               return $newsInstance;
-       }
-}
-
-// [EOF]
-?>
diff --git a/inc/classes/main/factories/web/class_WebNewsFactory.php b/inc/classes/main/factories/web/class_WebNewsFactory.php
new file mode 100644 (file)
index 0000000..032f3ce
--- /dev/null
@@ -0,0 +1,117 @@
+<?php
+/**
+ * A news factory for web pages
+ *
+ * @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 NewsFactory extends BaseFactory {
+       /**
+        * Instance of a request class
+        */
+       private $requestInstance = null;
+
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Set part description
+               $this->setObjectDescription("News-Fabrik f&uuml;r Webseiten");
+       }
+
+       /**
+        * Singleton getter for a special factory instance depending on the given
+        * request
+        *
+        * @param       $requestInstance        An instance of a request class
+        * @return      $factoryInstance        An instance of a NewsFactory class
+        */
+       public final static function createFactoryByRequest (Requestable $requestInstance) {
+               // Generate the new instance
+               $factoryInstance = new NewsFactory();
+
+               // Get the element name from configuration
+               $element = FrameworkConfiguration::getInstance()->readConfig('app_selector_get');
+
+               // Analyze the request, first get the Uni* application name (short one from URL)
+               $appName = $requestInstance->getRequestElement($element);
+
+               // Initialize some variables
+               $className = "";
+               $className2 = $appName;
+
+               // Then construct the class name
+               foreach (array("_", "-") as $exp) {
+                       $array = explode($exp, $className2);
+                       foreach ($array as $el) {
+                               $className .= ucfirst(strtolower($el));
+                       }
+
+                       // Copy it back and clear the class name
+                       $className2 = $className;
+                       $className = "";
+               }
+
+               // After all is done, copy it back and add this class' name
+               $className = $className2 . $factoryInstance->__toString();
+
+               // Once we have that name, try to load initialize it
+               $realFactoryInstance = ObjectFactory::createObjectByName($className);
+
+               // And assign it with the factory
+               $factoryInstance->setRealFactoryInstance($realFactoryInstance);
+
+               // Remember the request we have used for later usage
+               $factoryInstance->setRequestInstance($requestInstance);
+
+               // Return the prepared factory instance
+               return $factoryInstance;
+       }
+
+       /**
+        * Setter for the request instance
+        *
+        * @param       $requestInstance        An instance of a request object
+        * @return      void
+        */
+       public final function setRequestInstance (Requestable $requestInstance) {
+               $this->requestInstance = $requestInstance;
+       }
+
+       /**
+        * Creates a new object instance and returns it
+        *
+        * @return      $newsInstance   An instance of a news object
+        */
+       public function createNewsObject () {
+               // Ask the real factory class for doing this
+               $newsInstance = $this->getRealFactoryInstance()->createNewObject($this->requestInstance);
+
+               // And return it
+               return $newsInstance;
+       }
+}
+
+// [EOF]
+?>
index 95450e7171a1878d94b4dba1d2248d7a6b58edd2..cf2ff3b3c0fdb72c386fd1e2568c50ebde8c9365 100644 (file)
@@ -37,7 +37,7 @@ class FilterChain extends BaseFrameworkSystem {
                parent::__construct(__CLASS__);
 
                // Set part description
-               $this->setObjectDescription("");
+               $this->setObjectDescription("A filter chain class");
 
                // Create unique ID number
                $this->createUniqueID();
index 6f18e6b5ebd47f6e3f6fbd9f021381d1b6a31eb9..1c7c54afc820da98a0e2332fafd82737f416aa5a 100644 (file)
@@ -88,16 +88,7 @@ class UserNameValidatorFilter extends BaseFrameworkSystem implements Filterable
 
                        // Abort here
                        return false;
-               } elseif (!$this->ifUserNameIsValid($userName)) {
-                       // Regular expression check failed!
-                       $requestInstance->requestIsValid(false);
-
-                       // Set a message for the response
-                       $responseInstance->addFatalMessage('username_invalid');
-
-                       // Abort here
-                       return false;
-               } elseif (!$this->ifUserNameIsTaken($userName)) {
+               } elseif ($this->ifUserNameIsTaken($userName)) {
                        // Username is already taken
                        $requestInstance->requestIsValid(false);
 
@@ -108,6 +99,32 @@ class UserNameValidatorFilter extends BaseFrameworkSystem implements Filterable
                        return false;
                }
        }
+
+       /**
+        * Check wether the username as already been taken
+        *
+        * @param       $userName               Username to check for existence
+        * @return      $alreadyTaken   Wether the username has been taken
+        */
+       private function ifUserNameIsTaken ($userName) {
+               // Default is already taken
+               $alreadyTaken = true;
+
+               // Try to create a user instance
+               try {
+                       // If this instance is created then the username *does* exist
+                       $userInstance = User::createUserByUsername($userName);
+               } catch (UsernameMissingException $e) {
+                       // Okay, this user is missing!
+                       $alreadyTaken = false;
+               } catch (FrameworkException $e) {
+                       // Something bad happend
+                       ApplicationEntryPoint::app_die(sprintf("Exception: %s", $e->__toString()));
+               }
+
+               // Return the result
+               return $alreadyTaken;
+       }
 }
 
 // [EOF]
index 11d636c90844110d5cc1b507b60515fc66b4ff50..02a99e3aa16714b9eff08701e0eb95a01a2512c2 100644 (file)
@@ -42,9 +42,6 @@ class BaseHelper extends BaseFrameworkSystem {
                // Call parent constructor
                parent::__construct($className);
 
-               // Create unique ID number
-               $this->createUniqueID();
-
                // Clean up a little
                $this->removeNumberFormaters();
                $this->removeSystemArray();
index fc14638408cca3c5214e30ed4887e4ba709d54ff..00b7c0bdc0013f0f0bfacdc9f47400e96ad2e09c 100644 (file)
@@ -64,7 +64,10 @@ class WebFormHelper extends BaseHelper {
                parent::__construct(__CLASS__);
 
                // Set part description
-               $this->setObjectDescription("HTML-Formularhilfsklasse");
+               $this->setObjectDescription("Helper class for HTML forms");
+
+               // Create unique ID number
+               $this->createUniqueID();
        }
 
        /**
index c9833465a84dd6757a94e947795848c84ea39303..ee02a8d2ffa32198fb466746110af2cd01843201 100644 (file)
@@ -21,7 +21,7 @@
  * 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 FileIOStream extends BaseFrameworkSystem implements FileInputStreamer, FileOutputStreamer {
+class FileIoStream extends BaseFrameworkSystem implements FileInputStreamer, FileOutputStreamer {
        /**
         * Protected constructor
         */
@@ -30,7 +30,7 @@ class FileIOStream extends BaseFrameworkSystem implements FileInputStreamer, Fil
                parent::__construct(__CLASS__);
 
                // Set part description
-               $this->setObjectDescription("Universal Datei-Ein-/Ausgabesystem");
+               $this->setObjectDescription("Universal file I/O stream system");
 
                // Create unique ID
                $this->createUniqueID();
@@ -44,11 +44,11 @@ class FileIOStream extends BaseFrameworkSystem implements FileInputStreamer, Fil
         * Create a file IO stream. This is a class for performing all actions
         * on files like creating, deleting and loading them.
         *
-        * @return      $ioInstance     An instance of FileIOStream
+        * @return      $ioInstance     An instance of FileIoStream
         */
-       public final static function createFileIOStream () {
+       public final static function createFileIoStream () {
                // Create new instance
-               $ioInstance = new FileIOStream();
+               $ioInstance = new FileIoStream();
 
                // Return the instance
                return $ioInstance;
index 5ad52ed709ec177ba36b7168d91f4a569aab0181..f05bfc0275ce80e1253ae610cc049fa5965f7f19 100644 (file)
@@ -40,7 +40,7 @@ class FrameworkDirectoryPointer extends BaseFrameworkSystem {
                parent::__construct(__CLASS__);
 
                // Set part description
-               $this->setObjectDescription("Verzeichnis-Handler");
+               $this->setObjectDescription("Helper for handling directories");
 
                // Create unique ID
                $this->createUniqueID();
index a38b0a3d1d08e83270157aef05370ee931c9990f..b93c0026b50467832b6c5e81fd09816a442e7b4d 100644 (file)
@@ -40,7 +40,7 @@ class FrameworkFileInputPointer extends BaseFrameworkSystem {
                parent::__construct(__CLASS__);
 
                // Set part description
-               $this->setObjectDescription("Dateiausgabe-Handler");
+               $this->setObjectDescription("Handler for reading from files");
 
                // Create unique ID
                $this->createUniqueID();
index 8cc07caaa78e8977afcc880e260611396aa08836..350cd7241afa6ae24b066ae7d78649292893076f 100644 (file)
@@ -40,7 +40,7 @@ class FrameworkFileOutputPointer extends BaseFrameworkSystem {
                parent::__construct(__CLASS__);
 
                // Set part description
-               $this->setObjectDescription("Dateiausgabe-Handler");
+               $this->setObjectDescription("Handler for writing to files");
 
                // Create unique ID
                $this->createUniqueID();
index 6a830b4420d5ce40a4202c7ac7a39fcc64210f16..73763676b8289b20d8b2d5b8815e9a5a83a93f6e 100644 (file)
@@ -53,7 +53,7 @@ class LanguageSystem extends BaseFrameworkSystem implements ManageableLanguage {
                parent::__construct(__CLASS__);
 
                // Set part description
-               $this->setObjectDescription("Sprachsystem");
+               $this->setObjectDescription("Language sub-system");
 
                // Create unique ID number
                $this->createUniqueID();
@@ -66,7 +66,7 @@ class LanguageSystem extends BaseFrameworkSystem implements ManageableLanguage {
        /**
         * Creates an instance of the class LanguageSystem and prepares it for usage
         *
-        * @param               $basePath               The local base path for all language strings
+        * @param       $basePath               The local base path for all language strings
         * @return      $langInstance   An instance of LanguageSystem
         * @throws      LanguagePathIsEmptyException            If the provided $basePath is empty
         * @throws      InvalidLanguagePathStringException      If $basePath is no string
index c421ec4d3e9aacd98391790b92b25a7e78352ffc..7eeb854eeb926fdb3e2be7e6a72c511dba91d21e 100644 (file)
@@ -43,7 +43,7 @@ class ConsoleOutput extends BaseFrameworkSystem implements OutputStreamer {
                parent::__construct(__CLASS__);
 
                // Set description
-               $this->setObjectDescription("Console-Ausgabe-Handler");
+               $this->setObjectDescription("Console output class");
 
                // Create an unique ID
                $this->createUniqueID();
index a687cea24ddacb6f1ddde77442573558e3f92035..b1eecc9f36ef37046556a9adeab8192c61d29c66 100644 (file)
@@ -38,7 +38,7 @@ class WebOutput extends BaseFrameworkSystem implements OutputStreamer {
                parent::__construct(__CLASS__);
 
                // Set description
-               $this->setObjectDescription("Web-Ausgabe-Handler");
+               $this->setObjectDescription("Class for web output e.g. XHTML code");
 
                // Create an unique ID
                $this->createUniqueID();
index aa337db6a29e11654ea87553afc1a3e7c745200e..b95bab1bbdb790dad06dc6e5ece4a94da4c847fc 100644 (file)
@@ -44,7 +44,7 @@ class HttpRequest extends BaseFrameworkSystem implements Requestable {
                parent::__construct(__CLASS__);
 
                // Set part description
-               $this->setObjectDescription("HTTP-Anfrage");
+               $this->setObjectDescription("HTTP request");
 
                // Create unique ID number
                $this->createUniqueID();
index d1bc85e5f69302144a967fa974f2dec43ff1bfc6..47baef47bfc4cceabea389d6e49aa602e24413cd 100644 (file)
@@ -37,7 +37,7 @@ class WebCommandResolver extends BaseResolver implements CommandResolver {
                parent::__construct(__CLASS__);
 
                // Set part description
-               $this->setObjectDescription("Lokaler Kommandoaufl&ouml;ser");
+               $this->setObjectDescription("Resolver for local web commands");
 
                // Create unique ID number
                $this->createUniqueID();
index fe03162bdf05f43df91318d008407a043b6f577f..9e50d94516dfe8a99b592f7a8a73b33257257eaa 100644 (file)
@@ -42,7 +42,7 @@ class WebControllerResolver extends BaseResolver implements ControllerResolver {
                parent::__construct(__CLASS__);
 
                // Set part description
-               $this->setObjectDescription("");
+               $this->setObjectDescription("Resolver for local web controllers");
 
                // Create unique ID number
                $this->createUniqueID();
index 39185e9948b76613b64c7613b84ff99abae50178..52ad2a76db0ad226d10c7312a8e3ec5445d6e769 100644 (file)
@@ -60,7 +60,7 @@ class HttpResponse extends BaseFrameworkSystem implements Responseable {
                parent::__construct(__CLASS__);
 
                // Set part description
-               $this->setObjectDescription("HTTP-Antwort");
+               $this->setObjectDescription("HTTP response");
 
                // Create unique ID number
                $this->createUniqueID();
index 79fa5078ed6159d6eaf55957ccce5ce9275d1490..412d26ac442936a6847cf3a32392c73eb3827a53 100644 (file)
@@ -123,7 +123,7 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate
                parent::__construct(__CLASS__);
 
                // Set part description
-               $this->setObjectDescription("Template-Engine");
+               $this->setObjectDescription("Web template engine");
 
                // Create unique ID number
                $this->createUniqueID();
diff --git a/inc/classes/main/user/.htaccess b/inc/classes/main/user/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/classes/main/user/class_User.php b/inc/classes/main/user/class_User.php
new file mode 100644 (file)
index 0000000..53e8b46
--- /dev/null
@@ -0,0 +1,103 @@
+<?php
+/**
+ * A generic class for handling users
+ *
+ * @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 User extends BaseFrameworkSystem implements ManageableUser {
+       /**
+        * Username
+        */
+       private $username = "";
+
+       // Exceptions
+       const EXCEPTION_USERNAME_NOT_FOUND = 0xd00;
+
+       /**
+        * Private constructor
+        *
+        * @return      void
+        */
+       protected function __construct ($class = "") {
+               // Is the class name empty? Then this is not a specialized user class
+               if (empty($class)) $class = __CLASS__;
+
+               // Call parent constructor
+               parent::__construct($class);
+
+               // Set part description
+               $this->setObjectDescription("Generic user class");
+
+               // Create unique ID number
+               $this->createUniqueID();
+
+               // Clean up a little
+               $this->removeNumberFormaters();
+               $this->removeSystemArray();
+       }
+
+       /**
+        * Creates an instance of this user class by a provided username. This
+        * factory method will check if the username is already taken and if not
+        * so it will throw an exception.
+        *
+        * @param       $username               Username we need a class instance for
+        * @return      $userInstance   An instance of this user class
+        * @throws      UsernameMissingException        If the username does not exist
+        */
+       public final static function createUserByUsername ($userName) {
+               // Get a new instance
+               $userInstance = new User();
+
+               // Set the username
+               $userInstance->setUsername($userName);
+
+               // Check if the username exists
+               if (!$userInstance->ifUsernameExists()) {
+                       // Throw an exception here
+                       throw new UsernameMissingException(array($userInstance, $userName), self::EXCEPTION_USERNAME_NOT_FOUND);
+               }
+
+               // Return the instance
+               return $userInstance;
+       }
+
+       /**
+        * Setter for username
+        *
+        * @param       $userName       The username to set
+        * @return      void
+        */
+       protected final function setUsername ($userName) {
+               $this->userNane = $userName;
+       }
+
+       /**
+        * Getter for username
+        *
+        * @return      $userName       The username to set
+        */
+       public final function getUsername () {
+               return $this->userNane;
+       }
+}
+
+// [EOF]
+?>
index 4bf0ab3dc80e2c2b12cf04085cd4ccfbc30e6835..d5622f3cbb35351f0d3030323a5da32e4f949f36 100644 (file)
@@ -36,6 +36,9 @@ $cfg->definePath(dirname(dirname(__FILE__)) . '/'); // DON'T MISS THE TRAILING S
 // CFG: DATABASE-TYPE
 $cfg->defineDatabaseType('local');
 
+// CFG: LOCAL-DB-PATH
+$cfg->setConfigEntry('local_db_path', 'db/');
+
 // CFG: TIME-ZONE
 $cfg->setDefaultTimezone("Europe/Berlin");
 
@@ -60,11 +63,14 @@ $cfg->setConfigEntry('code_template_extension', ".ctp");
 // CFG: SELECTOR-GET
 $cfg->setConfigEntry('app_selector_get', "app");
 
+// CFG: SELECTOR-PATH
+$cfg->setConfigEntry('selector_path', "selector");
+
 // CFG: APPLICATION-HELPER
 $cfg->setConfigEntry('app_helper_class', "ApplicationHelper");
 
-// CFG: SELECTOR-PATH
-$cfg->setConfigEntry('selector_path', "selector");
+// CFG: LAUNCH-METHOD
+$cfg->setConfigEntry('entry_method', "entryPoint");
 
 // CFG: TEMPLATE-BASE-PATH
 $cfg->setConfigEntry('tpl_base_path', "templates/"); // DON'T MISS THE TRAILING SLASH!
@@ -123,9 +129,6 @@ $cfg->setConfigEntry('meta_keywords', "test,test,test");
 // CFG: META-DESCRIPTION
 $cfg->setConfigEntry('meta_description', "A lame description for an application framework");
 
-// CFG: LAUNCH-METHOD
-$cfg->setConfigEntry('entry_method', "entryPoint");
-
 // CFG: SELECTOR-MAIN-TEMPLATE
 $cfg->setConfigEntry('selector_main_tpl', "selector_main");
 
index 3430af52d36d36418d1b91df8aaa6b786e2ca648..95b0f895417079d1762c1e59b4edd5433ff68ac7 100644 (file)
 
 // Zum Testen speichern wir in lokale Dateien (LocalFileDatabase)
 try {
-       $layer = LocalFileDatabase::createLocalFileDatabase(PATH . 'db/', FileIoHandler::getInstance());
+       $layer = LocalFileDatabase::createLocalFileDatabase(PATH . FrameworkConfiguration::getInstance()->readConfig('local_db_path'), FileIoHandler::getInstance());
 } catch (SavePathIsEmptyException $e) {
-       ApplicationEntryPoint::app_die(sprintf("[Main:] Debug-Instanz konnte nicht gesetzt werden. Reason: <strong>%s</strong><br />\n",
+       ApplicationEntryPoint::app_die(sprintf("[Main:] Database layer could not be initialized. Reason: <strong>%s</strong><br />\n",
                $e->getMessage()
        ));
 } catch (SavePathNotFoundException $e) {
-       ApplicationEntryPoint::app_die(sprintf("[Main:] Debug-Instanz konnte nicht gesetzt werden. Reason: <strong>%s</strong><br />\n",
+       ApplicationEntryPoint::app_die(sprintf("[Main:] Database layer could not be initialized. Reason: <strong>%s</strong><br />\n",
                $e->getMessage()
        ));
 } catch (SavePathIsNoDirectoryException $e) {
-       ApplicationEntryPoint::app_die(sprintf("[Main:] Debug-Instanz konnte nicht gesetzt werden. Reason: <strong>%s</strong><br />\n",
+       ApplicationEntryPoint::app_die(sprintf("[Main:] Database layer could not be initialized. Reason: <strong>%s</strong><br />\n",
                $e->getMessage()
        ));
 } catch (SavePathReadProtectedException $e) {
-       ApplicationEntryPoint::app_die(sprintf("[Main:] Debug-Instanz konnte nicht gesetzt werden. Reason: <strong>%s</strong><br />\n",
+       ApplicationEntryPoint::app_die(sprintf("[Main:] Database layer could not be initialized. Reason: <strong>%s</strong><br />\n",
                $e->getMessage()
        ));
 } catch (SavePathWriteProtectedException $e) {
-       ApplicationEntryPoint::app_die(sprintf("[Main:] Debug-Instanz konnte nicht gesetzt werden. Reason: <strong>%s</strong><br />\n",
+       ApplicationEntryPoint::app_die(sprintf("[Main:] Database layer could not be initialized. Reason: <strong>%s</strong><br />\n",
                $e->getMessage()
        ));
 }