From 3cd888fdd3bcd9f8d8ed47acf1c3420c09f4030d Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Fri, 4 Jul 2014 07:42:52 +0200 Subject: rework setup check --- www/setup.php | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 95 insertions(+), 3 deletions(-) (limited to 'www/setup.php') diff --git a/www/setup.php b/www/setup.php index d62efe0..cd0deaa 100644 --- a/www/setup.php +++ b/www/setup.php @@ -3,6 +3,8 @@ * Check if all is setup correctly */ namespace phorkie; +header('HTTP/1.0 500 Internal Server Error'); + $reqWritePermissions = false; require_once 'www-header.php'; @@ -13,8 +15,98 @@ if (!$GLOBALS['phorkie']['cfg']['setupcheck']) { exit(1); } -SetupCheck::run(); +$messages = SetupCheck::run(); +$errors = 0; +foreach ($messages as $arMessage) { + list($type, $message) = $arMessage; + $type == 'error' && ++$errors; +} +if ($errors == 0) { + header('HTTP/1.0 200 OK'); +} +header('Content-type: text/html'); + +if ($errors == 0) { + $messages[] = array('ok', 'All fine'); +} + +$out = << + + + + phorkie setup check + + + + + + + +
+
+
+ + + +
    +HTM; +$stateMap = array( + 'ok' => 'success', + 'info' => 'info', + 'error' => 'danger' +); +foreach ($messages as $arMessage) { + list($type, $message) = $arMessage; + $out .= '
  • '; + $out .= htmlspecialchars($message); + $out .= '
  • ' . "\n"; +} +$out .= << +

    + back to the index +

    +
+
+
+ + -header('Content-type: text/plain'); -echo "All fine\n"; + + +HTM; +echo $out; ?> -- cgit v1.2.3