2012-01-13 11:58:06 -05:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* MiniMVC
|
|
|
|
*
|
|
|
|
* Convention-based micro-framework for PHP
|
|
|
|
*
|
2012-04-26 16:26:50 -04:00
|
|
|
* @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
|
|
|
|
*/
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------
|
2012-04-26 16:26:50 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* miniMVC bootstrap file
|
|
|
|
*
|
|
|
|
* @package miniMVC
|
|
|
|
* @subpackage App
|
|
|
|
*/
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
2012-01-17 11:55:42 -05:00
|
|
|
// 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 13:26:09 -04:00
|
|
|
if (ENVIRONMENT == 'DEVELOPMENT')
|
2012-01-17 11:55:42 -05:00
|
|
|
{
|
|
|
|
error_reporting(-1);
|
|
|
|
}
|
2012-05-03 13:26:09 -04:00
|
|
|
else if (EVIRONMENT == 'PRODUCTION')
|
2012-01-17 11:55:42 -05:00
|
|
|
{
|
|
|
|
error_reporting(0);
|
|
|
|
}
|
2012-01-13 11:58:06 -05:00
|
|
|
|
|
|
|
// Set the default paths
|
2012-04-26 16:26:50 -04:00
|
|
|
define('MM_BASE_PATH', __DIR__);
|
|
|
|
define('MM_SYS_PATH', __DIR__.'/sys/');
|
|
|
|
define('MM_MOD_PATH', __DIR__.'/modules/');
|
|
|
|
define('MM_APP_PATH', __DIR__.'/app/');
|
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
|
2012-04-26 16:26:50 -04:00
|
|
|
require(MM_APP_PATH.'config/config.php');
|
2012-01-13 11:58:06 -05:00
|
|
|
|
|
|
|
// Require the most important files
|
2012-04-26 16:26:50 -04:00
|
|
|
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
|