index.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. // Constantes de chemins
  21. define ('PUBLIC_PATH', realpath (dirname (__FILE__)));
  22. define ('LIB_PATH', realpath (PUBLIC_PATH . '/../lib'));
  23. define ('APP_PATH', realpath (PUBLIC_PATH . '/../app'));
  24. define ('LOG_PATH', realpath (PUBLIC_PATH . '/../log'));
  25. define ('CACHE_PATH', realpath (PUBLIC_PATH . '/../cache'));
  26. if (file_exists (PUBLIC_PATH . '/install.php')) {
  27. include ('install.php');
  28. } else {
  29. session_cache_limiter('');
  30. require (LIB_PATH . '/http-conditional.php');
  31. $dateLastModification = max(
  32. @filemtime(PUBLIC_PATH . '/data/touch.txt'),
  33. @filemtime(LOG_PATH . '/application.log'),
  34. @filemtime(PUBLIC_PATH . '/data/Configuration.array.php'),
  35. @filemtime(APP_PATH . '/configuration/application.ini')
  36. );
  37. if (httpConditional($dateLastModification, 0, 0, false, false, true)) {
  38. exit(); //No need to send anything
  39. }
  40. set_include_path (get_include_path ()
  41. . PATH_SEPARATOR
  42. . LIB_PATH
  43. . PATH_SEPARATOR
  44. . LIB_PATH . '/minz'
  45. . PATH_SEPARATOR
  46. . APP_PATH);
  47. require (APP_PATH . '/App_FrontController.php');
  48. try {
  49. $front_controller = new App_FrontController ();
  50. $front_controller->init ();
  51. $front_controller->run ();
  52. } catch (PDOConnectionException $e) {
  53. Minz_Log::record ($e->getMessage (), Minz_Log::ERROR);
  54. print '### Application problem ###<br />'."\n".'See logs files';
  55. }
  56. }