application/ship-simu/main/structures/extended/lower/.htaccess -text
application/ship-simu/main/structures/extended/upper/.htaccess -text
application/ship-simu/main/structures/extended/upper/class_Bridge.php -text
+application/ship-simu/main/user/.htaccess -text
+application/ship-simu/main/user/class_ShipSimuGuest.php -text
+application/ship-simu/main/user/class_ShipSimuMember.php -text
application/ship-simu/main/wrapper/.htaccess -text
application/ship-simu/main/wrapper/class_CompanyDatabaseWrapper.php -text
application/ship-simu/starter.php -text
application/ship-simu/templates/images/de/image/code_captcha.itp -text
/clear-cache.sh -text
db/.htaccess -text
+db/company_user/.htaccess -text
db/news/.htaccess -text
db/user/.htaccess -text
devel/.htaccess -text
// CFG: ADMIN-EMAIL
$cfg->setConfigEntry('admin_email', "you@some-hoster.invalid");
+// CFG: USER-CLASS
+$cfg->setConfigEntry('user_class', "ShipSimuMember");
+
+// CFG: GUEST-CLASS
+$cfg->setConfigEntry('guest_class', "ShipSimuGuest");
+
// [EOF]
?>
// Detect login method (username or email) and try to get a userinstance
if (!is_null($requestInstance->getRequestElement('user'))) {
// Username found!
- $method = "createGuestByUsername";
+ $method = 'createGuestByUsername';
$data = $requestInstance->getRequestElement('user');
- }
+ } // END - if
// Is a method detected?
if (is_null($method)) {
// Is there an instance?
if (is_null($userInstance)) {
// Get a user instance
- $userInstance = Member::createUserByRequest($requestInstance);
+ $userInstance = Member::createMemberByRequest($requestInstance);
// Remember this new instance in registry
Registry::getRegistry()->addInstance($userInstance);
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A special guest class for Ship-Simu!
+ *
+ * @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 ShipSimuGuest extends Guest {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Set part description
+ $this->setObjectDescription("Special guest class for Ship-Simu");
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A special member class for Ship-Simu!
+ *
+ * @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 ShipSimuMember extends Member {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Set part description
+ $this->setObjectDescription("Special member class for Ship-Simu");
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
* @return void
* @throws UserAuthorizationException If the auth login was not found or if it was invalid
* @throws UserPasswordMismatchException If the supplied password hash does not match
+ * @throws ClassNotFoundException If the user (guest/member) class was not found
*/
public function execute (Requestable $requestInstance, Responseable $responseInstance) {
// Then get an auth instance for checking and updating the auth cookies
// Now, try to get a user or guest instance
if ($authLogin == $this->getConfigInstance()->readConfig('guest_login_user')) {
- // Guest login!
- $userInstance = Guest::createGuestByUserName($authLogin);
+ // Set class
+ $className = $this->getConfigInstance()->readConfig('guest_class');
+ $methodName = 'createGuestByUserName';
} else {
// Regular user account
- $userInstance = Member::createUserByUserName($authLogin);
+ $className = $this->getConfigInstance()->readConfig('user_class');
+ $methodName = 'createMemberByUserName';
}
+ // Does the guest class exist?
+ if (!class_exists($className)) {
+ // Then abort here
+ throw new ClassNotFoundException (array($this, $className), self::EXCEPTION_CLASS_NOT_FOUND);
+ } // END - if
+
+ // Now try the dynamic login
+ $userInstance = call_user_func_array(array($className, $methodName), array($authLogin));
+
// Is the password correct?
if ($userInstance->getPasswordHash() !== $authHash) {
// Mismatching password
$userInstance->setEmailAddress($email);
} else {
// If this instance is created then the username *does* exist
- $userInstance = call_user_func_array(array($this->getConfigInstance()->readConfig('user_class'), "createUserByEmail"), array($email));
+ $userInstance = call_user_func_array(array($this->getConfigInstance()->readConfig('user_class'), 'createMemberByEmail'), array($email));
// Remember this user instance in our registry for later usage
$registry->addInstance('user', $userInstance);
// If this instance is created then the username *does* exist
try {
// Get a new instance
- $userInstance = call_user_func_array(array($this->getConfigInstance()->readConfig('user_class'), "createUserByUsername"), array($userName));
+ $userInstance = call_user_func_array(array($this->getConfigInstance()->readConfig('user_class'), 'createMemberByUsername'), array($userName));
// Remember this user instance in our registry for later usage
$registry->addInstance('user', $userInstance);
$userInstance->setEmailAddress($email);
} else {
// If this instance is created then the username *does* exist
- $userInstance = call_user_func_array(array($this->getConfigInstance()->readConfig('user_class'), "createUserByEmail"), array($email));
+ $userInstance = call_user_func_array(array($this->getConfigInstance()->readConfig('user_class'), 'createMemberByEmail'), array($email));
// Remember this user instance in our registry for later usage
$registry->addInstance('user', $userInstance);
// If this instance is created then the username *does* exist
try {
// Get a new instance
- $userInstance = call_user_func_array(array($this->getConfigInstance()->readConfig('guest_class'), "createGuestByUsername"), array($userName));
+ $userInstance = call_user_func_array(array($this->getConfigInstance()->readConfig('guest_class'), 'createGuestByUsername'), array($userName));
// Remember this user instance in our registry for later usage
$registry->addInstance('user', $userInstance);
// If this instance is created then the username *does* exist
try {
// Get a new instance
- $userInstance = call_user_func_array(array($this->getConfigInstance()->readConfig('user_class'), "createUserByUsername"), array($userName));
+ $userInstance = call_user_func_array(array($this->getConfigInstance()->readConfig('user_class'), 'createMemberByUsername'), array($userName));
// Remember this user instance in our registry for later usage
$registry->addInstance('user', $userInstance);
if ((is_null($userInstance)) || (!$userInstance->ifUsernameExists())) {
// This username is still available
$alreadyTaken = false;
- }
+ } // END - if
// Return the result
return $alreadyTaken;
*/
public function execute (Requestable $requestInstance, Responseable $responseInstance) {
// Get a user instance for comparison
- $userInstance = Member::createUserByRequest($requestInstance);
+ $userInstance = Member::createMemberByRequest($requestInstance);
// Is the email address valid?
if (!$userInstance->ifEmailAddressExists()) {
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class BaseUser extends BaseFrameworkSystem {
+ // Exception constances
+ const EXCEPTION_USERNAME_NOT_FOUND = 0x150;
+ const EXCEPTION_USER_EMAIL_NOT_FOUND = 0x151;
+ const EXCEPTION_USER_PASS_MISMATCH = 0x152;
+
/**
* Username of current user
*/
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class Member extends BaseUser implements ManageableMember, Registerable, Updateable {
- // Exception constances
- const EXCEPTION_USERNAME_NOT_FOUND = 0x150;
- const EXCEPTION_USER_EMAIL_NOT_FOUND = 0x151;
- const EXCEPTION_USER_PASS_MISMATCH = 0x152;
-
/**
* Protected constructor
*
* @return $userInstance An instance of this user class
* @throws UsernameMissingException If the username does not exist
*/
- public final static function createUserByUsername ($userName) {
+ public final static function createMemberByUsername ($userName) {
// Get a new instance
$userInstance = new Member();
* @param $email Email address of the user
* @return $userInstance An instance of this user class
*/
- public final static function createUserByEmail ($email) {
+ public final static function createMemberByEmail ($email) {
// Get a new instance
$userInstance = new Member();
* @param $requestInstance An instance of a Requestable class
* @return $userInstance An instance of this user class
*/
- public final static function createUserByRequest (Requestable $requestInstance) {
+ public final static function createMemberByRequest (Requestable $requestInstance) {
// Determine if by email or username
if (!is_null($requestInstance->getRequestElement('username'))) {
// Username supplied
- $userInstance = self::createUserByUserName($requestInstance->getRequestElement('username'));
+ $userInstance = self::createMemberByUserName($requestInstance->getRequestElement('username'));
} elseif (!is_null($requestInstance->getRequestElement('email'))) {
// Email supplied
- $userInstance = self::createUserByEmail($requestInstance->getRequestElement('email'));
+ $userInstance = self::createMemberByEmail($requestInstance->getRequestElement('email'));
} else {
// Unsupported mode
$userInstance = new Member();