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