index.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. require(LIB_PATH . '/lib_rss.php'); //Includes class autoloader
  22. if (file_exists(DATA_PATH . '/do-install.txt')) {
  23. require(APP_PATH . '/install.php');
  24. } else {
  25. session_cache_limiter('');
  26. Minz_Session::init('FreshRSS');
  27. Minz_Session::_param('keepAlive', 1); //For Persona
  28. if (!file_exists(DATA_PATH . '/no-cache.txt')) {
  29. require(LIB_PATH . '/http-conditional.php');
  30. $currentUser = Minz_Session::param('currentUser', '');
  31. $dateLastModification = $currentUser === '' ? time() : max(
  32. @filemtime(join_path(USERS_PATH, $currentUser, 'log.txt')),
  33. @filemtime(join_path(DATA_PATH, 'config.php'))
  34. );
  35. if (httpConditional($dateLastModification, 0, 0, false, PHP_COMPRESSION, true)) {
  36. exit(); //No need to send anything
  37. }
  38. }
  39. try {
  40. $front_controller = new FreshRSS();
  41. $front_controller->init();
  42. $front_controller->run();
  43. } catch (Exception $e) {
  44. echo '### Fatal error! ###<br />', "\n";
  45. Minz_Log::error($e->getMessage());
  46. echo 'See logs files.';
  47. }
  48. }