##############################################################
## MOD Title: Olympus-Style Login Screen
## MOD Author: afterlife_69 < afterlife_69[at]hotmail[dot]com > (Dean Newman) http://www.GamerzVault.com/
## MOD Description: This MOD will change the style of the login screen on phpBB 2.0.X to the style on Olympus (phpBB 3.0)
## MOD Version: 1.8.0
##
## Traduccion Espaol: ThE KuKa - http://www.phpbb-es.com
##
## Installation Level:	Easy
## Installation Time:	10 Minutes
## Files To Edit:	language/lang_english/lang_main.php, login.php, templates/subSilver/login_body.tpl, profile.php
## Included Files:	templates/subSilver/profile_resendactivation.tpl, includes/usercp_sendactivation.php, language/lang_english/email/user_activate_resend.tpl
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/
##############################################################
## Author Notes:
##	Originaly planned to be a clone of the login screen featured in olympus, 
##	it has now become more featured than the olympus login screen.
##
##############################################################
## MOD History:
##
##	2005-02-24 - Version 1.0.0
##		- Initial Release :)
##
##	2005-03-02 - Version 1.1.0
##		- Changed 'Return to Forum' to 'Board Index'
##		- Fixed the style of the login box
##		- Released a ForcedLogin_Explained Add-on
##
##	2005-03-19 - Version 1.2.2
##		- Added Resend Activation MOD into it
##		- Added ForcedLogin_Explained Compatiblity (No Add-On Needed)
##
##	2005-06-23 - Version 1.3.0
##		- Added 'Hide my online status this session
##		- Re-styled the box's
##		- Added Switch for the Admin Re-Auth
##
##	2005-06-27 - Version 1.4.0
##		- Added Error Handling for Pass/User/Inactive
##		- Added the 'Sucessfull Login' message from olympus
##		- Added Different message on left for re-authing
##		- Changed 'New User Registration' to 'Create an Account'
##		- Re-Wrote the lang files to be neat and tidy
##		- Added a comment copyright to the template
##		- Double-checked that it works ok with easymod (Passed)
##
##	2005-07-01 - Version 1.5.0
##		- Fixed some coding errors and re-submitted to MODDB
##
##	2005-07-06 - Version 1.6.0
##		- Added a Redirect for the 'Logged In' Message
##
##	2005-07-25 - Version 1.7.0
##		- Fixed 'Hide my online status this session' bug
##		- Resend Activation now checks to see if activation is set to ADMIN
##
##	2005-07-26 - Version 1.8.0
##		- Changed '2' to USER_ACTIVATION_ADMIN in the account activation mode checks
##		- Fixed a template error where tabindex was '4' on autologin and '5' on hide-my-online-status
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
############################################################## 

#
#-----[ COPY ]------------------------------------------
#
copy templates/subSilver/profile_resendactivation.tpl to templates/subSilver/profile_resendactivation.tpl
copy includes/usercp_sendactivation.php to includes/usercp_sendactivation.php
copy language/lang_english/email/user_activate_resend.tpl to language/lang_english/email/user_activate_resend.tpl

# 
#-----[ OPEN ]------------------------------------------------
# 
language/lang_english/lang_main.php

# 
#-----[ FIND ]------------------------------------------------ 
# 
$lang['Forgotten_password'] = 'I forgot my password';

# 
#-----[ AFTER, ADD ]----------------------------------------- 
#
// [+] 'Olympus Style' Login Screen
	$lang['olympus_login_BoardIndex'] = 'Board Index';
	$lang['olympus_login_CreateAccount'] = 'Create an Account';
	$lang['olympus_login_ViewFAQ'] = 'View FAQ';
	$lang['olympus_login_Resend_Activation'] = 'Resend Activation';
	$lang['olympus_login_HideOnlineSession'] = 'Hide my online status this session';
	$lang['olympus_login_NewActivationSent'] = 'A new activation key has been sent; please check your e-mail for details on how to activate it.';

	$lang['olympus_login_NoAccount'] = 'It appears that this account does not exist';
	$lang['olympus_login_WrongPassword'] = 'It appears that you have entered an incorrect password';
	$lang['olympus_login_InactiveAccount'] = 'It appears that this account is inactive';
	$lang['olympus_login_LoggedIn'] = 'You have successfully logged in';
	
	$lang['olympus_login_ActivateAccountMsg'] = 'Click %shere%s to send a new activation code';
	$lang['olympus_login_RegisterAccountMsg'] = 'Click %shere%s to register this account';
	$lang['olympus_login_SendPasswordMsg'] = 'Click %shere%s to send a new password';

	$lang['olympus_login_LoginInfo'] = 'In order to login you must be registered.<br />Registering takes only a few seconds but gives you increased<br />capabilies. The board administrator may also grant additional<br />permissions to registered users. Before you login please ensure you<br />are familiar with our terms of use and related policies. Please<br />ensure you read any forum rules as you navigate around the board.';
	$lang['olympus_login_AdminInfo'] = 'To login to the administration panel you must re-authenticate yourself to verify you are really the administrator of the board<br /><br />Once logged in you will be able to access the ACP until your session ends';

	$lang['olympus_login_Click_return'] = 'Click %sHere%s to return to the where you were previously';
	$lang['olympus_login_No_send_account_active'] = 'An error has occured and we cannot continue, Please contact your administrator';
	$lang['oly_adminactivation'] = 'Sorry but this board currently has ADMIN only activation enabled, Your account can only be activated by an administrator';
// [-] 'Olympus Style' Login Screen 

# 
#-----[ OPEN ]------------------------------------------------
# 
language/lang_spanish/lang_main.php

# 
#-----[ FIND ]------------------------------------------------ 
# Busqueda parcial, esta linea acaba en punto y coma ;
$lang['Forgotten_password']

# 
#-----[ AFTER, ADD ]----------------------------------------- 
#
// [+] 'Olympus Style' Login Screen
	$lang['olympus_login_BoardIndex'] = 'Indice del Foro';
	$lang['olympus_login_CreateAccount'] = 'Crear una Cuenta';
	$lang['olympus_login_ViewFAQ'] = 'Ver FAQ';
	$lang['olympus_login_Resend_Activation'] = 'Volver a enviar Activacion';
	$lang['olympus_login_HideOnlineSession'] = 'Ocultar mi estado de conexion en esta sesion';
	$lang['olympus_login_NewActivationSent'] = 'Un nuevo codigo de activacion a sido enviado, por favor revise su correo electronico para mas detalles sobre como activar su cuenta.';

	$lang['olympus_login_NoAccount'] = 'Al parecer esta cuenta no existe';
	$lang['olympus_login_WrongPassword'] = 'Al parecer a introducido una contrasea incorrecta';
	$lang['olympus_login_InactiveAccount'] = 'Al parecer esta cuenta esta inactiva';
	$lang['olympus_login_LoggedIn'] = 'Usted esta identificado con exito';
	
	$lang['olympus_login_ActivateAccountMsg'] = 'Clic %sAqui%s para enviar un nuevo codigo de activacion';
	$lang['olympus_login_RegisterAccountMsg'] = 'Clic %sAqui%s para registrar esta cuenta';
	$lang['olympus_login_SendPasswordMsg'] = 'Clic %sAqui%s para enviar una nueva contrasea';

	$lang['olympus_login_LoginInfo'] = 'Para identificarse debe estar registrado.<br />Registrarse son solamente unos segundos y se incrementan las posibilidades.<br /> El Administrador del foro tambin puede conceder<br />permisos adicionales a los usuarios registrados. Antes de identificarse, por favor asegurese<br />que esta al corriente de los terminos de uso y de las politicas relacionadas.<br />Por favor lea las Normas del foro para navegar en este.';
	$lang['olympus_login_AdminInfo'] = 'Para identificarse en el Panel de Administracion debe introducir de nuevo su contrasea para verificar que usted es realmente el Administrador del foro<br /><br />Una vez identificado podra acceder al ACP hasta que esta sesion finalice';

	$lang['olympus_login_Click_return'] = 'Clic %sAqui%s para volver a donde estaba previamente';
	$lang['olympus_login_No_send_account_active'] = 'Ha ocurrido un error y no se puede continuar, por favor contacte con el Administrador';
	$lang['oly_adminactivation'] = 'Perdone pero en este foro actualmente es el Administrador quien activa las cuentas solamente, su cuenta solamente podra ser activada por un Administrador';
// [-] 'Olympus Style' Login Screen 

# 
#-----[ OPEN ]------------------------------------------------
# 
login.php

# 
#-----[ FIND ]------------------------------------------------ 
# 
$autologin = ( isset($HTTP_POST_VARS['autologin']) ) ? TRUE : 0;

# 
#-----[ AFTER, ADD ]------------------------------------------------ 
# 
// [+] 'Olympus Style' Login Screen
						$hideonlinestatus = ( isset($HTTP_POST_VARS['hideonline']) ) ? 0 : 1;
// [-] 'Olympus Style' Login Screen

# 
#-----[ FIND ]------------------------------------------------ 
# 
if( $session_id )

# 
#-----[ BEFORE, ADD ]------------------------------------------------ 
#
// [+] 'Olympus Style' Login Screen
						$sql = "UPDATE " . USERS_TABLE . " SET user_allow_viewonline = '" . $hideonlinestatus . "' WHERE user_id = '" . $row['user_id'] . "'";
						if ( !( $result = $db->sql_query( $sql ) ) )
						{
							message_die(GENERAL_ERROR, 'Error in updating online status', '', __LINE__, __FILE__, $sql);
						}
						if(! $HTTP_POST_VARS['admin'] )
						{
							if ( empty ( $HTTP_POST_VARS['redirect'] ) )
							{
								$template->assign_vars(array(
									'META' => "<meta http-equiv=\"refresh\" content=\"3;url=index.$phpEx\">")
								);
								$message = $lang['olympus_login_LoggedIn'] . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
								message_die(GENERAL_MESSAGE, $message);
							}
							else
							{
								$template->assign_vars(array(
									'META' => "<meta http-equiv=\"refresh\" content=\"3;url=" . append_sid( $HTTP_POST_VARS['redirect'] ) . "\">")
								);
								$message = $lang['olympus_login_LoggedIn'] . '<br /><br />' . sprintf($lang['olympus_login_Click_return'], '<a href="' . append_sid( htmlspecialchars( $HTTP_POST_VARS['redirect'] ) ) . '">', '</a>');
								message_die(GENERAL_MESSAGE, $message);
							}
						}
// [-] 'Olympus Style' Login Screen

# 
#-----[ FIND ]------------------------------------------------ 
# 
						redirect(append_sid($url, true));
					}

# 
#-----[ AFTER, ADD ]------------------------------------------------ 
# 
// [+] 'Olympus Style' Login Screen
					else if ( ! $row['user_active'] )
					{
						$message = $lang['olympus_login_InactiveAccount'] . '<br /><br />' . sprintf($lang['olympus_login_ActivateAccountMsg'], "<a href=\"profile.$phpEx?mode=resendactivation\">", '</a>') . '<br /><br />' .  sprintf($lang['Click_return_login'], '<a href="' . append_sid("login.$phpEx") . '">', '</a>');
						message_die(GENERAL_MESSAGE, $message);
					}
// [-] 'Olympus Style' Login Screen
# 
#-----[ FIND ]------------------------------------------------ 
# 
						message_die(GENERAL_ERROR, 'Tried to redirect to potentially insecure url.');
					}

# 
#-----[ AFTER, ADD ]------------------------------------------------ 
# 
// [+] 'Olympus Style' Login Screen
					$message = $lang['olympus_login_WrongPassword'] . '<br /><br />' . sprintf($lang['olympus_login_SendPasswordMsg'], "<a href=\"profile.$phpEx?mode=sendpassword\">", '</a>') . '<br /><br />' .  sprintf($lang['Click_return_login'], '<a href="' . append_sid("login.$phpEx") . '">', '</a>');
					message_die(GENERAL_MESSAGE, $message);
// [-] 'Olympus Style' Login Screen

# 
#-----[ FIND ]------------------------------------------------ 
# 
				message_die(GENERAL_ERROR, 'Tried to redirect to potentially insecure url.');
			}

# 
#-----[ AFTER, ADD ]------------------------------------------------ 
# 
// [+] 'Olympus Style' Login Screen
			$message = $lang['olympus_login_NoAccount'] . '<br /><br />' . sprintf($lang['olympus_login_RegisterAccountMsg'], "<a href=\"profile.$phpEx?mode=register\">", '</a>') . '<br /><br />' .  sprintf($lang['Click_return_login'], '<a href="' . append_sid("login.$phpEx") . '">', '</a>');
			message_die(GENERAL_MESSAGE, $message);
// [-] 'Olympus Style' Login Screen

# 
#-----[ FIND ]------------------------------------------------ 
# 
		'L_SEND_PASSWORD' => $lang['Forgotten_password'],

# 
#-----[ AFTER, ADD ]----------------------------------------- 
#
		// [+] 'Olympus Style' Login Screen
			'L_OL_REGISTER' => $lang['olympus_login_CreateAccount'],
			'L_OL_INFOLOGIN' => $lang['olympus_login_LoginInfo'],
			'L_OL_BINDEX' => $lang['olympus_login_BoardIndex'],
			'L_OL_READFAQ' => $lang['olympus_login_ViewFAQ'],
			'L_OL_INFOADMIN' => $lang['olympus_login_AdminInfo'],
			'L_OL_ACTIVATION' => $lang['olympus_login_Resend_Activation'],
			'L_OL_HIDEONLINESTATUS' => $lang['olympus_login_HideOnlineSession'],
			'L_OL_OPTIONS' => $lang['Options'],

			'U_OL_ACTIVATION' => append_sid("profile.$phpEx?mode=resendactivation"),
		// [-] 'Olympus Style' Login Screen
# 
#-----[ FIND ]------------------------------------------------ 
#
			'S_HIDDEN_FIELDS' => $s_hidden_fields)
		);

# 
#-----[ AFTER, ADD ]----------------------------------------- 
#
// [+] 'Olympus Style' Login Screen
		if( isset( $HTTP_GET_VARS['admin'] ) )
		{
			$template->assign_block_vars('switch_admin_reauth', array());
		}
		if($board_config['require_activation'] !== USER_ACTIVATION_ADMIN && !$userdata['session_logged_in'])
		{
				$template->assign_block_vars('switch_admin_activation', array());
		}
// [-] 'Olympus Style' Login Screen

# 
#-----[ OPEN ]------------------------------------------------
# 
profile.php

# 
#-----[ FIND ]------------------------------------------------ 
# 
else if ( $mode == 'activate' )
	{
		include($phpbb_root_path . 'includes/usercp_activate.'.$phpEx);
		exit;
	}

# 
#-----[ AFTER, ADD ]----------------------------------------- 
#
// [+] 'Olympus Style' Login Screen
else if ( $mode == 'resendactivation' )
	{
		include ( $phpbb_root_path . 'includes/usercp_sendactivation.'.$phpEx );
		exit;
	}
// [-] 'Olympus Style' Login Screen

#
#-----[ OPEN ]---------------------------------------------
#
templates/subSilver/login_body.tpl

#
#-----[ FIND ]----------------------------------------
#
<form action="{S_LOGIN_ACTION}" method="post" target="_top">
#
#-----[ BEFORE, ADD ]------------------------------------------
#
<!--

#
#-----[ FIND ]----------------------------------------
#
</form>

#
#-----[ AFTER, ADD ]------------------------------------------
#
-->
<form action="{S_LOGIN_ACTION}" method="post" target="_top">
<br />
<table width="100%" cellspacing="2" cellpadding="2" border="1" style="border-collapse: collapse; border-style: solid; border-width: 1">
	<tr>
		<td width="80%" align="left" class="row1"><span class="nav">&nbsp;<a href="{U_INDEX}" class="nav">{L_INDEX}</a>  <a href="{U_LOGIN}" class="nav">{L_LOGIN}</a></span></td>
		<td width="20%" align="right" class="row1"><span class="gensmall">&nbsp;{S_TIMEZONE}&nbsp;</span></td>
	</tr>
</table>
<br />
   <table width="100%" cellpadding="4" cellspacing="1" border="0" class="forumline" align="center">
      <tr>
         <th colspan="2">{L_LOGIN}</th>
      </tr>
      <tr>
         <td class="row3" colspan="2" align="center"><span class="gensmall">
         <!-- BEGIN switch_forced_login -->
         {L_FORCED_LOGIN_EXPLAIN}
         <!-- END switch_forced_login -->
         {L_ENTER_PASSWORD}</span>
         </td> 
      </tr>
      <tr>
		<td class="row1" width="50%"><center><span class="gensmall">
		<!-- BEGIN switch_user_logged_out -->
		{L_OL_INFOLOGIN}
		<!-- END switch_user_logged_out -->
		<!-- BEGIN switch_admin_reauth -->
		{L_OL_INFOADMIN}
		<!-- END switch_admin_reauth -->
		</span><br /><br />
		<span class="genmed" align="center"><a href="{U_INDEX}">{L_OL_BINDEX}</a> | 
<!-- BEGIN switch_admin_activation -->
		<a href="{U_OL_ACTIVATION}">{L_OL_ACTIVATION}</a> | 
<!-- END switch_admin_activation -->
		<a href="{U_FAQ}">{L_OL_READFAQ}</a></span> 
		</center></td>
		<td class="row2">
			<table cellspacing="1" cellpadding="4">
				<tr>
					<td class="row1"><b class="gensmall">{L_USERNAME}:</b></td>
					<td width="100%" class="row1">
						<input class="post" type="text" name="username" size="25" maxlength="40" value="{USERNAME}" tabindex="1" /><br />
<!-- BEGIN switch_user_logged_out -->
						<a class="gensmall" href="{U_REGISTER}">{L_OL_REGISTER}</a>
<!-- END switch_user_logged_out -->
					</td>
				</tr>
				<tr>
					<td class="row1"><b class="gensmall">{L_PASSWORD}:</b></td>
					<td width="100%" class="row1">
					<input class="post" type="password" name="password" size="25" maxlength="25" tabindex="2" /><br />
<!-- BEGIN switch_user_logged_out -->
					<a class="gensmall" href="{U_SEND_PASSWORD}">{L_SEND_PASSWORD}</a>
<!-- END switch_user_logged_out -->
					</td>
				</tr>
<!-- BEGIN switch_user_logged_out -->
				<tr>
					<td class="row1"><span class="gensmall"><b>{L_OL_OPTIONS}:</b></span></td>
					<td width="100%" class="row1">
						<span class="gensmall">
						<input type="checkbox" name="autologin" tabindex="5" />{L_AUTO_LOGIN}
						<br />
						<input type="checkbox" name="hideonline" tabindex="5" />{L_OL_HIDEONLINESTATUS}
						</span>
					</td>
				</tr>
<!-- END switch_user_logged_out -->

         		</table>
		</td>
	</tr>
      <tr>
         <td class="cat" colspan="2" align="center">{S_HIDDEN_FIELDS}<input type="submit" name="login" class="mainoption" value="{L_LOGIN}" tabindex="3" /></td>
      </tr>
</table>
<br />
<table width="100%" cellspacing="2" cellpadding="2" border="1" style="border-collapse: collapse; border-style: solid; border-width: 1">
	<tr>
		<td width="80%" align="left" class="row1"><span class="nav">&nbsp;<a href="{U_INDEX}" class="nav">{L_INDEX}</a>  <a href="{U_LOGIN}" class="nav">{L_LOGIN}</a></span></td>
		<td width="20%" align="right" class="row1"><span class="gensmall">&nbsp;{S_TIMEZONE}&nbsp;</span></td>
	</tr>
</table>
<!-- [ 2005  Olympus-Style Login Screen 1.8.0 ] -->
<br /></form>

# 
#-----[ SAVE/CLOSE ALL FILES ]-------------------------------- 
# 
# EoM