summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2023-02-08 22:42:21 +0100
committerMinteck <contact@minteck.org>2023-02-08 22:42:21 +0100
commit885a05be06d0b42835652208c729e5fded451c26 (patch)
treee848835a00bce1bf790b867535a2c1e83cbcbe2e
parent5026c2f48d2a1bf8fbd3a63c1e41e59431054878 (diff)
downloadpluralconnect-885a05be06d0b42835652208c729e5fded451c26.tar.gz
pluralconnect-885a05be06d0b42835652208c729e5fded451c26.tar.bz2
pluralconnect-885a05be06d0b42835652208c729e5fded451c26.zip
Updated 9 files, added 2 files and deleted pages/bitset.inc (automated)
-rw-r--r--assets/logo/banner.js2
-rw-r--r--assets/logo/pacifier.pngbin0 -> 2128 bytes
-rw-r--r--includes/bitset.inc142
-rw-r--r--includes/flags.json23
-rw-r--r--includes/fullbanner.inc7
-rw-r--r--includes/metadata.inc182
-rw-r--r--includes/pages.json9
-rw-r--r--includes/planner.inc20
-rw-r--r--includes/refresh.php5
-rw-r--r--pages/bitset.inc457
-rw-r--r--pages/metadata.inc65
-rw-r--r--pages/rules.inc10
12 files changed, 217 insertions, 705 deletions
diff --git a/assets/logo/banner.js b/assets/logo/banner.js
index 076e8ce..da54b4d 100644
--- a/assets/logo/banner.js
+++ b/assets/logo/banner.js
@@ -134,7 +134,7 @@ async function refreshBanner(_, french) {
<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'].map(species => `
+ ${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>` : ''}
diff --git a/assets/logo/pacifier.png b/assets/logo/pacifier.png
new file mode 100644
index 0000000..caa54ab
--- /dev/null
+++ b/assets/logo/pacifier.png
Binary files differ
diff --git a/includes/bitset.inc b/includes/bitset.inc
index 5106d80..8e3f5b2 100644
--- a/includes/bitset.inc
+++ b/includes/bitset.inc
@@ -1,145 +1,5 @@
<?php
-function parseBitset($bitset, $birthData) {
- $bin = str_repeat("0", 48 - strlen(decbin($bitset))) . decbin($bitset);
-
- $sharedMemory = bindec(substr($bin, 24, 2));
- $little = bindec(substr($bin, 27, 2));
- $food = bindec(substr($bin, 16, 2));
- $nonverbal = substr($bin, 15, 1) !== "0";
- $lessFrequent = substr($bin, 14, 1) !== "0";
- $sexuallyActive = substr($bin, 13, 1) !== "0";
- $leader = substr($bin, 11, 1) !== "0";
- $sexualFeatures = substr($bin, 12, 1) !== "0";
- $persecutor = substr($bin, 10, 1) !== "0";
- $protector = substr($bin, 29, 1) !== "0";
- $fictive = substr($bin, 30, 1) !== "0";
- $robot = substr($bin, 45, 1) !== "0";
- $plush = substr($bin, 46, 1) !== "0";
- $polyamorous1 = substr($bin, 18, 1) !== "0";
- $polyamorous2 = substr($bin, 19, 1) !== "0";
- $species1 = substr($bin, 33, 4);
- $species2 = substr($bin, 37, 4);
- $alignment1 = substr($bin, 41, 4);
- $alignment2 = substr($bin, 20, 4);
-
- $species1 = match ($species1) {
- "0001" => "earth",
- "0010" => "unicorn",
- "0011" => "pegasus",
- "0100" => "alicorn",
- "0101" => "batpony",
- "0110" => "crystal",
- "0111" => "changeling",
- default => null,
- };
-
- $species2 = match ($species2) {
- "0001" => "earth",
- "0010" => "unicorn",
- "0011" => "pegasus",
- "0100" => "alicorn",
- "0101" => "batpony",
- "0110" => "crystal",
- "0111" => "changeling",
- default => null,
- };
-
- $alignment1 = match ($alignment1) {
- "0000" => "aroace",
- "0001" => "hetero",
- "0010" => "homo",
- "0011" => "bi",
- "0100" => "pan",
- default => null,
- };
-
- $alignment2 = match ($alignment2) {
- "0000" => "aroace",
- "0001" => "hetero",
- "0010" => "homo",
- "0011" => "bi",
- "0100" => "pan",
- default => null,
- };
-
- $little = 0;
-
- if (isset($birthData["age"]) && $birthData["age"] !== 0) {
- $age = $birthData["age"];
- } else if (isset($birthData["year"]) && $birthData["year"] > 1900) {
- $age = (int)date('Y') - $birthData["year"] + (strtotime(date('Y') . "-" . $birthData["date"]) <= time() ? 0 : -1);
- } else {
- $age = -2;
- }
-
- if ($age <= 10 && $age > 0) {
- $little = 2;
- }
-
- if ($age < 16 && $age > 10) {
- $little = 3;
- }
-
- return [
- 'shared_memory' => $sharedMemory,
- 'median' => false,
- 'protector' => $protector,
- 'fictive' => $fictive,
- 'little' => $little,
- 'not_talking' => false,
- 'sexual_features' => $sexualFeatures,
- 'host' => false,
- 'robot' => $robot,
- 'magic' => 0,
- 'sensitivity' => 0,
- 'food' => $food,
- 'plush' => $plush,
- 'nonverbal' => $nonverbal,
- 'less_frequent' => $lessFrequent,
- 'age_spells' => false,
- 'age_regressor' => false,
- 'leader' => $leader,
- 'persecutor' => $persecutor,
- 'sexually_active' => $sexuallyActive,
- 'polyamorous' => [
- 'romantic' => $polyamorous1,
- 'sexual' => $polyamorous2
- ],
- 'alignment' => [
- 'romantic' => $alignment1,
- 'sexual' => $alignment2
- ],
- 'species' => array_filter([
- $species1,
- $species2
- ], function ($i) {
- return isset($i);
- })
- ];
-}
-
function parseMetadata ($metadata) {
- if (isset($metadata)) {
- if ($metadata["bitset"]) {
- $m = parseBitset($metadata["bitset"], $metadata["birth"] ?? []);
- $m["sexfriends"] = $metadata["sexfriends"] ?? [];
- $m["marefriends"] = $metadata["marefriends"] ?? [];
- $m["bitset"] = $metadata["bitset"] ?? 0;
- $m["sisters"] = $metadata["sisters"] ?? [];
- $m["regression"] = $metadata["regression"] ?? null;
- $m["caretakers"] = $metadata["caretakers"] ?? [];
- $m["median"] = $metadata["median"] ?? null;
- $m["birth"] = $metadata["birth"] ?? null;
- $m["heat"] = $metadata["heat"] ?? null;
- $m["code"] = $metadata["code"] ?? null;
- $m["interest"] = $metadata["interest"] ?? null;
- } else {
- $m = $metadata;
- }
-
- return $m;
- } else {
- return $metadata;
- }
+ return $metadata;
} \ No newline at end of file
diff --git a/includes/flags.json b/includes/flags.json
new file mode 100644
index 0000000..1802615
--- /dev/null
+++ b/includes/flags.json
@@ -0,0 +1,23 @@
+{
+ "age_regressor": null,
+ "age_spells": null,
+ "host": null,
+ "not_talking": null,
+ "median": null,
+
+ "protector": "Protector",
+ "leader": "Leader",
+ "fictive": "Fictive",
+ "sexual_features": "Enable sexual features (for ponies below 16)",
+ "sexually_active": "Preemptive sexual consent",
+ "robot": "Robot",
+ "plush": "Plush",
+ "polyamorous": {
+ "romantic": "Polyamorous (romantic)",
+ "sexual": "Polyamorous (sexual)"
+ },
+ "non_verbal": "Non verbal in real life",
+ "less_frequent": "Fronts less frequently",
+ "persecutor": "Persecutor",
+ "pacifier": "Sleeps with pacifier"
+} \ No newline at end of file
diff --git a/includes/fullbanner.inc b/includes/fullbanner.inc
index b5a05b1..f6741c9 100644
--- a/includes/fullbanner.inc
+++ b/includes/fullbanner.inc
@@ -13,13 +13,6 @@
<script src="/assets/logo/banner.js"></script><script>refreshBanner(false, <?= $lang["_french"] ? "true" : "false" ?>)</script>
-<?php global $isLoggedIn; if ($isLoggedIn && $memberData["name"] !== "unknown" && $memberData["name"] !== "fusion"): ?>
- <?php if (!isset($metadata["bitset"])): ?>
- <div class="alert alert-warning">
- <b>This member's metadata needs an update.</b> It still uses the old JSON metadata system instead of the new 24bit integer-based system. Contact a developer to request an update. (only administrators can see this; file: <code><?= $_SERVER['DOCUMENT_ROOT'] ?>/includes/data/metadata/<?= $memberID ?>.json</code>)
- </div>
- <?php endif; ?>
-<?php endif; ?>
<?php if ($travelling[$memberID]['travelling'] && !$travelling[$memberID]['equestria']): ?>
<div class="alert alert-primary">
<?= getMiniName($memberData["display_name"] ?? $memberData["name"]) ?> <?= $lang["fullbanner"]["visit"][0] ?> <?= $systemID === "ynmuc" ? "Raindrops System" : "Cloudburst System" ?><?= str_replace("%1", getMemberPronouns($memberData["pronouns"])["subjective"], str_replace("%2", getMemberPronouns($memberData["pronouns"])["third"] ? "is" : "are", $lang["fullbanner"]["visit"][1])) ?><?= $systemCommonName ?>.
diff --git a/includes/metadata.inc b/includes/metadata.inc
index 7bc82ef..d7875c5 100644
--- a/includes/metadata.inc
+++ b/includes/metadata.inc
@@ -16,47 +16,145 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $member
<b>File</b><br>
<?= $_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $memberID . ".json" ?>
</p>
+
+ <hr>
+
+ <h3>General information</h3>
+
+ <div style="margin-bottom: 1rem;">
+ <b>General:</b><br>
+ <div style="display: grid; grid-template-columns: repeat(2, 1fr); grid-gap: 10px;">
+ <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=&apos;http://www.w3.org/2000/svg&apos; viewBox=&apos;0 0 16 16&apos;%3e%3cpath fill=&apos;none&apos; stroke=&apos;%23000000&apos; stroke-linecap=&apos;round&apos; stroke-linejoin=&apos;round&apos; stroke-width=&apos;2&apos; d=&apos;M2 5l6 6 6-6&apos;/%3e%3c/svg%3e");' name="food">
+ <option <?= $metadata["food"] === 0 ? "selected" : "" ?> value="0">Doesn't need to eat</option>
+ <option <?= $metadata["food"] === 1 ? "selected" : "" ?> value="1">Can't eat fish or meat</option>
+ <option <?= $metadata["food"] === 2 ? "selected" : "" ?> value="2">Can't eat meat</option>
+ <option <?= $metadata["food"] === 3 ? "selected" : "" ?> value="3">Can eat everything</option>
+ </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=&apos;http://www.w3.org/2000/svg&apos; viewBox=&apos;0 0 16 16&apos;%3e%3cpath fill=&apos;none&apos; stroke=&apos;%23000000&apos; stroke-linecap=&apos;round&apos; stroke-linejoin=&apos;round&apos; stroke-width=&apos;2&apos; d=&apos;M2 5l6 6 6-6&apos;/%3e%3c/svg%3e");' name="shared_memory">
+ <option <?= $metadata["shared_memory"] === 2 ? "selected" : "" ?> value="2">Doing subconsciously</option>
+ <option <?= $metadata["shared_memory"] === 1 ? "selected" : "" ?> value="1">Consciously willing</option>
+ <option <?= $metadata["shared_memory"] === 0 ? "selected" : "" ?> value="0">Incapable/not willing</option>
+ </select>
+ </div>
+ </div>
+ <div style="margin-bottom: 1rem;">
+ <b>Species</b><br>
+ <div style="display: grid; grid-template-columns: repeat(2, 1fr); grid-gap: 10px;">
+ <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=&apos;http://www.w3.org/2000/svg&apos; viewBox=&apos;0 0 16 16&apos;%3e%3cpath fill=&apos;none&apos; stroke=&apos;%23000000&apos; stroke-linecap=&apos;round&apos; stroke-linejoin=&apos;round&apos; stroke-width=&apos;2&apos; d=&apos;M2 5l6 6 6-6&apos;/%3e%3c/svg%3e");' name="species[0]">
+ <option <?= !isset($metadata["species"][0]) || $metadata["species"][0] === "" ? "selected" : "" ?> value="" disabled>None</option>
+ <option <?= $metadata["species"][0] === "earth" ? "selected" : "" ?> value="earth">Earth pony</option>
+ <option <?= $metadata["species"][0] === "unicorn" ? "selected" : "" ?> value="unicorn">Unicorn</option>
+ <option <?= $metadata["species"][0] === "pegasus" ? "selected" : "" ?> value="pegasus">Pegasus</option>
+ <option <?= $metadata["species"][0] === "alicorn" ? "selected" : "" ?> value="alicorn">Alicorn</option>
+ <option <?= $metadata["species"][0] === "batpony" ? "selected" : "" ?> value="batpony">Bat pony</option>
+ <option <?= $metadata["species"][0] === "crystal" ? "selected" : "" ?> value="crystal">Crystal pony</option>
+ <option <?= $metadata["species"][0] === "changeling" ? "selected" : "" ?> value="changeling">Changeling</option>
+ </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=&apos;http://www.w3.org/2000/svg&apos; viewBox=&apos;0 0 16 16&apos;%3e%3cpath fill=&apos;none&apos; stroke=&apos;%23000000&apos; stroke-linecap=&apos;round&apos; stroke-linejoin=&apos;round&apos; stroke-width=&apos;2&apos; d=&apos;M2 5l6 6 6-6&apos;/%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>
+ </select>
+ </div>
+ </div>
+ <div style="margin-bottom: 1rem;">
+ <b>Alignment</b><br>
+ <div style="display: grid; grid-template-columns: repeat(2, 1fr); grid-gap: 10px;">
+ <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=&apos;http://www.w3.org/2000/svg&apos; viewBox=&apos;0 0 16 16&apos;%3e%3cpath fill=&apos;none&apos; stroke=&apos;%23000000&apos; stroke-linecap=&apos;round&apos; stroke-linejoin=&apos;round&apos; stroke-width=&apos;2&apos; d=&apos;M2 5l6 6 6-6&apos;/%3e%3c/svg%3e");' name="alignment[sexual]">
+ <option <?= $metadata["alignment"]["sexual"] === "aroace" ? "selected" : "" ?> value="aroace">Asexual</option>
+ <option <?= $metadata["alignment"]["sexual"] === "hetero" ? "selected" : "" ?> value="hetero">Heterosexual</option>
+ <option <?= $metadata["alignment"]["sexual"] === "homo" ? "selected" : "" ?> value="homo">Homosexual</option>
+ <option <?= $metadata["alignment"]["sexual"] === "bi" ? "selected" : "" ?> value="bi">Bisexual</option>
+ <option <?= $metadata["alignment"]["sexual"] === "pan" ? "selected" : "" ?> value="pan">Pansexual</option>
+ </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=&apos;http://www.w3.org/2000/svg&apos; viewBox=&apos;0 0 16 16&apos;%3e%3cpath fill=&apos;none&apos; stroke=&apos;%23000000&apos; stroke-linecap=&apos;round&apos; stroke-linejoin=&apos;round&apos; stroke-width=&apos;2&apos; d=&apos;M2 5l6 6 6-6&apos;/%3e%3c/svg%3e");' name="alignment[romantic]">
+ <option <?= $metadata["alignment"]["romantic"] === "aroace" ? "selected" : "" ?> value="aroace">Aromantic</option>
+ <option <?= $metadata["alignment"]["romantic"] === "hetero" ? "selected" : "" ?> value="hetero">Heteroromantic</option>
+ <option <?= $metadata["alignment"]["romantic"] === "homo" ? "selected" : "" ?> value="homo">Homoromantic</option>
+ <option <?= $metadata["alignment"]["romantic"] === "bi" ? "selected" : "" ?> value="bi">Biromantic</option>
+ <option <?= $metadata["alignment"]["romantic"] === "pan" ? "selected" : "" ?> value="pan">Panromantic</option>
+ </select>
+ </div>
+ </div>
+
+ <hr>
+
+ <h3>Relationships</h3>
+
<p>
- <b>Bitset</b><br>
- <code id="bitset-text"><?= $metadata["bitset"] ?></code> · <a data-bs-toggle="modal" data-bs-target="#bitset" href="#">Edit...</a>
- <input name="bitset" id="bitset-value" type="hidden" value="<?= $metadata["bitset"] ?>">
- </p>
- <p>
- <b>Sexfriends (full IDs, comma-separated):</b><br>
+ <b>Sexfriends (full IDs, comma-separated)</b><br>
<input name="sexfriends" class="form-control" style="filter: invert(1) hue-rotate(180deg);" type="text" value="<?= implode(", ", $metadata["sexfriends"]) ?>">
</p>
<p>
- <b>Marefriends (full IDs, comma-separated):</b><br>
+ <b>Marefriends (full IDs, comma-separated)</b><br>
<input name="marefriends" class="form-control" style="filter: invert(1) hue-rotate(180deg);" type="text" value="<?= implode(", ", $metadata["marefriends"]) ?>">
</p>
<p>
- <b>Sisters (full IDs, comma-separated):</b><br>
+ <b>Sisters (full IDs, comma-separated)</b><br>
<input name="sisters" class="form-control" style="filter: invert(1) hue-rotate(180deg);" type="text" value="<?= implode(", ", $metadata["sisters"]) ?>">
</p>
<p>
- <b>Caretakers (full IDs, comma-separated):</b><br>
+ <b>Caretakers (full IDs, comma-separated)</b><br>
<input name="caretakers" class="form-control" style="filter: invert(1) hue-rotate(180deg);" type="text" value="<?= implode(", ", $metadata["caretakers"]) ?>">
</p>
<p>
- <b>Primary interest (keep it short):</b><br>
+ <b>Age regressed version (local ID)</b><br>
+ <input name="regressed" class="form-control" style="filter: invert(1) hue-rotate(180deg);" type="text" value="<?= $metadata["regressed"] ?? "" ?>">
+ </p>
+
+ <hr>
+
+ <h3>Technical details</h3>
+
+ <p>
+ <b>Primary interest (keep it short)</b><br>
<input name="interest" class="form-control" style="filter: invert(1) hue-rotate(180deg);" type="text" value="<?= $metadata["interest"] ?? "" ?>">
</p>
<p>
- <b>Age regressed version (local ID):</b><br>
- <input name="regressed" class="form-control" style="filter: invert(1) hue-rotate(180deg);" type="text" value="<?= $metadata["regressed"] ?? "" ?>">
+ <b>Member code</b><br>
+ <input name="membc" class="form-control" style="filter: invert(1) hue-rotate(180deg);" type="text" value="<?= $metadata["code"] ?? "" ?>">
</p>
+
+ <hr>
+
+ <h3>Age information</h3>
+
<p>
- <b>Birth date (use January 1<sup>st</sup> for none):</b><br>
+ <b>Birth date (use January 1<sup>st</sup> for none)</b><br>
<input name="birth" class="form-control" style="filter: invert(1) hue-rotate(180deg);" type="date" value="<?= $metadata["birth"]["year"] ?? "" ?>-<?= $metadata["birth"]["date"] ?? "" ?>">
</p>
<p>
- <b>Age (for ponies with fixed age):</b><br>
+ <b>Age (for ponies with fixed age)</b><br>
<input name="age" class="form-control" style="filter: invert(1) hue-rotate(180deg);" type="number" value="<?= $metadata["birth"]["age"] ?? "" ?>">
</p>
- <p>
- <b>Member code:</b><br>
- <input name="membc" class="form-control" style="filter: invert(1) hue-rotate(180deg);" type="text" value="<?= $metadata["code"] ?? "" ?>">
- </p>
+
+ <hr>
+
+ <h3>Toggleable flags</h3>
+
+ <?php
+
+ $flags = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/flags.json"), true);
+
+ foreach ($flags as $id => $name): if (!is_array($name) && !is_null($name)): ?>
+ <label style="margin-bottom:5px;">
+ <input <?= $metadata[$id] ? "checked" : "" ?> class="form-check-input" type="checkbox" name="flags[<?= $id ?>]">
+ <?= $name ?>
+ </label><br>
+ <?php else: foreach ($name as $id2 => $name2): ?>
+ <label style="margin-bottom:5px;">
+ <input <?= $metadata[$id][$id2] ? "checked" : "" ?> class="form-check-input" type="checkbox" name="flags[<?= $id ?>][<?= $id2 ?>]">
+ <?= $name2 ?>
+ </label><br>
+ <?php endforeach; endif; endforeach; ?>
+
+ <hr>
+
<input name="submit" class="btn btn-outline-primary" value="Save and quit" type="submit">
</form>
<?php else: ?>
@@ -66,52 +164,4 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $member
<?php endif; ?>
</div>
-<div class="modal fade" id="bitset">
- <div class="modal-dialog modal-xl">
- <div class="modal-content">
- <div class="modal-header">
- <h4 class="modal-title">
- <img src="/assets/icons/bitset.svg" style="filter: invert(1); vertical-align: middle; height: 32px; margin-right: 10px;">
- <span style="vertical-align: middle;">Bitset editor</span>
- </h4>
- <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
- </div>
- <div class="modal-body">
- <iframe src="/-/bitset?embed=<?= $metadata["bitset"] ?>"></iframe>
- <script>
- setInterval(() => {
- try {
- document.getElementById("bitset-text").innerText = document.getElementById("bitset-value").value = document.getElementsByTagName("iframe")[0].contentDocument.getElementById("output-dec").innerText;
- } catch (e) {}
- })
- </script>
- </div>
- </div>
- </div>
-</div>
-
-<style>
- .modal-header {
- border-bottom: 1px solid #353738;
- }
-
- .modal-content {
- border: 1px solid rgba(255, 255, 255, .2);
- background-color: #111;
- }
-
- .btn-close {
- filter: invert(1);
- }
-
- iframe {
- width: calc(100% + 2rem);
- min-height: calc(100% + 2rem);
- border-bottom-left-radius: .3rem;
- border-bottom-right-radius: .3rem;
- height: 60vh;
- margin: -1rem -1rem calc(-1rem - 6px);
- }
-</style>
-
<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> \ No newline at end of file
diff --git a/includes/pages.json b/includes/pages.json
index 777351b..985a224 100644
--- a/includes/pages.json
+++ b/includes/pages.json
@@ -44,15 +44,6 @@
"admin": false,
"rail": false
},
- "bitset": {
- "name": {
- "en": "Bitset calculator",
- "fr": "Bitset calculator"
- },
- "short": "Bitset",
- "admin": true,
- "rail": true
- },
"byfront": {
"name": {
"en": "Members by last fronted",
diff --git a/includes/planner.inc b/includes/planner.inc
index 003d3cc..1bc5143 100644
--- a/includes/planner.inc
+++ b/includes/planner.inc
@@ -13,6 +13,16 @@ global $_PROFILE;
$cloudburst = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/planner/ynmuc.json"), true);
$raindrops = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/planner/gdapd.json"), true);
+function pacifier($id) {
+ $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $id . ".json"), true));
+
+ if ($metadata["pacifier"]) {
+ return "<img title='This pony likes to sleep with a pacifier.' data-bs-toggle='tooltip' src='/assets/logo/pacifier.png' style='margin-left:auto;float: right;opacity:.75;width:24px;height:24px;vertical-align: middle; filter: invert(1);'>";
+ }
+
+ return "";
+}
+
foreach ($cloudburst as $id => $day) {
foreach ($day as $index => $fronter) {
if (is_string($fronter)) {
@@ -180,7 +190,7 @@ function day($display, $diff): void { if ($diff < 0) $disabled = true; else $dis
<?php elseif ($member["name"] === "unknown"): ?>
<a class="member-link" onclick="openEditFronter('cloudburst', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="/assets/logo/newlogo.png" style="filter:grayscale(1);width:24px;"> <span class="member-link-text"><span class="merge-desktop" style="opacity:.75;">Other/unknown/fallback pony</span></span></span></a>
<?php else: ?>
- <a class="member-link" onclick="openEditFronter('cloudburst', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="<?= getAsset($member["system"], $member["id"], "heads") ?>" style="width:24px;"> <span class="member-link-text"><?= !isset($dayCloudburst[$index][1]) ? $member["display_name"] ?? $member["name"] : getMiniName($member["display_name"] ?? $member["name"]) ?></span></span></a>
+ <a class="member-link" onclick="openEditFronter('cloudburst', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="<?= getAsset($member["system"], $member["id"], "heads") ?>" style="width:24px;"> <span class="member-link-text"><?= !isset($dayCloudburst[$index][1]) ? $member["display_name"] ?? $member["name"] : getMiniName($member["display_name"] ?? $member["name"]) ?></span><?= $index === count($dayCloudburst) - 1 ? pacifier($member["id"]) : "" ?></span></a>
<?php endif; ?>
</td>
<?php if (!isset($dayCloudburst[$index][1])): ?>
@@ -197,7 +207,7 @@ function day($display, $diff): void { if ($diff < 0) $disabled = true; else $dis
<?php elseif ($member["name"] === "unknown"): ?>
<a class="member-link" onclick="openEditCofronter('cloudburst', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="/assets/logo/newlogo.png" style="filter:grayscale(1);width:24px;"> <span class="member-link-text"><span class="merge-desktop" style="opacity:.75;">Other/unknown/fallback pony</span></span></span></a>
<?php else: ?>
- <a class="member-link" onclick="openEditCofronter('cloudburst', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="<?= getAsset($member["system"], $member["id"], "heads") ?>" style="width:24px;"> <span class="member-link-text"><?= !isset($dayCloudburst[$index][1]) ? $member["display_name"] ?? $member["name"] : getMiniName($member["display_name"] ?? $member["name"]) ?></span></span></a>
+ <a class="member-link" onclick="openEditCofronter('cloudburst', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="<?= getAsset($member["system"], $member["id"], "heads") ?>" style="width:24px;"> <span class="member-link-text"><?= !isset($dayCloudburst[$index][1]) ? $member["display_name"] ?? $member["name"] : getMiniName($member["display_name"] ?? $member["name"]) ?></span><?= $index === count($dayCloudburst) - 1 ? pacifier($member["id"]) : "" ?></span></a>
<?php endif; ?>
</td>
<?php endif; ?>
@@ -224,7 +234,7 @@ function day($display, $diff): void { if ($diff < 0) $disabled = true; else $dis
<?php elseif ($member["name"] === "unknown"): ?>
<a class="member-link" onclick="openEditFronter('raindrops', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="/assets/logo/newlogo.png" style="filter:grayscale(1);width:24px;"> <span class="member-link-text"><span class="merge-desktop" style="opacity:.75;">Other/unknown/fallback pony</span></span></span></a>
<?php else: ?>
- <a class="member-link" onclick="openEditFronter('raindrops', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="<?= getAsset($member["system"], $member["id"], "heads") ?>" style="width:24px;"> <span class="member-link-text"><?= !isset($dayRaindrops[$index][1]) ? $member["display_name"] ?? $member["name"] : getMiniName($member["display_name"] ?? $member["name"]) ?></span></span></a>
+ <a class="member-link" onclick="openEditFronter('raindrops', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="<?= getAsset($member["system"], $member["id"], "heads") ?>" style="width:24px;"> <span class="member-link-text"><?= !isset($dayRaindrops[$index][1]) ? $member["display_name"] ?? $member["name"] : getMiniName($member["display_name"] ?? $member["name"]) ?></span><?= $index === count($dayRaindrops) - 1 ? pacifier($member["id"]) : "" ?></span></a>
<?php endif; ?>
</td>
<?php if (!isset($dayRaindrops[$index][1])): ?>
@@ -241,7 +251,7 @@ function day($display, $diff): void { if ($diff < 0) $disabled = true; else $dis
<?php elseif ($member["name"] === "unknown"): ?>
<a class="member-link" onclick="openEditCofronter('raindrops', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="/assets/logo/newlogo.png" style="filter:grayscale(1);width:24px;"> <span class="member-link-text"><span class="merge-desktop" style="opacity:.75;">Other/unknown/fallback pony</span></span></span></a>
<?php else: ?>
- <a class="member-link" onclick="openEditCofronter('raindrops', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="<?= getAsset($member["system"], $member["id"], "heads") ?>" style="width:24px;"> <span class="member-link-text"><?= !isset($dayRaindrops[$index][1]) ? $member["display_name"] ?? $member["name"] : getMiniName($member["display_name"] ?? $member["name"]) ?></span></span></a>
+ <a class="member-link" onclick="openEditCofronter('raindrops', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="<?= getAsset($member["system"], $member["id"], "heads") ?>" style="width:24px;"> <span class="member-link-text"><?= !isset($dayRaindrops[$index][1]) ? $member["display_name"] ?? $member["name"] : getMiniName($member["display_name"] ?? $member["name"]) ?></span><?= $index === count($dayRaindrops) - 1 ? pacifier($member["id"]) : "" ?></span></a>
<?php endif; ?>
</td>
<?php endif; ?>
@@ -545,7 +555,7 @@ function day($display, $diff): void { if ($diff < 0) $disabled = true; else $dis
}
function openEditCofronter(system, id, date) {
- let display = formatDate(offset).display;
+ let display = formatDate(date).display;
window.selectedFronting = {
system: system === "cloudburst" ? "ynmuc" : "gdapd",
diff --git a/includes/refresh.php b/includes/refresh.php
index bbf8b01..ecf724a 100644
--- a/includes/refresh.php
+++ b/includes/refresh.php
@@ -243,8 +243,11 @@ foreach (json_decode(file_get_contents("./data/ynmuc/members.json"), true) as $m
echo("Backing up...\n");
-if (date('i') === "00" || date('i') === "01" || date('i') === "02" || date('i') === "03" || date('i') === "04") {
+$lastBackup = (int)trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/backup.txt"));
+
+if (time() - $lastBackup >= 3600) {
require_once "./backup.inc";
+ file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/backup.txt", time());
echo("Backup completed\n");
} else {
echo("Backup skipped\n");
diff --git a/pages/bitset.inc b/pages/bitset.inc
deleted file mode 100644
index bd8412b..0000000
--- a/pages/bitset.inc
+++ /dev/null
@@ -1,457 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages;
-require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc';
-
-?>
-
-<?php if (isset($_GET['embed'])): ?>
-<style>
- #page-content, #title-bar, #mobile-navigation, #titlebar-separator, #footer {
- display: none !important;
- }
-
- #footer-pre {
- height: 20px;
- }
-
- body {
- background-color: transparent !important;
- }
-</style>
-
-<script>
- window.addEventListener("load", () => {
- document.getElementById("input").value = "<?= $_GET['embed'] ?>";
- calculateInput();
- })
-</script>
-<?php endif; ?>
-
-<br>
-<div class="container">
- <div id="page-content">
- <h2 oncontextmenu="document.getElementById('deprecated-options').style.display='block';">Bitset calculator</h2>
- </div>
- <div style="display:grid; grid-template-columns: repeat(48, 1fr);">
- <div data-bs-toggle="tooltip" title="Value reserved for future use" id="binary-bit-1" class="font-monospace tooltip-nohelp text-muted" style="text-align: center;cursor: pointer;">0</div>
- <div data-bs-toggle="tooltip" title="Value reserved for future use" id="binary-bit-2" class="font-monospace tooltip-nohelp text-muted" style="text-align: center;cursor: pointer;">0</div>
- <div data-bs-toggle="tooltip" title="Value reserved for future use" id="binary-bit-3" class="font-monospace tooltip-nohelp text-muted" style="text-align: center;cursor: pointer;">0</div>
- <div data-bs-toggle="tooltip" title="Value reserved for future use" id="binary-bit-4" class="font-monospace tooltip-nohelp text-muted" style="text-align: center;cursor: pointer;">0</div>
- <div data-bs-toggle="tooltip" title="Value reserved for future use" id="binary-bit-5" class="font-monospace tooltip-nohelp text-muted" style="text-align: center;cursor: pointer;">0</div>
- <div data-bs-toggle="tooltip" title="Value reserved for future use" id="binary-bit-6" class="font-monospace tooltip-nohelp text-muted" style="text-align: center;cursor: pointer;">0</div>
- <div data-bs-toggle="tooltip" title="Value reserved for future use" id="binary-bit-7" class="font-monospace tooltip-nohelp text-muted" style="text-align: center;cursor: pointer;">0</div>
- <div data-bs-toggle="tooltip" title="Value reserved for future use" id="binary-bit-8" class="font-monospace tooltip-nohelp text-muted" style="text-align: center;cursor: pointer;">0</div>
- <div data-bs-toggle="tooltip" title="Value reserved for future use" id="binary-bit-9" class="font-monospace tooltip-nohelp text-muted" style="text-align: center;cursor: pointer;">0</div>
- <div data-bs-toggle="tooltip" title="Value reserved for future use" id="binary-bit-10" class="font-monospace tooltip-nohelp text-muted" style="text-align: center;cursor: pointer;">0</div>
- <div data-bs-toggle="tooltip" title="Persecutor" id="binary-bit-11" class="font-monospace tooltip-nohelp" style="color:#197387;text-align: center;cursor: pointer;">0</div>
- <div data-bs-toggle="tooltip" title="Leader" id="binary-bit-12" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#877e19;">0</div>
- <div data-bs-toggle="tooltip" title="Enable sexual features" id="binary-bit-13" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;">0</div>
- <div data-bs-toggle="tooltip" title="Preemptive sexual consent" id="binary-bit-14" class="font-monospace tooltip-nohelp" style="color: rgb(59,196,46);text-align: center;cursor: pointer;">0</div>
- <div data-bs-toggle="tooltip" title="Fronts less frequently" id="binary-bit-15" class="font-monospace tooltip-nohelp" style="color: #198754;text-align: center;cursor: pointer;">0</div>
- <div data-bs-toggle="tooltip" title="Non verbal in real life" id="binary-bit-16" class="font-monospace tooltip-nohelp" style="color: #20c997;text-align: center;cursor: pointer;">0</div>
- <div data-bs-toggle="tooltip" title="Eatable food" id="binary-bit-17" class="font-monospace tooltip-nohelp" style="color: #d63384;text-align: center;cursor: pointer;">0</div>
- <div data-bs-toggle="tooltip" title="Eatable food" id="binary-bit-18" class="font-monospace tooltip-nohelp" style="color: #d63384;text-align: center;cursor: pointer;">0</div>
- <div data-bs-toggle="tooltip" title="Polyamory (romantic)" id="binary-bit-19" class="font-monospace tooltip-nohelp" style="color: #eeb8b8; text-align: center;cursor: pointer;">0</div>
- <div data-bs-toggle="tooltip" title="Polyamory (sexual)" id="binary-bit-20" class="font-monospace tooltip-nohelp" style="color: #e2b8ee; text-align: center;cursor: pointer;">0</div>
- <div data-bs-toggle="tooltip" title="Sexual alignment" id="binary-bit-21" class="font-monospace tooltip-nohelp" style="color: #5fff4d; text-align: center;cursor: pointer;">0</div>
- <div data-bs-toggle="tooltip" title="Sexual alignment" id="binary-bit-22" class="font-monospace tooltip-nohelp" style="color: #5fff4d; text-align: center;cursor: pointer;">0</div>
- <div data-bs-toggle="tooltip" title="Sexual alignment" id="binary-bit-23" class="font-monospace tooltip-nohelp" style="color: #5fff4d; text-align: center;cursor: pointer;">0</div>
- <div data-bs-toggle="tooltip" title="Sexual alignment" id="binary-bit-24" class="font-monospace tooltip-nohelp" style="color: #5fff4d; text-align: center;cursor: pointer;">0</div>
- <div data-bs-toggle="tooltip" title="Memory polling" id="binary-bit-25" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#fa77ef;">0</div>
- <div data-bs-toggle="tooltip" title="Memory polling" id="binary-bit-26" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#fa77ef;">0</div>
- <div data-bs-toggle="tooltip" title="Value reserved for future use" id="binary-bit-27" class="text-muted font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;">0</div>
- <div data-bs-toggle="tooltip" title="Value reserved for future use" id="binary-bit-28" class="text-muted font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;">0</div>
- <div data-bs-toggle="tooltip" title="Value reserved for future use" id="binary-bit-29" class="text-muted font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;">0</div>
- <div data-bs-toggle="tooltip" title="Protector" id="binary-bit-30" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#77faab;">0</div>
- <div data-bs-toggle="tooltip" title="Fictive" id="binary-bit-31" class="font-monospace tooltip-nohelp text-info" style="text-align: center;cursor: pointer;">0</div>
- <div data-bs-toggle="tooltip" title="Value reserved for future use" id="binary-bit-32" class="text-muted font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;">0</div>
- <div data-bs-toggle="tooltip" title="Value reserved for future use" id="binary-bit-33" class="text-muted font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;">0</div>
- <div data-bs-toggle="tooltip" title="1st species" id="binary-bit-34" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#fab277;">0</div>
- <div data-bs-toggle="tooltip" title="1st species" id="binary-bit-35" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#fab277;">0</div>
- <div data-bs-toggle="tooltip" title="1st species" id="binary-bit-36" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#fab277;">0</div>
- <div data-bs-toggle="tooltip" title="1st species" id="binary-bit-37" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#fab277;">1</div>
- <div data-bs-toggle="tooltip" title="2nd species" id="binary-bit-38" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#faf377;">0</div>
- <div data-bs-toggle="tooltip" title="2nd species" id="binary-bit-39" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#faf377;">0</div>
- <div data-bs-toggle="tooltip" title="2nd species" id="binary-bit-40" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#faf377;">0</div>
- <div data-bs-toggle="tooltip" title="2nd species" id="binary-bit-41" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#faf377;">0</div>
- <div data-bs-toggle="tooltip" title="Romantic alignment" id="binary-bit-42" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color: #4d5cff;">0</div>
- <div data-bs-toggle="tooltip" title="Romantic alignment" id="binary-bit-43" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color: #4d5cff;">0</div>
- <div data-bs-toggle="tooltip" title="Romantic alignment" id="binary-bit-44" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color: #4d5cff;">0</div>
- <div data-bs-toggle="tooltip" title="Romantic alignment" id="binary-bit-45" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color: #4d5cff;">0</div>
- <div data-bs-toggle="tooltip" title="Robot" id="binary-bit-46" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;">0</div>
- <div data-bs-toggle="tooltip" title="Plush" id="binary-bit-47" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#6610f2;">0</div>
- <div data-bs-toggle="tooltip" title="Value reserved for future use" id="binary-bit-48" class="text-muted font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;">0</div>
- </div>
- <br>
- <p>
- <input onchange="calculateInput();" onkeydown="calculateInput()" onkeyup="calculateInput()" value="2048" id="input" type="number" class="form-control" style="width:256px;display: inline-block;color:white;background:#111;border-color:#222;" maxlength="15" max="281474976710655" min="2048"><br>
- <code id="output-bin">0b000000000000000000000000000000000000100000000000</code>, <code id="output-hex">0x000008000000</code>, <code id="output-dec">2048</code>
- </p>
- <script>
- for (let i = 1; i <= 48; i++) {
- document.getElementById("binary-bit-" + i).onclick = (event) => {
- let el = event.target;
- console.log(el, el.innerText);
-
- if (el.innerText === "0") {
- el.innerText = "1";
- } else {
- el.innerText = "0";
- }
-
- calculateOutput();
-
- let binString = ("0".repeat(48 - parseInt(document.getElementById("input").value).toString(2).length)) + parseInt(document.getElementById("input").value).toString(2);
- let bin = binString.split("").map((i) => parseInt(i));
-
- for (let i = 1; i <= 48; i++) {
- if (bin[i - 1]) {
- document.getElementById("binary-bit-" + i).innerText = bin[i - 1].toString();
- } else {
- document.getElementById("binary-bit-" + i).innerText = "0";
- }
- }
-
- display(binString);
- setColors();
- }
-
- setColors()
- }
-
- function setColors() {
- for (let i = 1; i <= 48; i++) {
- let e = document.getElementById("binary-bit-" + i);
- if (e.title !== "Value reserved for future use") {
- e.style.color = "";
-
- e.classList.remove("text-info");
- e.classList.remove("text-warning");
- e.classList.remove("text-light");
- e.classList.remove("text-dark");
-
- if (e.innerText === "0") {
- e.classList.remove("text-success");
- e.classList.add("text-danger");
- } else {
- e.classList.add("text-success");
- e.classList.remove("text-danger");
- }
- } else {
- e.style.cursor = "not-allowed";
- e.onclick = null;
- }
- }
- }
-
- function display(binString) {
- let sharedMemory = parseInt(binString.substring(8 + 16, 10 + 16), 2);
- let little = parseInt(binString.substring(11 + 16, 13 + 16), 2);
- let protector = binString.substring(13 + 16, 14 + 16) !== "0";
- let fictive = binString.substring(14 + 16, 15 + 16) !== "0";
- let robot = binString.substring(29 + 16, 30 + 16) !== "0";
- let plush = binString.substring(30 + 16, 31 + 16) !== "0";
- let species1 = binString.substring(17 + 16, 21 + 16);
- let species2 = binString.substring(21 + 16, 25 + 16);
- let food = parseInt(binString.substring(16, 2 + 16), 2);
- let nonverbal = binString.substring(15, 16) !== "0";
- let lessFrequent = binString.substring(14, 15) !== "0";
- let sexuallyActive = binString.substring(13, 14) !== "0";
- let leader = binString.substring(11, 12) !== "0";
- let persecutor = binString.substring(10, 11) !== "0";
- let polyamorous1 = binString.substring(18, 19) !== "0";
- let polyamorous2 = binString.substring(19, 20) !== "0";
- let alignment1 = binString.substring(20, 24);
- let alignment2 = binString.substring(25 + 16, 29 + 16);
- let sexualFeatures = binString.substring(12, 13) !== "0";
-
- document.getElementById("value-0").value = sharedMemory;
- document.getElementById("value-1").value = little;
- document.getElementById("value-2").value = species1;
- document.getElementById("value-3").value = species2;
- document.getElementById("value-5").checked = protector;
- document.getElementById("value-6").checked = fictive;
- document.getElementById("value-9").checked = robot;
- document.getElementById("value-10").checked = plush;
- document.getElementById("value-11").value = food;
- document.getElementById("value-16").checked = nonverbal;
- document.getElementById("value-17").checked = lessFrequent;
- document.getElementById("value-18").checked = sexuallyActive;
- document.getElementById("value-20").checked = leader;
- document.getElementById("value-21").checked = persecutor;
- document.getElementById("value-22").checked = polyamorous1;
- document.getElementById("value-23").checked = polyamorous2;
- document.getElementById("value-24").value = alignment1;
- document.getElementById("value-25").value = alignment2;
- document.getElementById("value-26").checked = sexualFeatures;
-
- setColors();
- }
-
- function calculateOutput() {
- let bin = [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null].map((_, i) => {
- let e = i + 1;
- return document.getElementById("binary-bit-" + e).innerText;
- }).join("");
-
- document.getElementById("output-bin").innerText = "0b" + bin;
-
- let hex = parseInt(bin, 2).toString(16);
-
- document.getElementById("output-hex").innerText = "0x" + "0".repeat(12 - hex.length) + hex;
- document.getElementById("output-dec").innerText = parseInt(bin, 2).toString();
- document.getElementById("input").value = parseInt(bin, 2).toString();
- }
-
- function calculateInput() {
- if (parseInt(document.getElementById("input").value).toString().length > 15) return;
-
- let binString = ("0".repeat(48 - parseInt(document.getElementById("input").value).toString(2).length)) + parseInt(document.getElementById("input").value).toString(2);
- let bin = binString.split("").map((i) => parseInt(i));
-
- for (let i = 1; i <= 48; i++) {
- if (bin[i - 1]) {
- document.getElementById("binary-bit-" + i).innerText = bin[i - 1].toString();
- } else {
- document.getElementById("binary-bit-" + i).innerText = "0";
- }
- }
-
- display(binString);
- calculateOutput();
- setColors();
-
- return bin;
- }
-
- function updateFromSelection() {
- let val0 = document.getElementById("value-0").value;
- let val1 = document.getElementById("value-1").value;
- let val2 = document.getElementById("value-2").value;
- let val3 = document.getElementById("value-3").value;
- let val5 = document.getElementById("value-5").checked;
- let val6 = document.getElementById("value-6").checked;
- let val9 = document.getElementById("value-9").checked;
- let val10 = document.getElementById("value-10").checked;
- let val11 = document.getElementById("value-11").value;
- let val16 = document.getElementById("value-16").checked;
- let val17 = document.getElementById("value-17").checked;
- let val18 = document.getElementById("value-18").checked;
- let val20 = document.getElementById("value-20").checked;
- let val21 = document.getElementById("value-21").checked;
- let val22 = document.getElementById("value-22").checked;
- let val23 = document.getElementById("value-23").checked;
- let val24 = document.getElementById("value-24").value;
- let val25 = document.getElementById("value-25").value;
- let val26 = document.getElementById("value-26").checked;
-
- let val0bin = parseInt(val0).toString(2);
- val0bin = val0bin.length === 1 ? "0" + val0bin : val0bin;
-
- let val1bin = parseInt(val1).toString(2);
- val1bin = val1bin.length === 1 ? "0" + val1bin : val1bin;
-
- let val11bin = parseInt(val11).toString(2);
- val11bin = val11bin.length === 1 ? "0" + val11bin : val11bin;
-
- let val2bin = val2;
- let val3bin = val3;
- let val24bin = val24;
- let val25bin = val25;
-
- let val4bin = "0";
- let val7bin = "0";
- let val8bin = "0";
- let val15bin = "0";
-
- let val5bin = val5 ? "1" : "0";
- let val6bin = val6 ? "1" : "0";
- let val9bin = val9 ? "1" : "0";
- let val10bin = val10 ? "1" : "0";
- let val16bin = val16 ? "1" : "0";
- let val17bin = val17 ? "1" : "0";
- let val18bin = val18 ? "1" : "0";
- let val20bin = val20 ? "1" : "0";
- let val21bin = val21 ? "1" : "0";
- let val22bin = val22 ? "1" : "0";
- let val23bin = val23 ? "1" : "0";
- let val26bin = val26 ? "1" : "0";
-
- let bin = "0000000000" + val21bin + val20bin + val26bin + val18bin + val17bin + val16bin + val11bin + val22bin + val23bin + val24bin + val0bin + val4bin + val1bin + val5bin + val6bin + val7bin + val8bin + val2bin + val3bin + val25bin + val9bin + val10bin + val15bin;
-
- console.log(bin, parseInt(bin, 2));
-
- let parts = bin.split("").map((i) => parseInt(i));
-
- for (let i = 1; i <= 48; i++) {
- if (parts[i - 1]) {
- document.getElementById("binary-bit-" + i).innerText = parts[i - 1].toString();
- } else {
- document.getElementById("binary-bit-" + i).innerText = "0";
- }
- }
-
- calculateOutput();
- setColors();
- }
- </script>
-
- <table style="margin-bottom: 1rem;">
- <tbody>
- <tr>
- <td style="padding-right: 10px; text-align: right;">
- <b>Memory polling: </b>
- </td>
- <td>
- <select class="tooltip-nohelp form-select" style='display:inline-block;width:max-content;color:white;background-color:#111;border-color:#222;background-image:url("data:image/svg+xml,%3csvg xmlns=&apos;http://www.w3.org/2000/svg&apos; viewBox=&apos;0 0 16 16&apos;%3e%3cpath fill=&apos;none&apos; stroke=&apos;%23ffffff&apos; stroke-linecap=&apos;round&apos; stroke-linejoin=&apos;round&apos; stroke-width=&apos;2&apos; d=&apos;M2 5l6 6 6-6&apos;/%3e%3c/svg%3e");' id="value-0" onchange="updateFromSelection();">
- <option value="2">Doing subconsciously</option>
- <option value="1">Consciously willing</option>
- <option value="0" selected>Incapable/not willing</option>
- </select>
- </td>
- </tr><tr>
- <td style="padding-right: 10px; text-align: right;">
- <b>Food: </b>
- </td>
- <td>
- <select class="tooltip-nohelp form-select" style='display:inline-block;width:max-content;color:white;background-color:#111;border-color:#222;background-image:url("data:image/svg+xml,%3csvg xmlns=&apos;http://www.w3.org/2000/svg&apos; viewBox=&apos;0 0 16 16&apos;%3e%3cpath fill=&apos;none&apos; stroke=&apos;%23ffffff&apos; stroke-linecap=&apos;round&apos; stroke-linejoin=&apos;round&apos; stroke-width=&apos;2&apos; d=&apos;M2 5l6 6 6-6&apos;/%3e%3c/svg%3e");' id="value-11" onchange="updateFromSelection();">
- <option value="0" selected>Doesn't need to eat</option>
- <option value="1">Can't eat fish or meat</option>
- <option value="2">Can't eat meat</option>
- <option value="3">Can eat everything</option>
- </select>
- </td>
- </tr><tr style="display:none;">
- <td style="padding-right: 10px; text-align: right;">
- <b>Little/younger: </b>
- </td>
- <td>
- <select class="tooltip-nohelp form-select" style='display:inline-block;width:max-content;color:white;background-color:#111;border-color:#222;background-image:url("data:image/svg+xml,%3csvg xmlns=&apos;http://www.w3.org/2000/svg&apos; viewBox=&apos;0 0 16 16&apos;%3e%3cpath fill=&apos;none&apos; stroke=&apos;%23ffffff&apos; stroke-linecap=&apos;round&apos; stroke-linejoin=&apos;round&apos; stroke-width=&apos;2&apos; d=&apos;M2 5l6 6 6-6&apos;/%3e%3c/svg%3e");' id="value-1" onchange="updateFromSelection();">
- <option value="0" selected>None</option>
- <option value="2">Little</option>
- <option value="3">Younger</option>
- <option value="1" disabled>Age regressor (old)</option>
- </select>
- </td>
- </tr><tr>
- <td style="padding-right: 10px; text-align: right;">
- <b>Species: </b>
- </td>
- <td>
- <select class="tooltip-nohelp form-select" style='display:inline-block;width:max-content;color:white;background-color:#111;border-color:#222;background-image:url("data:image/svg+xml,%3csvg xmlns=&apos;http://www.w3.org/2000/svg&apos; viewBox=&apos;0 0 16 16&apos;%3e%3cpath fill=&apos;none&apos; stroke=&apos;%23ffffff&apos; stroke-linecap=&apos;round&apos; stroke-linejoin=&apos;round&apos; stroke-width=&apos;2&apos; d=&apos;M2 5l6 6 6-6&apos;/%3e%3c/svg%3e");' id="value-2" onchange="updateFromSelection();">
- <option value="0000" disabled>None</option>
- <option value="0001">Earth pony</option>
- <option value="0010">Unicorn</option>
- <option value="0011">Pegasus</option>
- <option value="0100">Alicorn</option>
- <option value="0101">Bat pony</option>
- <option value="0110">Crystal pony</option>
- <option value="0111">Changeling</option>
- </select>
- <select class="tooltip-nohelp form-select" style='display:inline-block;width:max-content;color:white;background-color:#111;border-color:#222;background-image:url("data:image/svg+xml,%3csvg xmlns=&apos;http://www.w3.org/2000/svg&apos; viewBox=&apos;0 0 16 16&apos;%3e%3cpath fill=&apos;none&apos; stroke=&apos;%23ffffff&apos; stroke-linecap=&apos;round&apos; stroke-linejoin=&apos;round&apos; stroke-width=&apos;2&apos; d=&apos;M2 5l6 6 6-6&apos;/%3e%3c/svg%3e");' id="value-3" onchange="updateFromSelection();">
- <option value="0000">None</option>
- <option value="0001">Earth pony</option>
- <option value="0010">Unicorn</option>
- <option value="0011">Pegasus</option>
- <option value="0100">Alicorn</option>
- <option value="0101">Bat pony</option>
- <option value="0110">Crystal pony</option>
- <option value="0111">Changeling</option>
- </select>
- <select class="tooltip-nohelp form-select" style='display:none;width:max-content;color:white;background-color:#111;border-color:#222;background-image:url("data:image/svg+xml,%3csvg xmlns=&apos;http://www.w3.org/2000/svg&apos; viewBox=&apos;0 0 16 16&apos;%3e%3cpath fill=&apos;none&apos; stroke=&apos;%23ffffff&apos; stroke-linecap=&apos;round&apos; stroke-linejoin=&apos;round&apos; stroke-width=&apos;2&apos; d=&apos;M2 5l6 6 6-6&apos;/%3e%3c/svg%3e");' id="value-14" onchange="updateFromSelection();">
- <option value="0000">None</option>
- <option value="0001">Earth pony</option>
- <option value="0010">Unicorn</option>
- <option value="0011">Pegasus</option>
- <option value="0100">Alicorn</option>
- <option value="0101">Bat pony</option>
- <option value="0110">Crystal pony</option>
- <option value="0111">Changeling</option>
- </select>
- </td>
- </tr><tr>
- <td style="padding-right: 10px; text-align: right;">
- <b>Alignment: </b>
- </td>
- <td>
- <select class="tooltip-nohelp form-select" style='display:inline-block;width:max-content;color:white;background-color:#111;border-color:#222;background-image:url("data:image/svg+xml,%3csvg xmlns=&apos;http://www.w3.org/2000/svg&apos; viewBox=&apos;0 0 16 16&apos;%3e%3cpath fill=&apos;none&apos; stroke=&apos;%23ffffff&apos; stroke-linecap=&apos;round&apos; stroke-linejoin=&apos;round&apos; stroke-width=&apos;2&apos; d=&apos;M2 5l6 6 6-6&apos;/%3e%3c/svg%3e");' id="value-24" onchange="updateFromSelection();">
- <option value="0000">Asexual</option>
- <option value="0001">Heterosexual</option>
- <option value="0010">Homosexual</option>
- <option value="0011">Bisexual</option>
- <option value="0100">Pansexual</option>
- </select>
- <select class="tooltip-nohelp form-select" style='display:inline-block;width:max-content;color:white;background-color:#111;border-color:#222;background-image:url("data:image/svg+xml,%3csvg xmlns=&apos;http://www.w3.org/2000/svg&apos; viewBox=&apos;0 0 16 16&apos;%3e%3cpath fill=&apos;none&apos; stroke=&apos;%23ffffff&apos; stroke-linecap=&apos;round&apos; stroke-linejoin=&apos;round&apos; stroke-width=&apos;2&apos; d=&apos;M2 5l6 6 6-6&apos;/%3e%3c/svg%3e");' id="value-25" onchange="updateFromSelection();">
- <option value="0000">Aromantic</option>
- <option value="0001">Heteroromantic</option>
- <option value="0010">Homoromantic</option>
- <option value="0011">Biromantic</option>
- <option value="0100">Panromantic</option>
- </select>
- </td>
- </tr>
- </tbody>
- </table>
- <p>
- <label style="margin-bottom:5px;">
- <input class="form-check-input" type="checkbox" id="value-5" onchange="updateFromSelection();">
- Protector
- </label><br>
- <label style="margin-bottom:5px;">
- <input class="form-check-input" type="checkbox" id="value-20" onchange="updateFromSelection();">
- Leader
- </label><br>
- <label style="margin-bottom:5px;">
- <input class="form-check-input" type="checkbox" id="value-6" onchange="updateFromSelection();">
- Fictive
- </label><br>
- <label style="margin-bottom:5px;">
- <input class="form-check-input" type="checkbox" id="value-26" onchange="updateFromSelection();">
- Enable sexual features (for ponies below 16)
- </label><br>
- <label style="margin-bottom:5px;">
- <input class="form-check-input" type="checkbox" id="value-18" onchange="updateFromSelection();">
- Preemptive sexual consent
- </label><br>
- <label style="margin-bottom:5px;">
- <input class="form-check-input" type="checkbox" id="value-9" onchange="updateFromSelection();">
- Robot
- </label><br>
- <label style="margin-bottom:5px;">
- <input class="form-check-input" type="checkbox" id="value-10" onchange="updateFromSelection();">
- Plush
- </label><br>
- <label style="margin-bottom:5px;">
- <input class="form-check-input" type="checkbox" id="value-22" onchange="updateFromSelection();">
- Polyamorous (romantic)
- </label><br>
- <label style="margin-bottom:5px;">
- <input class="form-check-input" type="checkbox" id="value-23" onchange="updateFromSelection();">
- Polyamorous (sexual)
- </label><br>
- <label style="margin-bottom:5px;">
- <input class="form-check-input" type="checkbox" id="value-16" onchange="updateFromSelection();">
- Non verbal in real life
- </label><br>
- <label style="margin-bottom:5px;">
- <input class="form-check-input" type="checkbox" id="value-17" onchange="updateFromSelection();">
- Fronts less frequently
- </label><br>
- <label style="margin-bottom:5px;">
- <input class="form-check-input" type="checkbox" id="value-21" onchange="updateFromSelection();">
- Persecutor
- </label><br>
- </p>
-
- <div id="deprecated-options" style="display: none;">
- <hr>
- <details>
- <summary>Show deprecated options</summary>
-
- <p>Nothing here lol</p>
- </details>
- </div>
-</div>
-
-<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?>
diff --git a/pages/metadata.inc b/pages/metadata.inc
index 870ca42..5e2c452 100644
--- a/pages/metadata.inc
+++ b/pages/metadata.inc
@@ -67,6 +67,40 @@ if ($member === null) {
$toUpdate["bitset"] = (int)$_GET["bitset"];
}
+ if (isset($_GET["food"]) && is_numeric($_GET["food"])) {
+ $toUpdate["food"] = (int)$_GET["food"];
+ }
+
+ if (isset($_GET["shared_memory"]) && is_numeric($_GET["shared_memory"])) {
+ $toUpdate["shared_memory"] = (int)$_GET["shared_memory"];
+ }
+
+ if (isset($_GET["species"][0])) {
+ if (trim($_GET["species"][0]) === "") {
+ $toUpdate["species"][0] = null;
+ } else {
+ $toUpdate["species"][0] = $_GET["species"][0];
+ }
+ }
+
+ if (isset($_GET["species"][1])) {
+ if (trim($_GET["species"][1]) === "") {
+ $toUpdate["species"][1] = null;
+ } else {
+ $toUpdate["species"][1] = $_GET["species"][1];
+ }
+ }
+
+ $toUpdate["alignment"] = [];
+
+ if (isset($_GET["alignment"]["sexual"])) {
+ $toUpdate["alignment"]["sexual"] = $_GET["alignment"]["sexual"];
+ }
+
+ if (isset($_GET["alignment"]["romantic"])) {
+ $toUpdate["alignment"]["romantic"] = $_GET["alignment"]["romantic"];
+ }
+
if (isset($_GET["interest"])) {
$toUpdate["interest"] = strip_tags($_GET["interest"]);
}
@@ -122,23 +156,28 @@ if ($member === null) {
$toUpdate["code"] = $_GET['membc'];
}
+ $flags = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/flags.json"), true);
+
+ foreach ($flags as $id => $name) if (!is_array($name)) {
+ if (isset($_GET['flags'][$id])) {
+ $toUpdate[$id] = true;
+ } else {
+ $toUpdate[$id] = false;
+ }
+ } else foreach ($name as $id2 => $_) {
+ if (isset($_GET['flags'][$id][$id2])) {
+ $toUpdate[$id][$id2] = true;
+ } else {
+ $toUpdate[$id][$id2] = false;
+ }
+ }
+
foreach ($toUpdate as $item => $value) {
$metadata[$item] = $value;
}
- $metadata = [
- "bitset" => $metadata["bitset"] ?? 0,
- "regression" => $metadata["regression"] ?? null,
- "median" => $metadata["median"] ?? null,
- "sexfriends" => $metadata["sexfriends"] ?? [],
- "marefriends" => $metadata["marefriends"] ?? [],
- "sisters" => $metadata["sisters"] ?? [],
- "caretakers" => $metadata["caretakers"] ?? [],
- "heat" => $metadata["heat"] ?? null,
- "birth" => $metadata["birth"] ?? ["age" => 0, "date" => "01-01", "year" => null],
- "code" => $metadata["code"] ?? null,
- "interest" => $metadata["interest"] ?? null
- ];
+ if (isset($metadata["bitset"])) unset($metadata["bitset"]);
+ if (trim($metadata["species"][1]) === "") unset($metadata["species"][1]);
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $memberID . ".json", json_encode($metadata));
diff --git a/pages/rules.inc b/pages/rules.inc
index bf156f2..7257cf1 100644
--- a/pages/rules.inc
+++ b/pages/rules.inc
@@ -29,7 +29,7 @@ if (isset($_POST["updateRules"])) {
$_POST["payload"][$index] = $rule;
}
- file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/rules/rules.json", utf8_encode(json_encode($_POST["payload"])));
+ file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/rules/rules.json", json_encode($_POST["payload"]));
header("Location: /-/rules");
die();
@@ -60,7 +60,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc';
<?php $index = 1; foreach ($rules as $rule): ?>
<h4 style="margin-top: 20px;">
- <b>Rule <?= $index ?>: <?= strip_tags($rule["name"]) ?></b>
+ <b>Rule <?= $index ?>: <?= str_replace("<", "&lt;", str_replace(">", "&gt;", $rule["name"])) ?></b>
<?php if (in_array(false, $rule["approved"])): ?>
<span class="badge bg-warning text-black rounded-pill">Unapproved</span>
<?php endif; ?>
@@ -103,7 +103,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc';
</div>
<?php endif; ?>
<div>
- <p><?= $Parsedown->text(strip_tags($rule["content"])) ?></p>
+ <p><?= $Parsedown->text(str_replace("<", "&lt;", str_replace(">", "&gt;", $rule["content"]))) ?></p>
</div>
</li>
<?php $index++; endforeach; ?>
@@ -132,9 +132,9 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc';
<?php $index = 1; foreach ($rules as $rule): ?>
<div <?= $index === 1 ? 'id="default-rule"' : '' ?>>
<p><b <?= $index === 1 ? 'id="default-rule--number"' : '' ?>>Rule #<?= $index ?>:</b></p>
- <input <?= $index === 1 ? 'id="default-rule--name"' : '' ?> type="text" placeholder="Rule name" class="form-control" style="margin-bottom:15px;color:white;background:#111;border-color:#222;" name="payload[<?= $index - 1 ?>][name]" value="<?= str_replace('"', "&quot;", strip_tags($rule["name"])) ?>">
+ <input <?= $index === 1 ? 'id="default-rule--name"' : '' ?> type="text" placeholder="Rule name" class="form-control" style="margin-bottom:15px;color:white;background:#111;border-color:#222;" name="payload[<?= $index - 1 ?>][name]" value="<?= str_replace('"', "&quot;", str_replace("<", "&lt;", str_replace(">", "&gt;", $rule["name"]))) ?>">
- <textarea <?= $index === 1 ? 'id="default-rule--content"' : '' ?> name="payload[<?= $index - 1 ?>][content]" rows="5" class="form-control" style="resize: none;color:white;background:#111;border-color:#222;" placeholder="Rule details"><?= strip_tags($rule["content"] ?? "") ?></textarea>
+ <textarea <?= $index === 1 ? 'id="default-rule--content"' : '' ?> name="payload[<?= $index - 1 ?>][content]" rows="5" class="form-control" style="resize: none;color:white;background:#111;border-color:#222;" placeholder="Rule details"><?= str_replace("<", "&lt;", str_replace(">", "&gt;", $rule["content"] ?? "")) ?></textarea>
<label style="margin-top:10px;margin-left:5px;">
<input <?= $index === 1 ? 'id="default-rule--approval-1"' : '' ?> <?= ($rule["approved"][0] ?? false) ? "checked" : "" ?> type="checkbox" class="form-check-input" name="payload[<?= $index - 1 ?>][approved][0]">