X-Git-Url: http://git.shiar.nl/minimedit.git/blobdiff_plain/fc74e45e15e3b1f17312f229496c25f7caff7d60..170f16e2dd3a643423ea3681bf4ea42d320e1cf4:/page.php diff --git a/page.php b/page.php index bca7a67..e23b3e2 100644 --- a/page.php +++ b/page.php @@ -10,7 +10,7 @@ function abort($body, $status = NULL) { function placeholder_include($name, $params = []) { - $path = stream_resolve_include_path("$name.php"); + $path = stream_resolve_include_path("widget/$name.php"); if (!file_exists($path)) { return ''.$name.' ontbreekt'; } @@ -28,7 +28,7 @@ function placeholder_include($name, $params = []) } } try { - include "$name.php"; + include "widget/$name.php"; return ob_get_clean(); } catch (Exception $e) { @@ -55,7 +55,7 @@ function getoutput($blocks = []) # keep either login or logout parts depending on user level global $User; $hideclass = empty($User) ? 'login' : 'logout'; - $doc = preg_replace('{\s*<(p|li|span) class="'.$hideclass.'">.*?\1>}s', '', $doc); + $doc = preg_replace('{\s*<([a-z]+) class="'.$hideclass.'">.*?\1>}s', '', $doc); return preg_replace_callback( '{ (?title = 'Fout'; + } include_once 'page.inc.php'; ob_start(); - require_once '500.html'; - print getoutput(['debug' => $error]); + require '500.inc.html'; + print getoutput(['debug' => htmlspecialchars($error)]); } set_exception_handler('fail'); @@ -113,6 +118,7 @@ error_reporting(error_reporting() & ~E_FATAL); # user login and control +$User = NULL; include_once 'auth.inc.php'; $Edit = isset($_GET['edit']); @@ -158,42 +164,46 @@ if (file_exists("$Page$Args.html")) { elseif (file_exists("$Page$Args/index.html")) { $staticpage = "$Page$Args/index.html"; } -elseif (!empty($User['admin'])) { - $staticpage = (file_exists("$Page/template.html") ? "$Page/template.html" : 'template.html'); -} - -# load static contents - -ob_start(); # page body -ob_start(); # inner html -print '