blob: 021ae4b89c53b7028441d153fc29077a23cb762f (
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
<?php
function getSubsystemByID(string $id) {
global $subsystems;
$subsystem = null;
foreach ($subsystems as $ss) {
if ($ss["source"] === $id) {
$subsystem = $ss;
}
}
return $subsystem;
}
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages;
if (!isset($_GET['_']) || trim($_GET['_']) === "") header("Location: /?error=Invalid request") and die();
$parts = explode("/", $_GET['_']);
array_shift($parts);
array_shift($parts);
$system = $parts[0];
$member = !isset($parts[1]) || $parts[1] === "" ? null : $parts[1];
if ($system !== "cloudburst" && $system !== "raindrops") header("Location: /?error=Invalid system name: " . $system) and die();
$systemCommonName = $system === "cloudburst" ? "Cloudburst System" : "Raindrops System";
$systemID = $system === "cloudburst" ? "ynmuc" : "gdapd";
$subsystems = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/subsystems/$systemID.json"), true) ?? [];
if ($member === null) {
require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/sysedit.inc';
} else {
$isSubsystem = false;
$members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $systemID . "/members.json"), true);
$memberData = null;
$memberCommonName = null;
$memberID = null;
foreach ($members as $m) {
if ($m['name'] === $member) {
$memberData = $m;
$memberCommonName = $m['display_name'] ?? $m['name'];
$memberID = $m['id'];
}
}
if ($memberData === null) {
if (in_array($member, array_map(function ($i) {
return $i["source"];
}, $subsystems))) {
$isSubsystem = true;
$subsystemID = $member;
$subsystem = getSubsystemByID($subsystemID);
$subsystemData = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/subsystems/$systemID-$subsystem[source].json"), true);
$subsystemCommonName = $subsystemData["name"] ?? $subsystemID;
require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/subsysedit.inc';
} else {
header("Location: /?error=System member or subsystem not found: " . $subsystemID) and die();
}
}
require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/edit.inc';
}
exit;
|