- md5
- e54f20a8976f057be30795684f83fb73
- sha1
- 91136dd6752fb711913aa23d50e87d1b515411cc
- sha256
- 4d6ce18f4ec828c7884eedfa3ac2153d5ec374dca0a7d5a015c8d3c5eb881900
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
<?php
/**
* @package Joomla.Site
* @subpackage mod_login
*
* @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Helper for mod_login
*
* @package Joomla.Site
* @subpackage mod_login
*
* @since 1.5
*/
class ModLoginHelper
{
/**
* Retrieve the url where the user should be returned after logging in
*
* @param JRegistry $params module parameters
* @param string $type return type
*
* @return string
*/
public static function getReturnURL($params, $type)
{
$app = JFactory::getApplication();
$router = $app::getRouter();
$url = null;
if ($itemid = $params->get($type))
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select($db->quoteName('link'))
->from($db->quoteName('#__menu'))
->where($db->quoteName('published') . '=1')
->where($db->quoteName('id') . '=' . $db->quote($itemid));
$db->setQuery($query);
if ($link = $db->loadResult())
{
if ($router->getMode() == JROUTER_MODE_SEF)
{
$url = 'index.php?Itemid=' . $itemid;
}
else
{
$url = $link . '&Itemid=' . $itemid;
}
}
}
if (!$url)
{
// Stay on the same page
$uri = clone JUri::getInstance();
$vars = $router->parse($uri);
unset($vars['lang']);
if ($router->getMode() == JROUTER_MODE_SEF)
{
if (isset($vars['Itemid']))
{
$itemid = $vars['Itemid'];
$menu = $app->getMenu();
$item = $menu->getItem($itemid);
unset($vars['Itemid']);
if (isset($item) && $vars == $item->query)
{
$url = 'index.php?Itemid=' . $itemid;
}
else
{
$url = 'index.php?' . JUri::buildQuery($vars) . '&Itemid=' . $itemid;
}
}
else
{
$url = 'index.php?' . JUri::buildQuery($vars);
}
}
else
{
$url = 'index.php?' . JUri::buildQuery($vars);
}
}
return base64_encode($url);
}
/**
* Returns the current users type
*
* @return string
*/
public static function getType()
{
$user = JFactory::getUser();
return (!$user->get('guest')) ? 'logout' : 'login';
}
/**
* Get list of available two factor methods
*
* @return array
*/
public static function getTwoFactorMethods()
{
require_once JPATH_ADMINISTRATOR . '/components/com_users/helpers/users.php';
return UsersHelper::getTwoFactorMethods();
}
}
The same content is in 6 releases, Joomla 3.3.1 to 3.3.6. See them all, or every version of this file.