<?php

	/*
	*	Gekko - Open Source Web Development Framework
	*	------------------------------------------------------------------------
	*	Copyright (C) 2004-2005, J. Carlos Nieto <xiam@users.sourceforge.net>
	*	This program is Free Software.
	*
	*	@package	Gekko
	*	@license	http://www.gnu.org/copyleft/gpl.html GNU/GPL License 2.0
	*	@author		J. Carlos Nieto <xiam@users.sf.net>
	*	@version	CVS: $Id:$
	*	@link		http://gekkoware.sourceforge.net
	*/

	if (!defined("IN-BLOCK")) die();

	/*
	<%%>
	<?xml version="1.0" encoding="UTF-8"?>
	<blockscript>
		<info lang="en">
			<title>Who am I?</title>
			<description>Shows  identification for the logged user or a login form for visitors</description>
			<author><![CDATA[xiam &lt;<a href="mailto:xiam@users.sourceforge.net">xiam@users.sourceforge.net</a>&gt;]]></author>
			<homepage><![CDATA[<a href="http://www.gekkoware.org">http://www.gekkoware.org</a>]]></homepage>
		</info>
		<info lang="es">
			<title><![CDATA[&iquest;Qui&eacute;n soy?]]></title>
			<description><![CDATA[Muestra una identificaci&oacute;n al usuario que ha ingresado o un formulario para ingresar a los visitantes]]></description>
		</info>
	</blockscript>
	<%%>
	*/

	require_once GEKKO_ROOT."modules/users/main.lib.php";

	if (gauth("$")) {

		$avatar = mkUserAvatar($GLOBALS["User"]["ID"]);
		$return = "<div class=\"avatar\" style=\"float: left\">{$avatar}</div><br /><b>".cache_func("getuserbyid({$GLOBALS["User"]["ID"]})")."</b><br />{$GLOBALS["User"]["Realname"]}<br /><br /><br />";

	} else {

		$safe_mode = isset($_SERVER["HTTPS"]) ?  _l("L_SAFE") : '<a href="https://'.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"].'">'._l("L_SAFE").'</a>';
		$normal_mode = isset($_SERVER["HTTPS"]) ? '<a href="http://'.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"].'">'._l("L_NORMAL").'</a>' : _l("L_NORMAL");

		$return = '
		<b>'._l("L_LOGIN").'</b><br />
		<form action="'._l("C_SITE.REL_URL").'modules/users/main.act.php" method="post">
		<input type="hidden" name="action" value="login" />
		<input type="hidden" name="return" value="" />
		<input type="hidden" name="auth" value="'._l("C_AUTH_STR").'" />
		'._l("L_USERNAME").':<br />
		<input class="text" type="text" name="username" value="" /><br />
		'._l("L_PASSWORD").':<br />
		<input class="text" type="password" name="password" /><br />
		'._l("B_SUBMIT").'<hr />
		<b>'._l("L_MODE").':</b><br />
		'.$normal_mode.' | '.$safe_mode.'
		</form>';
	}
?>