当前位置: 首页>>代码示例>>PHP>>正文


PHP UserController::_sendMail方法代码示例

本文整理汇总了PHP中UserController::_sendMail方法的典型用法代码示例。如果您正苦于以下问题:PHP UserController::_sendMail方法的具体用法?PHP UserController::_sendMail怎么用?PHP UserController::_sendMail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserController的用法示例。


在下文中一共展示了UserController::_sendMail方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: register_save

 /**
  * Save user registration and notify users and admins if required
  * @return void
  */
 function register_save()
 {
     global $mainframe;
     // Check for request forgeries
     JRequest::checkToken() or jexit('Invalid Token');
     // Get required system objects
     $user = clone JFactory::getUser();
     $pathway =& $mainframe->getPathway();
     $config =& JFactory::getConfig();
     $authorize =& JFactory::getACL();
     $document =& JFactory::getDocument();
     // If user registration is not allowed, show 403 not authorized.
     $usersConfig =& JComponentHelper::getParams('com_users');
     if ($usersConfig->get('allowUserRegistration') == '0') {
         JError::raiseError(403, JText::_('Access Forbidden'));
         return;
     }
     // Initialize new usertype setting
     $newUsertype = $usersConfig->get('new_usertype');
     if (!$newUsertype) {
         $newUsertype = 'Registered';
     }
     // Bind the post array to the user object
     if (!$user->bind(JRequest::get('post'), 'usertype')) {
         JError::raiseError(500, $user->getError());
     }
     // Set some initial user values
     $user->set('id', 0);
     $user->set('usertype', '');
     $user->set('gid', $authorize->get_group_id('', $newUsertype, 'ARO'));
     $date =& JFactory::getDate();
     $user->set('registerDate', $date->toMySQL());
     // If user activation is turned on, we need to set the activation information
     $useractivation = $usersConfig->get('useractivation');
     if ($useractivation == '1') {
         jimport('joomla.user.helper');
         $user->set('activation', JUtility::getHash(JUserHelper::genRandomPassword()));
         $user->set('block', '1');
     }
     // If there was an error with registration, set the message and display form
     if (!$user->save()) {
         JError::raiseWarning('', JText::_($user->getError()));
         $this->register();
         return false;
     }
     // Send registration confirmation mail
     $password = JRequest::getString('password', '', 'post', JREQUEST_ALLOWRAW);
     $password = preg_replace('/[\\x00-\\x1F\\x7F]/', '', $password);
     //Disallow control chars in the email
     UserController::_sendMail($user, $password);
     // Everything went fine, set relevant message depending upon user activation state and display message
     if ($useractivation == 1) {
         $message = JText::_('REG_COMPLETE_ACTIVATE');
     } else {
         $message = JText::_('REG_COMPLETE');
     }
     $this->setRedirect('index.php', $message);
 }
开发者ID:hrishikesh-kumar,项目名称:NBSNIP,代码行数:62,代码来源:controller.php

示例2: register_save


//.........这里部分代码省略.........
         $user->set('id', 0);
         $user->set('usertype', '');
         $user->set('gid', $authorize->get_group_id('', $newUsertype, 'ARO'));
         $date =& JFactory::getDate();
         $user->set('registerDate', $date->toMySQL());
         $user->set('password', md5($password));
         $user->set('username', $username);
         // If user activation is turned on, we need to set the activation information
         if ($useractivation == '1') {
             jimport('joomla.user.helper');
             $user->set('activation', JUtility::getHash(JUserHelper::genRandomPassword()));
             $user->set('block', $block);
         }
         // If there was an error with registration, set the message and display form
         if (!$user->save()) {
             JError::raiseWarning('', JText::_($user->getError()));
             $message = JText::_('SYSTEM_MESSAGE_ERROR_REGISTER');
             UserHelper::showMessage(ERROR, $message);
             return false;
         }
         $userid = $this->getRUserId($db, $user->get('username'));
         $userExists = true;
         // registramos los datos extras en la tabla de com_aapu
         // pbtenemos el id del atributo sexo
         $atributesModel = new AapuModelAttributes();
         $atributesModel->setWhere("a.name='sex'");
         $sexData = $atributesModel->getData(true, true);
         $sexId = $sexData->id;
         // obtenemos el id del atributo birthday
         $atributesModel->setWhere("a.name='birthday'");
         $birthdayData = $atributesModel->getData(true, true);
         $birthdayId = $birthdayData->id;
         // obtenemos el id del atributo zonal
         $atributesModel->setWhere("a.name='zonal'");
         $zonalData = $atributesModel->getData(true, true);
         $zonaId = $zonalData->id;
         $atributesModel->setWhere("a.name='email2'");
         $emailData = $atributesModel->getData(true, true);
         $emailId = $emailData->id;
         $dataSex = array('value' => $sex, 'object_id' => $userid, 'object_type' => 'TABLE', 'object_name' => '#__users', 'attribute_id' => $sexId);
         $dataBirthday = array('value_date' => $birthday, 'object_id' => $userid, 'object_type' => 'TABLE', 'object_name' => '#__users', 'attribute_id' => $birthdayId);
         $dataZonal = array('value_int' => $zonalId, 'object_id' => $userid, 'object_type' => 'TABLE', 'object_name' => '#__users', 'attribute_id' => $zonaId);
         $dataEmail2 = array('value' => $email2, 'object_id' => $userid, 'object_type' => 'TABLE', 'object_name' => '#__users', 'attribute_id' => $emailId);
         $attributesEntityModel = new AapuModelAttribute_entity();
         // If there was an error with registration, set the message and display form
         if (!$attributesEntityModel->store(false, false, $dataSex) || !$attributesEntityModel->store(false, false, $dataBirthday) || !$attributesEntityModel->store(false, false, $dataZonal) || !$attributesEntityModel->store(false, false, $dataEmail2)) {
             JError::raiseWarning('', JText::_($user->getError()));
             $message = JText::_('SYSTEM_MESSAGE_ERROR_REGISTER');
             UserHelper::showMessage(ERROR, $message);
             return false;
         }
         // Send registration confirmation mail
         $password = preg_replace('/[\\x00-\\x1F\\x7F]/', '', $password);
         //Disallow control chars in the email
         UserController::_sendMail($user, $password);
     }
     ######### agregado por G2P ##############
     ##### testing ##########
     if ($userExists && $externalid != '' && $providerid != 0) {
         // hay que agregar un alias
         // $userid = $this->getUserId($db, $user);
         try {
             $externalid = urldecode($externalid);
             $this->insertAlias($block, $userid, $externalid, $user->get('providerid'), $label, $aliasemail);
             $requestNewAlias = false;
             // Send registration confirmation mail
             $selectpass = 'select u.password from #__users u where id=' . $userid;
             $db->setQuery($selectpass);
             $dbpass = $db->loadObject();
             $password = preg_replace('/[\\x00-\\x1F\\x7F]/', '', $dbpass->password);
             //Disallow control chars in the email
             $userClone->set('activation', $passphrase);
         } catch (Exception $ex) {
             $message = JText::_("SYSTEM_ALIAS_REGISTERED");
             UserHelper::showMessage(ERROR, $message);
         }
         //UserController::_sendMail($userClone, $password);
     } else {
         // tomo los valores especificos del proveedor externo
         $epProveedor = JRequest::getVar('selprovider', '', 'method', 'string');
         if ($epProveedor && $epProveedor != 'Zonales') {
             $epUserData = array();
             $epUserData['epusername'] = JRequest::getVar('epusername', '', 'method', 'string');
             $epUserData['epprovider'] = $epProveedor;
             $epUserData['userid'] = $userid;
             $this->login($epUserData);
         }
     }
     //$return = 'index.php' . ($requestNewAlias) ? '?option=com_alias&view=alias&userid=' . $userid .'&'. JUtility::getToken() . '=1' : '';
     ############## fin #####################
     // Everything went fine, set relevant message depending upon user activation state and display message
     if ($useractivation == '1') {
         $message = JText::_('REG_COMPLETE_ACTIVATE');
     } else {
         $message = JText::_('REG_COMPLETE');
     }
     $this->endAuthentication();
     // fin ------
     UserHelper::showMessage(SUCCESS, $message);
 }
开发者ID:BGCX261,项目名称:zonales-svn-to-git,代码行数:101,代码来源:controller.php

示例3: register_save

 /**
  * Save user registration and notify users and admins if required
  * @return void
  */
 function register_save()
 {
     global $mainframe;
     // Check for request forgeries
     JRequest::checkToken() or jexit('Invalid Token');
     $providerid = JRequest::getInt('providerid', '0', 'method');
     $externalid = JRequest::getVar('externalid', '', 'method', 'string');
     $force = JRequest::getInt('force', '0', 'method');
     $db =& JFactory::getDBO();
     // Get required system objects
     $user = clone JFactory::getUser();
     $pathway =& $mainframe->getPathway();
     $config =& JFactory::getConfig();
     $authorize =& JFactory::getACL();
     $document =& JFactory::getDocument();
     // If user registration is not allowed, show 403 not authorized.
     $usersConfig =& JComponentHelper::getParams('com_users');
     if ($usersConfig->get('allowUserRegistration') == '0') {
         JError::raiseError(403, JText::_('Access Forbidden'));
         return;
     }
     // Initialize new usertype setting
     $newUsertype = $usersConfig->get('new_usertype');
     if (!$newUsertype) {
         $newUsertype = 'Registered';
     }
     // Bind the post array to the user object
     if (!$user->bind(JRequest::get('post'), 'usertype')) {
         JError::raiseError(500, $user->getError());
     }
     $userClone = clone $user;
     $useractivation = (int) $usersConfig->get('useractivation');
     $this->logme($db, 'user activation es: ' . $useractivation);
     //$block = ($useractivation == 1) ? '1' : '0';
     $block = $useractivation;
     $this->logme($db, 'fecha de nacimiento: ' . $user->get('birthdate'));
     $this->logme($db, 'nombre completo: ' . $user->get('name'));
     $this->logme($db, 'nombre de usuario: ' . $user->get('username'));
     $this->logme($db, 'email: ' . $user->get('email'));
     $this->logme($db, 'email2: ' . $user->get('email2'));
     $this->logme($db, 'sexo: ' . $user->get('sex'));
     $userid = $this->getUserId($db, $user);
     $userExists = $this->userExists($db, $user);
     $requestNewAlias = true;
     $this->logme($db, 'usuario existe: ' . $userExists);
     if (!$userExists || $force == 1) {
         $this->logme($db, 'no existe o force');
         $password = JRequest::getString('password', '', 'post', JREQUEST_ALLOWRAW);
         // if ($password == '' && $externalid != '' && $providerid != 0){
         if ($password == '') {
             $password = JUserHelper::genRandomPassword();
             $block = '0';
         }
         // Set some initial user values
         $user->set('id', 0);
         $user->set('usertype', '');
         $user->set('gid', $authorize->get_group_id('', $newUsertype, 'ARO'));
         $date =& JFactory::getDate();
         $user->set('registerDate', $date->toMySQL());
         $user->set('password', md5($password));
         $this->logme($db, 'se va a chequear activacion');
         // If user activation is turned on, we need to set the activation information
         if ($useractivation == '1') {
             jimport('joomla.user.helper');
             $user->set('activation', JUtility::getHash(JUserHelper::genRandomPassword()));
             $user->set('block', $block);
         }
         $this->logme($db, 'se lo va a guardar');
         // If there was an error with registration, set the message and display form
         if (!$user->save()) {
             $this->logme($db, 'no se lo pudo guardar');
             JError::raiseWarning('', JText::_($user->getError()));
             $this->register();
             return false;
         }
         $this->logme($db, 'se lo guardo exitosamente');
         $userid = $this->getUserId($db, $user);
         $userExists = true;
         // Send registration confirmation mail
         $password = preg_replace('/[\\x00-\\x1F\\x7F]/', '', $password);
         //Disallow control chars in the email
         UserController::_sendMail($user, $password);
     }
     $this->logme($db, 'por el alias');
     ######### agregado por G2P ##############
     ##### testing ##########
     $this->logme($db, 'el external id es: ' . $externalid);
     $this->logme($db, 'el provider id es: ' . $providerid);
     if ($userExists && $externalid != '' && $providerid != 0) {
         // hay que agregar un alias
         $this->logme($db, 'vamos a gregar un alias');
         // $userid = $this->getUserId($db, $user);
         $externalid = urldecode($externalid);
         $this->insertAlias($block, $userid, $externalid, $user->get('providerid'));
         $this->logme($db, 'alias agregado');
         $requestNewAlias = false;
//.........这里部分代码省略.........
开发者ID:BGCX261,项目名称:zonales-svn-to-git,代码行数:101,代码来源:controller.php

示例4: createJoomlaUser

 /**
  * Function to create a user of Joomla.
  *  
  * @param array  $params associated array 
  * @param string $mail email id for cms user
  *
  * @return uid if user exists, false otherwise
  * 
  * @access public
  * @static
  */
 static function createJoomlaUser(&$params, $mail)
 {
     $userParams =& JComponentHelper::getParams('com_users');
     // get the default usertype
     $userType = $userParams->get('new_usertype');
     if (!$usertype) {
         $usertype = 'Registered';
     }
     $acl =& JFactory::getACL();
     // Prepare the values for a new Joomla! user.
     $values = array();
     $values['name'] = trim($params['cms_name']);
     $values['username'] = trim($params['cms_name']);
     $values['password'] = $params['cms_pass'];
     $values['password2'] = $params['cms_confirm_pass'];
     $values['email'] = trim($params[$mail]);
     $values['gid'] = $acl->get_group_id('', $userType);
     $values['sendEmail'] = 1;
     $useractivation = $userParams->get('useractivation');
     if ($useractivation == 1) {
         jimport('joomla.user.helper');
         // block the User
         $values['block'] = 1;
         $values['activation'] = JUtility::getHash(JUserHelper::genRandomPassword());
     } else {
         // don't block the user
         $values['block'] = 0;
     }
     // Get an empty JUser instance.
     $user =& JUser::getInstance(0);
     $user->bind($values);
     // Store the Joomla! user.
     if (!$user->save()) {
         // Error can be accessed via $user->getError();
         return false;
     }
     //since civicrm don't have own tokens to use in user
     //activation email. we have to use com_user tokens, CRM-5809
     $lang =& JFactory::getLanguage();
     $lang->load('com_user');
     require_once 'components/com_user/controller.php';
     UserController::_sendMail($user, $user->password2);
     return $user->get('id');
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:55,代码来源:CMSUser.php

示例5: register_save

 /**
  * Save user registration and notify users and admins if required
  * @return void
  */
 function register_save()
 {
     $input = JFactory::getApplication()->input;
     global $mainframe;
     // Check for request forgeries
     JSession::checkToken() or jexit('Invalid Token');
     // Get required system objects
     $user = clone JFactory::getUser();
     $pathway = $mainframe->getPathway();
     $config = JFactory::getConfig();
     $authorize = JFactory::getACL();
     $document = JFactory::getDocument();
     // If user registration is not allowed, show 403 not authorized.
     $usersConfig = JComponentHelper::getParams('com_users');
     if ($usersConfig->get('allowUserRegistration') == '0') {
         JError::raiseError(403, JText::_('COM_CITRUSCART_ACCESS_FORBIDDEN'));
         return;
     }
     // Initialize new usertype setting
     $newUsertype = $usersConfig->get('new_usertype');
     if (!$newUsertype) {
         $newUsertype = 'Registered';
     }
     // Bind the post array to the user object
     if (!$user->bind($input->getArray($_POST), 'usertype')) {
         JError::raiseError(500, $user->getError());
     }
     // Set some initial user values
     $user->set('id', 0);
     $user->set('usertype', $newUsertype);
     $user->set('gid', $authorize->get_group_id('', $newUsertype, 'ARO'));
     $date = JFactory::getDate();
     $user->set('registerDate', $date->toSql());
     // If user activation is turned on, we need to set the activation information
     // $useractivation = $usersConfig->get( 'useractivation' );
     // We aren't using activation for Citruscart so the process isn't interrupted for the user
     //        if ($useractivation == '1')
     //        {
     //            jimport('joomla.user.helper');
     //            $user->set('activation', JApplication::getHash( JUserHelper::genRandomPassword()) );
     //            $user->set('block', '1');
     //        }
     // If there was an error with registration, set the message and display form
     if (!$user->save()) {
         JError::raiseWarning('', JText::_($user->getError()));
         $this->register();
         return false;
     }
     // Send registration confirmation mail
     $password = $input->getString('password', '', 'post', JREQUEST_ALLOWRAW);
     $password = preg_replace('/[\\x00-\\x1F\\x7F]/', '', $password);
     //Disallow control chars in the email
     UserController::_sendMail($user, $password);
     // Everything went fine, set relevant message depending upon user activation state and display message
     //        if ( $useractivation == 1 ) {
     //            $message  = JText::_('COM_CITRUSCART_REG_COMPLETE_ACTIVATE');
     //        } else {
     //            $message = JText::_('COM_CITRUSCART_REG_COMPLETE');
     //        }
     $message = JText::_('COM_CITRUSCART_REG_COMPLETE');
     // if there is a return URL base64encoded, then redirect to there
     if ($return = $input->get('return', '', 'method', 'base64')) {
         $return = base64_decode($return);
         if (!JURI::isInternal($return)) {
             $return = '';
         }
     }
     if (!empty($return)) {
         $credentials = array();
         $credentials['username'] = $input->get('username', '', 'method', 'username');
         $credentials['password'] = $input->getString('password', '', 'post', JREQUEST_ALLOWRAW);
         $options = array();
         $options['remember'] = $input->getBool('remember', false);
         $options['return'] = $return;
         //preform the login action ?
         $success = $mainframe->login($credentials, $options);
         JFactory::getApplication()->redirect($return);
     }
     $this->setRedirect('index.php', $message);
 }
开发者ID:joomlacorner,项目名称:citruscart,代码行数:84,代码来源:controller.php

示例6: register_save

 /**
  * Save user registration and notify users and admins if required
  * @return void
  */
 function register_save()
 {
     global $mainframe;
     // Check for request forgeries
     JRequest::checkToken() or jexit('Invalid Token');
     // Get required system objects
     $user = clone JFactory::getUser();
     $pathway =& $mainframe->getPathway();
     $config =& JFactory::getConfig();
     $authorize =& JFactory::getACL();
     $document =& JFactory::getDocument();
     // If user registration is not allowed, show 403 not authorized.
     $usersConfig =& JComponentHelper::getParams('com_users');
     if ($usersConfig->get('allowUserRegistration') == '0') {
         JError::raiseError(403, JText::_('Access Forbidden'));
         return;
     }
     // do civicrm validation here
     require_once 'administrator/components/com_civicrm/civicrm.settings.php';
     require_once 'CRM/Core/Config.php';
     $civiConfig =& CRM_Core_Config::singleton();
     $civiConfig->formKeyDisable = true;
     require_once 'CRM/Core/BAO/UFGroup.php';
     $errors = CRM_Core_BAO_UFGroup::isValid(null, null, true);
     if (is_array($errors)) {
         $msg = null;
         foreach ($errors as $name => $error) {
             $msg .= "{$name}: {$error}<br/>";
         }
         JError::raiseWarning('', JText::_($msg));
         $this->register();
         return false;
     }
     // Initialize new usertype setting
     $newUsertype = $usersConfig->get('new_usertype');
     if (!$newUsertype) {
         $newUsertype = 'Registered';
     }
     // Bind the post array to the user object
     if (!$user->bind(JRequest::get('post'), 'usertype')) {
         JError::raiseError(500, $user->getError());
     }
     // Set some initial user values
     $user->set('id', 0);
     $user->set('usertype', '');
     $user->set('gid', $authorize->get_group_id('', $newUsertype, 'ARO'));
     $date =& JFactory::getDate();
     $user->set('registerDate', $date->toMySQL());
     // If user activation is turned on, we need to set the activation information
     $useractivation = $usersConfig->get('useractivation');
     if ($useractivation == '1') {
         jimport('joomla.user.helper');
         $user->set('activation', md5(JUserHelper::genRandomPassword()));
         $user->set('block', '1');
     }
     // If there was an error with registration, set the message and display form
     if (!$user->save()) {
         JError::raiseWarning('', JText::_($user->getError()));
         $this->register();
         return false;
     }
     // Send registration confirmation mail
     $password = JRequest::getString('password', '', 'post', JREQUEST_ALLOWRAW);
     $password = preg_replace('/[\\x00-\\x1F\\x7F]/', '', $password);
     //Disallow control chars in the email
     UserController::_sendMail($user, $password);
     // if this was a successful save, call civicrm code to save the contact
     if ($user->id) {
         require_once 'CRM/Core/BAO/UFMatch.php';
         CRM_Core_BAO_UFMatch::synchronize($user, true, 'Joomla', 'Individual');
         $userID = CRM_Core_BAO_UFMatch::getContactId($user->id);
         if ($userID) {
             require_once 'CRM/Core/BAO/UFGroup.php';
             CRM_Core_BAO_UFGroup::getEditHTML($userID, null, 2, true, false, null, false, 'Individual');
             $session =& CRM_Core_Session::singleton();
             $session->reset();
         }
     }
     // Everything went fine, set relevant message depending upon user activation state and display message
     if ($useractivation == 1) {
         $message = JText::_('REG_COMPLETE_ACTIVATE');
     } else {
         $message = JText::_('REG_COMPLETE');
     }
     //TODO :: this needs to be replace by raiseMessage
     JError::raiseNotice('', $message);
     $this->register();
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:92,代码来源:controller.php


注:本文中的UserController::_sendMail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。