summaryrefslogtreecommitdiff
path: root/pages
diff options
context:
space:
mode:
Diffstat (limited to 'pages')
-rw-r--r--pages/api/disconnect.php7
-rw-r--r--pages/byfront.inc4
-rw-r--r--pages/computers.inc14
-rw-r--r--pages/docs.inc6
-rw-r--r--pages/sessions.inc6
-rw-r--r--pages/toys.inc25
6 files changed, 23 insertions, 39 deletions
diff --git a/pages/api/disconnect.php b/pages/api/disconnect.php
index 13363e6..c4cf0bd 100644
--- a/pages/api/disconnect.php
+++ b/pages/api/disconnect.php
@@ -7,10 +7,13 @@ if (!$isLoggedIn && !$isLowerLoggedIn) {
die();
}
-$list = array_filter([...scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens"), ...scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/lowertokens")], function ($token) use ($_PROFILE) {
+$list = array_filter([...scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens"), ...scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/lowertokens")], function ($token) {
+ global $_PROFILE;
+ if ($token === "." || $token === "..") return false;
+
$session = file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . $token) ? json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . $token), true) : json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/lowertokens/" . $token), true);
- return $token !== "." && $token !== ".." && isset($session["last"]) && isset($session["profile"]) && $session["profile"]["id"] === $_PROFILE["id"];
+ return isset($session["last"]) && isset($session["profile"]) && ($session["profile"]["id"] ?? "") === ($_PROFILE["id"] ?? "");
});
foreach ($list as $token) {
diff --git a/pages/byfront.inc b/pages/byfront.inc
index 78c2319..f845378 100644
--- a/pages/byfront.inc
+++ b/pages/byfront.inc
@@ -111,7 +111,7 @@ $travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includ
}
if ((isset($age) && $age > 0 && time() > 1677628800) || time() <= 1677628800): ?>
- <div class="relation" style="background-color:<?php if ($member["_metadata"]["less_frequent"] || $member["_metadata"]["persecutor"]): ?><?php if ($member["_lastFronted"] > time() - (86400 * 21)): ?>rgba(128, 54, 54, .1)<?php else: ?><?php if ($member["_lastFronted"] > time() - (86400 * 37)): ?>rgba(255, 227, 0, 0.17)<?php else: ?>rgba(255, 255, 255, .1)<?php endif; ?>;<?php endif; ?><?php else: ?><?php if ($member["_lastFronted"] > time() - (86400 * 21)): ?>rgba(255, 255, 255, .1)<?php else: ?><?php if ($member["_lastFronted"] > time() - (86400 * 30)): ?>rgba(255, 227, 0, 0.17)<?php else: ?>rgba(255,55,55,0.17)<?php endif; ?>;<?php endif; ?><?php endif; ?>;margin-bottom:10px;padding:10px;border-radius:10px;display:grid;grid-template-columns: 1fr 2fr max-content;<?php if ($travelling[$member['id']]["travelling"] || $member["_metadata"]["punished"]): ?>opacity: 0.75;<?php endif; ?><?php if (isset($member["_metadata"]["not_fronting"]) && $member["_metadata"]["not_fronting"]): ?>background-color:rgba(255, 255, 255, .1) !important;<?php endif; ?>">
+ <div class="relation" style="background-color:<?php if ($member["_metadata"]["less_frequent"] || $member["_metadata"]["persecutor"]): ?><?php if ($member["_lastFronted"] > time() - (86400 * 21)): ?>rgba(128, 54, 54, .1)<?php else: ?><?php if ($member["_lastFronted"] > time() - (86400 * 37)): ?>rgba(255, 227, 0, 0.17)<?php else: ?>rgba(255, 255, 255, .1)<?php endif; ?>;<?php endif; ?><?php else: ?><?php if ($member["_lastFronted"] > time() - (86400 * 21)): ?>rgba(255, 255, 255, .1)<?php else: ?><?php if ($member["_lastFronted"] > time() - (86400 * 30)): ?>rgba(255, 227, 0, 0.17)<?php else: ?>rgba(255,55,55,0.17)<?php endif; ?>;<?php endif; ?><?php endif; ?>;margin-bottom:10px;padding:10px;border-radius:10px;display:grid;grid-template-columns: 1fr 2fr max-content;<?php if ($travelling[$member['id']]["travelling"] || ($member["_metadata"]["punished"] ?? false)): ?>opacity: 0.75;<?php endif; ?><?php if (isset($member["_metadata"]["not_fronting"]) && $member["_metadata"]["not_fronting"]): ?>background-color:rgba(255, 255, 255, .1) !important;<?php endif; ?>">
<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;">&nbsp;<?= $member["display_name"] ?? $member["name"] ?>
<span style="display: inline-block;margin-left: auto;">
@@ -124,7 +124,7 @@ $travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includ
<?php if ($member["_metadata"]["persecutor"]): ?>
<span class="badge bg-light text-black rounded-pill">Persecutor</span>
<?php endif; ?>
- <?php if ($member["_metadata"]["punished"]): ?>
+ <?php if (isset($member["_metadata"]["punished"]) && $member["_metadata"]["punished"]): ?>
<span class="badge bg-light text-black rounded-pill">Punished</span>
<?php endif; ?>
<?php if ($member["_metadata"]["shared_memory"] !== 2): ?>
diff --git a/pages/computers.inc b/pages/computers.inc
index b711c32..643fe87 100644
--- a/pages/computers.inc
+++ b/pages/computers.inc
@@ -36,11 +36,11 @@ if (count($parts) === 2 || count($parts) === 3) {
array_unshift($parts, null);
}
-if (str_ends_with($computer["os"], "unknown")) {
+if (isset($computer["os"]) && str_ends_with($computer["os"], "unknown")) {
$computer["os"] = trim(substr($computer["os"], 0, -7));
}
-if (str_ends_with($computer["os"], "rolling")) {
+if (isset($computer["os"]) && str_ends_with($computer["os"], "rolling")) {
$computer["os"] = trim(substr($computer["os"], 0, -7));
}
@@ -194,7 +194,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc';
</tr>
<tr>
<td style="padding-right: 10px; text-align: right;"><b>Main processor:</b></td>
- <td><?= trim($computer["cpu"]["manufacturer"] . " " . $computer["cpu"]["brand"] . " " . $computer["cpu"]["model"]) ?> (<?= $computer["cpu"]["speed"] ?> GHz)</td>
+ <td><?= trim(($computer["cpu"]["manufacturer"] ?? "") . " " . ($computer["cpu"]["brand"] ?? "") . " " . ($computer["cpu"]["model"] ?? "")) ?> (<?= $computer["cpu"]["speed"] ?? "" ?> GHz)</td>
</tr>
<tr>
<td style="padding-right: 10px; text-align: right;"><b>Processor threading:</b></td>
@@ -307,7 +307,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc';
<td style="padding-right: 10px; text-align: right;"><b>Kernel version:</b></td>
<td><?= $computer["os_info"]["kernel"] ?></td>
</tr>
- <?php if ($computer["os_info"]["codepage"]): ?>
+ <?php if (isset($computer["os_info"]["codepage"])): ?>
<tr>
<td style="padding-right: 10px; text-align: right;"><b>Code page:</b></td>
<td><?= $computer["os_info"]["codepage"] ?></td>
@@ -601,7 +601,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc';
<tr>
<th scope="row"><?= $process["pid"] ?></th>
<td><?= $process["name"] ?></td>
- <td><?= round($process["cpu"], 2) ?>%</td>
+ <td><?= round($process["cpu"] ?? 0, 2) ?>%</td>
<td><?= round($process["ram"], 2) ?>%</td>
<td><?= $process["user"] ?></td>
<td><?= isset($process["date"]) ? timeAgo($process["date"]) : "" ?></td>
@@ -896,6 +896,10 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc';
<h2>Devices</h2>
<p>Click on a device to view information about it</p>
+ <div class="alert alert-warning">
+ <b>Luna and the Cold Haze Devices software are deprecated.</b> These applications are now deprecated and monitoring devices through Luna is not supported anymore. Basic support and servers will be shut down in August 2023.
+ </div>
+
<ul class="list-group">
<?php
diff --git a/pages/docs.inc b/pages/docs.inc
index 84d9d87..9fd9bf3 100644
--- a/pages/docs.inc
+++ b/pages/docs.inc
@@ -38,7 +38,7 @@ function showDocument($item) { ?>
<div style="display: grid; grid-template-columns: 2fr repeat(3, 1fr);">
<span>
<?= $item["name"] ?>
- <?php if ($item["nsfw"]): ?>
+ <?php if (isset($item["nsfw"]) && $item["nsfw"]): ?>
<span class="badge bg-danger rounded-pill">NSFW</span>
<?php endif; ?>
</span>
@@ -58,13 +58,13 @@ function showDocument($item) { ?>
<div class="container">
<div>
<?php if (isset($data)): ?><div id="page-content">
- <?php if ($data["nsfw"]): ?><script>requestExplicit("back");</script><?php endif; ?>
+ <?php if (isset($data["nsfw"]) && $data["nsfw"]): ?><script>requestExplicit("back");</script><?php endif; ?>
<h2>
<span contenteditable="true" id="document-name" style="outline: none;"><?= $data["name"] ?></span>
<a href="/-/docs" class="small btn btn-outline-light" style="float:right;margin-top:5px;vertical-align:middle;opacity:1 !important; color:white;">Back</a>
</h2>
<p><b>Category:</b> <span id="category" contenteditable="true" style="outline: none;"><?= $data["category"] ?? "Unsorted" ?></span> · <label style="margin-bottom:5px;">
- <input <?= $data["nsfw"] ? "checked" : "" ?> class="form-check-input" type="checkbox" id="explicit">
+ <input <?= (isset($data["nsfw"]) && $data["nsfw"]) ? "checked" : "" ?> class="form-check-input" type="checkbox" id="explicit">
Explicit
</label></p>
<p>
diff --git a/pages/sessions.inc b/pages/sessions.inc
index 6b52a6d..d782128 100644
--- a/pages/sessions.inc
+++ b/pages/sessions.inc
@@ -17,9 +17,11 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; glob
<?php
$list = array_filter([...scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens"), ...scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/lowertokens")], function ($token) {
+ if ($token === "." || $token === "..") return false;
+
$session = file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . $token) ? json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . $token), true) : json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/lowertokens/" . $token), true);
- return $token !== "." && $token !== ".." && isset($session["last"]) && isset($session["profile"]);
+ return isset($session["last"]) && isset($session["profile"]);
});
usort($list, function ($token1, $token2) {
$session1 = file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . $token1) ? json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . $token1), true) : json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/lowertokens/" . $token1), true);
@@ -32,7 +34,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; glob
}
});
- foreach ($list as $token): $session = file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . $token) ? json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . $token), true) : json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/lowertokens/" . $token), true); if (isset($session["profile"]) && isset($session["name"]) && $session["profile"]["id"] === $_PROFILE["id"]): uasort($session["addresses"], function ($a, $b) {
+ foreach ($list as $token): $session = file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . $token) ? json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . $token), true) : json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/lowertokens/" . $token), true); if (isset($session["profile"]) && isset($session["name"]) && ($session["profile"]["id"] ?? "") === ($_PROFILE["id"] ?? "")): uasort($session["addresses"], function ($a, $b) {
return $b - $a;
}); ?>
<a class="list-group-item list-group-item-action" onclick="logOut(&quot;<?= sha1($token) . md5($token) ?>&quot;);">
diff --git a/pages/toys.inc b/pages/toys.inc
index 870bb62..df34af0 100644
--- a/pages/toys.inc
+++ b/pages/toys.inc
@@ -366,31 +366,6 @@ $parts = explode("/", $pagename);
<div class="card-body">
<h4 class="card-title"><?= $item["name"] ?></h4>
<p class="card-text">
- <!--
- <?php
-
- $uniquePonies = [];
-
- foreach ($item["ponies"] as $ponies) {
- foreach ($ponies["members"] as $member) {
- if (isset($uniquePonies[$member]) && !$uniquePonies[$member]) {
- $uniquePonies[$member] = false;
- } else {
- $uniquePonies[$member] = $ponies["deprecated"];
- }
- }
- }
-
- foreach ($uniquePonies as $name => $deprecated): if (!$deprecated): ?>
- <span data-bs-toggle="tooltip" title="<?= getMemberWithoutSystem($name)["display_name"] ?? getMemberWithoutSystem($name)["display_name"] ?>" style="display: inline-block;">
- <img src="/assets/uploads/pt-<?= getMemberWithoutSystem($name)["name"] ?>.png" style="width:32px;">
- </span>
- <?php endif; endforeach; ?>
- <?php foreach ($uniquePonies as $name => $deprecated): if ($deprecated): ?>
- <span data-bs-toggle="tooltip" data-bs-html="true" title="<i><?= strip_tags(getMemberWithoutSystem($name)["display_name"] ?? getMemberWithoutSystem($name)["name"]) ?></i>" style="opacity:.5;display: inline-block;">
- <img src="/assets/uploads/pt-<?= getMemberWithoutSystem($name)["name"] ?>.png" style="width:32px;">
- </span>
- <?php endif; endforeach; ?>-->
<?= strlen(strip_tags($item["description"])) > 100 ? substr(strip_tags($item["description"]), 0, 100) . "…" : strip_tags($item["description"]) ?>
</p>
<?php if ($item["water"] === "in"): ?>