From 30303a3ad0d0f31d93c25f42bfd10d70e8277b72 Mon Sep 17 00:00:00 2001 From: Minteck Date: Sat, 10 Dec 2022 22:27:08 +0100 Subject: Update --- includes/profiles.inc | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 includes/profiles.inc (limited to 'includes/profiles.inc') diff --git a/includes/profiles.inc b/includes/profiles.inc new file mode 100644 index 0000000..66274c7 --- /dev/null +++ b/includes/profiles.inc @@ -0,0 +1,97 @@ + 0) || isset($member["_metadata"]["birth"]["year"]) && $member["_metadata"]["birth"]["year"] > 1900) || ((isset($member["_metadata"]["birth"]["age"]) && $member["_metadata"]["birth"]["age"] === -1) && in_array("alicorn", $member["_metadata"]["species"])), + isset($member["_metadata"]["birth"]["date"]) && trim($member["_metadata"]["birth"]["date"]) !== "" && $member["_metadata"]["birth"]["date"] !== "01-01", + file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/" . $member["id"] . ".html") && strlen(preg_replace("/[^a-zA-Z0-9]/m", "", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/" . $member["id"] . ".html"))) > 200, + file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/" . $member["id"] . "-private.html") && strlen(preg_replace("/[^a-zA-Z0-9]/m", "", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/" . $member["id"] . "-private.html"))) > 200, + isset($member["banner"]), + file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member["name"] . ".png"), + isset($member["color"]) + ]; + + $result = [ + "values" => $values, + "pages" => [], + "characters" => [], + "score" => (float)array_reduce($values, function ($a, $b) { + return $a + $b; + }), + "score2" => (float)array_reduce($values, function ($a, $b) { + return $a + $b; + }), + "actions" => [] + ]; + + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/" . $member["id"] . ".html") && strlen(preg_replace("/[^a-zA-Z0-9]/m", "", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/" . $member["id"] . ".html"))) <= 200) { + $result["pages"][] = true; + $result["score"] += strlen(preg_replace("/[^a-zA-Z0-9]/m", "", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/" . $member["id"] . ".html"))) / 201; + } else { + $result["pages"][] = false; + } + + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/" . $member["id"] . "-private.html") && strlen(preg_replace("/[^a-zA-Z0-9]/m", "", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/" . $member["id"] . "-private.html"))) <= 200) { + $result["pages"][] = true; + $result["score"] += strlen(preg_replace("/[^a-zA-Z0-9]/m", "", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/" . $member["id"] . "-private.html"))) / 201; + } else { + $result["pages"][] = false; + } + + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/" . $member["id"] . ".html")) { + $result["characters"][] = strlen(preg_replace("/[^a-zA-Z0-9]/m", "", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/" . $member["id"] . ".html"))); + } else { + $result["characters"][] = -1; + } + + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/" . $member["id"] . "-private.html")) { + $result["characters"][] = strlen(preg_replace("/[^a-zA-Z0-9]/m", "", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/" . $member["id"] . "-private.html"))); + } else { + $result["characters"][] = -1; + } + + if (!((isset($member["_metadata"]["birth"]["age"]) && $member["_metadata"]["birth"]["age"] > 0) || isset($member["_metadata"]["birth"]["year"]) && $member["_metadata"]["birth"]["year"] > 1900) && !(isset($member["_metadata"]["birth"]["age"]) && $member["_metadata"]["birth"]["age"] === -1) && in_array("alicorn", $member["_metadata"]["species"])) { + $result["score"] += 0.5; + } + + $result["progress"] = $result["score"] / 7; + $result["sortable"] = (int)($result["progress"] * 100000000000000); + + if (!$result["values"][5]) { + $result["actions"][] = "a Pony Town character"; + } + + if (!$result["values"][6]) { + $result["actions"][] = "a color"; + } + + if (!$result["values"][2]) { + if ($result["characters"][0] === -1) { + $result["actions"][] = "a public page"; + } else { + $result["actions"][] = (200 - $result["characters"][0]) . " characters to the public page"; + } + } + + if (!$result["values"][3]) { + if ($result["characters"][1] === -1) { + $result["actions"][] = "a private page"; + } else { + $result["actions"][] = (200 - $result["characters"][1]) . " characters to the private page"; + } + } + + if (!$result["values"][4]) { + $result["actions"][] = "a banner"; + } + + if (!$result["values"][0]) { + $result["actions"][] = "an age"; + } + + if (!$result["values"][1]) { + $result["actions"][] = "a birthdate"; + } + + return $result; +} \ No newline at end of file -- cgit