<?php
// $Id: mod_login.php,v 1.29 2004/04/06 21:28:53 eddieajau Exp $
/**
* Login Module
* @package Mambo Open Source
* @Copyright (C) 2000 - 2003 Miro International Pty Ltd
* @ All rights reserved
* @ Mambo Open Source is Free Software
* @ Released under GNU/GPL License : http://www.gnu.org/copyleft/gpl.html
* @version $Revision: 1.29 $
**/

defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

// module parameter may override the system configuration setting
$registration_enabled = $mainframe->getCfg( 'allowUserRegistration' );
$pretext = @$params->pretext ? $params->pretext : '';
$posttext = @$params->posttext ? $params->posttext : '';

$return = mosGetParam( $_SERVER, 'REQUEST_URI', null );
if ($my->id) {
	echo _HI; ?><?php echo $my->username;?>
	<br />
	<a href="<?php echo sefRelToAbs("index.php?option=logout&return=$return"); ?>"><?php echo _BUTTON_LOGOUT; ?></a>
	<?php
} else {
	?>
	<form action="<?php echo sefRelToAbs("index.php?option=login"); ?>" method="post" name="login">
<?php	echo $pretext; ?>
	<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
	<tr>
	  <td>
		<?php echo _USERNAME; ?><br /><input type="text" name="username" class="inputbox" size="10" /><br />
		<?php echo _PASSWORD; ?><br /><input type="password" name="passwd" class="inputbox" size="10" /><br />
		<input type="hidden" name="op2" value="login" />
		<input type="hidden" name="lang" value="<?php echo $mosConfig_lang; ?>" />
		<input type="hidden" name="return" value="<?php echo $return; ?>" />
		<input type="checkbox" name="remember" class="inputbox" value="yes" /> <?php echo _REMEMBER_ME; ?><br />
		<input type="submit" name="Submit" class="button" value="<?php echo _BUTTON_LOGIN; ?>" />
	  </td>
	</tr>
	<tr>
	  <td><a href="<?php echo sefRelToAbs("index.php?option=com_registration&amp;task=lostPassword"); ?>"><?php echo _LOST_PASSWORD; ?></a>?</td>
	</tr>
	</table>
<?php	echo $posttext; ?>
	</form>
<?php
	if ($registration_enabled) {
		?>
		<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
		<tr>
		  <td><?php echo _NO_ACCOUNT; ?>
		  <a href="<?php echo sefRelToAbs("index.php?option=com_registration&amp;task=register"); ?>">
		  <?php echo _CREATE_ACCOUNT;?></a></td>
		</tr>
	</table>
	<?php
	}
}
?>
