index.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <?php
  2. /**
  3. * Index
  4. *
  5. * The Front Controller for handling 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 app.webroot
  18. * @since CakePHP(tm) v 0.2.9
  19. * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
  20. */
  21. /**
  22. * Use the DS to separate the directories in other defines
  23. */
  24. if (!defined('DS')) {
  25. define('DS', DIRECTORY_SEPARATOR);
  26. }
  27. /**
  28. * These defines should only be edited if you have cake installed in
  29. * a directory layout other than the way it is distributed.
  30. * When using custom settings be sure to use the DS and do not add a trailing DS.
  31. */
  32. /**
  33. * The full path to the directory which holds "app", WITHOUT a trailing DS.
  34. *
  35. */
  36. if (!defined('ROOT')) {
  37. define('ROOT', dirname(dirname(dirname(__FILE__))));
  38. }
  39. /**
  40. * The actual directory name for the "app".
  41. *
  42. */
  43. if (!defined('APP_DIR')) {
  44. define('APP_DIR', basename(dirname(dirname(__FILE__))));
  45. }
  46. /**
  47. * The absolute path to the "cake" directory, WITHOUT a trailing DS.
  48. *
  49. * Un-comment this line to specify a fixed path to CakePHP.
  50. * This should point at the directory containing `Cake`.
  51. *
  52. * For ease of development CakePHP uses PHP's include_path. If you
  53. * cannot modify your include_path set this value.
  54. *
  55. * Leaving this constant undefined will result in it being defined in Cake/bootstrap.php
  56. */
  57. //define('CAKE_CORE_INCLUDE_PATH', __CAKE_PATH__);
  58. /**
  59. * Editing below this line should NOT be necessary.
  60. * Change at your own risk.
  61. *
  62. */
  63. if (!defined('WEBROOT_DIR')) {
  64. define('WEBROOT_DIR', basename(dirname(__FILE__)));
  65. }
  66. if (!defined('WWW_ROOT')) {
  67. define('WWW_ROOT', dirname(__FILE__) . DS);
  68. }
  69. // for built-in server
  70. if (php_sapi_name() == 'cli-server') {
  71. $_SERVER['PHP_SELF'] = '/' . basename(__FILE__);
  72. }
  73. if (!defined('CAKE_CORE_INCLUDE_PATH')) {
  74. if (function_exists('ini_set')) {
  75. ini_set('include_path', ROOT . DS . 'lib' . PATH_SEPARATOR . ini_get('include_path'));
  76. }
  77. if (!include 'Cake' . DS . 'bootstrap.php') {
  78. $failed = true;
  79. }
  80. } else {
  81. if (!include CAKE_CORE_INCLUDE_PATH . DS . 'Cake' . DS . 'bootstrap.php') {
  82. $failed = true;
  83. }
  84. }
  85. if (!empty($failed)) {
  86. trigger_error("CakePHP core could not be found. Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php. It should point to the directory containing your " . DS . "cake core directory and your " . DS . "vendors root directory.", E_USER_ERROR);
  87. }
  88. App::uses('Dispatcher', 'Routing');
  89. $Dispatcher = new Dispatcher();
  90. $Dispatcher->dispatch(
  91. new CakeRequest(),
  92. new CakeResponse()
  93. );