]> git.mxchange.org Git - admin.git/commitdiff
Updated 'core' + renamed 'main' -> 'classes'.
authorRoland Haeder <roland@mxchange.org>
Tue, 25 Aug 2015 16:47:09 +0000 (18:47 +0200)
committerRoland Haeder <roland@mxchange.org>
Tue, 25 Aug 2015 16:47:09 +0000 (18:47 +0200)
Signed-off-by: Roland Haeder <roland@mxchange.org>
31 files changed:
application/admin/classes/.htaccess [new file with mode: 0644]
application/admin/classes/actions/.htaccess [new file with mode: 0644]
application/admin/classes/actions/web/.htaccess [new file with mode: 0644]
application/admin/classes/actions/web/class_WebAdminLoginWelcomeAction.php [new file with mode: 0644]
application/admin/classes/class_ [new file with mode: 0644]
application/admin/classes/commands/.htaccess [new file with mode: 0644]
application/admin/classes/commands/web/.htaccess [new file with mode: 0644]
application/admin/classes/commands/web/class_WebAdminUserLoginCommand.php [new file with mode: 0644]
application/admin/classes/login/.htaccess [new file with mode: 0644]
application/admin/classes/login/class_AdminUserLogin.php [new file with mode: 0644]
application/admin/classes/login/helper/.htaccess [new file with mode: 0644]
application/admin/classes/login/helper/class_AdminLoginHelper.php [new file with mode: 0644]
application/admin/classes/menu/.htaccess [new file with mode: 0644]
application/admin/classes/menu/class_Admin [new file with mode: 0644]
application/admin/classes/menu/class_AdminHomeMenu.php [new file with mode: 0644]
application/admin/main/.htaccess [deleted file]
application/admin/main/actions/.htaccess [deleted file]
application/admin/main/actions/web/.htaccess [deleted file]
application/admin/main/actions/web/class_WebAdminLoginWelcomeAction.php [deleted file]
application/admin/main/class_ [deleted file]
application/admin/main/commands/.htaccess [deleted file]
application/admin/main/commands/web/.htaccess [deleted file]
application/admin/main/commands/web/class_WebAdminUserLoginCommand.php [deleted file]
application/admin/main/login/.htaccess [deleted file]
application/admin/main/login/class_AdminUserLogin.php [deleted file]
application/admin/main/login/helper/.htaccess [deleted file]
application/admin/main/login/helper/class_AdminLoginHelper.php [deleted file]
application/admin/main/menu/.htaccess [deleted file]
application/admin/main/menu/class_Admin [deleted file]
application/admin/main/menu/class_AdminHomeMenu.php [deleted file]
core

diff --git a/application/admin/classes/.htaccess b/application/admin/classes/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/admin/classes/actions/.htaccess b/application/admin/classes/actions/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/admin/classes/actions/web/.htaccess b/application/admin/classes/actions/web/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/admin/classes/actions/web/class_WebAdminLoginWelcomeAction.php b/application/admin/classes/actions/web/class_WebAdminLoginWelcomeAction.php
new file mode 100644 (file)
index 0000000..fd2c1e9
--- /dev/null
@@ -0,0 +1,74 @@
+<?php
+/**
+ * An action class for the admin "welcome" page
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 Admin-Area Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.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 WebAdminLoginWelcomeAction extends BaseAction implements PerformableAction, Registerable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this action
+        *
+        * @return      $actionInstance         An instance of this action class
+        */
+       public static final function createWebAdminLoginWelcomeAction () {
+               // Get a new instance
+               $actionInstance = new WebAdminLoginWelcomeAction();
+
+               // Return the instance
+               return $actionInstance;
+       }
+
+       /**
+        * Executes the command with given request and response objects
+        *
+        * @param       $requestInstance        An instance of a class with an Requestable interface
+        * @param       $responseInstance       An instance of a class with an Responseable interface
+        * @return      void
+        * @todo        Maybe we need to do something later here
+        */
+       public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+               $this->partialStub("Unfinished part.");
+       }
+
+       /**
+        * Adds extra filters to the given controller instance
+        *
+        * @param       $controllerInstance             A controller instance
+        * @param       $requestInstance                An instance of a class with an Requestable interface
+        * @return      void
+        * @todo        0% done
+        */
+       public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
+               $this->partialStub("Need to add filters which looks for applications with &quot;admin&quot; directory.");
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/admin/classes/class_ b/application/admin/classes/class_
new file mode 100644 (file)
index 0000000..edb4f97
--- /dev/null
@@ -0,0 +1,37 @@
+<?php
+/**
+ * 
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 Admin-Area Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class  extends BaseFrameworkSystem {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/admin/classes/commands/.htaccess b/application/admin/classes/commands/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/admin/classes/commands/web/.htaccess b/application/admin/classes/commands/web/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/admin/classes/commands/web/class_WebAdminUserLoginCommand.php b/application/admin/classes/commands/web/class_WebAdminUserLoginCommand.php
new file mode 100644 (file)
index 0000000..bc416db
--- /dev/null
@@ -0,0 +1,124 @@
+<?php
+/**
+ * A command for user login
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 Admin-Area Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.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 WebAdminUserLoginCommand extends BaseCommand implements Commandable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this command and sets the resolver instance
+        *
+        * @param       $resolverInstance       An instance of a command resolver
+        * @return      $commandInstance        The created command instance
+        */
+       public static final function createWebAdminUserLoginCommand (CommandResolver $resolverInstance) {
+               // Get a new instance
+               $commandInstance = new WebAdminUserLoginCommand();
+
+               // Set the resolver instance
+               $commandInstance->setResolverInstance($resolverInstance);
+
+               // Return the prepared instance
+               return $commandInstance;
+       }
+
+       /**
+        * Executes the command with given request and response objects
+        *
+        * @param       $requestInstance        An instance of a class with an Requestable interface
+        * @param       $responseInstance       An instance of a class with an Responseable interface
+        * @return      void
+        */
+       public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+               // First get a UserLogin instance
+               $loginInstance = ObjectFactory::createObjectByConfiguredName('user_login_class');
+
+               // First set request and response instance
+               $loginInstance->setRequestInstance($requestInstance);
+
+               // Encrypt the password
+               $loginInstance->encryptPassword('pass');
+
+               // Do the login here
+               $loginInstance->doLogin($requestInstance, $responseInstance);
+
+               // Was the login fine? Then redirect here
+               if ($loginInstance->ifLoginWasSuccessfull()) {
+                       // Try to redirect here
+                       try {
+                               // Redirect...
+                               $responseInstance->redirectToConfiguredUrl('app_login');
+
+                               // Exit here
+                               exit();
+                       } catch (FrameworkException $e) {
+                               // Something went wrong here!
+                               $responseInstance->addFatalMessage($e->getMessage());
+                       }
+               } else {
+                       // Attach error message to the response
+                       $responseInstance->addFatalMessage('failed_user_login');
+               }
+       }
+
+       /**
+        * Adds extra filters to the given controller instance
+        *
+        * @param       $controllerInstance             A controller instance
+        * @param       $requestInstance                An instance of a class with an Requestable interface
+        * @return      void
+        * @todo        Add more filters
+        */
+       public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
+               // Which login type do we have?
+               switch ($this->getConfigInstance()->getConfigEntry('login_type')) {
+                       case "username": // Login via username
+                               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_verifier_filter'));
+                               break;
+
+                       case "email": // Login via email
+                               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('email_verifier_filter'));
+                               break;
+
+                       default: // Wether username or email is set
+                               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_email_verifier_filter'));
+                               break;
+               }
+
+               // Password verifier filter
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('password_verifier_filter'));
+
+               // Add filter for CAPTCHA
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_user_verifier_filter'));
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/admin/classes/login/.htaccess b/application/admin/classes/login/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/admin/classes/login/class_AdminUserLogin.php b/application/admin/classes/login/class_AdminUserLogin.php
new file mode 100644 (file)
index 0000000..ac8050e
--- /dev/null
@@ -0,0 +1,140 @@
+<?php
+/**
+ * A special login class for administration area
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 Admin-Area Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.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 AdminUserLogin extends BaseFrameworkSystem implements LoginableUser {
+       /**
+        * The hashed password
+        */
+       private $hashedPassword = "";
+
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this login class
+        *
+        * @return      $loginInstance  An instance of this login class
+        */
+       public static final function createAdminUserLogin () {
+               // Get a new instance
+               $loginInstance = new AdminUserLogin();
+
+               // Return the instance
+               return $loginInstance;
+       }
+
+       /**
+        * Logins the user with the given request containing the credential. The
+        * result of the login can be thrown by exception or, if prefered stored
+        * in a boolean attribute which is then readable by a matching getter.
+        *
+        * @param       $requestInstance        An instance of a Requestable class
+        * @param       $responseInstance       An instance of a Responseable class
+        * @return      void
+        * @throws      UserPasswordMismatchException   If the supplied password did not
+        *                                                                              match with the stored password
+        * @todo        We need to add something here which will make more than one
+        * @todo        guest logins, users who are online but based on the same
+        * @todo        user account.
+        */
+       public function doLogin (Requestable $requestInstance, Responseable $responseInstance) {
+               // By default no method is selected
+               $method = null;
+               $data = "";
+
+               // Get member class
+               $userClass = $this->getConfigInstance()->getConfigEntry('user_class');
+
+               // Get a user instance
+               $userInstance = call_user_func_array(array($userClass, 'createMemberByRequest'), array($requestInstance));
+
+               // Remember this new instance in registry
+               Registry::getRegistry()->addInstance('user', $userInstance);
+
+               // Is the password correct?
+               if ($userInstance->ifPasswordHashMatches($requestInstance) === false) {
+                       // Mismatching password
+                       throw new UserPasswordMismatchException(array($this, $userInstance), BaseUser::EXCEPTION_USER_PASS_MISMATCH);
+               } // END - if
+
+               // ToDo place
+
+               // 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_class', array($requestInstance));
+
+               // 2) Execute the login. This will now login...
+               $helperInstance->executeLogin($responseInstance);
+       }
+
+       /**
+        * Determines wether the login was fine. This is done by checking if 'login' instance is in registry
+        *
+        * @return      $loginDone      Wether the login was fine or not
+        */
+       public function ifLoginWasSuccessfull () {
+               // Is the registry key there?
+               $loginDone = (Registry::getRegistry()->getInstance('login') instanceof Registerable);
+
+               // Return the result
+               return $loginDone;
+       }
+
+       /**
+        * Encrypt given request key or throw an exception if key was not found in
+        * request
+        *
+        * @param       $requestKey             Key in request class
+        * @return      void
+        */
+       public function encryptPassword ($requestKey) {
+               // Check if password is found in request
+               if ($this->getRequestInstance()->isRequestElementSet($requestKey)) {
+                       // So encrypt the password and store it for later usage in
+                       // the request:
+
+                       // Get the plain password
+                       $plainPassword = $this->getRequestInstance()->getRequestElement($requestKey);
+
+                       // Get user instance
+                       $userInstance = Registry::getRegistry()->getInstance('user');
+
+                       // Get a crypto helper and hash the password
+                       $this->hashedPassword = ObjectFactory::createObjectByConfiguredName('crypto_class')->hashString($plainPassword, $userInstance->getPasswordHash());
+
+                       // Store the hash back in request
+                       $this->getRequestInstance()->setRequestElement('pass_hash', $this->hashedPassword);
+               } // END - if
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/admin/classes/login/helper/.htaccess b/application/admin/classes/login/helper/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/admin/classes/login/helper/class_AdminLoginHelper.php b/application/admin/classes/login/helper/class_AdminLoginHelper.php
new file mode 100644 (file)
index 0000000..a70a6ac
--- /dev/null
@@ -0,0 +1,114 @@
+<?php
+/**
+ * A helper for administration area login. This login helper first checks what
+ * setting (cookie or session) the admin has choosen then overwrites it with the
+ * setting from current user. The registry instance should hold an instance of
+ * this user class at key 'user' else an exception will be thrown. After this
+ * the setting from a login form will be taken as login method and be stored
+ * in database for later usage.
+ *
+ * The user shall be able to choose "Default login method" or similar to use his
+ * own login method.
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 Admin-Area Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.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 AdminLoginHelper extends BaseLoginHelper implements HelpableLogin {
+       /**
+        * The login method we shall choose
+        */
+       private $authMethod = "";
+
+       // Exception constants
+       const EXCEPTION_INVALID_USER_INSTANCE = 0x190;
+
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this class by given request instance
+        *
+        * @param       $requestInstance        An instance of a Requestable class
+        * @return      $helperInstance         An instance of this helper class
+        * @throws      UserInstanceMissingException    If the user instance in registry
+        *                                                                                      is missing or invalid
+        */
+       public static final function createAdminLoginHelper (Requestable $requestInstance) {
+               // Get a new instance first
+               $helperInstance = new AdminLoginHelper();
+
+               // Get a user instance from registry
+               $userInstance = Registry::getRegistry()->getInstance('user');
+
+               // Is this instance valid?
+               if (!$userInstance instanceof ManageableAccount) {
+                       // Thrown an exception here
+                       throw new UserInstanceMissingException (array($helperInstance, 'user'), self::EXCEPTION_INVALID_USER_INSTANCE);
+               } // END - if
+
+               // Set default login method from config
+               $helperInstance->setDefaultAuthMethod();
+
+               // Set request instance
+               $helperInstance->setRequestInstance($requestInstance);
+
+               // Return the prepared instance
+               return $helperInstance;
+       }
+
+       /**
+        * Setter for default login method from config
+        *
+        * @return      void
+        */
+       protected function setDefaultAuthMethod () {
+               $this->authMethod = $this->getConfigInstance()->getConfigEntry('auth_method_class');
+       }
+
+       /**
+        * Execute the login request by given response instance. This instance can
+        * be used for sending cookies or at least the session id out.
+        *
+        * @param       $responseInstance       An instance of a Responseable class
+        * @return      void
+        */
+       public function executeLogin (Responseable $responseInstance) {
+               // Get an instance from the login method
+               $loginInstance = ObjectFactory::createObjectByName($this->authMethod, array($responseInstance));
+
+               // Set user cookie
+               $loginInstance->setUserAuth($this->getRequestInstance()->getRequestElement('username'));
+
+               // Set password cookie
+               $loginInstance->setPasswordAuth($this->getRequestInstance()->getRequestElement('pass_hash'));
+
+               // Remember this login instance for later usage
+               Registry::getRegistry()->addInstance('login', $loginInstance);
+       }
+}
+
+//
+?>
diff --git a/application/admin/classes/menu/.htaccess b/application/admin/classes/menu/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/admin/classes/menu/class_Admin b/application/admin/classes/menu/class_Admin
new file mode 100644 (file)
index 0000000..031563b
--- /dev/null
@@ -0,0 +1,50 @@
+<?php
+/**
+ * A ??? menu class for Admin-Area
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 Admin-Area Developer Team
+ * @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 Admin???Menu extends BaseMenu implements RenderableMenu {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this class
+        *
+        * @return      $menuInstance   An instance of this class
+        */
+       public final static function createAdmin???Menu () {
+               // Get a new instance
+               $menuInstance = new Admin???Menu();
+
+               // Return the prepared instance
+               return $menuInstance;
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/admin/classes/menu/class_AdminHomeMenu.php b/application/admin/classes/menu/class_AdminHomeMenu.php
new file mode 100644 (file)
index 0000000..9ee6f3c
--- /dev/null
@@ -0,0 +1,50 @@
+<?php
+/**
+ * A Home menu class for Admin-Area
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 Admin-Area Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.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 AdminHomeMenu extends BaseMenu implements RenderableMenu {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this class
+        *
+        * @return      $menuInstance   An instance of this class
+        */
+       public static final function createAdminHomeMenu () {
+               // Get a new instance
+               $menuInstance = new AdminHomeMenu();
+
+               // Return the prepared instance
+               return $menuInstance;
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/admin/main/.htaccess b/application/admin/main/.htaccess
deleted file mode 100644 (file)
index 3a42882..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Deny from all
diff --git a/application/admin/main/actions/.htaccess b/application/admin/main/actions/.htaccess
deleted file mode 100644 (file)
index 3a42882..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Deny from all
diff --git a/application/admin/main/actions/web/.htaccess b/application/admin/main/actions/web/.htaccess
deleted file mode 100644 (file)
index 3a42882..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Deny from all
diff --git a/application/admin/main/actions/web/class_WebAdminLoginWelcomeAction.php b/application/admin/main/actions/web/class_WebAdminLoginWelcomeAction.php
deleted file mode 100644 (file)
index fd2c1e9..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-<?php
-/**
- * An action class for the admin "welcome" page
- *
- * @author             Roland Haeder <webmaster@shipsimu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 Admin-Area Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.shipsimu.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 WebAdminLoginWelcomeAction extends BaseAction implements PerformableAction, Registerable {
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       protected function __construct () {
-               // Call parent constructor
-               parent::__construct(__CLASS__);
-       }
-
-       /**
-        * Creates an instance of this action
-        *
-        * @return      $actionInstance         An instance of this action class
-        */
-       public static final function createWebAdminLoginWelcomeAction () {
-               // Get a new instance
-               $actionInstance = new WebAdminLoginWelcomeAction();
-
-               // Return the instance
-               return $actionInstance;
-       }
-
-       /**
-        * Executes the command with given request and response objects
-        *
-        * @param       $requestInstance        An instance of a class with an Requestable interface
-        * @param       $responseInstance       An instance of a class with an Responseable interface
-        * @return      void
-        * @todo        Maybe we need to do something later here
-        */
-       public function execute (Requestable $requestInstance, Responseable $responseInstance) {
-               $this->partialStub("Unfinished part.");
-       }
-
-       /**
-        * Adds extra filters to the given controller instance
-        *
-        * @param       $controllerInstance             A controller instance
-        * @param       $requestInstance                An instance of a class with an Requestable interface
-        * @return      void
-        * @todo        0% done
-        */
-       public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
-               $this->partialStub("Need to add filters which looks for applications with &quot;admin&quot; directory.");
-       }
-}
-
-// [EOF]
-?>
diff --git a/application/admin/main/class_ b/application/admin/main/class_
deleted file mode 100644 (file)
index edb4f97..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-/**
- * 
- *
- * @author             Roland Haeder <webmaster@ship-simu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 Admin-Area Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.ship-simu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-class  extends BaseFrameworkSystem {
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       protected function __construct () {
-               // Call parent constructor
-               parent::__construct(__CLASS__);
-       }
-}
-
-// [EOF]
-?>
diff --git a/application/admin/main/commands/.htaccess b/application/admin/main/commands/.htaccess
deleted file mode 100644 (file)
index 3a42882..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Deny from all
diff --git a/application/admin/main/commands/web/.htaccess b/application/admin/main/commands/web/.htaccess
deleted file mode 100644 (file)
index 3a42882..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Deny from all
diff --git a/application/admin/main/commands/web/class_WebAdminUserLoginCommand.php b/application/admin/main/commands/web/class_WebAdminUserLoginCommand.php
deleted file mode 100644 (file)
index bc416db..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-<?php
-/**
- * A command for user login
- *
- * @author             Roland Haeder <webmaster@shipsimu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 Admin-Area Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.shipsimu.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 WebAdminUserLoginCommand extends BaseCommand implements Commandable {
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       protected function __construct () {
-               // Call parent constructor
-               parent::__construct(__CLASS__);
-       }
-
-       /**
-        * Creates an instance of this command and sets the resolver instance
-        *
-        * @param       $resolverInstance       An instance of a command resolver
-        * @return      $commandInstance        The created command instance
-        */
-       public static final function createWebAdminUserLoginCommand (CommandResolver $resolverInstance) {
-               // Get a new instance
-               $commandInstance = new WebAdminUserLoginCommand();
-
-               // Set the resolver instance
-               $commandInstance->setResolverInstance($resolverInstance);
-
-               // Return the prepared instance
-               return $commandInstance;
-       }
-
-       /**
-        * Executes the command with given request and response objects
-        *
-        * @param       $requestInstance        An instance of a class with an Requestable interface
-        * @param       $responseInstance       An instance of a class with an Responseable interface
-        * @return      void
-        */
-       public function execute (Requestable $requestInstance, Responseable $responseInstance) {
-               // First get a UserLogin instance
-               $loginInstance = ObjectFactory::createObjectByConfiguredName('user_login_class');
-
-               // First set request and response instance
-               $loginInstance->setRequestInstance($requestInstance);
-
-               // Encrypt the password
-               $loginInstance->encryptPassword('pass');
-
-               // Do the login here
-               $loginInstance->doLogin($requestInstance, $responseInstance);
-
-               // Was the login fine? Then redirect here
-               if ($loginInstance->ifLoginWasSuccessfull()) {
-                       // Try to redirect here
-                       try {
-                               // Redirect...
-                               $responseInstance->redirectToConfiguredUrl('app_login');
-
-                               // Exit here
-                               exit();
-                       } catch (FrameworkException $e) {
-                               // Something went wrong here!
-                               $responseInstance->addFatalMessage($e->getMessage());
-                       }
-               } else {
-                       // Attach error message to the response
-                       $responseInstance->addFatalMessage('failed_user_login');
-               }
-       }
-
-       /**
-        * Adds extra filters to the given controller instance
-        *
-        * @param       $controllerInstance             A controller instance
-        * @param       $requestInstance                An instance of a class with an Requestable interface
-        * @return      void
-        * @todo        Add more filters
-        */
-       public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
-               // Which login type do we have?
-               switch ($this->getConfigInstance()->getConfigEntry('login_type')) {
-                       case "username": // Login via username
-                               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_verifier_filter'));
-                               break;
-
-                       case "email": // Login via email
-                               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('email_verifier_filter'));
-                               break;
-
-                       default: // Wether username or email is set
-                               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_email_verifier_filter'));
-                               break;
-               }
-
-               // Password verifier filter
-               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('password_verifier_filter'));
-
-               // Add filter for CAPTCHA
-               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_user_verifier_filter'));
-       }
-}
-
-// [EOF]
-?>
diff --git a/application/admin/main/login/.htaccess b/application/admin/main/login/.htaccess
deleted file mode 100644 (file)
index 3a42882..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Deny from all
diff --git a/application/admin/main/login/class_AdminUserLogin.php b/application/admin/main/login/class_AdminUserLogin.php
deleted file mode 100644 (file)
index ac8050e..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-<?php
-/**
- * A special login class for administration area
- *
- * @author             Roland Haeder <webmaster@shipsimu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 Admin-Area Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.shipsimu.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 AdminUserLogin extends BaseFrameworkSystem implements LoginableUser {
-       /**
-        * The hashed password
-        */
-       private $hashedPassword = "";
-
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       protected function __construct () {
-               // Call parent constructor
-               parent::__construct(__CLASS__);
-       }
-
-       /**
-        * Creates an instance of this login class
-        *
-        * @return      $loginInstance  An instance of this login class
-        */
-       public static final function createAdminUserLogin () {
-               // Get a new instance
-               $loginInstance = new AdminUserLogin();
-
-               // Return the instance
-               return $loginInstance;
-       }
-
-       /**
-        * Logins the user with the given request containing the credential. The
-        * result of the login can be thrown by exception or, if prefered stored
-        * in a boolean attribute which is then readable by a matching getter.
-        *
-        * @param       $requestInstance        An instance of a Requestable class
-        * @param       $responseInstance       An instance of a Responseable class
-        * @return      void
-        * @throws      UserPasswordMismatchException   If the supplied password did not
-        *                                                                              match with the stored password
-        * @todo        We need to add something here which will make more than one
-        * @todo        guest logins, users who are online but based on the same
-        * @todo        user account.
-        */
-       public function doLogin (Requestable $requestInstance, Responseable $responseInstance) {
-               // By default no method is selected
-               $method = null;
-               $data = "";
-
-               // Get member class
-               $userClass = $this->getConfigInstance()->getConfigEntry('user_class');
-
-               // Get a user instance
-               $userInstance = call_user_func_array(array($userClass, 'createMemberByRequest'), array($requestInstance));
-
-               // Remember this new instance in registry
-               Registry::getRegistry()->addInstance('user', $userInstance);
-
-               // Is the password correct?
-               if ($userInstance->ifPasswordHashMatches($requestInstance) === false) {
-                       // Mismatching password
-                       throw new UserPasswordMismatchException(array($this, $userInstance), BaseUser::EXCEPTION_USER_PASS_MISMATCH);
-               } // END - if
-
-               // ToDo place
-
-               // 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_class', array($requestInstance));
-
-               // 2) Execute the login. This will now login...
-               $helperInstance->executeLogin($responseInstance);
-       }
-
-       /**
-        * Determines wether the login was fine. This is done by checking if 'login' instance is in registry
-        *
-        * @return      $loginDone      Wether the login was fine or not
-        */
-       public function ifLoginWasSuccessfull () {
-               // Is the registry key there?
-               $loginDone = (Registry::getRegistry()->getInstance('login') instanceof Registerable);
-
-               // Return the result
-               return $loginDone;
-       }
-
-       /**
-        * Encrypt given request key or throw an exception if key was not found in
-        * request
-        *
-        * @param       $requestKey             Key in request class
-        * @return      void
-        */
-       public function encryptPassword ($requestKey) {
-               // Check if password is found in request
-               if ($this->getRequestInstance()->isRequestElementSet($requestKey)) {
-                       // So encrypt the password and store it for later usage in
-                       // the request:
-
-                       // Get the plain password
-                       $plainPassword = $this->getRequestInstance()->getRequestElement($requestKey);
-
-                       // Get user instance
-                       $userInstance = Registry::getRegistry()->getInstance('user');
-
-                       // Get a crypto helper and hash the password
-                       $this->hashedPassword = ObjectFactory::createObjectByConfiguredName('crypto_class')->hashString($plainPassword, $userInstance->getPasswordHash());
-
-                       // Store the hash back in request
-                       $this->getRequestInstance()->setRequestElement('pass_hash', $this->hashedPassword);
-               } // END - if
-       }
-}
-
-// [EOF]
-?>
diff --git a/application/admin/main/login/helper/.htaccess b/application/admin/main/login/helper/.htaccess
deleted file mode 100644 (file)
index 3a42882..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Deny from all
diff --git a/application/admin/main/login/helper/class_AdminLoginHelper.php b/application/admin/main/login/helper/class_AdminLoginHelper.php
deleted file mode 100644 (file)
index a70a6ac..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-<?php
-/**
- * A helper for administration area login. This login helper first checks what
- * setting (cookie or session) the admin has choosen then overwrites it with the
- * setting from current user. The registry instance should hold an instance of
- * this user class at key 'user' else an exception will be thrown. After this
- * the setting from a login form will be taken as login method and be stored
- * in database for later usage.
- *
- * The user shall be able to choose "Default login method" or similar to use his
- * own login method.
- *
- * @author             Roland Haeder <webmaster@shipsimu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 Admin-Area Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.shipsimu.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 AdminLoginHelper extends BaseLoginHelper implements HelpableLogin {
-       /**
-        * The login method we shall choose
-        */
-       private $authMethod = "";
-
-       // Exception constants
-       const EXCEPTION_INVALID_USER_INSTANCE = 0x190;
-
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       protected function __construct () {
-               // Call parent constructor
-               parent::__construct(__CLASS__);
-       }
-
-       /**
-        * Creates an instance of this class by given request instance
-        *
-        * @param       $requestInstance        An instance of a Requestable class
-        * @return      $helperInstance         An instance of this helper class
-        * @throws      UserInstanceMissingException    If the user instance in registry
-        *                                                                                      is missing or invalid
-        */
-       public static final function createAdminLoginHelper (Requestable $requestInstance) {
-               // Get a new instance first
-               $helperInstance = new AdminLoginHelper();
-
-               // Get a user instance from registry
-               $userInstance = Registry::getRegistry()->getInstance('user');
-
-               // Is this instance valid?
-               if (!$userInstance instanceof ManageableAccount) {
-                       // Thrown an exception here
-                       throw new UserInstanceMissingException (array($helperInstance, 'user'), self::EXCEPTION_INVALID_USER_INSTANCE);
-               } // END - if
-
-               // Set default login method from config
-               $helperInstance->setDefaultAuthMethod();
-
-               // Set request instance
-               $helperInstance->setRequestInstance($requestInstance);
-
-               // Return the prepared instance
-               return $helperInstance;
-       }
-
-       /**
-        * Setter for default login method from config
-        *
-        * @return      void
-        */
-       protected function setDefaultAuthMethod () {
-               $this->authMethod = $this->getConfigInstance()->getConfigEntry('auth_method_class');
-       }
-
-       /**
-        * Execute the login request by given response instance. This instance can
-        * be used for sending cookies or at least the session id out.
-        *
-        * @param       $responseInstance       An instance of a Responseable class
-        * @return      void
-        */
-       public function executeLogin (Responseable $responseInstance) {
-               // Get an instance from the login method
-               $loginInstance = ObjectFactory::createObjectByName($this->authMethod, array($responseInstance));
-
-               // Set user cookie
-               $loginInstance->setUserAuth($this->getRequestInstance()->getRequestElement('username'));
-
-               // Set password cookie
-               $loginInstance->setPasswordAuth($this->getRequestInstance()->getRequestElement('pass_hash'));
-
-               // Remember this login instance for later usage
-               Registry::getRegistry()->addInstance('login', $loginInstance);
-       }
-}
-
-//
-?>
diff --git a/application/admin/main/menu/.htaccess b/application/admin/main/menu/.htaccess
deleted file mode 100644 (file)
index 3a42882..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Deny from all
diff --git a/application/admin/main/menu/class_Admin b/application/admin/main/menu/class_Admin
deleted file mode 100644 (file)
index 031563b..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-<?php
-/**
- * A ??? menu class for Admin-Area
- *
- * @author             Roland Haeder <webmaster@ship-simu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 Admin-Area Developer Team
- * @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 Admin???Menu extends BaseMenu implements RenderableMenu {
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       protected function __construct () {
-               // Call parent constructor
-               parent::__construct(__CLASS__);
-       }
-
-       /**
-        * Creates an instance of this class
-        *
-        * @return      $menuInstance   An instance of this class
-        */
-       public final static function createAdmin???Menu () {
-               // Get a new instance
-               $menuInstance = new Admin???Menu();
-
-               // Return the prepared instance
-               return $menuInstance;
-       }
-}
-
-// [EOF]
-?>
diff --git a/application/admin/main/menu/class_AdminHomeMenu.php b/application/admin/main/menu/class_AdminHomeMenu.php
deleted file mode 100644 (file)
index 9ee6f3c..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-<?php
-/**
- * A Home menu class for Admin-Area
- *
- * @author             Roland Haeder <webmaster@shipsimu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 Admin-Area Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.shipsimu.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 AdminHomeMenu extends BaseMenu implements RenderableMenu {
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       protected function __construct () {
-               // Call parent constructor
-               parent::__construct(__CLASS__);
-       }
-
-       /**
-        * Creates an instance of this class
-        *
-        * @return      $menuInstance   An instance of this class
-        */
-       public static final function createAdminHomeMenu () {
-               // Get a new instance
-               $menuInstance = new AdminHomeMenu();
-
-               // Return the prepared instance
-               return $menuInstance;
-       }
-}
-
-// [EOF]
-?>
diff --git a/core b/core
index a0551c30b2e11aadba3f0513ef67c36ca7e60552..7bc4014657a70dedfc38b9b28d134aa7c3a6158c 160000 (submodule)
--- a/core
+++ b/core
@@ -1 +1 @@
-Subproject commit a0551c30b2e11aadba3f0513ef67c36ca7e60552
+Subproject commit 7bc4014657a70dedfc38b9b28d134aa7c3a6158c