<?php
/*******************************************************************************
 *                    _ _ _ _
 *                   / _ _  /
 *            _ _   / /__/ /_ _   ____ _ _   _ _ _    __
 *           / _ ` /   _ _// _ ` / __// _ ` / _ \\ \ / /
 *          / _ _// /\ \  / _ _/ \_ \/ _ _// / \/ \ ` /
 *          \_ , /_/  \_\ \_ ,  /__ /\_ , /_/      \_/
 *
 *******************************************************************************
 *    Application:  eReserv
 *    Version:      6
 *    Author:       David Di Certo
 *    Website:      http://www.cogites.com
 *    Email:        contact@cogites.com
 *    Copyright:    2013 - David Di Certo
 *******************************************************************************
 *    == FR ==      La revente et la redistribution de l'application sont
 *                  strictement interdites.
 *
 *                  Vous êtes tenu d'avoir pris connaissance des
 *                  Conditions Générales de Vente disponibles sur Cogites.com
 *                  (y compris pour la version Free).
 *
 *    == EN ==      Resale and redistribution of the application are
 *                  Strictly prohibited.
 *
 *                  You are required to have read the Terms and Conditions
 *                  available on Cogites.com (including the Free version).
 *
 *******************************************************************************
*/

	if ( in_array( strtolower( ini_get( 'magic_quotes_gpc' ) ), array( '1', 'on' ) ) ){
		function stripslashes_array(&$arr) {
			foreach ($arr as $k => &$v) {
				$nk = stripslashes($k);
				if ($nk != $k) {
					$arr[$nk] = &$v;
					unset($arr[$k]);
				}
				if (is_array($v)) {
					stripslashes_array($v);
				} else {
					$arr[$nk] = stripslashes($v);
				}
			}
		}
		stripslashes_array($_POST);
		stripslashes_array($_GET);
		stripslashes_array($_REQUEST);
		stripslashes_array($_COOKIE);
	}

	$userPageMaintenanceMode = false;

	ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . '../../services');
	ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . '../../services/lib');
	error_reporting(E_ALL);
	require_once('config/Logger.php');
	require_once('config/Func.php');
	include('config/Settings.php');
	require_once ('business/TenantMgr.php');



	parse_str($_SERVER['QUERY_STRING']);

	if ($_SERVER['REQUEST_URI'] !== CONTEXT_ROOT_RESS. "/front/install/"){
		if(is_dir('../install')) {
			header("Location: " . CONTEXT_ROOT_RESS . "/front/install/");
			exit();
		}
	}

	if ($_SERVER['REQUEST_URI'] !== CONTEXT_ROOT_RESS. "/front/update/"){
		if(is_dir('../update')) {
			if ((dirname($_SERVER['SCRIPT_NAME']) == CONTEXT_ROOT_RESS. "/front/user") || (dirname($_SERVER['SCRIPT_NAME']) == CONTEXT_ROOT_RESS. "/front/pesro")){	
				$userPageMaintenanceMode = true;
			}else{
				header("Location: " . CONTEXT_ROOT_RESS . "/front/update/");
				exit();
			}
		}
	}

	if (!isset($doAutentication) || $doAutentication){
		if ((!isset($session->connected) || !$session->connected == true) && ($_SERVER['REQUEST_URI'] !== CONTEXT_ROOT_RESS . "/front/install/") && ($_SERVER['REQUEST_URI'] !== CONTEXT_ROOT_RESS . "/front/update/")) {
			if ($_SERVER['PHP_SELF'] !== CONTEXT_ROOT_RESS . "/front/admin/login.php") {
				header("Location: " . CONTEXT_ROOT_RESS . "/front/admin/login.php");
				exit();
			}
		}
	}
?>

<!DOCTYPE HTML>
<html lang="en">
<head>
	<!--	******** Template Credit ********
		Charisma v1.0.0
		Copyright 2012 Muhammad Usman
		Licensed under the Apache License v2.0
		http://www.apache.org/licenses/LICENSE-2.0
		http://usman.it
		http://twitter.com/halalit_usman
	******** Template Credit ********	-->
	<meta charset="utf-8">
	<?php
		if (!isset($pageTitle))
			$pageTitle = "eReserv 6";
	?>
	<title><?php echo $pageTitle; ?></title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta name="description" content="ereserv">
	<meta name="author" content="David Di Certo">

	<meta http-equiv="cache-control" content="max-age=0">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">
	<meta http-equiv="expires" content="Tue, 01 Jan 1990 12:00:00 GMT">

	<!-- The styles -->
	<link href="<?php echo CONTEXT_ROOT_RESS;?>/styles/css/bootstrap-simplex.css" rel="stylesheet">
	<style type="text/css">
	  body {
		padding-bottom: 40px;
	  }
	  .sidebar-nav {
		padding: 9px 0;
	  }
	</style>
	<link href="<?php echo CONTEXT_ROOT_RESS;?>/styles/css/bootstrap-responsive.css" rel="stylesheet" media="screen">
<?php
	if (($_SERVER['PHP_SELF'] !== CONTEXT_ROOT_RESS . "/front/admin/login.php") && ($_SERVER['PHP_SELF'] !== CONTEXT_ROOT_RESS . "/front/install/index.php")) {
?>
	<style type="text/less">
		.year{
			margin: 0 auto;
			float: none;
		}
		.year-title{
			text-align: center;
			color: #000000;
			__background: #dedede;
		}
		.month-title{
			font-weight: bold;
		}
		.month-table{
			text-align: center;
			____background: #dedede;
			table-layout:fixed;
			width: 220px;
			margin: 0px 13px 10px 13px;
		}
		.week-day{
			font-size: 10px;
			font-weight: inherit;
		}
		.week-days{
			border-bottom: 1px #000 solid;
		}
		.month-day{
			background-color: @free;
			color: #<?php echo $config['color_cal_free_txt']; ?>;
		}
		.week-day{
			width:20px;
		}
		.weekend-day{
			background-color: @free;
			color: #<?php echo $config['color_cal_free_txt']; ?>;
		}
		.weeknum-day{
			width: 28px;
			color: #000000;
			background: #dedede;
			text-align: center;
		}
		.nomonth-day{
			background: #e9e9e9 !important;
			__color: #ED7476;
			__font-size: 8px;
			background-color: @free;
			color: #<?php echo $config['color_cal_free_txt']; ?>;
		}
		.today{
			border: 1px solid;
			font-weight: bold;
		}
		@free: #<?php echo (isset($config['color_cal_free_bgd'])) ? $config['color_cal_free_bgd'] : 0; ?>;
		@option: #<?php echo (isset($config['color_cal_option_bgd'])) ? $config['color_cal_option_bgd'] : 0; ?>;
		@booked: #<?php echo (isset($config['color_cal_booked_bgd'])) ? $config['color_cal_booked_bgd'] : 0; ?>;
		@indispo: #<?php echo (isset($config['color_season_na_bgd'])) ? $config['color_season_na_bgd'] : 0; ?>;
		@moyenne: #<?php echo (isset($config['color_season_medium_bgd'])) ? $config['color_season_medium_bgd'] : 0; ?>;
		@haute: #<?php echo (isset($config['color_season_high_bgd'])) ? $config['color_season_high_bgd'] : 0; ?>;
		@tres-haute: #<?php echo (isset($config['color_season_tophigh_bgd'])) ? $config['color_season_tophigh_bgd'] : 0; ?>;
		.calendar-gradient(@color-start, @color-end){
			background: @color-start; /* Old browsers */
			background: -moz-linear-gradient(-45deg, @color-start 50%, @color-end 50%); /* FF3.6+ */
			background: -webkit-gradient(linear, left top, right bottom, color-stop(50%,@color-start), color-stop(50%,@color-end)); /* Chrome,Safari4+ */
			background: -webkit-linear-gradient(-45deg, @color-start 50%,@color-end 50%); /* Chrome10+,Safari5.1+ */
			background: -o-linear-gradient(-45deg, @color-start 50%,@color-end 50%); /* Opera 11.10+ */
			background: -ms-linear-gradient(-45deg, @color-start 50%,@color-end 50%); /* IE10+ */
			background: linear-gradient(135deg, @color-start 50%,@color-end 50%); /* W3C */
			filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='@color-start', endColorstr='@color-end',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
		}
		.free{
			background-color: @free;
			color: #<?php echo $config['color_cal_free_txt']; ?>;
		}
		.indispo, .indispo a{
			background-color: @indispo;
			color: #<?php echo $config['color_season_na_txt']; ?>;
		}
		.indispo-option, .indispo-option a{
			.calendar-gradient(@indispo, @option);
			color: #<?php echo $config['color_season_na_txt']; ?>;
		}
		.indispo-booked, .indispo-booked a{
			.calendar-gradient(@indispo, @booked);
			color: #<?php echo $config['color_season_na_txt']; ?>;
		}
		.moyenne, .moyenne a{
			background-color: @moyenne;
			color: #<?php echo $config['color_season_medium_txt']; ?>;
		}
		.moyenne-option, .moyenne-option a{
			.calendar-gradient(@moyenne, @option);
			color: #<?php echo $config['color_cal_option_txt']; ?>;
		}
		.moyenne-booked, .moyenne-booked a{
			.calendar-gradient(@moyenne, @booked);
			color: #<?php echo $config['color_season_medium_txt']; ?>;
		}
		.haute, .haute a{
			background-color: @haute;
			color: #<?php echo $config['color_season_high_txt']; ?>;
		}
		.haute-option, .haute-option a{
			.calendar-gradient(@haute, @option);
			color: #<?php echo $config['color_cal_option_txt']; ?>;
		}
		.haute-booked, .haute-booked a{
			.calendar-gradient(@haute, @booked);
			color: #<?php echo $config['color_season_high_txt']; ?>;
		}
		.tres-haute, .tres-haute a{
			background-color: @tres-haute;
			color: #<?php echo $config['color_season_tophigh_txt']; ?>;
		}
		.tres-haute-option, .tres-haute-option a{
			.calendar-gradient(@tres-haute, @option);
			color: #<?php echo $config['color_season_tophigh_txt']; ?>;
		}
		.tres-haute-booked, .tres-haute-booked a{
			.calendar-gradient(@tres-haute, @booked);
			color: #<?php echo $config['color_season_tophigh_txt']; ?>;
		}
		.option, .option a{
			background-color: @option;
			color: #<?php echo $config['color_cal_option_txt']; ?>;
		}
		.option-indispo, .option-indispo a{
			.calendar-gradient(@option, @indispo);
			color: #<?php echo $config['color_cal_option_txt']; ?>;
		}
		.option-moyenne, .option-moyenne a{
			.calendar-gradient(@option, @moyenne);
			color: #<?php echo $config['color_cal_option_txt']; ?>;
		}
		.option-haute, .option-haute a{
			.calendar-gradient(@option, @haute);
			color: #<?php echo $config['color_cal_option_txt']; ?>;
		}
		.option-tres-haute, .option-tres-haute a{
			.calendar-gradient(@option, @tres-haute);
			color: #<?php echo $config['color_cal_option_txt']; ?>;
		}
		.option-free, .option-free a{
			.calendar-gradient(@option, @free);
			color: #<?php echo $config['color_cal_free_txt']; ?>;
		}
		.option-booked, .option-booked a{
			.calendar-gradient(@option, @booked);
			color: #<?php echo $config['color_cal_option_txt']; ?>;
		}
		.free-option, .free-option a{
			.calendar-gradient(@free, @option);
			color: #<?php echo $config['color_cal_free_txt']; ?>;
		}
		.booked, .booked a{
			background-color: @booked;
			color: #<?php echo $config['color_cal_booked_txt']; ?>;
		}
		.booked-indispo, .booked-indispo a{
			.calendar-gradient(@booked, @indispo);
			color: #<?php echo $config['color_season_na_txt']; ?>;
		}
		.booked-moyenne, .booked-moyenne a{
			.calendar-gradient(@booked, @moyenne);
			color: #<?php echo $config['color_season_medium_txt']; ?>;
		}
		.booked-haute, .booked-haute a{
			.calendar-gradient(@booked, @haute);
			color: #<?php echo $config['color_season_high_txt']; ?>;
		}
		.booked-tres-haute, .booked-tres-haute a{
			.calendar-gradient(@booked, @tres-haute);
			color: #<?php echo $config['color_season_tophigh_txt']; ?>;
		}
		.booked-free, .booked-free a{
			.calendar-gradient(@booked, @free);
			color: #<?php echo $config['color_cal_free_txt']; ?>;
		}
		.booked-option, .booked-option a{
			.calendar-gradient(@booked, @option);
			color: #<?php echo $config['color_cal_option_txt']; ?>;
		}
		.free-booked, .free-booked a{
			.calendar-gradient(@free, @booked);
			color: #<?php echo $config['color_cal_free_txt']; ?>;
		}
	</style>
<?php } ?>
	<link href="<?php echo CONTEXT_ROOT_RESS;?>/styles/css/ereserv-app.css?time=<?php echo time(); ?>" rel="stylesheet/less">
	<link href="<?php echo CONTEXT_ROOT_RESS;?>/styles/css/ereserv-app-print.css?time=<?php echo time(); ?>" rel="stylesheet/less" media="print">
	<?php if (file_exists(ROOT . "/data/css/custom.css")) { ?>
		<link href="<?php echo CONTEXT_ROOT_RESS;?>/data/css/custom.css?time=<?php echo time(); ?>" rel="stylesheet/less">
	<?php } ?>

	<link href="<?php echo CONTEXT_ROOT_RESS;?>/styles/css/jquery-ui-1.11.1.min.css" rel="stylesheet"/>

	<link href='<?php echo CONTEXT_ROOT_RESS;?>/styles/css/fullcalendar/fullcalendar.min.css' rel='stylesheet'>
	<link href='<?php echo CONTEXT_ROOT_RESS;?>/styles/css/fullcalendar/fullcalendar.print.css' rel='stylesheet' media='print'>

	<link href='<?php echo CONTEXT_ROOT_RESS;?>/styles/css/chosen.min.css' rel='stylesheet'>
	<link href='<?php echo CONTEXT_ROOT_RESS;?>/styles/css/uniform.default.css' rel='stylesheet'>
<!--	<link href='<?php echo CONTEXT_ROOT_RESS;?>/styles/css/colorbox.css' rel='stylesheet'> -->
<!--	<link href='<?php echo CONTEXT_ROOT_RESS;?>/styles/css/jquery.cleditor.css' rel='stylesheet'> -->
<!--	<link href='<?php echo CONTEXT_ROOT_RESS;?>/styles/css/jquery.noty.css' rel='stylesheet'> -->
<!-- 	<link href='<?php echo CONTEXT_ROOT_RESS;?>/styles/css/noty_theme_default.css' rel='stylesheet'> -->
<!--	<link href='<?php echo CONTEXT_ROOT_RESS;?>/styles/css/elfinder.min.css' rel='stylesheet'> -->
<!--	<link href='<?php echo CONTEXT_ROOT_RESS;?>/styles/css/elfinder.theme.css' rel='stylesheet'> -->
<!--	<link href='<?php echo CONTEXT_ROOT_RESS;?>/styles/css/jquery.iphone.toggle.css' rel='stylesheet'> -->
<!-- 	<link href='<?php echo CONTEXT_ROOT_RESS;?>/styles/css/opa-icons.css' rel='stylesheet'>	-->
<!--	<link href='<?php echo CONTEXT_ROOT_RESS;?>/styles/css/uploadify.css' rel='stylesheet'> -->
	<link href='<?php echo CONTEXT_ROOT_RESS;?>/styles/css/jquery-gantt.css' rel='stylesheet'>
	<link href='<?php echo CONTEXT_ROOT_RESS;?>/styles/css/jquery.tagsinput.css' rel='stylesheet'>

<!--		<link href='<?php echo CONTEXT_ROOT_RESS;?>/styles/css/bootstrap-formhelpers.css' rel='stylesheet'>-->
<!--		<link href='<?php echo CONTEXT_ROOT_RESS;?>/styles/css/bootstrap-formhelpers-countries.flags.css' rel='stylesheet'>-->
	
	<link href="<?php echo CONTEXT_ROOT_RESS;?>/styles/css/font-awesome.min.css" rel="stylesheet">
	<link href="<?php echo CONTEXT_ROOT_RESS;?>/styles/css/bootstrap-wizard.css" rel="stylesheet">

	<link href="<?php echo CONTEXT_ROOT_RESS;?>/styles/css/smart_wizard.css" rel="stylesheet">

	<link href="<?php echo CONTEXT_ROOT_RESS;?>/styles/css/bootstrap-editable.css" rel="stylesheet">

	<link href="<?php echo CONTEXT_ROOT_RESS;?>/styles/css/jquery.datetimepicker.css" rel="stylesheet">

	<link href="<?php echo CONTEXT_ROOT_RESS;?>/styles/css/colpick.css" rel="stylesheet">
	<link href="<?php echo CONTEXT_ROOT_RESS;?>/styles/css/colorbox.css" rel="stylesheet">

	<!-- The HTML5 shim, for IE6-8 support of HTML5 elements -->
	<!--[if lt IE 9]>
	  <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
	<![endif]-->

	<!-- The fav icon -->
	<link rel="shortcut icon" href="<?php echo CONTEXT_ROOT_RESS;?>/styles/img/favicon.ico">
</head>

<body>
	<?php if(!isset($no_visible_elements) || !$no_visible_elements)	{ ?>
	<!-- topbar starts -->
	<div class="navbar">
		<div class="navbar-inner">
			<div class="container-fluid">
				<a class="btn btn-navbar" data-toggle="collapse" data-target=".top-nav.nav-collapse,.sidebar-nav.nav-collapse">
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
				</a>
				<a class="brand menu-action" href="index.php"> <img alt="eReserv Logo" src="<?php echo CONTEXT_ROOT_RESS;?>/styles/img/logo20.png" /> <span>eReserv <?php echo VERSION_TYPE; ?></span></a>

				<div class="btn-group pull-right">
					<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
						<i class="icon-question"></i><span class="hidden-phone"> <?php echo $tr->translate("menuHelp"); ?></span>
						<span class="caret"></span>
					</a>
					<ul class="dropdown-menu">
						<li><a target="_blank" href="http://cogites.com/redirect.php?id=1000"><?php echo $tr->translate("menuOnlineHelp"); ?></a></li>
						<li><a target="_blank" href="http://cogites.com/redirect.php?id=1001"><?php echo $tr->translate("menuFAQ"); ?></a></li>
						<li><a target="_blank" href="http://cogites.com/redirect.php?id=1002"><?php echo $tr->translate("menuUpdates"); ?></a></li>
					<?php if (!file_exists(ROOT . "front/user/userform.php")) { ?>
						<li><a target="_blank" href="http://cogites.com/redirect.php?id=1003"><?php echo $tr->translate("menuUpgrade"); ?></a></li>
					<?php } ?>
					</ul>
				</div>
				<!-- user dropdown starts -->
				<div class="btn-group pull-right" >
					<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
						<i class="icon-user"></i><span class="hidden-phone"> <?php echo $session->userDisplayName; ?></span>
						<span class="caret"></span>
					</a>
					<ul class="dropdown-menu">
						<li><a class="menu-action" href="login.php?action=SIGN_OUT"><i class="icon-power-off"></i> <?php echo $tr->translate("menuLogout"); ?></a></li>
					<?php if ($config['renter_url']) { ?>
						<li><a class="" target="_blank" href="<?php echo $config['renter_url']; ?>"><i class="icon-home"></i> <?php echo $config['renter_url']; ?></a></li>
					<?php } ?>
					</ul>
				</div>
				<!-- user dropdown ends -->

				<div class="top-nav nav-collapse">
					<ul class="nav">
						<li>
							<form class="navbar-search pull-left" action="search.php" method="post">
								<input placeholder="<?php echo $tr->translate("menuSearch"); ?>" class="search-query span2" name="query" type="text">
							</form>
						</li>
					</ul>
				</div><!--/.nav-collapse -->
			</div>
		</div>
	</div>
	<!-- topbar ends -->
	<?php } ?>
	<div class="container-fluid">
		<div class="row-fluid">
		<?php if(!isset($no_visible_elements) || !$no_visible_elements) { ?>
		
			<!-- left menu starts -->
			<div class="span2 main-menu-span">
				<div class="well nav-collapse sidebar-nav">
					<ul class="nav nav-tabs nav-stacked main-menu">
						<li class="nav-header hidden-tablet"><?php echo $tr->translate("menuMainMenu"); ?></li>
						<li><a class="menu-action" href="index.php"><i class="icon-dashboard"></i><span class="hidden-tablet"> <?php echo $tr->translate("menuDashboard"); ?></span></a></li>
					</ul>
				</div><!--/.well -->
				<div class="well nav-collapse sidebar-nav">
					<ul class="nav nav-tabs nav-stacked main-menu">
						<li class="nav-header hidden-tablet"><?php echo $tr->translate("menuLists"); ?></li>
						<li><a class="menu-action" href="tenancy.php"><i class="icon-home"></i><span class="hidden-tablet"> <?php echo $tr->translate("menuTenancys"); ?></span></a></li>
						<li><a class="menu-action" href="tenant.php"><i class="icon-group"></i><span class="hidden-tablet"> <?php echo $tr->translate("menuTenants"); ?></span></a></li>
						<li><a class="menu-action" href="reservation.php"><i class="icon-calendar-empty"></i><span class="hidden-tablet"> <?php echo $tr->translate("menuReservations"); ?></span></a></li>
						<li><a class="menu-action" href="payment.php"><i class="icon-dollar"></i><span class="hidden-tablet"> <?php echo $tr->translate("menuPayments"); ?></span></a></li>
						<li><a class="menu-action" href="user.php"><i class="icon-user"></i><span class="hidden-tablet"> <?php echo $tr->translate("menuUsers"); ?></span></a></li>
					</ul>
				</div><!--/.well -->
				<div class="well nav-collapse sidebar-nav">
					<ul class="nav nav-tabs nav-stacked main-menu">
						<li class="nav-header hidden-tablet"><?php echo $tr->translate("menuCalendars"); ?></li>
						<li><a class="menu-action" href="calendar.php?show"><i class="icon-calendar"></i><span class="hidden-tablet"> <?php echo $tr->translate("menuCalendar"); ?></span></a></li>
						<li class="hidden"><a class="menu-action" href="calendar5.php"><i class="icon-calendar-empty"></i><span class="hidden-tablet"> <?php echo $tr->translate("menuCalV5"); ?></span></a></li>
						<li class="hidden"><a class="menu-action" href="calendarOmni.php"><i class="icon-calendar-empty"></i><span class="hidden-tablet"> <?php echo $tr->translate("menuCalOmni"); ?></span></a></li>
						<li class="hidden"><a class="menu-action" href="calendarYear.php"><i class="icon-calendar"></i><span class="hidden-tablet"> <?php echo $tr->translate("menuCalendarYear"); ?></span></a></li>
						<li class="hidden"><a class="menu-action" href="calendarYear2.php"><i class="icon-calendar"></i><span class="hidden-tablet"> <?php echo $tr->translate("menuCalendarYear2"); ?></span></a></li>
						<li class="hidden"><a class="menu-action" href="c.php"><i class="icon-calendar"></i><span class="hidden-tablet"> <?php echo $tr->translate("menuCalendar C"); ?></span></a></li>
						<li class="hidden"><a class="menu-action" href="calendarVert.php"><i class="icon-calendar"></i><span class="hidden-tablet"> <?php echo $tr->translate("menuCalendarVert"); ?></span></a></li>
					</ul>
				</div><!--/.well -->
				<div class="well nav-collapse sidebar-nav">
					<ul class="nav nav-tabs nav-stacked main-menu">
						<li class="nav-header hidden-tablet"><?php echo $tr->translate("menuModules"); ?></li>
						<li><a class="menu-action" href="lease.php"><i class="icon-list"></i><span class="hidden-tablet"> <?php echo $tr->translate("menuLease"); ?></span></a></li>
					</ul>
				</div><!--/.well -->
				<div class="well nav-collapse sidebar-nav">
					<ul class="nav nav-tabs nav-stacked main-menu">
						<li class="nav-header hidden-tablet"><?php echo $tr->translate("menuConfiguration"); ?></li>
						<li><a class="menu-action" href="mailing.php"><i class="icon-envelope"></i><span class="hidden-tablet"> <?php echo $tr->translate("menuMailing"); ?></span></a></li>
						<li><a class="menu-action" href="config.php"><i class="icon-wrench"></i><span class="hidden-tablet"> <?php echo $tr->translate("menuSettings"); ?></span></a></li>
						<li><a class="menu-action" href="code.php"><i class="icon-code"></i><span class="hidden-tablet"> <?php echo $tr->translate("menuCode"); ?></span></a></li>
						<!-- <li><a class="menu-action" href="license.php"><i class="icon-cogs"></i><span class="hidden-tablet"> <?php //echo $tr->translate("menuLicense"); ?></span></a></li> -->
					</ul>
				</div><!--/.well -->
			</div><!--/span-->
			<!-- left menu ends -->

<!--
			<noscript>
				<div class="alert alert-block span10">
					<h4 class="alert-heading">Warning!</h4>
					<p>You need to have <a href="http://en.wikipedia.org/wiki/JavaScript" target="_blank">JavaScript</a> enabled to use this site.</p>
				</div>
			</noscript>
-->			
			<div id="content" class="span10" style="display:none;">
			<!-- content starts -->
			<?php } ?>

			<?php
	$LANG['LICENSE_OK']				= "The License Key supplied with this file is valid. If this application was not a demonstration the end user would not see this display, your application could then run as normal.";
	$LANG['LICENSE_TMINUS']			= "The License Key supplied you are using with this application has not yet entered its valid period. The License Key is valid from <b>{[DATE_START]}</b> to <b>{[DATE_END]}</b>.";
	$LANG['LICENSE_EXPIRED']		= "The License Key supplied you are using with this application has expired and is no longer valid. The License Key was valid from <b>{[DATE_START]}</b> to <b>{[DATE_END]}</b>.";
	$LANG['LICENSE_ILLEGAL']		= "The License Key is not valid for this server. This means that you cannot make further use of this application untill you purchase a valid key. HOWEVER, if you have you have purchased a valid key and you get this message in error, please contact the applications reseller.";
	$LANG['LICENSE_ILLEGAL_LOCAL']	= "This application can not be run on the localhost. The application can only be run under a valid domain.";
	$LANG['LICENSE_INVALID']		= "The License Key is invalid. This means that your License Key file has become corrupted. Please replace the file 'license.supplied.dat' with a copy of the original license. If you do not still have a copy of the original license please contact the applications reseller.<br /><br />HOWEVER, you should note that this might be because the key was generated using mcrypt, where as your PHP install does not have access to the Mcrypt library (this is very unlikley).";
	$LANG['LICENSE_EMPTY']			= "The License Key is empty. Please make sure that the file 'license.supplied.dat' is writeable by the web server, then copy and paste the key into the box below and click submit.<br /><br /><form action='' method='POST'><textarea id='key' name='key' rows='7' cols='60'></textarea><br /><br /><input type='submit' id='submit' name='submit' value='Submit'></form>";

	switch($lic['RESULT'])
	{
		case 'OK' :
			$result 		= 'ok';
			$message 		= $LANG['LICENSE_OK'];
			break;
		case 'TMINUS' :
			$result 		= 'tminus';
			$message 		= str_replace(array('{[DATE_START]}', '{[DATE_END]}'), array($results['DATE']['HUMAN']['START'], $results['DATE']['HUMAN']['END']), $LANG['LICENSE_TMINUS']);
			break;
		case 'EXPIRED' :
			$result 		= 'expired';
			$message 		= str_replace(array('{[DATE_START]}', '{[DATE_END]}'), array($results['DATE']['HUMAN']['START'], $results['DATE']['HUMAN']['END']), $LANG['LICENSE_EXPIRED']);
			break;
		case 'ILLEGAL' :
			$result 		= 'illegal';
			$message 		= $LANG['LICENSE_ILLEGAL'];
			break;
		case 'ILLEGAL_LOCAL' :
			$result 		= 'illegal';
			$message 		= $LANG['LICENSE_ILLEGAL_LOCAL'];
			break;
		case 'INVALID' :
			$result 		= 'invalid';
			$message 		= $LANG['LICENSE_INVALID'];
			break;
		case 'EMPTY' :
			$result 		= 'empty';
			$message 		= $LANG['LICENSE_EMPTY'];
			if(defined('write_error')) $message = $LANG['WRITE_ERROR'].$message;
			break;
		default :
			break;
	}

	if ($result == 1){
		if ((isset($session->connected)) && ($session->connected == true) && ($_SERVER['PHP_SELF'] !== CONTEXT_ROOT_RESS . "/front/admin/login.php") && ($_SERVER['PHP_SELF'] !== CONTEXT_ROOT_RESS . "/front/install/index.php")) {
			echo '<div class="alert alert-block alert-error">
				<h4 class="alert-heading">' . $lic['RESULT'] . ' License. Please contact xxxxx.</h4>
				<p>'.$message.'</p>
				<p>It looks like you are using an invalid license.</p>
				<p>
				  <a class="btn btn-danger" href="license.php">Verify your license</a> <a class="btn" href="#">Or do this</a>
				</p>
				</div>';
  
		}
	}

	if(!isset($no_visible_elements) || !$no_visible_elements) {
		if ((isset($session->connected)) && ($session->connected == true) && ($_SERVER['PHP_SELF'] !== CONTEXT_ROOT_RESS . "/front/admin/login.php") && ($_SERVER['PHP_SELF'] !== CONTEXT_ROOT_RESS . "/front/install/index.php")) {
			$res = json_decode($session->upd, true);
			if (is_array($res)) {
			?>
				<div class="row-fluid">
					<div class="box span12">
						<div class="box-header well">
							<h2><i class="icon-info-sign"></i> <?php echo $res['header']; ?></h2>
							<div class="box-icon">
								<a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-down"></i></a>
							</div>
						</div>
						<div class="box-content alert-error" style="display:none;">
							<h1><?php echo $res['title']; ?></h1><hr>
								<?php echo $res['body']; ?>
									<a class="btn btn-success" target="_blank" href="<?php echo $res['url']; ?>"><i class="icon-download-alt"></i> <?php echo $res['btn']; ?></a>
								</p>
							<div class="clearfix"></div>
						</div>
					</div>
				</div>
		<?php
		} }
	} ?>
