From 885a05be06d0b42835652208c729e5fded451c26 Mon Sep 17 00:00:00 2001 From: Minteck Date: Wed, 8 Feb 2023 22:42:21 +0100 Subject: Updated 9 files, added 2 files and deleted pages/bitset.inc (automated) --- includes/bitset.inc | 142 +------------------------------------ includes/flags.json | 23 ++++++ includes/fullbanner.inc | 7 -- includes/metadata.inc | 182 ++++++++++++++++++++++++++++++------------------ includes/pages.json | 9 --- includes/planner.inc | 20 ++++-- includes/refresh.php | 5 +- 7 files changed, 159 insertions(+), 229 deletions(-) create mode 100644 includes/flags.json (limited to 'includes') 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 @@ "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 @@ - - -
- This member's metadata needs an update. 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: /includes/data/metadata/.json) -
- -
. 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 File

+ +
+ +

General information

+ +
+ General:
+
+ + +
+
+
+ Species
+
+ + +
+
+
+ Alignment
+
+ + +
+
+ +
+ +

Relationships

+

- Bitset
- ยท Edit... - "> -

-

- Sexfriends (full IDs, comma-separated):
+ Sexfriends (full IDs, comma-separated)
">

- Marefriends (full IDs, comma-separated):
+ Marefriends (full IDs, comma-separated)
">

- Sisters (full IDs, comma-separated):
+ Sisters (full IDs, comma-separated)
">

- Caretakers (full IDs, comma-separated):
+ Caretakers (full IDs, comma-separated)
">

- Primary interest (keep it short):
+ Age regressed version (local ID)
+ "> +

+ +
+ +

Technical details

+ +

+ Primary interest (keep it short)
">

- Age regressed version (local ID):
- "> + Member code
+ ">

+ +
+ +

Age information

+

- Birth date (use January 1st for none):
+ Birth date (use January 1st for none)
-">

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

-

- Member code:
- "> -

+ +
+ +

Toggleable flags

+ + $name): if (!is_array($name) && !is_null($name)): ?> +
+ $name2): ?> +
+ + +
+ @@ -66,52 +164,4 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $member
- - - - \ 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 ""; + } + + 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 Other/unknown/fallback pony - " style="width:24px;"> + " style="width:24px;"> @@ -197,7 +207,7 @@ function day($display, $diff): void { if ($diff < 0) $disabled = true; else $dis Other/unknown/fallback pony - " style="width:24px;"> + " style="width:24px;"> @@ -224,7 +234,7 @@ function day($display, $diff): void { if ($diff < 0) $disabled = true; else $dis Other/unknown/fallback pony - " style="width:24px;"> + " style="width:24px;"> @@ -241,7 +251,7 @@ function day($display, $diff): void { if ($diff < 0) $disabled = true; else $dis Other/unknown/fallback pony - " style="width:24px;"> + " style="width:24px;"> @@ -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"); -- cgit