miniMVC/index.php

68 lines
1.6 KiB
PHP
Raw Normal View History

2012-01-13 11:58:06 -05:00
<?php
/**
* MiniMVC
*
* Convention-based micro-framework for PHP
*
* @package miniMVC
2012-01-13 11:58:06 -05:00
* @author Timothy J. Warren
* @copyright Copyright (c) 2011 - 2012
* @link https://github.com/timw4mail/miniMVC
* @license http://philsturgeon.co.uk/code/dbad-license
*/
// --------------------------------------------------------------------------
/**
* miniMVC bootstrap file
*
* @package miniMVC
* @subpackage App
*/
// --------------------------------------------------------------------------
// 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
2012-05-03 16:07:40 -04:00
if(ENVIRONMENT == 'DEVELOPMENT')
{
error_reporting(-1);
}
2012-05-03 16:07:40 -04:00
else if(EVIRONMENT == 'PRODUCTION')
{
error_reporting(0);
}
2012-01-13 11:58:06 -05:00
// Set the default paths
define('MM_BASE_PATH', __DIR__);
define('MM_SYS_PATH', __DIR__.'/sys/');
define('MM_APP_PATH', __DIR__.'/app/');
2012-05-03 16:07:40 -04:00
define('MM_MOD_PATH', MM_APP_PATH.'modules/');
2012-01-13 11:58:06 -05:00
$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(MM_APP_PATH.'config/config.php');
2012-01-13 11:58:06 -05:00
// Require the most important files
require(MM_SYS_PATH . "common.php");
2012-01-13 11:58:06 -05:00
2012-04-26 16:50:41 -04:00
// Catch fatal errors, don't show them
error_reporting((-1) & ~(E_ERROR | E_PARSE));
register_shutdown_function('shutdown');
2012-01-13 11:58:06 -05:00
//Set error handlers
set_error_handler('on_error');
set_exception_handler('on_exception');
// And away we go!
route();
// End of index.php