index.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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'),
  29. @filemtime(LOG_PATH . '/application.log'),
  30. @filemtime(DATA_PATH . '/config.php')
  31. );
  32. $_SERVER['QUERY_STRING'] .= '&utime=' . file_get_contents(DATA_PATH . '/touch.txt'); //For ETag
  33. if (httpConditional($dateLastModification, 0, 0, false, false, true)) {
  34. exit(); //No need to send anything
  35. }
  36. }
  37. require(LIB_PATH . '/lib_rss.php'); //Includes class autoloader
  38. try {
  39. $front_controller = new FreshRSS();
  40. $front_controller->init ();
  41. $front_controller->run ();
  42. } catch (Exception $e) {
  43. echo '### Fatal error! ###<br />', "\n";
  44. Minz_Log::record ($e->getMessage (), Minz_Log::ERROR);
  45. echo 'See logs files.';
  46. }
  47. }