User class is now configurable
authorRoland Häder <roland@mxchange.org>
Wed, 11 Jun 2008 17:58:37 +0000 (17:58 +0000)
committerRoland Häder <roland@mxchange.org>
Wed, 11 Jun 2008 17:58:37 +0000 (17:58 +0000)
application/ship-simu/main/login/class_ShipSimuUserLogin.php
inc/classes/main/filter/validator/class_EmailValidatorFilter.php
inc/classes/main/filter/validator/class_UserNameValidatorFilter.php
inc/config.php

index 3721fb65f2cb1c622bcf9b8de32086960e2ce23b..7caea517ce48879a22e73c06fc8020e6aceceacb 100644 (file)
@@ -89,7 +89,7 @@ class ShipSimuUserLogin extends BaseFrameworkSystem implements LoginableUser {
                if (is_null($method)) {
                        // Then abort here
                        throw new UserLoginMethodException($this, self::EXCEPTION_MISSING_METHOD);
-               } elseif (!method_exists("User", $method)) {
+               } elseif (!method_exists($this->getConfigInstance()->readConfig('user_class'), $method)) {
                        // The method is invalid!
                        throw new MissingMethodException(array($this, $method), self::EXCEPTION_MISSING_METHOD);
                }
@@ -100,7 +100,7 @@ class ShipSimuUserLogin extends BaseFrameworkSystem implements LoginableUser {
                // Is there an instance?
                if (is_null($userInstance)) {
                        // Get a user instance
-                       $userInstance = call_user_func_array(array("User", $method), array($data));
+                       $userInstance = call_user_func_array(array($this->getConfigInstance()->readConfig('user_class'), $method), array($data));
                } // END - if
 
                // If we have email login then check if a user account with that email exists!
index d7e9a2dd66e45807308a8263d2af1f316d00b8f2..a1276c88a3204b4c10c46f50a3095ad66ff5ef84 100644 (file)
@@ -157,7 +157,7 @@ class EmailValidatorFilter extends BaseFrameworkSystem implements Filterable {
                        $userInstance->setEmailAddress($email);
                } else {
                        // If this instance is created then the username *does* exist
-                       $userInstance = User::createUserByEmail($email);
+                       $userInstance = call_user_func_array(array($this->getConfigInstance()->readConfig('user_class'), "createUserByEmail"), array($email));
 
                        // Remember this user instance in our registry for later usage
                        $registry->addInstance('user', $userInstance);
index 6c531d26e9c4a8d60f05d704c5be0e6ad7d559e6..068f807754892d010b16ac14b559d5b47ef792b4 100644 (file)
@@ -125,7 +125,7 @@ class UserNameValidatorFilter extends BaseFrameworkSystem implements Filterable
                        // If this instance is created then the username *does* exist
                        try {
                                // Get a new instance
-                               $userInstance = User::createUserByUsername($userName);
+                               $userInstance = call_user_func_array(array($this->getConfigInstance()->readConfig('user_class'), "createUserByUsername"), array($userName));
 
                                // Remember this user instance in our registry for later usage
                                $registry->addInstance('user', $userInstance);
index be9058ae777f69a873481e74f7db46f66a764fea..d27057bfeeed6cc1f0389cd78336e63b64035e82 100644 (file)
@@ -215,5 +215,8 @@ $cfg->setConfigEntry('is_single_server', "Y");
 // CFG: POST-REGISTRATION-ACTION
 $cfg->setConfigEntry('post_registration_action', "LoginAfterRegistrationAction");
 
+// CFG: USER-CLASS
+$cfg->setConfigEntry('user_class', "User");
+
 // [EOF]
 ?>