7257586f8fee38fccbb53aa36ec6fe7186bae15e.svn-base 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <?php
  2. /*
  3. |--------------------------------------------------------------------------
  4. | utf-8
  5. |--------------------------------------------------------------------------
  6. */
  7. header('Content-Type: text/html; charset=utf-8');
  8. /*
  9. |--------------------------------------------------------------------------
  10. | default hostname
  11. |--------------------------------------------------------------------------
  12. */
  13. if(!isset($_SERVER['MAZEPHP_SERVER']))
  14. {
  15. $_SERVER['MAZEPHP_SERVER'] = 'localhost';
  16. }
  17. /*
  18. |--------------------------------------------------------------------------
  19. | date rpc
  20. |--------------------------------------------------------------------------
  21. */
  22. date_default_timezone_set("PRC");
  23. /*
  24. |--------------------------------------------------------------------------
  25. | start time
  26. |--------------------------------------------------------------------------
  27. */
  28. define('MAZE_START', microtime());
  29. /*
  30. |--------------------------------------------------------------------------
  31. | maze time
  32. |--------------------------------------------------------------------------
  33. */
  34. define('MAZE_TIME', $_SERVER['REQUEST_TIME']);
  35. /*
  36. |--------------------------------------------------------------------------
  37. | maze path
  38. |--------------------------------------------------------------------------
  39. */
  40. define('MAZE_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR);
  41. /*
  42. |--------------------------------------------------------------------------
  43. | maze project host
  44. |--------------------------------------------------------------------------
  45. */
  46. define('MAZE_PROJECT_HOST', 'http://' . $_SERVER['HTTP_HOST'] . ($_SERVER['SCRIPT_NAME'] ? substr($_SERVER['SCRIPT_NAME'], 0, strpos($_SERVER['SCRIPT_NAME'], 'index.php')) : DIRECTORY_SEPARATOR));
  47. /*
  48. |--------------------------------------------------------------------------
  49. | autoload
  50. |--------------------------------------------------------------------------
  51. */
  52. require __DIR__ . '/vendor/autoload.php';
  53. /*
  54. |--------------------------------------------------------------------------
  55. | load base config
  56. |--------------------------------------------------------------------------
  57. */
  58. Maze\Config\Load::get('base');
  59. /*
  60. |--------------------------------------------------------------------------
  61. | maze project name
  62. |--------------------------------------------------------------------------
  63. */
  64. if(!defined('MAZE_PROJECT_NAME'))
  65. {
  66. $temp = explode(Maze\Config\Load::$global['base']['path'], MAZE_PROJECT_PATH);
  67. define('MAZE_PROJECT_NAME', chop(str_replace(DIRECTORY_SEPARATOR, '_', end($temp)), '_'));
  68. }
  69. /*
  70. |--------------------------------------------------------------------------
  71. | maze header cache
  72. |--------------------------------------------------------------------------
  73. */
  74. if(isset(Maze\Config\Load::$global['base']['header-cache']) && Maze\Config\Load::$global['base']['header-cache'] == true)
  75. {
  76. header("Expires: -1");
  77. header("Cache-Control: no-store, private, post-check=0, pre-check=0, max-age=0", FALSE);
  78. header("Pragma: no-cache");
  79. }
  80. /*
  81. |--------------------------------------------------------------------------
  82. | load host config
  83. |--------------------------------------------------------------------------
  84. */
  85. Maze\Config\Load::get('host');
  86. /*
  87. |--------------------------------------------------------------------------
  88. | load debug config
  89. |--------------------------------------------------------------------------
  90. */
  91. Maze\Config\Load::get('debug');
  92. if(Maze\Config\Load::$global['debug']['error'])
  93. {
  94. /*
  95. |----------------------------------------------------------------------
  96. | error
  97. |----------------------------------------------------------------------
  98. */
  99. ini_set('display_errors', true);
  100. }
  101. /*
  102. |--------------------------------------------------------------------------
  103. | project register
  104. |--------------------------------------------------------------------------
  105. */
  106. Maze\Config\Project::register();
  107. /*
  108. |--------------------------------------------------------------------------
  109. | route
  110. |--------------------------------------------------------------------------
  111. */
  112. $route = new Maze\Routing\Route;
  113. /*
  114. |--------------------------------------------------------------------------
  115. | route run and out
  116. |--------------------------------------------------------------------------
  117. */
  118. if(!defined('MAZE_DAEMON'))
  119. {
  120. $route->runing()->output();
  121. }
  122. /*
  123. |--------------------------------------------------------------------------
  124. | user cron
  125. |--------------------------------------------------------------------------
  126. */
  127. if(isset(Maze\Config\Load::$global['base']['cron']) && Maze\Config\Load::$global['base']['cron'] == true && MAZE_TIME%2 == 0)
  128. {
  129. Maze::load('manage/project.cron');
  130. }