<?php if(!defined('master_script')) die(); ?>

<!DOCTYPE html>
<html>

<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8">
	<meta name="language" content="<?php echo $user_data['backend language']; ?>">
	<meta name="generator" content="http://getpagemap.com/">
	
	<title>Pagemap <?php if($user_data["site title"] != '') echo '(' . $user_data["site title"] . ')'; ?></title>
	
	<!-- BASICS -->	
	<link rel="shortcut icon" type="image/x-icon" href="<?php echo $system_data['folder']['backend']; ?>favicon.ico">

	<link rel="stylesheet" type="text/css" media="all" href="<?php echo $system_data['folder']['backend']; ?>index.css">
	<script type="text/javascript" src="<?php echo $system_data['folder']['backend']; ?>functions.js"></script>
	
	<!-- CUSTOM DATA -->
	<?php echo $system_data['backend']['header']; ?>

	<!-- TinyMCE -->
	<script type="text/javascript" src="<?php echo $system_data['folder']['plugins']; ?>tiny-mce/tiny_mce_gzip.js"></script>

	<script type="text/javascript">
		tinyMCE_GZ.init({
			plugins : "safari, advhr, advimage, advlink, autosave, contextmenu, emotions, fullscreen, insertdatetime, layer, media, nonbreaking, paste, safari, searchreplace, style, table, visualchars, xhtmlxtras",
		  	themes : "advanced",
		  	languages : "<?php echo substr($user_data["backend language"],0 , 2); ?>",
		  	disk_cache : false,
		  	debug : false
		});
	</script>

	<!-- MoreCSS -->
	<link rel="MoreCSS" href="<?php echo $system_data['folder']['backend']; ?>MoreCSS.css">
	<script type="text/javascript" src="<?php echo $system_data['folder']['plugins']; ?>morecss/MoreCSS.js"></script>
	<script type="text/javascript" src="<?php echo $system_data['folder']['plugins']; ?>morecss/MoreCSS.effects.js"></script>
	<script type="text/javascript" src="<?php echo $system_data['folder']['plugins']; ?>morecss/MoreCSS.slider.js"></script>
	<script type="text/javascript" src="<?php echo $system_data['folder']['plugins']; ?>morecss/MoreCSS.filetree.js"></script>
	<script type="text/javascript" src="<?php echo $system_data['folder']['plugins']; ?>morecss/MoreCSS.sort.js"></script>
	<script type="text/javascript" src="<?php echo $system_data['folder']['plugins']; ?>morecss/MoreCSS.modal-window.js"></script>
</head>

<body id="top" <?php if(!isset($_SESSION['user'])) { ?>class="login"<?php } ?>>

	<?php if(isset($_SESSION['user'])) { ?>
		<div id="body-shadow-top"></div>
		<div id="body-shadow-bottom"></div>
		
		<?php include($system_data['folder']['extensions'] . 'pages/index.tpl'); ?>
		<?php include($system_data['folder']['extensions'] . 'toolbar/index.tpl'); ?>

		<div id="system-tray-top">
			<a href="http://getpagemap.com/" target="_blank">Pagemap <?php echo $system_data['system']['version']; ?></a>
			<?php connector('system tray top'); ?>
		</div>
	
		<div id="mask">
			<?php
				connector('backend mask before');
				
				$extension_template_file = $system_data['folder']['extensions'] . $_GET['backend'] . '/index.tpl';
				$extension_disabled = is_file($system_data['folder']['settings'] . 'extensions/' . $_GET['backend'] . '/DISABLED') ? true : false;
				
				if(file_exists($extension_template_file) && $extension_disabled == false)
					include($extension_template_file);
				
				connector('backend mask after');
			?>
			
			<div style="clear: both"></div>
		</div>
	<?php } else { ?>
		<div id="body">
			<?php include($system_data['folder']['extensions'] . 'login/index.tpl'); ?>
		</div>
	<?php } ?>

</body>
</html>