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


PHP UsersHelperRoute类代码示例

本文整理汇总了PHP中UsersHelperRoute的典型用法代码示例。如果您正苦于以下问题:PHP UsersHelperRoute类的具体用法?PHP UsersHelperRoute怎么用?PHP UsersHelperRoute使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: remind

 /**
  * Method to request a username reminder.
  *
  * @since	1.6
  */
 public function remind()
 {
     // Check the request token.
     Session::checkToken('post') or exit(Lang::txt('JINVALID_TOKEN'));
     $app = JFactory::getApplication();
     $model = $this->getModel('Remind', 'UsersModel');
     $data = Request::getVar('jform', array(), 'post', 'array');
     // Submit the password reset request.
     $return = $model->processRemindRequest($data);
     // Check for a hard error.
     if ($return == false) {
         // The request failed.
         // Get the route to the next page.
         $itemid = UsersHelperRoute::getRemindRoute();
         $itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
         $route = 'index.php?option=com_users&view=remind' . $itemid;
         // Go back to the request form.
         $message = Lang::txt('COM_USERS_REMIND_REQUEST_FAILED', $model->getError());
         $this->setRedirect(Route::url($route, false), $message, 'warning');
         return false;
     } else {
         // The request succeeded.
         // Get the route to the next page.
         $itemid = UsersHelperRoute::getRemindRoute();
         $itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
         $route = 'index.php?option=com_users&view=login' . $itemid;
         // Proceed to step two.
         $message = Lang::txt('COM_USERS_REMIND_REQUEST_SUCCESS');
         $this->setRedirect(Route::url($route, false), $message);
         return true;
     }
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:37,代码来源:remind.php

示例2: remind

 /**
  * Method to request a username reminder.
  *
  * @return  boolean
  *
  * @since   1.6
  */
 public function remind()
 {
     // Check the request token.
     JSession::checkToken('post') or jexit(JText::_('JINVALID_TOKEN'));
     $model = $this->getModel('Remind', 'UsersModel');
     $data = $this->input->post->get('jform', array(), 'array');
     // Submit the password reset request.
     $return = $model->processRemindRequest($data);
     // Check for a hard error.
     if ($return == false) {
         // The request failed.
         // Get the route to the next page.
         $itemid = UsersHelperRoute::getRemindRoute();
         $itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
         $route = 'index.php?option=com_users&view=remind' . $itemid;
         // Go back to the request form.
         $message = JText::sprintf('Request failed: Your account is not activated yet or is under review. Please contact the admin more for details.', $model->getError());
         $this->setRedirect(JRoute::_($route, false), $message, 'notice');
         return false;
     } else {
         // The request succeeded.
         // Get the route to the next page.
         $itemid = UsersHelperRoute::getRemindRoute();
         $itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
         $route = 'index.php?option=com_users&view=login' . $itemid;
         // Proceed to step two.
         $message = JText::_('COM_USERS_REMIND_REQUEST_SUCCESS');
         $this->setRedirect(JRoute::_($route, false), $message);
         return true;
     }
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:38,代码来源:remind.php

示例3: getLogout

 public static function getLogout($params)
 {
     $logout = new stdClass();
     $logout->menu = self::getMenu($params);
     $logout->profileLink = JRoute::_('index.php?option=com_users&view=profile&layout=edit&Itemid=' . UsersHelperRoute::getProfileRoute());
     $logout->option = 'com_users';
     $logout->task = 'user.logout';
     $logout->return = self::getReturnURL($params, 'logout');
     $logout->K2CommentsEnabled = JComponentHelper::getParams('com_k2')->get('comments');
     return $logout;
 }
开发者ID:Naldo100,项目名称:k2-v3-dev-build,代码行数:11,代码来源:helper.php

示例4: display

 /**
  * Method to display the view.
  *
  * @access	public
  * @param	string	$tpl	The template file to include
  * @since	1.0
  */
 function display($tpl = null)
 {
     $app =& JFactory::getApplication();
     $user =& JFactory::getUser();
     // If the user is logged in, send them to their profile.
     if (!$user->get('guest')) {
         $itemid = UsersHelperRoute::getProfileRoute();
         $itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
         $app->redirect(JRoute::_('index.php?option=com_users&view=profile' . $itemid, false));
         return false;
     }
     // Get the appropriate form.
     if ($this->_layout === 'confirm') {
         $form =& $this->get('ResetConfirmForm');
     } elseif ($this->_layout === 'complete') {
         // Get the token and user id from the confirmation process.
         $token = $app->getUserState('com_users.reset.token', null);
         $userId = $app->getUserState('com_users.reset.user', null);
         // Check the token and user id.
         if (empty($token) || empty($userId)) {
             JError::raiseError(403, JText::_('ALERTNOTAUTH'));
             return false;
         }
         $form =& $this->get('ResetCompleteForm');
     } else {
         $form =& $this->get('ResetRequestForm');
     }
     // Check the form.
     if (JError::isError($form)) {
         JError::raiseError(500, $form->getMessage());
         return false;
     }
     // Check for errors.
     if (count($errors =& $this->get('Errors'))) {
         JError::raiseError(500, implode('<br />', $errors));
         return false;
     }
     // Push the data into the view.
     $this->assignRef('form', $form);
     parent::display($tpl);
 }
开发者ID:joebushi,项目名称:joomla,代码行数:48,代码来源:view.html.php

示例5: display

    public function display($tpl = null)
    {
        // Get application
        $application = JFactory::getApplication();
        // Get document
        $document = JFactory::getDocument();
        // Get user
        $user = JFactory::getUser();
        // Extra class for Front-end
        $this->class = ' jw-backend';
        // Front-end permissions check.
        // We need to do this here since front-end requests are not executed through /administrator/components/com_k2/k2.php
        if ($application->isSite()) {
            $this->class = ' jw-frontend';
            if (!$user->authorise('core.manage', 'com_k2')) {
                if ($user->guest) {
                    // If user is guest redirect him to login page
                    require_once JPATH_SITE . '/components/com_users/helpers/route.php';
                    $uri = JUri::getInstance();
                    $url = 'index.php?option=com_users&view=login&return=' . base64_encode($uri->toString()) . '&Itemid=' . UsersHelperRoute::getLoginRoute();
                    $application->redirect(JRoute::_($url, false), JText::_('K2_YOU_NEED_TO_LOGIN_FIRST'));
                    return false;
                } else {
                    throw new Exception(JText::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN'), 403);
                }
            }
        }
        // Set the correct metadata
        $document->setMetaData('viewport', 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no');
        // Load jQuery
        JHtml::_('jquery.framework');
        // Keep alive the session
        JHtml::_('behavior.keepalive');
        // Load the CSS
        if ($application->isSite()) {
            $document->addScript(JURI::root(true) . '/media/k2app/assets/js/frontend.js?v=3.0.0');
            $document->addStyleSheet(JURI::root(true) . '/media/k2app/assets/css/frontend.css?v=3.0.0');
        }
        $document->addStyleSheet('//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css?v=3.0.0');
        $document->addStyleSheet(JURI::root(true) . '/media/k2app/assets/css/k2.css?v=3.0.0');
        // Add javascript variables
        $document->addScriptDeclaration('
			/* K2 v3.0.0 - START */
			var K2SessionToken = "' . JSession::getFormToken() . '";
			var K2Editor = ' . $this->getEditor() . ';
			var K2SitePath = "' . JURI::root(true) . '";
			var K2BasePath = "' . JURI::base(true) . '";
			var K2MediaManagerLanguage = "' . $this->getMediaManagerLanguage() . '";
			var K2Language = ' . $this->getLanguage() . ';
			/* K2 v3.0.0 - FINISH */
		');
        // Add DropBox drop-in
        $params = JComponentHelper::getParams('com_k2');
        if ($dropBoxAppKey = $params->get('dropboxAppKey')) {
            // Load DropBox script
            $document->addCustomTag('<script data-app-key="' . $dropBoxAppKey . '" id="dropboxjs" src="https://www.dropbox.com/static/api/2/dropins.js"></script>');
        }
        // Load the application
        $document->addCustomTag('<script data-main="' . JURI::root(true) . '/media/k2app/app/main" src="' . JURI::root(true) . '/media/k2app/vendor/require/require.js?v=3.0.0"></script>');
        // Set title
        if (class_exists('JToolBarHelper')) {
            JToolBarHelper::title(JText::_('COM_K2'));
        }
        // Display
        parent::display($tpl);
    }
开发者ID:Naldo100,项目名称:k2-v3-dev-build,代码行数:66,代码来源:view.html.php

示例6: complete

 /**
  * Method to complete the password reset process.
  *
  * @since   1.6
  */
 public function complete()
 {
     // Check for request forgeries
     JSession::checkToken('post') or jexit(JText::_('JINVALID_TOKEN'));
     $app = JFactory::getApplication();
     $model = $this->getModel('Reset', 'UsersModel');
     $data = $this->input->post->get('jform', array(), 'array');
     // Complete the password reset request.
     $return = $model->processResetComplete($data);
     // Check for a hard error.
     if ($return instanceof Exception) {
         // Get the error message to display.
         if ($app->get('error_reporting')) {
             $message = $return->getMessage();
         } else {
             $message = JText::_('COM_USERS_RESET_COMPLETE_ERROR');
         }
         // Get the route to the next page.
         $itemid = UsersHelperRoute::getResetRoute();
         $itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
         $route = 'index.php?option=com_users&view=reset&layout=complete' . $itemid;
         // Go back to the complete form.
         $this->setRedirect(JRoute::_($route, false), $message, 'error');
         return false;
     } elseif ($return === false) {
         // Complete failed.
         // Get the route to the next page.
         $itemid = UsersHelperRoute::getResetRoute();
         $itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
         $route = 'index.php?option=com_users&view=reset&layout=complete' . $itemid;
         // Go back to the complete form.
         $message = JText::sprintf('COM_USERS_RESET_COMPLETE_FAILED', $model->getError());
         $this->setRedirect(JRoute::_($route, false), $message, 'notice');
         return false;
     } else {
         // Complete succeeded.
         // Get the route to the next page.
         $itemid = UsersHelperRoute::getLoginRoute();
         $itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
         $route = 'index.php?option=com_users&view=login' . $itemid;
         // Proceed to the login form.
         $message = JText::_('COM_USERS_RESET_COMPLETE_SUCCESS');
         $this->setRedirect(JRoute::_($route, false), $message);
         return true;
     }
 }
开发者ID:terryvisser,项目名称:joomlatools-platform,代码行数:51,代码来源:reset.php

示例7: remind

 /**
  * Method to login a user.
  *
  * @return  boolean
  *
  * @since   1.6
  */
 public function remind()
 {
     // Check the request token.
     JSession::checkToken('post') or jexit(JText::_('JINVALID_TOKEN'));
     $app = JFactory::getApplication();
     $model = $this->getModel('User', 'UsersModel');
     $data = $this->input->post->get('jform', array(), 'array');
     // Submit the username remind request.
     $return = $model->processRemindRequest($data);
     // Check for a hard error.
     if ($return instanceof Exception) {
         // Get the error message to display.
         $message = $app->get('error_reporting') ? $return->getMessage() : JText::_('COM_USERS_REMIND_REQUEST_ERROR');
         // Get the route to the next page.
         $itemid = UsersHelperRoute::getRemindRoute();
         $itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
         $route = 'index.php?option=com_users&view=remind' . $itemid;
         // Go back to the complete form.
         $this->setRedirect(JRoute::_($route, false), $message, 'error');
         return false;
     }
     if ($return === false) {
         // Complete failed.
         // Get the route to the next page.
         $itemid = UsersHelperRoute::getRemindRoute();
         $itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
         $route = 'index.php?option=com_users&view=remind' . $itemid;
         // Go back to the complete form.
         $message = JText::sprintf('COM_USERS_REMIND_REQUEST_FAILED', $model->getError());
         $this->setRedirect(JRoute::_($route, false), $message, 'notice');
         return false;
     }
     // Complete succeeded.
     // Get the route to the next page.
     $itemid = UsersHelperRoute::getLoginRoute();
     $itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
     $route = 'index.php?option=com_users&view=login' . $itemid;
     // Proceed to the login form.
     $message = JText::_('COM_USERS_REMIND_REQUEST_SUCCESS');
     $this->setRedirect(JRoute::_($route, false), $message);
     return true;
 }
开发者ID:adjaika,项目名称:J3Base,代码行数:49,代码来源:user.php

示例8: processRemindRequest

 /**
  * @since	1.6
  */
 public function processRemindRequest($data)
 {
     // Get the form.
     $form = $this->getForm();
     // Check for an error.
     if (empty($form)) {
         return false;
     }
     // Validate the data.
     $data = $this->validate($form, $data);
     // Check for an error.
     if ($data instanceof Exception) {
         return $return;
     }
     // Check the validation results.
     if ($data === false) {
         // Get the validation messages from the form.
         foreach ($form->getErrors() as $message) {
             $this->setError($message);
         }
         return false;
     }
     // Find the user id for the given email address.
     $db = $this->getDbo();
     $query = $db->getQuery(true);
     $query->select('*');
     $query->from($db->quoteName('#__users'));
     $query->where($db->quoteName('email') . ' = ' . $db->Quote($data['email']));
     // Get the user id.
     $db->setQuery((string) $query);
     $users = $db->loadObjectList('id');
     $usersnames = array();
     // Check for an error.
     if ($db->getErrorNum()) {
         $this->setError(Lang::txt('COM_USERS_DATABASE_ERROR', $db->getErrorMsg()), 500);
         return false;
     }
     // Check for a user.
     if (count($users) < 1) {
         $this->setError(Lang::txt('COM_USERS_USER_NOT_FOUND'));
         return false;
     }
     foreach ($users as $user) {
         // Make sure the user isn't blocked.
         if ($user->block) {
             unset($users[$user->id]);
         } else {
             $usersnames[] = $user->username;
             $email = $user->email;
         }
     }
     // Check for a user.
     if (count($users) < 1) {
         $this->setError(Lang::txt('COM_USERS_USER_NOT_FOUND'));
         return false;
     }
     // Assemble the login link.
     $itemid = UsersHelperRoute::getLoginRoute();
     $itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
     $link = 'index.php?option=com_users&view=login' . $itemid;
     $mode = Config::get('force_ssl', 0) == 2 ? 1 : -1;
     // Put together the email template data.
     $data = array();
     $data['username'] = implode(', ', $usersnames);
     $data['fromname'] = Config::get('fromname');
     $data['mailfrom'] = Config::get('mailfrom');
     $data['sitename'] = Config::get('sitename');
     $data['link_text'] = Route::url($link, false, $mode);
     $data['link_html'] = Route::url($link, true, $mode);
     $subject = Lang::txt('COM_USERS_EMAIL_USERNAME_REMINDER_SUBJECT', $data['sitename']);
     $body = Lang::txt('COM_USERS_EMAIL_USERNAME_REMINDER_BODY', $data['sitename'], $data['username'], $data['link_text']);
     // Send the password reset request email.
     $return = JFactory::getMailer()->sendMail($data['mailfrom'], $data['fromname'], $email, $subject, $body);
     // Check for an error.
     if ($return !== true) {
         $this->setError(Lang::txt('COM_USERS_MAIL_FAILED'), 500);
         return false;
     }
     return true;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:83,代码来源:remind.php

示例9: remind

 /**
  * Method to login a user.
  *
  * @access	public
  * @since	1.0
  */
 function remind()
 {
     // Check the request token.
     JRequest::checkToken('post') or jexit(JText::_('JInvalid_Token'));
     $app =& JFactory::getApplication();
     $model =& $this->getModel('User', 'UsersModel');
     $data = JRequest::getVar('jform', array(), 'post', 'array');
     // Submit the username remind request.
     $return = $model->processRemindRequest($data);
     // Check for a hard error.
     if (JError::isError($return)) {
         // Get the error message to display.
         if ($app->getCfg('error_reporting')) {
             $message = $return->getMessage();
         } else {
             $message = JText::_('USERS_REMIND_REQUEST_ERROR');
         }
         // Get the route to the next page.
         $itemid = UsersHelperRoute::getRemindRoute();
         $itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
         $route = 'index.php?option=com_users&view=remind' . $itemid;
         // Go back to the complete form.
         $this->setRedirect(JRoute::_($route, false), $message, 'error');
         return false;
     } elseif ($return === false) {
         // Get the route to the next page.
         $itemid = UsersHelperRoute::getRemindRoute();
         $itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
         $route = 'index.php?option=com_users&view=remind' . $itemid;
         // Go back to the complete form.
         $message = JText::sprintf('USERS_REMIND_REQUEST_FAILED', $model->getError());
         $this->setRedirect(JRoute::_($route, false), $message, 'notice');
         return false;
     } else {
         // Get the route to the next page.
         $itemid = UsersHelperRoute::getLoginRoute();
         $itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
         $route = 'index.php?option=com_users&view=login' . $itemid;
         // Proceed to the login form.
         $message = JText::_('USERS_REMIND_REQUEST_SUCCESS');
         $this->setRedirect(JRoute::_($route, false), $message);
         return true;
     }
 }
开发者ID:joebushi,项目名称:joomla,代码行数:50,代码来源:user.php

示例10: getRegistrationLink

 public function getRegistrationLink($options = array())
 {
     return JRoute::_('index.php?option=com_users&view=registration&Itemid=' . UsersHelperRoute::getRegistrationRoute());
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:4,代码来源:alphauserpoints.php

示例11: checkSiteAccess

 public function checkSiteAccess()
 {
     // Get date
     $date = JFactory::getDate();
     $now = $date->toSql();
     // State check
     if ($this->state < 1 || (int) $this->id < 1) {
         throw new Exception(JText::_('K2_NOT_FOUND'), 404);
     }
     // Get user
     $user = JFactory::getUser();
     $viewLevels = $user->getAuthorisedViewLevels();
     // Access check
     if (!in_array($this->access, $viewLevels)) {
         if ($user->guest) {
             // Get application
             $application = JFactory::getApplication();
             // Get document
             $document = JFactory::getDocument();
             // In front end HTML requests redirect the user to the login page
             if ($application->isSite() && $document->getType() == 'html') {
                 require_once JPATH_SITE . '/components/com_users/helpers/route.php';
                 $uri = JUri::getInstance();
                 $url = 'index.php?option=com_users&view=login&return=' . base64_encode($uri->toString()) . '&Itemid=' . UsersHelperRoute::getLoginRoute();
                 $application->redirect(JRoute::_($url, false), JText::_('K2_YOU_NEED_TO_LOGIN_FIRST'));
             }
             // Return false
             return false;
         } else {
             throw new Exception(JText::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN'), 403);
         }
     }
     return true;
 }
开发者ID:Naldo100,项目名称:k2-v3-dev-build,代码行数:34,代码来源:categories.php

示例12: ajaxforgot


//.........这里部分代码省略.........

		// Get the user object.
		$user = JUser::getInstance($userId);

		// Make sure the user isn't blocked.
		if ($user->block) {
			awdwallController::ajaxResponse('$error$'.JText::_('COM_USERS_USER_BLOCKED'));
		}

		// Make sure the user isn't a Super Admin.
		if ($user->authorise('core.admin')) {
			awdwallController::ajaxResponse('$error$'.JText::_('COM_USERS_REMIND_SUPERADMIN_ERROR'));
		}

		// Make sure the user has not exceeded the reset limit
		$params = JFactory::getApplication()->getParams();
		$maxCount = (int) $params->get('reset_count');
		$resetHours = (int) $params->get('reset_time');
		$result = true;

		$lastResetTime = strtotime($user->lastResetTime) ? strtotime($user->lastResetTime) : 0;
		$hoursSinceLastReset = (strtotime(JFactory::getDate()->toSql()) - $lastResetTime) / 3600;

		// If it's been long enough, start a new reset count
		if ($hoursSinceLastReset > $resetHours)
		{
			$user->lastResetTime = JFactory::getDate()->toSql();
			$user->resetCount = 1;
		}

		// If we are under the max count, just increment the counter
		elseif ($user->resetCount < $maxCount)
		{
			$user->resetCount;
		}

		// At this point, we know we have exceeded the maximum resets for the time period
		else
		{
			$result = false;
		}
		
		
		if (!$result) {
			$resetLimit = (int) JFactory::getApplication()->getParams()->get('reset_time');
			//$this->setError(JText::plural('COM_USERS_REMIND_LIMIT_ERROR_N_HOURS', $resetLimit));
			awdwallController::ajaxResponse('$error$'.JText::plural('COM_USERS_REMIND_LIMIT_ERROR_N_HOURS', $resetLimit));
			//return false;
		}

		// Set the confirmation token.
		$token = JApplication::getHash(JUserHelper::genRandomPassword());
		$salt = JUserHelper::getSalt('crypt-md5');
		$hashedToken = md5($token.$salt).':'.$salt;

		$user->activation = $hashedToken;

		// Save the user to the database.
		if (!$user->save(true)) {
			awdwallController::ajaxResponse('$error$'.JText::sprintf('COM_USERS_USER_SAVE_FAILED', $user->getError()));
			//return new JException(JText::sprintf('COM_USERS_USER_SAVE_FAILED', $user->getError()), 500);
		}
		
		// Assemble the password reset confirmation link.
		$mode = $config->get('force_ssl', 0) == 2 ? 1 : -1;
		$itemid = UsersHelperRoute::getLoginRoute();
		$itemid = $itemid !== null ? '&Itemid='.$itemid : '';
		$link = 'index.php?option=com_users&view=reset&layout=confirm'.$itemid;
				

		// Put together the email template data.
		$data = $user->getProperties();
		$data['fromname']	= $config->get('fromname');
		$data['mailfrom']	= $config->get('mailfrom');
		$data['sitename']	= $config->get('sitename');
		$data['link_text']	= JRoute::_($link, false, $mode);
		$data['link_html']	= JRoute::_($link, true, $mode);
		$data['token']		= $token;

		$subject = JText::sprintf(
			'COM_USERS_EMAIL_PASSWORD_RESET_SUBJECT',
			$data['sitename']
		);

		$body = JText::sprintf(
			'COM_USERS_EMAIL_PASSWORD_RESET_BODY',
			$data['sitename'],
			$data['token'],
			$data['link_text']
		);

		// Send the password reset request email.
		$return = JFactory::getMailer()->sendMail($data['mailfrom'], $data['fromname'], $user->email, $subject, $body);
		// Check for an error.
		if ($return !== true) {
			awdwallController::ajaxResponse('$error$'.JText::_('COM_USERS_MAIL_FAILED'));
		}		
		awdwallController::ajaxResponse(JText::_('COM_COMAWDWALL_FORGOTPASS_SUCCESS_TEXT'));
		exit;
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:101,代码来源:controller.php

示例13:

        $langScript = '
			var JLanguage = {};
			JLanguage.WHAT_IS_OPENID = \'' . JText::_('K2_WHAT_IS_OPENID') . '\';
			JLanguage.LOGIN_WITH_OPENID = \'' . JText::_('K2_LOGIN_WITH_OPENID') . '\';
			JLanguage.NORMAL_LOGIN = \'' . JText::_('K2_NORMAL_LOGIN') . '\';
			var modlogin = 1;
		';
        $document = JFactory::getDocument();
        $document->addScriptDeclaration($langScript);
        JHTML::_('script', 'openid.js');
    }
    // Get user stuff (do not edit)
    $usersConfig = JComponentHelper::getParams('com_users');
    // Define some variables depending on Joomla! version
    $passwordFieldName = K2_JVERSION != '15' ? 'password' : 'passwd';
    $resetLink = JRoute::_(K2_JVERSION != '15' ? 'index.php?option=com_users&view=reset&Itemid=' . UsersHelperRoute::getResetRoute() : 'index.php?option=com_user&view=reset');
    $remindLink = JRoute::_(K2_JVERSION != '15' ? 'index.php?option=com_users&view=remind&Itemid=' . UsersHelperRoute::getRemindRoute() : 'index.php?option=com_user&view=remind');
    $registrationLink = JRoute::_(K2_JVERSION != '15' ? 'index.php?option=com_users&view=registration&Itemid=' . UsersHelperRoute::getRegistrationRoute() : 'index.php?option=com_user&view=register');
    $option = K2_JVERSION != '15' ? 'com_users' : 'com_user';
    $task = K2_JVERSION != '15' ? 'user.login' : 'login';
    require JModuleHelper::getLayoutPath('mod_k2_user', 'login');
} else {
    JHTML::_('behavior.modal');
    $user->profile = modK2UserHelper::getProfile($params);
    $user->numOfComments = modK2UserHelper::countUserComments($user->id);
    $menu = modK2UserHelper::getMenu($params);
    $profileLink = JRoute::_(K2_JVERSION != '15' ? 'index.php?option=com_users&view=profile&layout=edit&Itemid=' . UsersHelperRoute::getProfileRoute() : 'index.php?option=com_user&view=user&task=edit');
    $option = K2_JVERSION != '15' ? 'com_users' : 'com_user';
    $task = K2_JVERSION != '15' ? 'user.logout' : 'logout';
    require JModuleHelper::getLayoutPath('mod_k2_user', 'userblock');
}
开发者ID:emavro,项目名称:k2,代码行数:31,代码来源:mod_k2_user.php

示例14: remind

 /**
  * Method to login a user.
  *
  * @since	1.6
  */
 public function remind()
 {
     // Check the request token.
     Session::checkToken('post');
     $model = $this->getModel('User', 'UsersModel');
     $data = Request::getVar('jform', array(), 'post', 'array');
     // Submit the username remind request.
     $return = $model->processRemindRequest($data);
     // Check for a hard error.
     if ($return instanceof Exception) {
         // Get the error message to display.
         if (Config::get('error_reporting')) {
             $message = $return->getMessage();
         } else {
             $message = Lang::txt('COM_USERS_REMIND_REQUEST_ERROR');
         }
         // Get the route to the next page.
         $itemid = UsersHelperRoute::getRemindRoute();
         $itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
         $route = 'index.php?option=com_users&view=remind' . $itemid;
         // Go back to the complete form.
         $this->setRedirect(Route::url($route, false), $message, 'error');
         return false;
     } elseif ($return === false) {
         // Complete failed.
         // Get the route to the next page.
         $itemid = UsersHelperRoute::getRemindRoute();
         $itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
         $route = 'index.php?option=com_users&view=remind' . $itemid;
         // Go back to the complete form.
         $message = Lang::txt('COM_USERS_REMIND_REQUEST_FAILED', $model->getError());
         $this->setRedirect(Route::url($route, false), $message, 'notice');
         return false;
     } else {
         // Complete succeeded.
         // Get the route to the next page.
         $itemid = UsersHelperRoute::getLoginRoute();
         $itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
         $route = 'index.php?option=com_users&view=login' . $itemid;
         // Proceed to the login form.
         $message = Lang::txt('COM_USERS_REMIND_REQUEST_SUCCESS');
         $this->setRedirect(Route::url($route, false), $message);
         return true;
     }
 }
开发者ID:kevinwojo,项目名称:hubzero-cms,代码行数:50,代码来源:user.php

示例15: processRemindRequest

 function processRemindRequest($data)
 {
     // Get the form.
     $form =& $this->getRemindForm();
     // Check for an error.
     if (JError::isError($form)) {
         return $form;
     }
     // Validate the data.
     $data = $this->validate($form, $data);
     // Check the validator results.
     if (JError::isError($data) || $data === false) {
         return $data;
     }
     // Find the user id for the given e-mail address.
     $query = new JQuery();
     $query->select('*');
     $query->from('`#__users`');
     $query->where('`email` = ' . $this->_db->Quote($data['email']));
     // Get the user id.
     $this->_db->setQuery((string) $query);
     $user = $this->_db->loadObject();
     // Check for an error.
     if ($this->_db->getErrorNum()) {
         return new JException(JText::sprintf('USERS_DATABASE_ERROR', $this->_db->getErrorMsg()), 500);
     }
     // Check for a user.
     if (empty($user)) {
         $this->setError(JText::_('USERS_USER_NOT_FOUND'));
         return false;
     }
     // Make sure the user isn't blocked.
     if ($user->block) {
         $this->setError(JText::_('USERS_USER_BLOCKED'));
         return false;
     }
     $config =& JFactory::getConfig();
     // Assemble the login link.
     $itemid = UsersHelperRoute::getLoginRoute();
     $itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
     $link = 'index.php?option=com_users&view=login' . $itemid;
     $mode = $config->getValue('force_ssl', 0) == 2 ? 1 : -1;
     // Put together the e-mail template data.
     $data = JArrayHelper::fromObject($user);
     $data['fromname'] = $config->getValue('fromname');
     $data['mailfrom'] = $config->getValue('mailfrom');
     $data['sitename'] = $config->getValue('sitename');
     $data['link_text'] = JRoute::_($link, false, $mode);
     $data['link_html'] = JRoute::_($link, true, $mode);
     // Load the mail template.
     jimport('joomla.utilities.simpletemplate');
     $template = new JSimpleTemplate();
     if (!$template->load('users.username.remind.request')) {
         return new JException(JText::_('USERS_REMIND_MAIL_TEMPLATE_NOT_FOUND'), 500);
     }
     // Push in the email template variables.
     $template->bind($data);
     // Get the email information.
     $toEmail = $user->email;
     $subject = $template->getTitle();
     $message = $template->getHtml();
     // Send the password reset request e-mail.
     $return = JUtility::sendMail($data['mailfrom'], $data['fromname'], $toEmail, $subject, $message);
     // Check for an error.
     if ($return !== true) {
         return new JException(JText::_('USERS_MAIL_FAILED'), 500);
     }
     return true;
 }
开发者ID:joebushi,项目名称:joomla,代码行数:69,代码来源:user.php


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