Updated 14 files (automated)

mane
Mia Raindrops 1 week ago
parent eb89b15c0f
commit 940defd293
Signed by: Mia Raindrops
GPG Key ID: EFBDC68435A574B7

@ -63,7 +63,7 @@ async function refreshBanner(_, french) {
<img id="member-icon" src="${offline ? JSON.parse(await localforage.getItem("images")).profile[data['icon']['offline'].split(".")[0].split("-")[1]][data['icon']['offline'].split(".")[0].split("-")[2]] : (data['icon']['online'] ?? (data['id'] === "fusion" ? '/assets/logo/logo.png' : data['system']['icon']))}" alt="" style="background-color:rgba(255, 255, 255, .125);width:128px;height:128px;border-radius:5px;">
</div>
<div style="padding:10px 10px 10px 20px;text-align:center;">
<div id="mobile-left" style="padding:10px 10px 10px 20px;text-align:center;">
<h3 style="margin-bottom:0;">
<img id="member-icon-mobile" src="${offline ? JSON.parse(await localforage.getItem("images")).profile[data['icon']['offline'].split(".")[0].split("-")[1]][data['icon']['offline'].split(".")[0].split("-")[2]] : (data['icon']['online'] ?? (data['id'] === "fusion" ? '/assets/logo/logo.png' : data['system']['icon']))}" alt="" style="background-color:rgba(255, 255, 255, .125);width:36px;height:36px;border-radius:999px;display:none;margin-right:5px;">
<span style="vertical-align: middle;">
@ -72,7 +72,10 @@ async function refreshBanner(_, french) {
` : data['id'] === "fusion" ? (data['name'] === "fusion" ? `
<span class="text-muted">${french ? "Plusieurs membres fusionnés" : "Multiple merged members"}</span>
` : data['name']) : data['name']}
</span>
</span><span id="mobile-species" style="float: right; display: none;">
${data['species'].filter(i => i && i['name'] !== "_").map(species => `
<img data-bs-toggle="tooltip" title="${species['name']}" style="width:32px;vertical-align: middle;position:relative;top:-5px;" src="${offline ? species['icon_offline'] : `/assets/species/${species['icon']}`}" alt="${species['name']}">
`).join("")}</span>
</h3>
<div style="margin-bottom:0.5rem;">
@ -114,16 +117,17 @@ async function refreshBanner(_, french) {
` : ''}
${data['id'] !== "fusion" ? `
<span>
${data['id'] === "unknown" ? (french ? "<b>Espèce : </b> préférez demander" : "<b>Species: </b> best to ask") : `
<span class="member-small-only"><b>${french ? "Espèce :" : "Species:"} </b></span>
${data['species'].filter(i => i && i['name'] !== "_").map(species => `
<img data-bs-toggle="tooltip" title="${species['name']}" style="width:32px;vertical-align: middle;position:relative;top:-5px;" src="${offline ? species['icon_offline'] : `/assets/species/${species['icon']}`}" alt="${species['name']}">
`).join("")}`}
${data['id'] === "unknown" ? (french ? "<b>Genre : </b><span class=\"member-small-separator\"><br></span> préférez demander" : "<b>Gender: </b><span class=\"member-small-separator\"><br></span> best to ask") : `
<span><b>${french ? "Genre :" : "Gender:"} </b><span class="member-small-separator"><br></span></span>
${data['gender']}`}
</span>` : ''}
${data['id'] !== "fusion" ? `
<span>
<span class="member-small-only"><b>${french ? "Position :" : "Location:"} </b></span>
${data['system']['page'] ? `<a class="member-link" href="${data['system']['page']}"><img style="width:24px;" src="${offline ? data['system']['icon_offline'] : `${data['system']['icon']}`}"> ${data['system']['name']}</a>` : `<img style="width:24px;" src="${offline ? data['system']['icon_offline'] : `${data['system']['icon']}`}"> ${data['system']['name']}`}
${data['system']['page'] ? `<a class="member-link" href="${data['system']['page']}"><img style="width:24px;" src="${offline ? data['system']['icon_offline'] : `${data['system']['icon']}`}"> ${data['system']['name']}</a>` : `<img style="width:24px;" src="${offline ? data['system']['icon_offline'] : `${data['system']['icon']}`}"> ${data['system']['name']}`}<span class="member-small-separator"><br>
${data['species'].filter(i => i && i['name'] !== "_").map(species => `
<img data-bs-toggle="tooltip" title="${species['name']}" style="width:32px;vertical-align: middle;position:relative;top:-5px;" src="${offline ? species['icon_offline'] : `/assets/species/${species['icon']}`}" alt="${species['name']}">
`).join("")}</span>
</span>
` : ''}
</div>

@ -204,6 +204,14 @@ dd {
display: inline-block !important;
}
#mobile-left {
text-align: left !important;
}
#mobile-species {
display: inline-block !important;
}
#system-info {
grid-template-columns: 1fr !important;
}

@ -3,32 +3,31 @@
<div>
<b><?= $lang["details"]["food"] ?></b><span class="member-small-separator"><br></span>
<?= match ($metadata["food"]) {
0 => "<span data-bs-toggle='tooltip' title='" . ucfirst(str_replace("'", "&apos;", $pronouns["possessive_det"])) . " species indicates that " . str_replace("'", "&apos;", $pronouns["subjective"]) . ' ' . ($pronouns["third"] ? "doesn&apos;t" : "don&apos;t") . " need to eat food, therefore " . str_replace("'", "&apos;", $pronouns["subjective"]) . " can eat all foods.'>" . $lang["details"]["food_states"][0] . "</span>",
1 => "<span data-bs-toggle='tooltip' title='" . ucfirst(str_replace("'", "&apos;", $pronouns["subjective"])) . " can&apos;t eat fish or meat.'>" . $lang["details"]["food_states"][1] . "</span>",
2 => "<span data-bs-toggle='tooltip' title='" . ucfirst(str_replace("'", "&apos;", $pronouns["subjective"])) . " can&apos;t eat meat, but can eat fish.'>" . $lang["details"]["food_states"][2] . "</span>",
3 => "<span data-bs-toggle='tooltip' title='" . ucfirst(str_replace("'", "&apos;", $pronouns["subjective"])) . " can eat all foods, meat and fish included.'>" . $lang["details"]["food_states"][3] . "</span>",
0 => "<span data-bs-toggle='tooltip' title='This pony&apos;s species indicates that this pony doesn&apos;t need to eat food, therefore this pony can eat all foods.'>" . $lang["details"]["food_states"][0] . "</span>",
1 => "<span data-bs-toggle='tooltip' title='This pony can&apos;t eat fish or meat.'>" . $lang["details"]["food_states"][1] . "</span>",
2 => "<span data-bs-toggle='tooltip' title='This pony can&apos;t eat meat, but can eat fish.'>" . $lang["details"]["food_states"][2] . "</span>",
3 => "<span data-bs-toggle='tooltip' title='This pony can eat all foods, meat and fish included.'>" . $lang["details"]["food_states"][3] . "</span>",
} ?>
</div>
<div>
<b><?= $lang["details"]["memory"] ?></b><span class="member-small-separator"><br></span>
<?= match ($metadata["shared_memory"]) {
0 => "<span data-bs-toggle='tooltip' title='" . str_replace("'", "&apos;", ucfirst($pronouns["subjective"])) . ($pronouns["third"] ? " doesn&apos;t directly share" : " don&apos;t directly share") . " memory with " . str_replace("'", "&apos;", $pronouns["possessive_det"]) . " headmates, but is able to (slowly) query it if that is needed.'>" . $lang["details"]["memory_states"][0] . "</span>",
1 => "<span data-bs-toggle='tooltip' title='" . str_replace("'", "&apos;", ucfirst($pronouns["subjective"])) . ($pronouns["third"] ? " doesn&apos;t directly shares" : " don&apos;t directly share") . " all memories with " . str_replace("'", "&apos;", $pronouns["possessive_det"]) . " headmates, but may be able to share certain memories and/or share memories at will.'>" . $lang["details"]["memory_states"][1] . "</span>",
2 => "<span data-bs-toggle='tooltip' title='" . str_replace("'", "&apos;", ucfirst($pronouns["subjective"])) . ($pronouns["third"] ? " shares" : " share") . " all memories with " . str_replace("'", "&apos;", $pronouns["possessive_det"]) . " headmates.'>" . $lang["details"]["memory_states"][2] . "</span>",
0 => "<span data-bs-toggle='tooltip' title='This pony doesn&apos;t directly share memories with this pony&apos;s headmates, b, but is able to (slowly) query them if that is needed.'>" . $lang["details"]["memory_states"][0] . "</span>",
1 => "<span data-bs-toggle='tooltip' title='This pony doesn&apos;t directly share memories with this pony&apos;s headmates, but may be able to share certain memories and/or share memories at will.'>" . $lang["details"]["memory_states"][1] . "</span>",
2 => "<span data-bs-toggle='tooltip' title='This pony shares all memories with this pony&apos;s headmates.'>" . $lang["details"]["memory_states"][2] . "</span>",
} ?>
</div>
<?php if ($isLoggedIn || $isLowerLoggedIn): ?>
<div>
<b>Age:</b><span class="member-small-separator"><br></span>
<?php if (!isset($metadata["birth"]["year"]) || $metadata["birth"]["age"] > 0): ?>
<?php if ($metadata["birth"]["age"] === -1): $age = abs(log(0)); // => INF ?>
<?= "<span data-bs-toggle='tooltip' title='" . str_replace("'", "&apos;", ucfirst($pronouns["subjective"])) . " never age" . str_replace("'", "&apos;", $pronouns["third"] ? "s" : "") . " and " . str_replace("'", "&apos;", $pronouns["third"] ? "doesn't" : "don't") . " have a defined age, making " . str_replace("'", "&apos;", $pronouns["object"]) . " pretty much eternal.'>Eternal</span>" ?>
<?= "<span data-bs-toggle='tooltip' title='This pony never ages and doesn&apos;t have a defined age, making this pony pretty much eternal.'>Eternal</span>" ?>
<?php elseif ($metadata["birth"]["age"] <= 0): ?>
-
<?php else: $age = $metadata["birth"]["age"]; if (is_numeric($metadata["birth"]["age"])): ?>
<?= "<span data-bs-toggle='tooltip' title='" . str_replace("'", "&apos;", ucfirst($pronouns["subjective"])) . str_replace("'", "&apos;", $pronouns["third"] ? " doesn't" : " don't") . " age like the body does, making " . str_replace("'", "&apos;", $pronouns["object"]) . " stay " . $metadata["birth"]["age"] . " years old for " . str_replace("'", "&apos;", $pronouns["possessive_det"]) . " entire life.'>" . $metadata["birth"]["age"] . "* years old</span>" ?>
<?= "<span data-bs-toggle='tooltip' title='This pony doesn&apos;t age like the body does, making this pony stay " . $metadata["birth"]["age"] . " years old for this pony&apos;s entire life.'>" . $metadata["birth"]["age"] . "* years old</span>" ?>
<?php else: ?>
<?= "<span data-bs-toggle='tooltip' title='" . str_replace("'", "&apos;", ucfirst($pronouns["object"])) . " age " . str_replace("'", "&apos;", $pronouns["third"] ? " changes" : " change") . " frequently between " . explode("-", $metadata["birth"]["age"])[0] . " and " . explode("-", $metadata["birth"]["age"])[1] . " years old, and " . str_replace("'", "&apos;", $pronouns["subjective"]) . " " . str_replace("'", "&apos;", $pronouns["third"] ? " doesn't" : " don't") . " have a single defined age.'>Sliding " . explode("-", $metadata["birth"]["age"])[0] . " to " . explode("-", $metadata["birth"]["age"])[1] . "</span>" ?>
<?= "<span data-bs-toggle='tooltip' title='This pony&apos;s age changes frequently between " . explode("-", $metadata["birth"]["age"])[0] . " and " . explode("-", $metadata["birth"]["age"])[1] . " years old, and this &apos;t have a single defined age.'>Sliding " . explode("-", $metadata["birth"]["age"])[0] . " to " . explode("-", $metadata["birth"]["age"])[1] . "</span>" ?>
<?php endif; endif; ?>
<?php else: ?>
<?php if ($metadata["birth"]["year"] <= 1900): ?>
@ -50,12 +49,11 @@
}
?>
<?= "<span data-bs-toggle='tooltip' title='$age2 with the old algorithm | " . str_replace("'", "&apos;", ucfirst($pronouns["subjective"])) . " age" . str_replace("'", "&apos;", $pronouns["third"] ? "s" : "") . " like the body does, making " . str_replace("'", "&apos;", $pronouns["object"]) . " stay " . $age . " years old for now, having this age change $birthday.'>" . $age . " years old</span>" ?>
<?= "<span data-bs-toggle='tooltip' title='$age2 with the old algorithm | This pony ages like the body does, making this pony stay " . $age . " years old for now, having this age change $birthday.'>" . $age . " years old</span>" ?>
<?php endif; ?>
<?php endif; ?>
</div>
<?php endif; ?>
<?php if ($systemID !== $app["other"]["id"]): ?>
<?php if ($systemID !== $app["other"]["id"]): if ($isLoggedIn || $isLowerLoggedIn): ?>
<div>
<b><?= $lang["details"]["code"] ?></b><span class="member-small-separator"><br></span>
<?php if (isset($metadata["code"]) && trim($metadata["code"]) !== ""): ?>
@ -64,6 +62,7 @@
-
<?php endif; ?>
</div>
<?php endif; ?>
<div>
<b>Primary interest:</b><span class="member-small-separator"><br></span>
<?php if (isset($metadata["interest"]) && trim($metadata["interest"]) !== ""): ?>
@ -72,7 +71,7 @@
-
<?php endif; ?>
</div>
<?php endif; ?>
<?php endif ?>
<?php if ($systemID !== $app["other"]["id"]): ?>
</div>
<?php endif; ?>
@ -80,19 +79,19 @@
<?php if ($systemID !== $app["other"]["id"]): ?>
<div id="member-details-2" style="background-color: <?= isset($memberData["color"]) ? '#' . $memberData["color"] . "33" : "transparent" ?>; margin-left: -20px; margin-right: -20px;<?php if ($isLowerLoggedIn): ?>grid-template-columns: repeat(3, 1fr);<?php endif; ?>">
<?php endif; ?>
<?php if (((isset($age) && $age >= 16 && $metadata["little"] === 0) || (!isset($age) && $metadata["little"] === 0)) || $metadata["sexual_features"]): ?>
<?php $age2 = $age ?? 0; if (is_string($age2)) $age2 = (int)(explode("-", $age2)[1] ?? "0"); if (((isset($age2) && $age2 >= 16 && $metadata["little"] === 0) || (!isset($age2) && $metadata["little"] === 0)) || $metadata["sexual_features"]): ?>
<?php if ($isLoggedIn && $systemID !== $app["other"]["id"]): ?>
<div>
<span style="vertical-align: middle;">
<b>Sexual consent:</b><span class="member-small-separator"><br></span>
<?php if ($metadata["sexually_active"]): ?>
<span title="Consent is assumed when having sex with <?= $pronouns["object"] ?>, however <?= $pronouns["subjective"] ?> may ask to not have sex at the moment and such request must be honored." data-bs-toggle="tooltip">Preemptive</span>
<span title="Consent is assumed when having sex with this pony, however this pony may ask to not have sex at the moment and such request must be honored." data-bs-toggle="tooltip">Preemptive</span>
<?php else: ?>
<span title="Consent is absolutely required every time when having sex with <?= $pronouns["object"] ?>." data-bs-toggle="tooltip">Required</span>
<span title="Consent is absolutely required every time when having sex with this pony." data-bs-toggle="tooltip">Required</span>
<?php endif; ?>
</span>
<?php if (!((isset($age) && $age >= 16 && $metadata["little"] === 0) || (!isset($age) && $metadata["little"] === 0))): ?>
<img src="/assets/icons/warning.svg" style="width: 16px;" title="Although this pony is able to engage in sexual relationships, they are not allowed to have sex with ponies who are over 16 years old." data-bs-toggle="tooltip">
<img src="/assets/icons/warning.svg" style="width: 16px;" title="Although this pony is able to engage in sexual relationships, this pony is not allowed to have sex with ponies who are over 16 years old." data-bs-toggle="tooltip">
<?php endif; ?>
</div>
<?php endif; ?>
@ -126,7 +125,7 @@
grid-template-columns: <?= $isLowerLoggedIn ? "1fr 1fr 1fr" : "2fr 1fr 1fr" ?>;
}
</style>
<div style="display: flex; align-items: center; justify-content: center; height: 100%;opacity:.5;">This member is too young to be in a sexual relationship.</div>
<div style="display: flex; align-items: center; justify-content: center; height: 100%;opacity:.5;">This pony is too young to be in a sexual relationship.</div>
</div>
<?php endif; ?>
<div>

@ -120,7 +120,7 @@ if ($memberData["name"] === "fusion") {
</ul>
</li>
<li><b>Date added:</b> <?= date('l j F Y', strtotime($memberData["created"])) ?> (<?= timeAgo($memberData["created"]) ?>, <code><?= $memberData["created"] ?></code>)</li>
<li><b>Pronouns:</b> <?= implode(", ", getPronounsFromMark($memberData['pronouns'])) ?></li>
<li><b>Pronouns:</b> <?= $memberData['pronouns'] ?></li>
<li><b>Pronouns usage:</b> <ul><?php
foreach (getMemberPronouns($memberData['pronouns']) as $type => $usage) {

@ -83,6 +83,10 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $member
</select>
</div>
</div>
<p>
<b>Gender</b><br>
<input name="gender" class="form-control" style="filter: invert(1) hue-rotate(180deg);" type="text" value="<?= $metadata["gender"] ?? "" ?>">
</p>
<hr>
@ -132,7 +136,7 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $member
</p>
<p>
<b>Age (for ponies with fixed age)</b><br>
<input name="age" class="form-control" style="filter: invert(1) hue-rotate(180deg);" type="text" pattern="^\d{1,2}(-\d{1,2}|)$" value="<?= $metadata["birth"]["age"] ?? "" ?>">
<input name="age" class="form-control" style="filter: invert(1) hue-rotate(180deg);" type="text" pattern="^(-\d{1,2}|\d{1,2}(-\d{1,2}|))$" value="<?= $metadata["birth"]["age"] ?? "" ?>">
</p>
<hr>

@ -3,6 +3,7 @@
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $lang; global $pages;
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/pronouns.inc";
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc";
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/Parsedown.php"; $Parsedown = new Parsedown();
$travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling/travelling.json"), true);
@ -21,11 +22,13 @@ function getMemberBannerData(string $id, string $system, bool $french = false) {
global $travelling;
global $isLoggedIn;
global $lang;
global $Parsedown;
$french = $lang["_french"];
$member = getSystemMember($system, $id);
$metadata = file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$id.json") ? parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$id.json"), true)) : parseMetadata([
// FIXME: This doesn't work now that bitset functionality is removed
"bitset" => 4196352,
"regression" => null,
"median" => null,
@ -463,9 +466,10 @@ function getMemberBannerData(string $id, string $system, bool $french = false) {
'median' => $metadata["median"],
'little' => $metadata["little"] >= 2,
'name' => $member["display_name"] ?? $member["name"],
'gender' => isset($metadata["gender"]) && trim($metadata["gender"]) !== "" ? $Parsedown->text($metadata["gender"]) : "Agender",
'badges' => $badges,
'prefixes' => $prefixes,
'pronouns' => getTooltipsFromMark($member["pronouns"], $french) ?? "<span data-bs-toggle='tooltip' title='Pronouns not specified' class='text-muted'>they/them</span>",
'pronouns' => isset($member["pronouns"]) && trim($member["pronouns"]) !== "" ? $member["pronouns"] : "<i>they/them</i>",
'pronouns_usage' => getMemberPronouns($member['pronouns']),
'last_fronted' => $lastFronted,
'species' => $speciesList,

@ -11,6 +11,10 @@ function parseMetadata ($metadata) {
$age = (int)date('Y') - $metadata["birth"]["year"] + (strtotime(date('Y') . "-" . $metadata["birth"]["date"]) <= time() ? 0 : -1);
}
if (is_string($age) && isset(explode("-", $age)[1]) && is_numeric(explode("-", $age)[1])) {
$age = (int)explode("-", $age)[1];
}
if ($age > 0 && $age <= 10) {
$metadata["little"] = 2;
} else if ($age > 0 && $age <= 15) {

@ -1,149 +1,16 @@
<?php
$pronounsSets = [
"pony" => [
"gender" => "ponygender",
"gender:fr" => "poneygenre",
"object" => "pony",
function getMemberPronouns(?string $pronouns): ?array {
return [
"gender" => "invalid",
"gender:fr" => "invalide",
"object" => "this pony",
"person" => "pony",
"possessive_det" => "pony's",
"possessive_pro" => "pony's",
"reflexive" => "ponyself",
"subjective" => "pony",
"third" => true,
"color" => "warning"
],
"she" => [
"gender" => "female",
"gender:fr" => "fille",
"object" => "her",
"person" => "girl",
"possessive_det" => "her",
"possessive_pro" => "hers",
"reflexive" => "herself",
"subjective" => "she",
"possessive_det" => "this pony's",
"possessive_pro" => "this pony's",
"reflexive" => "this pony",
"subjective" => "this pony",
"third" => true,
"color" => "success"
],
"he" => [
"gender" => "male",
"gender:fr" => "garçon",
"object" => "him",
"person" => "boy",
"possessive_det" => "his",
"possessive_pro" => "his",
"reflexive" => "himself",
"subjective" => "he",
"third" => true,
"color" => "info"
],
"it" => [
"gender" => "agender",
"gender:fr" => "agenre",
"object" => "it",
"person" => "person",
"possessive_det" => "its",
"possessive_pro" => "its",
"reflexive" => "itself",
"subjective" => "it",
"third" => true,
"color" => "light"
],
"they" => [
"gender" => "non binary",
"gender:fr" => "non binaire",
"object" => "them",
"person" => "person",
"possessive_det" => "their",
"possessive_pro" => "theirs",
"reflexive" => "themself",
"subjective" => "they",
"third" => false,
"color" => "primary"
]
];
$pronounGetCount = 0;
$possibilitiesPerSet = [];
foreach ($pronounsSets as $name => $set) {
if (!isset($possibilitiesPerSet[$name])) $possibilitiesPerSet[$name] = [];
$possibilitiesPerSet[$name][] = $name;
foreach ($set as $category => $value) {
if (is_string($value)) $possibilitiesPerSet[$name][] = $value;
}
}
function getSetFromValue(string $value) {
global $possibilitiesPerSet;
foreach ($possibilitiesPerSet as $name => $set) {
if (in_array($value, $set)) {
return $name;
}
}
return null;
}
function getPronounsFromMark(?string $mark = null): array {
if (!isset($mark) || trim($mark) === "") {
return ["they"];
} else {
$parts = array_unique(array_map(function ($i) {
return getSetFromValue($i);
}, explode("/", $mark)));
return $parts;
}
}
function getMemberPronouns(?string $pronouns): ?array {
global $pronounsSets;
$list = getPronounsFromMark($pronouns);
return $pronounsSets[$list[array_rand($list)]] ?? $pronounsSets["she"];
}
function getGenderFromPronoun(string $pronoun, bool $french = false) {
global $pronounsSets;
$set = getPronounsFromMark($pronoun)[0];
if ($french) {
return ($pronounsSets[$set] ?? $pronounsSets["they"])["gender:fr"];
} else {
return ($pronounsSets[$set] ?? $pronounsSets["they"])["gender"];
}
}
function pronounInFrench(string $pronoun): string {
return match ($pronoun) {
"she" => "elle",
"her" => "elle",
"he" => "il",
"him" => "lui",
"they" => "iel",
"them" => "iel",
"it" => "iel",
"its" => "iel",
"pony" => "poney",
"pony's" => "à poney",
"ponys" => "à poney",
default => $pronoun,
};
}
function getTooltipsFromMark(string $mark = null, bool $french = false): ?string {
if (!isset($mark)) {
return null;
} else {
if ($french) {
return implode("/", array_map(function ($i) {
return "<span title='" . ucfirst(getGenderFromPronoun($i, true)) . "' data-bs-toggle='tooltip'>" . pronounInFrench($i) . "</span>";
}, explode("/", $mark)));
} else {
return implode("/", array_map(function ($i) {
return "<span title='" . ucfirst(getGenderFromPronoun($i, false)) . "' data-bs-toggle='tooltip'>" . $i . "</span>";
}, explode("/", $mark)));
}
}
];
}

@ -80,6 +80,9 @@ if (!isset($_GET["t"])) {
<?php
die();
case "unique":
header("Content-Type: text/plain");
die("Chromebook-" . strtoupper(substr(sha1($_COOKIE['PEH2_SESSION_TOKEN']), 0, 5)));
default:
header("Location: /");
die();

@ -1,7 +1,8 @@
<?php
if (isset($_GET["chrome"])) {
header("Access-Control-Allow-Origin: chrome-extension://klenhenmabddpffgdaijdkjmfkkafbno");
header("Access-Control-Allow-Origin: chrome-extension://" . preg_replace("/[^a-z]/m", "", $_GET["chrome"]));
header("Access-Control-Allow-Credentials: true");
}
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $_PROFILE;

@ -43,20 +43,20 @@ $lastFronter = json_decode(@file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/incl
if ($input["type"] === "CREATE_SWITCH" || $input["type"] === "UPDATE_SWITCH" || $input["type"] === "DELETE_SWITCH") {
if ($system === $app["other"]["id"]) {
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/fronters.json", file_get_contents("https://pluralkit.equestria.dev/v2/systems/$input[system_id]/fronters"), false, stream_context_create([
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/fronters.json", file_get_contents("https://pluralkit.equestria.dev/v2/systems/$input[system_id]/fronters", false, stream_context_create([
'http' => [
'method' => 'GET',
'header' =>
"Authorization: " . $app["other"]["token"] . "\r\n"
]
]));
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/switches.json", file_get_contents("https://pluralkit.equestria.dev/v2/systems/$input[system_id]/switches"), false, stream_context_create([
])));
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/switches.json", file_get_contents("https://pluralkit.equestria.dev/v2/systems/$input[system_id]/switches", false, stream_context_create([
'http' => [
'method' => 'GET',
'header' =>
"Authorization: " . $app["other"]["token"] . "\r\n"
]
]));
])));
} else {
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/fronters.json", file_get_contents("https://pluralkit.equestria.dev/v2/systems/$input[system_id]/fronters"));
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/switches.json", file_get_contents("https://pluralkit.equestria.dev/v2/systems/$input[system_id]/switches"));

@ -82,7 +82,7 @@ foreach ([1, 2] as $_) {
$errors[] = "0x{$_}000002B: Image #" . $_ . " is higher than it should, are you sure you set zoom to 1x? Maybe you inverted the files?";
}
if ($_ === 2 && $size[0] > 35) {
if ($_ === 2 && $size[0] > 40) {
$errors[] = "0x{$_}000002A: Image #" . $_ . " is wider than it should, are you sure you set zoom to 1x? Maybe you inverted the files?";
}

@ -69,7 +69,7 @@ if (str_ends_with($computer["os"], "unknown")) {
<?php if ($computer["luna_version"] === "1.0.0"): ?>
<div class="alert alert-danger">
<p><b>We are unable to give you access to this computer.</b></p>
<p>This computer is running Luna version 1.0.0. This version of Luna is considered malware because of inconspicuous behavior and is therefore not usable anymore and has been disabled. This means you cannot access this computer at the moment.</p>
<p>This computer is running xsion 1.0.0. This version of Luna is considered malware because of inconspicuous behavior and is therefore not usable anymore and has been disabled. This means you cannot access this computer at the moment.</p>
Update this computer to run Luna 1.1.0 or newer and try again.
</div>
<?php else: ?>
@ -93,7 +93,23 @@ if (str_ends_with($computer["os"], "unknown")) {
</style>
<div style="display: grid; grid-template-columns: 256px 1fr; grid-column-gap: 30px;" id="g-0">
<div style="display: flex; align-items: center;">
<img style="width: 256px;" src="https://ponies.equestria.horse/api/data?f=computers/screens/<?= $id . "-" . $computer["screens"][0]["id"] ?>.jpg">
<img style="width: 256px;" src="<?php
if (isset($computer["dsb"])) {
switch ($computer["dsb"]["platform"]) {
case "chrome":
echo("https://upload.wikimedia.org/wikipedia/en/3/3e/ChromeOS_screenshot.png");
break;
default:
echo("https://ponies.equestria.horse/api/data?f=computers/screens/" . $id . "-" . $computer["screens"][0]["id"] . ".jpg");
break;
}
} else {
echo("https://ponies.equestria.horse/api/data?f=computers/screens/" . $id . "-" . $computer["screens"][0]["id"] . ".jpg");
}
?>">
</div>
<div style="display: flex; align-items: center;">
<table>
@ -104,7 +120,26 @@ if (str_ends_with($computer["os"], "unknown")) {
</tr>
<tr>
<td style="padding-right: 10px; text-align: right;"><b>Luna version:</b></td>
<td><?= $computer["luna_version"] ?></td>
<td><?= $computer["luna_version"] ?><?php if (isset($computer["dsb"])): ?> (<?php switch ($computer["dsb"]["platform"]) {
case "chrome":
echo("Chrome ");
break;
case "desktop":
echo("Desktop ");
break;
case "android":
echo("Android ");
break;
case "server":
echo("server ");
break;
default:
break;
} ?> DSB <?= $computer["dsb"]["version"] ?? 0 ?>)<?php endif; ?></td>
</tr>
<tr>
<td style="padding-right: 10px; text-align: right;"><b>System:</b></td>
@ -123,7 +158,7 @@ if (str_ends_with($computer["os"], "unknown")) {
<?php if (timeAgo($computer["date"]) === "now"): ?>
<td>Online</td>
<?php else: ?>
<td>Offline since <?= timeAgo($computer["date"]) ?>, <?= date('j M, g:ia (T)', strtotime($computer["date"])) ?></td>
<td>Offline since <?= timeAgo($computer["date"]) ?>: <?= date('j M, g:ia (T)', strtotime($computer["date"])) ?></td>
<?php endif; ?>
</tr>
</tbody>
@ -142,14 +177,15 @@ if (str_ends_with($computer["os"], "unknown")) {
<tr>
<td style="padding-right: 10px; text-align: right;"><b>Processor threading:</b></td>
<td>
<?= $computer["cpu"]["processors"] ?> processor<?= $computer["cpu"]["processors"] > 1 ? "s" : "" ?>,
<?= $computer["cpu"]["physicalCores"] ?> core<?= $computer["cpu"]["physicalCores"] > 1 ? "s" : "" ?><?= isset($computer["cpu"]["efficiencyCores"]) ? " (" . $computer["cpu"]["efficiencyCores"] . " efficiency, " . $computer["cpu"]["performanceCores"] . " performance)" : "" ?>,
<?= $computer["cpu"]["cores"] ?> thread<?= $computer["cpu"]["cores"] > 1 ? "s" : "" ?></td>
<?php if ($computer["cpu"]["processors"] > 1): ?><?= $computer["cpu"]["processors"] ?> processor<?= $computer["cpu"]["processors"] > 1 ? "s" : "" ?>,
<?php endif; ?><?= $computer["cpu"]["physicalCores"] ?> core<?= $computer["cpu"]["physicalCores"] > 1 ? "s" : "" ?><?= isset($computer["cpu"]["efficiencyCores"]) && isset($computer["cpu"]["performanceCores"]) && $computer["cpu"]["efficiencyCores"] !== 0 && $computer["cpu"]["performanceCores"] !== 0 ? " (" . $computer["cpu"]["efficiencyCores"] . " efficiency, " . $computer["cpu"]["performanceCores"] . " performance)" : "" ?><?php if ($computer["cpu"]["cores"] !== $computer["cpu"]["physicalCores"]): ?>,
<?= $computer["cpu"]["cores"] ?> thread<?= $computer["cpu"]["cores"] > 1 ? "s" : "" ?><?php endif; ?></td>
</tr>
<tr>
<td style="padding-right: 10px; text-align: right;"><b>Hardware virtualization:</b></td>
<td><?= $computer["cpu"]["virtualization"] ? "Capable" : "Disabled" ?></td>
<td><?= isset($computer["cpu"]["virtualization"]) ? ($computer["cpu"]["virtualization"] ? "Capable" : "Disabled") : "Unknown" ?></td>
</tr>
<?php if (isset($computer["cpu"]["cache"])): ?>
<tr>
<td style="padding-right: 10px; text-align: right;"><b>Level 1 cache:</b></td>
<td><?= round($computer["cpu"]["cache"]["l1i"] / 1024, 2) ?> KiB (instruction), <?= round($computer["cpu"]["cache"]["l1d"] / 1024, 2) ?> KiB (data)</td>
@ -162,7 +198,9 @@ if (str_ends_with($computer["os"], "unknown")) {
<td style="padding-right: 10px; text-align: right;"><b>Level 3 cache:</b></td>
<td><?= isset($computer["cpu"]["cache"]["l3"]) ? round($computer["cpu"]["cache"]["l3"] / 1024**2, 2) . " MiB" : "Not supported" ?></td>
</tr>
<tr>
<?php endif; ?>
<?php if (isset($computer["gpu"])): ?>
<?php if (isset($computer["gpu"]["controllers"]) && isset($computer["gpu"]["controllers"][0])): ?><tr>
<td style="padding-right: 10px; text-align: right;"><b>Graphics processor<?= count($computer["gpu"]["controllers"]) > 1 ? "s" : "" ?>:</b></td>
<td>
<?php $index = 0; foreach ($computer["gpu"]["controllers"] as $controller): ?>
@ -170,7 +208,7 @@ if (str_ends_with($computer["os"], "unknown")) {
<?= $index < count($computer["gpu"]["controllers"]) - 1 ? "<br>" : "" ?>
<?php $index++; endforeach; ?>
</td>
</tr>
</tr><?php endif; ?>
<tr>
<td style="padding-right: 10px; text-align: right;"><b>Display<?= count($computer["gpu"]["displays"]) > 1 ? "s" : "" ?>:</b></td>
<td>
@ -180,6 +218,7 @@ if (str_ends_with($computer["os"], "unknown")) {
<?php $index++; endforeach; ?>
</td>
</tr>
<?php endif; ?>
<tr>
<td colspan="2"><h4 style="margin-top: 20px;margin-bottom: 10px;">System memory</h4></td>
@ -188,15 +227,15 @@ if (str_ends_with($computer["os"], "unknown")) {
<td style="padding-right: 10px; text-align: right;"><b>Physical memory:</b></td>
<td><?= round($computer["ram"]["total"] / 1024**3, 2) ?> GiB (<?= round($computer["ram"]["used"] / 1024**2, 2) ?> MiB used, <?= round($computer["ram"]["free"] / 1024**2, 2) ?> MiB free)</td>
</tr>
<tr>
<?php if (isset($computer["ram"]["active"]) && isset($computer["ram"]["available"]) && isset($computer["ram"]["buffcache"])): ?><tr>
<td style="padding-right: 10px; text-align: right;"><b>Memory usage:</b></td>
<td><?= round($computer["ram"]["active"] / 1024**2, 2) ?> MiB active, <?= round($computer["ram"]["available"] / 1024**2, 2) ?> MiB available, <?= round($computer["ram"]["buffcache"] / 1024**2, 2) ?> MiB cache</td>
</tr>
<tr>
</tr><?php endif; ?>
<?php if (isset($computer["ram"]["swaptotal"]) && isset($computer["ram"]["swapused"])): ?><tr>
<td style="padding-right: 10px; text-align: right;"><b>Swap memory:</b></td>
<td><?= round($computer["ram"]["swaptotal"] / 1024**3, 2) ?> GiB (<?= round($computer["ram"]["swapused"] / 1024**2, 2) ?> MiB used, <?= round($computer["ram"]["swapfree"] / 1024**2, 2) ?> MiB free)</td>
</tr>
<tr>
</tr><?php endif; ?>
<?php if (isset($computer["ram_chips"])): ?><tr>
<td style="padding-right: 10px; text-align: right;"><b>RAM chips:</b></td>
<td>
<?php $index = 0; foreach ($computer["ram_chips"] as $chip): ?>
@ -204,11 +243,12 @@ if (str_ends_with($computer["os"], "unknown")) {
<?= $index < count($computer["ram_chips"]) - 1 ? "<br>" : "" ?>
<?php $index++; endforeach; ?>
</td>
</tr>
</tr><?php endif; ?>
<tr>
<td colspan="2"><h4 style="margin-top: 20px;margin-bottom: 10px;">Battery</h4></td>
</tr>
<?php if (isset($computer["battery"])): ?>
<?php if ($computer["battery"]["hasBattery"]): ?>
<tr>
<td style="padding-right: 10px; text-align: right;"><b>Battery model:</b></td>
@ -226,7 +266,7 @@ if (str_ends_with($computer["os"], "unknown")) {
<td style="padding-right: 10px; text-align: right;"><b>Remaining capacity:</b></td>
<td><?= $computer["battery"]["currentCapacity"] ?>/<?= $computer["battery"]["maxCapacity"] ?> <?= $computer["battery"]["capacityUnit"] ?> (designed for <?= $computer["battery"]["designedCapacity"] ?> <?= $computer["battery"]["capacityUnit"] ?><?php if ($computer["battery"]["designedCapacity"] > 0): ?>, <?= round(($computer["battery"]["maxCapacity"] / $computer["battery"]["designedCapacity"]) * 100, 2) ?>% left<?php endif; ?>)</td>
</tr>
<?php else: ?><tr><td colspan="2">This computer does not contain a battery.</td></tr><?php endif; ?>
<?php else: ?><tr><td colspan="2">This computer does not contain a battery.</td></tr><?php endif; ?><?php else: ?><tr><td colspan="2">This operating system does not support reporting battery info.</td></tr><?php endif; ?>
<tr>
<td colspan="2"><h4 style="margin-top: 20px;margin-bottom: 10px;">Operating system</h4></td>
@ -243,10 +283,12 @@ if (str_ends_with($computer["os"], "unknown")) {
<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"]): ?>
<tr>
<td style="padding-right: 10px; text-align: right;"><b>Code page:</b></td>
<td><?= $computer["os_info"]["codepage"] ?></td>
</tr>
<?php endif; ?>
<tr>
<td style="padding-right: 10px; text-align: right;"><b>Build number:</b></td>
<td><?= $computer["os_info"]["build"] === "rolling" ? "Rolling release" : $computer["os_info"]["build"] ?></td>
@ -255,10 +297,12 @@ if (str_ends_with($computer["os"], "unknown")) {
<td style="padding-right: 10px; text-align: right;"><b>Serial number:</b></td>
<td><?= $computer["os_info"]["serial"] ?></td>
</tr>
<?php if (isset($computer["os_info"]["uefi"])): ?>
<tr>
<td style="padding-right: 10px; text-align: right;"><b>Startup interface:</b></td>
<td><?= $computer["os_info"]["uefi"] ? "UEFI" : "BIOS (legacy)" ?></td>
</tr>
<?php endif; ?>
<tr>
<td colspan="2"><h4 style="margin-top: 20px;margin-bottom: 10px;">Software versions</h4></td>
@ -305,12 +349,15 @@ if (str_ends_with($computer["os"], "unknown")) {
</tbody>
</table>
<?php if (!isset($computer["remote_control"]) || $computer["remote_control"] === true): ?>
<h4 style="margin-top: 20px;margin-bottom: 10px;" id="screens">Remote control</h4>
<p id="page-content">
You can remotely control this computer. <a href="./<?= $id ?>/control">Open remote control.</a><br>
<small class="text-muted">Note: The user of this computer will need to approve your connection request before you can see and control their screen.</small>
</p>
<?php endif; ?>
<?php if (count($computer["users"]) > 0): ?>
<h4 style="margin-top: 20px;margin-bottom: 10px;">Sessions</h4>
<table class="table">
<thead>
@ -334,7 +381,9 @@ if (str_ends_with($computer["os"], "unknown")) {
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
<?php if (count($computer["filesystems"]) > 0): ?>
<h4 style="margin-top: 20px;margin-bottom: 10px;">Filesystems</h4>
<table class="table">
<thead>
@ -366,7 +415,9 @@ if (str_ends_with($computer["os"], "unknown")) {
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
<?php if (isset($computer["audio"])): ?>
<h4 style="margin-top: 20px;margin-bottom: 10px;">Audio devices</h4>
<table class="table">
<thead>
@ -390,7 +441,9 @@ if (str_ends_with($computer["os"], "unknown")) {
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
<?php if (isset($computer["network"])): ?>
<h4 style="margin-top: 20px;margin-bottom: 10px;">Network cards</h4>
<table class="table">
<thead>
@ -437,7 +490,9 @@ if (str_ends_with($computer["os"], "unknown")) {
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
<?php if (isset($computer["connections"])): ?>
<h4 style="margin-top: 20px;margin-bottom: 10px;">Network connections</h4>
<table class="table">
<thead>
@ -499,6 +554,7 @@ if (str_ends_with($computer["os"], "unknown")) {
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
<h4 style="margin-top: 20px;margin-bottom: 10px;">Processes</h4>
<table class="table">
@ -520,7 +576,7 @@ if (str_ends_with($computer["os"], "unknown")) {
<td><?= round($process["cpu"], 2) ?>%</td>
<td><?= round($process["ram"], 2) ?>%</td>
<td><?= $process["user"] ?></td>
<td><?= timeAgo($process["date"]) ?></td>
<td><?= isset($process["date"]) ? timeAgo($process["date"]) : "" ?></td>
</tr>
<?php endforeach; ?>
</tbody>
@ -823,7 +879,23 @@ if (str_ends_with($computer["os"], "unknown")) {
?>
<a href="/-/computers/<?= $id ?>" class="list-group-item list-group-item-action" style="display: grid; grid-template-columns: 100px 1fr; grid-column-gap: 10px;">
<div style="display: flex; align-items: center;">
<img style="width: 100px;" src="https://ponies.equestria.horse/api/data?f=computers/screens/<?= $id . "-" . $computer["screens"][0]["id"] ?>.jpg">
<img style="width: 100px;" src="<?php
if (isset($computer["dsb"])) {
switch ($computer["dsb"]["platform"]) {
case "chrome":
echo("https://upload.wikimedia.org/wikipedia/en/3/3e/ChromeOS_screenshot.png");
break;
default:
echo("https://ponies.equestria.horse/api/data?f=computers/screens/" . $id . "-" . $computer["screens"][0]["id"] . ".jpg");
break;
}
} else {
echo("https://ponies.equestria.horse/api/data?f=computers/screens/" . $id . "-" . $computer["screens"][0]["id"] . ".jpg");
}
?>">
</div>
<div style="display: flex; align-items: center;">
<div>
@ -835,10 +907,6 @@ if (str_ends_with($computer["os"], "unknown")) {
</a>
<?php endforeach; ?>
</ul>
<div id="page-content" style="margin-top: 10px;">
<a href="https://static.equestria.horse/luna-cros.crx">Install Chrome OS extension</a>
</div>
</div>
<?php endif; ?>
</div>

@ -95,6 +95,10 @@ if ($member === null) {
$toUpdate["interest"] = strip_tags($_GET["interest"]);
}
if (isset($_GET["gender"])) {
$toUpdate["gender"] = strip_tags($_GET["gender"]);
}
$regex = "/^(ynmuc|gdapd|" . $app["other"]["id"] . ")\/[a-z]{5}$/m";
if (isset($_GET["marefriends"])) {

Loading…
Cancel
Save