]>
Commit | Line | Data |
---|---|---|
1 | <?php | |
2 | /** | |
3 | * wallabag, self hostable application allowing you to not miss any content anymore | |
4 | * | |
5 | * @category wallabag | |
6 | * @author Nicolas Lœuillet <nicolas@loeuillet.org> | |
7 | * @copyright 2013 | |
8 | * @license http://opensource.org/licenses/MIT see COPYING file | |
9 | */ | |
10 | ||
11 | $app_name = 'wallabag'; | |
12 | ||
13 | $php_ok = (function_exists('version_compare') && version_compare(phpversion(), '5.3.3', '>=')); | |
14 | $pcre_ok = extension_loaded('pcre'); | |
15 | $zlib_ok = extension_loaded('zlib'); | |
16 | $mbstring_ok = extension_loaded('mbstring'); | |
17 | $iconv_ok = extension_loaded('iconv'); | |
18 | $tidy_ok = function_exists('tidy_parse_string'); | |
19 | $curl_ok = function_exists('curl_exec'); | |
20 | $parse_ini_ok = function_exists('parse_ini_file'); | |
21 | $parallel_ok = ((extension_loaded('http') && class_exists('HttpRequestPool')) || ($curl_ok && function_exists('curl_multi_init'))); | |
22 | $allow_url_fopen_ok = (bool)ini_get('allow_url_fopen'); | |
23 | $filter_ok = extension_loaded('filter'); | |
24 | $gettext_ok = function_exists("gettext"); | |
25 | ||
26 | if (extension_loaded('xmlreader')) { | |
27 | $xml_ok = true; | |
28 | } elseif (extension_loaded('xml')) { | |
29 | $parser_check = xml_parser_create(); | |
30 | xml_parse_into_struct($parser_check, '<foo>&</foo>', $values); | |
31 | xml_parser_free($parser_check); | |
32 | $xml_ok = isset($values[0]['value']); | |
33 | } else { | |
34 | $xml_ok = false; | |
35 | } | |
36 | ||
37 | header('Content-type: text/html; charset=UTF-8'); | |
38 | ||
39 | ?><!DOCTYPE html> | |
40 | ||
41 | <html lang="en"> | |
42 | <head> | |
43 | <title><?php echo $app_name; ?>: Server Compatibility Test</title> | |
44 | ||
45 | <style type="text/css"> | |
46 | body { | |
47 | font:14px/1.4em "Lucida Grande", Verdana, Arial, Helvetica, Clean, Sans, sans-serif; | |
48 | letter-spacing:0px; | |
49 | color:#333; | |
50 | margin:0; | |
51 | padding:0; | |
52 | background:#fff; | |
53 | } | |
54 | ||
55 | div#site { | |
56 | width:550px; | |
57 | margin:20px auto 0 auto; | |
58 | } | |
59 | ||
60 | a { | |
61 | color:#000; | |
62 | text-decoration:underline; | |
63 | padding:0 1px; | |
64 | } | |
65 | ||
66 | a:hover { | |
67 | color:#fff; | |
68 | background-color:#333; | |
69 | text-decoration:none; | |
70 | padding:0 1px; | |
71 | } | |
72 | ||
73 | p { | |
74 | margin:0; | |
75 | padding:5px 0; | |
76 | } | |
77 | ||
78 | em { | |
79 | font-style:normal; | |
80 | background-color:#ffc; | |
81 | padding: 0.1em 0; | |
82 | } | |
83 | ||
84 | ul, ol { | |
85 | margin:10px 0 10px 20px; | |
86 | padding:0 0 0 15px; | |
87 | } | |
88 | ||
89 | ul li, ol li { | |
90 | margin:0 0 7px 0; | |
91 | padding:0 0 0 3px; | |
92 | } | |
93 | ||
94 | h2 { | |
95 | font-size:18px; | |
96 | padding:0; | |
97 | margin:30px 0 20px 0; | |
98 | } | |
99 | ||
100 | h3 { | |
101 | font-size:16px; | |
102 | padding:0; | |
103 | margin:20px 0 5px 0; | |
104 | } | |
105 | ||
106 | h4 { | |
107 | font-size:14px; | |
108 | padding:0; | |
109 | margin:15px 0 5px 0; | |
110 | } | |
111 | ||
112 | code { | |
113 | font-size:1.1em; | |
114 | background-color:#f3f3ff; | |
115 | color:#000; | |
116 | } | |
117 | ||
118 | em strong { | |
119 | text-transform: uppercase; | |
120 | } | |
121 | ||
122 | table#chart { | |
123 | border-collapse:collapse; | |
124 | } | |
125 | ||
126 | table#chart th { | |
127 | background-color:#eee; | |
128 | padding:2px 3px; | |
129 | border:1px solid #fff; | |
130 | } | |
131 | ||
132 | table#chart td { | |
133 | text-align:center; | |
134 | padding:2px 3px; | |
135 | border:1px solid #eee; | |
136 | } | |
137 | ||
138 | table#chart tr.enabled td { | |
139 | /* Leave this alone */ | |
140 | } | |
141 | ||
142 | table#chart tr.disabled td, | |
143 | table#chart tr.disabled td a { | |
144 | } | |
145 | ||
146 | table#chart tr.disabled td a { | |
147 | text-decoration:underline; | |
148 | } | |
149 | ||
150 | div.chunk { | |
151 | margin:20px 0 0 0; | |
152 | padding:0 0 10px 0; | |
153 | border-bottom:1px solid #ccc; | |
154 | } | |
155 | ||
156 | .footnote, | |
157 | .footnote a { | |
158 | font:10px/12px verdana, sans-serif; | |
159 | color:#aaa; | |
160 | } | |
161 | ||
162 | .footnote em { | |
163 | background-color:transparent; | |
164 | font-style:italic; | |
165 | } | |
166 | ||
167 | .good{ | |
168 | background-color:#52CC5B; | |
169 | } | |
170 | .bad{ | |
171 | background-color:#F74343; | |
172 | font-style:italic; | |
173 | font-weight: bold; | |
174 | } | |
175 | .pass{ | |
176 | background-color:#FF9500; | |
177 | } | |
178 | ||
179 | </style> | |
180 | ||
181 | </head> | |
182 | ||
183 | <body> | |
184 | <?php | |
185 | $frominstall = false; | |
186 | if (isset($_GET['from'])){ | |
187 | if ($_GET['from'] == 'install'){ | |
188 | $frominstall = true; | |
189 | }} | |
190 | ?> | |
191 | <div id="site"> | |
192 | <div id="content"> | |
193 | ||
194 | <div class="chunk"> | |
195 | <h2 style="text-align:center;"><?php echo $app_name; ?>: Compatibility Test</h2> | |
196 | <table cellpadding="0" cellspacing="0" border="0" width="100%" id="chart"> | |
197 | <thead> | |
198 | <tr> | |
199 | <th>Test</th> | |
200 | <th>Should Be</th> | |
201 | <th>What You Have</th> | |
202 | </tr> | |
203 | </thead> | |
204 | <tbody> | |
205 | <tr class="<?php echo ($php_ok) ? 'enabled' : 'disabled'; ?>"> | |
206 | <td>PHP</td> | |
207 | <td>5.3.3 or higher</td> | |
208 | <td class="<?php echo ($php_ok) ? 'good' : 'disabled'; ?>"><?php echo phpversion(); ?></td> | |
209 | </tr> | |
210 | <tr class="<?php echo ($xml_ok) ? 'enabled' : 'disabled'; ?>"> | |
211 | <td><a href="http://php.net/xml">XML</a></td> | |
212 | <td>Enabled</td> | |
213 | <?php echo ($xml_ok) ? '<td class="good">Enabled, and sane</span>' : '<td class="bad">Disabled, or broken'; ?></td> | |
214 | </tr> | |
215 | <tr class="<?php echo ($pcre_ok) ? 'enabled' : 'disabled'; ?>"> | |
216 | <td><a href="http://php.net/pcre">PCRE</a></td> | |
217 | <td>Enabled</td> | |
218 | <?php echo ($pcre_ok) ? '<td class="good">Enabled' : '<td class="bad">Disabled'; ?></td> | |
219 | </tr> | |
220 | <!-- <tr class="<?php echo ($zlib_ok) ? 'enabled' : 'disabled'; ?>"> | |
221 | <td><a href="http://php.net/zlib">Zlib</a></td> | |
222 | <td>Enabled</td> | |
223 | <?php echo ($zlib_ok) ? '<td class="good">Enabled' : '<td class="bad">Disabled'; ?></td> | |
224 | </tr> --> | |
225 | <!-- <tr class="<?php echo ($mbstring_ok) ? 'enabled' : 'disabled'; ?>"> | |
226 | <td><a href="http://php.net/mbstring">mbstring</a></td> | |
227 | <td>Enabled</td> | |
228 | <?php echo ($mbstring_ok) ? '<td class="good">Enabled' : '<td class="bad">Disabled'; ?></td> | |
229 | </tr> --> | |
230 | <!-- <tr class="<?php echo ($iconv_ok) ? 'enabled' : 'disabled'; ?>"> | |
231 | <td><a href="http://php.net/iconv">iconv</a></td> | |
232 | <td>Enabled</td> | |
233 | <?php echo ($iconv_ok) ? '<td class="good">Enabled' : '<td class="bad">Disabled'; ?></td> | |
234 | </tr> --> | |
235 | <tr class="<?php echo ($filter_ok) ? 'enabled' : 'disabled'; ?>"> | |
236 | <td><a href="http://uk.php.net/manual/en/book.filter.php">Data filtering</a></td> | |
237 | <td>Enabled</td> | |
238 | <?php echo ($filter_ok) ? '<td class="good">Enabled' : '<td class="pass">Disabled'; ?></td> | |
239 | </tr> | |
240 | <tr class="<?php echo ($tidy_ok) ? 'enabled' : 'disabled'; ?>"> | |
241 | <td><a href="http://php.net/tidy">Tidy</a></td> | |
242 | <td>Enabled</td> | |
243 | <?php echo ($tidy_ok) ? '<td class="good">Enabled' : '<td class="pass">Disabled'; ?></td> | |
244 | </tr> | |
245 | <tr class="<?php echo ($curl_ok) ? 'enabled' : 'disabled'; ?>"> | |
246 | <td><a href="http://php.net/curl">cURL</a></td> | |
247 | <td>Enabled</td> | |
248 | <?php echo (extension_loaded('curl')) ? '<td class="good">Enabled' : '<td class="pass">Disabled'; ?></td> | |
249 | </tr> | |
250 | <tr class="<?php echo ($parse_ini_ok) ? 'enabled' : 'disabled'; ?>"> | |
251 | <td><a href="http://uk.php.net/manual/en/function.parse-ini-file.php">Parse ini file</td> | |
252 | <td>Enabled</td> | |
253 | <?php echo ($parse_ini_ok) ? '<td class="good">Enabled' : '<td class="bad">Disabled'; ?></td> | |
254 | </tr> | |
255 | <tr class="<?php echo ($parallel_ok) ? 'enabled' : 'disabled'; ?>"> | |
256 | <td>Parallel URL fetching</td> | |
257 | <td>Enabled</td> | |
258 | <?php echo ($parallel_ok) ? '<td class="good">Enabled' : '<td class="pass">Disabled'; ?></td> | |
259 | </tr> | |
260 | <tr class="<?php echo ($allow_url_fopen_ok) ? 'enabled' : 'disabled'; ?>"> | |
261 | <td><a href="http://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen">allow_url_fopen</a></td> | |
262 | <td>Enabled</td> | |
263 | <?php echo ($allow_url_fopen_ok) ? '<td class="good">Enabled' : '<td class="bad">Disabled'; ?></td> | |
264 | </tr> | |
265 | <tr class="<?php echo ($gettext_ok) ? 'enabled' : 'disabled'; ?>"> | |
266 | <td><a href="http://php.net/manual/en/book.gettext.php">gettext</a></td> | |
267 | <td>Enabled</td> | |
268 | <?php echo ($gettext_ok) ? '<td class="good">Enabled' : '<td class="bad">Disabled'; ?></td> | |
269 | </tr> | |
270 | </tbody> | |
271 | </table> | |
272 | </div> | |
273 | ||
274 | <div class="chunk"> | |
275 | <h3>What does this mean?</h3> | |
276 | <ol> | |
277 | <?php //if ($php_ok && $xml_ok && $pcre_ok && $mbstring_ok && $iconv_ok && $filter_ok && $zlib_ok && $tidy_ok && $curl_ok && $parallel_ok && $allow_url_fopen_ok): ?> | |
278 | <?php if ($php_ok && $xml_ok && $pcre_ok && $filter_ok && $tidy_ok && $curl_ok && $parallel_ok && $allow_url_fopen_ok && $gettext_ok && $parse_ini_ok): ?> | |
279 | <li><em>You have everything you need to run <?php echo $app_name; ?> properly! Congratulations!</em></li> | |
280 | <?php else: ?> | |
281 | <?php if ($php_ok): ?> | |
282 | <li><strong>PHP:</strong> You are running a supported version of PHP. <em>No problems here.</em></li> | |
283 | <?php if ($xml_ok): ?> | |
284 | <li><strong>XML:</strong> You have XMLReader support or a version of XML support that isn't broken installed. <em>No problems here.</em></li> | |
285 | <?php if ($pcre_ok): ?> | |
286 | <li><strong>PCRE:</strong> You have PCRE support installed. <em>No problems here.</em></li> | |
287 | ||
288 | <?php if ($allow_url_fopen_ok): ?> | |
289 | <li><strong>allow_url_fopen:</strong> You have allow_url_fopen enabled. <em>No problems here.</em></li> | |
290 | ||
291 | <?php if ($gettext_ok): ?> | |
292 | <li><strong>Gettext:</strong> You have <code>gettext</code> enabled. <em>No problems here.</em></li> | |
293 | ||
294 | <?php if ($parse_ini_ok): ?> | |
295 | ||
296 | <?php if ($filter_ok): ?> | |
297 | <li><strong>Data filtering:</strong> You have the PHP filter extension enabled. <em>No problems here.</em></li> | |
298 | ||
299 | <?php if ($zlib_ok): ?> | |
300 | <li><strong>Zlib:</strong> You have <code>Zlib</code> enabled. This allows SimplePie to support GZIP-encoded feeds. <em>No problems here.</em></li> | |
301 | <?php else: ?> | |
302 | <li><strong>Zlib:</strong> The <code>Zlib</code> extension is not available. SimplePie will ignore any GZIP-encoding, and instead handle feeds as uncompressed text.</li> | |
303 | <?php endif; ?> | |
304 | ||
305 | <?php if ($mbstring_ok && $iconv_ok): ?> | |
306 | <li><strong>mbstring and iconv:</strong> You have both <code>mbstring</code> and <code>iconv</code> installed! This will allow <?php echo $app_name; ?> to handle the greatest number of languages. <em>No problems here.</em></li> | |
307 | <?php elseif ($mbstring_ok): ?> | |
308 | <li><strong>mbstring:</strong> <code>mbstring</code> is installed, but <code>iconv</code> is not.</li> | |
309 | <?php elseif ($iconv_ok): ?> | |
310 | <li><strong>iconv:</strong> <code>iconv</code> is installed, but <code>mbstring</code> is not.</li> | |
311 | <?php else: ?> | |
312 | <li><strong>mbstring and iconv:</strong> <em>You do not have either of the extensions installed.</em> This will significantly impair your ability to read non-English feeds, as well as even some English ones.</li> | |
313 | <?php endif; ?> | |
314 | ||
315 | <?php if ($tidy_ok): ?> | |
316 | <li><strong>Tidy:</strong> You have <code>Tidy</code> support installed. <em>No problems here.</em></li> | |
317 | <?php else: ?> | |
318 | <li><strong>Tidy:</strong> The <code>Tidy</code> extension is not available. <?php echo $app_name; ?> should still work with most feeds, but you may experience problems with some.</li> | |
319 | <?php endif; ?> | |
320 | ||
321 | <?php if ($curl_ok): ?> | |
322 | <li><strong>cURL:</strong> You have <code>cURL</code> support installed. <em>No problems here.</em></li> | |
323 | <?php else: ?> | |
324 | <li><strong>cURL:</strong> The <code>cURL</code> extension is not available. SimplePie will use <code>fsockopen()</code> instead.</li> | |
325 | <?php endif; ?> | |
326 | ||
327 | <?php if ($parallel_ok): ?> | |
328 | <li><strong>Parallel URL fetching:</strong> You have <code>HttpRequestPool</code> or <code>curl_multi</code> support installed. <em>No problems here.</em></li> | |
329 | <?php else: ?> | |
330 | <li><strong>Parallel URL fetching:</strong> <code>HttpRequestPool</code> or <code>curl_multi</code> support is not available. <?php echo $app_name; ?> will use <code>file_get_contents()</code> instead to fetch URLs sequentially rather than in parallel.</li> | |
331 | <?php endif; ?> | |
332 | ||
333 | <?php else: ?> | |
334 | <li><strong>Data filtering:</strong> Your PHP configuration has the filter extension disabled. <strong><?php echo $app_name; ?> will not work here.</strong></li> | |
335 | <?php endif; ?> | |
336 | ||
337 | <?php else : ?> | |
338 | <li><strong>Parse ini files function :</strong> Bad luck : your webhost has decided to block the use of the <em>parse_ini_file</em> function. <strong><?php echo $app_name; ?> will not work here.</strong> | |
339 | <?php endif; ?> | |
340 | ||
341 | <?php else: ?> | |
342 | <li><strong>GetText:</strong> The <code>gettext</code> extension is not available. The system we use to display wallabag in various languages is not available. <strong><?php echo $app_name; ?> will not work here.</strong></li> | |
343 | <?php endif; ?> | |
344 | ||
345 | <?php else: ?> | |
346 | <li><strong>allow_url_fopen:</strong> Your PHP configuration has allow_url_fopen disabled. <strong><?php echo $app_name; ?> will not work here.</strong></li> | |
347 | <?php endif; ?> | |
348 | ||
349 | <?php else: ?> | |
350 | <li><strong>PCRE:</strong> Your PHP installation doesn't support Perl-Compatible Regular Expressions. <strong><?php echo $app_name; ?> will not work here.</strong></li> | |
351 | <?php endif; ?> | |
352 | <?php else: ?> | |
353 | <li><strong>XML:</strong> Your PHP installation doesn't support XML parsing. <strong><?php echo $app_name; ?> will not work here.</strong></li> | |
354 | <?php endif; ?> | |
355 | <?php else: ?> | |
356 | <li><strong>PHP:</strong> You are running an unsupported version of PHP. <strong><?php echo $app_name; ?> will not work here.</strong></li> | |
357 | <?php endif; ?> | |
358 | <?php endif; ?> | |
359 | </ol> | |
360 | </div> | |
361 | ||
362 | <div class="chunk"> | |
363 | <?php //if ($php_ok && $xml_ok && $pcre_ok && $mbstring_ok && $iconv_ok && $filter_ok && $allow_url_fopen_ok) { ?> | |
364 | <?php if ($php_ok && $xml_ok && $pcre_ok && $filter_ok && $allow_url_fopen_ok && $gettext_ok && $parse_ini_ok) { ?> | |
365 | <h3>Bottom Line: Yes, you can!</h3> | |
366 | <p><em>Your webhost has its act together!</em></p> | |
367 | <?php if (!$frominstall) { ?> | |
368 | <p>You can download the latest version of <?php echo $app_name; ?> from <a href="http://wallabag.org/download">wallabag.org</a>.</p> | |
369 | <p>If you already have done that, you should access <a href="index.php">the index.php file</a> of your installation to configure and/or start using wallabag</p> | |
370 | <?php } else { ?> | |
371 | <p>You can now <a href="index.php">return to the installation section</a>.</p> | |
372 | <?php } ?> | |
373 | <p><strong>Note</strong>: Passing this test does not guarantee that <?php echo $app_name; ?> will run on your webhost — it only ensures that the basic requirements have been addressed. If you experience any problems, please let us know.</p> | |
374 | <?php //} else if ($php_ok && $xml_ok && $pcre_ok && $mbstring_ok && $allow_url_fopen_ok && $filter_ok) { ?> | |
375 | <?php } else if ($php_ok && $xml_ok && $pcre_ok && $allow_url_fopen_ok && $filter_ok && $gettext_ok && $parse_ini_ok) { ?> | |
376 | <h3>Bottom Line: Yes, you can!</h3> | |
377 | <p><em>For most feeds, it'll run with no problems.</em> There are certain languages that you might have a hard time with though.</p> | |
378 | <?php if (!$frominstall) { ?> | |
379 | <p>You can download the latest version of <?php echo $app_name; ?> from <a href="http://wallabag.org/download">wallabag.org</a>.</p> | |
380 | <p>If you already have done that, you should access <a href="index.php">the index.php file</a> of your installation to configure and/or start using wallabag</p> | |
381 | <?php } else { ?> | |
382 | <p>You can now <a href="index.php">return to the installation section</a>.</p> | |
383 | <?php } ?> | |
384 | <p><strong>Note</strong>: Passing this test does not guarantee that <?php echo $app_name; ?> will run on your webhost — it only ensures that the basic requirements have been addressed. If you experience any problems, please let us know.</p> | |
385 | <?php } else { ?> | |
386 | <h3>Bottom Line: We're sorry…</h3> | |
387 | <p><em>Your webhost does not support the minimum requirements for <?php echo $app_name; ?>.</em> It may be a good idea to contact your webhost and point them to the results of this test. They may be able to enable/install the required components.</p> | |
388 | <?php } ?> | |
389 | </div> | |
390 | ||
391 | <div class="chunk"> | |
392 | <p class="footnote">This compatibility test has been borrowed (and slightly adapted by <a href="http://fivefilters.org/content-only/">fivefilters.org</a>) from the one supplied by <a href="http://simplepie.org/">SimplePie.org</a>.</a></p> | |
393 | </div> | |
394 | ||
395 | </div> | |
396 | ||
397 | </div> | |
398 | ||
399 | </body> | |
400 | </html> |