<?php
/**
* @package   sandal
* @author    arrowthemes https://arrowthemes.com
* @copyright Copyright (C) arrowthemes
* @license   http://www.gnu.org/licenses/gpl.html GNU/GPL
*/

// set the default variables
$page = 'home';
$direction = 'ltr';
$header = 'right';
$layout = 'fullwidth';

if(isset($_GET['page'])) {
  $page_prefix = basename($_GET['page']);
} else {
  $page_prefix = 'Home';
}

if(isset($_GET['direction'])) {
  $direction = basename($_GET['direction']);
} else {
  $direction = 'ltr';
}

if(isset($_GET['layout'])) {
  $layout = basename($_GET['layout']);
} else {
  $layout = 'fullwidth';
}

// set the page title
$page_title= ucfirst(str_replace("-"," ",$page_prefix)) ." - ". "Sandal";

// set the page description
$page_description = "Sandal is a Finance and consultancy business html template built on UIkit Framework";

// disallowed paths 
$no_access = array(
  'includes/body.php',
  'includes/copyright.php',
  'includes/footer.php',
  'includes/head.php',
  'includes/header-centered.php',
  'includes/header-default.php',
  'includes/header-full-right.php',
  'includes/header-right.php',
  'includes/headerbar-small.php',
  'includes/headerbar.php',
  'includes/nav-one-page.php',
  'includes/nav.php',
  'includes/offcanvas.php',
  'includes/toolbar-full.php',
  'includes/toolbar.php'
);

// check if file exists
if (!empty($_GET['page'])) { 
  $new_page = basename($_GET['page']); 
  if (!in_array($new_page, $no_access) && file_exists("{$new_page}.php")) {
      $page = $new_page;
  } else {
    $page = '404';
  }
}

// head
include("includes/head.php");

// body start
include("includes/body.php");

// header
if(isset($_GET['header'])) {
  $header_block = basename($_GET['header']);
} else {
  $header_block = 'right';
}

switch ($header_block) {
  case 'center':
      include("includes/header-centered.php");
      break;
  case 'default':
      include("includes/header-default.php");
      break;
  case 'full-right':
      include("includes/header-full-right.php");
      break;
  case 'right':
      include("includes/header-right.php");
      break;
  default:
    include("includes/header-right.php");
}

// page 
include("$page.php");

// close boxed layout
if ($layout == 'boxed') {
  echo '</div>';
}

// copyright
include("includes/copyright.php");

// mobile menu
include("includes/offcanvas.php");

// footer
include("includes/footer.php");

?>