diff --git a/Actions/Setup.php b/Actions/Setup.php new file mode 100644 index 0000000..71dba26 --- /dev/null +++ b/Actions/Setup.php @@ -0,0 +1,32 @@ +get_response_code("$uri_root/settings.toml"); + + if($toml_response_code >= 200 && $toml_response_code < 300) + send_error(503, "Error: The settings file is visible from the web!"); + + header("content-type: text/plain"); + exit("Your setup looks ok :-)"); + } + + protected function get_response_code($url) { + stream_context_set_default([ 'http' => [ 'method' => 'HEAD' ] ]); + + $headers = get_headers($url); + return intval(explode(" ", $headers[0])[1]); + } +}