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