<?php

// -----------------------------------------------------------------------
// This file is part of AROUNDMe
//
// Copyright (C) 2003 - 2007 Barnraiser
// http://www.barnraiser.org/
// info@barnraiser.org
//
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option) any
// later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with program; see the file COPYING. If not, write to the Free
// Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
// 02110-1301, USA.
// -----------------------------------------------------------------------

?>
	
	<?php if (isset($_POST['frm_confirm'])) { am_email_save($_POST); header("location: install.php?step=5"); exit; } ?>

	<?php if (isset($_POST['frm_send'])) { ?>
	
		<div class="message">
			<p><b><?php echo $lang['txt_system_message']; ?></b></p>
			
			<?php if (am_check_email($_POST)) { ?>
				<?php echo $lang['txt_step_4_confirm']; ?>
				<form method="post" action="install.php">
					<input type="hidden" name="step" value="4" />
					<input type="hidden" name="frm_email_host" value="<?php echo isset($_REQUEST['frm_email_host']) ? $_REQUEST['frm_email_host'] : ''; ?>" />
					<input type="hidden" name="frm_email_port" value="<?php echo isset($_REQUEST['frm_email_port']) ? $_REQUEST['frm_email_port'] : '25'; ?>" />
					<input type="hidden" name="frm_email_no_reply" value="<?php echo isset($_REQUEST['frm_email_no_reply']) ? $_REQUEST['frm_email_no_reply'] : ''; ?>"/>
					<input type="hidden" name="frm_email_default" value="<?php echo isset($_REQUEST['frm_email_default']) ? $_REQUEST['frm_email_default'] : ''; ?>"/>
					<input type="hidden" name="frm_email_mailer" value="<?php echo $_REQUEST['frm_email_mailer'];?>" />
					<input type="hidden" name="frm_email_from_name" value="<?php echo isset($_REQUEST['frm_email_from_name']) ? $_REQUEST['frm_email_from_name'] : ''; ?>"/>
					<p align="right">
						<input type="submit" value="<?php echo $lang['frm_step_4_confirm']; ?>" name="frm_confirm"/>
					</p>			
				</form>
			<?php } ?>	
		</div>
	
	<?php } ?>
	
	<form method="post" action="install.php" name="frm">
		<input type="hidden" name="step" value="4" />
		<p><?php echo $lang['txt_step_4']; ?></p>
		
		<table width="100%">
		<tr>
			<td><label><?php echo $lang['txt_step_4_email_host']; ?></label></td>
			<td><input type="text" name="frm_email_host" value="<?php echo isset($_REQUEST['frm_email_host']) ? $_REQUEST['frm_email_host'] : ''; ?>"/></td>
		</tr>
		
		<tr>
			<td><label><?php echo $lang['txt_step_4_email_port']; ?></label></td>
			<td><input type="text" name="frm_email_port" value="<?php echo isset($_REQUEST['frm_email_port']) ? $_REQUEST['frm_email_port'] : '25'; ?>"/></td>
		</tr>
		
		<tr>
			<td><label><?php echo $lang['txt_step_4_email_noreply']; ?></label></td>
			<td><input type="text" name="frm_email_no_reply" value="<?php echo isset($_REQUEST['frm_email_no_reply']) ? $_REQUEST['frm_email_no_reply'] : ''; ?>"/></td>
		</tr>
		
		<tr>
			<td><label><?php echo $lang['txt_step_4_email_default']; ?></label></td>
			<td><input type="text" name="frm_email_default" value="<?php echo isset($_REQUEST['frm_email_default']) ? $_REQUEST['frm_email_default'] : ''; ?>"/></td>
		</tr>
		
		<tr>
			<td><label><?php echo $lang['txt_step_4_email_mailer']; ?></label></td>
			<td><select name="frm_email_mailer">
				<option value="mail" <?php if (isset($_REQUEST['frm_email_mailer']) && $_REQUEST['frm_email_mailer'] == "mail") { echo "selected='selected'"; } ?>>mail</option>
				<option value="sendmail" <?php if (isset($_REQUEST['frm_email_mailer']) && $_REQUEST['frm_email_mailer'] == "sendmail") { echo "selected='selected'"; } ?>>sendmail</option>
				<option value="smtp" <?php if (isset($_REQUEST['frm_email_mailer']) && $_REQUEST['frm_email_mailer'] == "smtp") { echo "selected='selected'"; } ?>>smtp</option>			
			</select></td>
		</tr>
		
		<tr>
			<td><label><?php echo $lang['txt_step_4_email_fromname']; ?></label></td>
			<td><input type="text" name="frm_email_from_name" value="<?php echo isset($_REQUEST['frm_email_from_name']) ? $_REQUEST['frm_email_from_name'] : ''; ?>"/></td>
		</tr>
		
		<tr>
			<td><label><?php echo $lang['txt_step_4_email_myemail']; ?></label></td>
			<td><input type="text" name="frm_email_my" value="<?php echo isset($_REQUEST['frm_email_my']) ? $_REQUEST['frm_email_my'] : ''; ?>"/></td>
		</tr>
		
		<tr>
			<td></td>
			<td>
				<p align="right">
					<input type="submit" value="<?php echo $lang['frm_step_4_next_step']; ?>" name="frm_send"/>
				</p>
			</td>					
		</tr>
		</table>
	</form>
	
	