PageRenderTime 47ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/modules/mod_login/helper.php

https://github.com/joebushi/joomla
PHP | 38 lines | 25 code | 4 blank | 9 comment | 1 complexity | 757676dfe147e2b103b385ac994a2398 MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0
  1. <?php
  2. /**
  3. * @version $Id$
  4. * @package Joomla.Site
  5. * @subpackage mod_login
  6. * @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
  7. * @license GNU General Public License version 2 or later; see LICENSE.txt
  8. */
  9. // no direct access
  10. defined('_JEXEC') or die;
  11. class modLoginHelper
  12. {
  13. static function getReturnURL($params, $type)
  14. {
  15. if ($itemid = $params->get($type))
  16. {
  17. $menu = &JSite::getMenu();
  18. $item = $menu->getItem($itemid);
  19. $url = JRoute::_($item->link.'&Itemid='.$itemid, false);
  20. }
  21. else
  22. {
  23. // stay on the same page
  24. $uri = JFactory::getURI();
  25. $url = $uri->toString(array('path', 'query', 'fragment'));
  26. }
  27. return base64_encode($url);
  28. }
  29. static function getType()
  30. {
  31. $user = & JFactory::getUser();
  32. return (!$user->get('guest')) ? 'logout' : 'login';
  33. }
  34. }