diff options
Diffstat (limited to 'pages')
46 files changed, 265 insertions, 265 deletions
diff --git a/pages/about.inc b/pages/about.inc deleted file mode 100644 index 8a62d66..0000000 --- a/pages/about.inc +++ /dev/null @@ -1,80 +0,0 @@ -<?php - -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; -$version = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/version.json"), true); - -$ignore = [ - $_SERVER['DOCUMENT_ROOT'] . "/Data", - $_SERVER['DOCUMENT_ROOT'] . "/bits/Data", - $_SERVER['DOCUMENT_ROOT'] . "/Private/Data", - $_SERVER['DOCUMENT_ROOT'] . "/bits/Private/Data", - $_SERVER['DOCUMENT_ROOT'] . "/includes/data", - $_SERVER['DOCUMENT_ROOT'] . "/includes/tokens", -]; - -function rscandir($dir, $inverseIgnore = false) { - global $ignore; - $files = []; - - foreach (array_filter(scandir($dir), function ($i) { - return !str_starts_with($i, "."); - }) as $file) { - if (!(($inverseIgnore && !in_array($dir . "/" . $file, $ignore)) || (!$inverseIgnore && in_array($dir . "/" . $file, $ignore)))) { - if (is_dir($dir . "/" . $file)) { - array_push($files, ...rscandir($dir . "/" . $file)); - } else { - $files[] = $dir . "/" . $file; - } - } - } - - return array_unique($files); -} - -$sizeSystem = array_reduce(array_map(function ($i) { - return filesize($i); -}, rscandir($_SERVER['DOCUMENT_ROOT'])), function ($a, $b) { - return $a + $b; -}); - -$sizeData = array_reduce(array_map(function ($i) { - return filesize($i); -}, rscandir($_SERVER['DOCUMENT_ROOT'], true)), function ($a, $b) { - return $a + $b; -}); - -?> - -<br> -<div class="container"> - <div id="page-content"> - <h2>About Cold Haze</h2> - <p> - <b>Cold Haze Engine version 2.<?= $version["build"] ?>.<?= $version["revision"] ?></b><br> - Version date: <?= date('D j M Y, G:i:s T', $version["timestamp"]) ?><br> - Version ID: <code style="color: white;"><?= $version["hash"] ?></code><br> - Install path: <?= $_SERVER['DOCUMENT_ROOT'] ?><br> - Server software: <?= $_SERVER['SERVER_SOFTWARE'] ?>, via <?= $_SERVER['GATEWAY_INTERFACE'] ?><br> - Transport protocol: <?= $_SERVER['SERVER_PROTOCOL'] ?> - </p> - - <p> - <b>PHP <?= PHP_VERSION ?></b><br> - Zend Engine: <?= zend_version() ?><br> - Server API: <?= php_sapi_name() ?><br> - Memory usage: <?= prettySize(memory_get_peak_usage()) ?><br> - Server OS: <?= php_uname("s") ?> <?= php_uname("r") ?><br> - Server domain name: <?= php_uname("n") ?><br> - Server architecture: <?= php_uname("m") ?> - </p> - - <p> - <b>Disk space usage</b><br> - Engine: <?= prettySize($sizeSystem) ?><br> - Database: <?= prettySize($sizeData) ?> - </p> - </div> -</div> - -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> diff --git a/pages/alphabet.inc b/pages/alphabet.inc index 55cb130..37bd74d 100644 --- a/pages/alphabet.inc +++ b/pages/alphabet.inc @@ -1,7 +1,7 @@ <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; ?> @@ -35,4 +35,4 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; </div> </div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/footer.inc'; ?> diff --git a/pages/api/chrome.php b/pages/api/chrome.php new file mode 100644 index 0000000..0be8a94 --- /dev/null +++ b/pages/api/chrome.php @@ -0,0 +1,87 @@ +<?php + +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; + + +if (isset($_GET["e"])) { + header("Access-Control-Allow-Origin: chrome-extension://klenhenmabddpffgdaijdkjmfkkafbno"); +} else { + header("Access-Control-Allow-Origin: *"); +} + +header("Access-Control-Allow-Credentials: true"); +header("Access-Control-Allow-Methods: *"); +header("Access-Control-Allow-Headers: *"); + +if (!isset($_GET["t"])) { + header("Content-Type: application/json"); + + if ($isLoggedIn) { + die("true"); + } else { + die("false"); + } +} else { + switch ($_GET["t"]) { + case "onboarding": + header("Content-Type: text/html"); + + ?> +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <link rel="icon" href="https://git.equestria.dev/repo-avatars/1c0dad449a8e21ad16fa0efb1426c1a3301b1f26a8cb3b3902eec88bb568e34c" type="image/png"> + <title>Luna for Chrome OS</title> + <style> + html, body { + background-color: #0d0b16; + color: white; + font-family: sans-serif; + overflow: hidden; + } + + button:hover { + opacity: .75; + } + + button:active { + opacity: .5; + } + </style> +</head> +<body> +<div style="max-width: 65vw; margin-left: auto; margin-right: auto; height: 100vh; display: flex; align-items: center; justify-content: center; text-align: center;"> + <div> + <img src="https://git.equestria.dev/repo-avatars/1c0dad449a8e21ad16fa0efb1426c1a3301b1f26a8cb3b3902eec88bb568e34c" width="128px"> + <h1>Please login to Cold Haze</h1> + <p>To proceed with activating Luna on this Chromebook, you need to login to Cold Haze. You also need to make sure you properly enroled this computer into Chrome Enterprise.</p> + <button onclick='window.open("https://ponies.equestria.horse/-/login/?return=/api/close&mini", "_blank", "popup,top=100,width=100,height:250")' style="cursor: pointer; background: #5958ad; color: white; border: none; padding: 5px 10px; border-radius: 5px;">Login</button> + </div> +</div> + +<script> + setTimeout(async () => { + if (JSON.parse(await (await fetch("https://ponies.equestria.horse/api/chrome")).text())) { + window.close(); + } + }); + + setInterval(async () => { + if (JSON.parse(await (await fetch("https://ponies.equestria.horse/api/chrome")).text())) { + window.close(); + } + }, 5000); +</script> +</body> +</html> +<?php + + die(); + default: + header("Location: /"); + die(); + } +}
\ No newline at end of file diff --git a/pages/api/close.php b/pages/api/close.php new file mode 100644 index 0000000..07d1cff --- /dev/null +++ b/pages/api/close.php @@ -0,0 +1 @@ +<script>window.close();</script>
\ No newline at end of file diff --git a/pages/api/cloudburst-img.php b/pages/api/cloudburst-img.php index 1967a90..7d22aad 100644 --- a/pages/api/cloudburst-img.php +++ b/pages/api/cloudburst-img.php @@ -1,6 +1,6 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.inc"; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; $fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/fronters.json"), true); $url = isset($fronters['members'][0]) ? ($fronters['members'][0]["avatar_url"] ? $_SERVER['DOCUMENT_ROOT'] . getAsset("ynmuc", $fronters['members'][0]["id"]) : $_SERVER['DOCUMENT_ROOT'] . "/uploads/raindrops.png") : $_SERVER['DOCUMENT_ROOT'] . "/uploads/raindrops.png"; diff --git a/pages/api/computer.php b/pages/api/computer.php index d3ec15a..8261fa8 100644 --- a/pages/api/computer.php +++ b/pages/api/computer.php @@ -1,12 +1,16 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn; global $_PROFILE; +if (isset($_GET["chrome"])) { + header("Access-Control-Allow-Origin: chrome-extension://klenhenmabddpffgdaijdkjmfkkafbno"); +} + +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $_PROFILE; if (!$isLoggedIn) header("Location: /-/login") and die(); $request_raw = file_get_contents('php://input'); $json_object = json_decode($request_raw, true); -$host = md5($json_object['host']); +$host = md5($json_object['host'] ?? $_GET["host"]); switch ($_GET['type']) { case "heartbeat": diff --git a/pages/api/data.php b/pages/api/data.php index 0a1b01b..eb07824 100644 --- a/pages/api/data.php +++ b/pages/api/data.php @@ -1,7 +1,7 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn; -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/bitset.inc"; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/bitset.inc"; if (!$isLoggedIn) header("Location: /-/login") and die(); if (!isset($_GET['f']) || !file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $_GET['f'])) { diff --git a/pages/api/docs.php b/pages/api/docs.php index 89e9216..d279765 100644 --- a/pages/api/docs.php +++ b/pages/api/docs.php @@ -1,6 +1,6 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn; global $_PROFILE; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $_PROFILE; if (!$isLoggedIn) header("Location: /-/login") and die(); $request_raw = file_get_contents('php://input'); diff --git a/pages/api/emergency-real.php b/pages/api/emergency-real.php index 2dd7172..05bbaf7 100644 --- a/pages/api/emergency-real.php +++ b/pages/api/emergency-real.php @@ -1,6 +1,6 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; if (!$isLoggedIn) header("Location: /-/login") and die(); global $_PROFILE; diff --git a/pages/api/emergency.php b/pages/api/emergency.php index e0726e7..ff79834 100644 --- a/pages/api/emergency.php +++ b/pages/api/emergency.php @@ -1,6 +1,6 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; if (!$isLoggedIn) header("Location: /-/login") and die(); global $_PROFILE; diff --git a/pages/api/fronter.php b/pages/api/fronter.php index b380a56..9ef5571 100644 --- a/pages/api/fronter.php +++ b/pages/api/fronter.php @@ -1,6 +1,6 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn; global $isLowerLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $isLowerLoggedIn; if (!$isLoggedIn || $isLowerLoggedIn) { header("Location: /-/login"); die(); diff --git a/pages/api/me.php b/pages/api/me.php index 817b106..215e1cf 100644 --- a/pages/api/me.php +++ b/pages/api/me.php @@ -2,7 +2,7 @@ $app = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true); -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn; global $isLowerLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $isLowerLoggedIn; if (!$isLoggedIn && !$isLowerLoggedIn) header("Location: /-/login") and die(); global $_PROFILE; diff --git a/pages/api/plex.php b/pages/api/plex.php index 6d7ad8f..a2fa739 100644 --- a/pages/api/plex.php +++ b/pages/api/plex.php @@ -1,6 +1,6 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/random.inc"; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/random.inc"; $app = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true); function formatTitle($metadata) { @@ -48,8 +48,6 @@ if ($payload["Metadata"]["type"] === "track") { file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/assets/cache/" . $id . ".jpg", file_get_contents("https://plex.equestria.dev" . $payload["Metadata"]["grandparentThumb"] . "?X-Plex-Token=" . $app["plex"])); } -file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/.files.json", json_encode($_FILES)); - if ($payload["event"] === "playback.started" || $payload["event"] === "media.play") { $hookObject = json_encode([ "username" => "Plex", diff --git a/pages/api/pluralkit-integration.php b/pages/api/pluralkit-integration.php index 0793873..f5bb4dd 100644 --- a/pages/api/pluralkit-integration.php +++ b/pages/api/pluralkit-integration.php @@ -1,6 +1,6 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/agewarning.inc"; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/agewarning.inc"; $app = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true); $user = $_GET['user'] ?? null; @@ -86,86 +86,56 @@ if ($input["type"] === "CREATE_SWITCH" || $input["type"] === "UPDATE_SWITCH" || } } - if ($system !== $app["other"]["id"] || !isset($app["other"])) { - if (count($fronters["members"]) > 1) { - $context = stream_context_create([ - 'http' => [ - 'method' => 'POST', - 'header' => - "Content-Type: text/plain\r\n" . - "Title: 🐴 Switch occurred in the $name\r\n" . - "Priority: default\r\n" . - "Tags: switch\r\n" . - "Actions: view, Open " . $fronters["members"][0]["display_name"] . " on Cold Haze, https://ponies.equestria.horse/" . $fronters["members"][0]["name"] . "/, clear=true;view, Open " . $fronters["members"][1]["display_name"] . " on Cold Haze, https://ponies.equestria.horse/" . $fronters["members"][1]["name"] . "/, clear=true\r\n" . - "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => ($fronters["members"][0]["display_name"] ?? $fronters["members"][0]["name"]) . " and " . ($fronters["members"][1]["display_name"] ?? $fronters["members"][1]["name"]) . " switched in just now" - ] - ]); - } else if (count($fronters["members"]) > 0) { - $context = stream_context_create([ - 'http' => [ - 'method' => 'POST', - 'header' => - "Content-Type: text/plain\r\n" . - "Title: 🐴 Switch occurred in the $name\r\n" . - "Priority: default\r\n" . - "Tags: switch\r\n" . - "Actions: view, Open on Cold Haze, https://ponies.equestria.horse/" . $fronters["members"][0]["name"] . "/, clear=true\r\n" . - "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => ($fronters["members"][0]["display_name"] ?? $fronters["members"][0]["name"]) . " switched in just now" - ] - ]); - } else { - $context = stream_context_create([ - 'http' => [ - 'method' => 'POST', - 'header' => - "Content-Type: text/plain\r\n" . - "Title: 🐴 Switch occurred in the $name\r\n" . - "Priority: default\r\n" . - "Tags: switch\r\n" . - "Actions: view, Open on Cold Haze, https://ponies.equestria.horse/, clear=true\r\n" . - "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => "The fallback pony switched in just now" - ] - ]); - } + if (count($fronters["members"]) > 1) { + $context = stream_context_create([ + 'http' => [ + 'method' => 'POST', + 'header' => + "Content-Type: text/plain\r\n" . + "Title: 🐴 Switch occurred in $name\r\n" . + "Priority: default\r\n" . + "Tags: switch\r\n" . + "Actions: view, Open " . $fronters["members"][0]["display_name"] . " on Cold Haze, https://ponies.equestria.horse/" . $fronters["members"][0]["name"] . "/, clear=true;view, Open " . $fronters["members"][1]["display_name"] . " on Cold Haze, https://ponies.equestria.horse/" . $fronters["members"][1]["name"] . "/, clear=true\r\n" . + "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), + 'content' => ($fronters["members"][0]["display_name"] ?? $fronters["members"][0]["name"]) . " and " . ($fronters["members"][1]["display_name"] ?? $fronters["members"][1]["name"]) . " switched in just now" + ] + ]); + } else if (count($fronters["members"]) > 0) { + $context = stream_context_create([ + 'http' => [ + 'method' => 'POST', + 'header' => + "Content-Type: text/plain\r\n" . + "Title: 🐴 Switch occurred in $name\r\n" . + "Priority: default\r\n" . + "Tags: switch\r\n" . + "Actions: view, Open on Cold Haze, https://ponies.equestria.horse/" . $fronters["members"][0]["name"] . "/, clear=true\r\n" . + "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), + 'content' => ($fronters["members"][0]["display_name"] ?? $fronters["members"][0]["name"]) . " switched in just now" + ] + ]); + } else { + $context = stream_context_create([ + 'http' => [ + 'method' => 'POST', + 'header' => + "Content-Type: text/plain\r\n" . + "Title: 🐴 Switch occurred in $name\r\n" . + "Priority: default\r\n" . + "Tags: switch\r\n" . + "Actions: view, Open on Cold Haze, https://ponies.equestria.horse/, clear=true\r\n" . + "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), + 'content' => "The fallback pony switched in just now" + ] + ]); + } + if ($system !== $app["other"]["id"] || !isset($app["other"])) { file_get_contents('https://' . $ntfy["server"] . '/public-switches', false, $context); } if ($system === "gdapd") { $topic = "public-switches-raindrops"; - - if (count($fronters["members"]) > 0) { - file_get_contents('https://' . $ntfy["server"] . '/public-switches-fr', false, stream_context_create([ - 'http' => [ - 'method' => 'POST', - 'header' => - "Content-Type: text/plain\r\n" . - "Title: 🐴 $name vient de switch\r\n" . - "Priority: default\r\n" . - "Tags: switch\r\n" . - "Actions: view, Voir sur Cold Haze, https://fr.equestria.horse/" . $fronters["members"][0]["name"] . "/, clear=true\r\n" . - "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => ($fronters["members"][0]["display_name"] ?? $fronters["members"][0]["name"]) . " est désormais au front" - ] - ])); - } else { - file_get_contents('https://' . $ntfy["server"] . '/public-switches-fr', false, stream_context_create([ - 'http' => [ - 'method' => 'POST', - 'header' => - "Content-Type: text/plain\r\n" . - "Title: 🐴 $name vient de switch\r\n" . - "Priority: default\r\n" . - "Tags: switch\r\n" . - "Actions: view, Voir sur Cold Haze, https://fr.equestria.horse/, clear=true\r\n" . - "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => "Le poney de trait est désormais au front" - ] - ])); - } } else if ($system === "ynmuc") { $topic = "public-switches-cloudburst"; } else { diff --git a/pages/api/ponytown.php b/pages/api/ponytown.php index f41ac01..e75ea33 100644 --- a/pages/api/ponytown.php +++ b/pages/api/ponytown.php @@ -1,6 +1,6 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn; global $_PROFILE; global $isLowerLoggedIn; global $app; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $_PROFILE; global $isLowerLoggedIn; global $app; if (!$isLoggedIn && !$isLowerLoggedIn) header("Location: /-/login") and die(); $request_raw = file_get_contents('php://input'); diff --git a/pages/api/raindrops-img.php b/pages/api/raindrops-img.php index 4cbac6b..fcf1ae6 100644 --- a/pages/api/raindrops-img.php +++ b/pages/api/raindrops-img.php @@ -1,6 +1,6 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.inc"; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; $fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/fronters.json"), true); $url = isset($fronters['members'][0]) ? ($fronters['members'][0]["avatar_url"] ? $_SERVER['DOCUMENT_ROOT'] . getAsset("gdapd", $fronters['members'][0]["id"]) : $_SERVER['DOCUMENT_ROOT'] . "/uploads/raindrops.png") : $_SERVER['DOCUMENT_ROOT'] . "/uploads/raindrops.png"; diff --git a/pages/api/save-private.php b/pages/api/save-private.php index de7d505..6843e2a 100644 --- a/pages/api/save-private.php +++ b/pages/api/save-private.php @@ -1,6 +1,6 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; if (!$isLoggedIn) header("Location: /-/login") and die(); $request_raw = file_get_contents('php://input'); diff --git a/pages/api/save.php b/pages/api/save.php index 2ea3663..abb477d 100644 --- a/pages/api/save.php +++ b/pages/api/save.php @@ -1,6 +1,6 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn; global $isLowerLoggedIn; global $app; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $isLowerLoggedIn; global $app; if (!$isLoggedIn && !$isLowerLoggedIn) header("Location: /-/login") and die(); $request_raw = file_get_contents('php://input'); diff --git a/pages/api/token.php b/pages/api/token.php index 99b9158..5c80ca3 100644 --- a/pages/api/token.php +++ b/pages/api/token.php @@ -1,6 +1,6 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; if (!$isLoggedIn) header("Location: /-/login") and die(); header("Content-Type: text/plain"); diff --git a/pages/api/wakeup-real.php b/pages/api/wakeup-real.php index 2267a4e..0467f27 100644 --- a/pages/api/wakeup-real.php +++ b/pages/api/wakeup-real.php @@ -1,6 +1,6 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; if (!$isLoggedIn) header("Location: /-/login") and die(); global $_PROFILE; diff --git a/pages/api/wakeup.php b/pages/api/wakeup.php index 69b0a68..c338b9a 100644 --- a/pages/api/wakeup.php +++ b/pages/api/wakeup.php @@ -1,6 +1,6 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; if (!$isLoggedIn) header("Location: /-/login") and die(); global $_PROFILE; diff --git a/pages/byfront.inc b/pages/byfront.inc index bcdc1e8..2ec62bd 100644 --- a/pages/byfront.inc +++ b/pages/byfront.inc @@ -1,7 +1,7 @@ <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; $travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling/travelling.json"), true); ?> @@ -174,4 +174,4 @@ $travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includ </style> </div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/footer.inc'; ?> diff --git a/pages/byspecies.inc b/pages/byspecies.inc index 28f114e..ee2b372 100644 --- a/pages/byspecies.inc +++ b/pages/byspecies.inc @@ -1,4 +1,4 @@ -<?php global $system; global $systemCommonName; global $lang; global $pages; global $systemID; $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true); $title = $pages["s:species"]["name"][$lang["_name"]] . " · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; global $travelling; +<?php global $system; global $systemCommonName; global $lang; global $pages; global $systemID; $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true); $title = $pages["s:species"]["name"][$lang["_name"]] . " · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; global $travelling; $members = scoreOrderGlobal(); @@ -10,7 +10,7 @@ function species(array $members, string $id, string $name) { global $systemID; g <div class="relation-item" style="margin-left:10px;padding:0 20px;"> <?php if (count($members) > 0): ?> - <?php $index = 0; foreach ($members as $member): ?><a class="member-link" href="/<?= $member["name"] ?>"><img src="<?= getAsset($member["_system"], $member["id"], "heads") ?>" style="width:24px;"> <?= getMiniName($member["display_name"] ?? $member["name"]) ?></a><?php if ($index + 2 <= count($members)) echo('<span class="list-separator-desktop">, </span><span class="list-separator-mobile"><br></span>'); $index++; endforeach; ?> + <?php $index = 0; foreach ($members as $member): ?><a class="member-link" href="/<?= $member["name"] ?>"><img src="<?= getAsset($member["_system"], $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?></a><?php if ($index + 2 <= count($members)) echo('<span class="list-separator-desktop">, </span><span class="list-separator-mobile"><br></span>'); $index++; endforeach; ?> <?php else: ?>-<?php endif; ?> </div> </div> @@ -54,4 +54,4 @@ function species(array $members, string $id, string $name) { global $systemID; g <?php species($changeling, "changeling", "Changelings"); ?> </div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?>
\ No newline at end of file +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/footer.inc'; ?>
\ No newline at end of file diff --git a/pages/computers.inc b/pages/computers.inc index 56a1b5d..fb88296 100644 --- a/pages/computers.inc +++ b/pages/computers.inc @@ -1,6 +1,6 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; global $pagename; global $_USER; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; global $pagename; global $_USER; global $_PROFILE; $computer = []; $parts = explode("/", $pagename); @@ -26,7 +26,7 @@ if (isset($parts[2]) && $parts[2] !== "control") { die(); } -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; $parts = array_values(array_filter($parts, function ($i) { return $i !== "-"; @@ -36,6 +36,10 @@ if (count($parts) === 2 || count($parts) === 3) { array_unshift($parts, null); } +if (str_ends_with($computer["os"], "unknown")) { + $computer["os"] = trim(substr($computer["os"], 0, -7)); +} + ?> <script> @@ -112,11 +116,15 @@ if (count($parts) === 2 || count($parts) === 3) { </tr> <tr> <td style="padding-right: 10px; text-align: right;"><b>Serial:</b></td> - <td><?= $computer["serial"] ?> (<?= $computer["serial_source"] === "hardware" ? "logic board" : "OS" ?>)</td> + <?php if (trim($computer["serial"]) !== ""): ?><td><?= $computer["serial"] ?> (<?= $computer["serial_source"] === "hardware" ? "logic board" : "OS" ?>)</td><?php else: ?><td>-</td><?php endif; ?> </tr> <tr> - <td style="padding-right: 10px; text-align: right;"><b>Last seen:</b></td> - <td><?= date('j M, g:ia (T)', strtotime($computer["date"])) ?>, <?= timeAgo($computer["date"]) ?></td> + <td style="padding-right: 10px; text-align: right;"><b>Status:</b></td> + <?php if (timeAgo($computer["date"]) === "now"): ?> + <td>Online</td> + <?php else: ?> + <td>Offline since <?= timeAgo($computer["date"]) ?>, <?= date('j M, g:ia (T)', strtotime($computer["date"])) ?></td> + <?php endif; ?> </tr> </tbody> </table> @@ -225,7 +233,7 @@ if (count($parts) === 2 || count($parts) === 3) { </tr> <tr> <td style="padding-right: 10px; text-align: right;"><b>System:</b></td> - <td><?= $computer["os_info"]["distro"] ?> <?= $computer["os_info"]["release"] ?></td> + <td><?= $computer["os_info"]["distro"] ?> <?= $computer["os_info"]["release"] === "unknown" ? "" : $computer["os_info"]["release"] ?></td> </tr> <tr> <td style="padding-right: 10px; text-align: right;"><b>CPU architecture:</b></td> @@ -241,7 +249,7 @@ if (count($parts) === 2 || count($parts) === 3) { </tr> <tr> <td style="padding-right: 10px; text-align: right;"><b>Build number:</b></td> - <td><?= $computer["os_info"]["build"] ?></td> + <td><?= $computer["os_info"]["build"] === "rolling" ? "Rolling release" : $computer["os_info"]["build"] ?></td> </tr> <tr> <td style="padding-right: 10px; text-align: right;"><b>Serial number:</b></td> @@ -449,9 +457,8 @@ if (count($parts) === 2 || count($parts) === 3) { "LISTEN" => "Listening", "CLOSING" => "Terminating", "UNKNOWN" => "?", - "LAST_ACK", "FIN_WAIT2" => "Waiting", - "TIME_WAIT" => "Waiting", - "FIN_WAIT1" => "Closing", + "LAST_ACK", "FIN_WAIT2", "TIME_WAIT" => "Waiting", + "FIN_WAIT1", "CLOSE_WAIT" => "Closing", "SYN_RECV" => "Received", "SYN_SENT" => "Attempting", default => $connection["state"], @@ -598,7 +605,6 @@ if (count($parts) === 2 || count($parts) === 3) { } } - document.getElementById("title-bar-action-1").style.display = "none"; window.controlling = false; window.commandRunInterval = null; @@ -792,14 +798,10 @@ if (count($parts) === 2 || count($parts) === 3) { } function enableControl() { - document.getElementById("title-bar-action-1").style.display = "inline-block"; - document.getElementById("title-bar-action-0").style.display = "none"; window.controlling = true; } function disableControl() { - document.getElementById("title-bar-action-1").style.display = "none"; - document.getElementById("title-bar-action-0").style.display = "inline-block"; window.controlling = false; } </script> @@ -812,7 +814,13 @@ if (count($parts) === 2 || count($parts) === 3) { <ul class="list-group"> <?php foreach (array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/metadata"), function ($i) { return !str_starts_with($i, "."); - }) as $file): $computer = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/metadata/" . $file), true); $id = substr($file, 0, -5); $owner = explode("-", $id)[0]; ?> + }) as $file): $computer = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/metadata/" . $file), true); $id = substr($file, 0, -5); $owner = explode("-", $id)[0]; + + if (str_ends_with($computer["os"], "unknown")) { + $computer["os"] = trim(substr($computer["os"], 0, -7)); + } + + ?> <a href="/-/computers/<?= $id ?>" class="list-group-item list-group-item-action" style="display: grid; grid-template-columns: 100px 1fr; grid-column-gap: 10px;"> <div style="display: flex; align-items: center;"> <img style="width: 100px;" src="https://ponies.equestria.horse/api/data?f=computers/screens/<?= $id . "-" . $computer["screens"][0]["id"] ?>.jpg"> @@ -821,12 +829,16 @@ if (count($parts) === 2 || count($parts) === 3) { <div> <b><?= $computer["host"] ?></b> · <?= $computer["os"] ?><br> Owned by <?= $owner === "raindrops" ? "Raindrops System" : "Cloudburst System"; ?><br> - Last seen <?= timeAgo($computer["date"]) ?> + <?php if (timeAgo($computer["date"]) === "now"): ?>Online<?php else: ?>Offline since <?= timeAgo($computer["date"]) ?><?php endif; ?> </div> </div> </a> <?php endforeach; ?> </ul> + + <div id="page-content" style="margin-top: 10px;"> + <a href="https://static.equestria.horse/luna-cros.crx">Install Chrome OS extension</a> + </div> </div> <?php endif; ?> </div> @@ -881,4 +893,4 @@ if (count($parts) === 2 || count($parts) === 3) { } </style> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/footer.inc'; ?> diff --git a/pages/debug.inc b/pages/debug.inc index 1327af5..6d2b4c9 100644 --- a/pages/debug.inc +++ b/pages/debug.inc @@ -1,7 +1,7 @@ <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; function itemToName(string $item): string { global $lang; global $pages; @@ -114,4 +114,4 @@ function itemToName(string $item): string { } </style> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/footer.inc'; ?> diff --git a/pages/docs.inc b/pages/docs.inc index 2e43727..a94f92e 100644 --- a/pages/docs.inc +++ b/pages/docs.inc @@ -1,7 +1,7 @@ <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; global $_PROFILE; -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/random.inc"; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/random.inc"; $parts = explode("/", $_GET['_']); $select = $parts[2] ?? null; @@ -32,7 +32,7 @@ if ($select === "add") { } } -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; function showDocument($item) { ?> <div style="display: grid; grid-template-columns: 2fr repeat(3, 1fr);"> @@ -401,4 +401,4 @@ function showDocument($item) { ?> } </style> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/footer.inc'; ?> diff --git a/pages/edit-private.inc b/pages/edit-private.inc index 4d89b5c..f26c8c6 100644 --- a/pages/edit-private.inc +++ b/pages/edit-private.inc @@ -34,7 +34,7 @@ if ($member === null) { peh_error("System member not found", 404); } - require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/edit-private.inc'; + require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/fragments/edit-private.inc'; } exit;
\ No newline at end of file diff --git a/pages/edit.inc b/pages/edit.inc index e074087..28b8d88 100644 --- a/pages/edit.inc +++ b/pages/edit.inc @@ -19,7 +19,7 @@ if ($isLowerLoggedIn && $systemID !== $app["other"]["id"]) { } if ($member === null) { - require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/sysedit.inc'; + require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/fragments/sysedit.inc'; } else { $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $systemID . "/members.json"), true); $memberData = null; @@ -38,7 +38,7 @@ if ($member === null) { peh_error("System member not found", 404); } - require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/edit.inc'; + require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/fragments/edit.inc'; } exit;
\ No newline at end of file diff --git a/pages/emergency.inc b/pages/emergency.inc index 0d34251..244571b 100644 --- a/pages/emergency.inc +++ b/pages/emergency.inc @@ -1,15 +1,15 @@ <?php $emergencyHeader = true; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; ?> <br> <div class="container"> <div id="page-content"> - <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/emergency.inc"; ?> + <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/components/emergency.inc"; ?> </div> </div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/footer.inc'; ?> diff --git a/pages/fronting.inc b/pages/fronting.inc index a2b5cb0..6cd464b 100644 --- a/pages/fronting.inc +++ b/pages/fronting.inc @@ -1,15 +1,15 @@ <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; ?> <br> <div class="container"> <div> - <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/planner.inc"; ?> + <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/components/planner.inc"; ?> </div> </div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/footer.inc'; ?> diff --git a/pages/games.inc b/pages/games.inc index 4df95f1..ca881e4 100644 --- a/pages/games.inc +++ b/pages/games.inc @@ -1,7 +1,7 @@ <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; global $app; -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; ?> @@ -80,4 +80,4 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; </ul> </div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/footer.inc'; ?> diff --git a/pages/home.inc b/pages/home.inc index 82ff3d5..86bf513 100644 --- a/pages/home.inc +++ b/pages/home.inc @@ -4,7 +4,7 @@ if (isset($_GET["ec"])) { header("HTTP/1.1 " . $_GET["ec"] . " Error"); } -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; global $readOnly; global $isNormallyLoggedIn; global $_PROFILE; global $lang; global $pages; global $isLowerLoggedIn; global $app; global $isLoggedIn; ?> +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; global $readOnly; global $isNormallyLoggedIn; global $_PROFILE; global $lang; global $pages; global $isLowerLoggedIn; global $app; global $isLoggedIn; ?> <br> <div class="container"> @@ -21,7 +21,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; require_once $_SE </div> <?php endif; ?> - <?php global $travelling; $byColor = getMembersByColor($_SERVER['HTTP_HOST'] === "fr.equestria.horse"); ?> + <?php global $travelling; $byColor = getMembersByColor(); ?> <div style="text-align: center;"> <img alt="" src="/assets/logo/newlogo<?= $isLoggedIn || $isLowerLoggedIn ? "3" : "" ?>.png" style="width:128px;"> <p style="z-index:999;position:relative;background:transparent;margin: 20px -10px 0 -20px;padding-right:30px;height:32px;text-align: center;display:grid;grid-template-columns: repeat(<?= count($byColor) ?>, 1fr);"> @@ -34,15 +34,11 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; require_once $_SE </div> <div style="padding:5px 10px;background:#3332328a;border-bottom-left-radius: 10px;border-bottom-right-radius: 10px;position:relative;z-index: 999;backdrop-filter: blur(30px);"> <h2 style="margin-top: 20px;">Cold Haze</h2> - <?php if ($_SERVER['HTTP_HOST'] === "fr.equestria.horse"): ?> - <p><?= count($byColor) ?> poneys dans une tête</p> - <?php else: ?> <?php if ($isLoggedIn || $isLowerLoggedIn): ?> <p><?= count($byColor) ?> ponies in 3 plural systems</p> <?php else: ?> <p><?= count($byColor) ?> <?= $lang["home"]["intro"] ?></p> <?php endif; ?> - <?php endif; ?> </div> </div> @@ -79,4 +75,4 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; require_once $_SE </div> </div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?>
\ No newline at end of file +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/footer.inc'; ?>
\ No newline at end of file diff --git a/pages/home.old.inc b/pages/home.old.inc index f918549..085af58 100644 --- a/pages/home.old.inc +++ b/pages/home.old.inc @@ -4,7 +4,7 @@ if (isset($_GET["ec"])) { header("HTTP/1.1 " . $_GET["ec"] . " Error"); } -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; global $readOnly; global $isNormallyLoggedIn; global $_PROFILE; global $lang; global $pages; global $isLowerLoggedIn; global $app; global $isLoggedIn; ?> +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; global $readOnly; global $isNormallyLoggedIn; global $_PROFILE; global $lang; global $pages; global $isLowerLoggedIn; global $app; global $isLoggedIn; ?> <br> <div class="container"> @@ -21,7 +21,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; require_once $_SE </div> <?php endif; ?> - <?php global $travelling; $byColor = getMembersByColor($_SERVER['HTTP_HOST'] === "fr.equestria.horse"); ?> + <?php global $travelling; $byColor = getMembersByColor(); ?> <div style="text-align: center;"> <img alt="" src="/assets/logo/newlogo<?= $isLoggedIn || $isLowerLoggedIn ? "3" : "" ?>.png" style="width:128px;"> <p style="z-index:999;position:relative;background:transparent;margin: 20px -10px 0 -20px;padding-right:30px;height:32px;text-align: center;display:grid;grid-template-columns: repeat(<?= count($byColor) ?>, 1fr);"> @@ -34,15 +34,11 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; require_once $_SE </div> <div style="padding:5px 10px;background:#3332328a;border-bottom-left-radius: 10px;border-bottom-right-radius: 10px;position:relative;z-index: 999;backdrop-filter: blur(30px);"> <h2 style="margin-top: 20px;">Cold Haze</h2> - <?php if ($_SERVER['HTTP_HOST'] === "fr.equestria.horse"): ?> - <p><?= count($byColor) ?> poneys dans une tête</p> - <?php else: ?> <?php if ($isLoggedIn || $isLowerLoggedIn): ?> <p><?= count($byColor) ?> ponies in 3 plural systems</p> <?php else: ?> <p><?= count($byColor) ?> <?= $lang["home"]["intro"] ?></p> <?php endif; ?> - <?php endif; ?> </div> </div> <hr style="border-color:rgba(255, 255, 255, .25);"> @@ -80,4 +76,4 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; require_once $_SE </div> </div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?>
\ No newline at end of file +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/footer.inc'; ?>
\ No newline at end of file diff --git a/pages/login.inc b/pages/login.inc index 8d71574..313be91 100644 --- a/pages/login.inc +++ b/pages/login.inc @@ -1,9 +1,25 @@ <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; global $readOnly; global $isNormallyLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; global $readOnly; global $isNormallyLoggedIn; +if (isset($_GET["return"])) { + setcookie("PEH2_RETURN_PAGE", $_GET["return"], 0, "/"); +} + + +if (isset($_GET["mini"])) { ?> +<style> + #navigation-pane, #title-bar, #footer, #titlebar-separator, #mobile-navigation, #global-search-container { + display: none !important; + } + + body { + margin-left: 0 !important; + } +</style> +<?php } ?> <br> <div class="container"> @@ -36,4 +52,4 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; global $readOnl </div> </div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/footer.inc'; ?> diff --git a/pages/metadata.inc b/pages/metadata.inc index 9faefef..768f548 100644 --- a/pages/metadata.inc +++ b/pages/metadata.inc @@ -1,8 +1,8 @@ <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLowerLoggedIn; global $isLoggedIn; global $lang; global $pages; global $app; -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.inc"; -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/bitset.inc"; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/bitset.inc"; if (!isset($_GET['_']) || trim($_GET['_']) === "") peh_error("Invalid request", 400); @@ -177,7 +177,7 @@ if ($member === null) { header("Location: /" . $_GET['_']); } else { - require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/metadata.inc'; + require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/fragments/metadata.inc'; } } diff --git a/pages/money.inc b/pages/money.inc index 257b87f..7571507 100644 --- a/pages/money.inc +++ b/pages/money.inc @@ -13,7 +13,7 @@ $accounts = array_map(function ($i) { return $data; }, array_values(array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/money"), function ($i) { return !str_starts_with($i, "."); }))); -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.inc"; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; function calculateFullAmount($account, $asNumber = false, $gbpOnly = false): string|float|int { global $rate; @@ -118,7 +118,7 @@ if ((isset($_GET["create"]) || isset($_GET["delete"])) && isset($parts[2])) { $rate = (float)trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/exchange.txt")); -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; ?> @@ -678,4 +678,4 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; <?php endif; ?> </div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/footer.inc'; ?> diff --git a/pages/page.inc b/pages/page.inc index d35dba8..8446062 100644 --- a/pages/page.inc +++ b/pages/page.inc @@ -49,8 +49,8 @@ $systemID = $system === "cloudburst" ? "ynmuc" : ($system === $app["other"]["slu if ($member === null) { global $_SystemName; $_SystemName = $system; - $pageFile = $_SERVER['DOCUMENT_ROOT'] . '/includes/system.inc'; - require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/system.inc'; + $pageFile = $_SERVER['DOCUMENT_ROOT'] . '/includes/fragments/system.inc'; + require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/fragments/system.inc'; } else if ($member === "-" && isset($parts[2])) { if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/includes/system/' . $parts[2] . '.inc')) { global $_SystemPage; @@ -112,8 +112,8 @@ if ($member === null) { global $_MemberName; $_MemberName = $member; - $pageFile = $_SERVER['DOCUMENT_ROOT'] . '/includes/member.inc'; - require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/member.inc'; + $pageFile = $_SERVER['DOCUMENT_ROOT'] . '/includes/fragments/member.inc'; + require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/fragments/member.inc'; } exit;
\ No newline at end of file diff --git a/pages/ponytown.inc b/pages/ponytown.inc index d055c9c..7ad38f7 100644 --- a/pages/ponytown.inc +++ b/pages/ponytown.inc @@ -23,7 +23,7 @@ if ($isLowerLoggedIn && $member["_system"] !== $app["other"]["id"]) { $title = ($member["display_name"] ?? $member["name"]) . " · " . $title; -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; $member = getMemberWithoutSystem($parts[2]); @@ -255,4 +255,4 @@ $member = getMemberWithoutSystem($parts[2]); </div> </div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?>
\ No newline at end of file +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/footer.inc'; ?>
\ No newline at end of file diff --git a/pages/profiles.inc b/pages/profiles.inc index dd6df4b..41e5222 100644 --- a/pages/profiles.inc +++ b/pages/profiles.inc @@ -1,8 +1,8 @@ <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; global $_PROFILE; global $isLowerLoggedIn; -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/profiles.inc'; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/util/profiles.inc'; ?> @@ -101,4 +101,4 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/profiles.inc'; </div> </div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/footer.inc'; ?> diff --git a/pages/relations.inc b/pages/relations.inc index b66ab25..7a05def 100644 --- a/pages/relations.inc +++ b/pages/relations.inc @@ -1,7 +1,7 @@ <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; ?> @@ -102,4 +102,4 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; </style> </div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/footer.inc'; ?> diff --git a/pages/rules.inc b/pages/rules.inc index ec007df..1238b7d 100644 --- a/pages/rules.inc +++ b/pages/rules.inc @@ -1,7 +1,7 @@ <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/Parsedown.php"; $Parsedown = new Parsedown(); +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/Parsedown.php"; $Parsedown = new Parsedown(); if (isset($_POST["updateRules"])) { header("Content-Type: text/plain"); @@ -35,7 +35,7 @@ if (isset($_POST["updateRules"])) { die(); } -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; ?> @@ -134,7 +134,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; <p><b <?= $index === 1 ? 'id="default-rule--number"' : '' ?>>Rule #<?= $index ?>:</b></p> <input <?= $index === 1 ? 'id="default-rule--name"' : '' ?> type="text" placeholder="Rule name" class="form-control" style="margin-bottom:15px;color:white;background:#111;border-color:#222;" name="payload[<?= $index - 1 ?>][name]" value="<?= str_replace('"', """, str_replace("<", "<", str_replace(">", ">", $rule["name"]))) ?>"> - <textarea <?= $index === 1 ? 'id="default-rule--content"' : '' ?> name="payload[<?= $index - 1 ?>][content]" rows="5" class="form-control" style="resize: none;color:white;background:#111;border-color:#222;" placeholder="Rule details"><?= str_replace("<", "<", str_replace(">", ">", $rule["content"] ?? "")) ?></textarea> + <textarea <?= $index === 1 ? 'id="default-rule--content"' : '' ?> name="payload[<?= $index - 1 ?>][content]" rows="10" class="form-control" style="resize: none;color:white;background:#111;border-color:#222;" placeholder="Rule details"><?= str_replace("<", "<", str_replace(">", ">", $rule["content"] ?? "")) ?></textarea> <label style="margin-top:10px;margin-left:5px;"> <input <?= $index === 1 ? 'id="default-rule--approval-1"' : '' ?> <?= ($rule["approved"][0] ?? false) ? "checked" : "" ?> type="checkbox" class="form-check-input" name="payload[<?= $index - 1 ?>][approved][0]"> @@ -273,4 +273,4 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; } </style> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/footer.inc'; ?> diff --git a/pages/splitting.inc b/pages/splitting.inc index 520b2c8..d1dccae 100644 --- a/pages/splitting.inc +++ b/pages/splitting.inc @@ -1,7 +1,7 @@ <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; ?> @@ -52,4 +52,4 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; </style> </div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/footer.inc'; ?> diff --git a/pages/stats.inc b/pages/stats.inc index 1b0fe31..de501bb 100644 --- a/pages/stats.inc +++ b/pages/stats.inc @@ -1,7 +1,7 @@ <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; $switchesRaindrops = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/switches.json"), true); $switchesCloudburst = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/switches.json"), true); @@ -489,4 +489,4 @@ $switchesCloudburst = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . </div> </div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/footer.inc'; ?> diff --git a/pages/terminology.inc b/pages/terminology.inc index d94eddc..77a19de 100644 --- a/pages/terminology.inc +++ b/pages/terminology.inc @@ -1,7 +1,7 @@ <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; ?> @@ -12,4 +12,4 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; </div> </div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?>
\ No newline at end of file +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/footer.inc'; ?>
\ No newline at end of file diff --git a/pages/travelling.inc b/pages/travelling.inc index e0fbfb1..fdcfa99 100644 --- a/pages/travelling.inc +++ b/pages/travelling.inc @@ -4,7 +4,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; gl $travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling/travelling.json"), true); $app = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true); -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.inc"; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; if (isset($_GET['toggleTravel']) && $isLoggedIn) { if (isset($travelling[$_GET['member']])) { @@ -102,7 +102,7 @@ if (isset($_GET['toggleTravel']) && $isLoggedIn) { die(); } -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; global $travelling; ?> @@ -203,4 +203,4 @@ global $travelling; </style> </div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/footer.inc'; ?> diff --git a/pages/wakeup.inc b/pages/wakeup.inc index 9df2c3e..43fa614 100644 --- a/pages/wakeup.inc +++ b/pages/wakeup.inc @@ -1,15 +1,15 @@ <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; -$emergencyHeader = true; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; +$emergencyHeader = true; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; ?> <br> <div class="container"> <div id="page-content"> - <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/wakeup.inc"; ?> + <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/components/wakeup.inc"; ?> </div> </div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/footer.inc'; ?> |