diff options
-rw-r--r-- | app.php | 6 | ||||
-rw-r--r-- | error.php | 8 | ||||
-rw-r--r-- | includes/components/navigation.inc | 8 | ||||
-rw-r--r-- | includes/components/pleasure.inc | 10 | ||||
-rw-r--r-- | includes/flags.json | 2 | ||||
-rw-r--r-- | includes/fragments/member.inc | 2 | ||||
-rw-r--r-- | includes/fragments/metadata.inc | 20 | ||||
-rw-r--r-- | includes/fragments/system.inc | 2 | ||||
-rw-r--r-- | includes/util/banner.inc | 4 | ||||
-rw-r--r-- | pages/api/disconnect.php | 7 | ||||
-rw-r--r-- | pages/byfront.inc | 4 | ||||
-rw-r--r-- | pages/computers.inc | 14 | ||||
-rw-r--r-- | pages/docs.inc | 6 | ||||
-rw-r--r-- | pages/sessions.inc | 6 | ||||
-rw-r--r-- | pages/toys.inc | 25 |
15 files changed, 52 insertions, 72 deletions
@@ -2,8 +2,10 @@ ob_start(); -require_once $_SERVER['DOCUMENT_ROOT'] . "/error.php"; -set_error_handler("ch_error"); +if (!str_starts_with($_SERVER['REQUEST_URI'], "/api")) { + require_once $_SERVER['DOCUMENT_ROOT'] . "/error.php"; + set_error_handler("ch_error"); +} $start = microtime(true); $GLOBALS["ColdHazeStart"] = microtime(true); @@ -1,5 +1,9 @@ <?php function ch_error($level, $message, $file = null, $line = null, $context = null) { - ob_end_clean(); ?> + if ($level === E_USER_DEPRECATED || $level === E_DEPRECATED) return false; + + ob_end_clean(); + + ?> <!DOCTYPE html> <html lang="en"> @@ -68,10 +72,8 @@ if ($level === E_COMPILE_WARNING) echo("E_ALL"); if ($level === E_CORE_ERROR) echo("E_ALL"); if ($level === E_CORE_WARNING) echo("E_ALL"); - if ($level === E_DEPRECATED) echo("E_DEPRECATED"); if ($level === E_PARSE) echo("E_PARSE"); if ($level === E_RECOVERABLE_ERROR) echo("E_RECOVERABLE_ERROR"); - if ($level === E_USER_DEPRECATED) echo("E_USER_DEPRECATED"); ?>] <?= $message ?> diff --git a/includes/components/navigation.inc b/includes/components/navigation.inc index 9a777ce..f08fca2 100644 --- a/includes/components/navigation.inc +++ b/includes/components/navigation.inc @@ -158,14 +158,6 @@ $navigation_admin = [ "private" => false ], [ - "name" => $pages["rules"]["name"][$lang["_name"]], - "icon" => "/assets/icons/rules.svg", - "invert" => true, - "link" => "/-/rules", - "stepped" => null, - "private" => true - ], - [ "name" => $pages["toys"]["name"][$lang["_name"]], "icon" => "/assets/icons/toys.svg", "invert" => true, diff --git a/includes/components/pleasure.inc b/includes/components/pleasure.inc index 40bf7fd..0939228 100644 --- a/includes/components/pleasure.inc +++ b/includes/components/pleasure.inc @@ -28,7 +28,7 @@ ?> However, if you wish, any of the ponies mentioned on this page can take control of the body for the amount of time required for sex. </div> - <?php elseif (!parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $front[0]["id"]), true))["other"]): ?> + <?php elseif (!parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $front[0]["id"] . ".json"), true))["other"]): ?> <div class="alert alert-warning"> <?php @@ -217,28 +217,28 @@ if (!isset($school[$day])) { <p><?= $_PROFILE["login"] === "raindrops" ? "These ponies will have sex with " . $app["other"]["name"] : "These ponies will have sex with you" ?>:</p> <ul> - <?php foreach (scoreOrderGlobal() as $pony): if ($pony["system"] === "gdapd" && $pony["_metadata"]["other"]): ?> + <?php foreach (scoreOrderGlobal() as $pony): if ($pony["system"] === "gdapd" && isset($pony["_metadata"]["other"]) && $pony["_metadata"]["other"]): ?> <li><a href="/<?= $pony["name"] ?>"><?= $pony["display_name"] ?? $pony["name"] ?></a> (<?= $pony["_metadata"]["sexually_active"] ? "no consent is required" : "consent is mandatory" ?>)</li> <?php endif; endforeach; ?> </ul> <p><?= $_PROFILE["login"] === "raindrops" ? "These ponies may have sex with " . $app["other"]["name"] . " but are unsure about it" : "These ponies may have sex with you but are unsure about it" ?>:</p> <ul> - <?php foreach (scoreOrderGlobal() as $pony): if ($pony["system"] === "gdapd" && $pony["_metadata"]["other2"]): ?> + <?php foreach (scoreOrderGlobal() as $pony): if ($pony["system"] === "gdapd" && isset($pony["_metadata"]["other2"]) && $pony["_metadata"]["other2"]): ?> <li><a href="/<?= $pony["name"] ?>"><?= $pony["display_name"] ?? $pony["name"] ?></a></li> <?php endif; endforeach; ?> </ul> <p><?= $_PROFILE["login"] === "raindrops" ? "These ponies will have sex with you" : "These ponies will have sex with Raindrops" ?>:</p> <ul> - <?php foreach (scoreOrderGlobal() as $pony): if ($pony["system"] === $app["other"]["id"] && $pony["_metadata"]["other3"]): ?> + <?php foreach (scoreOrderGlobal() as $pony): if ($pony["system"] === $app["other"]["id"] && isset($pony["_metadata"]["other3"]) && $pony["_metadata"]["other3"]): ?> <li><a href="/<?= $pony["name"] ?>"><?= $pony["display_name"] ?? $pony["name"] ?></a></li> <?php endif; endforeach; ?> </ul> <p><?= $_PROFILE["login"] === "raindrops" ? "These ponies may have sex with you but are unsure about it" : "These ponies may have sex with Raindrops but are unsure about it" ?>:</p> <ul> - <?php foreach (scoreOrderGlobal() as $pony): if ($pony["system"] === $app["other"]["id"] && $pony["_metadata"]["other4"]): ?> + <?php foreach (scoreOrderGlobal() as $pony): if ($pony["system"] === $app["other"]["id"] && isset($pony["_metadata"]["other4"]) && $pony["_metadata"]["other4"]): ?> <li><a href="/<?= $pony["name"] ?>"><?= $pony["display_name"] ?? $pony["name"] ?></a></li> <?php endif; endforeach; ?> </ul> diff --git a/includes/flags.json b/includes/flags.json index 9d21e1f..d11fd54 100644 --- a/includes/flags.json +++ b/includes/flags.json @@ -7,7 +7,7 @@ "protector": "!!Protector", "leader": "Leader", - "fictive": "!!Fictive (Equestria)", + "fictive": "!!Equestrian", "fictive2": "Fictive (Celeste)", "sexual_features": "Enable sexual features (for ponies below 16)", "sexually_active": "!!Preemptive sexual consent", diff --git a/includes/fragments/member.inc b/includes/fragments/member.inc index 1db0dd2..476b748 100644 --- a/includes/fragments/member.inc +++ b/includes/fragments/member.inc @@ -13,7 +13,7 @@ if ($memberData["name"] === "fusion") { if ($memberData["name"] !== "unknown" && $memberData["name"] !== "fusion") { $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $memberID . ".json"), true)); - if ($metadata["private"] && !$isLoggedIn && !$isLowerLoggedIn) { + if (isset($metadata["private"]) && $metadata["private"] && !$isLoggedIn && !$isLowerLoggedIn) { peh_error("Page not found: " . strip_tags($member), 404); } } diff --git a/includes/fragments/metadata.inc b/includes/fragments/metadata.inc index cd022df..38317ce 100644 --- a/includes/fragments/metadata.inc +++ b/includes/fragments/metadata.inc @@ -95,14 +95,14 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $member </select> <select class="tooltip-nohelp form-select" style='display:inline-block;filter:invert(1) hue-rotate(180deg);background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23000000' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");' name="species[1]"> <option <?= !isset($metadata["species"][1]) || $metadata["species"][1] === "" ? "selected" : "" ?> value="">None</option> - <option <?= $metadata["species"][1] === "earth" ? "selected" : "" ?> value="earth">Earth pony</option> - <option <?= $metadata["species"][1] === "unicorn" ? "selected" : "" ?> value="unicorn">Unicorn</option> - <option <?= $metadata["species"][1] === "pegasus" ? "selected" : "" ?> value="pegasus">Pegasus</option> - <option <?= $metadata["species"][1] === "alicorn" ? "selected" : "" ?> value="alicorn">Alicorn</option> - <option <?= $metadata["species"][1] === "batpony" ? "selected" : "" ?> value="batpony">Bat pony</option> - <option <?= $metadata["species"][1] === "crystal" ? "selected" : "" ?> value="crystal">Crystal pony</option> - <option <?= $metadata["species"][1] === "changeling" ? "selected" : "" ?> value="changeling">Changeling</option> - <option <?= $metadata["species"][1] === "merpony" ? "selected" : "" ?> value="merpony">Merpony</option> + <option <?= ($metadata["species"][1] ?? "") === "earth" ? "selected" : "" ?> value="earth">Earth pony</option> + <option <?= ($metadata["species"][1] ?? "") === "unicorn" ? "selected" : "" ?> value="unicorn">Unicorn</option> + <option <?= ($metadata["species"][1] ?? "") === "pegasus" ? "selected" : "" ?> value="pegasus">Pegasus</option> + <option <?= ($metadata["species"][1] ?? "") === "alicorn" ? "selected" : "" ?> value="alicorn">Alicorn</option> + <option <?= ($metadata["species"][1] ?? "") === "batpony" ? "selected" : "" ?> value="batpony">Bat pony</option> + <option <?= ($metadata["species"][1] ?? "") === "crystal" ? "selected" : "" ?> value="crystal">Crystal pony</option> + <option <?= ($metadata["species"][1] ?? "") === "changeling" ? "selected" : "" ?> value="changeling">Changeling</option> + <option <?= ($metadata["species"][1] ?? "") === "merpony" ? "selected" : "" ?> value="merpony">Merpony</option> </select> </div> </div> @@ -292,7 +292,7 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $member <b><?= $relations[1] ?></b><br> <input name="<?= $relations[0] ?>" type="hidden" value="<?= implode(", ", $metadata[$relations[0]] ?? []) ?>"> <span id="<?= $relations[0] ?>-list"></span> - <a style="margin-top: 4px;" class="btn btn-secondary" onclick="openAddDialog('<?= $relations[0] ?>', '<?= $relations[2] ?>')">+</a> + <a style="margin-top: 4px;" class="btn btn-secondary" onclick="openAddDialog('<?= $relations[0] ?>', '<?= $relations[2] ?? '' ?>')">+</a> <script> update('<?= $relations[0] ?>'); </script> @@ -331,7 +331,7 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $member <input <?= $metadata[$id] ? "checked" : "" ?> class="form-check-input" type="checkbox" name="flags[<?= $id ?>]"> <?= str_replace("%other%", $app["other"]["name"], str_starts_with($name, "!!") ? substr($name, 2) : (str_starts_with($name, "#") ? substr($name, 1) : $name)) ?> </label><br> - <?php endif; else: foreach ($name as $id2 => $name2): if (!is_array($name2) && !is_null($name2)): if (($systemID === $app["other"]["id"] && str_starts_with($name2, "!!")) || ($systemID !== $app["other"]["id"] && !str_starts_with($name2, "#"))): ?> + <?php endif; else: foreach ($name ?? [] as $id2 => $name2): if (!is_array($name2) && !is_null($name2)): if (($systemID === $app["other"]["id"] && str_starts_with($name2, "!!")) || ($systemID !== $app["other"]["id"] && !str_starts_with($name2, "#"))): ?> <label style="margin-bottom:5px;"> <input <?= $metadata[$id][$id2] ? "checked" : "" ?> class="form-check-input" type="checkbox" name="flags[<?= $id ?>][<?= $id2 ?>]"> <?= str_replace("%other%", $app["other"]["name"], str_starts_with($name2, "!!") ? substr($name2, 2) : $name2) ?> diff --git a/includes/fragments/system.inc b/includes/fragments/system.inc index 030c743..ad7db76 100644 --- a/includes/fragments/system.inc +++ b/includes/fragments/system.inc @@ -20,7 +20,7 @@ <br> <div id="page-content"> - <?= file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/content.html") ?> + <?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/content.html") ? file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/content.html") : "" ?> </div> <?php if ($system === "cloudburst") cloudburst(true); elseif ($system === "raindrops") raindrops(true); elseif ($isLoggedIn || $isLowerLoggedIn) other(true); ?> </div> diff --git a/includes/util/banner.inc b/includes/util/banner.inc index 388e4b1..6c6b128 100644 --- a/includes/util/banner.inc +++ b/includes/util/banner.inc @@ -292,7 +292,7 @@ function getMemberBannerData(string $id, string $system, bool $french = false) { $badges[] = [ "id" => "fictive", "color" => "info", - "html" => '<span data-bs-toggle="tooltip" data-bs-html="true" title="<b>Fictive</b><br>' . ucfirst(getMemberPronouns($member['pronouns'])["subjective"]) . ' ' . (getMemberPronouns($member['pronouns'])["third"] ? "is" : "are") . ' based on the personality, look and behavior of a character that is from Equestria." class="badge rounded-pill bg-info" style="height: 24px;"><img style="width: 16px;" src="/assets/logo/equestria.png"><span style="vertical-align: middle;"> Fictive</span></span>' + "html" => '<span data-bs-toggle="tooltip" data-bs-html="true" title="<b>Equestrian</b><br>' . ucfirst(getMemberPronouns($member['pronouns'])["subjective"]) . ' ' . (getMemberPronouns($member['pronouns'])["third"] ? "is" : "are") . ' based on the personality, look and behavior of a character that is from Equestria." class="badge rounded-pill bg-info" style="height: 24px;"><img style="width: 16px;" src="/assets/logo/equestria.png"><span style="vertical-align: middle;"> Equestrian</span></span>' ]; } @@ -368,7 +368,7 @@ function getMemberBannerData(string $id, string $system, bool $french = false) { ]; } - if (($isLoggedIn || $isLowerLoggedIn) && $metadata["alcohol"] !== null && $metadata["alcohol"] !== false) { + if (($isLoggedIn || $isLowerLoggedIn) && isset($metadata["alcohol"]) && $metadata["alcohol"] !== false) { $badges[] = [ "id" => "alcohol", "color" => "secondary", 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;"> <?= $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("<?= sha1($token) . md5($token) ?>");"> 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"): ?> |