bootstrap.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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-2011, 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-2011, 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. error_reporting(E_ALL & ~E_DEPRECATED);
  26. if (!defined('CAKE_CORE_INCLUDE_PATH')) {
  27. define('CAKE_CORE_INCLUDE_PATH', dirname(dirname(__FILE__)));
  28. }
  29. if (!defined('CORE_PATH')) {
  30. define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS);
  31. }
  32. if (!defined('WEBROOT_DIR')) {
  33. define('WEBROOT_DIR', 'webroot');
  34. }
  35. /**
  36. * Path to the cake directory.
  37. */
  38. define('CAKE', CORE_PATH . 'Cake' . DS);
  39. /**
  40. * Path to the application's directory.
  41. */
  42. if (!defined('APP')) {
  43. define('APP', ROOT . DS . APP_DIR.DS);
  44. }
  45. /**
  46. * Path to the application's libs directory.
  47. */
  48. define('APPLIBS', APP . 'Lib' . DS);
  49. /**
  50. * Path to the public CSS directory.
  51. */
  52. define('CSS', WWW_ROOT . 'css' . DS);
  53. /**
  54. * Path to the public JavaScript directory.
  55. */
  56. define('JS', WWW_ROOT . 'js' . DS);
  57. /**
  58. * Path to the public images directory.
  59. */
  60. define('IMAGES', WWW_ROOT . 'img' . DS);
  61. /**
  62. * Path to the tests directory.
  63. */
  64. if (!defined('TESTS')) {
  65. define('TESTS', APP . 'Test' . DS);
  66. }
  67. /**
  68. * Path to the temporary files directory.
  69. */
  70. if (!defined('TMP')) {
  71. define('TMP', APP . 'tmp' . DS);
  72. }
  73. /**
  74. * Path to the logs directory.
  75. */
  76. define('LOGS', TMP . 'logs' . DS);
  77. /**
  78. * Path to the cache files directory. It can be shared between hosts in a multi-server setup.
  79. */
  80. define('CACHE', TMP . 'cache' . DS);
  81. /**
  82. * Path to the vendors directory.
  83. */
  84. if (!defined('VENDORS')) {
  85. define('VENDORS', ROOT . DS . 'vendors' . DS);
  86. }
  87. /**
  88. * Web path to the public images directory.
  89. */
  90. if (!defined('IMAGES_URL')) {
  91. define('IMAGES_URL', 'img/');
  92. }
  93. /**
  94. * Web path to the CSS files directory.
  95. */
  96. if (!defined('CSS_URL')) {
  97. define('CSS_URL', 'css/');
  98. }
  99. /**
  100. * Web path to the js files directory.
  101. */
  102. if (!defined('JS_URL')) {
  103. define('JS_URL', 'js/');
  104. }
  105. require CAKE . 'basics.php';
  106. require CAKE . 'Core' . DS .'App.php';
  107. require CAKE . 'Error' . DS . 'exceptions.php';
  108. spl_autoload_register(array('App', 'load'));
  109. App::uses('ErrorHandler', 'Error');
  110. App::uses('Configure', 'Core');
  111. App::uses('CakePlugin', 'Core');
  112. App::uses('Cache', 'Cache');
  113. App::uses('Object', 'Core');
  114. App::$bootstrapping = true;
  115. Configure::bootstrap(isset($boot) ? $boot : true);
  116. /**
  117. * Full url prefix
  118. */
  119. if (!defined('FULL_BASE_URL')) {
  120. $s = null;
  121. if (env('HTTPS')) {
  122. $s = 's';
  123. }
  124. $httpHost = env('HTTP_HOST');
  125. if (isset($httpHost)) {
  126. define('FULL_BASE_URL', 'http' . $s . '://' . $httpHost);
  127. }
  128. unset($httpHost, $s);
  129. }