*/ // Include functions and settings. require_once __DIR__ . "/inc/functions.php"; // Check validity of request. if (isset($_GET['id']) and !file_exists(__DIR__ . "/data/static/" . $_GET['id'] . ".json")) { echo printErrorPage($settings, "File does not exist."); return; } // Ensure working environment for frontend. ensureEnvironment(); $pages = loadPublicPages(); // Load overview of pages. /* * Load data. */ /* * @var array $tPage The variable contains the main data on the displayed page. */ $tPage = []; if (isset($_GET['id'])) $id = $_GET['id']; else if (file_exists(__DIR__ . "/data/static/" . $settings['startPage'] . ".json")) { $id = $settings['startPage']; } else { echo printErrorPage($settings, "This file does not exist."); return; } $tPage = json_decode(file_get_contents(__DIR__ . "/data/static/" . $id . ".json"), true); if (!$tPage['public']) { if (!(isset($_GET['preview']) and checkPreviewAccess())) { echo printErrorPage("This page is not public."); return; } } /* * Output */ echo printPublicHead($settings, $id, $settings['pageTitle'], $settings['logo']); echo printPublicHeader($settings['pageTitle']); echo printStaticPagePart("banner", "header"); // Print aside (if need be) echo generatePublicNav($pages); echo '