1<?php
2/** Step 1 - requirements. Nothing here touches the database. */
3
4if (!defined('ZNOTE_INSTALL')) { http_response_code(403); die('Direct access denied.'); }
5
6$checks = install_requirements();
7
8$blocking = 0;
9foreach ($checks as $check) {
10 if (!$check[1] && $check[3]) { $blocking++; }
11}
12
13if ($_SERVER['REQUEST_METHOD'] === 'POST' && $blocking === 0) {
14 install_max_step(2);
15 header('Location: ' . install_url(2));
16 exit;
17}
18?>
19<h1>Requirements</h1>
20<p class="lead">What this server needs before ZnoteX can run.</p>
21
22<ul class="checks">
23 <?php foreach ($checks as $check):
24 list($label, $ok, $detail, $fatal) = $check;
25 $state = $ok ? 'ok' : ($fatal ? 'no' : 'opt');
26 ?>
27 <li>
28 <span class="state <?= $state ?>"><?= $ok ? '✓' : ($fatal ? '✗' : '!') ?></span>
29 <span class="what">
30 <?= ih($label) ?>
31 <?php if (!$ok && !$fatal): ?><em>(optional)</em><?php endif; ?>
32 <span class="detail"><?= ih($detail) ?></span>
33 </span>
34 </li>
35 <?php endforeach; ?>
36</ul>
37
38<?php if ($blocking > 0): ?>
39 <p class="bad">
40 <?= (int)$blocking ?> requirement<?= $blocking === 1 ? '' : 's' ?> not met. Fix
41 <?= $blocking === 1 ? 'it' : 'them' ?> and reload this page.
42 </p>
43<?php else: ?>
44 <p class="good">Everything required is in place.</p>
45<?php endif; ?>
46
47<form method="post">
48 <div class="actions">
49 <button class="btn" type="submit" <?= $blocking > 0 ? 'disabled' : '' ?>>Continue</button>
50 <a class="btn ghost" href="index.php?step=1">Re-check</a>
51 </div>
52</form>
53