index.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. # ***** BEGIN LICENSE BLOCK *****
  3. # MINZ - A free PHP framework
  4. # Copyright (C) 2011 Marien Fressinaud
  5. #
  6. # This program is free software: you can redistribute it and/or modify
  7. # it under the terms of the GNU Affero General Public License as
  8. # published by the Free Software Foundation, either version 3 of the
  9. # License, or (at your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU Affero General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU Affero General Public License
  17. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. #
  19. # ***** END LICENSE BLOCK *****
  20. if (file_exists ('install.php')) {
  21. require('install.php');
  22. } else {
  23. require('../constants.php');
  24. session_cache_limiter('');
  25. if (!file_exists(DATA_PATH . '/no-cache.txt')) {
  26. require (LIB_PATH . '/http-conditional.php');
  27. $dateLastModification = max(
  28. @filemtime(DATA_PATH . '/touch.txt') - 1,
  29. @filemtime(LOG_PATH . '/application.log') - 1,
  30. @filemtime(DATA_PATH . '/application.ini') - 1
  31. );
  32. if (httpConditional($dateLastModification, 0, 0, false, false, true)) {
  33. exit(); //No need to send anything
  34. }
  35. }
  36. set_include_path (get_include_path ()
  37. . PATH_SEPARATOR
  38. . LIB_PATH
  39. . PATH_SEPARATOR
  40. . LIB_PATH . '/minz'
  41. . PATH_SEPARATOR
  42. . APP_PATH);
  43. require (APP_PATH . '/App_FrontController.php');
  44. try {
  45. $front_controller = new App_FrontController ();
  46. $front_controller->init ();
  47. $front_controller->run ();
  48. } catch (Exception $e) {
  49. echo '### Fatal error! ###<br />', "\n";
  50. Minz_Log::record ($e->getMessage (), Minz_Log::ERROR);
  51. echo 'See logs files.';
  52. }
  53. }