blob: ba523aacfd2eac4beff3bdeb22b93d6edea68bcc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
<?php
global $title;
global $toplevel;
global $emergencyHeader;
global $pages;
global $lang; global $pages;
$pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true);
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $isLowerLoggedIn;
if (in_array($toplevel, array_keys($pages))) {
$title = $pages[$toplevel]["name"][$lang["_name"]];
if ($pages[$toplevel]["admin"]) {
$readOnly = false;
@file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/.test", "hello");
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/.test")) {
unlink($_SERVER['DOCUMENT_ROOT'] . "/includes/data/.test");
} else {
$readOnly = true;
}
if ($pages[$toplevel]["limited"]) {
if ((!$isLoggedIn && !$isLowerLoggedIn) || ($readOnly && !$emergencyHeader)) header("Location: /-/login/?return=/-/$toplevel") and die();
} else {
if (!$isLoggedIn || ($readOnly && !$emergencyHeader)) header("Location: /-/login/?return=/-/$toplevel") and die();
}
}
} else {
$title = $toplevel;
}
|