index.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <?php
  2. /**
  3. * The directory in which your application specific resources are located.
  4. * The application directory must contain the bootstrap.php file.
  5. *
  6. * @link http://kohanaframework.org/guide/about.install#application
  7. */
  8. $application = 'application';
  9. /**
  10. * The directory in which your modules are located.
  11. *
  12. * @link http://kohanaframework.org/guide/about.install#modules
  13. */
  14. $modules = 'modules';
  15. /**
  16. * The directory in which the Kohana resources are located. The system
  17. * directory must contain the classes/kohana.php file.
  18. *
  19. * @link http://kohanaframework.org/guide/about.install#system
  20. */
  21. $system = 'system';
  22. /**
  23. * The default extension of resource files. If you change this, all resources
  24. * must be renamed to use the new extension.
  25. *
  26. * @link http://kohanaframework.org/guide/about.install#ext
  27. */
  28. define('EXT', '.php');
  29. /**
  30. * Set the PHP error reporting level. If you set this in php.ini, you remove this.
  31. * @link http://www.php.net/manual/errorfunc.configuration#ini.error-reporting
  32. *
  33. * When developing your application, it is highly recommended to enable notices
  34. * and warnings. Enable them by using: E_ALL
  35. *
  36. * In a production environment, it is safe to ignore notices. Disable them by
  37. * using: E_ALL & ~E_NOTICE
  38. *
  39. * When using a legacy application, it is recommended to disable deprecated
  40. * notices. Disable with: E_ALL & ~E_DEPRECATED
  41. */
  42. error_reporting(E_ALL);
  43. /**
  44. * End of standard configuration! Changing any of the code below should only be
  45. * attempted by those with a working knowledge of Kohana internals.
  46. *
  47. * @link http://kohanaframework.org/guide/using.configuration
  48. */
  49. // Set the full path to the docroot
  50. define('DOCROOT', realpath(__DIR__.'/../').DIRECTORY_SEPARATOR);
  51. // Make the application relative to the docroot, for symlink'd index.php
  52. if ( ! is_dir($application) AND is_dir(DOCROOT.$application))
  53. $application = DOCROOT.$application;
  54. // Make the modules relative to the docroot, for symlink'd index.php
  55. if ( ! is_dir($modules) AND is_dir(DOCROOT.$modules))
  56. $modules = DOCROOT.$modules;
  57. // Make the system relative to the docroot, for symlink'd index.php
  58. if ( ! is_dir($system) AND is_dir(DOCROOT.$system))
  59. $system = DOCROOT.$system;
  60. // Define the absolute paths for configured directories
  61. define('APPPATH', realpath($application).DIRECTORY_SEPARATOR);
  62. define('MODPATH', realpath($modules).DIRECTORY_SEPARATOR);
  63. define('SYSPATH', realpath($system).DIRECTORY_SEPARATOR);
  64. // Clean up the configuration vars
  65. unset($application, $modules, $system);
  66. if (file_exists('install'.EXT))
  67. {
  68. // Load the installation check
  69. return include 'install'.EXT;
  70. }
  71. /**
  72. * Define the start time of the application, used for profiling.
  73. */
  74. if ( ! defined('KOHANA_START_TIME'))
  75. {
  76. define('KOHANA_START_TIME', microtime(TRUE));
  77. }
  78. /**
  79. * Define the memory usage at the start of the application, used for profiling.
  80. */
  81. if ( ! defined('KOHANA_START_MEMORY'))
  82. {
  83. define('KOHANA_START_MEMORY', memory_get_usage());
  84. }
  85. // Bootstrap the application
  86. require APPPATH.'bootstrap'.EXT;
  87. if (PHP_SAPI == 'cli') // Try and load minion
  88. {
  89. class_exists('Minion_Task') OR die('Please enable the Minion module for CLI support.');
  90. set_exception_handler(['Minion_Exception', 'handler']);
  91. Minion_Task::factory(Minion_CLI::options())->execute();
  92. }
  93. else
  94. {
  95. /**
  96. * Execute the main request. A source of the URI can be passed, eg: $_SERVER['PATH_INFO'].
  97. * If no source is specified, the URI will be automatically detected.
  98. */
  99. echo Request::factory(TRUE, [], FALSE)
  100. ->execute()
  101. ->send_headers(TRUE)
  102. ->body();
  103. }