<?php
ini_set('display_errors','1');
error_reporting (E_ALL & ~E_NOTICE);
setlocale (LC_ALL, 'de_DE');
setlocale (LC_TIME, 'de_DE');
header('Content-Type: text/html; charset=utf-8');
include('frontend.php');
include('seo.php');
if (is_file('bookings.php')) include('bookings.php');
if (is_file('forms_input.php')) include('forms_input.php');
if ($content == 'newsletter') {
	if (is_file('newsletter.php')) include('newsletter.php');
	if (isset($_GET['token'])) die();
	else $content = 'home';
	
	if (isset($content)){
		$content_data = array();
		$content_guidv4 = NULL;
		$sql_tmp = "SELECT guidv4 FROM content_levels WHERE url = :url AND c_active = '1' ORDER BY sortorder LIMIT 1";
		$result_tmp = $conn->prepare($sql_tmp);
		$result_tmp->bindValue(':url', $content, PDO::PARAM_STR);
		$result_tmp->execute();
		if ($result_tmp->rowCount()){
			$arr_tmp = $result_tmp->fetch();
			$content_guidv4 = $arr_tmp['guidv4'];
			$content_data = get_parent_levels('content_levels', $arr_tmp['guidv4']);
		}
	}
} else if (isset($_POST['subscribe'])){
	if (is_file('newsletter.php')) include('newsletter.php');
}
if (is_file('customers.php')) include('customers.php');
if (is_file('orders.php')) include('orders.php');
$assets = new Assets(debug: false);
?>
<!DOCTYPE html>
<html lang='de'>
	<head>
		<meta charset='utf-8' />
		
		<meta name='viewport' content='width=device-width, initial-scale=1' />
		<title><?=$meta_title;?></title>
		<meta name="description" content="<?=$meta_description;?>" />
		<meta name="robots" content="<?=$meta_robots;?>" />
		<?php
			if (isset($canonical_link) && $canonical_link) print "<link rel='canonical' href='".$canonical_link."'/>";
			if (isset($canonical_prev) && $canonical_prev) print "<link rel='prev' href='".$canonical_prev."'/>";
			if (isset($canonical_next) && $canonical_next) print "<link rel='next' href='".$canonical_next."'/>";
			if (isset($canonical_lang) && count($canonical_lang) > 1){
				foreach ($canonical_lang AS $key => $value){
					print "<link rel='alternate' hreflang='".$key."' href='".$value."'/>";
				}
			}
		?>
		
		<!--FAVICON-->
		<?php print $assets->favicon(); ?>
	
		<!-- App Styles -->
		<?php print $assets->css(); ?>
	</head>
	<body>
		<div class='wrapper'>
			<header class='header'>
				<?php include('box/header.php'); ?>
				<?php renderNavigation('main', 'main-navigation'); ?>
			</header><!-- /.header -->
			
			<?php renderNavigation('mobile', 'mobile-navigation'); ?>
			
			<div class='content'>
				<?php 
				include('box/teaser.php');
				include('box/ticker.php');
				include('box/breadcrumb.php');
				if (is_file('content_'.$content.'.php')) include('content_'.$content.'.php');
				else include('content_default.php');	
				?>				
			</div><!-- /.content -->
			
			<footer class='footer'>
				<?php include('box/footer.php'); ?>		
			</footer><!-- /.footer -->
		</div><!-- /.wrapper -->
		<?php include('box/note.php'); ?>
		
	
		<!-- App JS -->
		<?php print $assets->js(); ?>
	</body>
</html>