diff options
Diffstat (limited to 'pages/metadata.inc')
-rw-r--r-- | pages/metadata.inc | 65 |
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)); |