summaryrefslogtreecommitdiff
path: root/includes/util/profiles.inc
diff options
context:
space:
mode:
authorRaindropsSys <raindrops@equestria.dev>2023-11-18 11:34:36 +0100
committerRaindropsSys <raindrops@equestria.dev>2023-11-18 11:34:36 +0100
commit9337aae8b1c87fad34884dacd5cd79d9591c60db (patch)
tree5340f9fa67cd6236e4c879f0057d51d0b1e21361 /includes/util/profiles.inc
parent953ddd82e48dd206cef5ac94456549aed13b3ad5 (diff)
downloadpluralconnect-9337aae8b1c87fad34884dacd5cd79d9591c60db.tar.gz
pluralconnect-9337aae8b1c87fad34884dacd5cd79d9591c60db.tar.bz2
pluralconnect-9337aae8b1c87fad34884dacd5cd79d9591c60db.zip
Updated 39 files, added 86 files, deleted 40 files and renamed 2 files (automated)
Diffstat (limited to 'includes/util/profiles.inc')
-rw-r--r--includes/util/profiles.inc97
1 files changed, 0 insertions, 97 deletions
diff --git a/includes/util/profiles.inc b/includes/util/profiles.inc
deleted file mode 100644
index 66274c7..0000000
--- a/includes/util/profiles.inc
+++ /dev/null
@@ -1,97 +0,0 @@
-<?php
-
-function calculateProfileScore($member) {
- $values = [
- ((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"])),
- 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