File: D:/HostingSpaces/SBogers10/lab.komma-mediadesign.nl/wwwroot/sherakhan/app/bootstrap.php
<?php
/**
* bootstrap.php
* Created by Komma Mediadesign.
* Author: mike
* Date: 9/23/13
*/
class Bootstrap
{
public function __construct()
{
session_start();
$title = 'Sherakhan';
// Define allowed pages ?
$pages = array('meet-sherakhan','404');
$phases = array();
for($i=1;$i<=5;$i++)
{
$phases[] = 'phase-' . $i;
}
$phases[] = 'charter-options';
// Handle 404
if( defined('URL_PAGE') && ! in_array(URL_PAGE,$pages) && ! in_array(URL_PAGE,$phases) )
{
header("HTTP/1.0 404 Not Found");
header('location: ' . SITE_ROOT . '404');
exit();
}
else if( defined('URL_PAGE') && in_array(URL_PAGE,$phases) )
{
if( ! defined('URL_SUB'))
{
header("HTTP/1.0 404 Not Found");
header('location: ' . SITE_ROOT . '404');
exit();
}
else
{
$dir = $pdf = str_replace('-','_',URL_SUB);
if( ! is_dir(DOCUMENT_ROOT . 'public/routes/' . $dir))
{
header("HTTP/1.0 404 Not Found");
header('location: ' . SITE_ROOT . '404');
exit();
}
}
}
// Header
require_once DOCUMENT_ROOT . 'app/includes/header.php';
// Aside Menu Left
require_once DOCUMENT_ROOT . 'app/includes/aside_menu.php';
// Check what page to load
if( ! defined('URL_PAGE'))
{
require_once DOCUMENT_ROOT . 'app/home.php';
}
else
{
switch(URL_PAGE)
{
case 'meet-sherakhan':
// About view
require_once DOCUMENT_ROOT . 'app/about.php';
break;
case '404':
// Display a 404
require_once DOCUMENT_ROOT . 'app/404.php';
break;
default:
// Routes
require_once DOCUMENT_ROOT . 'app/route.php';
}
}
// Footer
require_once DOCUMENT_ROOT . 'app/includes/footer.php';
}
}