X-Git-Url: https://git.cweiske.de/phancap.git/blobdiff_plain/9379b9f65e1231053a41271ba20c8b161726cc70..09ad15fd2ed08bbfb4ed4d70ff21f774387aa204:/www/setup.php diff --git a/www/setup.php b/www/setup.php index 747699a..a49a7ae 100644 --- a/www/setup.php +++ b/www/setup.php @@ -1,8 +1,17 @@ + * @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')) { @@ -17,7 +26,39 @@ $messages = array(); $config = new Config(); try { $config->load(); - $messages[][] = array('ok', 'Configuration check ok'); + 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) { + $messages[][] = array('ok', 'Everyone may access the API'); + } else if ($config->access === false) { + $messages[][] = array('err', 'API access is disabled'); + } else { + $messages[][] = array( + 'ok', + count($config->access) . ' users may access the API' + ); + } + + foreach ($config->cfgFiles as $cfgFile) { + $messages[][] = array( + 'info', 'Possible config file: ' . $cfgFile + ); + } + if ($config->cfgFileExists) { + $messages[][] = array( + 'ok', 'Configuration file loaded' + ); + } else { + $messages[][] = array( + 'info', 'No configuration file found' + ); + } } catch (\Exception $e) { $messages[][] = array('err', $e->getMessage()); } @@ -41,41 +82,68 @@ foreach ($adapter as $classpart) { } } -header('HTTP/1.0 200 OK'); - $out = << - + + phancap setup check + + + + -

phancap setup check

-