From: Roland Häder Date: Tue, 1 Jul 2008 08:33:53 +0000 (+0000) Subject: User class renamed to Member and it's interface X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=8ba5a30e52e7cd8adb76f675ab3f7129a60819e3;p=shipsimu.git User class renamed to Member and it's interface --- 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_ManageableMember.php b/inc/classes/interfaces/user/extended/class_ManageableMember.php new file mode 100644 index 0000000..db33c63 --- /dev/null +++ b/inc/classes/interfaces/user/extended/class_ManageableMember.php @@ -0,0 +1,28 @@ + + * @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 . + */ +interface ManageableMember extends ManageableAccount { +} + +// +?> diff --git a/inc/classes/interfaces/user/extended/class_ManageableUser.php b/inc/classes/interfaces/user/extended/class_ManageableUser.php deleted file mode 100644 index a236103..0000000 --- a/inc/classes/interfaces/user/extended/class_ManageableUser.php +++ /dev/null @@ -1,28 +0,0 @@ - - * @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 . - */ -interface ManageableUser 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/member/.htaccess b/inc/classes/main/user/member/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/classes/main/user/member/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/main/user/member/class_Member.php b/inc/classes/main/user/member/class_Member.php new file mode 100644 index 0000000..1cf97e9 --- /dev/null +++ b/inc/classes/main/user/member/class_Member.php @@ -0,0 +1,202 @@ + + * @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 . + */ +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 + * + * @param $className Name of the class + * @return void + */ + protected function __construct ($className = "") { + // Is the class name empty? Then this is not a specialized user class + if (empty($className)) $className = __CLASS__; + + // Call parent constructor + parent::__construct($className); + + // Set part description + $this->setObjectDescription("Generic user class"); + + // Create unique ID number + $this->generateUniqueId(); + } + + /** + * Destructor to always flush updates + * + * @return void + */ + public function __destruct () { + // Flush any updated entries to the database + $this->flushPendingUpdates(); + + // Call parent destructor + parent::__destruct(); + } + + /** + * Creates an instance of this user class by a provided username. This + * factory method will check if the username is already taken and if not + * so it will throw an exception. + * + * @param $userName Username we need a class instance for + * @return $userInstance An instance of this user class + * @throws UsernameMissingException If the username does not exist + */ + public final static function createUserByUsername ($userName) { + // Get a new instance + $userInstance = new Member(); + + // Set the username + $userInstance->setUserName($userName); + + // Check if the username exists + if (!$userInstance->ifUsernameExists()) { + // Throw an exception here + throw new UsernameMissingException(array($userInstance, $userName), self::EXCEPTION_USERNAME_NOT_FOUND); + } + + // Return the instance + return $userInstance; + } + + /** + * Creates an instance of this user class by a provided email address. This + * factory method will not check if the email address is there. + * + * @param $email Email address of the user + * @return $userInstance An instance of this user class + */ + public final static function createUserByEmail ($email) { + // Get a new instance + $userInstance = new Member(); + + // Set the username + $userInstance->setEmail($email); + + // Return the instance + return $userInstance; + } + + /** + * Creates a user by a given request instance + * + * @param $requestInstance An instance of a Requestable class + * @return $userInstance An instance of this user class + */ + public final static function createUserByRequest (Requestable $requestInstance) { + // Determine if by email or username + if (!is_null($requestInstance->getRequestElement('username'))) { + // Username supplied + $userInstance = self::createUserByUserName($requestInstance->getRequestElement('username')); + } elseif (!is_null($requestInstance->getRequestElement('email'))) { + // Email supplied + $userInstance = self::createUserByEmail($requestInstance->getRequestElement('email')); + } else { + // Unsupported mode + $userInstance = new Member(); + $userInstance->partialStub("We need to add more ways of creating user classes here."); + $userInstance->debugBackTrace(); + exit(); + } + + // Return the prepared instance + return $userInstance; + } + + /** + * Adds data for later complete update + * + * @param $column Column we want to update + * @param $value New value to store in database + * @return void + * @deprecated + */ + public function addUpdateData ($column, $value) { + $this->deprecatedMethod("Please use updateDatabaseField() instead!"); + $this->updateDatabaseField($column, $value); + } + + /** + * Updates the last activity timestamp and last performed action in the + * database result. You should call flushPendingUpdates() to flush these updates + * to the database layer. + * + * @param $requestInstance A requestable class instance + * @return void + */ + public function updateLastActivity (Requestable $requestInstance) { + // Set last action + $lastAction = $requestInstance->getRequestElement('action'); + + // If there is no action use the default on + if (is_null($lastAction)) { + $lastAction = $this->getConfigInstance()->readConfig('login_default_action'); + } // END - if + + // Get a critieria instance + $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); + + // Add search criteria + $searchInstance->addCriteria(UserDatabaseWrapper::DB_COLUMN_USERNAME, $this->getUserName()); + $searchInstance->setLimit(1); + + // Now get another criteria + $updateInstance = ObjectFactory::createObjectByConfiguredName('update_criteria_class'); + + // And add our both entries + $updateInstance->addCriteria('last_activity', date("Y-m-d H:i:s", time())); + $updateInstance->addCriteria('last_action', $lastAction); + + // Add the search criteria for searching for the right entry + $updateInstance->setSearchInstance($searchInstance); + + // Remember the update in database result + $this->getResultInstance()->add2UpdateQueue($updateInstance); + } + + /** + * Flushs all pending updates to the database layer + * + * @return void + */ + public function flushPendingUpdates () { + // Do we have data to update? + if ($this->getResultInstance()->ifDataNeedsFlush()) { + // Get a database wrapper + $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_db_wrapper_class'); + + // Yes, then send the whole result to the database layer + $wrapperInstance->doUpdateByResult($this->getResultInstance()); + } // END - if + } +} + +// [EOF] +?> diff --git a/inc/classes/main/user/user/.htaccess b/inc/classes/main/user/user/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/inc/classes/main/user/user/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/inc/classes/main/user/user/class_User.php b/inc/classes/main/user/user/class_User.php deleted file mode 100644 index 6b0491d..0000000 --- a/inc/classes/main/user/user/class_User.php +++ /dev/null @@ -1,202 +0,0 @@ - - * @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 . - */ -class User extends BaseUser implements ManageableUser, 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 - * - * @param $className Name of the class - * @return void - */ - protected function __construct ($className = "") { - // Is the class name empty? Then this is not a specialized user class - if (empty($className)) $className = __CLASS__; - - // Call parent constructor - parent::__construct($className); - - // Set part description - $this->setObjectDescription("Generic user class"); - - // Create unique ID number - $this->generateUniqueId(); - } - - /** - * Destructor to always flush updates - * - * @return void - */ - public function __destruct () { - // Flush any updated entries to the database - $this->flushPendingUpdates(); - - // Call parent destructor - parent::__destruct(); - } - - /** - * Creates an instance of this user class by a provided username. This - * factory method will check if the username is already taken and if not - * so it will throw an exception. - * - * @param $userName Username we need a class instance for - * @return $userInstance An instance of this user class - * @throws UsernameMissingException If the username does not exist - */ - public final static function createUserByUsername ($userName) { - // Get a new instance - $userInstance = new User(); - - // Set the username - $userInstance->setUserName($userName); - - // Check if the username exists - if (!$userInstance->ifUsernameExists()) { - // Throw an exception here - throw new UsernameMissingException(array($userInstance, $userName), self::EXCEPTION_USERNAME_NOT_FOUND); - } - - // Return the instance - return $userInstance; - } - - /** - * Creates an instance of this user class by a provided email address. This - * factory method will not check if the email address is there. - * - * @param $email Email address of the user - * @return $userInstance An instance of this user class - */ - public final static function createUserByEmail ($email) { - // Get a new instance - $userInstance = new User(); - - // Set the username - $userInstance->setEmail($email); - - // Return the instance - return $userInstance; - } - - /** - * Creates a user by a given request instance - * - * @param $requestInstance An instance of a Requestable class - * @return $userInstance An instance of this user class - */ - public final static function createUserByRequest (Requestable $requestInstance) { - // Determine if by email or username - if (!is_null($requestInstance->getRequestElement('username'))) { - // Username supplied - $userInstance = self::createUserByUserName($requestInstance->getRequestElement('username')); - } elseif (!is_null($requestInstance->getRequestElement('email'))) { - // Email supplied - $userInstance = self::createUserByEmail($requestInstance->getRequestElement('email')); - } else { - // Unsupported mode - $userInstance = new User(); - $userInstance->partialStub("We need to add more ways of creating user classes here."); - $userInstance->debugBackTrace(); - exit(); - } - - // Return the prepared instance - return $userInstance; - } - - /** - * Adds data for later complete update - * - * @param $column Column we want to update - * @param $value New value to store in database - * @return void - * @deprecated - */ - public function addUpdateData ($column, $value) { - $this->deprecatedMethod("Please use updateDatabaseField() instead!"); - $this->updateDatabaseField($column, $value); - } - - /** - * Updates the last activity timestamp and last performed action in the - * database result. You should call flushPendingUpdates() to flush these updates - * to the database layer. - * - * @param $requestInstance A requestable class instance - * @return void - */ - public function updateLastActivity (Requestable $requestInstance) { - // Set last action - $lastAction = $requestInstance->getRequestElement('action'); - - // If there is no action use the default on - if (is_null($lastAction)) { - $lastAction = $this->getConfigInstance()->readConfig('login_default_action'); - } // END - if - - // Get a critieria instance - $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); - - // Add search criteria - $searchInstance->addCriteria(UserDatabaseWrapper::DB_COLUMN_USERNAME, $this->getUserName()); - $searchInstance->setLimit(1); - - // Now get another criteria - $updateInstance = ObjectFactory::createObjectByConfiguredName('update_criteria_class'); - - // And add our both entries - $updateInstance->addCriteria('last_activity', date("Y-m-d H:i:s", time())); - $updateInstance->addCriteria('last_action', $lastAction); - - // Add the search criteria for searching for the right entry - $updateInstance->setSearchInstance($searchInstance); - - // Remember the update in database result - $this->getResultInstance()->add2UpdateQueue($updateInstance); - } - - /** - * Flushs all pending updates to the database layer - * - * @return void - */ - public function flushPendingUpdates () { - // Do we have data to update? - if ($this->getResultInstance()->ifDataNeedsFlush()) { - // Get a database wrapper - $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_db_wrapper_class'); - - // Yes, then send the whole result to the database layer - $wrapperInstance->doUpdateByResult($this->getResultInstance()); - } // END - if - } -} - -// [EOF] -?> 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");