From 8ba5a30e52e7cd8adb76f675ab3f7129a60819e3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 1 Jul 2008 08:33:53 +0000 Subject: [PATCH] User class renamed to Member and it's interface --- .gitattributes | 6 +++--- .../ship-simu/main/companies/class_ShippingCompany.php | 4 ++-- .../ship-simu/main/login/class_ShipSimuGuestLogin.php | 2 +- .../ship-simu/main/login/class_ShipSimuUserLogin.php | 4 ++-- .../main/wrapper/class_CompanyDatabaseWrapper.php | 2 +- inc/classes/interfaces/mailer/class_DeliverableMail.php | 2 +- ...lass_ManageableUser.php => class_ManageableMember.php} | 2 +- inc/classes/main/commands/web/class_WebHomeCommand.php | 3 +++ .../main/commands/web/class_WebResendLinkCommand.php | 8 ++++---- inc/classes/main/filter/auth/class_UserAuthFilter.php | 4 ++-- .../verifier/class_AccountPasswordVerifierFilter.php | 2 +- .../verifier/class_UserUnconfirmedVerifierFilter.php | 2 +- inc/classes/main/mailer/class_BaseMailer.php | 2 +- inc/classes/main/mailer/debug/class_DebugMailer.php | 2 +- inc/classes/main/user/{user => member}/.htaccess | 0 .../user/{user/class_User.php => member/class_Member.php} | 8 ++++---- inc/config.php | 2 +- 17 files changed, 29 insertions(+), 26 deletions(-) rename inc/classes/interfaces/user/extended/{class_ManageableUser.php => class_ManageableMember.php} (94%) rename inc/classes/main/user/{user => member}/.htaccess (100%) rename inc/classes/main/user/{user/class_User.php => member/class_Member.php} (97%) diff --git a/.gitattributes b/.gitattributes index 4c2153b..2084758 100644 --- a/.gitattributes +++ b/.gitattributes @@ -417,7 +417,7 @@ inc/classes/interfaces/user/.htaccess -text inc/classes/interfaces/user/class_ManageableAccount.php -text inc/classes/interfaces/user/extended/.htaccess -text inc/classes/interfaces/user/extended/class_ManageableGuest.php -text -inc/classes/interfaces/user/extended/class_ManageableUser.php -text +inc/classes/interfaces/user/extended/class_ManageableMember.php -text inc/classes/main/.htaccess -text inc/classes/main/actions/.htaccess -text inc/classes/main/actions/class_ -text @@ -630,8 +630,8 @@ inc/classes/main/user/.htaccess -text inc/classes/main/user/class_BaseUser.php -text inc/classes/main/user/guest/.htaccess -text inc/classes/main/user/guest/class_Guest.php -text -inc/classes/main/user/user/.htaccess -text -inc/classes/main/user/user/class_User.php -text +inc/classes/main/user/member/.htaccess -text +inc/classes/main/user/member/class_Member.php -text inc/classes/middleware/.htaccess -text inc/classes/middleware/class_BaseMiddleware.php -text inc/classes/middleware/compressor/.htaccess -text diff --git a/application/ship-simu/main/companies/class_ShippingCompany.php b/application/ship-simu/main/companies/class_ShippingCompany.php index a7f12ef..1eef86b 100644 --- a/application/ship-simu/main/companies/class_ShippingCompany.php +++ b/application/ship-simu/main/companies/class_ShippingCompany.php @@ -91,7 +91,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner * @param $userInstance A user class * @return $companyInstance Prepared company instance */ - public final static function createShippingCompany (BaseUser $userInstance) { + public final static function createShippingCompany (ManageableAccount $userInstance) { // Get new instance $companyInstance = new ShippingCompany(); @@ -115,7 +115,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner * @param $userInstance An instance of a user class * @return $participates Wether the user participates at lease in one company */ - protected function ifUserParticipatesInCompany (BaseUser $userInstance) { + protected function ifUserParticipatesInCompany (ManageableAccount $userInstance) { // By default no user owns any company... ;) $participates = false; diff --git a/application/ship-simu/main/login/class_ShipSimuGuestLogin.php b/application/ship-simu/main/login/class_ShipSimuGuestLogin.php index f57cdee..b59eb2b 100644 --- a/application/ship-simu/main/login/class_ShipSimuGuestLogin.php +++ b/application/ship-simu/main/login/class_ShipSimuGuestLogin.php @@ -111,7 +111,7 @@ class ShipSimuGuestLogin extends BaseFrameworkSystem implements LoginableUser { // Is the password correct? if (!$userInstance->ifPasswordHashMatches($requestInstance)) { // Mismatching password - throw new UserPasswordMismatchException(array($this, $userInstance), User::EXCEPTION_USER_PASS_MISMATCH); + throw new UserPasswordMismatchException(array($this, $userInstance), BaseUser::EXCEPTION_USER_PASS_MISMATCH); } // END - if // Now do the real login. This can be cookie- or session-based login diff --git a/application/ship-simu/main/login/class_ShipSimuUserLogin.php b/application/ship-simu/main/login/class_ShipSimuUserLogin.php index 0a0c944..367103c 100644 --- a/application/ship-simu/main/login/class_ShipSimuUserLogin.php +++ b/application/ship-simu/main/login/class_ShipSimuUserLogin.php @@ -85,7 +85,7 @@ class ShipSimuUserLogin extends BaseFrameworkSystem implements LoginableUser { // Is there an instance? if (is_null($userInstance)) { // Get a user instance - $userInstance = User::createUserByRequest($requestInstance); + $userInstance = Member::createUserByRequest($requestInstance); // Remember this new instance in registry Registry::getRegistry()->addInstance($userInstance); @@ -94,7 +94,7 @@ class ShipSimuUserLogin extends BaseFrameworkSystem implements LoginableUser { // Is the password correct? if (!$userInstance->ifPasswordHashMatches($requestInstance)) { // Mismatching password - throw new UserPasswordMismatchException(array($this, $userInstance), User::EXCEPTION_USER_PASS_MISMATCH); + throw new UserPasswordMismatchException(array($this, $userInstance), BaseUser::EXCEPTION_USER_PASS_MISMATCH); } // END - if // ToDo place diff --git a/application/ship-simu/main/wrapper/class_CompanyDatabaseWrapper.php b/application/ship-simu/main/wrapper/class_CompanyDatabaseWrapper.php index b49b1d0..80bb037 100644 --- a/application/ship-simu/main/wrapper/class_CompanyDatabaseWrapper.php +++ b/application/ship-simu/main/wrapper/class_CompanyDatabaseWrapper.php @@ -64,7 +64,7 @@ class CompanyDatabaseWrapper extends BaseDatabaseWrapper { * @param $userInstance An instance of a user class * @return $participates Wether the user participates at lease in one company */ - public function ifUserParticipatesInCompany (BaseUser $userInstance) { + public function ifUserParticipatesInCompany (ManageableAccount $userInstance) { // By default no user owns any company... ;) $participates = false; diff --git a/inc/classes/interfaces/mailer/class_DeliverableMail.php b/inc/classes/interfaces/mailer/class_DeliverableMail.php index 675254d..7e04204 100644 --- a/inc/classes/interfaces/mailer/class_DeliverableMail.php +++ b/inc/classes/interfaces/mailer/class_DeliverableMail.php @@ -28,7 +28,7 @@ interface DeliverableMail extends FrameworkInterface { * @param $userInstance An instance of a user class * @return void */ - function addRecipientByUserInstance (ManageableUser $userInstance); + function addRecipientByUserInstance (ManageableMember $userInstance); /** * Use subject line provided by the (XML) template otherwise a subject line must be set diff --git a/inc/classes/interfaces/user/extended/class_ManageableUser.php b/inc/classes/interfaces/user/extended/class_ManageableMember.php similarity index 94% rename from inc/classes/interfaces/user/extended/class_ManageableUser.php rename to inc/classes/interfaces/user/extended/class_ManageableMember.php index a236103..db33c63 100644 --- a/inc/classes/interfaces/user/extended/class_ManageableUser.php +++ b/inc/classes/interfaces/user/extended/class_ManageableMember.php @@ -21,7 +21,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -interface ManageableUser extends ManageableAccount { +interface ManageableMember extends ManageableAccount { } // diff --git a/inc/classes/main/commands/web/class_WebHomeCommand.php b/inc/classes/main/commands/web/class_WebHomeCommand.php index 572d71d..577968e 100644 --- a/inc/classes/main/commands/web/class_WebHomeCommand.php +++ b/inc/classes/main/commands/web/class_WebHomeCommand.php @@ -72,6 +72,9 @@ class WebHomeCommand extends BaseCommand implements Commandable { // Prepare a template instance $templateInstance = $this->prepareTemplateInstance($appInstance); + // Transfer application data + $templateInstance->assignApplicationData($appInstance); + // Load the master template $masterTemplate = $appInstance->getMasterTemplate(); diff --git a/inc/classes/main/commands/web/class_WebResendLinkCommand.php b/inc/classes/main/commands/web/class_WebResendLinkCommand.php index fda4669..3c69b34 100644 --- a/inc/classes/main/commands/web/class_WebResendLinkCommand.php +++ b/inc/classes/main/commands/web/class_WebResendLinkCommand.php @@ -64,16 +64,16 @@ class WebResendLinkCommand extends BaseCommand implements Commandable { * @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 InvalidInterfaceException If the user class does not implement ManageableUser + * @throws InvalidInterfaceException If the user class does not implement ManageableMember */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { // Get user instance from registry $userInstance = Registry::getRegistry()->getInstance('user'); - // Does the user instance implement ManageableUser? - if (!$userInstance instanceof ManageableUser) { + // Does the user instance implement ManageableMember? + if (!$userInstance instanceof ManageableMember) { // Throw exception here - throw new InvalidInterfaceException(array($userInstance, 'ManageableUser'), self::EXCEPTION_REQUIRED_INTERFACE_MISSING); + throw new InvalidInterfaceException(array($userInstance, 'ManageableMember'), self::EXCEPTION_REQUIRED_INTERFACE_MISSING); } // END - if // Get an application instance diff --git a/inc/classes/main/filter/auth/class_UserAuthFilter.php b/inc/classes/main/filter/auth/class_UserAuthFilter.php index 1ef8045..25641dc 100644 --- a/inc/classes/main/filter/auth/class_UserAuthFilter.php +++ b/inc/classes/main/filter/auth/class_UserAuthFilter.php @@ -112,13 +112,13 @@ class UserAuthFilter extends BaseFilter implements Filterable { $userInstance = Guest::createGuestByUserName($authLogin); } else { // Regular user account - $userInstance = User::createUserByUserName($authLogin); + $userInstance = Member::createUserByUserName($authLogin); } // Is the password correct? if ($userInstance->getPasswordHash() !== $authHash) { // Mismatching password - throw new UserPasswordMismatchException(array($this, $userInstance), User::EXCEPTION_USER_PASS_MISMATCH); + throw new UserPasswordMismatchException(array($this, $userInstance), BaseUser::EXCEPTION_USER_PASS_MISMATCH); } // END - if // Remember auth and user instances in registry diff --git a/inc/classes/main/filter/verifier/class_AccountPasswordVerifierFilter.php b/inc/classes/main/filter/verifier/class_AccountPasswordVerifierFilter.php index 7f3bc69..f28d181 100644 --- a/inc/classes/main/filter/verifier/class_AccountPasswordVerifierFilter.php +++ b/inc/classes/main/filter/verifier/class_AccountPasswordVerifierFilter.php @@ -97,7 +97,7 @@ class AccountPasswordVerifierFilter extends BaseFilter implements Filterable { // Does it match? if ($oldHash != $passHash) { // Throw an exception here to stop the proccessing - throw new AccountPasswordMismatchException($this, User::EXCEPTION_USER_PASS_MISMATCH); + throw new AccountPasswordMismatchException($this, BaseUser::EXCEPTION_USER_PASS_MISMATCH); } // END - if } } diff --git a/inc/classes/main/filter/verifier/class_UserUnconfirmedVerifierFilter.php b/inc/classes/main/filter/verifier/class_UserUnconfirmedVerifierFilter.php index d65ca74..d9a11d9 100644 --- a/inc/classes/main/filter/verifier/class_UserUnconfirmedVerifierFilter.php +++ b/inc/classes/main/filter/verifier/class_UserUnconfirmedVerifierFilter.php @@ -60,7 +60,7 @@ class UserUnconfirmedVerifierFilter extends BaseFrameworkSystem implements Filte */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { // Get a user instance for comparison - $userInstance = User::createUserByRequest($requestInstance); + $userInstance = Member::createUserByRequest($requestInstance); // Is the email address valid? if (!$userInstance->ifEmailAddressExists()) { diff --git a/inc/classes/main/mailer/class_BaseMailer.php b/inc/classes/main/mailer/class_BaseMailer.php index 2dcbd93..4230fbc 100644 --- a/inc/classes/main/mailer/class_BaseMailer.php +++ b/inc/classes/main/mailer/class_BaseMailer.php @@ -70,7 +70,7 @@ class BaseMailer extends BaseFrameworkSystem { * @param $userInstance An instance of a user class * @return void */ - public function addRecipientByUserInstance (ManageableUser $userInstance) { + public function addRecipientByUserInstance (ManageableMember $userInstance) { // Get template name $templateName = $this->getTemplateName(); diff --git a/inc/classes/main/mailer/debug/class_DebugMailer.php b/inc/classes/main/mailer/debug/class_DebugMailer.php index 6a93267..9e2aea1 100644 --- a/inc/classes/main/mailer/debug/class_DebugMailer.php +++ b/inc/classes/main/mailer/debug/class_DebugMailer.php @@ -78,7 +78,7 @@ class DebugMailer extends BaseMailer implements DeliverableMail { // Walk through all recipients and "sent", or better print, it out foreach ($recipientList['recipients'] as $recipientInstance) { // The recipient should be a user instance, right? - if ($recipientInstance instanceof ManageableUser) { + if ($recipientInstance instanceof ManageableMember) { // User class found, so entry is valid, first load the template $this->loadTemplate($templateName); diff --git a/inc/classes/main/user/user/.htaccess b/inc/classes/main/user/member/.htaccess similarity index 100% rename from inc/classes/main/user/user/.htaccess rename to inc/classes/main/user/member/.htaccess diff --git a/inc/classes/main/user/user/class_User.php b/inc/classes/main/user/member/class_Member.php similarity index 97% rename from inc/classes/main/user/user/class_User.php rename to inc/classes/main/user/member/class_Member.php index 6b0491d..1cf97e9 100644 --- a/inc/classes/main/user/user/class_User.php +++ b/inc/classes/main/user/member/class_Member.php @@ -21,7 +21,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class User extends BaseUser implements ManageableUser, Registerable, Updateable { +class Member extends BaseUser implements ManageableMember, Registerable, Updateable { // Exception constances const EXCEPTION_USERNAME_NOT_FOUND = 0x150; const EXCEPTION_USER_EMAIL_NOT_FOUND = 0x151; @@ -71,7 +71,7 @@ class User extends BaseUser implements ManageableUser, Registerable, Updateable */ public final static function createUserByUsername ($userName) { // Get a new instance - $userInstance = new User(); + $userInstance = new Member(); // Set the username $userInstance->setUserName($userName); @@ -95,7 +95,7 @@ class User extends BaseUser implements ManageableUser, Registerable, Updateable */ public final static function createUserByEmail ($email) { // Get a new instance - $userInstance = new User(); + $userInstance = new Member(); // Set the username $userInstance->setEmail($email); @@ -120,7 +120,7 @@ class User extends BaseUser implements ManageableUser, Registerable, Updateable $userInstance = self::createUserByEmail($requestInstance->getRequestElement('email')); } else { // Unsupported mode - $userInstance = new User(); + $userInstance = new Member(); $userInstance->partialStub("We need to add more ways of creating user classes here."); $userInstance->debugBackTrace(); exit(); diff --git a/inc/config.php b/inc/config.php index ec15729..e49f94b 100644 --- a/inc/config.php +++ b/inc/config.php @@ -261,7 +261,7 @@ $cfg->setConfigEntry('is_single_server', "Y"); $cfg->setConfigEntry('post_registration_class', "LoginAfterRegistrationAction"); // CFG: USER-CLASS -$cfg->setConfigEntry('user_class', "User"); +$cfg->setConfigEntry('user_class', "Member"); // CFG: GUEST-CLASS $cfg->setConfigEntry('guest_class', "Guest"); -- 2.39.2