<?php
-namespace phancap;
/**
- * Check if everything is setup
+ * Check if everything is setup correctly
+ *
+ * PHP version 5
+ *
+ * @category Tools
+ * @package Phancap
+ * @author Christian Weiske <cweiske@cweiske.de>
+ * @copyright 2014 Christian Weiske
+ * @license http://www.gnu.org/licenses/agpl.html GNU AGPL v3
+ * @link http://cweiske.de/phancap.htm
*/
+namespace phancap;
header('HTTP/1.0 500 Internal Server Error');
if (file_exists(__DIR__ . '/../src/phancap/Autoloader.php')) {
$config = new Config();
try {
$config->load();
+ if ($config->disableSetup) {
+ header('HTTP/1.0 403 Forbidden');
+ header('Content-type: text/plain');
+ echo "Setup check is disabled.\n";
+ exit(1);
+ }
$messages[][] = array('ok', 'Base configuration is ok');
if ($config->access === true) {
$out = <<<HTM
<?xml version="1.0" encoding="utf-8"?>
-<html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>phancap setup check</title>
+ <link rel="stylesheet" href="css/bootstrap.min.css"/>
+ <link rel="stylesheet" href="css/bootstrap-theme.min.css"/>
+ <link rel="stylesheet" href="css/phancap.css"/>
+ <meta name="viewport" content="width=device-width, initial-scale=1"/>
<style type="text/css">
+ /*
li:before {
text-align: center;
display: inline-block;
font-weight: bold;
color: blue;
}
+ */
</style>
</head>
<body>
- <h1>phancap setup check</h1>
-<ul>
+ <div class="container">
+ <div class="row">
+ <div class="col-md-2"></div>
+ <div class="col-md-8">
+
+ <div class="page-header">
+ <h1>phancap setup check</h1>
+ </div>
+
+ <ul class="list-group">
HTM;
+$stateMap = array(
+ 'ok' => 'success',
+ 'info' => 'info',
+ 'err' => 'danger'
+);
foreach ($messages as $key => $messages) {
if (!is_numeric($key)) {
- $out .= '<li>' . htmlspecialchars($key)
- . '<ul>';
+ $out .= '<li class="list-group-item">' . htmlspecialchars($key)
+ . '<ul class="list-group">';
}
foreach ($messages as $data) {
list($state, $message) = $data;
- $out .= '<li class="' . $state . '">';
+ $out .= '<li class="list-group-item list-group-item-'
+ . $stateMap[$state] . '">';
$out .= htmlspecialchars($message);
$out .= '</li>' . "\n";
}
}
}
$out .= <<<HTM
- </ul>
- <p>
- <a href="./">back</a> to the index
- </p>
+ </ul>
+ <p>
+ <a href="./">back</a> to the index
+ </p>
+ </div>
+ </div>
+ </div>
</body>
</html>
HTM;