[ Index ]

PHP Cross Reference of Mambo 4.6.5

[ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/modules/ -> mod_login.php (source)

   1  <?php
   2  /**
   3  * @package Mambo
   4  * @author Mambo Foundation Inc see README.php
   5  * @copyright (C) 2000 - 2009 Mambo Foundation Inc.
   6  * See COPYRIGHT.php for copyright notices and details.
   7  * @license GNU/GPL Version 2, see LICENSE.php
   8  *
   9  * Redistributions of files must retain the above copyright notice.
  10  *
  11  * Mambo is free software; you can redistribute it and/or
  12  * modify it under the terms of the GNU General Public License
  13  * as published by the Free Software Foundation; version 2 of the License.
  14  */
  15  
  16  /** ensure this file is being included by a parent file */
  17  defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
  18  
  19  global $mosConfig_locale;
  20  
  21  if (isset($_SERVER['QUERY_STRING']) AND $_SERVER['QUERY_STRING']) $return = 'index.php?'.mosGetParam ($_SERVER,"QUERY_STRING","");
  22  else $return = 'index.php';
  23  
  24  // converts & to &amp; for xtml compliance
  25  $return = str_replace( '&', '&amp;', $return );
  26  
  27  $registration_enabled     = $mainframe->getCfg( 'allowUserRegistration' );
  28  $message_login             = $params->def( 'login_message', 0 );
  29  $message_logout         = $params->def( 'logout_message', 0 );
  30  $pretext     = $params->get( 'pretext' );
  31  $posttext     = $params->get( 'posttext' );
  32  $login         = $params->def( 'login', $return );
  33  $logout     = $params->def( 'logout', $return );
  34  $name         = $params->def( 'name', 1 );
  35  $greeting     = $params->def( 'greeting', 1 );
  36  
  37  if ( $name AND $my->id ) {
  38      $query = "SELECT name FROM #__users WHERE id = ". $my->id;
  39      $database->setQuery( $query );
  40      $name = $database->loadResult();
  41  } else {
  42      $name = $my->username;
  43  }
  44  
  45  if ( $my->id ) {
  46      ?>
  47      <form action="<?php echo sefRelToAbs('index.php'); ?>" method="post">
  48      <?php
  49      if ( $greeting ) {
  50          printf(T_('Hi, %s'), $name);
  51      }
  52      ?>
  53      <br />
  54      <div align="center">
  55      <input type="submit" class="button" value="<?php echo T_('Logout'); ?>" />
  56      <input type="hidden" name="option" value="logout" />
  57      <input type="hidden" name="op2" value="logout" />
  58      <input type="hidden" name="lang" value="<?php echo $mosConfig_locale; ?>" />
  59      <input type="hidden" name="return" value="<?php echo sefRelToAbs( $logout ); ?>" />
  60      <input type="hidden" name="message" value="<?php echo $message_logout; ?>" />
  61      </div>
  62      </form>
  63      <?php
  64  } else {
  65      ?>
  66      <form action="<?php echo sefRelToAbs('index.php'); ?>" method="post" name="login" >
  67      <?php
  68      echo $pretext;
  69      ?>
  70      <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
  71      <tr>
  72          <td>
  73          <?php echo T_('Username'); ?>
  74          <br />
  75          <input name="username" type="text" class="inputbox" alt="<?php echo T_('username') ?>" size="10" />
  76          <br />
  77          <?php echo T_('Password'); ?>
  78          <br />
  79          <input type="password" name="passwd" class="inputbox" size="10" alt="<?php echo T_('password') ?>" />
  80          <br />
  81          <input type="checkbox" name="remember" class="inputbox" value="yes" alt="<?php echo T_('Remember Me'); ?>" /> 
  82          <?php echo T_('Remember me'); ?>
  83          <br />
  84          <input type="hidden" name="option" value="login" />
  85          <input type="submit" name="Submit" class="button" value="<?php echo T_('Login'); ?>" />
  86          </td>
  87      </tr>
  88      <tr>
  89          <td>
  90          <a href="<?php echo sefRelToAbs( 'index.php?option=com_registration&amp;task=lostPassword' ); ?>">
  91          <?php echo T_('Password Reminder'); ?>
  92          </a>
  93          </td>
  94      </tr>
  95      <?php
  96      if ( $registration_enabled ) {
  97          ?>
  98          <tr>
  99              <td>
 100              <?php echo T_('No account yet?'); ?>
 101              <a href="<?php echo sefRelToAbs( 'index.php?option=com_registration&amp;task=register' ); ?>">
 102              <?php echo T_('Create one'); ?>
 103              </a>
 104              </td>
 105          </tr>
 106          <?php
 107      }
 108      ?>
 109      </table>
 110      <?php
 111      echo $posttext;
 112      ?>
 113      
 114      <input type="hidden" name="op2" value="login" />
 115      <input type="hidden" name="lang" value="<?php echo $mosConfig_locale; ?>" />
 116      <input type="hidden" name="return" value="<?php echo sefRelToAbs( $login ); ?>" />
 117      <input type="hidden" name="message" value="<?php echo $message_login; ?>" />
 118      </form>
 119      <?php
 120  }
 121  ?>