bootstrap.php 3.0 KB

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