This commit is contained in:
Roman 2021-04-03 13:05:20 +02:00
parent d1f030542a
commit c81e9e8776
2 changed files with 6 additions and 2 deletions

@ -27,6 +27,10 @@ abstract class Document {
public function getView() : ?View { public function getView() : ?View {
if ($this->activeView === null) {
return null;
}
$view = parseClass($this->activeView); $view = parseClass($this->activeView);
$file = getClassPath($view); $file = getClassPath($view);
if(!file_exists($file) || !is_subclass_of($view, View::class)) { if(!file_exists($file) || !is_subclass_of($view, View::class)) {

@ -139,8 +139,8 @@ function serveStatic(string $webRoot, string $file): string {
$pathInfo = pathinfo($path); $pathInfo = pathinfo($path);
// TODO: add more file extensions here // TODO: add more file extensions here, probably add them to settings?
$allowedExtension = array("html", "htm"); $allowedExtension = array("html", "htm", "pdf");
$ext = $pathInfo["extension"] ?? ""; $ext = $pathInfo["extension"] ?? "";
if (!in_array($ext, $allowedExtension)) { if (!in_array($ext, $allowedExtension)) {
http_response_code(406); http_response_code(406);