<? $this->title->create($this->Language('Installer')); ?>

<? if(!is_file(_RootFolder.'/d22341sd21782.sql')) $this->error('Database file missing'); ?>
<? $_POST['default_language'] = !$_POST['default_language'] ? 'est' : $_POST['default_language']; ?>

<form method="post" enctype = "multipart/form-data" id="installer">
<table class="header">
<tr>
	<th>HOMEPAGE</th>
	<th></th>
</tr>

<tr>
	<td>default language (3 letters - est,eng,rus,fin etc.)</td>
	<td><input type="text" name="default_language" value="<?=$_POST['default_language'];?>"/></td>
</tr>
<tr>
	<th>DATABASE</th>
	<th></th>
</tr>
<?
if($this->getError('import_error')){

	echo '<tr>
		<td style="color:red;" colspan="2">'.$this->getError('import_error').'</td>
	</tr>';
}
if($this->getError('mysql_error')){

	echo '<tr>
		<td style="color:red;" colspan="2">'.$this->getError('mysql_error').'</td>
	</tr>';
}
if($this->getError('write_error')){

	echo '<tr>
		<td style="color:red;" colspan="2">'.$this->getError('write_error').'</td>
	</tr>';
}
if($this->getError('Database file missing')){

	echo '<tr>
		<td style="color:red;" colspan="2">'.$this->getError('Database file missing').'</td>
	</tr>';
}
if($this->getError('database')){

	echo '<tr>
		<td style="color:red;" colspan="2">'.$this->getError('database').'</td>
	</tr>';
}
?>
<tr>
	<td>phpmyadmin url</td>
	<td><input type="text" name="phpmyadmin" value="<?=$_POST['phpmyadmin'];?>"/></td>
</tr>
<tr>
	<td>host</td>
	<td><input type="text" name="host" value="<?=$_POST['host'];?>"/></td>
</tr>
<tr>
	<td>port</td>
	<td><input type="text" name="port" value="<?=($_POST['port'] ? $_POST['port'] : '3306');?>"/></td>
</tr>
<tr>
	<td>database</td>
	<td><input type="text" name="database" value="<?=$_POST['database'];?>"/></td>
</tr>
<tr>
	<td>user</td>
	<td><input type="text" name="user" value="<?=$_POST['user'];?>"/></td>
</tr>
<tr>
	<td>password</td>
	<td><input type="text" name="password" value="<?=$_POST['password'];?>"/></td>
</tr>
<tr>
	<td>error report email</td>
	<td><input type="text" name="error_report_email" value="<?=$_POST['error_report_email'];?>"/></td>
</tr>

<tr>
	<th>USER</th>
	<th></th>
</tr>

<tr>
	<td>user</td>
	<td><input type="text" name="admin_user" value="<?=$_POST['admin_user'];?>"/></td>
</tr>
<tr>
	<td>password</td>
	<td><input type="text" name="admin_password" value="<?=$_POST['admin_password'];?>"/></td>
</tr>

<tr>
	<td></td>
	<td><input type="submit" name="install" value="Install"/></td>
</tr>

</table>
</form>

<? if($this->getError("json")){ ?>

	<script type="text/javascript">
	var json_data = '<?=$this->getError("json");?>';
	$('#installer').validate({jsonData : json_data});
	</script>
<? } ?>