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. require(LIB_PATH . '/lib_rss.php'); //Includes class autoloader
  25. session_cache_limiter('');
  26. Minz_Session::init('FreshRSS');
  27. if (!file_exists(DATA_PATH . '/no-cache.txt')) {
  28. require(LIB_PATH . '/http-conditional.php');
  29. $currentUser = Minz_Session::param('currentUser', '');
  30. $dateLastModification = $currentUser === '' ? time() : max(
  31. @filemtime(LOG_PATH . '/' . $currentUser . '.log'),
  32. @filemtime(DATA_PATH . '/config.php')
  33. );
  34. if (httpConditional($dateLastModification, 0, 0, false, false, true)) {
  35. exit(); //No need to send anything
  36. }
  37. }
  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. }