<?php
// Session
session_start();

// Relativity
if (!isset($depth)) $depth = 1;
$path_exp = explode("/", $_SERVER[PHP_SELF]);
$home_dir = "";
$path_count = count($path_exp);
for($i = 0; $i < count($path_exp) - $depth; $i++){
	$home_dir .= $path_exp[$i]."/";
}

// Constants
define('HOME_DIR', $_SERVER[DOCUMENT_ROOT].$home_dir);
define('MASTER_SMARTY_TEMPLATES', HOME_DIR."include/theme/templates/");
define('MASTER_SMARTY_COMPILE', HOME_DIR."include/theme/templates_c/");

// Paths
$include_paths = "";
$include_paths .= HOME_DIR."include/core:";
$include_paths .= HOME_DIR."include/core/lib/corestd:";
$include_paths .= HOME_DIR."include/core/lib/smarty:";
ini_set("include_path",$include_paths);

// Libs
require_once('Smarty.class.php'); // http://www.smarty.net/
//require_once('stdfuncs.inc.php'); // http://demo.corvent.ch/stdfuncs/

// Kick Smarty
$smarty = new Smarty;
$smarty->cache_dir = HOME_DIR."include/cache";
$smarty->left_delimiter = "{{";
$smarty->right_delimiter = "}}";

// What page
$page = ($_GET['page']) ? $_GET['page'] : "index";
//$data = ($_GET['data']) ? $_GET['data'] : "";
$location = ($_GET['location']) ? $_GET['location'] : "All";

// For admin
$section = ($_GET['section']) ? $_GET['section'] : "";
$data = ($_GET['data']) ? $_GET['data'] : "";

$smarty->assign('page', $page);
//$smarty->assign('data', $data);
$smarty->assign('section', $section);
$smarty->assign('data', $data);
$smarty->assign('location', $location);
?>