X-Git-Url: http://git.shiar.nl/minimedit.git/blobdiff_plain/11c30da0ff491c29301ec1a42e7873d556364c74..fc74e45e15e3b1f17312f229496c25f7caff7d60:/page.php diff --git a/page.php b/page.php index dd629fd..bca7a67 100644 --- a/page.php +++ b/page.php @@ -10,7 +10,7 @@ function abort($body, $status = NULL) { function placeholder_include($name, $params = []) { - $path = "$name.php"; + $path = stream_resolve_include_path("$name.php"); if (!file_exists($path)) { return ''.$name.' ontbreekt'; } @@ -52,8 +52,13 @@ 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.'">.*?}s', '', $doc); + return preg_replace_callback( - '< \[\[ ([^] ]+) ([^]]*) \]\] >x', + '{ (?