]>
Commit | Line | Data |
---|---|---|
1d3a17c7 | 1 | <?php |
1025ad87 AD |
2 | require_once "functions.php"; |
3 | ||
e4f7f8df | 4 | define('EXPECTED_CONFIG_VERSION', 20); |
30b6ee8c | 5 | define('SCHEMA_VERSION', 78); |
adf702d6 | 6 | |
66581886 | 7 | if (!file_exists("config.php")) { |
b5227ac0 AD |
8 | print "<b>Fatal Error</b>: You forgot to copy |
9 | <b>config.php-dist</b> to <b>config.php</b> and edit it.\n"; | |
66581886 AD |
10 | exit; |
11 | } | |
12 | ||
9d87df8f AD |
13 | require_once "config.php"; |
14 | ||
adf702d6 | 15 | if (CONFIG_VERSION != EXPECTED_CONFIG_VERSION) { |
b5227ac0 | 16 | $err_msg = "config: your config file version is incorrect. See config.php-dist.\n"; |
7c5a308d AD |
17 | } |
18 | ||
d8735fc8 AD |
19 | $purifier_cache_dir = "lib/htmlpurifier/library/HTMLPurifier/DefinitionCache/Serializer"; |
20 | ||
21 | if (!is_writable($purifier_cache_dir)) { | |
22 | $err_msg = "config: HTMLPurifier cache directory should be writable by anyone (chmod -R 777 $purifier_cache_dir)"; | |
23 | } | |
24 | ||
49f9c923 | 25 | if (defined('RSS_BACKEND_TYPE')) { |
b5227ac0 AD |
26 | print "<b>Fatal error</b>: RSS_BACKEND_TYPE is deprecated. Please remove this |
27 | option from config.php\n"; | |
7c5a308d AD |
28 | exit; |
29 | } | |
30 | ||
3f286c4c | 31 | if (file_exists("xml-export.php") || file_exists("xml-import.php")) { |
b5227ac0 | 32 | print "<b>Fatal Error</b>: XML Import/Export tools (<b>xml-export.php</b> |
3f286c4c | 33 | and <b>xml-import.php</b>) could be used maliciously. Please remove them |
b5227ac0 | 34 | from your TT-RSS instance.\n"; |
3f286c4c AD |
35 | exit; |
36 | } | |
51c04420 | 37 | |
07280718 | 38 | if (SINGLE_USER_MODE && DAEMON_UPDATE_LOGIN_LIMIT > 0) { |
b5227ac0 AD |
39 | print "<b>Fatal Error</b>: Please set DAEMON_UPDATE_LOGIN_LIMIT |
40 | to 0 in single user mode.\n"; | |
07280718 AD |
41 | exit; |
42 | } | |
c798704b AD |
43 | |
44 | if (USE_CURL_FOR_ICONS && ! function_exists("curl_init")) { | |
b5227ac0 AD |
45 | print "<b>Fatal Error</b>: You have enabled USE_CURL_FOR_ICONS, but your PHP |
46 | doesn't seem to support CURL functions."; | |
c798704b AD |
47 | exit; |
48 | } | |
ef8be8ea AD |
49 | |
50 | if (!defined('SESSION_EXPIRE_TIME')) { | |
b5227ac0 | 51 | $err_msg = "config: SESSION_EXPIRE_TIME is undefined"; |
ef8be8ea AD |
52 | } |
53 | ||
54 | if (SESSION_EXPIRE_TIME < 60) { | |
b5227ac0 | 55 | $err_msg = "config: SESSION_EXPIRE_TIME is too low (less than 60)"; |
ef8be8ea AD |
56 | } |
57 | ||
f7c390b8 | 58 | if (SESSION_EXPIRE_TIME < SESSION_COOKIE_LIFETIME) { |
b5227ac0 AD |
59 | $err_msg = "config: SESSION_EXPIRE_TIME should be greater or equal to" . |
60 | "SESSION_COOKIE_LIFETIME"; | |
ef8be8ea AD |
61 | } |
62 | ||
ec83ae9f | 63 | /* if (defined('DISABLE_SESSIONS')) { |
ef8be8ea | 64 | $err_msg = "config: you have enabled DISABLE_SESSIONS. Please disable this option."; |
ec83ae9f | 65 | } */ |
ef8be8ea AD |
66 | |
67 | if (DATABASE_BACKED_SESSIONS && SINGLE_USER_MODE) { | |
b5227ac0 | 68 | $err_msg = "config: DATABASE_BACKED_SESSIONS is incompatible with SINGLE_USER_MODE"; |
ef8be8ea AD |
69 | } |
70 | ||
333f0b2a | 71 | if (DATABASE_BACKED_SESSIONS && DB_TYPE == "mysql") { |
b5227ac0 | 72 | $err_msg = "config: DATABASE_BACKED_SESSIONS are currently broken with MySQL"; |
333f0b2a AD |
73 | } |
74 | ||
50e7dd7d AD |
75 | if (SINGLE_USER_MODE) { |
76 | $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME); | |
77 | ||
78 | if ($link) { | |
79 | $result = db_query($link, "SELECT id FROM ttrss_users WHERE id = 1"); | |
80 | ||
81 | if (db_num_rows($result) != 1) { | |
82 | $err_msg = "config: SINGLE_USER_MODE is enabled but default admin account (UID=1) is not found."; | |
83 | } | |
84 | } | |
85 | } | |
86 | ||
a8931123 | 87 | if (defined('MAIL_FROM')) { |
b5227ac0 | 88 | $err_msg = "config: MAIL_FROM has been split into DIGEST_FROM_NAME and DIGEST_FROM_ADDRESS"; |
a8931123 AD |
89 | } |
90 | ||
b03b2631 | 91 | if (!defined('COUNTERS_MAX_AGE')) { |
b5227ac0 | 92 | $err_msg = "config: option COUNTERS_MAX_AGE expected, but not defined"; |
b03b2631 AD |
93 | } |
94 | ||
55826adc | 95 | if (defined('DAEMON_REFRESH_ONLY')) { |
1f8c187d | 96 | $err_msg = "config: option DAEMON_REFRESH_ONLY is obsolete. Please remove this option and read about other ways to update feeds on the <a href='http://tt-rss.org/wiki/UpdatingFeeds'>wiki</a>."; |
17c0eeba AD |
97 | |
98 | } | |
99 | ||
78a5c296 AD |
100 | if (defined('ENABLE_SIMPLEPIE')) { |
101 | $err_msg = "config: ENABLE_SIMPLEPIE is obsolete and replaced with DEFAULT_UPDATE_METHOD. Please adjust your config.php."; | |
102 | } | |
103 | ||
104 | if (!defined('DEFAULT_UPDATE_METHOD') || (DEFAULT_UPDATE_METHOD != 0 && | |
105 | DEFAULT_UPDATE_METHOD != 1)) { | |
106 | $err_msg = "config: DEFAULT_UPDATE_METHOD should be either 0 or 1."; | |
107 | } | |
108 | ||
f6370f36 AD |
109 | if (!is_writable(ICONS_DIR)) { |
110 | $err_msg = "config: your ICONS_DIR (" . ICONS_DIR . ") is not writable.\n"; | |
111 | } | |
112 | ||
ef8be8ea | 113 | if ($err_msg) { |
b5227ac0 | 114 | print "<b>Fatal Error</b>: $err_msg\n"; |
ef8be8ea AD |
115 | exit; |
116 | } | |
117 | ||
66581886 | 118 | ?> |