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