* @copyright 2004 by http://www.gumnutsystems.com * @package wbSite * @subpackage extension */ /** * account module * - register new accounts and email activation password to user * - activate new users * - change password * * * @version 1.1.0 * @package wbSite * @subpackage extension */ class wbModule_Account extends wbModule { /** * some parameter * * Available parameter: * - email_from * - email_subject * - email_x-mailer * - part * - groups (comma seperated list of groups) () * - contact_src select where to grasp contact details from * * @access private * @var array $_params */ var $_params = array( 'email_from' => 'Usermanager ', 'email_subject' => 'Activate user account', 'part' => 'new', 'groups' => '', 'tmpldir' => 'module/Account', 'contact_src' => 'info' ); /** * display ... * * @access public * @return string $result html code of this part */ function getHtml() { $acc =& wbFactory::singleton( 'wbAccount' ); $acc->setTemplateDir( $this->_params['tmpldir'] ); $acc->setRequest( $this->_request ); $conf =& wbFactory::singleton( 'patConfiguration' ); // whose are standard groups? if( !empty( $this->_params['groups'] ) ) { $acc->setDefaultGroups( explode( ',', $this->_params['groups'] ) ); } else { $conf->loadConfig( 'user.xml' ); $config = $conf->getConfigValue(); if( isset( $config['default']['groups'] ) ) { $acc->setDefaultGroups( explode( ',', $config['default']['groups'] ) ); } $conf->clearConfigValue(); } // add contact details $conf->loadConfig( 'contact.xml' ); $contact = $conf->getConfigValue(); $conf->clearConfigValue(); $acc->setContactDetails( $contact['default'] ); $acc->setEmailHeader( 'from', $contact['default']['from'] ); if( isset( $contact[$this->_params['contact_src']] ) && !empty( $contact[$this->_params['contact_src']] ) ) { $acc->setContactDetails( $contact[$this->_params['contact_src']] ); if( isset( $contact[$this->_params['contact_src']]['from'] ) ) { $acc->setEmailHeader( 'from', $contact[$this->_params['contact_src']]['from'] ); } } // overwrite email header foreach( $this->_params as $key => $value ) { $keys = explode( '_', $key ); if( $keys[0] === 'email' && !empty( $keys[1] ) ) { $acc->setEmailHeader( $keys[1], $value ); } } switch( $this->_params['part'] ) { case 'manager': $result = $acc->processManager(); break; case 'edit': $result = $acc->editAccountData(); break; case 'password': $result = $acc->changePassword(); break; case 'forgot': $result = $acc->renewPassword(); break; case 'activate': $result = $acc->activateAccount(); break; case 'new': default: $result = $acc->registerUser(); break; } return $result; } } ?>