index.php 1.7 KB

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