X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/487771a9db7678090c96997cda323b53706f95a9..7333dc046075c7873b15643ecd73f6e3b32c7a79:/page.php diff --git a/page.php b/page.php index 9acacc2..cb201f2 100644 --- a/page.php +++ b/page.php @@ -28,44 +28,39 @@ while (TRUE) { } } -# execute dynamic code +# load static contents -$prepend = $append = ''; -if ($Page) { - require "./$Page.php"; - if (ob_get_level() > 1) $append = ob_get_clean(); - if (ob_get_level() > 0) $prepend = ob_get_clean(); +ob_start(); # page body +ob_start(); # inner html +print '
'."\n\n"; + +$found = FALSE; +if (file_exists("$Page$Args/index.html")) { + $found = include "./$Page$Args/index.html"; +} +elseif (file_exists("$Page$Args.html")) { + $found = include "./$Page$Args.html"; } -# prepare static contents +print "
\n\n"; -include_once 'page.inc.php'; # global html +# execute dynamic code -if (file_exists("$Page$Args/index.html")) { - $Args .= '/index'; +if ($Page) { + $found |= require "./$Page.php"; } -if (!$Page and !file_exists("$Page$Args.html")) { - # include not found - $Args = ''; +# global html + +include_once 'page.inc.php'; + +if (!$found) { + # no resulting output if (isset($User) and $User['admin']) { - $Page = 'template'; + require './template.html'; } else { - $Page = '404'; - require "./$Page.php"; + require "./404.php"; } } -# output prepared html - -print $prepend; - -print '
'."\n\n"; -if (file_exists("$Page$Args.html")) { -include "./$Page$Args.html"; # static contents -} -print "
\n\n"; - -print $append; -