summaryrefslogtreecommitdiff
path: root/pages/metadata.inc
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 /pages/metadata.inc
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)
Diffstat (limited to 'pages/metadata.inc')
-rw-r--r--pages/metadata.inc65
1 files changed, 52 insertions, 13 deletions
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));