summaryrefslogtreecommitdiff
path: root/includes/init.php
blob: 71d7def8ea3929d66678fead521977d3f1f10007 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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;
}