2 error_reporting(E_ALL);
3 ini_set('display_errors', TRUE);
5 set_exception_handler(function ($error) {
6 include_once 'page.inc.php';
7 include_once '500.php';
10 include_once 'auth.inc.php';
11 $Edit = isset($_GET['edit']);
13 # distinguish subpage Args from topmost Page script
16 $Page = preg_replace('/\?.*/', '', $_SERVER['REQUEST_URI']);
17 $Page = urldecode(trim($Page, '/')) ?: 'index';
19 if (file_exists("$Page.php")) {
23 $up = strrpos($Page, '/');
24 $Args = substr($Page, $up) . $Args;
25 $Page = substr($Page, 0, $up);
31 # load static contents
33 ob_start(); # page body
34 ob_start(); # inner html
35 print '<div class="static">'."\n\n";
38 if (file_exists("$Page$Args/index.html")) {
39 $found = include "./$Page$Args/index.html";
41 elseif (file_exists("$Page$Args.html")) {
42 $found = include "./$Page$Args.html";
47 # execute dynamic code
50 $found |= require "./$Page.php";
55 include_once 'page.inc.php';
59 if (isset($User) and $User['admin']) {
60 require './template.html';