]> git.wh0rd.org - tt-rss.git/blame - sanity_check.php
drop BACKEND_RSS_TYPE from update_rss_feed, support detection of dc:subject as tags...
[tt-rss.git] / sanity_check.php
CommitLineData
1d3a17c7 1<?php
1e7f3b0c 2 define('EXPECTED_CONFIG_VERSION', 5);
adf702d6 3
66581886 4 if (!file_exists("config.php")) {
dd34f155
AD
5 print _("<b>Fatal Error</b>: You forgot to copy
6 <b>config.php-dist</b> to <b>config.php</b> and edit it.\n");
66581886
AD
7 exit;
8 }
9
9d87df8f
AD
10 require_once "config.php";
11
adf702d6 12 if (CONFIG_VERSION != EXPECTED_CONFIG_VERSION) {
dd34f155 13 print _("<b>Fatal Error</b>: Your configuration file has
adf702d6 14 wrong version. Please copy new options from <b>config.php-dist</b> and
dd34f155 15 update CONFIG_VERSION directive.\n");
adf702d6
AD
16 exit;
17 }
18
f26baf36 19 if (!defined('RSS_BACKEND_TYPE')) {
dd34f155 20 print _("<b>Fatal error</b>: RSS backend type is not defined
f26baf36 21 (config variable <b>RSS_BACKEND_TYPE</b>) - please check your
dd34f155 22 configuration file.\n");
f26baf36
AD
23 exit;
24 }
25
7c5a308d 26 if (RSS_BACKEND_TYPE == "magpie" && !file_exists("magpierss/rss_fetch.inc")) {
dd34f155 27 print _("<b>Fatal Error</b>: You forgot to place
66581886
AD
28 <a href=\"http://magpierss.sourceforge.net\">MagpieRSS</a>
29 distribution in <b>magpierss/</b>
dd34f155 30 subdirectory of TT-RSS tree.\n");
66581886
AD
31 exit;
32 }
3f286c4c 33
7c5a308d 34 if (RSS_BACKEND_TYPE == "simplepie" && !file_exists("simplepie/simplepie.inc")) {
dd34f155 35 print _("<b>Fatal Error</b>: You forgot to place
7c5a308d
AD
36 <a href=\"http://simplepie.org\">SimplePie</a>
37 distribution in <b>simplepie/</b>
dd34f155 38 subdirectory of TT-RSS tree.\n");
7c5a308d
AD
39 exit;
40 }
41
42 if (RSS_BACKEND_TYPE != "simplepie" && RSS_BACKEND_TYPE != "magpie") {
dd34f155 43 print _("<b>Fatal Error</b>: Invalid RSS_BACKEND_TYPE\n");
7c5a308d
AD
44 exit;
45 }
46
47 if (CONFIG_VERSION != EXPECTED_CONFIG_VERSION) {
dd34f155 48 return _("config: your config file version is incorrect. See config.php-dist.\n");
7c5a308d 49 }
adf702d6 50
3f286c4c 51 if (file_exists("xml-export.php") || file_exists("xml-import.php")) {
dd34f155 52 print _("<b>Fatal Error</b>: XML Import/Export tools (<b>xml-export.php</b>
3f286c4c 53 and <b>xml-import.php</b>) could be used maliciously. Please remove them
dd34f155 54 from your TT-RSS instance.\n");
3f286c4c
AD
55 exit;
56 }
51c04420
AD
57
58 if (RSS_BACKEND_TYPE != "magpie") {
dd34f155
AD
59 print _("<b>Fatal Error</b>: RSS backends other than magpie are not
60 supported now.\n");
51c04420
AD
61 exit;
62 }
07280718
AD
63
64 if (SINGLE_USER_MODE && DAEMON_UPDATE_LOGIN_LIMIT > 0) {
dd34f155
AD
65 print _("<b>Fatal Error</b>: Please set DAEMON_UPDATE_LOGIN_LIMIT
66 to 0 in single user mode.\n");
07280718
AD
67 exit;
68 }
c798704b
AD
69
70 if (USE_CURL_FOR_ICONS && ! function_exists("curl_init")) {
dd34f155
AD
71 print _("<b>Fatal Error</b>: You have enabled USE_CURL_FOR_ICONS, but your PHP
72 doesn't seem to support CURL functions.");
c798704b
AD
73 exit;
74 }
ef8be8ea
AD
75
76 if (!defined('SESSION_EXPIRE_TIME')) {
dd34f155 77 $err_msg = _("config: SESSION_EXPIRE_TIME is undefined");
ef8be8ea
AD
78 }
79
80 if (SESSION_EXPIRE_TIME < 60) {
dd34f155 81 $err_msg = _("config: SESSION_EXPIRE_TIME is too low (less than 60)");
ef8be8ea
AD
82 }
83
84 if (SESSION_EXPIRE_TIME < SESSION_COOKIE_LIFETIME_REMEMBER) {
dd34f155
AD
85 $err_msg = _("config: SESSION_EXPIRE_TIME should be greater or equal to" .
86 "SESSION_COOKIE_LIFETIME_REMEMBER");
ef8be8ea
AD
87 }
88
ec83ae9f 89/* if (defined('DISABLE_SESSIONS')) {
ef8be8ea 90 $err_msg = "config: you have enabled DISABLE_SESSIONS. Please disable this option.";
ec83ae9f 91} */
ef8be8ea
AD
92
93 if (DATABASE_BACKED_SESSIONS && SINGLE_USER_MODE) {
dd34f155 94 $err_msg = _("config: DATABASE_BACKED_SESSIONS is incompatible with SINGLE_USER_MODE");
ef8be8ea
AD
95 }
96
333f0b2a 97 if (DATABASE_BACKED_SESSIONS && DB_TYPE == "mysql") {
dd34f155 98 $err_msg = _("config: DATABASE_BACKED_SESSIONS are currently broken with MySQL");
333f0b2a
AD
99 }
100
ef8be8ea 101 if ($err_msg) {
ec83ae9f 102 print "<b>Fatal Error</b>: $err_msg\n";
ef8be8ea
AD
103 exit;
104 }
105
66581886 106?>