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-2010, 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-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
  16. * @link http://cakephp.org CakePHP(tm) Project
  17. * @package cake.config
  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. /**
  26. * If the index.php file is used instead of an .htaccess file
  27. * or if the user can not set the web root to use the public
  28. * directory we will define ROOT there, otherwise we set it
  29. * here.
  30. */
  31. if (!defined('ROOT')) {
  32. define('ROOT', '../');
  33. }
  34. if (!defined('WEBROOT_DIR')) {
  35. define('WEBROOT_DIR', 'webroot');
  36. }
  37. /**
  38. * Path to the cake directory.
  39. */
  40. define('CAKE', CORE_PATH . 'Cake' . DS);
  41. /**
  42. * Path to the application's directory.
  43. */
  44. if (!defined('APP')) {
  45. define('APP', ROOT.DS.APP_DIR.DS);
  46. }
  47. /**
  48. * Path to the application's libs directory.
  49. */
  50. define('APPLIBS', APP.'Lib'.DS);
  51. /**
  52. * Path to the public CSS directory.
  53. */
  54. define('CSS', WWW_ROOT.'css'.DS);
  55. /**
  56. * Path to the public JavaScript directory.
  57. */
  58. define('JS', WWW_ROOT.'js'.DS);
  59. /**
  60. * Path to the public images directory.
  61. */
  62. define('IMAGES', WWW_ROOT.'img'.DS);
  63. /**
  64. * Path to the tests directory.
  65. */
  66. if (!defined('TESTS')) {
  67. define('TESTS', APP.'Test'.DS);
  68. }
  69. /**
  70. * Path to the temporary files directory.
  71. */
  72. if (!defined('TMP')) {
  73. define('TMP', APP.'tmp'.DS);
  74. }
  75. /**
  76. * Path to the logs directory.
  77. */
  78. define('LOGS', TMP.'logs'.DS);
  79. /**
  80. * Path to the cache files directory. It can be shared between hosts in a multi-server setup.
  81. */
  82. define('CACHE', TMP.'cache'.DS);
  83. /**
  84. * Path to the vendors directory.
  85. */
  86. if (!defined('VENDORS')) {
  87. define('VENDORS', ROOT . DS . 'vendors' . DS);
  88. }
  89. /**
  90. * Web path to the public images directory.
  91. */
  92. if (!defined('IMAGES_URL')) {
  93. define('IMAGES_URL', 'img/');
  94. }
  95. /**
  96. * Web path to the CSS files directory.
  97. */
  98. if (!defined('CSS_URL')) {
  99. define('CSS_URL', 'css/');
  100. }
  101. /**
  102. * Web path to the js files directory.
  103. */
  104. if (!defined('JS_URL')) {
  105. define('JS_URL', 'js/');
  106. }
  107. require CAKE . 'basics.php';
  108. require CAKE . 'Core' . DS .'App.php';
  109. require CAKE . 'Error' . DS . 'exceptions.php';
  110. spl_autoload_register(array('App', 'load'));
  111. App::uses('ErrorHandler', 'Error');
  112. App::uses('Configure', 'Core');
  113. App::uses('Cache', 'Cache');
  114. App::uses('Object', 'Core');
  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. }