本文整理汇总了PHP中UserHelper::showMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP UserHelper::showMessage方法的具体用法?PHP UserHelper::showMessage怎么用?PHP UserHelper::showMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserHelper
的用法示例。
在下文中一共展示了UserHelper::showMessage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _sendConfirmationMail
/**
* Sends a password reset request confirmation to the
* specified e-mail address with the specified token.
*
* @since 1.5
* @param string An e-mail address
* @param string An md5 hashed randomly generated string
* @return bool True on success/false on failure
*/
function _sendConfirmationMail($email, $token)
{
$config =& JFactory::getConfig();
$uri =& JFactory::getURI();
$url = JURI::base() . 'index.php?option=com_user&view=reset&layout=confirm&map=0';
$sitename = $config->getValue('sitename');
// Set the e-mail parameters
$from = $config->getValue('mailfrom');
$fromname = $config->getValue('fromname');
$subject = JText::sprintf('PASSWORD_RESET_CONFIRMATION_EMAIL_TITLE', $sitename);
$body = JText::sprintf('PASSWORD_RESET_CONFIRMATION_EMAIL_TEXT', $sitename, $token, $url);
// Send the e-mail
if (!JUtility::sendMail($from, $fromname, $email, $subject, $body)) {
$message = JText::_('ERROR_SENDING_CONFIRMATION_EMAIL');
$this->setError($message);
UserHelper::showMessage(ERROR, $message);
return false;
}
return true;
}
示例2: 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(JText::_('SYSTEM_TOKEN_INVALID'));
$providerid = JRequest::getInt('providerid', '0', 'method');
$externalid = JRequest::getVar('externalid', '', 'method', 'string');
$aliasemail = JRequest::getVar('email', '', 'method', 'string');
$label = JRequest::getVar('label', '', 'method', 'string');
$force = JRequest::getInt('force', '0', 'method');
$zonalId = JRequest::getInt('zonal', UserHelper::ZONAL_NOT_DEFINED, 'method');
$email2 = JRequest::getString('email2', '', 'method');
$birthday = JRequest::getString('birthdate', '', 'method');
$sex = JRequest::getString('sex', 'M', 'method');
$username = JRequest::getString('usernamer', '', 'method');
if ($zonalId == UserHelper::ZONAL_NOT_DEFINED) {
$notZonalMessage = JText::_('SYSTEM_ZONAL_NOT_DEFINED');
$baseUrl = "option=com_user&view=register&map=0";
UserHelper::showMessage(ERROR, $notZonalMessage, $baseUrl);
return;
}
$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');
//$block = ($useractivation == 1) ? '1' : '0';
$block = $useractivation;
$userid = $this->getUserId($db, $user);
$userExists = $this->userExists($db, $user);
$requestNewAlias = true;
if ($userExists) {
$message = JText::_('SYSTEM_MESSAGE_ERROR_USER_EXISTS');
UserHelper::showMessage(ERROR, $message);
}
if (!$userExists || $force == 1) {
$password = JRequest::getString('passwordt', '', 'post', JREQUEST_ALLOWRAW);
$username = JRequest::getString('usernamer', '', 'method');
// 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));
$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
//.........这里部分代码省略.........
示例3: _sendReminderMail
/**
* Sends a username reminder to the e-mail address
* specified containing the specified username.
*
* @since 1.5
* @param string A user's e-mail address
* @param string A user's username
* @return bool True on success/false on failure
*/
function _sendReminderMail($email, $username)
{
$config =& JFactory::getConfig();
$uri =& JFactory::getURI();
$url = $uri->toString(array('scheme', 'host', 'port')) . JRoute::_('index.php?option=com_user&view=zlogin&map=0', false);
$from = $config->getValue('mailfrom');
$fromname = $config->getValue('fromname');
$subject = JText::sprintf('USERNAME_REMINDER_EMAIL_TITLE', $config->getValue('sitename'));
$body = JText::sprintf('USERNAME_REMINDER_EMAIL_TEXT', $config->getValue('sitename'), $username, $url);
if (!JUtility::sendMail($from, $fromname, $email, $subject, $body)) {
$message = JText::_('ERROR_SENDING_REMINDER_EMAIL');
$this->setError($message);
UserHelper::showMessage(ERROR, $message);
return false;
}
return true;
}