sanity_check.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. define('EXPECTED_CONFIG_VERSION', 5);
  3. if (!file_exists("config.php")) {
  4. print __("<b>Fatal Error</b>: You forgot to copy
  5. <b>config.php-dist</b> to <b>config.php</b> and edit it.\n");
  6. exit;
  7. }
  8. require_once "config.php";
  9. if (CONFIG_VERSION != EXPECTED_CONFIG_VERSION) {
  10. return __("config: your config file version is incorrect. See config.php-dist.\n");
  11. }
  12. if (defined('RSS_BACKEND_TYPE')) {
  13. print __("<b>Fatal error</b>: RSS_BACKEND_TYPE is deprecated. Please remove this
  14. option from config.php\n");
  15. exit;
  16. }
  17. if (file_exists("xml-export.php") || file_exists("xml-import.php")) {
  18. print __("<b>Fatal Error</b>: XML Import/Export tools (<b>xml-export.php</b>
  19. and <b>xml-import.php</b>) could be used maliciously. Please remove them
  20. from your TT-RSS instance.\n");
  21. exit;
  22. }
  23. if (SINGLE_USER_MODE && DAEMON_UPDATE_LOGIN_LIMIT > 0) {
  24. print __("<b>Fatal Error</b>: Please set DAEMON_UPDATE_LOGIN_LIMIT
  25. to 0 in single user mode.\n");
  26. exit;
  27. }
  28. if (USE_CURL_FOR_ICONS && ! function_exists("curl_init")) {
  29. print __("<b>Fatal Error</b>: You have enabled USE_CURL_FOR_ICONS, but your PHP
  30. doesn't seem to support CURL functions.");
  31. exit;
  32. }
  33. if (!defined('SESSION_EXPIRE_TIME')) {
  34. $err_msg = __("config: SESSION_EXPIRE_TIME is undefined");
  35. }
  36. if (SESSION_EXPIRE_TIME < 60) {
  37. $err_msg = __("config: SESSION_EXPIRE_TIME is too low (less than 60)");
  38. }
  39. if (SESSION_EXPIRE_TIME < SESSION_COOKIE_LIFETIME) {
  40. $err_msg = __("config: SESSION_EXPIRE_TIME should be greater or equal to" .
  41. "SESSION_COOKIE_LIFETIME");
  42. }
  43. /* if (defined('DISABLE_SESSIONS')) {
  44. $err_msg = "config: you have enabled DISABLE_SESSIONS. Please disable this option.";
  45. } */
  46. if (DATABASE_BACKED_SESSIONS && SINGLE_USER_MODE) {
  47. $err_msg = __("config: DATABASE_BACKED_SESSIONS is incompatible with SINGLE_USER_MODE");
  48. }
  49. if (DATABASE_BACKED_SESSIONS && DB_TYPE == "mysql") {
  50. $err_msg = __("config: DATABASE_BACKED_SESSIONS are currently broken with MySQL");
  51. }
  52. if ($err_msg) {
  53. print "<b>".__("Fatal Error")."</b>: $err_msg\n";
  54. exit;
  55. }
  56. ?>