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) --- pages/bitset.inc | 457 ----------------------------------------------------- pages/metadata.inc | 65 ++++++-- pages/rules.inc | 10 +- 3 files changed, 57 insertions(+), 475 deletions(-) delete mode 100644 pages/bitset.inc (limited to 'pages') 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 @@ - - - - - - - - -
-
-
-

Bitset calculator

-
-
-
0
-
0
-
0
-
0
-
0
-
0
-
0
-
0
-
0
-
0
-
0
-
0
-
0
-
0
-
0
-
0
-
0
-
0
-
0
-
0
-
0
-
0
-
0
-
0
-
0
-
0
-
0
-
0
-
0
-
0
-
0
-
0
-
0
-
0
-
0
-
0
-
1
-
0
-
0
-
0
-
0
-
0
-
0
-
0
-
0
-
0
-
0
-
0
-
-
-

-
- 0b000000000000000000000000000000000000100000000000, 0x000008000000, 2048 -

- - - - - - - - - - - - - - - - - - - - - -
- Memory polling: - - -
- Food: - - -
- Little/younger: - - -
- Species: - - - - -
- Alignment: - - - -
-

-
-
-
-
-
-
-
-
-
-
-
-
-

- - -
- - 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';

- Rule : + Rule : ", ">", $rule["name"])) ?> Unapproved @@ -103,7 +103,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc';
-

text(strip_tags($rule["content"])) ?>

+

text(str_replace("<", "<", str_replace(">", ">", $rule["content"]))) ?>

@@ -132,9 +132,9 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc';
>

>Rule #:

- type="text" placeholder="Rule name" class="form-control" style="margin-bottom:15px;color:white;background:#111;border-color:#222;" name="payload[][name]" value=""> + type="text" placeholder="Rule name" class="form-control" style="margin-bottom:15px;color:white;background:#111;border-color:#222;" name="payload[][name]" value="", ">", $rule["name"]))) ?>"> - +