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 # execute dynamic code
33 $prepend = $append = '';
35 require "./$Page.php";
36 if (ob_get_level() > 1) $append = ob_get_clean();
37 if (ob_get_level() > 0) $prepend = ob_get_clean();
40 # prepare static contents
42 include_once 'page.inc.php'; # global html
44 if (file_exists("$Page$Args/index.html")) {
48 if (!$Page and !file_exists("$Page$Args.html")) {
51 if (isset($User) and $User['admin']) {
56 require "./$Page.php";
60 # output prepared html
64 print '<div class="static">'."\n\n";
65 if (file_exists("$Page$Args.html")) {
66 include "./$Page$Args.html"; # static contents