123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- <?php
- /*
- |--------------------------------------------------------------------------
- | utf-8
- |--------------------------------------------------------------------------
- */
- header('Content-Type: text/html; charset=utf-8');
- /*
- |--------------------------------------------------------------------------
- | default hostname
- |--------------------------------------------------------------------------
- */
- if(!isset($_SERVER['MAZEPHP_SERVER']))
- {
- $_SERVER['MAZEPHP_SERVER'] = 'localhost';
- }
- /*
- |--------------------------------------------------------------------------
- | date rpc
- |--------------------------------------------------------------------------
- */
- date_default_timezone_set("PRC");
- /*
- |--------------------------------------------------------------------------
- | start time
- |--------------------------------------------------------------------------
- */
- define('MAZE_START', microtime());
- /*
- |--------------------------------------------------------------------------
- | maze time
- |--------------------------------------------------------------------------
- */
- define('MAZE_TIME', $_SERVER['REQUEST_TIME']);
- /*
- |--------------------------------------------------------------------------
- | maze path
- |--------------------------------------------------------------------------
- */
- define('MAZE_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR);
- /*
- |--------------------------------------------------------------------------
- | maze project host
- |--------------------------------------------------------------------------
- */
- define('MAZE_PROJECT_HOST', 'http://' . $_SERVER['HTTP_HOST'] . ($_SERVER['SCRIPT_NAME'] ? substr($_SERVER['SCRIPT_NAME'], 0, strpos($_SERVER['SCRIPT_NAME'], 'index.php')) : DIRECTORY_SEPARATOR));
- /*
- |--------------------------------------------------------------------------
- | autoload
- |--------------------------------------------------------------------------
- */
- require __DIR__ . '/vendor/autoload.php';
- /*
- |--------------------------------------------------------------------------
- | load base config
- |--------------------------------------------------------------------------
- */
- Maze\Config\Load::get('base');
- /*
- |--------------------------------------------------------------------------
- | maze project name
- |--------------------------------------------------------------------------
- */
- if(!defined('MAZE_PROJECT_NAME'))
- {
- $temp = explode(Maze\Config\Load::$global['base']['path'], MAZE_PROJECT_PATH);
- define('MAZE_PROJECT_NAME', chop(str_replace(DIRECTORY_SEPARATOR, '_', end($temp)), '_'));
- }
- /*
- |--------------------------------------------------------------------------
- | maze header cache
- |--------------------------------------------------------------------------
- */
- if(isset(Maze\Config\Load::$global['base']['header-cache']) && Maze\Config\Load::$global['base']['header-cache'] == true)
- {
- header("Expires: -1");
- header("Cache-Control: no-store, private, post-check=0, pre-check=0, max-age=0", FALSE);
- header("Pragma: no-cache");
- }
- /*
- |--------------------------------------------------------------------------
- | load host config
- |--------------------------------------------------------------------------
- */
- Maze\Config\Load::get('host');
- /*
- |--------------------------------------------------------------------------
- | load debug config
- |--------------------------------------------------------------------------
- */
- Maze\Config\Load::get('debug');
- if(Maze\Config\Load::$global['debug']['error'])
- {
- /*
- |----------------------------------------------------------------------
- | error
- |----------------------------------------------------------------------
- */
- ini_set('display_errors', true);
- }
- /*
- |--------------------------------------------------------------------------
- | project register
- |--------------------------------------------------------------------------
- */
- Maze\Config\Project::register();
- /*
- |--------------------------------------------------------------------------
- | route
- |--------------------------------------------------------------------------
- */
- $route = new Maze\Routing\Route;
- /*
- |--------------------------------------------------------------------------
- | route run and out
- |--------------------------------------------------------------------------
- */
- if(!defined('MAZE_DAEMON'))
- {
- $route->runing()->output();
- }
- /*
- |--------------------------------------------------------------------------
- | user cron
- |--------------------------------------------------------------------------
- */
- if(isset(Maze\Config\Load::$global['base']['cron']) && Maze\Config\Load::$global['base']['cron'] == true && MAZE_TIME%2 == 0)
- {
- Maze::load('manage/project.cron');
- }
|