summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--api/booru-check.php24
-rw-r--r--api/booru.php8
-rw-r--r--api/raindrops-img.php3
-rw-r--r--includes/session.inc2
-rw-r--r--pages/money.inc24
5 files changed, 55 insertions, 6 deletions
diff --git a/api/booru-check.php b/api/booru-check.php
new file mode 100644
index 0000000..b2a3800
--- /dev/null
+++ b/api/booru-check.php
@@ -0,0 +1,24 @@
+<?php
+
+$list = array_map(function ($i) {
+ return sha1($i) . md5($i);
+}, array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens"), function ($i) { return !str_starts_with($i, "."); }));
+header("Content-Type: text/plain");
+
+$obj = [
+ "valid" => false,
+ "user" => null
+];
+
+if (isset($_GET["key"])) {
+ if (in_array($_GET["key"], $list)) {
+ $obj["valid"] = true;
+
+ foreach (array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens"), function ($i) { return !str_starts_with($i, "."); }) as $token) {
+ $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . $token), true);
+ $obj["user"] = $data["login"];
+ }
+ }
+}
+
+die(json_encode($obj)); \ No newline at end of file
diff --git a/api/booru.php b/api/booru.php
new file mode 100644
index 0000000..3c3c1d0
--- /dev/null
+++ b/api/booru.php
@@ -0,0 +1,8 @@
+<?php
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc";
+global $isLoggedIn;
+if (!$isLoggedIn) header("Location: /-/login") and die();
+
+header("Location: http://localhost:8083/auth/?key=" . sha1($_COOKIE['PEH2_SESSION_TOKEN']) . md5($_COOKIE['PEH2_SESSION_TOKEN']));
+die(); \ No newline at end of file
diff --git a/api/raindrops-img.php b/api/raindrops-img.php
index 6a7484f..4cbac6b 100644
--- a/api/raindrops-img.php
+++ b/api/raindrops-img.php
@@ -1,8 +1,9 @@
<?php
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/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"] ?? "https://static.equestria.horse/ponies/uploads/raindrops.png") : "https://static.equestria.horse/ponies/uploads/raindrops.png";
+$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");
diff --git a/includes/session.inc b/includes/session.inc
index b440c9c..4e2569c 100644
--- a/includes/session.inc
+++ b/includes/session.inc
@@ -5,7 +5,7 @@ global $isUserLoggedIn;
global $_PROFILE;
if (isset($_COOKIE['PEH2_SESSION_TOKEN'])) {
- if (str_contains($_COOKIE['PEH2_SESSION_TOKEN'], ".") || str_contains($_COOKIE['PEH2_SESSION_TOKEN'], "/")) {
+ if (str_contains($_COOKIE['PEH2_SESSION_TOKEN'], ".") || str_contains($_COOKIE['PEH2_SESSION_TOKEN'], "/") || trim($_COOKIE["PEH2_SESSION_TOKEN"]) === "") {
$isLoggedIn = false;
}
diff --git a/pages/money.inc b/pages/money.inc
index 9c98613..609ff6c 100644
--- a/pages/money.inc
+++ b/pages/money.inc
@@ -249,7 +249,15 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc';
<hr>
- <h4>Cloudburst System</h4>
+ <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, '.', ',') ?>)</h4>
<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"] ?>">
@@ -257,7 +265,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc';
<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 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>
@@ -335,7 +343,15 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc';
})
</script>
- <h4 style="margin-top: 20px;">Raindrops System</h4>
+ <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, '.', ',') ?>)</h4>
<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"] ?>">
@@ -343,7 +359,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc';
<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 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>