當前位置: 首頁>>代碼示例>>PHP>>正文


PHP UserHelper::showMessage方法代碼示例

本文整理匯總了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;
 }
開發者ID:BGCX261,項目名稱:zonales-svn-to-git,代碼行數:29,代碼來源:reset.php

示例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
//.........這裏部分代碼省略.........
開發者ID:BGCX261,項目名稱:zonales-svn-to-git,代碼行數:101,代碼來源:controller.php

示例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;
 }
開發者ID:BGCX261,項目名稱:zonales-svn-to-git,代碼行數:26,代碼來源:remind.php


注:本文中的UserHelper::showMessage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。