[ Index ]

PHP Cross Reference of Joomla 1.5.26 DE

title

Body

[close]

/administrator/components/com_login/ -> admin.login.php (source)

   1  <?php
   2  /**
   3   * @version        $Id: admin.login.php 14401 2010-01-26 14:10:00Z louis $
   4   * @package        Joomla
   5   * @subpackage    Joomla.Extensions
   6   * @copyright    Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
   7   * @license        GNU/GPL, see LICENSE.php
   8   * Joomla! is free software. This version may have been modified pursuant
   9   * to the GNU General Public License, and as distributed it includes or
  10   * is derivative of works licensed under the GNU General Public License or
  11   * other free or open source software licenses.
  12   * See COPYRIGHT.php for copyright notices and details.
  13   */
  14  
  15  // no direct access
  16  defined( '_JEXEC' ) or die( 'Restricted access' );
  17  
  18  switch ( JRequest::getCmd('task'))
  19  {
  20      case 'login' :
  21          LoginController::login();
  22          break;
  23  
  24      case 'logout' :
  25          LoginController::logout();
  26          break;
  27  
  28      default :
  29          LoginController::display();
  30          break;
  31  }
  32  
  33  
  34  /**
  35   * Static class to hold controller functions for the Login component
  36   *
  37   * @static
  38   * @package        Joomla
  39   * @subpackage    Login
  40   * @since        1.5
  41   */
  42  class LoginController
  43  {
  44  	function display()
  45      {
  46          jimport('joomla.application.module.helper');
  47          $module = & JModuleHelper::getModule('mod_login');
  48          $module = JModuleHelper::renderModule($module, array('style' => 'rounded', 'id' => 'section-box'));
  49          echo $module;
  50      }
  51  
  52  	function login()
  53      {
  54          global $mainframe;
  55  
  56          // Check for request forgeries
  57          JRequest::checkToken('request') or jexit( 'Invalid Token' );
  58  
  59          $credentials = array();
  60  
  61          $credentials['username'] = JRequest::getVar('username', '', 'method', 'username');
  62          $credentials['password'] = JRequest::getVar('passwd', '', 'post', 'string', JREQUEST_ALLOWRAW);
  63  
  64          $result = $mainframe->login($credentials);
  65  
  66          if (!JError::isError($result)) {
  67              $mainframe->redirect('index.php');
  68          }
  69  
  70          LoginController::display();
  71      }
  72  
  73  	function logout()
  74      {
  75          global $mainframe;
  76  
  77          $result = $mainframe->logout();
  78  
  79          if (!JError::isError($result)) {
  80              $mainframe->redirect('index.php?option=com_login');
  81          }
  82  
  83          LoginController::display();
  84      }
  85  }


Generated: Wed Mar 28 15:54:07 2012 Cross-referenced by PHPXref 0.7.1