Source for file helper.php

Documentation is available at helper.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Site
  4.  * @subpackage  mod_login
  5.  *
  6.  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
  7.  * @license     GNU General Public License version 2 or later; see LICENSE.txt
  8.  */
  9.  
  10. defined('_JEXEC'or die;
  11.  
  12. /**
  13.  * Helper for mod_login
  14.  *
  15.  * @package     Joomla.Site
  16.  * @subpackage  mod_login
  17.  * @since       1.5
  18.  */
  19. {
  20.     public static function getReturnURL($params$type)
  21.     {
  22.         $app    JFactory::getApplication();
  23.         $router $app->getRouter();
  24.         $url null;
  25.         if ($itemid $params->get($type))
  26.         {
  27.             $db        JFactory::getDbo();
  28.             $query    $db->getQuery(true)
  29.                 ->select($db->quoteName('link'))
  30.                 ->from($db->quoteName('#__menu'))
  31.                 ->where($db->quoteName('published''=1')
  32.                 ->where($db->quoteName('id''=' $db->quote($itemid));
  33.  
  34.             $db->setQuery($query);
  35.             if ($link $db->loadResult())
  36.             {
  37.                 if ($router->getMode(== JROUTER_MODE_SEF)
  38.                 {
  39.                     $url 'index.php?Itemid='.$itemid;
  40.                 }
  41.                 else {
  42.                     $url $link.'&Itemid='.$itemid;
  43.                 }
  44.             }
  45.         }
  46.         if (!$url)
  47.         {
  48.             // Stay on the same page
  49.             $uri clone JUri::getInstance();
  50.             $vars $router->parse($uri);
  51.             unset($vars['lang']);
  52.             if ($router->getMode(== JROUTER_MODE_SEF)
  53.             {
  54.                 if (isset($vars['Itemid']))
  55.                 {
  56.                     $itemid $vars['Itemid'];
  57.                     $menu $app->getMenu();
  58.                     $item $menu->getItem($itemid);
  59.                     unset($vars['Itemid']);
  60.                     if (isset($item&& $vars == $item->query)
  61.                     {
  62.                         $url 'index.php?Itemid='.$itemid;
  63.                     }
  64.                     else {
  65.                         $url 'index.php?'.JUri::buildQuery($vars).'&Itemid='.$itemid;
  66.                     }
  67.                 }
  68.                 else
  69.                 {
  70.                     $url 'index.php?'.JUri::buildQuery($vars);
  71.                 }
  72.             }
  73.             else
  74.             {
  75.                 $url 'index.php?'.JUri::buildQuery($vars);
  76.             }
  77.         }
  78.  
  79.         return base64_encode($url);
  80.     }
  81.  
  82.     public static function getType()
  83.     {
  84.         $user JFactory::getUser();
  85.         return (!$user->get('guest')) 'logout' 'login';
  86.     }
  87.  
  88.     public static function getTwoFactorMethods()
  89.     {
  90.         require_once JPATH_ADMINISTRATOR '/components/com_users/helpers/users.php';
  91.         return UsersHelper::getTwoFactorMethods();
  92.     }
  93. }

Documentation generated on Tue, 19 Nov 2013 15:04:22 +0100 by phpDocumentor 1.4.3