From 940defd2939f52480ed5b548189b549457944995 Mon Sep 17 00:00:00 2001 From: RaindropsSys Date: Wed, 15 Mar 2023 22:40:55 +0100 Subject: Updated 14 files (automated) --- assets/logo/banner.js | 20 +++-- assets/logo/custom.css | 8 ++ includes/components/details.inc | 39 +++++---- includes/fragments/member.inc | 2 +- includes/fragments/metadata.inc | 6 +- includes/util/banner.inc | 6 +- includes/util/bitset.inc | 4 + includes/util/pronouns.inc | 153 +++--------------------------------- pages/api/chrome.php | 3 + pages/api/computer.php | 3 +- pages/api/pluralkit-integration.php | 8 +- pages/api/ponytown.php | 2 +- pages/computers.inc | 114 +++++++++++++++++++++------ pages/metadata.inc | 4 + 14 files changed, 169 insertions(+), 203 deletions(-) diff --git a/assets/logo/banner.js b/assets/logo/banner.js index 3f41912..02a8298 100644 --- a/assets/logo/banner.js +++ b/assets/logo/banner.js @@ -63,7 +63,7 @@ async function refreshBanner(_, french) { -
+

@@ -72,7 +72,10 @@ async function refreshBanner(_, french) { ` : data['id'] === "fusion" ? (data['name'] === "fusion" ? ` ${french ? "Plusieurs membres fusionnés" : "Multiple merged members"} ` : data['name']) : data['name']} - +

@@ -114,16 +117,17 @@ async function refreshBanner(_, french) { ` : ''} ${data['id'] !== "fusion" ? ` - ${data['id'] === "unknown" ? (french ? "Espèce : préférez demander" : "Species: best to ask") : ` - ${french ? "Espèce :" : "Species:"} - ${data['species'].filter(i => i && i['name'] !== "_").map(species => ` - ${species['name']} - `).join("")}`} + ${data['id'] === "unknown" ? (french ? "Genre :
préférez demander" : "Gender:
best to ask") : ` + ${french ? "Genre :" : "Gender:"}
+ ${data['gender']}`}
` : ''} ${data['id'] !== "fusion" ? ` ${french ? "Position :" : "Location:"} - ${data['system']['page'] ? ` ${data['system']['name']}` : ` ${data['system']['name']}`} + ${data['system']['page'] ? ` ${data['system']['name']}` : ` ${data['system']['name']}`}
+ ${data['species'].filter(i => i && i['name'] !== "_").map(species => ` + ${species['name']} + `).join("")}
` : ''}
diff --git a/assets/logo/custom.css b/assets/logo/custom.css index 59200f9..75c1d19 100644 --- a/assets/logo/custom.css +++ b/assets/logo/custom.css @@ -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; } diff --git a/includes/components/details.inc b/includes/components/details.inc index b7d0ebe..e50daf6 100644 --- a/includes/components/details.inc +++ b/includes/components/details.inc @@ -3,32 +3,31 @@

"" . $lang["details"]["food_states"][0] . "", - 1 => "" . $lang["details"]["food_states"][1] . "", - 2 => "" . $lang["details"]["food_states"][2] . "", - 3 => "" . $lang["details"]["food_states"][3] . "", + 0 => "" . $lang["details"]["food_states"][0] . "", + 1 => "" . $lang["details"]["food_states"][1] . "", + 2 => "" . $lang["details"]["food_states"][2] . "", + 3 => "" . $lang["details"]["food_states"][3] . "", } ?>

"" . $lang["details"]["memory_states"][0] . "", - 1 => "" . $lang["details"]["memory_states"][1] . "", - 2 => "" . $lang["details"]["memory_states"][2] . "", + 0 => "" . $lang["details"]["memory_states"][0] . "", + 1 => "" . $lang["details"]["memory_states"][1] . "", + 2 => "" . $lang["details"]["memory_states"][2] . "", } ?>
-
Age:
0): ?> INF ?> - Eternal" ?> + Eternal" ?> - - " . $metadata["birth"]["age"] . "* years old" ?> + " . $metadata["birth"]["age"] . "* years old" ?> - Sliding " . explode("-", $metadata["birth"]["age"])[0] . " to " . explode("-", $metadata["birth"]["age"])[1] . "" ?> + Sliding " . explode("-", $metadata["birth"]["age"])[0] . " to " . explode("-", $metadata["birth"]["age"])[1] . "" ?> @@ -50,12 +49,11 @@ } ?> - " . $age . " years old" ?> + " . $age . " years old" ?>
- - +

@@ -64,6 +62,7 @@ -
+
Primary interest:
@@ -72,7 +71,7 @@ -
- +
@@ -80,19 +79,19 @@
; margin-left: -20px; margin-right: -20px;grid-template-columns: repeat(3, 1fr);"> - = 16 && $metadata["little"] === 0) || (!isset($age) && $metadata["little"] === 0)) || $metadata["sexual_features"]): ?> + = 16 && $metadata["little"] === 0) || (!isset($age2) && $metadata["little"] === 0)) || $metadata["sexual_features"]): ?>
Sexual consent:
- , however may ask to not have sex at the moment and such request must be honored." data-bs-toggle="tooltip">Preemptive + Preemptive - ." data-bs-toggle="tooltip">Required + Required
= 16 && $metadata["little"] === 0) || (!isset($age) && $metadata["little"] === 0))): ?> - +
@@ -126,7 +125,7 @@ grid-template-columns: ; } -
This member is too young to be in a sexual relationship.
+
This pony is too young to be in a sexual relationship.
diff --git a/includes/fragments/member.inc b/includes/fragments/member.inc index 4eed308..bbdfc98 100644 --- a/includes/fragments/member.inc +++ b/includes/fragments/member.inc @@ -120,7 +120,7 @@ if ($memberData["name"] === "fusion") {
  • Date added: (, )
  • -
  • Pronouns:
  • +
  • Pronouns:
  • Pronouns usage:
      $usage) { diff --git a/includes/fragments/metadata.inc b/includes/fragments/metadata.inc index e143153..031fd19 100644 --- a/includes/fragments/metadata.inc +++ b/includes/fragments/metadata.inc @@ -83,6 +83,10 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $member
  • +

    + Gender
    + "> +


    @@ -132,7 +136,7 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $member

    Age (for ponies with fixed age)
    - "> + ">


    diff --git a/includes/util/banner.inc b/includes/util/banner.inc index 46d9ce5..1657233 100644 --- a/includes/util/banner.inc +++ b/includes/util/banner.inc @@ -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) ?? "they/them", + 'pronouns' => isset($member["pronouns"]) && trim($member["pronouns"]) !== "" ? $member["pronouns"] : "they/them", 'pronouns_usage' => getMemberPronouns($member['pronouns']), 'last_fronted' => $lastFronted, 'species' => $speciesList, diff --git a/includes/util/bitset.inc b/includes/util/bitset.inc index 131cb39..14f178c 100644 --- a/includes/util/bitset.inc +++ b/includes/util/bitset.inc @@ -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) { diff --git a/includes/util/pronouns.inc b/includes/util/pronouns.inc index 6ab2487..b7c8dd4 100644 --- a/includes/util/pronouns.inc +++ b/includes/util/pronouns.inc @@ -1,149 +1,16 @@ [ - "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 "" . pronounInFrench($i) . ""; - }, explode("/", $mark))); - } else { - return implode("/", array_map(function ($i) { - return "" . $i . ""; - }, explode("/", $mark))); - } - } + ]; } \ No newline at end of file diff --git a/pages/api/chrome.php b/pages/api/chrome.php index 0be8a94..3b49ec7 100644 --- a/pages/api/chrome.php +++ b/pages/api/chrome.php @@ -80,6 +80,9 @@ if (!isset($_GET["t"])) { [ '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")); diff --git a/pages/api/ponytown.php b/pages/api/ponytown.php index e75ea33..99d755c 100644 --- a/pages/api/ponytown.php +++ b/pages/api/ponytown.php @@ -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?"; } diff --git a/pages/computers.inc b/pages/computers.inc index fb88296..d2b9cbd 100644 --- a/pages/computers.inc +++ b/pages/computers.inc @@ -69,7 +69,7 @@ if (str_ends_with($computer["os"], "unknown")) {

    We are unable to give you access to this computer.

    -

    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.

    +

    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.

    Update this computer to run Luna 1.1.0 or newer and try again.
    @@ -93,7 +93,23 @@ if (str_ends_with($computer["os"], "unknown")) {
    - .jpg"> + ">
    @@ -104,7 +120,26 @@ if (str_ends_with($computer["os"], "unknown")) { - + @@ -123,7 +158,7 @@ if (str_ends_with($computer["os"], "unknown")) { - + @@ -142,14 +177,15 @@ if (str_ends_with($computer["os"], "unknown")) { + 1): ?> processor 1 ? "s" : "" ?>, + core 1 ? "s" : "" ?>, + thread 1 ? "s" : "" ?> - + + @@ -162,7 +198,9 @@ if (str_ends_with($computer["os"], "unknown")) { - + + + - + + @@ -188,15 +227,15 @@ if (str_ends_with($computer["os"], "unknown")) { - + - - + + - - + + - + + @@ -226,7 +266,7 @@ if (str_ends_with($computer["os"], "unknown")) { - + @@ -243,10 +283,12 @@ if (str_ends_with($computer["os"], "unknown")) { + + @@ -255,10 +297,12 @@ if (str_ends_with($computer["os"], "unknown")) { + + @@ -305,12 +349,15 @@ if (str_ends_with($computer["os"], "unknown")) {
    Luna version: ( DSB )
    System: Online Offline since , Offline since :
    Processor threading: - processor 1 ? "s" : "" ?>, - core 1 ? "s" : "" ?>, - thread 1 ? "s" : "" ?>
    Hardware virtualization:
    Level 1 cache: KiB (instruction), KiB (data)Level 3 cache:
    Graphics processor 1 ? "s" : "" ?>: @@ -170,7 +208,7 @@ if (str_ends_with($computer["os"], "unknown")) { " : "" ?>
    Display 1 ? "s" : "" ?>: @@ -180,6 +218,7 @@ if (str_ends_with($computer["os"], "unknown")) {

    System memory

    Physical memory: GiB ( MiB used, MiB free)
    Memory usage: MiB active, MiB available, MiB cache
    Swap memory: GiB ( MiB used, MiB free)
    RAM chips: @@ -204,11 +243,12 @@ if (str_ends_with($computer["os"], "unknown")) { " : "" ?>

    Battery

    Battery model:Remaining capacity: / (designed for 0): ?>, % left)
    This computer does not contain a battery.
    This computer does not contain a battery.
    This operating system does not support reporting battery info.

    Operating system

    Kernel version:
    Code page:
    Build number: Serial number:
    Startup interface:

    Software versions

    +

    Remote control

    You can remotely control this computer. Open remote control.
    Note: The user of this computer will need to approve your connection request before you can see and control their screen.

    + + 0): ?>

    Sessions

    @@ -334,7 +381,9 @@ if (str_ends_with($computer["os"], "unknown")) {
    + + 0): ?>

    Filesystems

    @@ -366,7 +415,9 @@ if (str_ends_with($computer["os"], "unknown")) {
    + +

    Audio devices

    @@ -390,7 +441,9 @@ if (str_ends_with($computer["os"], "unknown")) {
    + +

    Network cards

    @@ -437,7 +490,9 @@ if (str_ends_with($computer["os"], "unknown")) {
    + +

    Network connections

    @@ -499,6 +554,7 @@ if (str_ends_with($computer["os"], "unknown")) {
    +

    Processes

    @@ -520,7 +576,7 @@ if (str_ends_with($computer["os"], "unknown")) { - + @@ -823,7 +879,23 @@ if (str_ends_with($computer["os"], "unknown")) { ?>
    - .jpg"> + ">
    @@ -835,10 +907,6 @@ if (str_ends_with($computer["os"], "unknown")) { - -
    diff --git a/pages/metadata.inc b/pages/metadata.inc index 768f548..adde5e7 100644 --- a/pages/metadata.inc +++ b/pages/metadata.inc @@ -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"])) { -- cgit
    % %