X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/d3d149e5d0a1dd80333077966c1b9d12fd18a87a..acc39fd2f0eaf516dbb534232ed5f631c269886b:/page.php diff --git a/page.php b/page.php index b160e45..bb53a94 100644 --- a/page.php +++ b/page.php @@ -42,8 +42,15 @@ function getoutput($blocks = []) $Args .= '/'.$param; } } - include "$name.php"; - $html = ob_get_clean(); + try { + include "$name.php"; + $html = ob_get_clean(); + } + catch (Exception $e) { + $html = sprintf('%s', + "fout in $name: {$e->getMessage()}" + ); + } } else { $html = ''.$name.' ontbreekt'; @@ -59,14 +66,15 @@ function getoutput($blocks = []) # custom error handling -define('DOCROOT', getcwd().'/'); +define('DOCROOT', getcwd()); +set_include_path(implode(PATH_SEPARATOR, [ DOCROOT, __DIR__ ])); function fail($error) { http_response_code(500); include_once 'page.inc.php'; ob_start(); - require_once DOCROOT.'500.html'; + require_once '500.html'; print getoutput(['debug' => $error]); } @@ -162,7 +170,7 @@ $Place += [ if (!$found) { # no resulting output http_response_code(404); - @require "./404.html"; + @require '404.html'; } include_once 'page.inc.php';