From e95b208af90cc386a7d8d1bcab426727cf4f0121 Mon Sep 17 00:00:00 2001 From: Minteck Date: Wed, 21 Sep 2022 22:42:33 +0200 Subject: Update time --- includes/ai.php | 311 +++++++++++++++++++++ includes/backup.php | 31 ++- includes/banner.php | 73 +---- includes/bitset.php | 41 +-- includes/edit-private.php | 147 ++++++++++ includes/edit.php | 41 +-- includes/footer.php | 33 +-- includes/functions.php | 29 +- includes/header.php | 153 +++++++---- includes/init.php | 18 ++ includes/keywords.php | 18 +- includes/member.php | 140 ++++++---- includes/member/hierarchy.php | 30 --- includes/pages.json | 162 +++++++++++ includes/planner.php | 614 +++++++++++------------------------------- includes/refresh.php | 56 +++- includes/score.php | 13 +- includes/search.php | 529 ++++++++++++++++++++++++++++++++++++ includes/short.php | 7 +- includes/subsysbanner.php | 15 +- includes/subsysedit.php | 29 -- includes/sysbanner.php | 43 ++- includes/sysedit.php | 29 -- includes/system/history.php | 97 +++++-- includes/system/subsystem.php | 32 +-- includes/travelling.php | 17 +- includes/wakeup.php | 114 ++++++++ 27 files changed, 1942 insertions(+), 880 deletions(-) create mode 100644 includes/ai.php create mode 100644 includes/edit-private.php create mode 100644 includes/init.php create mode 100644 includes/pages.json create mode 100644 includes/search.php create mode 100644 includes/wakeup.php (limited to 'includes') diff --git a/includes/ai.php b/includes/ai.php new file mode 100644 index 0000000..8f5f7ba --- /dev/null +++ b/includes/ai.php @@ -0,0 +1,311 @@ + $metadata["robot"] ? + "robot earth pony" : + (!$metadata["plush"] ? "earth pony" . (component(2, 2) && $canHaveMareSuffix ? " mare" : "") : + "earth pony" . (component(2, 2) && $canHaveMareSuffix ? " mare" : "") . " plush"), + "alicorn" => $metadata["robot"] ? + "robot alicorn" : + (!$metadata["plush"] ? "alicorn" . (component(2, 2) && $canHaveMareSuffix ? " mare" : "") : + "alicorn" . (component(2, 2) && $canHaveMareSuffix ? " mare" : "") . " plush"), + "crystal" => $metadata["robot"] ? + "robot crystal pony" : + (!$metadata["plush"] ? "crystal pony" : + "crystal pony plush"), + "pegasus" => $metadata["robot"] ? + "robot pegasus" : + (!$metadata["plush"] ? "pegasus" . (component(2, 2) && $canHaveMareSuffix ? " mare" : "") : + "pegasus" . (component(2, 2) && $canHaveMareSuffix ? " mare" : "") . " plush"), + "batpony" => $metadata["robot"] ? + "robot batpony" : + (!$metadata["plush"] ? "batpony" . (component(2, 2) && $canHaveMareSuffix ? " mare" : "") : + "batpony" . (component(2, 2) && $canHaveMareSuffix ? " mare" : "") . " plush"), + "unicorn" => $metadata["robot"] ? + "robot unicorn" : + (!$metadata["plush"] ? "unicorn" . (component(2, 2) && $canHaveMareSuffix ? " mare" : "") : + "unicorn" . (component(2, 2) && $canHaveMareSuffix ? " mare" : "") . " plush"), + default => $species . "_" . $metadata["robot"] + }; + } +} + +if (!function_exists("listing")) { + function listing(array $list): string { + $out = ""; + + foreach (array_values($list) as $index => $value) { + $mem = getSystemMember(explode("/", $value)[0], explode("/", $value)[1]); + $value = "" . getMiniName($mem["display_name"] ?? $mem["name"]) . ""; + + if ($index === 0) { + $out = $value; + } else if ($index < count(array_values($list)) - 1) { + $out .= ", " . $value; + } else { + $out .= " and " . $value; + } + } + + return $out; + } +} + +$iam = 0; +$multipleNames = count(explode("/", $memberData["display_name"])) > 1; + +$otherNames = explode("/", $memberData["display_name"]); +array_shift($otherNames); + +if ($memberData["name"] === "scootaloo" && ((int)date('N') - 1) % 2 === 0) { + $metadata["marefriends"] = array_reverse($metadata["marefriends"]); +} + +?> + + +

+ + Hello, + + Hi, + + Hey, + + Hey there!

+ + + + , + + + +the most common fronter +a protector + +of the , + 0): $source = getMember($metadata["median"]); ?> ">, + = 3) ? "and" : (component(2, 2, 1) ? "I'm" : "I am") ?> + + += 3 && component(2, 1, 4)): ?>also + +a and a + +a , a and a + +a = 3 && component(2, 2, 4)): ?> too +, +. + +

+ +

+ + + + Depending on the circumstances, I may not share memories with my headmates + + I may not share memories with my headmates depending on the circumstances + + I sometimes share memories with my headmates + + + + I share memories with my headmates + + I have access to my headmates' memories + + I have access to my headmates' memories + + + + + + + a fictive + + from Equestria + + I come from Equestria + + + + + + + fronting less often + + less often at front + + I like to front less often + + + + + + + nonverbal in real life + + not talking in real life + + I don't talk in real life + + + + + + + 0): ?> + an age regressor + + 0): ?> + capable of age regression + + I can age regress + + + + + + + 0): ?> + younger than the body is + + 0): ?> + younger but not enough to be considered a little + + I feel younger than my headmates + + + + + 0)): ?> + + 0): ?> + affected by spells to make me feel younger + + 0): ?> + affected by age spells + + age regression spells can affect me + + + + + + + 0): ?> + a lot younger than the body is + + 0): ?> + a little + + I feel a lot younger than my headmates + + + +

+ +

+ + + 0): ?> + + 0): ?> + 1): ?>in relationships within a relationship with + + 0): ?> + 1): ?>My marefriends areMy marefriend is + + 0): ?> + 1): ?>are my marefriendsis my marefriend + + I love + + + + + 0): ?> + + 0): ?> + 1): ?>in relationships within a relationship with + + 0): ?> + 1): ?> sisters are sister is + + 0): ?> + 1): ?>are my sistersis my sister + + + I also love as sister 1): ?>s + + 1): ?>are my familyis my family + + + + + + 0): ?> + + 0): ?> + being taken care of by + + 0): ?> + 1): ?> mares who take care of me are mare who takes care of me is + + 0): ?> + 1): ?>are my caretakersis my caretaker + + + I like having take care of me + + take care of me + + + + +

\ No newline at end of file diff --git a/includes/backup.php b/includes/backup.php index 18ed6a4..ad09617 100644 --- a/includes/backup.php +++ b/includes/backup.php @@ -1,5 +1,6 @@ $file, "file" => $dirfile ]; } } else { + echo(" /$file\n"); $files[] = [ "dir" => "", "file" => $file @@ -31,7 +35,9 @@ foreach ($root as $file) { } } +echo(" Reading files...\n"); foreach ($files as $file) { + echo(" /$file[dir]/$file[file]\n"); $file["mime"] = mime_content_type("data/$file[dir]/$file[file]"); $file["checksum"] = [ sha1_file("data/$file[dir]/$file[file]"), @@ -48,6 +54,7 @@ function pkcs7_pad($data, $size) { } if (!file_exists("./data/backup.ponieskey")) { + echo(" Reading encryption key...\n"); $key = openssl_random_pseudo_bytes(512); $iv = openssl_random_pseudo_bytes(16); file_put_contents("./data/backup.ponieskey", base64_encode(json_encode([ @@ -55,27 +62,41 @@ if (!file_exists("./data/backup.ponieskey")) { "key" => bin2hex($key) ]))); } else { + echo(" Creating encryption key...\n"); $key_raw = json_decode(base64_decode(file_get_contents("./data/backup.ponieskey")), true); $key = hex2bin($key_raw["key"]); $iv = hex2bin($key_raw["iv"]); } +echo(" Encrypting...\n"); $payload = json_encode($data); $encrypted = openssl_encrypt(pkcs7_pad($payload, 16), 'AES-256-CBC', $key, OPENSSL_RAW_DATA, $iv); +echo(" Writing backup...\n"); file_put_contents("./data/backup.poniesbackup", $encrypted); @mkdir("./data/encrypted"); $id = str_replace(":", "-", date('c')); copy("./data/backup.poniesbackup", "./data/encrypted/" . $id . ".poniesbackup"); +echo(" Uploading to servers...\n"); + +echo(" bridlewood... upload\n"); exec("scp ./data/encrypted/" . $id . ".poniesbackup fedora@bridlewood.equestria.dev:/opt/ponies"); -exec('ssh fedora@bridlewood.equestria.dev bash -c "cd /opt/ponies; ls -tp | grep -v \'/$\' | tail -n +20 | xargs -I {} rm -- {}"'); +echo(" bridlewood... cleaning up\n"); +exec('ssh fedora@bridlewood.equestria.dev bash /opt/clean.sh'); +echo(" canterlot... upload\n"); exec("scp ./data/encrypted/" . $id . ".poniesbackup root@canterlot.equestria.dev:/opt/ponies"); -exec('ssh root@canterlot.equestria.dev bash -c "cd /opt/ponies; ls -tp | grep -v \'/$\' | tail -n +20 | xargs -I {} rm -- {}"'); +echo(" canterlot... cleaning up\n"); +exec('ssh root@canterlot.equestria.dev bash /opt/clean.sh'); -copy("./data/encrypted/" . $id . ".poniesbackup", "/opt/ponies/" . $id . ".poniesbackup"); -exec('bash -c "cd /opt/ponies; ls -tp | grep -v \'/$\' | tail -n +20 | xargs -I {} rm -- {}"'); +if (file_exists("/opt/ponies")) { + echo(" zephyrheights... copy\n"); + copy("./data/encrypted/" . $id . ".poniesbackup", "/opt/ponies/" . $id . ".poniesbackup"); + echo(" zephyrheights... cleaning up\n"); + exec('bash -c "cd /opt/ponies; ls -tp | grep -v \'/$\' | tail -n +20 | xargs -I {} rm -- {}"'); +} +echo(" Cleaning up...\n"); unlink("./data/encrypted/" . $id . ".poniesbackup"); \ No newline at end of file diff --git a/includes/banner.php b/includes/banner.php index 2582b63..213863a 100644 --- a/includes/banner.php +++ b/includes/banner.php @@ -2,69 +2,9 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $isLoggedIn; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/pronouns.php"; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.php"; $travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling.json"), true); -if (!function_exists("getMiniName")) { - function getMiniName(string $name) { - $parts = explode(" ", $name); - - if (strlen($parts[0]) > 3 && !str_ends_with($parts[0], "e") && $parts[0] !== "Filly") { - if (str_contains($parts[0], "/")) { - return explode("/", $parts[0])[0]; - } else { - return $parts[0]; - } - } else { - return $name; - } - } -} - -if (!function_exists("getSystemMember")) { - function getSystemMember(string $system, string $id) { - $systemID = $system; - - $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-members.json"), true); - $member = null; - - foreach ($members as $m) { - if ($m["id"] === $id) $member = $m; - } - - return $member; - } -} - -if (!function_exists("timeAgo")) { - function timeAgo($time): string { - if (!is_numeric($time)) { - $time = strtotime($time); - } - - $periods = ["second", "minute", "hour", "day", "week", "month", "year", "age"]; - $lengths = array("60", "60", "24", "7", "4.35", "12", "100"); - - $now = time(); - - $difference = $now - $time; - if ($difference <= 10 && $difference >= 0) { - return $tense = "now"; - } elseif ($difference > 0) { - $tense = "ago"; - } else { - $tense = "later"; - } - - for ($j = 0; $difference >= $lengths[$j] && $j < count($lengths)-1; $j++) { - $difference /= $lengths[$j]; - } - - $difference = round($difference); - - $period = $periods[$j] . ($difference >1 ? "s" :''); - return "{$difference} {$period} {$tense}"; - } -} function _header_getMember(string $id, $system) { $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system-members.json"), true); @@ -106,6 +46,7 @@ function _header_getSubsystemFromMember(array $member) { function getMemberBannerData(string $id, string $system, bool $french = false) { global $subsystems; global $travelling; + global $isLoggedIn; $subsystems = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system-subsystems.json"), true) ?? []; @@ -381,6 +322,14 @@ function getMemberBannerData(string $id, string $system, bool $french = false) { ]; } + if (($metadata["sexually_active"] ?? false) && !$french && $isLoggedIn) { + $badges[] = [ + "id" => "sexually_active", + "color" => "d6a833", + "html" => 'Sexually active' + ]; + } + if ($metadata["protector"] ?? false) { $badges[] = [ "id" => "protector", @@ -423,7 +372,7 @@ function getMemberBannerData(string $id, string $system, bool $french = false) { ]; } - if (($metadata["little"] ?? 0) === 1) { + if (($metadata["age_regressor"] ?? false)) { if ($metadata["regression"] !== null && $metadata["regression"] !== false) { $regression = _header_getMember($metadata["regression"], $system); $badges[] = [ diff --git a/includes/bitset.php b/includes/bitset.php index 2e5a645..1d026e5 100644 --- a/includes/bitset.php +++ b/includes/bitset.php @@ -3,24 +3,26 @@ function parseBitset ($bitset) { $bin = str_repeat("0", 48 - strlen(decbin($bitset))) . decbin($bitset); - $sharedMemory = bindec(substr($bin, 8 + 16, 2)); - $median = substr($bin, 10 + 16, 1) !== "0"; - $little = bindec(substr($bin, 11 + 16, 2)); + $sharedMemory = bindec(substr($bin, 24, 2)); + $median = substr($bin, 26, 1) !== "0"; + $little = bindec(substr($bin, 27, 2)); $food = bindec(substr($bin, 16, 2)); $nonverbal = substr($bin, 15, 1) !== "0"; $lessFrequent = substr($bin, 14, 1) !== "0"; - $magic = bindec(substr($bin, 2 + 16, 3)); - $sensitivity = bindec(substr($bin, 5 + 16, 3)); - $protector = substr($bin, 13 + 16, 1) !== "0"; - $fictive = substr($bin, 14 + 16, 1) !== "0"; - $notTalking = substr($bin, 15 + 16, 1) !== "0"; - $host = substr($bin, 16 + 16, 1) !== "0"; - $robot = substr($bin, 29 + 16, 1) !== "0"; - $plush = substr($bin, 30 + 16, 1) !== "0"; - $age = substr($bin, 31 + 16, 1) !== "0"; - $species1 = substr($bin, 17 + 16, 4); - $species2 = substr($bin, 21 + 16, 4); - $species3 = substr($bin, 25 + 16, 4); + $sexuallyActive = substr($bin, 13, 1) !== "0"; + $ageRegressor = substr($bin, 12, 1) !== "0"; + $magic = bindec(substr($bin, 18, 3)); + $sensitivity = bindec(substr($bin, 21, 3)); + $protector = substr($bin, 29, 1) !== "0"; + $fictive = substr($bin, 30, 1) !== "0"; + $notTalking = substr($bin, 31, 1) !== "0"; + $host = substr($bin, 32, 1) !== "0"; + $robot = substr($bin, 45, 1) !== "0"; + $plush = substr($bin, 46, 1) !== "0"; + $age = substr($bin, 47, 1) !== "0"; + $species1 = substr($bin, 33, 4); + $species2 = substr($bin, 37, 4); + $species3 = substr($bin, 41, 4); $species1 = match ($species1) { "0001" => "earth", @@ -52,6 +54,11 @@ function parseBitset ($bitset) { default => null, }; + if ($little === 1) { + $ageRegressor = true; + $little = 0; + } + return [ 'shared_memory' => $sharedMemory, 'median' => $median, @@ -68,6 +75,8 @@ function parseBitset ($bitset) { 'nonverbal' => $nonverbal, 'less_frequent' => $lessFrequent, 'age_spells' => $age, + 'age_regressor' => $ageRegressor, + 'sexually_active' => $sexuallyActive, 'species' => array_filter([ $species1, $species2, @@ -88,6 +97,8 @@ function parseMetadata ($metadata) { $m["regression"] = $metadata["regression"] ?? null; $m["caretakers"] = $metadata["caretakers"] ?? []; $m["median"] = $metadata["median"] ?? null; + $m["birth"] = $metadata["birth"] ?? null; + $m["heat"] = $metadata["heat"] ?? null; } else { $m = $metadata; } diff --git a/includes/edit-private.php b/includes/edit-private.php new file mode 100644 index 0000000..58e9ed5 --- /dev/null +++ b/includes/edit-private.php @@ -0,0 +1,147 @@ + + +
+
+ +
+ +
+ +

+ Saved · bytes · ">View page +

+ + + + + + + + +
+ + \ No newline at end of file diff --git a/includes/edit.php b/includes/edit.php index 85382a0..5bbd38a 100644 --- a/includes/edit.php +++ b/includes/edit.php @@ -1,36 +1,9 @@ -= 0) { - return $tense = "now"; - } elseif ($difference > 0) { - $tense = "ago"; - } else { - $tense = "later"; - } - - for ($j = 0; $difference >= $lengths[$j] && $j < count($lengths)-1; $j++) { - $difference /= $lengths[$j]; - } - - $difference = round($difference); - - $period = $periods[$j] . ($difference >1 ? "s" :''); - return "{$difference} {$period} {$tense}"; +if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $systemID . "-" . $memberID . "-metadata.json")) { + $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $systemID . "-" . $memberID . "-metadata.json"), true)); } -$metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $systemID . "-" . $memberID . "-metadata.json"), true)); - ?>
@@ -42,8 +15,8 @@ $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'
-

- Saved · bytes +

+ Saved · bytes · ">View page

@@ -166,10 +139,6 @@ $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT' } } else { timeSinceLastModified = 0; - document.getElementById("editor-save-status").innerHTML = "Saved"; - document.getElementById("editor-save-status").classList.add("text-muted"); - document.getElementById("editor-save-status").classList.remove("text-warning"); - document.getElementById("editor-save-status").classList.remove("text-primary"); } }, 100) diff --git a/includes/footer.php b/includes/footer.php index 4592b8e..720881a 100644 --- a/includes/footer.php +++ b/includes/footer.php @@ -1,35 +1,6 @@ = 0) { - return $tense = "now"; - } elseif ($difference > 0) { - $tense = "ago"; - } else { - $tense = "later"; - } - - for ($j = 0; $difference >= $lengths[$j] && $j < count($lengths)-1; $j++) { - $difference /= $lengths[$j]; - } - - $difference = round($difference); - - $period = $periods[$j] . ($difference >1 ? "s" :''); - return "{$difference} {$period} {$tense}"; - } -} +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.php"; ?> @@ -58,5 +29,7 @@ if (!function_exists("timeAgo")) { }) + + \ No newline at end of file diff --git a/includes/functions.php b/includes/functions.php index db4a8df..1a2bf4c 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -7,7 +7,7 @@ if (!function_exists("getMiniName")) { function getMiniName(string $name) { $parts = explode(" ", $name); - if (strlen($parts[0]) > 3 && !str_ends_with($parts[0], "e") && $parts[0] !== "Filly") { + if (strlen($parts[0]) > 3 && !str_ends_with($parts[0], "e") && $parts[0] !== "Filly" && $parts[0] !== "Windy") { if (str_contains($parts[0], "/")) { return explode("/", $parts[0])[0]; } else { @@ -19,6 +19,23 @@ if (!function_exists("getMiniName")) { } } +if (!function_exists("withCaretakersDown")) { + function withCaretakersDown(array $ordered): array { + $caretakersNo = []; + $caretakersYes = []; + + foreach ($ordered as $item) { + if ($item["_metadata"]["little"] === 2) { + $caretakersYes[] = $item; + } else { + $caretakersNo[] = $item; + } + } + + return [...$caretakersNo, ...$caretakersYes]; + } +} + if (!function_exists("getSystemMember")) { function getSystemMember(string $system, string $id) { $systemID = $system; @@ -61,7 +78,7 @@ if (!function_exists("showMembersFromList")) {
' . ($member['display_name'] ?? $member['name']) . '
-
' . ($member['travelling'] ? "+" . ($member['proxy_tags'][0]['prefix'] ?? " ") : ($member['proxy_tags'][0]['prefix'] ?? " ")) . '
+
' . (isset($member['travelling']) && $member['travelling'] ? "+" . ($member['proxy_tags'][0]['prefix'] ?? " ") : ($member['proxy_tags'][0]['prefix'] ?? " ")) . '
'); }} } @@ -114,13 +131,13 @@ if (!function_exists("showSystem")) { $i["system"] = $id; return $i; }, array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$id-members.json"), true), function ($i) use ($travelling) { - return !$travelling[$i['id']]['travelling']; + return !(isset($travelling[$i['id']]) && $travelling[$i['id']]['travelling']); })), ...array_map(function ($i) use ($id) { $i["travelling"] = true; $i["system"] = ($id === "gdapd" ? "ynmuc" : "gdapd"); return $i; }, array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($id === "gdapd" ? "ynmuc" : "gdapd") . "-members.json"), true), function ($i) use ($travelling) { - return $travelling[$i['id']]['travelling']; + return isset($travelling[$i['id']]) && $travelling[$i['id']]['travelling']; }))], $id)); echo(' @@ -162,7 +179,7 @@ if (!function_exists("timeAgo")) { $time = strtotime($time); } - $periods = ["second", "minute", "hour", "day", "week", "month", "year", "age"]; + $periods = ["sec.", "mn.", "hr.", "d.", "wk.", "mo.", "y.", "ages"]; $lengths = array("60", "60", "24", "7", "4.35", "12", "100"); $now = time(); @@ -182,7 +199,7 @@ if (!function_exists("timeAgo")) { $difference = round($difference); - $period = $periods[$j] . ($difference >1 ? "s" :''); + $period = $periods[$j]; return "{$difference} {$period} {$tense}"; } } diff --git a/includes/header.php b/includes/header.php index 1f71aa5..91d0aee 100644 --- a/includes/header.php +++ b/includes/header.php @@ -1,4 +1,6 @@ -
  • - Home +
  • - Disclaimers +
  • - Relations +
  • - Terminology +
  • - Message parser +
  • - Prefix generator +
  • @@ -733,21 +776,32 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/ical/main.php"; @@ -829,8 +863,8 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/ical/main.php";
  • - -
  • + +
  • .png" alt="" style="width:24px;vertical-align: middle;">
  • @@ -864,10 +898,27 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/ical/main.php"; About us + 0): ?> +
  • +
  • + +
  • + + +
  • + +
  • - -
  • + +
  • .png" alt="" style="width:24px;vertical-align: middle;">
  • diff --git a/includes/init.php b/includes/init.php new file mode 100644 index 0000000..71d7def --- /dev/null +++ b/includes/init.php @@ -0,0 +1,18 @@ + $keyword, + "link" => $page["link"] + ]; } } + uasort($keywords, function ($a, $b) { + return strlen($b["keyword"]) - strlen($a["keyword"]); + }); + return $keywords; } function replaceKeyWords(string $input): string { $keywords = getKeyWords(); - foreach ($keywords as $keyword => $url) { + foreach ($keywords as $data) { + $keyword = $data["keyword"]; + $url = $data["link"]; + $input = str_replace($keyword, "$keyword", $input); } diff --git a/includes/member.php b/includes/member.php index f8050b0..d0120d5 100644 --- a/includes/member.php +++ b/includes/member.php @@ -10,35 +10,6 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; $travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling.json"), true); -function timeAgo($time): string { - if (!is_numeric($time)) { - $time = strtotime($time); - } - - $periods = ["second", "minute", "hour", "day", "week", "month", "year", "age"]; - $lengths = array("60", "60", "24", "7", "4.35", "12", "100"); - - $now = time(); - - $difference = $now - $time; - if ($difference <= 10 && $difference >= 0) { - return $tense = "now"; - } elseif ($difference > 0) { - $tense = "ago"; - } else { - $tense = "later"; - } - - for ($j = 0; $difference >= $lengths[$j] && $j < count($lengths)-1; $j++) { - $difference /= $lengths[$j]; - } - - $difference = round($difference); - - $period = $periods[$j] . ($difference >1 ? "s" :''); - return "{$difference} {$period} {$tense}"; -} - if ($memberData["name"] !== "unknown" && $memberData["name"] !== "fusion") { $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $systemID . "-" . $memberID . "-metadata.json"), true)); } @@ -78,44 +49,83 @@ if ($memberData["name"] === "fusion") {
    ">
    - Food: + Food:
    "Doesn't need", - 1 => "Can't eat animals", - 2 => "Can't eat meat", - 3 => "No restrictions", + 0 => "Not needed", + 1 => "Not animals", + 2 => "Not meat", + 3 => "All", } ?>
    - Memory access: + Shared memory:
    "No direct access", - 1 => "Partial direct access", - 2 => "Full direct access", + 0 => "None", + 1 => "Partial", + 2 => "Full", } ?>
    - Magic: + Magic:
    "Can't use magic", - 1 => "Can use magic in some cases", - 2 => "Can use a horn", - 3 => "Can use wings", - 4 => "Can use a horn and wings", - 5 => "Can cast spells", + 0 => "None", + 1 => "In some cases", + 2 => "Horn", + 3 => "Wings", + 4 => "Horn and wings", + 5 => "Yes", } ?>
    - Sensitivity: + Sensitivity:
    "Not sensitive", - 1 => "May be sensitive", - 2 => "Affectionately sensitive", - 3 => "Sexually sensitive", + 0 => "None", + 1 => "Maybe", + 2 => "Affectionate", + 3 => "Sexual", 4 => "Affectionate and sexual", } ?>
    +
    + Age:
    + + + - + + " . $metadata["birth"]["age"] . "* years old" ?> + + + + - + + + " . $age . " years old" ?> + + +
    +
    + Birthday:
    + + + + - + +
    @@ -141,6 +151,7 @@ if ($memberData["name"] === "fusion") {
  • Date added: (, )
  • @@ -189,6 +200,12 @@ if ($memberData["name"] === "fusion") { ?> + +
    +
    + AI-generated page: + +
    @@ -197,6 +214,14 @@ if ($memberData["name"] === "fusion") { is visiting the since , therefore currently not in the . + +
    +

    Hello there!

    +

    I'm currently a new headmate slowly figuring myself out.

    +

    Give me some time to figure myself out and see this page change as I find new stuff about my identity. Don't be too worried if I accidentally get pushed to front, it's something that can happen sometimes.

    + Thanks! +
    +
    @@ -222,9 +247,20 @@ if ($memberData["name"] === "fusion") {
    - (edit) + (edit: public, private) + + + + +
    + + + + + +

    This page is automatically generated and may not be 100% accurate.

    + - This page is empty." ?> diff --git a/includes/member/hierarchy.php b/includes/member/hierarchy.php index 39045b3..301bd1c 100644 --- a/includes/member/hierarchy.php +++ b/includes/member/hierarchy.php @@ -10,36 +10,6 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; $travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling.json"), true); -function timeAgo($time): string -{ - if (!is_numeric($time)) { - $time = strtotime($time); - } - - $periods = ["second", "minute", "hour", "day", "week", "month", "year", "age"]; - $lengths = array("60", "60", "24", "7", "4.35", "12", "100"); - - $now = time(); - - $difference = $now - $time; - if ($difference <= 10 && $difference >= 0) { - return $tense = "now"; - } elseif ($difference > 0) { - $tense = "ago"; - } else { - $tense = "later"; - } - - for ($j = 0; $difference >= $lengths[$j] && $j < count($lengths) - 1; $j++) { - $difference /= $lengths[$j]; - } - - $difference = round($difference); - - $period = $periods[$j] . ($difference > 1 ? "s" : ''); - return "{$difference} {$period} {$tense}"; -} - $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $systemID . "-" . $memberID . "-metadata.json"), true)); $allMembers = scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $systemID . "-members.json"), true), $systemID); diff --git a/includes/pages.json b/includes/pages.json new file mode 100644 index 0000000..4fc023b --- /dev/null +++ b/includes/pages.json @@ -0,0 +1,162 @@ +{ + "actions": { + "name": "Actions database", + "short": "Actions", + "admin": true + }, + "api": { + "name": "API", + "short": null, + "admin": false + }, + "app": { + "name": "Mobile application", + "short": null, + "admin": false + }, + "bitset": { + "name": "Bitset calculator", + "short": "Bitset", + "admin": true + }, + "byfront": { + "name": "Members by last fronted", + "short": "Last fronts", + "admin": true + }, + "dashboard": { + "name": "Dashboard", + "short": null, + "admin": true + }, + "debug": { + "name": "Data updater debugging", + "short": null, + "admin": false + }, + "demo": { + "name": "Demo interface", + "short": null, + "admin": false + }, + "docs": { + "name": "Documents", + "short": "Docs", + "admin": true + }, + "disclaimers": { + "name": "Disclaimers", + "short": null, + "admin": false + }, + "edit": { + "name": "Editor", + "short": null, + "admin": true + }, + "edit-private": { + "name": "Editor (private)", + "short": null, + "admin": true + }, + "emergency": { + "name": "Emergency alert", + "short": null, + "admin": true + }, + "fronting": { + "name": "Front planner", + "short": null, + "admin": true + }, + "home": { + "name": "Home", + "short": null, + "admin": false + }, + "login": { + "name": "Login", + "short": null, + "admin": false + }, + "logout": { + "name": "Logout", + "short": null, + "admin": false + }, + "nicknames": { + "name": "Relations nicknames", + "short": "Nicknames", + "admin": true + }, + "page": { + "name": "Member/system page", + "short": null, + "admin": false + }, + "parser": { + "name": "Message parser", + "short": null, + "admin": false + }, + "pleasure": { + "name": "Pleasure alert", + "short": null, + "admin": true + }, + "prefix": { + "name": "Prefix generator", + "short": null, + "admin": false + }, + "relations": { + "name": "Relations", + "short": null, + "admin": false + }, + "rules": { + "name": "Systems rules", + "short": "Rules", + "admin": true + }, + "score": { + "name": "Score system testing", + "short": null, + "admin": true + }, + "splitting": { + "name": "Members by splitting date", + "short": "Splits", + "admin": true + }, + "terminology": { + "name": "Terminology", + "short": null, + "admin": false + }, + "together": { + "name": "Watch Together", + "short": "Together", + "admin": true + }, + "together-dev": { + "name": "Watch Together (dev)", + "short": null, + "admin": true + }, + "toys": { + "name": "Toys database", + "short": "Toys", + "admin": true + }, + "travelling": { + "name": "System travels manager", + "short": null, + "admin": true + }, + "wakeup": { + "name": "Wake-up alert", + "short": null, + "admin": true + } +} \ No newline at end of file diff --git a/includes/planner.php b/includes/planner.php index 64d87e4..8644b25 100644 --- a/includes/planner.php +++ b/includes/planner.php @@ -12,90 +12,18 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.php"; $cloudburst = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-planner.json"), true); $raindrops = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-planner.json"), true); -?> - -

    Front planner

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +function day($display, $diff): void { global $cloudburst; global $raindrops; ?> + - + - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +

    Front planner

    +
    Today
    Cloudburst SystemRaindrops System
    - - - -
    - 0 && count($dayRaindrops) > 0): ?> - will sleep with - - Unable to calculate who will sleep with who - -
    Tomorrow
    0 && count($dayRaindrops) > 0): ?> - will sleep with + will sleep with Unable to calculate who will sleep with who
    Cloudburst SystemRaindrops System
    - - - -
    - 0 && count($dayRaindrops) > 0): ?> - will sleep with - - Unable to calculate who will sleep with who - -
    Cloudburst SystemRaindrops System
    - - - -
    - 0 && count($dayRaindrops) > 0): ?> - will sleep with - - Unable to calculate who will sleep with who - -
    Cloudburst SystemRaindrops System
    - - - -
    - 0 && count($dayRaindrops) > 0): ?> - will sleep with - - Unable to calculate who will sleep with who - -
    Cloudburst SystemRaindrops System
    - - - -
    - 0 && count($dayRaindrops) > 0): ?> - will sleep with - - Unable to calculate who will sleep with who - -
    Cloudburst SystemRaindrops System
    - - - -
    - 0 && count($dayRaindrops) > 0): ?> - will sleep with - - Unable to calculate who will sleep with who - -
    + + + + + + + +
    @@ -637,6 +232,20 @@ $raindrops = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/include cursor: pointer !important; } + .merge-mobile { + display: none; + } + + @media (max-width: 768px) { + .merge-desktop { + display: none; + } + + .merge-mobile { + display: inline; + } + } + @@ -703,7 +312,12 @@ $raindrops = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/include index: id } - document.getElementById("edit-fronter-name").innerText = names[fronting[system][date][id]] ?? fronting[system][date][id]; + if (fronting[system][date][id] === "lzlaq" || fronting[system][date][id] === "irxyh") { + document.getElementById("edit-fronter-name").innerText = "merged members"; + } else { + document.getElementById("edit-fronter-name").innerText = names[fronting[system][date][id]] ?? fronting[system][date][id]; + } + document.getElementById("edit-fronter-date").innerText = display; document.getElementById("edit-fronter-pos").innerText = ordinal(id + 1); document.getElementById("edit-fronter-system").innerText = system === "cloudburst" ? "Cloudburst System" : "Raindrops System"; @@ -756,11 +370,15 @@ $raindrops = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/include window.currentWorkingDate = date; document.getElementById("new-fronter-date").innerText = display; document.getElementById("new-fronter-system").innerText = system === "cloudburst" ? "Cloudburst System" : "Raindrops System"; - document.getElementById("list-" + system).style.display = ""; - document.getElementById("list-" + (system === "cloudburst" ? "raindrops" : "cloudburst")).style.display = "none"; + window.addSystem = system === "raindrops" ? "gdapd" : "ynmuc"; + + document.getElementById("list").style.display = "block"; + document.getElementById("search-results").style.display = "none"; + document.getElementById("search").value = ""; let modal = new bootstrap.Modal(document.getElementById('new-fronter')); modal.show(); + document.getElementById("search").focus(); } function confirmFronterAdd(system, id) { @@ -799,6 +417,11 @@ $raindrops = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/include }); } + function viewFronterPage() { + let id = fronting[window.selectedFronting["system"] === "ynmuc" ? "cloudburst" : "raindrops"][window.selectedFronting["date"]][window.selectedFronting["index"]]; + location.href = "/" + id; + } + function moveFronterUp() { Array.from(document.getElementsByClassName("edit-fronter-link")).forEach((i) => { i.classList.add("disabled"); @@ -812,7 +435,7 @@ $raindrops = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/include } - @@ -281,13 +319,15 @@ function getMember(string $id) { $fronters = array_map(function ($i) { return [ "member" => $i["members"][0], + "member2" => $i["members"][1] ?? null, "date" => strtotime($i["timestamp"]) ]; }, $switches7); $fronters[] = [ - "member" => $switches8[0] ? $switches8[0]["members"][0] : ($switches9[0] ? $switches9[0]["members"][0] : $switches10[0]["members"][0]), - "date" => strtotime($switches8[0] ? $switches8[0]["timestamp"] : ($switches9[0] ? $switches9[0]["timestamp"] : $switches10[0]["timestamp"])) + "member" => isset($switches8[0]) ? (isset($switches8[0]["members"]) && isset($switches8[0]["members"][0]) ? $switches8[0]["members"][0] : null) : (isset($switches9[0]) ? (isset($switches9[0]["members"]) && isset($switches9[0]["members"][0]) ? $switches9[0]["members"][0] : null) : $switches10[0]["members"][0]), + "member2" => isset($switches8[0]) ? (isset($switches8[0]["members"]) && isset($switches8[0]["members"][1]) ? $switches8[0]["members"][1] : null) : (isset($switches9[0]) ? (isset($switches9[0]["members"]) && isset($switches9[0]["members"][1]) ? $switches9[0]["members"][1] : null) : $switches10[0]["members"][1]), + "date" => strtotime(isset($switches8[0]) ? $switches8[0]["timestamp"] : (isset($switches9[0]) ? $switches9[0]["timestamp"] : $switches10[0]["timestamp"])) ]; $fronters = array_unique($fronters, SORT_REGULAR); @@ -302,6 +342,10 @@ function getMember(string $id) { "> .png" style="width:24px;"> + + (with "> + .png" style="width:24px;"> ) + @@ -311,13 +355,15 @@ function getMember(string $id) { $fronters = array_map(function ($i) { return [ "member" => $i["members"][0], + "member2" => $i["members"][1] ?? null, "date" => strtotime($i["timestamp"]) ]; }, $switches8); $fronters[] = [ - "member" => $switches9[0] ? $switches9[0]["members"][0] : $switches10[0]["members"][0], - "date" => strtotime($switches9[0] ? $switches9[0]["timestamp"] : $switches10[0]["timestamp"]) + "member" => isset($switches9[0]) ? (isset($switches9[0]["members"]) && isset($switches9[0]["members"][0]) ? $switches9[0]["members"][0] : null) : $switches10[0]["members"][0], + "member2" => isset($switches9[0]) ? (isset($switches9[0]["members"]) && isset($switches9[0]["members"][1]) ? $switches9[0]["members"][1] : null) : $switches10[0]["members"][1], + "date" => strtotime(isset($switches9[0]) ? $switches9[0]["timestamp"] : $switches10[0]["timestamp"]) ]; $fronters = array_unique($fronters, SORT_REGULAR); @@ -332,6 +378,10 @@ function getMember(string $id) { "> .png" style="width:24px;"> + + (with "> + .png" style="width:24px;"> ) + @@ -341,12 +391,14 @@ function getMember(string $id) { $fronters = array_map(function ($i) { return [ "member" => $i["members"][0], + "member2" => $i["members"][1] ?? null, "date" => strtotime($i["timestamp"]) ]; }, $switches9); $fronters[] = [ - "member" => $switches10[0] ? $switches10[0]["members"][0] : getSwitchBefore($switches9[count($switches9) - 1]["id"])["members"][0], + "member" => isset($switches10[0]) ? $switches10[0]["members"][0] : getSwitchBefore($switches9[count($switches9) - 1]["id"])["members"][0], + "member2" => isset($switches10[0]) && isset($switches10[0]["members"]) && isset($switches10[0]["members"][1]) ? $switches10[0]["members"][1] : (isset(getSwitchBefore($switches9[count($switches9) - 1]["id"])["members"][1]) ? getSwitchBefore($switches9[count($switches9) - 1]["id"])["members"][1] : null), "date" => strtotime($switches10[0] ? $switches10[0]["timestamp"] : getSwitchBefore($switches9[count($switches9) - 1]["id"])["timestamp"]) ]; @@ -362,6 +414,10 @@ function getMember(string $id) { "> .png" style="width:24px;"> + + (with "> + .png" style="width:24px;"> ) + @@ -371,6 +427,7 @@ function getMember(string $id) { $fronters = array_map(function ($i) { return [ "member" => $i["members"][0], + "member2" => $i["members"][1] ?? null, "date" => strtotime($i["timestamp"]) ]; }, $switches10); @@ -387,6 +444,10 @@ function getMember(string $id) { "> .png" style="width:24px;"> + + (with "> + .png" style="width:24px;"> ) + diff --git a/includes/system/subsystem.php b/includes/system/subsystem.php index 14d1b2a..372ad08 100644 --- a/includes/system/subsystem.php +++ b/includes/system/subsystem.php @@ -73,38 +73,12 @@ function getSubsystemByID(string $id) { return $subsystem; } -function timeAgo($time): string { - if (!is_numeric($time)) { - $time = strtotime($time); - } - - $periods = ["second", "minute", "hour", "day", "week", "month", "year", "age"]; - $lengths = array("60", "60", "24", "7", "4.35", "12", "100"); - - $now = time(); - - $difference = $now - $time; - if ($difference <= 10 && $difference >= 0) { - return $tense = "now"; - } elseif ($difference > 0) { - $tense = "ago"; - } else { - $tense = "later"; - } - - for ($j = 0; $difference >= $lengths[$j] && $j < count($lengths)-1; $j++) { - $difference /= $lengths[$j]; - } - - $difference = round($difference); - - $period = $periods[$j] . ($difference >1 ? "s" :''); - return "{$difference} {$period} {$tense}"; -} - if (getSubsystemByID($subsystemID) === null) header("Location: /?error=Invalid subsystem ID") and die(); $subsystemData = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-subsystem-$subsystemID.json"), true); +global $subsystem; +$subsystem = getSubsystemByID($subsystemID); + $title = $subsystemData["name"] . " · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; ?> diff --git a/includes/travelling.php b/includes/travelling.php index bb24172..b74c826 100644 --- a/includes/travelling.php +++ b/includes/travelling.php @@ -1,13 +1,20 @@ Wake-up alert +
    + + · +
    + + +Turn ON + +

    Sending next notification never

    + + + + + + \ No newline at end of file -- cgit