]> git.mxchange.org Git - shipsimu.git/commitdiff
Login and auth classes added. WARNING: All class config entries must end with _class!
authorRoland Häder <roland@mxchange.org>
Sun, 15 Jun 2008 19:30:22 +0000 (19:30 +0000)
committerRoland Häder <roland@mxchange.org>
Sun, 15 Jun 2008 19:30:22 +0000 (19:30 +0000)
70 files changed:
.gitattributes
application/selector/class_ApplicationSelector.php
application/selector/starter.php
application/ship-simu/class_ApplicationHelper.php
application/ship-simu/config.php
application/ship-simu/main/commands/web/class_WebShipsimuRegisterCommand.php
application/ship-simu/main/login/class_ShipSimuUserLogin.php
application/ship-simu/main/login/helper/class_ShipSimuLoginHelper.php
application/ship-simu/main/registration/class_ShipSimuRegistration.php
application/ship-simu/starter.php
inc/classes/exceptions/auth/.htaccess [new file with mode: 0644]
inc/classes/exceptions/auth/class_UserAuthorizationException.php [new file with mode: 0644]
inc/classes/exceptions/class_ [new file with mode: 0644]
inc/classes/exceptions/class_FrameworkException.php
inc/classes/exceptions/filter/.htaccess [new file with mode: 0644]
inc/classes/exceptions/filter/class_FilterChainException.php [new file with mode: 0644]
inc/classes/interfaces/auth/.htaccess [new file with mode: 0644]
inc/classes/interfaces/auth/class_Authorizeable.php [new file with mode: 0644]
inc/classes/interfaces/reader/.htaccess [new file with mode: 0644]
inc/classes/interfaces/reader/class_ReadableNews.php [new file with mode: 0644]
inc/classes/interfaces/request/class_Requestable.php
inc/classes/interfaces/response/class_Responseable.php
inc/classes/main/actions/post_registration/class_LoginAfterRegistrationAction.php
inc/classes/main/auth/.htaccess [new file with mode: 0644]
inc/classes/main/auth/class_CookieAuth.php [new file with mode: 0644]
inc/classes/main/class_BaseFrameworkSystem.php
inc/classes/main/commands/web/class_WebLoginAreaCommand.php
inc/classes/main/controller/class_BaseController.php
inc/classes/main/controller/default/class_WebDefaultNewsController.php
inc/classes/main/controller/login/.htaccess [new file with mode: 0644]
inc/classes/main/controller/login/class_WebLoginAreaController.php [new file with mode: 0644]
inc/classes/main/database/class_BaseDatabaseFrontend.php
inc/classes/main/database/databases/class_LocalFileDatabase.php
inc/classes/main/database/wrapper/class_UserDatabaseWrapper.php
inc/classes/main/factories/cache/class_CacheFactory.php
inc/classes/main/factories/objects/class_ObjectFactory.php
inc/classes/main/factories/web/class_WebNewsFactory.php
inc/classes/main/filter/auth/.htaccess [new file with mode: 0644]
inc/classes/main/filter/auth/class_UserAuthFilter.php [new file with mode: 0644]
inc/classes/main/filter/checkboxes/class_RulesAcceptedFilter.php
inc/classes/main/filter/class_BaseFilter.php [new file with mode: 0644]
inc/classes/main/filter/class_FilterChain.php
inc/classes/main/filter/news/.htaccess [new file with mode: 0644]
inc/classes/main/filter/news/class_NewsDownloadFilter.php [new file with mode: 0644]
inc/classes/main/filter/news/class_NewsProcessFilter.php [new file with mode: 0644]
inc/classes/main/filter/null/class_NullFilter.php
inc/classes/main/filter/validator/class_EmailValidatorFilter.php
inc/classes/main/filter/validator/class_PasswordValidatorFilter.php
inc/classes/main/filter/validator/class_UserNameValidatorFilter.php
inc/classes/main/helper/web/class_WebFormHelper.php
inc/classes/main/login/.htaccess [deleted file]
inc/classes/main/login/class_CookieLogin.php [deleted file]
inc/classes/main/reader/.htaccess [new file with mode: 0644]
inc/classes/main/reader/class_DefaultNewsReader.php [new file with mode: 0644]
inc/classes/main/registration/class_BaseRegistration.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/class_User.php
inc/classes/middleware/io/class_FileIoHandler.php
inc/config.php
inc/config/class_FrameworkConfiguration.php
inc/file_io.php
inc/includes.php
inc/loader/class_ClassLoader.php
inc/output.php
templates/de/code/emergency_exit.ctp
templates/de/code/header.ctp

index 578b832e0d0b1da516afe7444e1096cf0660efce..bff812fd2123c8ff6867590593bef5eb4ce1a97a 100644 (file)
@@ -149,6 +149,9 @@ inc/.htaccess -text
 inc/classes.php -text
 inc/classes/.htaccess -text
 inc/classes/exceptions/.htaccess -text
+inc/classes/exceptions/auth/.htaccess -text
+inc/classes/exceptions/auth/class_UserAuthorizationException.php -text
+inc/classes/exceptions/class_ -text
 inc/classes/exceptions/class_FrameworkException.php -text
 inc/classes/exceptions/compressor/.htaccess -text
 inc/classes/exceptions/compressor/class_MismatchingCompressorsException.php -text
@@ -170,6 +173,8 @@ inc/classes/exceptions/database/local_file/class_SavePathReadProtectedException.
 inc/classes/exceptions/database/local_file/class_SavePathWriteProtectedException.php -text
 inc/classes/exceptions/database/wrapper/.htaccess -text
 inc/classes/exceptions/database/wrapper/class_WrapperUserNameNotFoundException.php -text
+inc/classes/exceptions/filter/.htaccess -text
+inc/classes/exceptions/filter/class_FilterChainException.php -text
 inc/classes/exceptions/helper/.htaccess -text
 inc/classes/exceptions/helper/class_FormClosedException.php -text
 inc/classes/exceptions/helper/class_FormGroupClosedException.php -text
@@ -232,6 +237,8 @@ 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
+inc/classes/interfaces/auth/.htaccess -text
+inc/classes/interfaces/auth/class_Authorizeable.php -text
 inc/classes/interfaces/cache/.htaccess -text
 inc/classes/interfaces/cache/class_Cacheable.php -text
 inc/classes/interfaces/class_ -text
@@ -272,6 +279,8 @@ inc/classes/interfaces/language/.htaccess -text
 inc/classes/interfaces/language/class_ManageableLanguage.php -text
 inc/classes/interfaces/login/.htaccess -text
 inc/classes/interfaces/login/class_LoginableUser.php -text
+inc/classes/interfaces/reader/.htaccess -text
+inc/classes/interfaces/reader/class_ReadableNews.php -text
 inc/classes/interfaces/registration/.htaccess -text
 inc/classes/interfaces/registration/class_UserRegister.php -text
 inc/classes/interfaces/registry/.htaccess -text
@@ -297,6 +306,8 @@ inc/classes/main/actions/class_ -text
 inc/classes/main/actions/class_BaseAction.php -text
 inc/classes/main/actions/post_registration/.htaccess -text
 inc/classes/main/actions/post_registration/class_LoginAfterRegistrationAction.php -text
+inc/classes/main/auth/.htaccess -text
+inc/classes/main/auth/class_CookieAuth.php -text
 inc/classes/main/cache/.htaccess -text
 inc/classes/main/cache/class_MemoryCache.php -text
 inc/classes/main/class_ -text
@@ -324,6 +335,8 @@ inc/classes/main/controller/default/class_WebDefaultController.php -text
 inc/classes/main/controller/default/class_WebDefaultNewsController.php -text
 inc/classes/main/controller/form/.htaccess -text
 inc/classes/main/controller/form/class_WebDoFormController.php -text
+inc/classes/main/controller/login/.htaccess -text
+inc/classes/main/controller/login/class_WebLoginAreaController.php -text
 inc/classes/main/criteria/.htaccess -text
 inc/classes/main/criteria/class_DataSetCriteria.php -text
 inc/classes/main/criteria/class_SearchCriteria.php -text
@@ -353,12 +366,18 @@ inc/classes/main/factories/objects/class_ObjectFactory.php -text
 inc/classes/main/factories/web/.htaccess -text
 inc/classes/main/factories/web/class_WebNewsFactory.php -text
 inc/classes/main/filter/.htaccess -text
+inc/classes/main/filter/auth/.htaccess -text
+inc/classes/main/filter/auth/class_UserAuthFilter.php -text
 inc/classes/main/filter/checkboxes/.htaccess -text
 inc/classes/main/filter/checkboxes/class_RulesAcceptedFilter.php -text
 inc/classes/main/filter/class_ -text
 inc/classes/main/filter/class_AbstractFilterDecorator.php -text
+inc/classes/main/filter/class_BaseFilter.php -text
 inc/classes/main/filter/class_FilterChain.php -text
 inc/classes/main/filter/decorator/.htaccess -text
+inc/classes/main/filter/news/.htaccess -text
+inc/classes/main/filter/news/class_NewsDownloadFilter.php -text
+inc/classes/main/filter/news/class_NewsProcessFilter.php -text
 inc/classes/main/filter/null/.htaccess -text
 inc/classes/main/filter/null/class_NullFilter.php -text
 inc/classes/main/filter/validator/.htaccess -text
@@ -379,11 +398,11 @@ inc/classes/main/io/class_FrameworkFileInputPointer.php -text
 inc/classes/main/io/class_FrameworkFileOutputPointer.php -text
 inc/classes/main/language/.htaccess -text
 inc/classes/main/language/class_LanguageSystem.php -text
-inc/classes/main/login/.htaccess -text
-inc/classes/main/login/class_CookieLogin.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/reader/.htaccess -text
+inc/classes/main/reader/class_DefaultNewsReader.php -text
 inc/classes/main/registration/.htaccess -text
 inc/classes/main/registration/class_BaseRegistration.php -text
 inc/classes/main/registry/.htaccess -text
index f6dab265c8f6fd415ab150556ef4d23c9a858edf..928fcda608222ec3bbd246ee3013a79cca61e532 100644 (file)
@@ -273,7 +273,7 @@ class ApplicationSelector extends BaseFrameworkSystem {
 
                        // Remember this template and the application for later usage
                        $this->loadedTemplates->append(array(
-                               'tpl_engine'   => $tplEngine,
+                               'template_class'   => $tplEngine,
                                'app_instance' => $appInstance
                        ));
                }
@@ -342,9 +342,9 @@ class ApplicationSelector extends BaseFrameworkSystem {
                        } elseif (count($curr) != 2) {
                                // Not expected count of entries
                                throw new InvalidArrayCountException(array($this, "curr", count($curr), 2), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT);
-                       } elseif (!isset($curr['tpl_engine']) || (!isset($curr['app_instance']))) {
+                       } elseif (!isset($curr['template_class']) || (!isset($curr['app_instance']))) {
                                // Expected entries missing
-                               throw new MissingArrayElementsException(array($this, "curr", array('tpl_engine', 'app_instance')), self::EXCEPTION_ARRAY_ELEMENTS_MISSING);
+                               throw new MissingArrayElementsException(array($this, "curr", array('template_class', 'app_instance')), self::EXCEPTION_ARRAY_ELEMENTS_MISSING);
                        }
                        die("<pre>".print_r($curr, true)."</pre>");
 
index 4bcbd4ac5a3a36cd023ac87111b50fa029617844..fcd9855cc5bdf85462c72b2c1360af6d1b213627 100644 (file)
@@ -51,7 +51,7 @@ try {
        // Call user function
        call_user_func_array(array($app, FrameworkConfiguration::getInstance()->readConfig('entry_method')), array());
 } catch (FrameworkException  $e) {
-       ApplicationEntryPoint::app_die(sprintf("[Main:] The application <strong>%s</strong> could not be launched for the follwing reason: <strong>%s</strong>",
+       ApplicationEntryPoint::app_die(sprintf("[Main:] The application <strong>%s</strong> has been terminated due to a thrown exception: <strong>%s</strong>",
                $application,
                $e->getMessage()
        ));
index ef2de33ecda7290a372b2d818506f42b2282ff5f..c8057d44099809b2b8d7a9cef3a2290f51023be6 100644 (file)
@@ -187,16 +187,13 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica
                // ... and a new response object
                $responseInstance = HttpResponse::createHttpResponse($this);
 
-               // Get command parameter
-               $commandPara = $this->getConfigInstance()->readConfig('command_parameter');
-
                // Get the parameter from the request
-               $commandName = $requestInstance->getRequestElement($commandPara);
+               $commandName = $requestInstance->getRequestElement("page");
 
                // If it is null then get default command
                if (is_null($commandName)) {
                        $commandName = $this->getConfigInstance()->readConfig('default_command');
-               }
+               } // END - if
 
                // Get a resolver
                $resolverInstance = WebControllerResolver::createWebControllerResolver($commandName, $this);
index a827e380cbe3c6169b3997e5d1226b3180dc23f1..d5f7a4824339f2b084c3cf1f1ecea86079de50f0 100644 (file)
@@ -67,26 +67,38 @@ $cfg->setConfigEntry('chat_enabled_aol', "Y");
 // CFG: CHAT-ENABLED-MSN
 $cfg->setConfigEntry('chat_enabled_msn', "Y");
 
-// CFG: COMMAND-PARAMETER
-$cfg->setConfigEntry('command_parameter', "page");
-
 // CFG: USER-REGISTRATION
-$cfg->setConfigEntry('user_registration', "ShipSimuRegistration");
+$cfg->setConfigEntry('user_registration_class', "ShipSimuRegistration");
 
 // CFG: LOGIN-USER
-$cfg->setConfigEntry('login_user', "ShipSimuUserLogin");
+$cfg->setConfigEntry('user_login_class', "ShipSimuUserLogin");
 
 // CFG: USER-STATUS-REGISTER
 $cfg->setConfigEntry('user_status_register', "UNCONFIRMED");
 
 // CFG: LOGIN-HELPER
-$cfg->setConfigEntry('login_helper', "ShipSimuLoginHelper");
+$cfg->setConfigEntry('login_helper_class', "ShipSimuLoginHelper");
 
 // CFG: LOGIN-METHOD
-$cfg->setConfigEntry('login_method', "cookie");
+$cfg->setConfigEntry('auth_method_class', "CookieAuth");
 
 // CFG: APP-LOGIN-URL
 $cfg->setConfigEntry('app_login_url', "index.php?app=ship-simu&page=login_area");
 
+// CFG: LOGIN-DEFAULT-ACTION
+$cfg->setConfigEntry('login_default_action', "welcome");
+
+// CFG: NEWS-READER-CLASS
+$cfg->setConfigEntry('news_reader_class', "DefaultNewsReader");
+
+// CFG: NEWS-DOWNLOAD-FILTER
+$cfg->setConfigEntry('news_download_class', "NewsDownloadFilter");
+
+// CFG: NEWS-PROCESS-FILTER
+$cfg->setConfigEntry('news_process_class', "NewsProcessFilter");
+
+// CFG: USER-AUTH-FILTER
+$cfg->setConfigEntry('user_auth_class', "UserAuthFilter");
+
 // [EOF]
 ?>
index 0940b79630a8c71dc65494c68983f9b873ef75b6..cc9b0b7193e4fa1902503f9917fa5c0f71196c1c 100644 (file)
@@ -59,10 +59,10 @@ class WebShipsimuRegisterCommand extends BaseCommand implements Commandable {
                $controllerInstance = $resolverInstance->getControllerInstance();
 
                // @TODO Add some more pre/post filters to the controller
-               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('email_validator'));
-               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_validator'));
-               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('password_validator'));
-               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('rules_accepted_filter'));
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('email_validator_class'));
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_validator_class'));
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('password_validator_class'));
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('rules_accepted_class'));
 
                // Return the prepared instance
                return $commandInstance;
@@ -77,7 +77,7 @@ class WebShipsimuRegisterCommand extends BaseCommand implements Commandable {
         */
        public function execute (Requestable $requestInstance, Responseable $responseInstance) {
                // First get a UserRegistration instance
-               $registerInstance = ObjectFactory::createObjectByConfiguredName('user_registration');
+               $registerInstance = ObjectFactory::createObjectByConfiguredName('user_registration_class');
 
                // First set request and response instance
                $registerInstance->setRequestInstance($requestInstance);
index 59ddcdcb6b9f8619191dbabb3aeb1732281d0aaa..75bc8fa1384b8b8dc2edbd9c9860b362cc28b858 100644 (file)
@@ -63,7 +63,7 @@ class ShipSimuUserLogin extends BaseFrameworkSystem implements LoginableUser {
         * @param       $requestInstance        An instance of a Requestable class
         * @param       $responseInstance       An instance of a Responseable class
         * @return      void
-        * @throws      UserLoginMethodException        If wether username nor email login
+        * @throws      UserAuthMethodException If wether username nor email login
         *                                                                              was detected
         * @throws      MissingMethodException          If a method was not found in the
         *                                                                              User class
@@ -89,7 +89,7 @@ class ShipSimuUserLogin extends BaseFrameworkSystem implements LoginableUser {
                // Is a method detected?
                if (is_null($method)) {
                        // Then abort here
-                       throw new UserLoginMethodException($this, self::EXCEPTION_MISSING_METHOD);
+                       throw new UserAuthMethodException($this, self::EXCEPTION_MISSING_METHOD);
                } elseif (!method_exists($this->getConfigInstance()->readConfig('user_class'), $method)) {
                        // The method is invalid!
                        throw new MissingMethodException(array($this, $method), self::EXCEPTION_MISSING_METHOD);
@@ -116,7 +116,7 @@ class ShipSimuUserLogin extends BaseFrameworkSystem implements LoginableUser {
                // Now do the real login. This can be cookie- or session-based login
                // which depends on the admins setting then on the user's taste.
                // 1) Get a login helper instance
-               $helperInstance = ObjectFactory::createObjectByConfiguredName('login_helper', array($requestInstance));
+               $helperInstance = ObjectFactory::createObjectByConfiguredName('login_helper_class', array($requestInstance));
 
                // 2) Execute the login. This will now login...
                $helperInstance->executeLogin($responseInstance);
index 9dd7f96fb34a815a11e1b2e6c13a9b8a29af9347..169f18fbdd5242973893e947282bd412eef26170 100644 (file)
@@ -33,7 +33,7 @@ class ShipSimuLoginHelper extends BaseLoginHelper implements HelpableLogin {
        /**
         * The login method we shall choose
         */
-       private $loginMethod = "";
+       private $authMethod = "";
 
        /**
         * Instance for a request class
@@ -41,7 +41,7 @@ class ShipSimuLoginHelper extends BaseLoginHelper implements HelpableLogin {
        private $requestInstance = null;
 
        // Exception constants
-       const EXCEPTION_INVALID_USER_INSTANCE = 0xf00;
+       const EXCEPTION_INVALID_USER_INSTANCE = 0x080;
 
        /**
         * Protected constructor
@@ -80,23 +80,8 @@ class ShipSimuLoginHelper extends BaseLoginHelper implements HelpableLogin {
                        throw new UserInstanceMissingException (array($helperInstance, 'user'), self::EXCEPTION_INVALID_USER_INSTANCE);
                } // END - if
 
-               // Get the login method from request
-               $methodRequest = $requestInstance->getRequestElement('login_method');
-
-               // Now, if that wents fine we can check if the request includes a login method entry
-               if ((!is_null($methodRequest)) && ($methodRequest != "default") && ($methodRequest != $userInstance->getLoginMethod())) {
-                       // Okay, the login method has been choosen by user so remember it
-                       $helperInstance->setLoginMethod($methodRequest);
-
-                       // Remeber that we need to update the user account as well
-                       $userInstance->addUpdateData('login_method', $methodRequest);
-               } elseif (($methodRequest == "default") && (is_string($userInstance->getLoginMethod()))) {
-                       // Choose default method from user
-                       $helperInstance->setLoginMethod($userInstance->getLoginMethod());
-               } else {
-                       // Set default login method from config
-                       $helperInstance->setDefaultLoginMethod();
-               }
+               // Set default login method from config
+               $helperInstance->setDefaultAuthMethod();
 
                // Set request instance
                $helperInstance->setRequestInstance($requestInstance);
@@ -110,8 +95,8 @@ class ShipSimuLoginHelper extends BaseLoginHelper implements HelpableLogin {
         *
         * @return      void
         */
-       protected function setDefaultLoginMethod () {
-               $this->loginMethod = $this->getConfigInstance()->readConfig('login_method');
+       protected function setDefaultAuthMethod () {
+               $this->authMethod = $this->getConfigInstance()->readConfig('auth_method_class');
        }
 
        /**
@@ -142,11 +127,8 @@ class ShipSimuLoginHelper extends BaseLoginHelper implements HelpableLogin {
         * @return      void
         */
        public function executeLogin (Responseable $responseInstance) {
-               // First create the requested login method name
-               $loginMethodClass = ucfirst(strtolower($this->loginMethod)) . "Login";
-
-               // Then try to get an instance from it
-               $loginInstance = ObjectFactory::createObjectByName($loginMethodClass, array($responseInstance));
+               // Get an instance from the login method
+               $loginInstance = ObjectFactory::createObjectByName($this->authMethod, array($responseInstance));
 
                // Set user cookie
                $loginInstance->setUserAuth($this->requestInstance->getRequestElement('username'));
index 0a8563cd10c5754e8cb3536e65264e0a0e898e73..aae55e7f86a83325d82f1f4795d6421f95680f32 100644 (file)
@@ -93,7 +93,7 @@ class ShipSimuRegistration extends BaseRegistration {
                        // 1.: Get the plain password
                        $plainPassword = $this->getRequestInstance()->getRequestElement($requestKey);
                        // 2. Get a crypto helper and hash the password
-                       $this->hashedPassword = ObjectFactory::createObjectByConfiguredName('crypto_heler')->hashPassword($plainPassword);
+                       $this->hashedPassword = ObjectFactory::createObjectByConfiguredName('crypto_class')->hashPassword($plainPassword);
                        // 3. Store the hash back in the request
                        $this->getRequestInstance()->setRequestElement('pass_hash', $this->hashedPassword);
                }
@@ -118,7 +118,7 @@ class ShipSimuRegistration extends BaseRegistration {
         */
        public function registerNewUser () {
                // Get a user database wrapper
-               $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_db_wrapper');
+               $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_db_wrapper_class');
 
                // Use this instance to insert the whole registration instance
                $wrapperInstance->insertRegistrationObject($this);
@@ -143,7 +143,7 @@ class ShipSimuRegistration extends BaseRegistration {
         */
        public function doPostAction () {
                // Get an action instance from our factory
-               $actionInstance = ObjectFactory::createObjectByConfiguredName('post_registration_action');
+               $actionInstance = ObjectFactory::createObjectByConfiguredName('post_registration_class');
 
                // Execute the action
                $actionInstance->execute($this->getRequestInstance(), $this->getResponseInstance());
index 4bcbd4ac5a3a36cd023ac87111b50fa029617844..fcd9855cc5bdf85462c72b2c1360af6d1b213627 100644 (file)
@@ -51,7 +51,7 @@ try {
        // Call user function
        call_user_func_array(array($app, FrameworkConfiguration::getInstance()->readConfig('entry_method')), array());
 } catch (FrameworkException  $e) {
-       ApplicationEntryPoint::app_die(sprintf("[Main:] The application <strong>%s</strong> could not be launched for the follwing reason: <strong>%s</strong>",
+       ApplicationEntryPoint::app_die(sprintf("[Main:] The application <strong>%s</strong> has been terminated due to a thrown exception: <strong>%s</strong>",
                $application,
                $e->getMessage()
        ));
diff --git a/inc/classes/exceptions/auth/.htaccess b/inc/classes/exceptions/auth/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/classes/exceptions/auth/class_UserAuthorizationException.php b/inc/classes/exceptions/auth/class_UserAuthorizationException.php
new file mode 100644 (file)
index 0000000..5fedd40
--- /dev/null
@@ -0,0 +1,46 @@
+<?php
+/**
+ * 
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+class UserAuthorizationException extends FrameworkException {
+       /**
+        * The super constructor for all exceptions
+        *
+        * @param               $filterInstance         An instance of the filter throwing this exception
+        * @param               $code                           Error code
+        * @return      void
+        */
+       public function __construct(Filterable $filterInstance, $code) {
+               // Construct the message
+               $message = sprintf("[%s:%d] Authorization has failed. Error code <u>%s</u>",
+                       $filterInstance->__toString(),
+                       $this->getLine(),
+                       $this->getHexCode($code)
+               );
+
+               // Call parent exception constructor
+               parent::__construct($message, $code);
+       }
+}
+
+// [EOF]
+?>
diff --git a/inc/classes/exceptions/class_ b/inc/classes/exceptions/class_
new file mode 100644 (file)
index 0000000..3001d84
--- /dev/null
@@ -0,0 +1,39 @@
+<?php
+/**
+ * 
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+class ???Exception extends FrameworkException {
+       /**
+        * The super constructor for all exceptions
+        *
+        * @param               $message        Error message
+        * @param               $code           Error code
+        * @return      void
+        */
+       public function __construct($message, $code) {
+               // Call parent exception constructor
+               parent::__construct($message, $code);
+       }
+}
+
+// [EOF]
+?>
index b7f1c5bb2d1948a2b3764a0a38af9502cd4ce7de..2c403966037f736c9be75a5e2a37870ee8a6f04f 100644 (file)
@@ -44,7 +44,7 @@ abstract class FrameworkException extends ReflectionException {
                $message = (string) $message;
                $code    = (int)    $code;
 
-               // make sure everything is assigned properly
+               // Make sure everything is assigned properly
                parent::__construct($message, $code);
        }
 
@@ -78,11 +78,12 @@ abstract class FrameworkException extends ReflectionException {
        /**
         * Getter for hex-decimal code
         *
+        * @param       $code           Integer code to encode in hex
         * @return      $hexCode        The exception code in hex-decimal format
         */
-       public final function getHexCode () {
+       public final function getHexCode ($code = null) {
                // Get the decimal code
-               $code = $this->getCode();
+               if (is_null($code)) $code = $this->getCode();
 
                // Format it to hex-decimal, 0x as prefix and 3 chars
                $hexCode = sprintf("0x%03s", dechex($code));
diff --git a/inc/classes/exceptions/filter/.htaccess b/inc/classes/exceptions/filter/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/classes/exceptions/filter/class_FilterChainException.php b/inc/classes/exceptions/filter/class_FilterChainException.php
new file mode 100644 (file)
index 0000000..e1bfe10
--- /dev/null
@@ -0,0 +1,45 @@
+<?php
+/**
+ * An exception thrown in a filter chain to stop processing further filters
+ *
+ * @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 FilterChainException extends FrameworkException {
+       /**
+        * The super constructor for all exceptions
+        *
+        * @param               $filterInstance         Instance of a filter class
+        * @param               $code                           Exception code for better debugging
+        * @return      void
+        */
+       public function __construct(Filterable $filterInstance, $code) {
+               // Construct the message
+               $message = sprintf("[%s:%d] Filter chain interruppted by fatal error in filter.",
+                       $filterInstance->__toString(),
+                       $this->getLine()
+               );
+
+               // Call the parent exception
+               parent::__construct($message, $code);
+       }
+}
+
+// [EOF]
+?>
diff --git a/inc/classes/interfaces/auth/.htaccess b/inc/classes/interfaces/auth/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/classes/interfaces/auth/class_Authorizeable.php b/inc/classes/interfaces/auth/class_Authorizeable.php
new file mode 100644 (file)
index 0000000..88e383f
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+/**
+ * An interface for authorization methods
+ *
+ * @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/>.
+ */
+interface Authorizeable extends FrameworkInterface {
+       /**
+        * Destroy the authorization data
+        *
+        * @return      void
+        */
+       function destroyAuthData();
+}
+
+//
+?>
diff --git a/inc/classes/interfaces/reader/.htaccess b/inc/classes/interfaces/reader/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/classes/interfaces/reader/class_ReadableNews.php b/inc/classes/interfaces/reader/class_ReadableNews.php
new file mode 100644 (file)
index 0000000..c38b702
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+/**
+ * An interface for news reader
+ *
+ * @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/>.
+ */
+interface ReadableNews extends FrameworkInterface {
+       /**
+        * Initializes the news reader class. This is very reader-dependent
+        *
+        * @return      void
+        */
+       function initializeReader();
+}
+
+//
+?>
index 41f4564b314158e6c6e3fa2c0eca23d4d955b27b..1c3d092507be464a067c9a19a0f7fc0886c4c7b0 100644 (file)
@@ -70,6 +70,14 @@ interface Requestable extends FrameworkInterface {
         * @return      void
         */
        function requestIsValid ($isValid = true);
+
+       /**
+        * Reads a cookie and returns it's value or null if not found
+        *
+        * @param       $cookieName             Name of cookie we shall read
+        * @return      $cookieValue    Value of cookie or null if not found
+        */
+       function readCookie ($cookieName);
 }
 
 //
index 5fd6b50cc4a613fc6f9c7b75fefbe8065fabde7d..a1fabde81d9b02364c040ec7fdbf6f860b3d6a9b 100644 (file)
@@ -87,6 +87,14 @@ interface Responseable extends FrameworkInterface {
         * @throws      ResponseHeadersAlreadySentException             If headers are already sent
         */
        function redirectToConfiguredUrl ($configEntry);
+
+       /**
+        * Expires the given cookie if it is set
+        *
+        * @param       $cookieName             Cookie to expire
+        * @return      void
+        */
+       function expireCookie ($cookieName);
 }
 
 //
index 63c4450fa817a693dd960ca60e47aa0af3ed3d8f..c5f1e8a02ff4480fbece3a9479ef4f065d73acfa 100644 (file)
@@ -60,7 +60,7 @@ class LoginAfterRegistrationAction extends BaseAction implements Commandable {
         */
        public function execute (Requestable $requestInstance, Responseable $responseInstance) {
                // Get a login class from factory
-               $loginInstance = ObjectFactory::createObjectByConfiguredName('login_user');
+               $loginInstance = ObjectFactory::createObjectByConfiguredName('user_login_class');
 
                // Login the user by the request instance
                $loginInstance->doLogin($requestInstance, $responseInstance);
diff --git a/inc/classes/main/auth/.htaccess b/inc/classes/main/auth/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/classes/main/auth/class_CookieAuth.php b/inc/classes/main/auth/class_CookieAuth.php
new file mode 100644 (file)
index 0000000..6b1bf3f
--- /dev/null
@@ -0,0 +1,121 @@
+<?php
+/**
+ * A cookie-bases authorization class
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+class CookieAuth extends BaseFrameworkSystem implements Authorizeable, Registerable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Set part description
+               $this->setObjectDescription("Cookie-based login");
+
+               // Create unique ID number
+               $this->generateUniqueId();
+
+               // Clean up a little
+               $this->removeNumberFormaters();
+               $this->removeSystemArray();
+       }
+
+       /**
+        * Creates an instance of this class by the given response instance
+        *
+        * @param       $responseInstance       An instance of a Responseable class
+        * @return      $loginInstance          An instance of this login class
+        */
+       public final static function createCookieAuth (Responseable $responseInstance) {
+               // Get a new instance
+               $loginInstance = new CookieAuth();
+
+               // Set the response instance
+               $loginInstance->setResponseInstance($responseInstance);
+
+               // Return the prepared instance
+               return $loginInstance;
+       }
+
+       /**
+        * "Setter" for username auth data
+        *
+        * @param       $userName       The username from request we shall set
+        * @return      void
+        */
+       public function setUserAuth ($userName) {
+               $this->getResponseInstance()->addCookie('username', $userName);
+       }
+
+       /**
+        * "Setter" for password hash auth data
+        *
+        * @param       $passHash       The hashed password from request we shall set
+        * @return      void
+        */
+       public function setPasswordAuth ($passHash) {
+               $this->getResponseInstance()->addCookie('u_hash', $passHash, true);
+       }
+
+       /**
+        * Getter for user auth cookie
+        *
+        * @return      $userName       Username to get from cookie
+        */
+       public function getUserAuth () {
+               // Get the username from cookie
+               $userName = $this->getRequestInstance()->readCookie('username');
+
+               // Return the username
+               return $userName;
+       }
+
+       /**
+        * Getter for password hash auth cookie
+        *
+        * @return      $passHash       Password hash to get from cookie
+        */
+       public function getPasswordAuth () {
+               // Get the username from cookie
+               $passHash = $this->getRequestInstance()->readCookie('u_hash');
+
+               // Return the username
+               return $passHash;
+       }
+
+       /**
+        * Destroy the authorization data
+        *
+        * @return      void
+        */
+       public function destroyAuthData () {
+               // Expire both cookies
+               $this->getResponseInstance()->expireCookie('username');
+               $this->getResponseInstance()->expireCookie('u_hash');
+       }
+}
+
+// [EOF]
+?>
index d8d095f06ac7e9957055aa95d0dfc0e199485559..3484a4eb5a9dc5724e37525bfe81954e230114a0 100644 (file)
@@ -32,6 +32,15 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         * The language instance for the template loader
         */
        private static $langInstance = null;
+       /**
+        * Instance of a request class
+        */
+       private $requestInstance = null;
+
+       /**
+        * Instance of a response class
+        */
+       private $responseInstance = null;
 
        /**
         * The real class name
@@ -267,7 +276,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                        $this->systemclasses[] = $this->getConfigInstance()->readConfig('app_helper_class');
 
                        // Set debug instance
-                       $this->setDebugInstance(DebugMiddleware::createDebugMiddleware($this->getConfigInstance()->readConfig('debug_engine')));
+                       $this->setDebugInstance(DebugMiddleware::createDebugMiddleware($this->getConfigInstance()->readConfig('debug_class')));
 
                        // Get output instance and set it
                        $outputInstance = ObjectFactory::createObjectByConfiguredName('web_engine', array($this->getConfigInstance()->readConfig('web_content_type')));
@@ -407,6 +416,44 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                self::$applicationInstance = $applicationInstance;
        }
 
+       /**
+        * Setter for request instance
+        *
+        * @param       $requestInstance        An instance of a Requestable class
+        * @return      void
+        */
+       public final function setRequestInstance (Requestable $requestInstance) {
+               $this->requestInstance = $requestInstance;
+       }
+
+       /**
+        * Getter for request instance
+        *
+        * @return      $requestInstance        An instance of a Requestable class
+        */
+       public final function getRequestInstance () {
+               return $this->requestInstance;
+       }
+
+       /**
+        * Setter for response instance
+        *
+        * @param       $responseInstance       An instance of a Responseable class
+        * @return      void
+        */
+       public final function setResponseInstance (Responseable $responseInstance) {
+               $this->responseInstance = $responseInstance;
+       }
+
+       /**
+        * Getter for response instance
+        *
+        * @return      $responseInstance       An instance of a Responseable class
+        */
+       public final function getResponseInstance () {
+               return $this->responseInstance;
+       }
+
        /**
         * Getter for $realClass
         *
@@ -821,7 +868,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                }
 
                // Initialize the template engine
-               $tplEngine = ObjectFactory::createObjectByConfiguredName('tpl_engine', array($fqfn, $appInstance->getLanguageInstance(), $appInstance->getFileIoInstance()));
+               $tplEngine = ObjectFactory::createObjectByConfiguredName('template_class', array($fqfn, $appInstance->getLanguageInstance(), $appInstance->getFileIoInstance()));
 
                // Return the prepared instance
                return $tplEngine;
@@ -886,10 +933,19 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         * @return      $className      Generated class name
         */
        public function convertToClassName ($str) {
+               // Init class name
                $className = "";
+
+               // Convert all dashes in underscores
+               $str = str_replace("-", "_", $str);
+
+               // Now use that underscores to get classname parts for hungarian style
                foreach (explode("_", $str) as $strPart) {
+                       // Make the class name part lower case and first upper case
                        $className .= ucfirst(strtolower($strPart));
-               }
+               } // END - foreach
+
+               // Return class name
                return $className;
        }
 
index da423e95265a5b86fffdaa9da05ea6c9f7f52165..d5f45ec598d9ab404eb4048ad41e4896bf862a03 100644 (file)
@@ -66,8 +66,6 @@ class WebLoginAreaCommand extends BaseCommand implements Commandable {
         * @return      void
         */
        public function execute (Requestable $requestInstance, Responseable $responseInstance) {
-               // TODO Add basic check on authorization data here
-
                // Default action is the one from configuration
                $action = sprintf("login_%s", $this->getConfigInstance()->readConfig('login_default_action'));
 
index 409ded2b9eba7a60ee8893b1818947fce167013b..4438cc216e60f0d61f44da6ed10b1928b31028c8 100644 (file)
@@ -53,8 +53,8 @@ class BaseController extends BaseFrameworkSystem {
                $this->removeSystemArray();
 
                // Initialize both filter chains
-               $this->preFilterChain  = ObjectFactory::createObjectByConfiguredName('filter_chain');
-               $this->postFilterChain = ObjectFactory::createObjectByConfiguredName('filter_chain');
+               $this->preFilterChain  = ObjectFactory::createObjectByConfiguredName('filter_chain_class');
+               $this->postFilterChain = ObjectFactory::createObjectByConfiguredName('filter_chain_class');
        }
 
        /**
index 326c0b00bce91ea26f80cb8574aa987aa3190cb5..fee2d39f00034c55f50e7b8828cfb8173245b919 100644 (file)
@@ -51,6 +51,10 @@ class WebDefaultNewsController extends BaseController implements Controller {
                // Set the command resolver
                $controllerInstance->setResolverInstance($resolverInstance);
 
+               // Add news filters to this controller
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_download_class'));
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_process_class'));
+
                // Return the prepared instance
                return $controllerInstance;
        }
@@ -63,32 +67,24 @@ class WebDefaultNewsController extends BaseController implements Controller {
         * @return      void
         */
        public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) {
+               // Run the pre filters
+               $this->executePreFilters($requestInstance, $responseInstance);
+
                // Get the command instance from the resolver by sending a request instance to the resolver
                $commandInstance = $this->getResolverInstance()->resolvCommandByRequest($requestInstance);
 
-               // Load the news here
-               $this->loadNewsByRequest($requestInstance);
-
                // This request was valid! :-D
                $requestInstance->requestIsValid();
 
                // Execute the command
                $commandInstance->execute($requestInstance, $responseInstance);
 
+               // Run the pre filters
+               $this->executePostFilters($requestInstance, $responseInstance);
+
                // Flush the response out
                $responseInstance->flushBuffer();
        }
-
-       /**
-        * Loads news by a given request
-        *
-        * @param       $requestInstance        An instance of a request class
-        * @return      void
-        */
-       private function loadNewsByRequest (Requestable $requestInstance) {
-               // Generate a new news object but not carring about which concrete we have
-               $newsInstance = WebNewsFactory::createFactoryByRequest($requestInstance)->createNewsObject();
-       }
 }
 
 // [EOF]
diff --git a/inc/classes/main/controller/login/.htaccess b/inc/classes/main/controller/login/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/classes/main/controller/login/class_WebLoginAreaController.php b/inc/classes/main/controller/login/class_WebLoginAreaController.php
new file mode 100644 (file)
index 0000000..34893a1
--- /dev/null
@@ -0,0 +1,92 @@
+<?php
+/**
+ * Controller for login area with news
+ *
+ * @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 WebLoginAreaController extends BaseController implements Controller {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Set part description
+               $this->setObjectDescription("Default controller with news");
+
+               // Create unique ID number
+               $this->generateUniqueId();
+       }
+
+       /**
+        * Creates an instance of this class
+        *
+        * @param       $resolverInstance               An instance of a command resolver class
+        * @return      $controllerInstance             A prepared instance of this class
+        */
+       public final static function createWebLoginAreaController (CommandResolver $resolverInstance) {
+               // Create the instance
+               $controllerInstance = new WebLoginAreaController();
+
+               // Set the command resolver
+               $controllerInstance->setResolverInstance($resolverInstance);
+
+               // Add some filters to this controller
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_auth_class'));
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_download_class'));
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_process_class'));
+
+               // Return the prepared instance
+               return $controllerInstance;
+       }
+
+       /**
+        * Handles the given request and response
+        *
+        * @param       $requestInstance        An instance of a request class
+        * @param       $responseInstance       An instance of a response class
+        * @return      void
+        */
+       public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) {
+               // Run the pre filters
+               $this->executePreFilters($requestInstance, $responseInstance);
+
+               // Get the command instance from the resolver by sending a request instance to the resolver
+               $commandInstance = $this->getResolverInstance()->resolvCommandByRequest($requestInstance);
+
+               // This request was valid! :-D
+               $requestInstance->requestIsValid();
+
+               // Execute the command
+               $commandInstance->execute($requestInstance, $responseInstance);
+
+               // Run the pre filters
+               $this->executePostFilters($requestInstance, $responseInstance);
+
+               // Flush the response out
+               $responseInstance->flushBuffer();
+       }
+}
+
+// [EOF]
+?>
index dc54e77ffdc5b27427b528358e2155d88ef36075..2d2e04bdcf87a4ab38c9844f3483f59304f1ce27 100644 (file)
@@ -24,7 +24,7 @@
  */
 abstract class BaseDatabaseFrontend extends BaseFrameworkSystem implements DatabaseFrontendInterface, LimitableObject {
        // Constants for exceptions
-       const EXCEPTION_SQL_QUERY = 0xc00;
+       const EXCEPTION_SQL_QUERY = 0x050;
 
        /**
         * The limiter instance
index f599673a400e259ce5865038ff492b8336f12a32..220ad14d2888bdb84e28054e84aff41e455f5d04 100644 (file)
@@ -26,8 +26,8 @@
 class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontendInterface {
 
        // Constants for MySQL backward-compatiblity (PLEASE FIX THEM!)
-       const DB_CODE_TABLE_MISSING     = 0x000;
-       const DB_CODE_TABLE_UNWRITEABLE = 0x001;
+       const DB_CODE_TABLE_MISSING     = 0x010;
+       const DB_CODE_TABLE_UNWRITEABLE = 0x011;
 
        /**
         * Save path for "file database"
index cd6fa214ad57590943672219ca59c68553743f08..5fc62e2a836a0a2fd32fb9ea2d8bcf6d676d0711 100644 (file)
@@ -29,7 +29,7 @@ class UserDatabaseWrapper extends BaseDatabaseWrapper {
        private $cacheInstance = null;
 
        // Constants for exceptions
-       const EXCEPTION_CLIENT_USERNAME_NOT_FOUND = 0xe00;
+       const EXCEPTION_CLIENT_USERNAME_NOT_FOUND = 0x070;
 
        // Constants for database columns
        const DB_COLUMN_USERNAME = "username";
@@ -132,7 +132,7 @@ class UserDatabaseWrapper extends BaseDatabaseWrapper {
         */
        public function insertRegistrationObject (UserRegister $registrationInstance) {
                // Generate a data set for the request
-               $dataSetInstance = ObjectFactory::createObjectByConfiguredName('dataset_criteria');
+               $dataSetInstance = ObjectFactory::createObjectByConfiguredName('dataset_criteria_class');
                $dataSetInstance->setTableName(self::DB_TABLE_USER);
 
                // Add registration elements to the dataset
index 48f83383fe8b7e22213447c9b2cd645235b2fc47..e2cb7bce35571fc18604c469a8c6180758272f7a 100644 (file)
@@ -66,7 +66,7 @@ class CacheFactory extends BaseFactory {
         */
        public function createConfiguredCache () {
                // Read the config entry
-               $cacheType = $this->getConfigInstance()->readConfig("cache_type");
+               $cacheType = $this->getConfigInstance()->readConfig("cache_class");
 
                // And get a new instance
                $cacheInstance = ObjectFactory::createObjectByName($cacheType);
index 024020d6d4782d93e9063712e7715c34da869537..9a2ec9c2d2c9958191c6af7bf2a415dc0e39e255 100644 (file)
@@ -55,14 +55,17 @@ class ObjectFactory extends BaseFactory {
         * @throws      EmptyVariableException  If a variable is empty unexpectly
         */
        public final static function createObjectByName ($className, array $args=array()) {
-               // First get an instance of this factory
-               $factoryInstance = new ObjectFactory();
-
                // Is the class name valid and is the class there?
                if (empty($className)) {
+                       // First get an instance of this factory
+                       $factoryInstance = new ObjectFactory();
+
                        // Throw an exception here
                        throw new EmptyVariableException(array($factoryInstance, 'className'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
                } elseif (!class_exists($className)) {
+                       // First get an instance of this factory
+                       $factoryInstance = new ObjectFactory();
+
                        // Then throw an exception
                        throw new ClassNotFoundException(array($factoryInstance, $className), self::EXCEPTION_CLASS_NOT_FOUND);
                }
index ecd1f286422f9f38294e25dbac5848da3f3d1a1b..dfbb6db85f26b04d14187a21182792a387c2f42d 100644 (file)
@@ -51,67 +51,16 @@ class WebNewsFactory extends BaseFactory {
         * @return      $factoryInstance        An instance of a WebNewsFactory class
         */
        public final static function createFactoryByRequest (Requestable $requestInstance) {
-               // Generate the new instance
-               $factoryInstance = new WebNewsFactory();
-
-               // 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();
+               // Get the news reader class name from config
+               $className = $requestInstance->getConfigInstance()->readConfig('news_reader_class');
 
                // Once we have that name, try to load initialize it
-               $realFactoryInstance = ObjectFactory::createObjectByName($className);
-
-               // And assign it with the factory
-               $factoryInstance->setRealFactoryInstance($realFactoryInstance);
+               $newsInstance = ObjectFactory::createObjectByName($className, array($requestInstance));
 
-               // Remember the request we have used for later usage
-               $factoryInstance->setRequestInstance($requestInstance);
+               // Initialize the reader
+               $newsInstance->initializeReader();
 
                // 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;
        }
 }
diff --git a/inc/classes/main/filter/auth/.htaccess b/inc/classes/main/filter/auth/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/classes/main/filter/auth/class_UserAuthFilter.php b/inc/classes/main/filter/auth/class_UserAuthFilter.php
new file mode 100644 (file)
index 0000000..5754bf1
--- /dev/null
@@ -0,0 +1,114 @@
+<?php
+/**
+ * A filter for checking user permissions
+ *
+ * @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 UserAuthFilter extends BaseFilter implements Filterable {
+       // Exception constants
+       const EXCEPTION_AUTH_DATA_INVALID = 0x0a0;
+
+       /**
+        * The login method we shall choose
+        */
+       private $authMethod = "";
+
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Set part description
+               $this->setObjectDescription("A user authorization filter");
+
+               // Create unique ID number
+               $this->generateUniqueId();
+       }
+
+       /**
+        * Creates an instance of this filter class
+        *
+        * @return      $filterInstance         An instance of this filter class
+        */
+       public final static function createUserAuthFilter () {
+               // Get a new instance
+               $filterInstance = new UserAuthFilter();
+
+               // Set default auth method
+               $filterInstance->setDefaultAuthMethod();
+
+               // Return the instance
+               return $filterInstance;
+       }
+
+       /**
+        * Setter for default login method from config
+        *
+        * @return      void
+        */
+       protected function setDefaultAuthMethod () {
+               $this->authMethod = $this->getConfigInstance()->readConfig('auth_method_class');
+       }
+
+       /**
+        * Executes the filter 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
+        * @throws      UserAuthorizationException      If the auth login was not found or if it was invalid
+        */
+       public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+               // Then get an auth instance for checking and updating the auth cookies
+               $authInstance = ObjectFactory::createObjectByName($this->authMethod, array($responseInstance));
+
+               // Set request instance
+               $authInstance->setRequestInstance($requestInstance);
+
+               // Now, get the auth data for comparison
+               $authLogin = $authInstance->getUserAuth();
+               $authHash  = $authInstance->getPasswordAuth();
+
+               // If one is empty stop here
+               if ((empty($authLogin)) || (empty($authHash))) {
+                       // Destroy the auth data
+                       $authInstance->destroyAuthData();
+
+                       // Mark the request as invalid
+                       $requestInstance->requestIsValid(false);
+
+                       // Add fatal message
+                       $responseInstance->addFatalMessage('auth_data_incomplete');
+
+                       // Stop here
+                       throw new UserAuthorizationException($this, self::EXCEPTION_AUTH_DATA_INVALID);
+               }
+
+               // Destroy safely the auth instance
+               unset($authInstance);
+       }
+}
+
+// [EOF]
+?>
index 3029dcee64c559460175239cd023ace84dd708a0..d52c6aa6ac639c9e1eedd85dd8817c22be3bf698 100644 (file)
@@ -23,7 +23,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 RulesAcceptedFilter extends BaseFrameworkSystem implements Filterable {
+class RulesAcceptedFilter extends BaseFilter implements Filterable {
        /**
         * Protected constructor
         *
@@ -38,10 +38,6 @@ class RulesAcceptedFilter extends BaseFrameworkSystem implements Filterable {
 
                // Create unique ID number
                $this->generateUniqueId();
-
-               // Clean up a little
-               $this->removeNumberFormaters();
-               $this->removeSystemArray();
        }
 
        /**
@@ -76,7 +72,7 @@ class RulesAcceptedFilter extends BaseFrameworkSystem implements Filterable {
                        // Add a message to the response
                        $responseInstance->addFatalMessage('rules_unchecked');
 
-                       // Abort here
+                       // Skip further processing
                        return false;
                }
        }
diff --git a/inc/classes/main/filter/class_BaseFilter.php b/inc/classes/main/filter/class_BaseFilter.php
new file mode 100644 (file)
index 0000000..3800c49
--- /dev/null
@@ -0,0 +1,45 @@
+<?php
+/**
+ * A general filter class
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class BaseFilter extends BaseFrameworkSystem {
+       // Exception constants
+       const EXCEPTION_FILTER_CHAIN_ABORTED = 0x090;
+
+       /**
+        * Protected constructor
+        *
+        * @param       $className      Name of the filter class
+        * @return      void
+        */
+       protected function __construct ($className) {
+               // Call parent constructor
+               parent::__construct($className);
+
+               // Clean up a little
+               $this->removeNumberFormaters();
+               $this->removeSystemArray();
+       }
+}
+
+// [EOF]
+?>
index fa1f8f42112f095634f1e98c9e809012a3f5f467..7004eb50f4563d5e56639dcabdcfffcab7f20daf 100644 (file)
@@ -81,11 +81,16 @@ class FilterChain extends BaseFrameworkSystem {
                // Run all filters
                //* DEBUG */ echo "COUNT=".count($this->filters)."<br />\n";
                foreach ($this->filters as $filterInstance) {
-                       // Execute this filter
-                       //* DEBUG */ echo "FILTER: ".$filterInstance->__toString().": Processing started.<br />\n";
+                       // Try to execute this filter
+                       try {
+                               //* DEBUG */ echo "FILTER: ".$filterInstance->__toString().": Processing started.<br />\n";
                                $filterInstance->execute($requestInstance, $responseInstance);
-                       //* DEBUG */ echo "FILTER: ".$filterInstance->__toString().": Processing ended.<br />\n";
-               }
+                               //* DEBUG */ echo "FILTER: ".$filterInstance->__toString().": Processing ended.<br />\n";
+                       } catch (FilterChainException $e) {
+                               // This exception can be thrown to just skip any further processing
+                               break;
+                       }
+               } // END - foreach
        }
 }
 
diff --git a/inc/classes/main/filter/news/.htaccess b/inc/classes/main/filter/news/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/classes/main/filter/news/class_NewsDownloadFilter.php b/inc/classes/main/filter/news/class_NewsDownloadFilter.php
new file mode 100644 (file)
index 0000000..e3a1881
--- /dev/null
@@ -0,0 +1,73 @@
+<?php
+/**
+ * A pre-filter for downloading news from a source. This can be a XML feed or
+ * the local database. You *can* register this filter as post filter but for
+ * output on web pages it makes no sense.
+ *
+ * @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 NewsDownloadFilter extends BaseFilter implements Filterable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Set part description
+               $this->setObjectDescription("A filter for downloading news");
+
+               // Create unique ID number
+               $this->generateUniqueId();
+       }
+
+       /**
+        * Creates an instance of this filter class
+        *
+        * @return      $filterInstance         An instance of this filter class
+        */
+       public final static function createNewsDownloadFilter () {
+               // Get a new instance
+               $filterInstance = new NewsDownloadFilter();
+
+               // Return the instance
+               return $filterInstance;
+       }
+
+       /**
+        * Executes the filter with given request and response objects
+        *
+        * @param       $requestInstance        An instance of a class with an Requestable interface
+        * @param       $responseInstance       An instance of a class with an Responseable interface
+        * @return      void
+        */
+       public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+               // Get a news instance
+               $newsInstance = WebNewsFactory::createFactoryByRequest($requestInstance);
+
+               // TODO Need to extend/rewrite this
+               $this->partialStub("Unfinished work.");
+       }
+}
+
+// [EOF]
+?>
diff --git a/inc/classes/main/filter/news/class_NewsProcessFilter.php b/inc/classes/main/filter/news/class_NewsProcessFilter.php
new file mode 100644 (file)
index 0000000..8df6a0f
--- /dev/null
@@ -0,0 +1,68 @@
+<?php
+/**
+ * A post-filter for processing downloaded news. This will prepare the news fir
+ * output to the template engine.
+ *
+ * @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 NewsProcessFilter extends BaseFilter implements Filterable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Set part description
+               $this->setObjectDescription("A filter for processing news");
+
+               // Create unique ID number
+               $this->generateUniqueId();
+       }
+
+       /**
+        * Creates an instance of this filter class
+        *
+        * @return      $filterInstance         An instance of this filter class
+        */
+       public final static function createNewsProcessFilter () {
+               // Get a new instance
+               $filterInstance = new NewsProcessFilter();
+
+               // Return the instance
+               return $filterInstance;
+       }
+
+       /**
+        * Executes the filter with given request and response objects
+        *
+        * @param       $requestInstance        An instance of a class with an Requestable interface
+        * @param       $responseInstance       An instance of a class with an Responseable interface
+        * @return      void
+        */
+       public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+               $this->partialStub("Unfinished work.");
+       }
+}
+
+// [EOF]
+?>
index 3ac6d34ac97fd2f8fc2acecb7873d233469b03f5..ef9c70c3fd2ce8d7c527ed8d87e98e51a714091d 100644 (file)
@@ -22,7 +22,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 NullFilter extends BaseFrameworkSystem implements Filterable {
+class NullFilter extends BaseFilter implements Filterable {
        /**
         * Protected constructor
         *
@@ -37,10 +37,6 @@ class NullFilter extends BaseFrameworkSystem implements Filterable {
 
                // Create unique ID number
                $this->generateUniqueId();
-
-               // Clean up a little
-               $this->removeNumberFormaters();
-               $this->removeSystemArray();
        }
 
        /**
index a1276c88a3204b4c10c46f50a3095ad66ff5ef84..4785a9653cbff6eb5df1efa0653894729b01c467 100644 (file)
@@ -24,7 +24,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 EmailValidatorFilter extends BaseFrameworkSystem implements Filterable {
+class EmailValidatorFilter extends BaseFilter implements Filterable {
        /**
         * Protected constructor
         *
@@ -39,10 +39,6 @@ class EmailValidatorFilter extends BaseFrameworkSystem implements Filterable {
 
                // Create unique ID number
                $this->generateUniqueId();
-
-               // Clean up a little
-               $this->removeNumberFormaters();
-               $this->removeSystemArray();
        }
 
        /**
index a8369d819088c995cdd98bd99a60e91da7ec8b70..1d371b1e82d14e7e31485b09d54fa5ce04503f67 100644 (file)
@@ -22,7 +22,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 PasswordValidatorFilter extends BaseFrameworkSystem implements Filterable {
+class PasswordValidatorFilter extends BaseFilter implements Filterable {
        /**
         * Protected constructor
         *
@@ -37,10 +37,6 @@ class PasswordValidatorFilter extends BaseFrameworkSystem implements Filterable
 
                // Create unique ID number
                $this->generateUniqueId();
-
-               // Clean up a little
-               $this->removeNumberFormaters();
-               $this->removeSystemArray();
        }
 
        /**
index 068f807754892d010b16ac14b559d5b47ef792b4..456f16a40c0933e68c3f67b49914e6d5876d59e2 100644 (file)
@@ -24,7 +24,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 UserNameValidatorFilter extends BaseFrameworkSystem implements Filterable {
+class UserNameValidatorFilter extends BaseFilter implements Filterable {
        /**
         * Protected constructor
         *
@@ -39,10 +39,6 @@ class UserNameValidatorFilter extends BaseFrameworkSystem implements Filterable
 
                // Create unique ID number
                $this->generateUniqueId();
-
-               // Clean up a little
-               $this->removeNumberFormaters();
-               $this->removeSystemArray();
        }
 
        /**
index 718ed77871ff0d8ee98c0adcd374692554be56f5..61a62434792800f2a23b179c96893868feacd3c9 100644 (file)
@@ -49,10 +49,10 @@ class WebFormHelper extends BaseHelper {
        private $subGroupName = "";
 
        // Class Constants
-       const EXCEPTION_FORM_NAME_INVALID       = 0xb00;
-       const EXCEPTION_CLOSED_FORM             = 0xb01;
-       const EXCEPTION_OPENED_FORM             = 0xb02;
-       const EXCEPTION_UNEXPECTED_CLOSED_GROUP = 0xb03;
+       const EXCEPTION_FORM_NAME_INVALID       = 0x030;
+       const EXCEPTION_CLOSED_FORM             = 0x031;
+       const EXCEPTION_OPENED_FORM             = 0x032;
+       const EXCEPTION_UNEXPECTED_CLOSED_GROUP = 0x033;
 
        /**
         * Protected constructor
diff --git a/inc/classes/main/login/.htaccess b/inc/classes/main/login/.htaccess
deleted file mode 100644 (file)
index 3a42882..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Deny from all
diff --git a/inc/classes/main/login/class_CookieLogin.php b/inc/classes/main/login/class_CookieLogin.php
deleted file mode 100644 (file)
index cbc9203..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-<?php
-/**
- * A cookie-bases login class
- *
- * @author             Roland Haeder <webmaster@ship-simu.org>
- * @version            0.0.0
- * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.ship-simu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-class CookieLogin extends BaseFrameworkSystem implements Registerable {
-       /**
-        * Response instance
-        */
-       private $responseInstance = null;
-
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       protected function __construct () {
-               // Call parent constructor
-               parent::__construct(__CLASS__);
-
-               // Set part description
-               $this->setObjectDescription("Cookie-based login");
-
-               // Create unique ID number
-               $this->generateUniqueId();
-
-               // Clean up a little
-               $this->removeNumberFormaters();
-               $this->removeSystemArray();
-       }
-
-       /**
-        * Creates an instance of this class by the given response instance
-        *
-        * @param       $responseInstance       An instance of a Responseable class
-        * @return      $loginInstance          An instance of this login class
-        */
-       public final static function createCookieLogin (Responseable $responseInstance) {
-               // Get a new instance
-               $loginInstance = new CookieLogin();
-
-               // Set the response instance
-               $loginInstance->setResponseInstance($responseInstance);
-
-               // Return the prepared instance
-               return $loginInstance;
-       }
-
-       /**
-        * Setter for login instance
-        *
-        * @param       $responseInstance       An instance of a Responseable class
-        * @return      void
-        */
-       protected final function setResponseInstance (Responseable $responseInstance) {
-               $this->responseInstance = $responseInstance;
-       }
-
-       /**
-        * "Setter" for username auth data
-        *
-        * @param       $userName       The username from request we shall set
-        * @return      void
-        */
-       public function setUserAuth ($userName) {
-               $this->responseInstance->addCookie('username', $userName);
-       }
-
-       /**
-        * "Setter" for password hash auth data
-        *
-        * @param       $passHash       The hashed password from request we shall set
-        * @return      void
-        */
-       public function setPasswordAuth ($passHash) {
-               $this->responseInstance->addCookie('u_hash', $passHash, true);
-       }
-}
-
-// [EOF]
-?>
diff --git a/inc/classes/main/reader/.htaccess b/inc/classes/main/reader/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/classes/main/reader/class_DefaultNewsReader.php b/inc/classes/main/reader/class_DefaultNewsReader.php
new file mode 100644 (file)
index 0000000..7fa8ff2
--- /dev/null
@@ -0,0 +1,74 @@
+<?php
+/**
+ * A default news reader class reads news from database layer
+ *
+ * @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 DefaultNewsReader extends BaseFrameworkSystem implements ReadableNews {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+
+               // Set part description
+               $this->setObjectDescription("Default news reader");
+
+               // Create unique ID number
+               $this->generateUniqueId();
+
+               // Clean up a little
+               $this->removeNumberFormaters();
+               $this->removeSystemArray();
+       }
+
+       /**
+        * Creates an instance of this reader by a provided request instance
+        *
+        * @param       $requestInstance        An instance of a Requestable class
+        * @return      $readerInstance         An instance of this reader class
+        */
+       public final static function createDefaultNewsReader (Requestable $requestInstance) {
+               // Get a new instance
+               $readerInstance = new DefaultNewsReader();
+
+               // Set request instance
+               $readerInstance->setRequestInstance($requestInstance);
+
+               // Return prepared instance
+               return $readerInstance;
+       }
+
+       /**
+        * Initializes this reader class by pre-fetching news depending on "page"
+        * (outside or login area), which amount of news and how much to skip
+        *
+        * @return      void
+        */
+       public function initializeReader () {
+               // TODO Need to implement this method
+       }
+}
+
+// [EOF]
+?>
index aec7e5ab8a4b59dadec8acaad89f433ab357f983..79225300e10d1f8eccfaf9d8b2e9529b0b5686d8 100644 (file)
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 abstract class BaseRegistration extends BaseFrameworkSystem implements UserRegister {
-       /**
-        * Instance of a request class
-        */
-       private $requestInstance = null;
-
-       /**
-        * Instance of a response class
-        */
-       private $responseInstance = null;
-
        /**
         * Pre-registration filter chain
         */
@@ -64,46 +54,8 @@ abstract class BaseRegistration extends BaseFrameworkSystem implements UserRegis
         */
        protected function initFilterChains () {
                // Pre/post-registration filters
-               $this->preRegistrationFilter = ObjectFactory::createObjectByConfiguredName('filter_chain');
-               $this->postRegistrationFilter = ObjectFactory::createObjectByConfiguredName('filter_chain');
-       }
-
-       /**
-        * Setter for request instance
-        *
-        * @param       $requestInstance        An instance of a Requestable class
-        * @return      void
-        */
-       public final function setRequestInstance (Requestable $requestInstance) {
-               $this->requestInstance = $requestInstance;
-       }
-
-       /**
-        * Getter for request instance
-        *
-        * @return      $requestInstance        An instance of a Requestable class
-        */
-       public final function getRequestInstance () {
-               return $this->requestInstance;
-       }
-
-       /**
-        * Setter for response instance
-        *
-        * @param       $responseInstance       An instance of a Responseable class
-        * @return      void
-        */
-       public final function setResponseInstance (Responseable $responseInstance) {
-               $this->responseInstance = $responseInstance;
-       }
-
-       /**
-        * Getter for response instance
-        *
-        * @return      $responseInstance       An instance of a Responseable class
-        */
-       public final function getResponseInstance () {
-               return $this->responseInstance;
+               $this->preRegistrationFilter = ObjectFactory::createObjectByConfiguredName('filter_chain_class');
+               $this->postRegistrationFilter = ObjectFactory::createObjectByConfiguredName('filter_chain_class');
        }
 
        /**
index e3bb312f9ea3757b0cb0d4dbd7b70a187a567c30..b6f9b95f46c6f2cd874228c1b2afde5532df8f1c 100644 (file)
@@ -93,7 +93,7 @@ class HttpRequest extends BaseFrameworkSystem implements Requestable {
                if (!isset($this->requestData[$element])) {
                        // Then throw an exception
                        throw new MissingArrayElementsException(array($this, 'requestData', $element), self::EXCEPTION_MISSING_ELEMENT);
-               }
+               } // END - if
 
                // All clear
                return true;
@@ -113,7 +113,7 @@ class HttpRequest extends BaseFrameworkSystem implements Requestable {
                try {
                        if ($this->isRequestElementSet($element)) {
                                $value = $this->requestData[$element];
-                       }
+                       } // END - if
                } catch (MissingArrayElementsException $e) {
                        // Do nothing here
                }
@@ -158,7 +158,7 @@ class HttpRequest extends BaseFrameworkSystem implements Requestable {
                // Does this header exist?
                if (isset($_SERVER[$name])) {
                        $headerValue = $_SERVER[$name];
-               }
+               } // END - if
 
                // Return the value
                return $headerValue;
@@ -176,7 +176,7 @@ class HttpRequest extends BaseFrameworkSystem implements Requestable {
        /**
         * Sets wether the request was valid (default: true)
         *
-        * @param       $isValid                Wether the request is valid
+        * @param       $isValid        Wether the request is valid
         * @return      void
         */
        public final function requestIsValid ($isValid = true) {
@@ -191,6 +191,26 @@ class HttpRequest extends BaseFrameworkSystem implements Requestable {
        public final function isRequestValid () {
                return $this->requestIsValid;
        }
+
+       /**
+        * Reads a cookie and returns it's value or null if not found
+        *
+        * @param       $cookieName             Name of cookie we shall read
+        * @return      $cookieValue    Value of cookie or null if not found
+        */
+       public final function readCookie ($cookieName) {
+               // Default is no cookie with that name found
+               $cookieValue = null;
+
+               // Is the cookie set?
+               if (isset($_COOKIE[$cookieName])) {
+                       // Then get it
+                       $cookieValue = $_COOKIE[$cookieName];
+               } // END - if
+
+               // Return the value
+               return $cookieValue;
+       }
 }
 
 // [EOF]
index e551a98d16dd730beae91313d7bfef8573f1410f..f4b87a2b30c7967e36bc25d5fc7e15877e6834f9 100644 (file)
@@ -181,7 +181,7 @@ class WebCommandResolver extends BaseResolver implements CommandResolver {
                                // Still not found?
                                throw new InvalidCommandException(array($this, $defaultCommand), self::EXCEPTION_INVALID_COMMAND);
                        }
-               }
+               } // END - if
 
                // Initiate the command
                $commandInstance = ObjectFactory::createObjectByName($className, array($this));
index b5f66e85314c923e1e952b8b0bb76ea75b4f52b7..0585196bc06c999fcaa3fe3adb7afd2a2424763a 100644 (file)
@@ -126,7 +126,9 @@ class WebControllerResolver extends BaseResolver implements ControllerResolver {
        }
 
        /**
-        * "Loads" a given controller and instances it if not yet cached
+        * "Loads" a given controller and instances it if not yet cached. If the
+        * controller was not found one of the default controllers will be used
+        * depending on wether news shall be displayed.
         *
         * @param       $commandName                    A controller name we shall look for
         * @return      $controllerInstance             A loaded controller instance
@@ -150,6 +152,7 @@ class WebControllerResolver extends BaseResolver implements ControllerResolver {
                $class = "WebDefaultController";
 
                // Generate the class name
+               //* DEBUG: */ echo __METHOD__.": Command=".$commandName;
                if ($commandName != $defaultCommand) {
                        // Create controller class name
                        $class = sprintf("Web%sController",
@@ -162,6 +165,7 @@ class WebControllerResolver extends BaseResolver implements ControllerResolver {
                        // No nes at "home" page
                        $class = "WebDefaultController";
                }
+               //* DEBUG: */ echo ", controller=".$class."<br />\n";
 
                // Is this class loaded?
                if (!class_exists($class)) {
@@ -176,7 +180,7 @@ class WebControllerResolver extends BaseResolver implements ControllerResolver {
                } // END - if
 
                // Initiate the resolver and controller
-               $resolverInstance = ObjectFactory::createObjectByConfiguredName('web_cmd_resolver', array($commandName, $this->getApplicationInstance()));
+               $resolverInstance = ObjectFactory::createObjectByConfiguredName('web_cmd_resolver_class', array($commandName, $this->getApplicationInstance()));
                $controllerInstance = ObjectFactory::createObjectByName($class, array($resolverInstance));
 
                // Remove resolver
index f4a3d50e3e16166be1ee05a2724e204d35396e37..3fc5d2db1943c62b56ad4a209604804ab03cefd5 100644 (file)
@@ -243,10 +243,11 @@ class HttpResponse extends BaseFrameworkSystem implements Responseable {
         * @param       $cookieName             Cookie's name
         * @param       $cookieValue    Value to store in the cookie
         * @param       $encrypted              Do some extra encryption on the value
+        * @param       $expires                Timestamp of expiration (default: configured)
         * @return      void
         * @throws      ResponseHeadersAlreadySentException             If headers are already sent
         */
-       public function addCookie ($cookieName, $cookieValue, $encrypted = false) {
+       public function addCookie ($cookieName, $cookieValue, $encrypted = false, $expires = null) {
                // Are headers already sent?
                if (headers_sent()) {
                        // Throw an exception here
@@ -261,8 +262,11 @@ class HttpResponse extends BaseFrameworkSystem implements Responseable {
                // For slow browsers set the cookie array element first
                $_COOKIE[$cookieName] = $cookieValue;
 
-               // Get a config entries
-               $expires = (time() + $this->getConfigInstance()->readConfig('cookie_expire'));
+               // Get all config entries
+               if (is_null($expires)) {
+                       $expires = (time() + $this->getConfigInstance()->readConfig('cookie_expire'));
+               } // END - if
+
                $path = $this->getConfigInstance()->readConfig('cookie_path');
                $domain = $this->getConfigInstance()->readConfig('cookie_domain');
 
@@ -324,6 +328,23 @@ class HttpResponse extends BaseFrameworkSystem implements Responseable {
                // All done here...
                exit();
        }
+
+       /**
+        * Expires the given cookie if it is set
+        *
+        * @param       $cookieName             Cookie to expire
+        * @return      void
+        */
+       public function expireCookie ($cookieName) {
+               // Is the cookie there?
+               if (isset($_COOKIE[$cookieName])) {
+                       // Then expire it with 20 minutes past
+                       $this->addCookie($cookieName, "", false, (time() - 1200));
+
+                       // Remove it from array
+                       unset($_COOKIE[$cookieName]);
+               } // END - if
+       }
 }
 
 // [EOF]
index 85632a4cd5216af35758b2b48109e543334deb6b..fad4cf4a3f5a956a63092319b477076d58f0586b 100644 (file)
@@ -109,9 +109,9 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate
        private $helpers = array();
 
        // Exception codes for the template engine
-       const EXCEPTION_TEMPLATE_TYPE_IS_UNEXPECTED   = 0xa00;
-       const EXCEPTION_TEMPLATE_CONTAINS_INVALID_VAR = 0xa01;
-       const EXCEPTION_INVALID_VIEW_HELPER           = 0xa02;
+       const EXCEPTION_TEMPLATE_TYPE_IS_UNEXPECTED   = 0x020;
+       const EXCEPTION_TEMPLATE_CONTAINS_INVALID_VAR = 0x021;
+       const EXCEPTION_INVALID_VIEW_HELPER           = 0x022;
 
        /**
         * Protected constructor
index 302c117d73d475c0fdb4d6129b2fbd7bdc60a5d2..cc9c44348058bd2e9645030a5d2950a22554955e 100644 (file)
@@ -33,9 +33,9 @@ class User extends BaseFrameworkSystem implements ManageableUser, Registerable {
        private $email = "";
 
        // Exceptions
-       const EXCEPTION_USERNAME_NOT_FOUND   = 0xd00;
-       const EXCEPTION_USER_EMAIL_NOT_FOUND = 0xd01;
-       const EXCEPTION_USER_PASS_MISMATCH   = 0xd02;
+       const EXCEPTION_USERNAME_NOT_FOUND   = 0x060;
+       const EXCEPTION_USER_EMAIL_NOT_FOUND = 0x061;
+       const EXCEPTION_USER_PASS_MISMATCH   = 0x062;
 
        /**
         * Protected constructor
@@ -152,10 +152,10 @@ class User extends BaseFrameworkSystem implements ManageableUser, Registerable {
                $exists = false;
 
                // Get a UserDatabaseWrapper instance
-               $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_db_wrapper');
+               $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_db_wrapper_class');
 
                // Create a search criteria
-               $criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria');
+               $criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
 
                // Add the username as a criteria and set limit to one entry
                $criteriaInstance->addCriteria(UserDatabaseWrapper::DB_COLUMN_USERNAME, $this->getUsername());
@@ -184,10 +184,10 @@ class User extends BaseFrameworkSystem implements ManageableUser, Registerable {
                $exists = false;
 
                // Get a UserDatabaseWrapper instance
-               $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_db_wrapper');
+               $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_db_wrapper_class');
 
                // Create a search criteria
-               $criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria');
+               $criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
 
                // Add the username as a criteria and set limit to one entry
                $criteriaInstance->addCriteria(UserDatabaseWrapper::DB_COLUMN_EMAIL, $this->getEmail());
@@ -218,10 +218,10 @@ class User extends BaseFrameworkSystem implements ManageableUser, Registerable {
                $matches = false;
 
                // Get a UserDatabaseWrapper instance
-               $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_db_wrapper');
+               $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_db_wrapper_class');
 
                // Create a search criteria
-               $criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria');
+               $criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
 
                // Add the username as a criteria and set limit to one entry
                $criteriaInstance->addCriteria(UserDatabaseWrapper::DB_COLUMN_USERNAME, $this->getUserName());
index dcac291d6551d51d55ba89b96f4703927af7b847..99cb434e16a1379a2a2220834fbcf062f7bb8b56 100644 (file)
@@ -68,8 +68,8 @@ class FileIoHandler extends BaseMiddleware {
                $ioHandler = new FileIoHandler();
 
                // Set the *real* file IO instances (both the same)
-               $ioHandler->setInputStream(ObjectFactory::createObjectByConfiguredName('file_input_stream'));
-               $ioHandler->setOutputStream(ObjectFactory::createObjectByConfiguredName('file_output_stream'));
+               $ioHandler->setInputStream(ObjectFactory::createObjectByConfiguredName('file_input_class'));
+               $ioHandler->setOutputStream(ObjectFactory::createObjectByConfiguredName('file_output_class'));
 
                // Return instance
                return $ioHandler;
index d1b71f6db7b1e29c2b361cf79387f73b4f47a74b..50571624abfeeac3611f4ad9f0c39c3eaf7ae363 100644 (file)
@@ -65,9 +65,6 @@ $cfg->setConfigEntry('raw_template_extension', ".tpl");
 // CFG: CODE-TEMPLATE-EXTENSION
 $cfg->setConfigEntry('code_template_extension', ".ctp");
 
-// CFG: SELECTOR-GET
-$cfg->setConfigEntry('app_selector_get', "app");
-
 // CFG: SELECTOR-PATH
 $cfg->setConfigEntry('selector_path', "selector");
 
@@ -93,10 +90,10 @@ $cfg->setConfigEntry('application_path', "application");
 $cfg->setConfigEntry('compile_output_path', "templates/_compiled/"); // DON'T MISS THE TRAILING SLASH!
 
 // CFG: TEMPLATE-ENGINE
-$cfg->setConfigEntry('tpl_engine', "TemplateEngine");
+$cfg->setConfigEntry('template_class', "TemplateEngine");
 
 // CFG: DEBUG-ENGINE
-$cfg->setConfigEntry('debug_engine', "DebugWebOutput");
+$cfg->setConfigEntry('debug_class', "DebugWebOutput");
 
 // CFG: DEFAULT-LANGUAGE
 $cfg->setConfigEntry('default_lang', "de"); // A two-char language string: de for german, en for english and so on
@@ -153,49 +150,49 @@ $cfg->setConfigEntry('default_application', "selector");
 $cfg->setConfigEntry('verbose_level', 0);
 
 // CFG: CACHE-TYPE
-$cfg->setConfigEntry('cache_type', "MemoryCache");
+$cfg->setConfigEntry('cache_class', "MemoryCache");
 
 // CFG: SEARCH-CRITERIA
-$cfg->setConfigEntry('search_criteria', "SearchCriteria");
+$cfg->setConfigEntry('search_criteria_class', "SearchCriteria");
 
 // CFG: DATASET-CRITERIA
-$cfg->setConfigEntry('dataset_criteria', "DataSetCriteria");
+$cfg->setConfigEntry('dataset_criteria_class', "DataSetCriteria");
 
 // CFG: FILE-IO-HANDLER
-$cfg->setConfigEntry('file_io_handler', "FileIoHandler");
+$cfg->setConfigEntry('file_io_class', "FileIoHandler");
 
 // CFG: FILTER-CHAIN
-$cfg->setConfigEntry('filter_chain', "FilterChain");
+$cfg->setConfigEntry('filter_chain_class', "FilterChain");
 
 // CFG: FILE-INPUT-STREAM
-$cfg->setConfigEntry('file_input_stream', "FileIoStream");
+$cfg->setConfigEntry('file_input_class', "FileIoStream");
 
 // CFG: FILE-OUTPUT-STREAM
-$cfg->setConfigEntry('file_output_stream', "FileIoStream");
+$cfg->setConfigEntry('file_output_class', "FileIoStream");
 
 // CFG: EMAIL-VALIDATOR
-$cfg->setConfigEntry('email_validator', "EmailValidatorFilter");
+$cfg->setConfigEntry('email_validator_class', "EmailValidatorFilter");
 
 // CFG: USERNAME-VALIDATOR
-$cfg->setConfigEntry('username_validator', "UserNameValidatorFilter");
+$cfg->setConfigEntry('username_validator_class', "UserNameValidatorFilter");
 
 // CFG: PASSWORD-VALIDATOR
-$cfg->setConfigEntry('password_validator', "PasswordValidatorFilter");
+$cfg->setConfigEntry('password_validator_class', "PasswordValidatorFilter");
 
 // CFG: RULES-ACCEPTED-FILTER
-$cfg->setConfigEntry('rules_accepted_filter', "RulesAcceptedFilter");
+$cfg->setConfigEntry('rules_accepted_class', "RulesAcceptedFilter");
 
 // CFG: CRYPTO-HELPER
-$cfg->setConfigEntry('crypto_heler', "CryptoHelper");
+$cfg->setConfigEntry('crypto_class', "CryptoHelper");
 
 // CFG: RNG-CLASS
 $cfg->setConfigEntry('rng_class', "RandomNumberGenerator");
 
 // CFG: USER-DB-WRAPPER
-$cfg->setConfigEntry('user_db_wrapper', "UserDatabaseWrapper");
+$cfg->setConfigEntry('user_db_wrapper_class', "UserDatabaseWrapper");
 
 // CFG: WEB-CMD-RESOLVER
-$cfg->setConfigEntry('web_cmd_resolver', "WebCommandResolver");
+$cfg->setConfigEntry('web_cmd_resolver_class', "WebCommandResolver");
 
 // CFG: MATH-PRIME
 $cfg->setConfigEntry('math_prime', 591623);
@@ -216,7 +213,7 @@ $cfg->setConfigEntry('hash_mask', "%1s:%2s:%3s"); // 1=salt, 2=extra salt, 3=pla
 $cfg->setConfigEntry('is_single_server', "Y");
 
 // CFG: POST-REGISTRATION-ACTION
-$cfg->setConfigEntry('post_registration_action', "LoginAfterRegistrationAction");
+$cfg->setConfigEntry('post_registration_class', "LoginAfterRegistrationAction");
 
 // CFG: USER-CLASS
 $cfg->setConfigEntry('user_class', "User");
index 794925dd1e590fdde9868c4485dbb7c5e117c490..50a4ac18a35d588fe162e4b75c0f17f140c1019e 100644 (file)
@@ -39,8 +39,8 @@ class FrameworkConfiguration implements Registerable {
        private static $cfgInstance = null;
 
        // Some constants for the configuration system
-       const EXCEPTION_CONFIG_ENTRY_IS_EMPTY      = 0xc00;
-       const EXCEPTION_CONFIG_ENTRY_WAS_NOT_FOUND = 0xc01;
+       const EXCEPTION_CONFIG_ENTRY_IS_EMPTY      = 0x040;
+       const EXCEPTION_CONFIG_ENTRY_WAS_NOT_FOUND = 0x041;
 
        /**
         * Protected constructor
index 7713c6371a7072924ba8c7eb4df44c3c0e7e3af1..afb41612bd913bc05e750be7d25a86d00becaebe 100644 (file)
@@ -25,7 +25,7 @@
  */
 
 // Get the instance
-$io = ObjectFactory::createObjectByConfiguredName('file_io_handler');
+$io = ObjectFactory::createObjectByConfiguredName('file_io_class');
 
 // [EOF]
 ?>
index 96e6aba694b26c46be536097fa418621a8f60519..a9af02b50245144ec9ed515900e5e26c51395b59 100644 (file)
@@ -29,14 +29,14 @@ $cfg = FrameworkConfiguration::getInstance();
 require(sprintf("%sinc/loader/class_ClassLoader%s", PATH, $cfg->readConfig('php_extension')));
 
 // Does the user has an application specified?
-if (!empty($_GET[$cfg->readConfig('app_selector_get')])) {
+if (!empty($_GET['app'])) {
        // Set the application from string
-       $application = (string) $_GET[$cfg->readConfig('app_selector_get')];
+       $application = (string) $_GET['app'];
 } elseif (!empty($_SERVER['argv'][1])) {
        // Set the application from string
        $application = (string) $_SERVER['argv'][1];
        $app = explode('=', trim($application));
-       if ($app[0] == $cfg->readConfig('app_selector_get')) {
+       if ($app[0] == 'app') {
                // Application is valid!
                $application = trim($app[1]);
        } else {
index 4eb1223473c92d6cef605a4bbe942d92d6e43693..fa9c771d9f23912c58b003725cf68f51d0917c5a 100644 (file)
@@ -102,6 +102,11 @@ class ClassLoader {
         */
        private $classCacheFQFN = "";
 
+       /**
+        * Counter for loaded include files
+        */
+       private $total = 0;
+
        /**
         * The *public* constructor
         *
@@ -306,6 +311,9 @@ class ClassLoader {
                        // File is found so load it only once
                        require($this->classes[$fileName]);
 
+                       // Count this include
+                       $this->total++;
+
                        // Developer mode excludes caching (better debugging)
                        if (!defined('DEVELOPER')) {
                                // Mark this class as loaded
@@ -335,6 +343,15 @@ class ClassLoader {
                        } // END - if
                } // END - foreach
        }
+
+       /**
+        * Getter for total include counter
+        *
+        * @return      $total  Total loaded include files
+        */
+       public final function getTotal () {
+               return $this->total;
+       }
 }
 
 // [EOF]
index 32eb1e513ba45531ba9d7d8da9378a253452ecc4..35b9359f7dec4f39c3ab0cb25d4e14faaa400716 100644 (file)
@@ -23,7 +23,7 @@
  */
 
 // Get a debugger instance
-$debug = DebugMiddleware::createDebugMiddleware(FrameworkConfiguration::getInstance()->readConfig('debug_engine'));
+$debug = DebugMiddleware::createDebugMiddleware(FrameworkConfiguration::getInstance()->readConfig('debug_class'));
 
 // Empty string should be ignored and used for testing the middleware
 DebugMiddleware::getInstance()->output("");
index 29725af3dc9c8a33f664f09fbf2ef00bffd8e04d..406c2b8601fa0db2d1275352ac521c02293f6ccb 100644 (file)
                <div id="stats_objects">
                        Total objects: $content[total_objects]
                </div>
+               <div id="stats_includes">
+                       Loaded class files: $content[total_includes]
+                       <span class="hint">(Including exception and interfaces.)</span>
+               </div>
        </div>
 
 {?footer_msg:footer_msg="Please contact the support and supply the full above message, if you think you are not qualified to fix this problem."?}
index cce846071dfe3e81dbd8dbaefe962a9d0643025d..2561392fea64f0287ce845fe5016b13b74b8ca8f 100644 (file)
@@ -1,5 +1,5 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
 <head>
        <title>
                $content[title]