diff options
author | RaindropsSys <raindrops@equestria.dev> | 2024-01-13 16:12:11 +0100 |
---|---|---|
committer | RaindropsSys <raindrops@equestria.dev> | 2024-01-13 16:12:11 +0100 |
commit | 2b192b3840ac344c456b98304ea400f0af90da15 (patch) | |
tree | 081ba8cbc0add17f08c9b94fb4a830834d87c259 /pages | |
parent | 2bfdb0ab2e366007269d1b77446f1581801e05dc (diff) | |
download | pluralconnect-2b192b3840ac344c456b98304ea400f0af90da15.tar.gz pluralconnect-2b192b3840ac344c456b98304ea400f0af90da15.tar.bz2 pluralconnect-2b192b3840ac344c456b98304ea400f0af90da15.zip |
Updated 46 files and deleted 19 files (automated)
Diffstat (limited to 'pages')
36 files changed, 34 insertions, 1652 deletions
diff --git a/pages/alerts.inc b/pages/alerts.inc index 46d514d..a47c84f 100644 --- a/pages/alerts.inc +++ b/pages/alerts.inc @@ -1,8 +1,6 @@ <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; global $_PROFILE; global $isLowerLoggedIn; - -if ($_PROFILE["login"] === "cloudburst") die(); require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; ?> <br> diff --git a/pages/api/cloudburst-img-round.php b/pages/api/cloudburst-img-round.php deleted file mode 100644 index 3238696..0000000 --- a/pages/api/cloudburst-img-round.php +++ /dev/null @@ -1,18 +0,0 @@ -<?php - -$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"] ?? "/assets/uploads/cloudburst.png") : "/assets/uploads/cloudburst.png"; -file_put_contents("/tmp/temp", file_get_contents($url)); - -header("Content-Type: image/png"); - -$id = bin2hex(random_bytes(8)); -exec('convert -size 128x128 xc:none -draw "roundrectangle 0,0,128,128,128,128" /tmp/' . $id . '-mask.png', $out); - -exec('convert -resize 128x128 "/tmp/temp" /tmp/' . $id . '-source.png'); -exec('convert /tmp/' . $id . '-source.png -matte /tmp/' . $id . '-mask.png -compose DstIn -composite /tmp/' . $id . '.png', $out2); - -unlink("/tmp/temp"); - -echo(file_get_contents('/tmp/' . $id . '.png'));
\ No newline at end of file diff --git a/pages/api/cloudburst-img.php b/pages/api/cloudburst-img.php deleted file mode 100644 index 7d22aad..0000000 --- a/pages/api/cloudburst-img.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php - -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"; -file_put_contents("/tmp/temp", file_get_contents($url)); -header("Content-Type: " . mime_content_type("/tmp/temp")); -unlink("/tmp/temp"); - -echo(file_get_contents($url));
\ No newline at end of file diff --git a/pages/api/cloudburst-img2-round.php b/pages/api/cloudburst-img2-round.php deleted file mode 100644 index 5f4f0dc..0000000 --- a/pages/api/cloudburst-img2-round.php +++ /dev/null @@ -1,18 +0,0 @@ -<?php - -$fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/fronters.json"), true); - -$url = isset($fronters['members'][1]) ? ($fronters['members'][1]["avatar_url"] ?? "/assets/uploads/cloudburst.png") : "/assets/uploads/cloudburst.png"; -file_put_contents("/tmp/temp", file_get_contents($url)); - -header("Content-Type: image/png"); - -$id = bin2hex(random_bytes(8)); -exec('convert -size 128x128 xc:none -draw "roundrectangle 0,0,128,128,128,128" /tmp/' . $id . '-mask.png', $out); - -exec('convert -resize 128x128 "/tmp/temp" /tmp/' . $id . '-source.png'); -exec('convert /tmp/' . $id . '-source.png -matte /tmp/' . $id . '-mask.png -compose DstIn -composite /tmp/' . $id . '.png', $out2); - -unlink("/tmp/temp"); - -echo(file_get_contents('/tmp/' . $id . '.png'));
\ No newline at end of file diff --git a/pages/api/cloudburst-two.php b/pages/api/cloudburst-two.php deleted file mode 100644 index 8272d81..0000000 --- a/pages/api/cloudburst-two.php +++ /dev/null @@ -1,8 +0,0 @@ -<?php - -header("Content-Type: text/plain"); - -$fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/fronters.json"), true); -echo(json_encode([ - "multiple" => count($fronters["members"]) > 1 -]));
\ No newline at end of file diff --git a/pages/api/cloudburst.php b/pages/api/cloudburst.php deleted file mode 100644 index 2750a98..0000000 --- a/pages/api/cloudburst.php +++ /dev/null @@ -1,6 +0,0 @@ -<?php - -header("Content-Type: text/plain"); - -$fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/fronters.json"), true); -echo($fronters['members'][0]['display_name'] ?? $fronters['members'][0]['name']);
\ No newline at end of file diff --git a/pages/api/emergency-real.php b/pages/api/emergency-real.php index 700a6a7..04fd56e 100644 --- a/pages/api/emergency-real.php +++ b/pages/api/emergency-real.php @@ -1,7 +1,6 @@ <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $isLowerLoggedIn; global $_PROFILE; -if ($_PROFILE["login"] === "cloudburst") die(); if (!$isLoggedIn && !$isLowerLoggedIn) { header("Location: /-/login"); @@ -15,6 +14,7 @@ $channels = []; if (isset($_GET["raindrops"])) $channels[] = "emergency-raindrops"; if (isset($_GET["moonglow"])) $channels[] = "emergency-moonglow"; +if (isset($_GET["hailstorm"])) $channels[] = "emergency-hailstorm"; if (isset($_GET[$GLOBALS["ColdHazeApp"]["other"]["slug"]])) $channels[] = "emergency"; $context = stream_context_create([ diff --git a/pages/api/emergency.php b/pages/api/emergency.php index a8a6e20..e682598 100644 --- a/pages/api/emergency.php +++ b/pages/api/emergency.php @@ -1,7 +1,6 @@ <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $isLowerLoggedIn; global $_PROFILE; -if ($_PROFILE["login"] === "cloudburst") die(); if (!$isLoggedIn && !$isLowerLoggedIn) { header("Location: /-/login"); @@ -15,6 +14,7 @@ $channels = []; if (isset($_GET["raindrops"])) $channels[] = "emergency-raindrops"; if (isset($_GET["moonglow"])) $channels[] = "emergency-moonglow"; +if (isset($_GET["hailstorm"])) $channels[] = "emergency-hailstorm"; if (isset($_GET[$GLOBALS["ColdHazeApp"]["other"]["slug"]])) $channels[] = "emergency"; $context = stream_context_create([ diff --git a/pages/api/me.php b/pages/api/me.php index 5b13208..0e91189 100644 --- a/pages/api/me.php +++ b/pages/api/me.php @@ -18,13 +18,13 @@ if ($_PROFILE['login'] === "raindrops") { "avatar" => getAsset("gdapd"), "email" => $_PROFILE["profile"]["email"]["email"] ])); -} else if ($_PROFILE["login"] === "cloudburst") { +} else if ($_PROFILE["login"] === "Moonglow") { die(json_encode([ "valid" => true, - "name" => "Cloudburst System", - "id" => "cloudburst", - "pluralkit" => "ynmuc", - "avatar" => getAsset("ynmuc"), + "name" => "Moonglow", + "id" => "moonglow", + "pluralkit" => "hrbom", + "avatar" => getAsset("hrbom"), "email" => $_PROFILE["profile"]["email"]["email"] ])); } else { diff --git a/pages/api/money/account.php b/pages/api/money/account.php deleted file mode 100644 index 1801b28..0000000 --- a/pages/api/money/account.php +++ /dev/null @@ -1,62 +0,0 @@ -<?php - -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $_PROFILE; -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; -if (!$isLoggedIn) header("Location: /-/login") and die(); -header("Content-Type: application/json"); - -$accounts = array_map(function ($i) { - $name = substr($i, 0, -5); - $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/money/" . $i), true); - $data["_name"] = $name; - return $data; -}, array_values(array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/money"), function ($i) { return !str_starts_with($i, "."); }))); -$rate = (float)trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/exchange.txt")); -$obj = []; - -if (!isset($_GET["id"])) { - die(json_encode($obj, JSON_PRETTY_PRINT)); -} - -foreach ($accounts as $account) { - if ($account["_name"] === $_GET["id"]) { - $acc = []; - - $acc["id"] = $account["_name"]; - $acc["name"] = $account["name"]; - $acc["currency"] = $account["currency"]; - $acc["default"] = $account["default"]; - $acc["total"] = round(calculateFullAmount($account, true), 2); - $acc["interests"] = $account["interests"]; - $acc["max"] = $account["max"]; - $acc["used_percentage"] = isset($account["max"]) ? round((calculateFullAmount($account, true) / $account["max"]) * 100, 2) : null; - $acc["transactions"] = []; - - foreach ($account["transactions"] as $index => $transaction) { - $member = getMemberWithoutSystem($transaction["author"]) ?? getMemberWithoutSystem("zdtsg"); - $trans = [ - "id" => $index, - "author" => [ - "avatar" => getAsset($member["_system"], $member["id"]), - "name" => $member["display_name"] ?? $member["name"] - ], - "type" => $transaction["amount"] < 0 ? "REMOVE" : "ADD", - "amount" => round(abs($transaction["amount"]), 2), - "date" => [ - "ts" => strtotime($transaction["date"]), - "iso" => date('c', strtotime($transaction["date"])), - "relative" => timeAgo($transaction["date"]) - ], - "description" => (isset($transaction["description"]) && trim($transaction["description"]) !== "") ? trim($transaction["description"]) : null - ]; - - $acc["transactions"][] = $trans; - } - - $obj = $acc; - } -} - -/* ------------------- */ - -die(json_encode($obj, JSON_PRETTY_PRINT));
\ No newline at end of file diff --git a/pages/api/money/accounts.php b/pages/api/money/accounts.php deleted file mode 100644 index 9f85323..0000000 --- a/pages/api/money/accounts.php +++ /dev/null @@ -1,96 +0,0 @@ -<?php - -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $_PROFILE; -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; -if (!$isLoggedIn) header("Location: /-/login") and die(); -header("Content-Type: application/json"); - -$accounts = array_map(function ($i) { - $name = substr($i, 0, -5); - $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/money/" . $i), true); - $data["_name"] = $name; - return $data; -}, array_values(array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/money"), function ($i) { return !str_starts_with($i, "."); }))); -$rate = (float)trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/exchange.txt")); -$obj = [ - "total" => 0, - "exchange_rate" => $rate, - "users" => [ - "cloudburst" => [ - "total" => 0, - "accounts" => [] - ], - "raindrops" => [ - "total" => 0, - "accounts" => [] - ] - ] -]; - -$allAccounts = array_reduce(array_map(function ($i) { - return calculateFullAmount($i, true, true); -}, $accounts), function ($a, $b) { - return $a + $b; -}); -$obj["total"] = [ - "gbp" => round($allAccounts, 2), - "eur" => round($allAccounts * (1 / $rate), 2) -]; - -/* ------------------- */ - -$allAccounts = array_reduce(array_map(function ($i) { - return calculateFullAmount($i, true, true); -}, array_values(array_filter($accounts, function ($i) { return $i["owner"] === "cloudburst"; }))), function ($a, $b) { - return $a + $b; -}); - -$obj["users"]["cloudburst"]["total"] = $allAccounts; - -foreach ($accounts as $index => $account) { - if ($account["owner"] === "cloudburst") { - $acc = []; - - $acc["id"] = $account["_name"]; - $acc["name"] = $account["name"]; - $acc["currency"] = $account["currency"]; - $acc["default"] = $account["default"]; - $acc["total"] = round(calculateFullAmount($account, true), 2); - $acc["interests"] = $account["interests"]; - $acc["max"] = $account["max"]; - $acc["used_percentage"] = isset($account["max"]) ? round((calculateFullAmount($account, true) / $account["max"]) * 100, 2) : null; - - $obj["users"]["cloudburst"]["accounts"][] = $acc; - } -} -/* ------------------- */ - -$allAccounts = array_reduce(array_map(function ($i) { - return calculateFullAmount($i, true, true); -}, array_values(array_filter($accounts, function ($i) { return $i["owner"] === "raindrops"; }))), function ($a, $b) { - return $a + $b; -}); - -$obj["users"]["raindrops"]["total"] = $allAccounts; - -foreach ($accounts as $index => $account) { - if ($account["owner"] === "raindrops") { - $acc = []; - - $acc["id"] = $account["_name"]; - $acc["name"] = $account["name"]; - $acc["currency"] = $account["currency"]; - $acc["default"] = $account["default"]; - $acc["total"] = round(calculateFullAmount($account, true), 2); - $acc["interests"] = $account["interests"]; - $acc["max"] = $account["max"]; - $acc["used_percentage"] = isset($account["max"]) ? round((calculateFullAmount($account, true) / $account["max"]) * 100, 2) : null; - $acc["transactions"] = null; - - $obj["users"]["raindrops"]["accounts"][] = $acc; - } -} - -/* ------------------- */ - -die(json_encode($obj, JSON_PRETTY_PRINT));
\ No newline at end of file diff --git a/pages/api/money/create.php b/pages/api/money/create.php deleted file mode 100644 index 12cc7c9..0000000 --- a/pages/api/money/create.php +++ /dev/null @@ -1,99 +0,0 @@ -<?php - -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $_PROFILE; -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; -$app = $GLOBALS["ColdHazeApp"] = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true); -if (!$isLoggedIn) header("Location: /-/login") and die(); -header("Content-Type: application/json"); - -$request_raw = file_get_contents('php://input'); -$json_object = $data = json_decode($request_raw, true); - -$systemID = $_PROFILE["login"] === "cloudburst" ? "ynmuc" : "gdapd"; -$fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($_PROFILE["login"] === "cloudburst" ? "ynmuc" : "gdapd") . "/fronters.json"), true)["members"]; - -if (count($fronters) > 0) { - $myId = $fronters[0]["id"]; -} else { - $myId = "zdtsg"; -} - -$accounts = array_map(function ($i) { - $name = substr($i, 0, -5); - $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/money/" . $i), true); - $data["_name"] = $name; - return $data; -}, array_values(array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/money"), function ($i) { return !str_starts_with($i, "."); }))); -$rate = (float)trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/exchange.txt")); - -$obj = [ - "success" => false, - "error" => null -]; - -if ($_SERVER["REQUEST_METHOD"] !== "POST") { - $obj["success"] = false; - $obj["error"] = "INVALID_METHOD"; - die(json_encode($obj, JSON_PRETTY_PRINT)); -} - -if (!isset($data["amount"]) || !isset($data["id"]) || !isset($data["description"])) { - $obj["success"] = false; - $obj["error"] = "MISSING_OPERAND"; - die(json_encode($obj, JSON_PRETTY_PRINT)); -} - -$account = array_values(array_filter($accounts, function ($i) use ($data) { return $i["_name"] === $data["id"]; }))[0] ?? null; - -if (!isset($account)) { - $obj["success"] = false; - $obj["error"] = "ACCOUNT_NOT_FOUND"; - die(json_encode($obj, JSON_PRETTY_PRINT)); -} - -if (!(isset($data["amount"]) && is_numeric($data["amount"]) && (float)$data["amount"] < 9999 && (float)$data["amount"] > -9999)) { - $obj["success"] = false; - $obj["error"] = "INVALID_AMOUNT"; - die(json_encode($obj, JSON_PRETTY_PRINT)); -} -if (!isset($data["description"])) $data["description"] = ""; - -if (strlen($data["description"]) > 150) { - $obj["success"] = false; - $obj["error"] = "DESCRIPTION_TOO_LONG"; - die(json_encode($obj, JSON_PRETTY_PRINT)); -} - -if ($data["amount"] === 0) { - $obj["success"] = false; - $obj["error"] = "AMOUNT_IS_ZERO"; - die(json_encode($obj, JSON_PRETTY_PRINT)); -} - -$ntfy = $GLOBALS["ColdHazeApp"]["ntfy"]; -file_get_contents('https://' . $ntfy["server"] . '/' . $ntfy["topic"], false, stream_context_create([ - 'http' => [ - 'method' => 'POST', - 'header' => - "Content-Type: text/plain\r\n" . - "Title: " . formatPonypush((getMember($myId)["display_name"] ?? getMember($myId)["name"]) . " created a transaction to " . $account["name"] . " (" . ucfirst($account["owner"]) . ")") . "\r\n" . - "Tags: bits\r\n" . - "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => formatPonypush(($account["currency"] === "gbp" ? "£" : "€") . abs((float)$data["amount"]) . " were " . ((float)$data["amount"] >= 0 ? "added" : "removed") . " just now" . (trim($data["description"]) !== "" ? ": " . $data["description"] : "")) - ] -])); - -array_unshift($account["transactions"], [ - "author" => $myId, - "description" => $data["description"], - "amount" => (float)$data["amount"], - "date" => date('c') -]); - -$name = $account["_name"]; -unset($account["_name"]); - -file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/money/" . $name . ".json", json_encode($account, JSON_PRETTY_PRINT)); - -$obj["success"] = true; -die(json_encode($obj, JSON_PRETTY_PRINT));
\ No newline at end of file diff --git a/pages/api/pleasure-real.php b/pages/api/pleasure-real.php index adfe732..c1cbd59 100644 --- a/pages/api/pleasure-real.php +++ b/pages/api/pleasure-real.php @@ -1,7 +1,6 @@ <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $isLowerLoggedIn; global $_PROFILE; -if ($_PROFILE["login"] === "cloudburst") die(); if (!$isLoggedIn && !$isLowerLoggedIn) { header("Location: /-/login"); @@ -16,9 +15,9 @@ $frontMoonglow = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/inc if ($_PROFILE["login"] === "raindrops" && isset($frontRaindrops[0])) { $pony = $frontRaindrops[0]["display_name"] ?? $frontRaindrops[0]["name"]; -} else if ($_PROFILE["login"] === "Moonwind" && isset($frontMoonglow[0])) { +} else if ($_PROFILE["login"] === "Moonglow" && isset($frontMoonglow[0])) { $pony = $frontMoonglow[0]["display_name"] ?? $frontMoonglow[0]["name"]; -} else if ($_PROFILE["login"] !== "raindrops" && $_PROFILE["login"] !== "Moonwind" && isset($frontOther[0])) { +} else if ($_PROFILE["login"] !== "raindrops" && $_PROFILE["login"] !== "Moonglow" && isset($frontOther[0])) { $pony = $frontOther[0]["display_name"] ?? $frontOther[0]["name"]; } else { $pony = "somepony"; diff --git a/pages/api/pleasure.php b/pages/api/pleasure.php index 7d331ce..7b268cb 100644 --- a/pages/api/pleasure.php +++ b/pages/api/pleasure.php @@ -1,7 +1,6 @@ <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $isLowerLoggedIn; global $_PROFILE; -if ($_PROFILE["login"] === "cloudburst") die(); if (!$isLoggedIn && !$isLowerLoggedIn) { header("Location: /-/login"); @@ -16,9 +15,9 @@ $frontMoonglow = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/inc if ($_PROFILE["login"] === "raindrops" && isset($frontRaindrops[0])) { $pony = $frontRaindrops[0]["display_name"] ?? $frontRaindrops[0]["name"]; -} else if ($_PROFILE["login"] === "Moonwind" && isset($frontMoonglow[0])) { +} else if ($_PROFILE["login"] === "Moonglow" && isset($frontMoonglow[0])) { $pony = $frontMoonglow[0]["display_name"] ?? $frontMoonglow[0]["name"]; -} else if ($_PROFILE["login"] !== "raindrops" && $_PROFILE["login"] !== "Moonwind" && isset($frontOther[0])) { +} else if ($_PROFILE["login"] !== "raindrops" && $_PROFILE["login"] !== "Moonglow" && isset($frontOther[0])) { $pony = $frontOther[0]["display_name"] ?? $frontOther[0]["name"]; } else { $pony = "somepony"; diff --git a/pages/api/pluralkit-integration.php b/pages/api/pluralkit-integration.php index 7d7c641..a3faa6f 100644 --- a/pages/api/pluralkit-integration.php +++ b/pages/api/pluralkit-integration.php @@ -23,9 +23,6 @@ if ($input["signing_token"] !== $data[$user]) { if ($input['system_id'] === "7d9f543e-f742-40f6-9d07-86c3f2983124") { $system = "gdapd"; $name = "Raindrops System"; -} elseif ($input['system_id'] === "ade46823-206b-4b0c-ad3c-caae934a5f3b") { - $system = "ynmuc"; - $name = "Cloudburst System"; } elseif ($input['system_id'] === "d1cd97eb-9c92-4e42-94cd-4397a5074ff9") { $system = "hrbom"; $name = "Moonglow"; diff --git a/pages/api/raindrops-img-round.php b/pages/api/raindrops-img-round.php deleted file mode 100644 index 5e80bd0..0000000 --- a/pages/api/raindrops-img-round.php +++ /dev/null @@ -1,18 +0,0 @@ -<?php - -$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"] ?? "/assets/uploads/raindrops.png") : "/assets/uploads/raindrops.png"; -file_put_contents("/tmp/temp", file_get_contents($url)); - -header("Content-Type: image/png"); - -$id = bin2hex(random_bytes(8)); -exec('convert -size 128x128 xc:none -draw "roundrectangle 0,0,128,128,128,128" /tmp/' . $id . '-mask.png', $out); - -exec('convert -resize 128x128 "/tmp/temp" /tmp/' . $id . '-source.png'); -exec('convert /tmp/' . $id . '-source.png -matte /tmp/' . $id . '-mask.png -compose DstIn -composite /tmp/' . $id . '.png', $out2); - -unlink("/tmp/temp"); - -echo(file_get_contents('/tmp/' . $id . '.png'));
\ No newline at end of file diff --git a/pages/api/raindrops-img-round2.php b/pages/api/raindrops-img-round2.php deleted file mode 100644 index 2560ed0..0000000 --- a/pages/api/raindrops-img-round2.php +++ /dev/null @@ -1,20 +0,0 @@ -<?php - -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]) ? (getAsset("gdapd", $fronters["members"][0]["id"], "avatars") ?? "/assets/uploads/pt.png") : "/assets/uploads/pt.png"; -file_put_contents("/tmp/temp", file_get_contents($_SERVER['DOCUMENT_ROOT'] . $url)); - -header("Content-Type: image/png"); - -$id = bin2hex(random_bytes(8)); -exec('convert -size 256x128 xc:none -draw "roundrectangle 0,0,256,128,128,128" -chop 128x0 -resize 64x128\! /tmp/' . $id . '-mask.png', $out); -exec('convert /tmp/' . $id . '-mask.png -gravity West -background black -splice 64x0 -distort SRT 90 /tmp/' . $id . '-mask2.png', $out); - -exec('convert -resize 128x128 -filter Point -background transparent -gravity center -extent 128x128 "/tmp/temp" /tmp/' . $id . '-source.png'); -exec('convert /tmp/' . $id . '-source.png -matte /tmp/' . $id . '-mask2.png -compose DstIn -composite -gravity East /tmp/' . $id . '.png', $out2); - -unlink("/tmp/temp"); - -echo(file_get_contents('/tmp/' . $id . '.png'));
\ No newline at end of file diff --git a/pages/api/raindrops-img.php b/pages/api/raindrops-img.php deleted file mode 100644 index fcf1ae6..0000000 --- a/pages/api/raindrops-img.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php - -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"; -file_put_contents("/tmp/temp", file_get_contents($url)); -header("Content-Type: " . mime_content_type("/tmp/temp")); -unlink("/tmp/temp"); - -echo(file_get_contents($url));
\ No newline at end of file diff --git a/pages/api/raindrops-img2-round.php b/pages/api/raindrops-img2-round.php deleted file mode 100644 index 1b0d320..0000000 --- a/pages/api/raindrops-img2-round.php +++ /dev/null @@ -1,18 +0,0 @@ -<?php - -$fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/fronters.json"), true); - -$url = isset($fronters['members'][1]) ? ($fronters['members'][1]["avatar_url"] ?? "/assets/uploads/raindrops.png") : "/assets/uploads/raindrops.png"; -file_put_contents("/tmp/temp", file_get_contents($url)); - -header("Content-Type: image/png"); - -$id = bin2hex(random_bytes(8)); -exec('convert -size 128x128 xc:none -draw "roundrectangle 0,0,128,128,128,128" /tmp/' . $id . '-mask.png', $out); - -exec('convert -resize 128x128 "/tmp/temp" /tmp/' . $id . '-source.png'); -exec('convert /tmp/' . $id . '-source.png -matte /tmp/' . $id . '-mask.png -compose DstIn -composite /tmp/' . $id . '.png', $out2); - -unlink("/tmp/temp"); - -echo(file_get_contents('/tmp/' . $id . '.png'));
\ No newline at end of file diff --git a/pages/api/raindrops-img2-round2.php b/pages/api/raindrops-img2-round2.php deleted file mode 100644 index 5eb7e3f..0000000 --- a/pages/api/raindrops-img2-round2.php +++ /dev/null @@ -1,20 +0,0 @@ -<?php - -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'][1]) ? (getAsset("gdapd", $fronters["members"][1]["id"], "avatars") ?? "/assets/uploads/pt.png") : "/assets/uploads/pt.png"; -file_put_contents("/tmp/temp", file_get_contents($_SERVER['DOCUMENT_ROOT'] . $url)); - -header("Content-Type: image/png"); - -$id = bin2hex(random_bytes(8)); -exec('convert -size 256x128 xc:none -draw "roundrectangle 0,0,256,128,128,128" -chop 128x0 -resize 64x128\! /tmp/' . $id . '-mask.png', $out); -exec('convert /tmp/' . $id . '-mask.png -gravity West -background black -splice 64x0 -distort SRT 90 /tmp/' . $id . '-mask2.png', $out); - -exec('convert -resize 128x128 -filter Point -background transparent -gravity center -extent 128x128 "/tmp/temp" /tmp/' . $id . '-source.png'); -exec('convert /tmp/' . $id . '-source.png -matte /tmp/' . $id . '-mask2.png -compose DstIn -composite -gravity East /tmp/' . $id . '.png', $out2); - -unlink("/tmp/temp"); - -echo(file_get_contents('/tmp/' . $id . '.png'));
\ No newline at end of file diff --git a/pages/api/raindrops-two.php b/pages/api/raindrops-two.php deleted file mode 100644 index 2fa09f2..0000000 --- a/pages/api/raindrops-two.php +++ /dev/null @@ -1,8 +0,0 @@ -<?php - -header("Content-Type: text/plain"); - -$fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/fronters.json"), true); -echo(json_encode([ - "multiple" => count($fronters["members"]) > 1 -]));
\ No newline at end of file diff --git a/pages/api/raindrops.php b/pages/api/raindrops.php deleted file mode 100644 index c44faa6..0000000 --- a/pages/api/raindrops.php +++ /dev/null @@ -1,6 +0,0 @@ -<?php - -header("Content-Type: text/plain"); - -$fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/fronters.json"), true); -echo($fronters['members'][0]['display_name'] ?? $fronters['members'][0]['name']);
\ No newline at end of file diff --git a/pages/api/timeline.php b/pages/api/timeline.php index ccd19f9..8271b7a 100644 --- a/pages/api/timeline.php +++ b/pages/api/timeline.php @@ -5,7 +5,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $i $systems = array_filter(array_keys($_GET), function ($i) { global $isLowerLoggedIn; global $isLoggedIn; global $app; - return $i === "gdapd" || $i === "ynmuc" || $i === "hrbom" || (($isLowerLoggedIn || $isLoggedIn) && $i === $app["other"]["id"]); + return $i === "gdapd" || $i === "hrbom" || (($isLowerLoggedIn || $isLoggedIn) && $i === $app["other"]["id"]); }); require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/components/timeline.inc"; diff --git a/pages/api/wakeup-real.php b/pages/api/wakeup-real.php deleted file mode 100644 index f00d5ea..0000000 --- a/pages/api/wakeup-real.php +++ /dev/null @@ -1,33 +0,0 @@ -<?php - -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; - -if (!$isLoggedIn) { - header("Location: /-/login"); - die(); -} - -global $_PROFILE; - -$frontCloudburst = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/fronters.json"), true)["members"]; -$frontRaindrops = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/fronters.json"), true)["members"]; - -$pony = "somepony"; -if ($_PROFILE['login'] === "raindrops") $pony = $frontRaindrops[0]["display_name"]; else $pony = $frontCloudburst[0]["display_name"]; - -$ntfy = $GLOBALS["ColdHazeApp"]["ntfy"]; - -file_get_contents('https://' . $ntfy["server"] . '/' . $ntfy["topic"], false, stream_context_create([ - 'http' => [ - 'method' => 'POST', - 'header' => - "Content-Type: text/plain\r\n" . - "Title: " . formatPonypush("🥱 Wake up!") . "\r\n" . - "Priority: high\r\n" . - "Tags: wakeup\r\n" . - "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => formatPonypush("Hey, $pony wants you to wake up!") - ] -])); - -die();
\ No newline at end of file diff --git a/pages/api/wakeup.php b/pages/api/wakeup.php deleted file mode 100644 index a5d2b9f..0000000 --- a/pages/api/wakeup.php +++ /dev/null @@ -1,33 +0,0 @@ -<?php - -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; - -if (!$isLoggedIn) { - header("Location: /-/login"); - die(); -} - -global $_PROFILE; - -$frontCloudburst = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/fronters.json"), true)["members"]; -$frontRaindrops = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/fronters.json"), true)["members"]; - -$pony = "somepony"; -if ($_PROFILE['login'] === "raindrops") $pony = $frontRaindrops[0]["display_name"]; else $pony = $frontCloudburst[0]["display_name"]; - -$ntfy = $GLOBALS["ColdHazeApp"]["ntfy"]; - -file_get_contents('https://' . $ntfy["server"] . '/' . $ntfy["topic"], false, stream_context_create([ - 'http' => [ - 'method' => 'POST', - 'header' => - "Content-Type: text/plain\r\n" . - "Title: " . formatPonypush("[Test] 🥱 Wake up!") . "\r\n" . - "Priority: high\r\n" . - "Tags: wakeup\r\n" . - "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => formatPonypush("[This notification is test] Hey, $pony wants you to wake up! [This notification is test]") - ] -])); - -die();
\ No newline at end of file diff --git a/pages/byfront.inc b/pages/byfront.inc index beb9275..0974091 100644 --- a/pages/byfront.inc +++ b/pages/byfront.inc @@ -12,52 +12,13 @@ global $app; global $_PROFILE; <h2>Members by last fronted</h2> <select id="selected-system" class="form-select" style="margin-bottom: 20px;" onchange="refreshList()"> <option value="gdapd" <?= $_PROFILE["login"] === "raindrops" ? "select" : "" ?>>Raindrops System</option> - <option value="hrbom" <?= $_PROFILE["login"] === "Moonwind" ? "select" : "" ?>>Moonglow</option> - <option value="<?= $app["other"]["id"] ?>" <?= $_PROFILE["login"] !== "raindrops" && $_PROFILE["login"] !== "cloudburst" && $_PROFILE["login"] !== "Moonwind" ? "select" : "" ?>><?= $app["other"]["name"] ?></option> - <option value="ynmuc" <?= $_PROFILE["login"] === "cloudburst" ? "select" : "" ?>>Cloudburst System</option> + <option value="hrbom" <?= $_PROFILE["login"] === "Moonglow" ? "select" : "" ?>>Moonglow</option> + <option value="<?= $app["other"]["id"] ?>" <?= $_PROFILE["login"] === $app["other"]["user"] ? "select" : "" ?>><?= $app["other"]["name"] ?></option> <option value="">(all systems)</option> </select> <?php $members = [ ...array_map(function ($i) { - $system = "ynmuc"; - $i["_lastFronted"] = -1; - $id = $i["id"]; - $memberData = $i; - - $fronters = array_map(function ($item) { - return $item["id"]; - }, json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/fronters.json"), true)["members"]); - - if (in_array($id, $fronters)) { - $i["_lastFronted"] = time(); - } else { - $switches = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/switches.json"), true); - - $thisMember = array_filter($switches, function ($item) use ($memberData) { - return in_array($memberData["id"], $item["members"]); - }); - - $thisMember = array_values($thisMember); - $frontingEnd = null; - - if (count($thisMember) > 0) { - $thisIndex = array_search($thisMember[0], $switches); - - $frontingStart = $thisMember[0]; - $frontingEnd = $switches[$thisIndex - 1]; - } - - if ($frontingEnd !== null && isset($frontingStart)) { - $i["_lastFronted"] = strtotime($frontingEnd["timestamp"]); - } - } - - return $i; - }, array_values(array_filter(scoreOrderGlobal(), function ($i) { - return $i["_system"] === "ynmuc"; - }))), - ...array_map(function ($i) { $system = "gdapd"; $i["_lastFronted"] = -1; $id = $i["id"]; diff --git a/pages/emergency.inc b/pages/emergency.inc index e51b410..d57269a 100644 --- a/pages/emergency.inc +++ b/pages/emergency.inc @@ -1,8 +1,6 @@ <?php $emergencyHeader = true; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; global $_PROFILE; - -if ($_PROFILE["login"] === "cloudburst") die(); require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; ?> diff --git a/pages/front.inc b/pages/front.inc index 73f193c..ad38a14 100644 --- a/pages/front.inc +++ b/pages/front.inc @@ -3,8 +3,8 @@ $parts = explode("/", $_GET["_"]); if (isset($parts[2])) { - if ($parts[2] === "cloudburst") { - $fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/fronters.json"), true); + if ($parts[2] === "moonglow") { + $fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/hrbom/fronters.json"), true); } elseif ($parts[2] === "raindrops") { $fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/fronters.json"), true); } else { @@ -16,8 +16,8 @@ if (isset($parts[2])) { header("Location: /" . $fronters["members"][0]["name"]); die(); } else { - if ($parts[2] === "cloudburst") { - header("Location: /cloudburst"); + if ($parts[2] === "moonglow") { + header("Location: /moonglow"); } else { header("Location: /raindrops"); } diff --git a/pages/metadata.inc b/pages/metadata.inc index 0c02398..53d5c05 100644 --- a/pages/metadata.inc +++ b/pages/metadata.inc @@ -11,9 +11,9 @@ array_shift($parts); $system = $parts[0]; $member = !isset($parts[1]) || $parts[1] === "" ? null : $parts[1]; -if ($system !== "cloudburst" && $system !== "raindrops" && $system !== "moonglow" && $system !== $app["other"]["slug"]) peh_error("Invalid system name: " . $system, 400); -$systemCommonName = $system === "cloudburst" ? "Cloudburst System" : ($system === $app["other"]["slug"] && ($isLoggedIn || $isLowerLoggedIn) ? $app["other"]["name"] : ($system === "moonglow" ? "Moonglow" : "Raindrops System")); -$systemID = $system === "cloudburst" ? "ynmuc" : ($system === $app["other"]["slug"] && ($isLoggedIn || $isLowerLoggedIn) ? $app["other"]["id"] : ($system === "moonglow" ? "hrbom" : "gdapd")); +if ($system !== "raindrops" && $system !== "moonglow" && $system !== $app["other"]["slug"]) peh_error("Invalid system name: " . $system, 400); +$systemCommonName = $system === $app["other"]["slug"] && ($isLoggedIn || $isLowerLoggedIn) ? $app["other"]["name"] : ($system === "moonglow" ? "Moonglow" : "Raindrops System"); +$systemID = $system === $app["other"]["slug"] && ($isLoggedIn || $isLowerLoggedIn) ? $app["other"]["id"] : ($system === "moonglow" ? "hrbom" : "gdapd"); if ($isLowerLoggedIn && $systemID !== $app["other"]["id"] && $systemID !== "hrbom") { header("Location: /"); @@ -94,7 +94,7 @@ if ($member === null) { $toUpdate["gender"] = strip_tags($_GET["gender"]); } - $regex = "/^(ynmuc|gdapd|" . $app["other"]["id"] . ")\/[a-z]{5}$/m"; + $regex = "/^(hrbom|gdapd|" . $app["other"]["id"] . ")\/[a-z]{5}$/m"; if (isset($_GET["marefriends"])) { $toUpdate["marefriends"] = array_values(array_filter(array_map(function ($i) { return trim($i); }, explode(",", $_GET["marefriends"])), function ($i) use ($regex) { diff --git a/pages/money.inc b/pages/money.inc deleted file mode 100644 index 881c618..0000000 --- a/pages/money.inc +++ /dev/null @@ -1,822 +0,0 @@ -<?php - -$minimumRaindrops = 100; -//$minimumCloudburst = 2762.89; -//$minimumCloudburst = 700; -$minimumCloudburst = 0; - -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; global $_PROFILE; -$parts = explode("/", $_GET["_"]); - -$accounts = array_map(function ($i) { - $name = substr($i, 0, -5); - $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/money/" . $i), true); - $data["_name"] = $name; - 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/util/functions.inc"; - -global $parts; -if (isset($parts[2])) { - if (str_contains($parts[2], "/") || !file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/money/" . $parts[2] . ".json")) { - header("Location: /-/money"); - die(); - } -} - -$systemID = $_PROFILE["login"] === "cloudburst" ? "ynmuc" : "gdapd"; -$fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($_PROFILE["login"] === "cloudburst" ? "ynmuc" : "gdapd") . "/fronters.json"), true)["members"]; - -if (!isset($parts[2])) { - unset($systemID); -} else { - $systemID = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/money/" . $parts[2] . ".json"), true)["owner"] === "cloudburst" ? "ynmuc" : "gdapd"; -} - -if (count($fronters) > 0) { - $myId = $fronters[0]["id"]; -} else { - $myId = "zdtsg"; -} - -if ((isset($_GET["create"]) || isset($_GET["delete"])) && isset($parts[2])) { - $account = array_values(array_filter($accounts, function ($i) use ($parts) { return $i["_name"] === $parts[2]; }))[0]; - - header("Content-Type: text/plain"); - - if (isset($_GET["create"])) { - if (!(isset($_GET["amount"]) && is_numeric($_GET["amount"]) && (float)$_GET["amount"] < 9999 && (float)$_GET["amount"] > -9999)) { - header("Location: /-/money/" . $parts[2]); - die(); - } - if (!isset($_GET["description"])) $_GET["description"] = ""; - $_GET["description"] = substr($_GET["description"], 0, 150); - - $ntfy = $GLOBALS["ColdHazeApp"]["ntfy"]; - file_get_contents('https://' . $ntfy["server"] . '/' . $ntfy["topic"], false, stream_context_create([ - 'http' => [ - 'method' => 'POST', - 'header' => - "Content-Type: text/plain\r\n" . - "Title: " . formatPonypush((getMember($myId)["display_name"] ?? getMember($myId)["name"]) . " created a transaction to " . $account["name"] . " (" . ucfirst($account["owner"]) . ")") . "\r\n" . - "Tags: bits\r\n" . - "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => formatPonypush(($account["currency"] === "gbp" ? "£" : "€") . abs((float)$_GET["amount"]) . " were " . ((float)$_GET["amount"] >= 0 ? "added" : "removed") . " just now" . (trim($_GET["description"]) !== "" ? ": " . $_GET["description"] : "")) - ] - ])); - - if ((float)$_GET["amount"] !== 0.0) array_unshift($account["transactions"], [ - "author" => $myId, - "description" => $_GET["description"], - "amount" => (float)$_GET["amount"], - "date" => date('c') - ]); - - $name = $account["_name"]; - unset($account["_name"]); - - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/money/" . $name . ".json", json_encode($account, JSON_PRETTY_PRINT)); - } else { - if (isset($_GET["id"]) && is_numeric($_GET["id"]) && isset($account["transactions"][(int)$_GET["id"]])) { - $ntfy = $GLOBALS["ColdHazeApp"]["ntfy"]; - file_get_contents('https://' . $ntfy["server"] . '/' . $ntfy["topic"], false, stream_context_create([ - 'http' => [ - 'method' => 'POST', - 'header' => - "Content-Type: text/plain\r\n" . - "Title: " . formatPonypush((getMember($myId)["display_name"] ?? getMember($myId)["name"]) . " deleted a transaction from " . $account["name"] . " (" . ucfirst($account["owner"]) . ")") . "\r\n" . - "Tags: bits\r\n" . - "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => formatPonypush(($account["currency"] === "gbp" ? "£" : "€") . abs((float)$account["transactions"][(int)$_GET["id"]]["amount"]) . " " . ((float)$account["transactions"][(int)$_GET["id"]]["amount"] >= 0 ? "advance" : "withdrawal") . " created by " . (getMemberWithoutSystem($account["transactions"][(int)$_GET["id"]]["author"])["display_name"] ?? getMemberWithoutSystem($account["transactions"][(int)$_GET["id"]]["author"])["name"]) . " " . timeAgo($account["transactions"][(int)$_GET["id"]]["date"])) - ] - ])); - - unset($account["transactions"][(int)$_GET["id"]]); - - $name = $account["_name"]; - unset($account["_name"]); - - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/money/" . $name . ".json", json_encode($account, JSON_PRETTY_PRINT)); - } - } - - header("Location: /-/money/" . $parts[2]); - die(); -} - -$rate = (float)trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/exchange.txt")); - -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; -$transactionMonths = []; - -foreach ($accounts as $account) { - array_push($transactionMonths, ...array_map(function ($i) { return date('Y-m', strtotime($i["date"])); }, array_filter($account["transactions"], function ($i) { return !isset($i["initial"]) || !$i["initial"]; }))); -} - -$months = [ - ...[ - "2022-12", "2022-11", "2022-10", "2022-09", - "2022-08", "2022-07", "2022-06" - ], - ...array_values(array_filter(array_unique(array_reduce($transactionMonths, function ($a, $b) { - return [...$a, $b]; - }, [])), function ($i) { - return $i !== date('Y-m'); - })) -]; - -$monthlyCloudburst = []; -$monthlyRaindrops = []; - -$bits = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/bits.json"), true); -$projects = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/projects.json"), true); - -foreach ($bits["cloudburst"] as $month => $value) { - $monthlyCloudburst[$month] = $value; -} - -foreach ($bits["raindrops"] as $month => $value) { - $monthlyRaindrops[$month] = $value; -} - -foreach ($months as $month) { - $gainedCloudburst = $monthlyCloudburst[$month] ?? 0; - $gainedRaindrops = $monthlyRaindrops[$month] ?? 0; - - foreach ($accounts as $account) { - foreach ($account["transactions"] as $transaction) { - if (isset($transaction["initial"]) && $transaction["initial"]) continue; - if (date('Y-m', strtotime($transaction["date"])) !== $month) continue; - - if ($account["owner"] === "raindrops") { - $gainedRaindrops += $transaction["amount"]; - } else { - $gainedCloudburst += $transaction["amount"]; - } - } - } - - $monthlyCloudburst[$month] = $gainedCloudburst; - $monthlyRaindrops[$month] = $gainedRaindrops; -} - -uksort($monthlyCloudburst, function ($k1, $k2) { - return strtotime($k2) - strtotime($k1); -}); - -uksort($monthlyRaindrops, function ($k1, $k2) { - return strtotime($k2) - strtotime($k1); -}); - -function getMonthlyEarnings(): array { - global $monthlyRaindrops; - global $monthlyCloudburst; - - return [ - "cloudburst" => array_sum(array_values($monthlyCloudburst)) / count($monthlyCloudburst), - "raindrops" => array_sum(array_values($monthlyRaindrops)) / count($monthlyRaindrops) - ]; -} - -?> - -<script src="/assets/editor/chart.js"></script> - -<style> - a:hover > .card { - opacity: .75; - } - - a:active > .card, a:focus > .card { - opacity: .5; - } - - <?php global $use2023UI; if (!$use2023UI): ?> - .list-group-item { - color: #fff; - background-color: #222; - border: 1px solid rgba(255, 255, 255, .125); - } - - .list-group-item.disabled { - color: #fff; - background-color: #222; - border-color: rgba(255, 255, 255, .125); - opacity: .75; - } - - .list-group-item-action:hover { - background-color: #252525; - color: #ddd; - } - - .list-group-item-action:active, .list-group-item-action:focus { - background-color: #272727; - color: #bbb; - } - - .modal-header { - border-bottom: 1px solid #353738; - } - - .modal-content { - border: 1px solid rgba(255, 255, 255, .2); - background-color: #111; - } - <?php endif; ?> - - .btn-close { - filter: invert(1); - } - - .text-danger, .text-success { - filter: invert(1) brightness(150%) hue-rotate(180deg); - } -</style> - -<br> -<div class="container"> - <?php if (count($parts) < 3): ?> - <div> - <h2>Money tracker</h2> - - <div class="alert alert-danger"> - <b>The Ponycule money tracker is deprecated and will be removed.</b> Data currently in the money tracker will be moved to individual accounts on a dedicated money tracking application that Equestria.dev will not have control over. - </div> - - <hr> - - <?php - - $allAccounts = array_reduce(array_map(function ($i) { - return calculateFullAmount($i, true, true); - }, $accounts), function ($a, $b) { - return $a + $b; - }); - - ?> - <h2>£<?= number_format($allAccounts, 2, '.', ',') ?> · €<?= number_format($allAccounts * (1 / $rate), 2, '.', ',') ?></h2> - <p>As of <?= date('j F Y') ?> · €1.00 = £<?= number_format($rate, 2, '.', ',') ?></p> - - <canvas id="history" style="margin-top: 10px; width: 100%; height: 400px; max-height: 100%;"></canvas> - <?php - - $balance = 0; - $history = []; - $dates = []; - - $transactions1 = array_reduce(array_values(array_filter($accounts, function ($i) { return $i["owner"] === "raindrops"; })), function ($a, $b) { - return [...$a, ...$b["transactions"]]; - }, []); - - $transactions2 = array_reduce(array_values(array_filter($accounts, function ($i) { return $i["owner"] === "cloudburst"; })), function ($a, $b) { - return [...$a, ...$b["transactions"]]; - }, []); - $transactions2 = array_map(function ($i) use ($rate) { - $i["amount"] = $i["amount"] * (1/$rate); - return $i; - }, $transactions2); - - $transactions = [...$transactions1, ...$transactions2]; - usort($transactions, function ($a, $b) { - return strtotime($a["date"]) - strtotime($b["date"]); - }); - - foreach ($transactions as $transaction) { - $balance += $transaction["amount"]; - $history[] = $balance; - $dates[] = date('j M Y, H:i', strtotime($transaction["date"])); - } - - global $palette; - - ?> - <script> - const ctx3 = document.getElementById('history').getContext('2d'); - const graph3 = new Chart(ctx3, { - type: 'line', - data: { - labels: JSON.parse(`<?= json_encode($dates) ?>`), - datasets: [{ - label: 'Balance', - data: JSON.parse(`<?= json_encode($history) ?>`), - borderColor: '#<?= $use2023UI ? $palette[9] : "b9f1ef" ?>', - backgroundColor: '#<?= $use2023UI ? $palette[9] : "b9f1ef77" ?>', - lineTension: 0.4 - }] - }, - options: { - animation: { - duration: 0 - }, - scales: { - y: { - ticks: { - callback: function(label) { - return '€' + Math.round(label); - } - }, - grid: { - color: "rgba(255,255,255,0.25)" - } - } - }, - elements: { - point: { - radius: 0 - } - }, - plugins: { - legend: { - display: false - }, - tooltip: { - callbacks: { - label: function(tooltipItem) { - return '€' + tooltipItem.raw.toFixed(2); - } - }, - intersect: false - } - } - } - }) - </script> - - <hr> - - <h4>Cloudburst System (<?php - - $allAccounts = array_reduce(array_map(function ($i) { - return calculateFullAmount($i, true, true); - }, array_values(array_filter($accounts, function ($i) { return $i["owner"] === "cloudburst"; }))), function ($a, $b) { - return $a + $b; - }); - - ?>£<?= number_format($allAccounts, 2, '.', ',') ?>, earning £<?= number_format(getMonthlyEarnings()["cloudburst"], 2, '.', ',') ?>/month)</h4> - <div class="list-group"> - <details class="list-group-item list-group-item-action" style="margin-bottom: 10px;"> - <summary>Show monthly earnings</summary> - - <table style="margin-top: 10px;"> - <?php foreach ($monthlyCloudburst as $month => $value): ?> - <tr> - <td style="padding-right: 20px;"><b><?= date('F Y', strtotime($month)) ?>:</b></td> - <td class="text-<?= $value > 0 ? "success" : ($value === 0 ? "warning" : "danger") ?>">£<?= number_format($value, 2, '.', ',') ?></td> - </tr> - <?php endforeach; ?> - </table> - </details> - </div> - <div style="display: grid; grid-template-columns: repeat(3, 1fr); grid-gap: 20px;"> - <?php foreach ($accounts as $index => $account): if ($account["owner"] === "cloudburst"): ?> - <a style="color: white; text-decoration: none;" href="/-/money/<?= $account["_name"] ?>"> - <div class="card"> - <div class="card-body"> - <h4 class="card-title"><?= $account["currency"] === "gbp" ? "£" : "€" ?><?= calculateFullAmount($account); ?></h4> - <?= $account["name"] ?><?php if ($account["default"]): ?> <span class="badge bg-success rounded-pill">Default</span><?php endif; ?><?php if (isset($account["interests"])): ?> · <?= $account["interests"] * 100 ?>% interests<?php endif; ?> - <?php if (isset($account["max"])): ?><br><span class="text-muted">Max balance: <?= $account["currency"] === "gbp" ? "£" : "€" ?><?= number_format($account["max"], 2, '.', ',') ?> (<?= round((calculateFullAmount($account, true) / $account["max"]) * 100, 2) ?>% used)</span><?php else: ?><br><span class="text-muted">No maximum balance</span><?php endif; ?> - </div> - </div> - </a> - <?php endif; endforeach; ?> - </div> - - <div class="progress" style="margin-top: 20px;"> - <?php - - $part1 = 0; - $part2 = 1; - $difference = 0; - - if ($allAccounts > $minimumCloudburst) { - $part2 = ($allAccounts - $minimumCloudburst) / $allAccounts; - $part1 = 1 - $part2; - $difference = $allAccounts - $minimumCloudburst; - } else { - $part1 = 1; - $part2 = 0; - $difference = $minimumCloudburst - $allAccounts; - } - - ?> - <div class="progress-bar bg-danger" style="width:<?= $part1 * 100 ?>%"></div> - <div class="progress-bar bg-success" style="width:<?= $part2 * 100 ?>%"></div> - </div> - <p style="text-align: center; margin-top: 5px;" class="<?= $allAccounts > $minimumCloudburst ? "" : "bold text-danger" ?>">£<?= number_format($difference, 2, '.', ',') ?><?php if ($allAccounts > $minimumCloudburst): ?> (<?= round($part2 * 100, 2) ?>%)<?php endif; ?> <?= $allAccounts > $minimumCloudburst ? "over" : "under" ?> the minimum</p> - - <?php if (isset($projects["cloudburst"]) && $projects["cloudburst"]["enable"]): ?> - <div class="grid" style="margin-bottom: 10px; display: grid; grid-template-columns: 25% 1fr; grid-gap: 20px;"> - <div style="width: 100%; display: flex; align-items: center; justify-content: center;"> - <img src="<?= $projects["cloudburst"]["image"] ?>" style="width: 100%;"> - </div> - <div style="display: flex; align-items: center;"> - <div style="width: 100%;"> - <h2><?= strip_tags($projects["cloudburst"]["name"]) ?></h2> - <div class="progress" style="margin-top: 20px; margin-bottom: 20px; width: 100%; background-color: #222;"> - <div class="progress-bar bg-success" style="width: <?= ($allAccounts - $minimumRaindrops >= 0) ? (($allAccounts - $minimumRaindrops) / $projects["raindrops"]["cost"]) * 100 : 0 ?>%"></div> - </div> - <?php $missing = $projects["cloudburst"]["cost"] - ($allAccounts - $minimumCloudburst); if ($missing > 0): $months = ceil($missing / getMonthlyEarnings()["cloudburst"]); ?> - <div>Costs £<?= number_format($projects["cloudburst"]["cost"], 2, '.', ',') ?> · Missing £<?= number_format($missing, 2, '.', ',') ?> · Can afford it in <?= date('F Y', time() + ($months * 2678400)) ?> (in <?= $months ?> month<?= $months > 1 ? "s" : "" ?>)</div> - <?php elseif ($missing === 0): ?><div>You can afford it now, this will take you to the minimum.</div> - <?php else: ?><div>You can afford it now, this will take you £<?= -$missing ?> above the minimum.</div><?php endif; ?> - </div> - </div> - </div> - <?php endif; ?> - - <canvas id="history-cloudburst" style="margin-top: 10px; width: 100%; height: 200px; max-height: 100%;"></canvas> - <?php - - $balance = 0; - $history = []; - $dates = []; - - $transactions = array_reduce(array_values(array_filter($accounts, function ($i) { return $i["owner"] === "cloudburst"; })), function ($a, $b) { - return [...$a, ...$b["transactions"]]; - }, []); - usort($transactions, function ($a, $b) { - return strtotime($a["date"]) - strtotime($b["date"]); - }); - - foreach ($transactions as $transaction) { - $balance += $transaction["amount"]; - $history[] = $balance; - $dates[] = date('j M Y, H:i', strtotime($transaction["date"])); - } - - ?> - <script> - const ctx = document.getElementById('history-cloudburst').getContext('2d'); - const graph = new Chart(ctx, { - type: 'line', - data: { - labels: JSON.parse(`<?= json_encode($dates) ?>`), - datasets: [{ - label: 'Balance', - data: JSON.parse(`<?= json_encode($history) ?>`), - borderColor: '#<?= $use2023UI ? $palette[9] : "ff6ae6" ?>', - backgroundColor: '#<?= $use2023UI ? $palette[9] : "ff6ae677" ?>', - lineTension: 0.4 - }] - }, - options: { - animation: { - duration: 0 - }, - scales: { - y: { - ticks: { - callback: function(label) { - return '£' + Math.round(label); - } - }, - grid: { - color: "rgba(255,255,255,0.25)" - } - } - }, - elements: { - point: { - radius: 0 - } - }, - plugins: { - legend: { - display: false - }, - tooltip: { - callbacks: { - label: function(tooltipItem) { - return '£' + tooltipItem.raw.toFixed(2); - } - }, - intersect: false - } - } - } - }) - </script> - - <h4 style="margin-top: 20px;">Raindrops System (<?php - - $allAccounts = array_reduce(array_map(function ($i) { - return calculateFullAmount($i, true); - }, array_values(array_filter($accounts, function ($i) { return $i["owner"] === "raindrops"; }))), function ($a, $b) { - return $a + $b; - }); - - ?>€<?= number_format($allAccounts, 2, '.', ',') ?>, earning €<?= number_format(getMonthlyEarnings()["raindrops"], 2, '.', ',') ?>/month)</h4> - <div class="list-group"> - <details class="list-group-item list-group-item-action" style="margin-bottom: 10px;"> - <summary>Show monthly earnings</summary> - - <table style="margin-top: 10px;"> - <?php foreach ($monthlyRaindrops as $month => $value): ?> - <tr> - <td style="padding-right: 20px;"><b><?= date('F Y', strtotime($month)) ?>:</b></td> - <td class="text-<?= $value > 0 ? "success" : ($value === 0 ? "warning" : "danger") ?>">€<?= number_format($value, 2, '.', ',') ?></td> - </tr> - <?php endforeach; ?> - </table> - </details> - </div> - <div style="display: grid; grid-template-columns: repeat(3, 1fr); grid-gap: 20px;"> - <?php foreach ($accounts as $index => $account): if ($account["owner"] === "raindrops"): ?> - <a style="color: white; text-decoration: none;" href="/-/money/<?= $account["_name"] ?>"> - <div class="card"> - <div class="card-body"> - <h4 class="card-title"><?= $account["currency"] === "gbp" ? "£" : "€" ?><?= calculateFullAmount($account); ?></h4> - <?= $account["name"] ?><?php if ($account["default"]): ?> <span class="badge bg-success rounded-pill">Default</span><?php endif; ?><?php if (isset($account["interests"])): ?> · <?= $account["interests"] * 100 ?>% interests<?php endif; ?> - <?php if (isset($account["max"])): ?><br><span class="text-muted">Max balance: <?= $account["currency"] === "gbp" ? "£" : "€" ?><?= number_format($account["max"], 2, '.', ',') ?> (<?= round((calculateFullAmount($account, true) / $account["max"]) * 100, 2) ?>% used)</span><?php else: ?><br><span class="text-muted">No maximum balance</span><?php endif; ?> - </div> - </div> - </a> - <?php endif; endforeach; ?> - </div> - - <div class="progress" style="margin-top: 20px;"> - <?php - - $part1 = 0; - $part2 = 1; - $difference = 0; - - if ($allAccounts > $minimumRaindrops) { - $part2 = ($allAccounts - $minimumRaindrops) / $allAccounts; - $part1 = 1 - $part2; - $difference = $allAccounts - $minimumRaindrops; - } else { - $part1 = 1; - $part2 = 0; - $difference = $minimumRaindrops - $allAccounts; - } - - ?> - <div class="progress-bar bg-danger" style="width:<?= $part1 * 100 ?>%"></div> - <div class="progress-bar bg-success" style="width:<?= $part2 * 100 ?>%"></div> - </div> - <p style="text-align: center; margin-top: 5px;" class="<?= $allAccounts > $minimumRaindrops ? "" : "bold text-danger" ?>">€<?= number_format($difference, 2, '.', ',') ?><?php if ($allAccounts > $minimumRaindrops): ?> (<?= round($part2 * 100, 2) ?>%)<?php endif; ?> <?= $allAccounts > $minimumRaindrops ? "over" : "under" ?> the minimum</p> - - <?php if (isset($projects["raindrops"]) && $projects["raindrops"]["enable"]): ?> - <div class="grid" style="margin-bottom: 10px; display: grid; grid-template-columns: 25% 1fr; grid-gap: 20px;"> - <div style="width: 100%; display: flex; align-items: center; justify-content: center;"> - <img src="<?= $projects["raindrops"]["image"] ?>" style="width: 100%;"> - </div> - <div style="display: flex; align-items: center;"> - <div style="width: 100%;"> - <h2><?= strip_tags($projects["raindrops"]["name"]) ?></h2> - <div class="progress" style="margin-top: 20px; margin-bottom: 20px; width: 100%; background-color: #222;"> - <div class="progress-bar bg-success" style="width: <?= ($allAccounts - $minimumRaindrops >= 0) ? (($allAccounts - $minimumRaindrops) / $projects["raindrops"]["cost"]) * 100 : 0 ?>%"></div> - </div> - <?php $missing = $projects["raindrops"]["cost"] - ($allAccounts - $minimumRaindrops); if ($missing > 0): $months = ceil($missing / getMonthlyEarnings()["raindrops"]); ?> - <div>Costs €<?= number_format($projects["raindrops"]["cost"], 2, '.', ',') ?> · Missing €<?= number_format($missing, 2, '.', ',') ?> · Can afford it in <?= date('F Y', time() + ($months * 2678400)) ?> (in <?= $months ?> month<?= $months > 1 ? "s" : "" ?>)</div> - <?php elseif ($missing === 0): ?><div>You can afford it now, this will take you to the minimum.</div> - <?php else: ?><div>You can afford it now, this will take you €<?= -$missing ?> above the minimum.</div><?php endif; ?> - </div> - </div> - </div> - <?php endif; ?> - - <canvas id="history-raindrops" style="margin-top: 10px; width: 100%; height: 200px; max-height: 100%;"></canvas> - <?php - - $balance = 0; - $history = []; - $dates = []; - - $transactions = array_reduce(array_values(array_filter($accounts, function ($i) { return $i["owner"] === "raindrops"; })), function ($a, $b) { - return [...$a, ...$b["transactions"]]; - }, []); - usort($transactions, function ($a, $b) { - return strtotime($a["date"]) - strtotime($b["date"]); - }); - - foreach ($transactions as $transaction) { - $balance += $transaction["amount"]; - $history[] = $balance; - $dates[] = date('j M Y, H:i', strtotime($transaction["date"])); - } - - ?> - <script> - const ctx2 = document.getElementById('history-raindrops').getContext('2d'); - const graph2 = new Chart(ctx2, { - type: 'line', - data: { - labels: JSON.parse(`<?= json_encode($dates) ?>`), - datasets: [{ - label: 'Balance', - data: JSON.parse(`<?= json_encode($history) ?>`), - borderColor: '#<?= $use2023UI ? $palette[9] : "d7e1ff" ?>', - backgroundColor: '#<?= $use2023UI ? $palette[9] : "d7e1ff77" ?>', - lineTension: 0.4 - }] - }, - options: { - animation: { - duration: 0 - }, - scales: { - y: { - ticks: { - callback: function(label) { - return '€' + Math.round(label); - } - }, - grid: { - color: "rgba(255,255,255,0.25)" - } - } - }, - elements: { - point: { - radius: 0 - } - }, - plugins: { - legend: { - display: false - }, - tooltip: { - callbacks: { - label: function(tooltipItem) { - return '€' + tooltipItem.raw.toFixed(2); - } - }, - intersect: false - } - } - } - }) - </script> - </div> - <?php else: $account = array_values(array_filter($accounts, function ($i) use ($parts) { return $i["_name"] === $parts[2]; }))[0]; ?> - <h2> - <?= $account["owner"] === "cloudburst" ? "Cloudburst System" : "Raindrops System" ?> · <?= $account["name"] ?><?php if ($account["default"]): ?><span class="text-muted"> (default)</span><?php endif; ?> - <a href="/-/money" class="small btn btn-outline-<?= $use2023UI ? "primary" : "light" ?>" style="float:right;margin-top:5px;vertical-align:middle;opacity:1 !important; <?= $use2023UI ? "" : "color: white;" ?>">Back</a> - </h2> - <div style="display: grid; grid-template-columns: max-content 1fr; grid-gap: 15px;"> - <h3 style="margin-bottom: 0; display: flex; align-items: center; justify-content: center;"><?= $account["currency"] === "gbp" ? "£" : "€" ?><?= calculateFullAmount($account) ?></h3> - <div> - <div><b>Maximum balance:</b> <?php if (isset($account["max"])): ?><?= $account["currency"] === "gbp" ? "£" : "€" ?><?= number_format($account["max"], 2, '.', ',') ?> (<?= round((calculateFullAmount($account, true) / $account["max"]) * 100, 2) ?>% used)<?php else: ?>No maximum balance<?php endif; ?></div> - <div><b>Interests:</b> <?php if (isset($account["interests"])): ?><?= $account["interests"] * 100 ?>% interests<?php else: ?>None<?php endif; ?></div> - </div> - </div> - <canvas id="history" style="margin-top: 10px; width: 100%; height: 200px; max-height: 100%;"></canvas> - <?php - - $balance = 0; - $history = []; - $dates = []; - - $transactions = $account["transactions"]; - usort($transactions, function ($a, $b) { - return strtotime($a["date"]) - strtotime($b["date"]); - }); - - foreach ($transactions as $transaction) { - $balance += $transaction["amount"]; - $history[] = $balance; - $dates[] = date('j M Y, H:i', strtotime($transaction["date"])); - } - - global $palette; - - ?> - <script> - const ctx = document.getElementById('history').getContext('2d'); - const graph = new Chart(ctx, { - type: 'line', - data: { - labels: JSON.parse(`<?= json_encode($dates) ?>`), - datasets: [{ - label: 'Balance', - data: JSON.parse(`<?= json_encode($history) ?>`), - borderColor: '#<?= $use2023UI ? $palette[9] : ($account["owner"] === "cloudburst" ? "ff6ae6" : "d7e1ff") ?>', - backgroundColor: '#<?=$use2023UI ? $palette[9] : ($account["owner"] === "cloudburst" ? "ff6ae677" : "d7e1ff77") ?>', - lineTension: 0.4 - }] - }, - options: { - animation: { - duration: 0 - }, - scales: { - y: { - ticks: { - callback: function(label) { - return '<?= $account["currency"] === "gbp" ? "£" : "€" ?>' + Math.round(label); - } - }, - grid: { - color: "rgba(255,255,255,0.25)" - } - } - }, - elements: { - point: { - radius: 0 - } - }, - plugins: { - legend: { - display: false - }, - tooltip: { - callbacks: { - label: function(tooltipItem) { - return '<?= $account["currency"] === "gbp" ? "£" : "€" ?>' + tooltipItem.raw.toFixed(2); - } - }, - intersect: false - } - } - } - }) - </script> - - <hr> - - <div class="list-group"> - <a href="#" data-bs-toggle="modal" data-bs-target="#create" class="list-group-item list-group-item-action" style="display: grid; grid-template-columns: max-content 1fr;"><img src="<?= $use2023UI ? icon('add', null, true) : "/assets/icons/add.svg" ?>" style="filter: invert(1); margin-right: 10px; height: 32px; width: 32px;"><div style="display: flex; align-items: center;"><b>Add new transaction</b></div></a> - <?php foreach ($account["transactions"] as $index => $transaction): $member = getMemberWithoutSystem($transaction["author"]) ?? getMemberWithoutSystem("zdtsg"); ?> - <a id="transaction-<?= $index ?>" onclick="deleteTransaction(<?= $index ?>)" class="list-group-item list-group-item-action" style="display: grid; grid-template-columns: max-content 1fr;cursor:pointer;"><div style="display: flex; align-items: center;"><img src="<?= getAsset($member["_system"], $member["id"]) ?>" style="border-radius: 999px; width: 32px; height: 32px; margin-right: 10px;"></div><div style="display: flex; align-items: center;"><div><b><?= $member["display_name"] ?? $member["name"] ?></b><?= $transaction["amount"] < 0 ? " removed" : " added" ?> <span class="<?= $transaction["amount"] < 0 ? "text-danger" : "text-success" ?>"><?= $account["currency"] === "gbp" ? "£" : "€" ?><?= number_format(abs($transaction["amount"]), 2, '.', ',') ?> </span><?= timeAgo($transaction["date"]) ?><?php if (isset($transaction["description"]) && trim($transaction["description"]) !== "" && (!isset($transaction["initial"]) || !$transaction["initial"])): ?>: <?= strip_tags(trim($transaction["description"])) ?><?php endif; ?><?php if (isset($transaction["initial"]) && $transaction["initial"]): ?> <span class="badge bg-<?= $use2023UI ? "success" : "secondary" ?> rounded-pill">Initial amount</span><?php endif; ?></div></div></a> - <?php endforeach; ?> - </div> - - <script> - window.transactions = JSON.parse(atob("<?= base64_encode(json_encode($account["transactions"])) ?>")); - - function deleteTransaction(index) { - document.getElementById("delete-item").innerHTML = document.getElementById("transaction-" + index).innerHTML; - document.getElementById("delete-link").href = location.pathname + "/?delete&id=" + index; - new bootstrap.Modal(document.getElementById("delete")).show(); - } - </script> - - <div class="modal fade" id="delete"> - <div class="modal-dialog"> - <div class="modal-content"> - <div class="modal-header"> - <h4 class="modal-title">Delete transaction?</h4> - <button type="button" class="btn-close" data-bs-dismiss="modal"></button> - </div> - - <div class="modal-body"> - <p>Are you sure you want to delete the following transaction?</p> - - <p> - <div class="list-group"> - <div class="list-group-item" id="delete-item" style="display: grid; grid-template-columns: max-content 1fr;">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab eum facere minima officiis quas. Architecto ea eius impedit incidunt ipsa itaque laudantium pariatur quae repudiandae sunt unde vel, veritatis, voluptates.</div> - </div> - </p> - - <p>Deleting a transaction takes effect immediately and cannot be undone.</p> - <a href="#" id="delete-link" class="btn btn-<?= $use2023UI ? "primary" : "danger" ?>">Delete</a> - </div> - </div> - </div> - </div> - - <div class="modal fade" id="create"> - <div class="modal-dialog"> - <div class="modal-content"> - <div class="modal-header"> - <h4 class="modal-title">Create new transaction</h4> - <button type="button" class="btn-close" data-bs-dismiss="modal"></button> - </div> - - <div class="modal-body"> - <form> - <input type="hidden" name="create"> - - <label style="display: grid; grid-template-columns: 1fr 1fr; grid-gap: 20px;"> - <span style="align-items: center; justify-content: right; display: flex;">Amount (<?= $account["currency"] === "gbp" ? "£" : "€" ?>):</span> - <input required type="text" pattern="^(-|)\d{1,4}([,.]\d{0,2}|)$" name="amount" class="form-control" placeholder="Amount" style="filter: invert(1) hue-rotate(180deg);" maxlength="7" minlength="1"> - </label> - - <label style="margin-top: 10px;display: grid; grid-template-columns: 1fr 1fr; grid-gap: 20px;"> - <span style="align-items: center; justify-content: right; display: flex;">Description:</span> - <input maxlength="150" type="text" name="description" class="form-control" placeholder="Description" style="filter: invert(1) hue-rotate(180deg);"> - </label> - - <p> - <label style="margin-top: 10px;display: grid; grid-template-columns: 1fr 1fr; grid-gap: 20px;"> - <span style="align-items: center; justify-content: right; display: flex;">Author:</span> - <input type="text" disabled class="form-control" placeholder="Description" style="filter: invert(1) hue-rotate(180deg);" value="<?= getMemberWithoutSystem($myId)["display_name"] ?? getMemberWithoutSystem($myId)["name"] ?>"> - </label> - </p> - - <p>Adding a transaction takes effect immediately and cannot be modified afterward.</p> - <button id="delete-link" class="btn btn-<?= $use2023UI ? "primary" : "success" ?>">Create</button> - </form> - </div> - </div> - </div> - </div> - <?php endif; ?> -</div> - -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/footer.inc'; ?> diff --git a/pages/page.inc b/pages/page.inc index fb63383..fa82a10 100644 --- a/pages/page.inc +++ b/pages/page.inc @@ -9,10 +9,7 @@ if (!isset($_GET['_']) || trim($_GET['_']) === "") peh_error("Invalid request", $parts = explode("/", $_GET['_']); -if (($parts[0] !== "cloudburst" && $parts[0] !== "raindrops" && $parts[0] !== "moonglow" && $parts[0] !== $app["other"]["slug"]) && (!(count($parts) > 2) || $parts[1] === "-")) { - $namesCloudburst = [...array_map(function ($i) { - return $i['name']; - }, json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/members.json"), true)), "unknown-cb"]; +if (($parts[0] !== "raindrops" && $parts[0] !== "moonglow" && $parts[0] !== $app["other"]["slug"]) && (!(count($parts) > 2) || $parts[1] === "-")) { $namesRaindrops = [...array_map(function ($i) { return $i['name']; }, json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true)), "unknown-rd"]; @@ -33,9 +30,7 @@ if (($parts[0] !== "cloudburst" && $parts[0] !== "raindrops" && $parts[0] !== "m array_unshift($parts, ""); $parts = array_values($parts); - if (in_array($parts[1], $namesCloudburst)) { - $parts[0] = "cloudburst"; - } else if (in_array($parts[1], $namesRaindrops)) { + if (in_array($parts[1], $namesRaindrops)) { $parts[0] = "raindrops"; } else if (in_array($parts[1], $namesMoonglow)) { $parts[0] = "moonglow"; @@ -49,9 +44,9 @@ if (($parts[0] !== "cloudburst" && $parts[0] !== "raindrops" && $parts[0] !== "m $system = $parts[0]; $member = ($parts[1] ?? null) === "" ? null : ($parts[1] ?? null); -if ($system !== "cloudburst" && $system !== "raindrops" && $system !== "moonglow" && ($system !== $app["other"]["slug"] && !$isLowerLoggedIn && !$isLoggedIn)) peh_error("System not found", 404); -$systemCommonName = $system === "cloudburst" ? "Cloudburst System" : ($system === $app["other"]["slug"] && ($isLoggedIn || $isLowerLoggedIn) ? $app["other"]["name"] : ($system === "moonglow" ? "Moonglow" : "Raindrops System")); -$systemID = $system === "cloudburst" ? "ynmuc" : ($system === $app["other"]["slug"] && ($isLoggedIn || $isLowerLoggedIn) ? $app["other"]["id"] : ($system === "moonglow" ? "hrbom" : "gdapd")); +if ($system !== "raindrops" && $system !== "moonglow" && ($system !== $app["other"]["slug"] && !$isLowerLoggedIn && !$isLoggedIn)) peh_error("System not found", 404); +$systemCommonName = $system === $app["other"]["slug"] && ($isLoggedIn || $isLowerLoggedIn) ? $app["other"]["name"] : ($system === "moonglow" ? "Moonglow" : "Raindrops System"); +$systemID = $system === $app["other"]["slug"] && ($isLoggedIn || $isLowerLoggedIn) ? $app["other"]["id"] : ($system === "moonglow" ? "hrbom" : "gdapd"); if ($member === null) { global $_SystemName; @@ -72,13 +67,12 @@ if ($member === null) { $traveller = false; $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($systemID === $app["other"]["id"] ? "other" : $systemID) . "/members.json"), true); - $members2 = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($systemID === "gdapd" ? "ynmuc" : "gdapd") . "/members.json"), true); + $members2 = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($systemID === "gdapd" ? "hrbom" : "gdapd") . "/members.json"), true); $memberData = null; $memberCommonName = null; $memberID = null; - foreach ($members as $m) { - if ($m['name'] === $member) { + foreach ($members as $m) {if ($m['name'] === $member) { $memberData = $m; $memberCommonName = $m['display_name'] ?? $m['name']; $memberID = $m['id']; @@ -86,14 +80,7 @@ if ($member === null) { } foreach ($members2 as $m) { - if ($m['name'] === $member && $travelling[$m['id']]['travelling']) { - $traveller = true; - $memberData = $m; - $memberCommonName = $m['display_name'] ?? $m['name']; - $memberID = $m['id']; - $system = $systemID === "gdapd" ? "cloudburst" : "raindrops"; - $systemID = $system === "cloudburst" ? "ynmuc" : "gdapd"; - } else if ($m['name'] === $member) { + if ($m['name'] === $member) { $memberFoundInAnotherSystem = true; } } diff --git a/pages/pleasure.inc b/pages/pleasure.inc index 1a6e50a..5435bd1 100644 --- a/pages/pleasure.inc +++ b/pages/pleasure.inc @@ -1,7 +1,6 @@ <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $_PROFILE; global $pages; -if ($_PROFILE["login"] === "cloudburst") die(); $emergencyHeader = true; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; diff --git a/pages/public.inc b/pages/public.inc index b29d626..f87256b 100644 --- a/pages/public.inc +++ b/pages/public.inc @@ -41,8 +41,7 @@ function banner() { $isLoggedIn = false; $isLowerLoggedIn = false; $byColor = ge function members() { $isLoggedIn = false; $isLowerLoggedIn = false; global $app; ?> <div id="new-homepage" style="margin-top:20px;"> - <div id="new-homepage-systems" <?php if ($isLoggedIn || $isLowerLoggedIn): ?>style="grid-template-columns: repeat(4, 1fr);"<?php endif; ?>> - <?php newHomepage("ynmuc", "cloudburst", true); ?> + <div id="new-homepage-systems" <?php if ($isLoggedIn || $isLowerLoggedIn): ?>style="grid-template-columns: repeat(3, 1fr);"<?php endif; ?>> <?php newHomepage("gdapd", "raindrops", true); ?> <?php if ($isLoggedIn || $isLowerLoggedIn) newHomepage($app["other"]["id"], $app["other"]["slug"], true); ?> <?php newHomepage("hrbom", "moonglow", true); ?> @@ -74,7 +73,7 @@ function members() { $isLoggedIn = false; $isLowerLoggedIn = false; global $app; <?php - //file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/home.json", "{}"); + if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/home.json")) file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/home.json", "{}"); $cache = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/home.json"), true); if (!isset($cache["banner"])) $cache["banner"] = []; if (!isset($cache["members"])) $cache["members"] = []; @@ -150,7 +149,7 @@ function members() { $isLoggedIn = false; $isLowerLoggedIn = false; global $app; <div id="timeline"></div> <script> async function refreshTimeline() { - document.getElementById("timeline").innerHTML = await (await fetch("/api/timeline?gdapd&ynmuc<?= ($isLowerLoggedIn || $isLoggedIn) ? "&" . $app["other"]["id"] : "" ?>&hrbom")).text(); + document.getElementById("timeline").innerHTML = await (await fetch("/api/timeline?gdapd&hrbom<?= ($isLowerLoggedIn || $isLoggedIn) ? "&" . $app["other"]["id"] : "" ?>&hrbom")).text(); Array.from(document.getElementsByClassName("dynamic-time")).forEach((el) => { let time = el.getAttribute("data-time"); @@ -168,12 +167,6 @@ function members() { $isLoggedIn = false; $isLowerLoggedIn = false; global $app; </script> </div> - <?php if ($isLoggedIn || $isLowerLoggedIn): ?> - <div class="alert alert-warning" style="margin-top: 20px;"> - <b>Ponycule Documents is now deprecated.</b> Ponycule's Documents feature is now deprecated in favor of Google Docs and will be removed in the future. Please migrate your documents to Google Drive as soon as possible. - </div> - <?php endif; ?> - <!--<div class="alert alert-warning" style="margin-top:20px;"> <b>Notice:</b> The administrators are currently trying a new optimisation technique based on a virtual file system (chvfs). Data loss, corruption or inconsistency may happen and should be reported on <a href="https://bugs.equestria.dev/issues/CH" target="_blank">bugs.equestria.dev</a>. </div>--> diff --git a/pages/relations.inc b/pages/relations.inc index 1c5a878..5d3f7ef 100644 --- a/pages/relations.inc +++ b/pages/relations.inc @@ -11,7 +11,7 @@ function page() { global $isLoggedIn; global $isLowerLoggedIn; global $pages; gl <div id="page-content"> <h2><?= $pages["relations"]["name"][$lang["_name"]] ?></h2> <?php foreach (withCaretakersDown(scoreOrderGlobal()) as $member): ?> - <div class="relation" style="background-color:rgba(255, 255, 255, .1);margin-bottom:10px;padding:10px;border-radius:10px;display:grid;grid-template-columns: 2fr 2.25fr 2.25fr 2.25fr 2.25fr;"> + <div class="relation" style="background-color:rgba(255, 255, 255, .1);margin-bottom:10px;padding:10px;border-radius:10px;display:grid;grid-template-columns: 2fr 2.25fr 2.25fr 2.25fr;"> <a class="relation-intro" style="background-color:rgba(255, 255, 255, .05);border-right:1px solid rgba(255, 255, 255, .1);margin:-10px;padding:10px;border-top-left-radius:10px;border-bottom-left-radius:10px;color: white;text-decoration: none;" href="/<?= $member["name"] ?>"> <img src="<?= getAsset($member["system"], $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> </a> @@ -66,23 +66,6 @@ function page() { global $isLoggedIn; global $isLowerLoggedIn; global $pages; gl </td> </tr></tbody> </table> - - <table class="relation-item relation-item-friends" style="padding:0 20px;"> - <tbody><tr> - <td style="width: 50%;text-align:right;"> - <b style="padding-right:5px;">Friends:</b><span class="list-separator-mobile"><br></span> - </td> - <td style="width: 50%;text-align:left;"> - <?php if (!isset($member["_metadata"]["friends"]) || count($member["_metadata"]["friends"]) === 0): ?> - <span class="text-muted"><?= $lang["relations"]["no"] ?></span> - <?php else: ?> - <?php foreach ($member["_metadata"]["friends"] as $id): $mfSystem = explode("/", $id)[0]; $marefriend = getSystemMember(explode("/", $id)[0], explode("/", $id)[1]); if (!($mfSystem === $app["other"]["id"] && !$isLoggedIn && !$isLowerLoggedIn)): ?> - <a title="<?= $marefriend["display_name"] ?? $marefriend["name"] ?>" data-bs-toggle="tooltip" class="member-link tooltip-nohelp" href="/<?= $marefriend["name"] ?>"><img src="<?= getAsset($mfSystem, $marefriend["id"], "heads") ?>" style="width:24px;"></a> - <?php endif; endforeach; ?> - <?php endif; ?> - </td> - </tr></tbody> - </table> </div> <?php endforeach; ?> </div> diff --git a/pages/sessions.inc b/pages/sessions.inc index 7e6f328..444e981 100644 --- a/pages/sessions.inc +++ b/pages/sessions.inc @@ -7,7 +7,6 @@ $verified = [ dns_get_record("zephyrheights.equestria.dev", DNS_A)[0]["ip"], dns_get_record("maretimebay.equestria.dev", DNS_A)[0]["ip"], dns_get_record("bridlewood.equestria.dev", DNS_A)[0]["ip"], - dns_get_record("cloudsdale.equestria.dev", DNS_A)[0]["ip"], dns_get_record("manehattan.equestria.dev", DNS_A)[0]["ip"], dns_get_record("everfree.equestria.dev", DNS_A)[0]["ip"], ]; @@ -16,7 +15,6 @@ $verifiedNames = [ "Raindrops System", "Raindrops System", "Equestria.dev bridlewood", - "Cloudburst System", "Equestria.dev manehattan", $app["other"]["name"] ]; diff --git a/pages/travelling.inc b/pages/travelling.inc deleted file mode 100644 index c7eaadf..0000000 --- a/pages/travelling.inc +++ /dev/null @@ -1,223 +0,0 @@ -<?php - -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; global $isLowerLoggedIn; -$travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling/travelling.json"), true); -$app = $GLOBALS["ColdHazeApp"]; - -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; - -if (isset($_GET['toggleTravel']) && $isLoggedIn) { - if (isset($travelling[$_GET['member']])) { - $id = $_GET['member']; - $equestria = isset($_GET['equestria']); - $member = getSystemMember(getMemberSystem($id), $id); - $system = getMemberSystem($id); - $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$id.json"), true)); - $travellingSystem = $system === "gdapd" ? "ynmuc" : "gdapd"; - - if ($travelling[$_GET['member']]["travelling"]) { - - $travelling[$_GET['member']]["travelling"] = false; - $travelling[$_GET['member']]["history"][count($travelling[$_GET['member']]["history"]) - 1]["end"] = date("c"); - - // Insert code here to run after a travelling member is DELETED. - // $id is the member ID (e.g. rirgf) - // $member is the member object - // $system is the ID of the system the member comes from - // $travellingSystem is the ID of the system the member visits - // $metadata is the ponies.equestria.horse metadata object - // $travellingMember is the member ID from the other system - if (isset($travelling[$_GET['member']]["pluralkit"])) { - $travellingMember = $travelling[$_GET['member']]["pluralkit"]; - $reqOptions = [ - 'http' => [ - 'method' => "DELETE", - 'header' => "Authorization: " . $app["pluralkit"][$travellingSystem === "gdapd" ? "raindrops" : "cloudburst"] - ] - ]; - - $reqContext = stream_context_create($reqOptions); - - // No actual data is received on DELETE, so we don't even bother trying to collect req response; if it fails it will put a warning in the logs anyway. - //sleep(1); - //file_get_contents("https://api.pluralkit.me/v2/members/$travellingMember", false, $reqContext); - } - } else { - $travelling[$_GET['member']]["travelling"] = true; - $travelling[$_GET['member']]["equestria"] = $equestria; - $travelling[$_GET['member']]["pluralkit"] = null; - $travelling[$_GET['member']]["history"][] = [ - "start" => date("c"), - "end" => null, - "equestria" => $equestria - ]; - - if (!$equestria) { - // Insert code here to run after a travelling member is ADDED. - // $id is the member ID (e.g. rirgf) - // $member is the member - // $system is the system the member comes from - // $metadata is the ponies.equestria.horse metadata - // $travellingMember is unset here - // Store the travelling member ID in $travelling[$id]['pluralkit'] - $reqOptions = [ - 'http' => [ - 'method' => "POST", - 'header' => "Authorization: " . $app["pluralkit"][$travellingSystem === "gdapd" ? "raindrops" : "cloudburst"] . "\r\n" . - "Content-Type: application/json", - 'content' => json_encode([ - 'name' => "$member[name]-travelling", - 'display_name' => $member["display_name"], - 'color' => $member["color"], - 'birthday' => $member["birthday"], - 'created' => $member["created"], - 'pronouns' => $member["pronouns"], - 'avatar_url' => $member["avatar_url"], - 'banner' => $member["banner"], - 'description' => "**This pony is visiting this system from the " . ($system === "gdapd" ? "Raindrops System" : "Cloudburst System") . ". They are not a permanent member of this system**\n\n$member[description]", - 'proxy_tags' => array_map(function ($i) { - $i["prefix"] = "+" . $i['prefix']; - return $i; - }, $member["proxy_tags"]), - 'privacy' => $member["privacy"] - ]) - ] - ]; - - $reqContext = stream_context_create($reqOptions); - - //sleep(1); - //$member = json_decode(file_get_contents("https://api.pluralkit.me/v2/members", false, $reqContext), true); - - // Member exists? - //if (isset($member)) { - //$travelling[$id]['pluralkit'] = $member["id"]; - //} - } - } - } - - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/navigation.json", "{}"); - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/home.json", "{}"); - createJob("RefreshCache", []); - - header("Location: /-/travelling"); - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling/travelling.json", utf8_encode(json_encode($travelling, JSON_PRETTY_PRINT))); - die(); -} - -global $use2023UI; - -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; -global $travelling; - -?> - -<style> - .member-link:hover, .relation-intro:hover { - opacity: .75; - } - - .member-link:active, .relation-intro:active { - opacity: .5; - } -</style> - -<br> -<div class="container"> - <div> - <h2>System travelling</h2> - <?php foreach ([ - ...array_values(array_filter(scoreOrderGlobal(), function ($i) use ($travelling) { - return $travelling[$i['id']]["travelling"] && ($i["_system"] === "gdapd" || $i["_system"] === "ynmuc"); - })), - "SEPARATOR", - ...array_values(array_filter(scoreOrderGlobal(), function ($i) use ($travelling) { - return !$travelling[$i['id']]["travelling"] && ($i["_system"] === "gdapd" || $i["_system"] === "ynmuc"); - })) - ] as $member): if (is_string($member)): ?> - <hr> - <?php else: ?> - <div class="relation" style="background-color:rgba(255, 255, 255, .1);margin-bottom:10px;padding:10px;border-radius:10px;display:grid;grid-template-columns: 1fr 2fr max-content;"> - <a class="relation-intro" style="background-color:rgba(255, 255, 255, .05);border-right:1px solid rgba(255, 255, 255, .1);margin:-10px;padding:10px;border-top-left-radius:10px;border-bottom-left-radius:10px;color: white;display:flex;align-items:center;text-decoration: none;" href="/<?= $member["name"] ?>"> - <img src="<?= getAsset($member["system"], $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> - </a> - - <div class="relation-item" style="display:flex;align-items:center;margin-left:10px;padding:0 20px;"> - <div> - <b style="padding-right:5px;">Current location:</b><span class="list-separator-mobile"><br></span> - <?php $system = $member['_system'] === "gdapd" ? ($travelling[$member['id']]["travelling"] ? "ynmuc" : "gdapd") : ($travelling[$member['id']]["travelling"] ? "gdapd" : "ynmuc"); ?> - <?php if ($travelling[$member['id']]["travelling"] && $travelling[$member['id']]["equestria"]): ?> - <?php if ($member["_metadata"]["fictive"]): ?> - <img style="width:24px;" src="/assets/logo/equestria.png"> Equestria - <?php else: ?> - <img style="width:24px;" src="/assets/logo/celeste.png"> Celeste - <?php endif; ?> - <?php else: ?> - <a class="member-link" href="/<?= $system === "gdapd" ? "raindrops" : "cloudburst" ?>"><img style="width:24px;border-radius:5px;" src="<?= getAsset($system) ?>"> <?= $system === "gdapd" ? "Raindrops" : "Cloudburst" ?> System</a> - <?php endif; ?> - <?php if ($travelling[$member['id']]["travelling"]): ?> - <span class="text-muted">(<?= timeAgo($travelling[$member['id']]["history"][count($travelling[$member['id']]["history"]) - 1]["start"]) ?>)</span> - <?php endif; ?> - </div> - </div> - - <div> - <?php if ($travelling[$member['id']]["travelling"]): ?> - <div class="dropdown"> - <button type="button" class="btn btn-outline-<?= $use2023UI ? "primary" : "danger" ?> dropdown-toggle" data-bs-toggle="dropdown" <?= $isLowerLoggedIn ? "disabled" : "" ?>> - Stop travelling - </button> - <ul class="dropdown-menu"> - <li><a class="dropdown-item" href="?toggleTravel&member=<?= $member['id'] ?>">Stop travelling</a></li> - </ul> - </div> - <?php else: ?> - <div class="dropdown"> - <button type="button" class="btn btn-outline-<?= $use2023UI ? "primary" : "success" ?> dropdown-toggle" data-bs-toggle="dropdown" <?= $isLowerLoggedIn ? "disabled" : "" ?>> - Start travelling - </button> - <ul class="dropdown-menu"> - <li><a class="dropdown-item" href="?toggleTravel&member=<?= $member['id'] ?>"><img style="width:24px;border-radius:5px;" src="<?= getAsset($system === "gdapd" ? "ynmuc" : "gdapd") ?>"> <?= $system === "gdapd" ? "Cloudburst" : "Raindrops" ?> System</a></li> - <?php if ($member["_metadata"]["fictive"]): ?> - <li><a class="dropdown-item" href="?toggleTravel&equestria&member=<?= $member['id'] ?>"><img style="width:24px;" src="/assets/logo/equestria.png"> Equestria</a></li> - <?php endif; if (isset($member["_metadata"]["fictive2"]) && $member["_metadata"]["fictive2"]): ?> - <li><a class="dropdown-item" href="?toggleTravel&equestria&member=<?= $member['id'] ?>"><img style="width:24px;" src="/assets/logo/celeste.png"> Celeste</a></li> - <?php endif; ?> - </ul> - </div> - <?php endif; ?> - </div> - </div> - <?php endif; endforeach; ?> - </div> - - <style> - @media (max-width: 991px) { - .relation { - grid-template-columns: 1fr !important; - } - - .relation-intro { - text-align: center; - border-bottom-left-radius: 0 !important; - border-top-right-radius: 10px; - border-right: none !important; - border-bottom: 1px solid rgba(255, 255, 255, .1); - } - - .relation-item-marefriends { - margin-top: 20px !important; - } - - .relation-item { - margin-top: 10px; - margin-left: 0 !important; - padding: 10px 0 !important; - text-align: center; - } - } - </style> -</div> - -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/footer.inc'; ?> |