<?php
session_start();
define("VERSION", "2.2.1");
define("IN_MFA",true);
include("includes/init.php");

$layoutargs= array();
$layoutargs['host_name'] = HOST_NAME;
//login information
if($user->IsValid())
{
	if($user->user_level == 1) $user_rank = $lang['admin'];
	if($user->user_level == 0) $user_rank = $lang['normal_user'];
	$layoutargs['login_info'] = $lang['logged_in_as']." <acronym title='".$user_rank."'>".$user->user_name."</acronym>";	
}
else
	$layoutargs['login_info'] = "Nicht eingeloggt";

//the header_menu
$layoutargs['loginmenu'] = array();
if($user->IsValid())
{	
	$layoutloginmenuargs['install_info'] = (file_exists("install.php"))? "<div class='error'>".$lang['install_warning']."</div>":"";
	//the header_menu
	$layoutloginmenuargs['adminmenu'] = array();
	if($user->isAdmin())
	{
		$layoutadminmenuargs['lang_admin_panel'] = $lang['admin_panel'];
		$layoutloginmenuargs['adminmenu'][] = $layoutadminmenuargs;
	}
		
	$layoutargs['loginmenu'][] = $layoutloginmenuargs;
	include("includes/dir_list.php"); //Verzeichnisbaum

	$layoutargs['directories'] = ($user->isValid())? $template->layoutparser("directories",array(directories=>$dir_tree)):"";

	unset($dir_tree);
}
else
	$layoutargs['directories'] = "";
  
if(IsSet($show_after_header))
{
$layoutargs['main_content'] = $show_after_header;
unset($show_after_header);
}
else
$layoutargs['main_content'] = "";
 
echo $template->layoutparser("top",$layoutargs);
if(!$user->IsValid())
	echo $template->layoutparser("login",$layoutargs);
else
{
 	if(IsSet($show_explorer))
  {
 		if($show_explorer == 1)
   		include("includes/explorer.php");
 	}
 	else
 		include("includes/explorer.php");
}
$layoutargs['version_info'] = ($user->isValid())?VERSION:"";     
	
	
echo $template->layoutparser("bottom",$layoutargs);
	
if(FTP_USED == 1)
	ftp_quit($ftp_conn_id);
?>