summaryrefslogtreecommitdiff
path: root/includes/init.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/init.php')
-rw-r--r--includes/init.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/includes/init.php b/includes/init.php
new file mode 100644
index 0000000..71d7def
--- /dev/null
+++ b/includes/init.php
@@ -0,0 +1,18 @@
+<?php
+
+global $title;
+global $toplevel;
+global $pages;
+
+$pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true);
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $isLoggedIn;
+
+if (in_array($toplevel, array_keys($pages))) {
+ $title = $pages[$toplevel]["name"];
+
+ if ($pages[$toplevel]["admin"]) {
+ if (!$isLoggedIn) header("Location: /-/login/?return=$toplevel") and die();
+ }
+} else {
+ $title = $toplevel;
+} \ No newline at end of file