miniMVC/src/index.php

59 lines
1.5 KiB
PHP
Raw Normal View History

2012-01-13 11:58:06 -05:00
<?php
/**
* MiniMVC
*
* Convention-based micro-framework for PHP
*
* @author Timothy J. Warren
* @copyright Copyright (c) 2011 - 2012
* @link https://github.com/timw4mail/miniMVC
* @license http://philsturgeon.co.uk/code/dbad-license
*/
// --------------------------------------------------------------------------
// Set as either DEVELOPMENT or PRODUCTION
// DEVELOPMENT enables error reporting
// PRODUCTION disables error reporting
define('ENVIRONMENT', 'DEVELOPMENT');
2012-01-13 11:58:06 -05:00
if(ENVIRONMENT == 'DEVELOPMENT')
{
error_reporting(-1);
}
else if(EVIRONMENT == 'PRODUCTION')
{
error_reporting(0);
}
2012-01-13 11:58:06 -05:00
// Set the default paths
define('BASE_PATH', __DIR__);
define('SYS_PATH', __DIR__.'/sys/');
define('MOD_PATH', __DIR__.'/modules/');
define('APP_PATH', __DIR__.'/app/');
$ri = $_SERVER['REQUEST_URI'];
$ind_pos = stripos($ri, "index.php");
$default_path = ($ind_pos !== FALSE) ? substr($ri, 0, $ind_pos) : $ri;
$default_baseurl = "//" . str_replace("//", "/", $_SERVER['HTTP_HOST']. $default_path);
// Require the basic configuratio file
require(APP_PATH.'config/config.php');
// Require the most important files
require(SYS_PATH . "common.php");
//Set error handlers
// Quercus doesn't define error_get_last...
if(function_exists('error_get_last'))
{
// Catch fatal errors, don't show them
error_reporting((-1) & ~(E_ERROR | E_PARSE));
2012-01-13 11:58:06 -05:00
register_shutdown_function('shutdown');
}
set_error_handler('on_error');
set_exception_handler('on_exception');
// And away we go!
route();
// End of index.php