From: Roland Häder Date: Wed, 11 Jun 2008 17:58:37 +0000 (+0000) Subject: User class is now configurable X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=807e2914df6484c7f371897ad8f5288b08bb2081;p=shipsimu.git User class is now configurable --- diff --git a/application/ship-simu/main/login/class_ShipSimuUserLogin.php b/application/ship-simu/main/login/class_ShipSimuUserLogin.php index 3721fb6..7caea51 100644 --- a/application/ship-simu/main/login/class_ShipSimuUserLogin.php +++ b/application/ship-simu/main/login/class_ShipSimuUserLogin.php @@ -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! diff --git a/inc/classes/main/filter/validator/class_EmailValidatorFilter.php b/inc/classes/main/filter/validator/class_EmailValidatorFilter.php index d7e9a2d..a1276c8 100644 --- a/inc/classes/main/filter/validator/class_EmailValidatorFilter.php +++ b/inc/classes/main/filter/validator/class_EmailValidatorFilter.php @@ -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); diff --git a/inc/classes/main/filter/validator/class_UserNameValidatorFilter.php b/inc/classes/main/filter/validator/class_UserNameValidatorFilter.php index 6c531d2..068f807 100644 --- a/inc/classes/main/filter/validator/class_UserNameValidatorFilter.php +++ b/inc/classes/main/filter/validator/class_UserNameValidatorFilter.php @@ -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); diff --git a/inc/config.php b/inc/config.php index be9058a..d27057b 100644 --- a/inc/config.php +++ b/inc/config.php @@ -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] ?>