Example #1
0
<?php

//This initializes the include path. It prevents the server from having to have the include path preconfigured making it easier to load the scripts onto any machine and have it work right away.
session_start();
$executionPath = str_replace('\\', '/', getcwd());
$path = get_include_path() . PATH_SEPARATOR . $executionPath . '/interface';
$details = new ArrayObject(scandir($executionPath . '/class'));
//Determines if any directories were found and, if so, iterates over the directories.
if ($details->count() > 0) {
    foreach ($details as $interface) {
        if ($interface !== '.' && $interface !== '..') {
            $path .= PATH_SEPARATOR . $executionPath . '/class/' . $interface;
        }
    }
}
$path .= PATH_SEPARATOR . $executionPath . '/function' . PATH_SEPARATOR . $executionPath . '/config' . PATH_SEPARATOR . $executionPath . '/template' . PATH_SEPARATOR . $executionPath . '/function';
set_include_path($path);
date_default_timezone_set('UTC');
ini_set('display_errors', 0);
ini_set('allow_url_fopen', 1);
error_reporting(E_ALL);
$details = null;
//Defines an autoload function used to catch any missing classes, interfaces or functions and load them dynamically as they're called.
require_once 'Autoload.function.php';
spl_autoload_register('Autoload');
//Calls the routing script and begins processing the route of the page.
if ($_GET['q'] != 'favicon.ico') {
    $router = new Route($_GET['q']);
    header("Access-Control-Allow-Origin: http://zeldathon.net");
    echo $router->executePath();
}