2 error_reporting(E_ALL);
3 ini_set('display_errors', TRUE);
5 include_once 'auth.inc.php';
6 $Edit = isset($_GET['edit']);
8 # distinguish subpage Args from topmost Page script
11 $Page = preg_replace('/\?.*/', '', $_SERVER['REQUEST_URI']);
12 $Page = urldecode(trim($Page, '/')) ?: 'index';
14 if (file_exists("$Page.php")) {
18 $up = strrpos($Page, '/');
19 $Args = substr($Page, $up) . $Args;
20 $Page = substr($Page, 0, $up);
26 # execute dynamic code
28 $prepend = $append = '';
30 require "./$Page.php";
31 if (ob_get_level() > 1) $append = ob_get_clean();
32 if (ob_get_level() > 0) $prepend = ob_get_clean();
35 # prepare static contents
37 include_once 'page.inc.php'; # global html
39 if (file_exists("$Page$Args/index.html")) {
43 if (!$Page and !file_exists("$Page$Args.html")) {
46 if (isset($User) and $User['admin']) {
51 require "./$Page.php";
55 # output prepared html
59 print '<div class="static">'."\n\n";
60 if (file_exists("$Page$Args.html")) {
61 include "./$Page$Args.html"; # static contents