index.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. require('../constants.php');
  21. if (file_exists ('install.php')) {
  22. include ('install.php');
  23. } else {
  24. session_cache_limiter('');
  25. require (LIB_PATH . '/http-conditional.php');
  26. $dateLastModification = max(
  27. @filemtime(DATA_PATH . '/touch.txt'),
  28. @filemtime(LOG_PATH . '/application.log'),
  29. @filemtime(DATA_PATH . '/Configuration.array.php'),
  30. @filemtime(DATA_PATH . '/application.ini')
  31. );
  32. if (httpConditional($dateLastModification, 0, 0, false, false, true)) {
  33. exit(); //No need to send anything
  34. }
  35. set_include_path (get_include_path ()
  36. . PATH_SEPARATOR
  37. . LIB_PATH
  38. . PATH_SEPARATOR
  39. . LIB_PATH . '/minz'
  40. . PATH_SEPARATOR
  41. . APP_PATH);
  42. require (APP_PATH . '/App_FrontController.php');
  43. try {
  44. $front_controller = new App_FrontController ();
  45. $front_controller->init ();
  46. $front_controller->run ();
  47. } catch (Exception $e) {
  48. echo '### Fatal error! ###<br />', "\n";
  49. Minz_Log::record ($e->getMessage (), Minz_Log::ERROR);
  50. echo 'See logs files.';
  51. }
  52. }