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 62c4a88..4078b21 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 407b588..b925ebd 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 559c4bc..e4c2300 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 a0f9560..0b7e9c4 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 8ed4a44..af1d748 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 88322b6..24566b9 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 4e95f80..08b1a6d 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 a8a570c..157dc1a 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 78dc94c..054c8c7 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 6b2b89d..9d60e61 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 8781206..b8bbc05 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 b23dbc5..dbe55ac 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 dfcfd36..e9be4a5 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 26b099d..1a1723f 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 17faa19..0c763e0 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 75925c6..3c23f80 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 a0980e3..7924d4c 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 fd983ca..5dda5fb 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 95450e7..cf2ff3b 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 6f18e6b..1c7c54a 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 11d636c..02a99e3 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 fc14638..00b7c0b 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 c983346..ee02a8d 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 5ad52ed..f05bfc0 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 a38b0a3..b93c002 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 8cc07ca..350cd72 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 6a830b4..7376367 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 c421ec4..7eeb854 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 a687cea..b1eecc9 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 aa337db..b95bab1 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 d1bc85e..47baef4 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 fe03162..9e50d94 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 39185e9..52ad2a7 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 79fa507..412d26a 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 4bf0ab3..d5622f3 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 3430af5..95b0f89 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()
        ));
 }