index.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. // > Error: FreshRSS requires PHP, which does not seem to be installed or configured correctly! <!--
  3. # ***** BEGIN LICENSE BLOCK *****
  4. # MINZ - A free PHP framework
  5. # Copyright (C) 2011 Marien Fressinaud
  6. #
  7. # This program is free software: you can redistribute it and/or modify
  8. # it under the terms of the GNU Affero General Public License as
  9. # published by the Free Software Foundation, either version 3 of the
  10. # License, or (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU Affero General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU Affero General Public License
  18. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. #
  20. # ***** END LICENSE BLOCK *****
  21. require(__DIR__ . '/../../constants.php');
  22. require(LIB_PATH . '/lib_rss.php'); //Includes class autoloader
  23. if (file_exists(DATA_PATH . '/do-install.txt')) {
  24. require(APP_PATH . '/install.php');
  25. } else {
  26. session_cache_limiter('');
  27. Minz_Session::init('FreshRSS');
  28. Minz_Session::_param('keepAlive', 1); //To prevent the PHP session from expiring
  29. if (!file_exists(DATA_PATH . '/no-cache.txt')) {
  30. require(LIB_PATH . '/http-conditional.php');
  31. $currentUser = Minz_Session::param('currentUser', '');
  32. $dateLastModification = $currentUser === '' ? time() : max(
  33. @filemtime(join_path(USERS_PATH, $currentUser, 'log.txt')),
  34. @filemtime(join_path(DATA_PATH, 'config.php'))
  35. );
  36. if (httpConditional($dateLastModification, 0, 0, false, PHP_COMPRESSION, true)) {
  37. exit(); //No need to send anything
  38. }
  39. }
  40. try {
  41. $front_controller = new FreshRSS();
  42. $front_controller->init();
  43. $front_controller->run();
  44. } catch (Exception $e) {
  45. echo '### Fatal error! ###<br />', "\n";
  46. Minz_Log::error($e->getMessage());
  47. echo 'See logs files.';
  48. prepareSyslog();
  49. syslog(LOG_INFO, 'FreshRSS Fatal error! ' . $e->getMessage());
  50. }
  51. }