bootstrap.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <?php
  2. /**
  3. * Basic Cake functionality.
  4. *
  5. * Handles loading of core files needed on every request
  6. *
  7. * PHP 5
  8. *
  9. * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
  10. * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
  11. *
  12. * Licensed under The MIT License
  13. * Redistributions of files must retain the above copyright notice.
  14. *
  15. * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
  16. * @link http://cakephp.org CakePHP(tm) Project
  17. * @package Cake
  18. * @since CakePHP(tm) v 0.2.9
  19. * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
  20. */
  21. define('TIME_START', microtime(true));
  22. if (!defined('E_DEPRECATED')) {
  23. define('E_DEPRECATED', 8192);
  24. }
  25. if (!defined('E_USER_DEPRECATED')) {
  26. define('E_USER_DEPRECATED', E_USER_NOTICE);
  27. }
  28. error_reporting(E_ALL & ~E_DEPRECATED);
  29. if (!defined('CAKE_CORE_INCLUDE_PATH')) {
  30. define('CAKE_CORE_INCLUDE_PATH', dirname(dirname(__FILE__)));
  31. }
  32. if (!defined('CORE_PATH')) {
  33. define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS);
  34. }
  35. if (!defined('WEBROOT_DIR')) {
  36. define('WEBROOT_DIR', 'webroot');
  37. }
  38. /**
  39. * Path to the cake directory.
  40. */
  41. define('CAKE', CORE_PATH . 'Cake' . DS);
  42. /**
  43. * Path to the application's directory.
  44. */
  45. if (!defined('APP')) {
  46. define('APP', ROOT . DS . APP_DIR . DS);
  47. }
  48. /**
  49. * Path to the application's libs directory.
  50. */
  51. define('APPLIBS', APP . 'Lib' . DS);
  52. /**
  53. * Path to the public CSS directory.
  54. */
  55. define('CSS', WWW_ROOT . 'css' . DS);
  56. /**
  57. * Path to the public JavaScript directory.
  58. */
  59. define('JS', WWW_ROOT . 'js' . DS);
  60. /**
  61. * Path to the public images directory.
  62. */
  63. define('IMAGES', WWW_ROOT . 'img' . DS);
  64. /**
  65. * Path to the tests directory.
  66. */
  67. if (!defined('TESTS')) {
  68. define('TESTS', APP . 'Test' . DS);
  69. }
  70. /**
  71. * Path to the temporary files directory.
  72. */
  73. if (!defined('TMP')) {
  74. define('TMP', APP . 'tmp' . DS);
  75. }
  76. /**
  77. * Path to the logs directory.
  78. */
  79. define('LOGS', TMP . 'logs' . DS);
  80. /**
  81. * Path to the cache files directory. It can be shared between hosts in a multi-server setup.
  82. */
  83. define('CACHE', TMP . 'cache' . DS);
  84. /**
  85. * Path to the vendors directory.
  86. */
  87. if (!defined('VENDORS')) {
  88. define('VENDORS', ROOT . DS . 'vendors' . DS);
  89. }
  90. /**
  91. * Web path to the public images directory.
  92. */
  93. if (!defined('IMAGES_URL')) {
  94. define('IMAGES_URL', 'img/');
  95. }
  96. /**
  97. * Web path to the CSS files directory.
  98. */
  99. if (!defined('CSS_URL')) {
  100. define('CSS_URL', 'css/');
  101. }
  102. /**
  103. * Web path to the js files directory.
  104. */
  105. if (!defined('JS_URL')) {
  106. define('JS_URL', 'js/');
  107. }
  108. require CAKE . 'basics.php';
  109. require CAKE . 'Core' . DS . 'App.php';
  110. require CAKE . 'Error' . DS . 'exceptions.php';
  111. spl_autoload_register(array('App', 'load'));
  112. App::uses('ErrorHandler', 'Error');
  113. App::uses('Configure', 'Core');
  114. App::uses('CakePlugin', 'Core');
  115. App::uses('Cache', 'Cache');
  116. App::uses('Object', 'Core');
  117. App::$bootstrapping = true;
  118. Configure::bootstrap(isset($boot) ? $boot : true);
  119. /**
  120. * Full url prefix
  121. */
  122. if (!defined('FULL_BASE_URL')) {
  123. $s = null;
  124. if (env('HTTPS')) {
  125. $s = 's';
  126. }
  127. $httpHost = env('HTTP_HOST');
  128. if (isset($httpHost)) {
  129. define('FULL_BASE_URL', 'http' . $s . '://' . $httpHost);
  130. }
  131. unset($httpHost, $s);
  132. }