diff options
author | Minteck <contact@minteck.org> | 2022-09-21 22:42:33 +0200 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2022-09-21 22:42:33 +0200 |
commit | e95b208af90cc386a7d8d1bcab426727cf4f0121 (patch) | |
tree | b293e0c644513fbeb6e9ad29be97fa6347a55e9f /pages | |
parent | b5f589c323f415bb42ea7069cb4d1a8a2233dd69 (diff) | |
download | pluralconnect-e95b208af90cc386a7d8d1bcab426727cf4f0121.tar.gz pluralconnect-e95b208af90cc386a7d8d1bcab426727cf4f0121.tar.bz2 pluralconnect-e95b208af90cc386a7d8d1bcab426727cf4f0121.zip |
Update time
Diffstat (limited to 'pages')
-rw-r--r-- | pages/actions.php | 6 | ||||
-rw-r--r-- | pages/alphabet.php | 38 | ||||
-rw-r--r-- | pages/api.php | 4 | ||||
-rw-r--r-- | pages/bitset.php | 50 | ||||
-rw-r--r-- | pages/byfront.php | 160 | ||||
-rw-r--r-- | pages/dashboard.php | 66 | ||||
-rw-r--r-- | pages/debug.php | 7 | ||||
-rw-r--r-- | pages/demo.php | 3 | ||||
-rw-r--r-- | pages/disclaimers.php | 7 | ||||
-rw-r--r-- | pages/docs.php | 361 | ||||
-rw-r--r-- | pages/edit-private.php | 68 | ||||
-rw-r--r-- | pages/edit.php | 3 | ||||
-rw-r--r-- | pages/emergency.php | 7 | ||||
-rw-r--r-- | pages/fronting.php | 7 | ||||
-rw-r--r-- | pages/home.php | 2 | ||||
-rw-r--r-- | pages/login.php | 3 | ||||
-rw-r--r-- | pages/nicknames.php | 6 | ||||
-rw-r--r-- | pages/page.php | 2 | ||||
-rw-r--r-- | pages/parser.php | 14 | ||||
-rw-r--r-- | pages/pleasure.php | 7 | ||||
-rw-r--r-- | pages/prefix.php | 7 | ||||
-rw-r--r-- | pages/relations.php | 87 | ||||
-rw-r--r-- | pages/rules.php | 7 | ||||
-rw-r--r-- | pages/score.php | 22 | ||||
-rw-r--r-- | pages/splitting.php | 6 | ||||
-rw-r--r-- | pages/terminology.php | 7 | ||||
-rw-r--r-- | pages/together.php | 6 | ||||
-rw-r--r-- | pages/toys.php | 30 | ||||
-rw-r--r-- | pages/travelling.php | 9 | ||||
-rw-r--r-- | pages/wakeup.php | 15 |
30 files changed, 870 insertions, 147 deletions
diff --git a/pages/actions.php b/pages/actions.php index 1fa998a..939ed7e 100644 --- a/pages/actions.php +++ b/pages/actions.php @@ -1,7 +1,6 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $isLoggedIn; -if (!$isLoggedIn) header("Location: /-/login") and die(); +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; if (isset($_POST['deleteAction'])) { $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/actions.json"), true); @@ -170,7 +169,6 @@ $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/dat $toys = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/toys.json"), true); $selected = null; -$title = "Actions database"; if (isset($parts[1])) { $id = $parts[1]; @@ -186,7 +184,7 @@ if (isset($parts[1])) { header("Location: /-/actions/?nf&id=" . $id); die(); } else { - $title = $selected["name"] . " · Actions database"; + $title = $selected["name"] . " · " . $title; } } diff --git a/pages/alphabet.php b/pages/alphabet.php new file mode 100644 index 0000000..b59772d --- /dev/null +++ b/pages/alphabet.php @@ -0,0 +1,38 @@ +<?php + +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; + +?> + +<br> +<div class="container"> + <div id="page-content"> + <h2>Members by prefix letters</h2> + <?php $members = scoreOrderGlobal(); ?> + + <div> + <?php foreach (str_split("abcdefgihjklmnopqrstuvwxyz") as $letter): ?> + <div style="display:inline-grid;grid-template-columns: max-content 1fr;min-height:32px;"> + <div style="display:flex;align-items:center;justify-content:center;font-weight: bold;margin-right:10px;" class="font-monospace"><?= $letter ?>.</div> + <div> + <?php foreach ($members as $member): if (isset($member["proxy_tags"][0]) && isset($member["proxy_tags"][0]["prefix"]) && str_starts_with(strtolower($member["proxy_tags"][0]["prefix"]), strtolower($letter)) && strlen($member["proxy_tags"][0]["prefix"]) === 2): ?><a href="/<?= $member["name"] ?>" title="<b><?= $member["display_name"] ?></b> (<code class='text-white'><?= $member["proxy_tags"][0]["prefix"] ?></code>)" data-bs-toggle="tooltip" data-bs-html="true"><img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . resolveMember($member['name']) . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"></a><?php endif; endforeach; ?> + </div> + </div> + <?php foreach (str_split("abcdefgihjklmnopqrstuvwxyz") as $letter2): $list = array_filter($members, function ($member) use ($letter, $letter2) { + return isset($member["proxy_tags"][0]) && isset($member["proxy_tags"][0]["prefix"]) && str_starts_with(strtolower($member["proxy_tags"][0]["prefix"]), strtolower($letter . $letter2)) && strlen($member["proxy_tags"][0]["prefix"]) === 3; + }); if (count($list) > 0): ?> + (<div style="display:inline-grid;grid-template-columns: max-content 1fr;min-height:32px;"> + <div style="display:flex;align-items:center;justify-content:center;" class="font-monospace"><?= $letter . $letter2 ?>.</div> + <div> + <?php foreach ($list as $member): ?><a href="/<?= $member["name"] ?>" title="<b><?= $member["display_name"] ?></b> (<code class='text-white'><?= $member["proxy_tags"][0]["prefix"] ?></code>)" data-bs-toggle="tooltip" data-bs-html="true"><img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . resolveMember($member['name']) . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"></a><?php endforeach; ?> + </div> + </div>) + <?php endif; endforeach; ?> + <br> + <?php endforeach; ?> + </div> + </div> +</div> + +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?> diff --git a/pages/api.php b/pages/api.php index a1f13d9..1d83985 100644 --- a/pages/api.php +++ b/pages/api.php @@ -11,5 +11,7 @@ $toplevel = explode("/", $pagename)[1]; if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/api/" . $toplevel . ".php")) { require_once $_SERVER['DOCUMENT_ROOT'] . "/api/" . $toplevel . ".php"; } else { - header("Location: /?error=Endpoint not found: " . strip_tags($toplevel)) and die(); + header("HTTP/1.1 500 Internal Server Error"); + echo("Endpoint not found"); + die(); }
\ No newline at end of file diff --git a/pages/bitset.php b/pages/bitset.php index 8c63bc5..0d2d10e 100644 --- a/pages/bitset.php +++ b/pages/bitset.php @@ -1,9 +1,7 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $isLoggedIn; -if (!$isLoggedIn) header("Location: /-/login") and die(); - -$title = "Bitset calculator"; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; ?> @@ -25,8 +23,8 @@ $title = "Bitset calculator"; require_once $_SERVER['DOCUMENT_ROOT'] . '/include <div data-bs-toggle="tooltip" title="Value reserved for future use" id="binary-bit-10" class="font-monospace tooltip-nohelp text-muted" style="text-align: center;cursor: pointer;">0</div> <div data-bs-toggle="tooltip" title="Value reserved for future use" id="binary-bit-11" class="font-monospace tooltip-nohelp text-muted" style="text-align: center;cursor: pointer;">0</div> <div data-bs-toggle="tooltip" title="Value reserved for future use" id="binary-bit-12" class="font-monospace tooltip-nohelp text-muted" style="text-align: center;cursor: pointer;">0</div> - <div data-bs-toggle="tooltip" title="Value reserved for future use" id="binary-bit-13" class="font-monospace tooltip-nohelp text-muted" style="text-align: center;cursor: pointer;">0</div> - <div data-bs-toggle="tooltip" title="Value reserved for future use" id="binary-bit-14" class="font-monospace tooltip-nohelp text-muted" style="text-align: center;cursor: pointer;">0</div> + <div data-bs-toggle="tooltip" title="Age regressor" id="binary-bit-13" class="font-monospace tooltip-nohelp" style="color: #877e19;text-align: center;cursor: pointer;">0</div> + <div data-bs-toggle="tooltip" title="Sexually active" id="binary-bit-14" class="font-monospace tooltip-nohelp" style="color: #871985;text-align: center;cursor: pointer;">0</div> <div data-bs-toggle="tooltip" title="Fronts less frequently" id="binary-bit-15" class="font-monospace tooltip-nohelp" style="color: #198754;text-align: center;cursor: pointer;">0</div> <div data-bs-toggle="tooltip" title="Non verbal in real life" id="binary-bit-16" class="font-monospace tooltip-nohelp" style="color: #20c997;text-align: center;cursor: pointer;">0</div> <div data-bs-toggle="tooltip" title="Eatable food" id="binary-bit-17" class="font-monospace tooltip-nohelp" style="color: #d63384;text-align: center;cursor: pointer;">0</div> @@ -40,12 +38,12 @@ $title = "Bitset calculator"; require_once $_SERVER['DOCUMENT_ROOT'] . '/include <div data-bs-toggle="tooltip" title="Shared memory access" id="binary-bit-25" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#fa77ef;">0</div> <div data-bs-toggle="tooltip" title="Shared memory access" id="binary-bit-26" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#fa77ef;">0</div> <div data-bs-toggle="tooltip" title="Median system" id="binary-bit-27" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color: #a14700;">0</div> - <div data-bs-toggle="tooltip" title="Little/age regressor" id="binary-bit-28" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#b277fa;">0</div> - <div data-bs-toggle="tooltip" title="Little/age regressor" id="binary-bit-29" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#b277fa;">0</div> + <div data-bs-toggle="tooltip" title="Little/younger" id="binary-bit-28" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#b277fa;">0</div> + <div data-bs-toggle="tooltip" title="Little/younger" id="binary-bit-29" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#b277fa;">0</div> <div data-bs-toggle="tooltip" title="Protector" id="binary-bit-30" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#77faab;">0</div> <div data-bs-toggle="tooltip" title="Fictive" id="binary-bit-31" class="font-monospace tooltip-nohelp text-info" style="text-align: center;cursor: pointer;">0</div> <div data-bs-toggle="tooltip" title="Not talking" id="binary-bit-32" class="font-monospace tooltip-nohelp text-danger" style="text-align: center;cursor: pointer;">0</div> - <div data-bs-toggle="tooltip" title="Host" id="binary-bit-33" class="font-monospace tooltip-nohelp text-primary" style="text-align: center;cursor: pointer;">0</div> + <div data-bs-toggle="tooltip" title="Most common fronter" id="binary-bit-33" class="font-monospace tooltip-nohelp text-primary" style="text-align: center;cursor: pointer;">0</div> <div data-bs-toggle="tooltip" title="1st species" id="binary-bit-34" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#fab277;">0</div> <div data-bs-toggle="tooltip" title="1st species" id="binary-bit-35" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#fab277;">0</div> <div data-bs-toggle="tooltip" title="1st species" id="binary-bit-36" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#fab277;">0</div> @@ -64,7 +62,7 @@ $title = "Bitset calculator"; require_once $_SERVER['DOCUMENT_ROOT'] . '/include </div> <br> <p> - <b>Input:</b> <input onchange="calculateInput();" onkeydown="calculateInput()" onkeyup="calculateInput()" value="2048" id="input" type="number" class="form-control" style="width:256px;display: inline-block;color:white;background:#111;border-color:#222;" maxlength="10" max="4294967295" min="2048"><br> + <b>Input:</b> <input onchange="calculateInput();" onkeydown="calculateInput()" onkeyup="calculateInput()" value="2048" id="input" type="number" class="form-control" style="width:256px;display: inline-block;color:white;background:#111;border-color:#222;" maxlength="15" max="281474976710655" min="2048"><br> <b>Output:</b> <code id="output-bin">0b000000000000000000000000000000000000100000000000</code>, <code id="output-hex">0x000008000000</code>, <code id="output-dec">2048</code> </p> <script> @@ -110,6 +108,8 @@ $title = "Bitset calculator"; require_once $_SERVER['DOCUMENT_ROOT'] . '/include let ageSpells = binString.substring(31 + 16, 32 + 16) !== "0"; let nonverbal = binString.substring(15, 16) !== "0"; let lessFrequent = binString.substring(14, 15) !== "0"; + let sexuallyActive = binString.substring(13, 14) !== "0"; + let ageRegressor = binString.substring(12, 13) !== "0"; document.getElementById("value-0").value = sharedMemory; document.getElementById("value-1").value = little; @@ -129,6 +129,8 @@ $title = "Bitset calculator"; require_once $_SERVER['DOCUMENT_ROOT'] . '/include document.getElementById("value-15").checked = ageSpells; document.getElementById("value-16").checked = nonverbal; document.getElementById("value-17").checked = lessFrequent; + document.getElementById("value-18").checked = sexuallyActive; + document.getElementById("value-19").checked = ageRegressor; } } @@ -148,7 +150,7 @@ $title = "Bitset calculator"; require_once $_SERVER['DOCUMENT_ROOT'] . '/include } function calculateInput() { - if (parseInt(document.getElementById("input").value).toString().length > 10) return; + if (parseInt(document.getElementById("input").value).toString().length > 15) return; let binString = ("0".repeat(48 - parseInt(document.getElementById("input").value).toString(2).length)) + parseInt(document.getElementById("input").value).toString(2); let bin = binString.split("").map((i) => parseInt(i)); @@ -179,6 +181,8 @@ $title = "Bitset calculator"; require_once $_SERVER['DOCUMENT_ROOT'] . '/include let lessFrequent = binString.substring(14, 15) !== "0"; let magic = parseInt(binString.substring(2 + 16, 5 + 16), 2); let sensitivity = parseInt(binString.substring(5 + 16, 8 + 16), 2); + let sexuallyActive = binString.substring(13, 14) !== "0"; + let ageRegressor = binString.substring(12, 13) !== "0"; document.getElementById("value-0").value = sharedMemory; document.getElementById("value-1").value = little; @@ -198,6 +202,8 @@ $title = "Bitset calculator"; require_once $_SERVER['DOCUMENT_ROOT'] . '/include document.getElementById("value-15").checked = ageSpells; document.getElementById("value-16").checked = nonverbal; document.getElementById("value-17").checked = lessFrequent; + document.getElementById("value-18").checked = sexuallyActive; + document.getElementById("value-19").checked = ageRegressor; calculateOutput(); @@ -223,6 +229,8 @@ $title = "Bitset calculator"; require_once $_SERVER['DOCUMENT_ROOT'] . '/include let val15 = document.getElementById("value-15").checked; let val16 = document.getElementById("value-16").checked; let val17 = document.getElementById("value-17").checked; + let val18 = document.getElementById("value-18").checked; + let val19 = document.getElementById("value-19").checked; let val0bin = parseInt(val0).toString(2); val0bin = val0bin.length === 1 ? "0" + val0bin : val0bin; @@ -253,8 +261,10 @@ $title = "Bitset calculator"; require_once $_SERVER['DOCUMENT_ROOT'] . '/include let val15bin = val15 ? "1" : "0"; let val16bin = val16 ? "1" : "0"; let val17bin = val17 ? "1" : "0"; + let val18bin = val18 ? "1" : "0"; + let val19bin = val19 ? "1" : "0"; - let bin = "00000000000000" + val17bin + val16bin + val11bin + val12bin + val13bin + val0bin + val4bin + val1bin + val5bin + val6bin + val7bin + val8bin + val2bin + val3bin + val14bin + val9bin + val10bin + val15bin; + let bin = "000000000000" + val19bin + val18bin + val17bin + val16bin + val11bin + val12bin + val13bin + val0bin + val4bin + val1bin + val5bin + val6bin + val7bin + val8bin + val2bin + val3bin + val14bin + val9bin + val10bin + val15bin; console.log(bin, parseInt(bin, 2)); @@ -288,11 +298,11 @@ $title = "Bitset calculator"; require_once $_SERVER['DOCUMENT_ROOT'] . '/include </select> <img alt="" src="/assets/icons/visibility-public.svg" style="filter:invert(1);width:24px;margin-left:5px;margin-top:-5px;" title="This information will be shown publicly" data-bs-toggle="tooltip"> <br> - <b>Little/age regressor: </b><select class="tooltip-nohelp form-select" style='display:inline-block;width:max-content;color:white;background-color:#111;border-color:#222;background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");' id="value-1" onchange="updateFromSelection();"> + <b>Little/younger: </b><select class="tooltip-nohelp form-select" style='display:inline-block;width:max-content;color:white;background-color:#111;border-color:#222;background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");' id="value-1" onchange="updateFromSelection();"> <option value="0" selected>None</option> <option value="2">Little</option> <option value="3">Younger</option> - <option value="1">Age regressor</option> + <option value="1" disabled>Age regressor (old)</option> </select> <img alt="" src="/assets/icons/visibility-public.svg" style="filter:invert(1);width:24px;margin-left:5px;margin-top:-5px;" title="This information will be shown publicly" data-bs-toggle="tooltip"> <br> @@ -363,7 +373,7 @@ $title = "Bitset calculator"; require_once $_SERVER['DOCUMENT_ROOT'] . '/include </label><img alt="" src="/assets/icons/visibility-public.svg" style="filter:invert(1);width:24px;margin-left:5px;margin-top:-5px;" title="This information will be shown publicly" data-bs-toggle="tooltip"><br> <label style="margin-bottom:5px;"> <input type="checkbox" id="value-8" onchange="updateFromSelection();"> - Host + Most common fronter </label><img alt="" src="/assets/icons/visibility-public.svg" style="filter:invert(1);width:24px;margin-left:5px;margin-top:-5px;" title="This information will be shown publicly" data-bs-toggle="tooltip"><br> <label style="margin-bottom:5px;"> <input type="checkbox" id="value-9" onchange="updateFromSelection();"> @@ -384,7 +394,15 @@ $title = "Bitset calculator"; require_once $_SERVER['DOCUMENT_ROOT'] . '/include <label style="margin-bottom:5px;"> <input type="checkbox" id="value-17" onchange="updateFromSelection();"> Fronts less frequently - </label><img alt="" src="/assets/icons/visibility-public.svg" style="filter:invert(1);width:24px;margin-left:5px;margin-top:-5px;" title="This information will be shown publicly" data-bs-toggle="tooltip"> + </label><img alt="" src="/assets/icons/visibility-public.svg" style="filter:invert(1);width:24px;margin-left:5px;margin-top:-5px;" title="This information will be shown publicly" data-bs-toggle="tooltip"><br> + <label style="margin-bottom:5px;"> + <input type="checkbox" id="value-18" onchange="updateFromSelection();"> + Sexually active + </label><img alt="" src="/assets/icons/visibility-private.svg" style="filter:invert(1);width:24px;margin-left:5px;margin-top:-5px;" title="This information will remain private" data-bs-toggle="tooltip"><br> + <label style="margin-bottom:5px;"> + <input type="checkbox" id="value-19" onchange="updateFromSelection();"> + Age regressor + </label><img alt="" src="/assets/icons/visibility-public.svg" style="filter:invert(1);width:24px;margin-left:5px;margin-top:-5px;" title="This information will be shown publicly" data-bs-toggle="tooltip"><br> </p> </div> diff --git a/pages/byfront.php b/pages/byfront.php new file mode 100644 index 0000000..eb9050c --- /dev/null +++ b/pages/byfront.php @@ -0,0 +1,160 @@ +<?php + +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; +$travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling.json"), true); + +?> + +<br> +<div class="container"> + <div id="page-content"> + <h2>Members by last fronted</h2> + + <h4>Cloudburst System</h4> + <?php $system = "ynmuc"; $members = array_map(function ($i) use ($system) { + $i["_lastFronted"] = -1; + $id = $i["id"]; + $memberData = $i; + + $fronters = array_map(function ($item) { + return $item["id"]; + }, json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system-fronters.json"), true)["members"]); + + if (in_array($id, $fronters)) { + $i["_lastFronted"] = time(); + } else { + $switches = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system-switches.json"), true); + + $thisMember = array_filter($switches, function ($item) use ($memberData) { + return in_array($memberData["id"], $item["members"]); + }); + + $thisMember = array_values($thisMember); + $frontingEnd = null; + + if (count($thisMember) > 0) { + $thisIndex = array_search($thisMember[0], $switches); + + $frontingStart = $thisMember[0]; + $frontingEnd = $switches[$thisIndex - 1]; + } + + if ($frontingEnd !== null && isset($frontingStart)) { + $i["_lastFronted"] = strtotime($frontingEnd["timestamp"]); + } + } + + return $i; + }, array_values(array_filter(scoreOrderGlobal(), function ($i) { + return $i["_system"] === "ynmuc"; + }))); uasort($members, function ($a, $b) { + return $b["_lastFronted"] - $a["_lastFronted"]; + }); foreach ($members as $member): ?> + <div class="relation" style="background-color:rgba(255, 255, 255, .1);margin-bottom:10px;padding:10px;border-radius:10px;display:grid;grid-template-columns: 1fr 2fr max-content;"> + <a class="relation-intro" style="background-color:rgba(255, 255, 255, .05);border-right:1px solid rgba(255, 255, 255, .1);margin:-10px;padding:10px;border-top-left-radius:10px;border-bottom-left-radius:10px;color: white;display:flex;align-items:center;text-decoration: none;" href="/<?= $member["name"] ?>"> + <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . resolveMember($member['name']) . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> + <?php if ($member["_metadata"]["shared_memory"] !== 2): ?> + <span class="badge text-black bg-warning rounded-pill">Not sharing memory</span> + <?php endif; ?> + </a> + + <div class="relation-item" style="display:flex;align-items:center;margin-left:10px;padding:0 20px;"> + <?php if ($member["_lastFronted"] === -1): ?> + Never fronted + <?php else: ?> + Last fronted <?= timeAgo($member["_lastFronted"]) ?><?php if ($member["_lastFronted"] !== time()): ?> (<?= date('l j F Y', $member["_lastFronted"]) ?>)<?php endif; ?> + <?php endif; ?> + </div> + </div> + <?php endforeach; ?> + + <br> + <h4>Raindrops System</h4> + <?php $system = "gdapd"; $members = array_map(function ($i) use ($system) { + $i["_lastFronted"] = -1; + $id = $i["id"]; + $memberData = $i; + + $fronters = array_map(function ($item) { + return $item["id"]; + }, json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system-fronters.json"), true)["members"]); + + if (in_array($id, $fronters)) { + $i["_lastFronted"] = time(); + } else { + $switches = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system-switches.json"), true); + + $thisMember = array_filter($switches, function ($item) use ($memberData) { + return in_array($memberData["id"], $item["members"]); + }); + + $thisMember = array_values($thisMember); + $frontingEnd = null; + + if (count($thisMember) > 0) { + $thisIndex = array_search($thisMember[0], $switches); + + $frontingStart = $thisMember[0]; + $frontingEnd = $switches[$thisIndex - 1]; + } + + if ($frontingEnd !== null && isset($frontingStart)) { + $i["_lastFronted"] = strtotime($frontingEnd["timestamp"]); + } + } + + return $i; + }, array_values(array_filter(scoreOrderGlobal(), function ($i) { + return $i["_system"] === "gdapd"; + }))); uasort($members, function ($a, $b) { + return $b["_lastFronted"] - $a["_lastFronted"]; + }); foreach ($members as $member): ?> + <div class="relation" style="background-color:rgba(255, 255, 255, .1);margin-bottom:10px;padding:10px;border-radius:10px;display:grid;grid-template-columns: 1fr 2fr max-content;"> + <a class="relation-intro" style="background-color:rgba(255, 255, 255, .05);border-right:1px solid rgba(255, 255, 255, .1);margin:-10px;padding:10px;border-top-left-radius:10px;border-bottom-left-radius:10px;color: white;display:flex;align-items:center;text-decoration: none;" href="/<?= $member["name"] ?>"> + <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . resolveMember($member['name']) . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> + <?php if ($member["_metadata"]["shared_memory"] !== 2): ?> + <span class="badge text-black bg-warning rounded-pill">Not sharing memory</span> + <?php endif; ?> + </a> + + <div class="relation-item" style="display:flex;align-items:center;margin-left:10px;padding:0 20px;"> + <?php if ($member["_lastFronted"] === -1): ?> + Never fronted + <?php else: ?> + Last fronted <?= timeAgo($member["_lastFronted"]) ?><?php if ($member["_lastFronted"] !== time()): ?> (<?= date('l j F Y', $member["_lastFronted"]) ?>)<?php endif; ?> + <?php endif; ?> + </div> + </div> + <?php endforeach; ?> + </div> + + <style> + @media (max-width: 991px) { + .relation { + grid-template-columns: 1fr !important; + } + + .relation-intro { + text-align: center; + border-bottom-left-radius: 0 !important; + border-top-right-radius: 10px; + border-right: none !important; + border-bottom: 1px solid rgba(255, 255, 255, .1); + } + + .relation-item-marefriends { + margin-top: 20px !important; + } + + .relation-item { + margin-top: 10px; + margin-left: 0 !important; + padding: 10px 0 !important; + text-align: center; + } + } + </style> +</div> + +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?> diff --git a/pages/dashboard.php b/pages/dashboard.php index 622cd20..a861636 100644 --- a/pages/dashboard.php +++ b/pages/dashboard.php @@ -1,9 +1,7 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $isLoggedIn; -if (!$isLoggedIn) header("Location: /-/login") and die(); - -$title = "Dashboard"; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; global $_PROFILE; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; global $pages; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; global $_PROFILE; use om\IcalParser; $poniesHavingSex = []; @@ -32,7 +30,7 @@ foreach ($actions as $action) { $fronter = array_map(function ($i) { return $i["id"]; -}, ($_PROFILE["login"] === "raindrops" ? json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-fronters.json"), true) : json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-fronters.json"), true))["members"])[0]; +}, ($_PROFILE["login"] === "raindrops" ? json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-fronters.json"), true) : json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-fronters.json"), true))["members"])[0] ?? null; $viewingPonyHasSex = in_array($fronter, $poniesHavingSex) || isset($_GET['toys']); @@ -87,61 +85,77 @@ $viewingPonyHasSex = in_array($fronter, $poniesHavingSex) || isset($_GET['toys'] setInterval(_Date); </script> - <div class="peh-row" style="<?php if (!$viewingPonyHasSex): ?>grid-template-columns: repeat(6, 1fr) !important;<?php endif; ?>"> + <div class="peh-row" style="<?php if (!$viewingPonyHasSex): ?>grid-template-columns: repeat(8, 1fr) !important;<?php endif; ?>"> <div class="column"> - <div class="card"> + <div class="card" title="<?= $pages["actions"]["name"] ?>" data-bs-toggle="tooltip"> <a href="/-/actions" class="card-body" style="text-align:center;color: white !important; text-decoration: none !important;"> <img src="/assets/icons/actions.svg" style="width:32px;height:32px;filter:invert(1);"><br> - <h6 class="app-name">Actions</h6> + <h6 class="app-name"><?= $pages["actions"]["short"] ?></h6> </a> </div> </div> <div class="column"> - <div class="card"> + <div class="card" title="<?= $pages["rules"]["name"] ?>" data-bs-toggle="tooltip"> <a href="/-/rules" class="card-body" style="text-align:center;color: white !important; text-decoration: none !important;"> <img src="/assets/icons/rules.svg" style="width:32px;height:32px;filter:invert(1);"><br> - <h6 class="app-name">Rules</h6> + <h6 class="app-name"><?= $pages["rules"]["short"] ?></h6> </a> </div> </div> <div class="column"> - <div class="card"> + <div class="card" title="<?= $pages["docs"]["name"] ?>" data-bs-toggle="tooltip"> + <a href="/-/docs" class="card-body" style="text-align:center;color: white !important; text-decoration: none !important;"> + <img src="/assets/icons/docs.svg" style="width:32px;height:32px;filter:invert(1);"><br> + <h6 class="app-name"><?= $pages["docs"]["short"] ?></h6> + </a> + </div> + </div> + <div class="column"> + <div class="card" title="<?= $pages["nicknames"]["name"] ?>" data-bs-toggle="tooltip"> <a href="/-/nicknames" class="card-body" style="text-align:center;color: white !important; text-decoration: none !important;"> <img src="/assets/icons/nicknames.svg" style="width:32px;height:32px;filter:invert(1);"><br> - <h6 class="app-name">Nicknames</h6> + <h6 class="app-name"><?= $pages["nicknames"]["short"] ?></h6> </a> </div> </div> <div class="column"> - <div class="card"> + <div class="card" title="<?= $pages["together"]["name"] ?>" data-bs-toggle="tooltip"> <a href="/-/together" class="card-body" style="text-align:center;color: white !important; text-decoration: none !important;"> <img src="/assets/icons/together.svg" style="width:32px;height:32px;filter:invert(1);"><br> - <h6 class="app-name">Watch Together</h6> + <h6 class="app-name"><?= $pages["together"]["short"] ?></h6> </a> </div> </div> <div class="column"> - <div class="card"> + <div class="card" title="<?= $pages["splitting"]["name"] ?>" data-bs-toggle="tooltip"> <a href="/-/splitting" class="card-body" style="text-align:center;color: white !important; text-decoration: none !important;"> <img src="/assets/icons/form.svg" style="width:32px;height:32px;filter:invert(1);"><br> - <h6 class="app-name">Splits</h6> + <h6 class="app-name"><?= $pages["splitting"]["short"] ?></h6> </a> </div> </div> <div class="column"> - <div class="card"> + <div class="card" title="<?= $pages["byfront"]["name"] ?>" data-bs-toggle="tooltip"> + <a href="/-/byfront" class="card-body" style="text-align:center;color: white !important; text-decoration: none !important;"> + <img src="/assets/icons/byfront.svg" style="width:32px;height:32px;filter:invert(1);"><br> + <h6 class="app-name"><?= $pages["byfront"]["short"] ?></h6> + </a> + </div> + </div> + <div class="column"> + <div class="card" title="<?= $pages["bitset"]["name"] ?>" data-bs-toggle="tooltip"> <a href="/-/bitset" class="card-body" style="text-align:center;color: white !important; text-decoration: none !important;"> <img src="/assets/icons/bitset.svg" style="width:32px;height:32px;filter:invert(1);"><br> - <h6 class="app-name">Bitset</h6> + <h6 class="app-name"><?= $pages["bitset"]["short"] ?></h6> </a> </div> </div> <?php if ($viewingPonyHasSex): ?> <div class="column"> - <div class="card"> + <div class="card" title="<?= $pages["toys"]["name"] ?>" data-bs-toggle="tooltip"> <a href="/-/toys" class="card-body" style="text-align:center;color: white !important; text-decoration: none !important;"> <img src="/assets/icons/toys.svg" style="width:32px;height:32px;filter:invert(1);"><br> - <h6 class="app-name">Toys</h6> + <h6 class="app-name"><?= $pages["toys"]["short"] ?></h6> </a> </div> </div> @@ -167,9 +181,13 @@ $viewingPonyHasSex = in_array($fronter, $poniesHavingSex) || isset($_GET['toys'] <h5>Fronters today</h5> <ul> - <?php foreach ($today1 as $index => $id): $member = getSystemMember($_PROFILE["login"] === "raindrops" ? "gdapd" : "ynmuc", $id); ?> + <?php foreach ($today1 as $index => $id): $member = getMemberWithoutSystem($id); ?> <li> + <?php if ($member["name"] === "fusion"): ?> + <img alt="" src="/assets/logo/logo.png" style="width:24px; height: 24px; vertical-align: middle;"> <span style="vertical-align: middle;">Merged members</span> + <?php else: ?> <img alt="" src="/assets/uploads/pt-<?= $member["name"] ?>.png" style="width:24px; height: 24px; vertical-align: middle;"> <b style="vertical-align: middle;"><?= getMiniName($member["display_name"] ?? $member["name"]) ?></b> + <?php endif; ?> <?php if (isset($today2[$index])): $member2 = getSystemMember($_PROFILE["login"] === "raindrops" ? "ynmuc" : "gdapd", $today2[$index]); ?><span style="vertical-align: middle;">with</span> <img alt="" src="/assets/uploads/pt-<?= $member2["name"] ?>.png" style="width:24px; height: 24px; vertical-align: middle;"> <span style="vertical-align: middle;"><?= getMiniName($member2["display_name"] ?? $member2["name"]) ?></span><?php endif; ?> </li> <?php endforeach; ?> @@ -179,7 +197,11 @@ $viewingPonyHasSex = in_array($fronter, $poniesHavingSex) || isset($_GET['toys'] <ul> <?php foreach ($tomorrow1 as $index => $id): $member = getSystemMember($_PROFILE["login"] === "raindrops" ? "gdapd" : "ynmuc", $id); ?> <li> + <?php if ($member["name"] === "fusion"): ?> + <img alt="" src="/assets/logo/logo.png" style="width:24px; height: 24px; vertical-align: middle;"> <span style="vertical-align: middle;">Merged members</span> + <?php else: ?> <img alt="" src="/assets/uploads/pt-<?= $member["name"] ?>.png" style="width:24px; height: 24px; vertical-align: middle;"> <b style="vertical-align: middle;"><?= getMiniName($member["display_name"] ?? $member["name"]) ?></b> + <?php endif; ?> <?php if (isset($tomorrow2[$index])): $member2 = getSystemMember($_PROFILE["login"] === "raindrops" ? "ynmuc" : "gdapd", $tomorrow2[$index]); ?><span style="vertical-align: middle;">with</span> <img alt="" src="/assets/uploads/pt-<?= $member2["name"] ?>.png" style="width:24px; height: 24px; vertical-align: middle;"> <span style="vertical-align: middle;"><?= getMiniName($member2["display_name"] ?? $member2["name"]) ?></span><?php endif; ?> </li> <?php endforeach; ?> @@ -252,7 +274,7 @@ $viewingPonyHasSex = in_array($fronter, $poniesHavingSex) || isset($_GET['toys'] <style> .peh-row { display: grid; - grid-template-columns: repeat(7, 1fr); + grid-template-columns: repeat(9, 1fr); } .column .card { diff --git a/pages/debug.php b/pages/debug.php index 338a896..fdd6fec 100644 --- a/pages/debug.php +++ b/pages/debug.php @@ -1,6 +1,11 @@ -<?php $title = "Data updater debugging"; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; +<?php + +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; function itemToName(string $item): string { + if ($item === "docs_cleanup") return "Deleting scheduled documents"; + if ($item === "important_backup") return "Differential backups"; if ($item === "restore") return "Failure protection"; if ($item === "backups") return "Encrypted off-site backups"; if ($item === "calendar") return "Google Calendar integration"; diff --git a/pages/demo.php b/pages/demo.php index a408763..381a7e4 100644 --- a/pages/demo.php +++ b/pages/demo.php @@ -1,6 +1,7 @@ <?php -$title = "Mode démonstration"; $demoHeader = true; $emergencyHeader = true; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; +$demoHeader = true; $emergencyHeader = true; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; ?> diff --git a/pages/disclaimers.php b/pages/disclaimers.php index 2983909..b47e33a 100644 --- a/pages/disclaimers.php +++ b/pages/disclaimers.php @@ -1,4 +1,9 @@ -<?php $title = "Disclaimers"; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; ?> +<?php + +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; + +?> <br> <div class="container"> diff --git a/pages/docs.php b/pages/docs.php new file mode 100644 index 0000000..bbc3054 --- /dev/null +++ b/pages/docs.php @@ -0,0 +1,361 @@ +<?php + +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; global $_PROFILE; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/random.php"; + +$parts = explode("/", $_GET['_']); +$select = $parts[2] ?? null; + +if ($select === "add") { + $id = random(); + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/docs/" . $id . ".json", json_encode([ + "name" => "Untitled document ($id)", + "category" => null, + "contents" => "<div class='alert alert-primary'>This is a new document you just created.</div>", + "last" => [ + "author" => $_PROFILE["login"], + "date" => time() + ] + ])); + + header("Location: /-/docs/$id"); + die(); +} elseif (isset($select)) { + if (ctype_alnum($select) && file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/docs/" . $select . ".json")) { + $id = $select; + $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/docs/" . $select . ".json"), true); + $titleBase = " · " . $title . " · Cold Haze"; + $title = $data["name"] . " · " . $title; + } else { + header("Location: /-/docs"); + die(); + } +} + +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; + +?> + +<br> +<div class="container"> + <div> + <?php if (isset($data)): ?><div id="page-content"> + <h2> + <span contenteditable="true" id="document-name" style="outline: none;"><?= $data["name"] ?></span> + <a href="/-/docs" class="small btn btn-outline-light" style="float:right;margin-top:5px;vertical-align:middle;opacity:1 !important; color:white;">Back</a> + </h2> + <p><b>Category:</b> <span id="category" contenteditable="true" style="outline: none;"><?= $data["category"] ?? "Unsorted" ?></span></p> + <p> + <?php if ($data["last"]["date"] === 0): ?> + Last modified <span id="last-edit-time" class="relative-time" data-relative-timestamp="">never</span> + <?php else: ?> + Last modified <span id="last-edit-time" class="relative-time" data-relative-timestamp="<?= $data["last"]["date"] ?>"><?= timeAgo($data["last"]["date"]) ?></span> + <?php if ($data["last"]["author"] !== $_PROFILE["login"]): ?> + <span id="last-edit-author">by <?= $data["last"]["author"] === "raindrops" ? "the Raindrops System" : "the Cloudburst System" ?></span> + <?php endif; ?> + <?php endif; ?> + · <span id="editor-save-status" class="text-muted">Saved</span> + </p> + + <textarea id="editor"><?= $data["contents"] ?></textarea> + + <script src="/assets/editor/editor.js"></script> + <script> + let editor; + ClassicEditor + .create( document.querySelector( '#editor' ), { + toolbar: [ + 'undo', 'redo', '|', 'removeFormat', '|', 'heading', '|', 'fontSize', 'fontColor', 'fontBackgroundColor', 'alignment', '|', 'bold', 'italic', 'underline', 'strikethrough', '|', 'subscript', 'superscript', '|', 'code', '|', 'outdent', 'indent', '|', 'bulletedList', 'numberedList', '|', 'link', 'imageUpload', 'mediaEmbed', 'blockQuote', 'insertTable', 'codeBlock', '|', 'horizontalLine' + ] + } ) + + .then( newEditor => { + editor = newEditor; + } ) + .catch( error => { + console.error( error ); + } ); + </script> + <!--suppress CssUnresolvedCustomProperty --> + <style> + :root { + --ck-color-base-background: transparent; + } + + .ck-toolbar { + filter: invert(1); + border-bottom-left-radius: var(--ck-border-radius) !important; + border-bottom-right-radius: var(--ck-border-radius) !important; + border-bottom-width: 1px !important; + } + + .ck-tooltip__text { + color: white !important; + } + + .ck-dropdown__panel { + background: #ddd !important; + } + + .ck-color-grid__tile { + filter: invert(1); + } + + .ck-balloon-rotator { + background-color: #ccc !important; + } + + .ck-balloon-panel { + filter: invert(1); + } + + .ck-editor__editable { + border-color: transparent !important; + } + </style> + <script> + + let titleBase = "<?= $titleBase ?>"; + let lastSavedData = editor.getData(); + let lastFetchedData = editor.getData(); + let timeSinceLastModified = 0; + let saving = false; + + async function save() { + let data = editor.getData(); + document.getElementById("editor-save-status").innerHTML = "Saving..."; + document.getElementById("editor-save-status").classList.remove("text-danger"); + document.getElementById("editor-save-status").classList.remove("text-muted"); + document.getElementById("editor-save-status").classList.remove("text-warning"); + document.getElementById("editor-save-status").classList.add("text-primary"); + saving = true; + + try { + await window.fetch("/api/docs?id=<?= $id ?>", { + method: "POST", + body: JSON.stringify({ content: data, name: document.getElementById("document-name").innerText, category: document.getElementById("category").innerText }) + }); + document.getElementById("last-edit-time").setAttribute("data-relative-timestamp", (new Date().getTime() / 1000).toFixed(0)); + if (document.getElementById("last-edit-author")) document.getElementById("last-edit-author").outerHTML = ""; + document.title = document.getElementById("document-name").innerText + titleBase; + document.getElementById("editor-save-status").innerHTML = "Saved"; + document.getElementById("editor-save-status").classList.remove("text-danger"); + 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"); + lastSavedData = data; + saving = false; + } catch (e) { + console.error(e); + document.getElementById("editor-save-status").innerHTML = "Failed to save"; + document.getElementById("editor-save-status").classList.add("text-danger"); + document.getElementById("editor-save-status").classList.remove("text-muted"); + document.getElementById("editor-save-status").classList.remove("text-warning"); + document.getElementById("editor-save-status").classList.remove("text-primary"); + } + } + + document.onclick = async () => { + if (saving) return; + + if (editor.getData() !== lastSavedData) { + await save(); + } + } + + setInterval(async () => { + if (saving) return; + + if (editor.getData() !== lastSavedData) { + document.getElementById("editor-save-status").innerHTML = "Modified"; + document.getElementById("editor-save-status").classList.remove("text-danger"); + document.getElementById("editor-save-status").classList.remove("text-muted"); + document.getElementById("editor-save-status").classList.add("text-warning"); + document.getElementById("editor-save-status").classList.remove("text-primary"); + + if (editor.getData() !== lastFetchedData) { + lastFetchedData = editor.getData(); + timeSinceLastModified = 0; + } else { + timeSinceLastModified++; + } + + if (timeSinceLastModified > 20 || !document.hasFocus()) { + await save(); + } + } else { + timeSinceLastModified = 0; + } + }, 100) + + </script> + </div><?php else: ?> + <h2>Documents</h2> + <div id="list"> + <?php + + $documents = array_map(function ($i) { + return [ + "id" => substr($i, 0, -5), + ...(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/docs/" . $i), true) ?? []) + ]; + }, array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/docs"), function ($i) { + return !str_starts_with($i, ".") && str_ends_with($i, ".json"); + })); + + $deletable = array_values(array_filter($documents, function ($i) { + return strip_tags($i["contents"]) === "/delete"; + })); + $unsorted_pre = array_values(array_filter($documents, function ($i) { + return strip_tags($i["contents"]) !== "/delete"; + })); + + $unsorted = []; + $categories = []; + foreach ($unsorted_pre as $item) { + if (isset($item["category"])) { + $existing_categories = array_keys($categories); + $matched_category = null; + + foreach ($existing_categories as $existing_category) { + if (levenshtein($item["category"], $existing_category) < 3) { + $matched_category = $existing_category; + } + } + + $selected_category = $matched_category ?? $item["category"]; + if (!isset($categories[$selected_category])) $categories[$selected_category] = []; + $categories[$selected_category][] = $item; + } else { + $unsorted[] = $item; + } + } + + uasort($unsorted, function ($a, $b) { + return $b["last"]["date"] - $a["last"]["date"]; + }); + + uasort($deletable, function ($a, $b) { + return $b["last"]["date"] - $a["last"]["date"]; + }); + + ?> + + <?php foreach ($categories as $category => $items): ?> + <h4><?= $category ?></h4><div class="list-group"> + <?php foreach ($items as $item): ?> + <a href="/-/docs/<?= $item["id"] ?>" id="document-<?= $item["id"] ?>" class="list-group-item list-group-item-action document-listing <?php if (strip_tags($item["contents"]) === "/delete"): ?>opacity-75<?php endif; ?>"> + <?= $item["name"] ?> + <?php if (strip_tags($item["contents"]) === "/delete"): ?> + <span class="badge bg-warning rounded-pill text-black">Deleting in <?= round((($item["last"]["date"] + 86400) - time()) / 3600) ?> hours</span> + <?php else: ?> + <span class="relative-time text-muted" data-relative-timestamp="<?= $item["last"]["date"] ?>"><?= timeAgo($item["last"]["date"]) ?></span> + <?php endif; ?> + </a> + <?php endforeach; ?></div> + <hr> + <?php endforeach; ?> + + <h4>Unsorted</h4><div class="list-group"> + <?php foreach ($unsorted as $item): ?> + <a href="/-/docs/<?= $item["id"] ?>" id="document-<?= $item["id"] ?>" class="list-group-item list-group-item-action document-listing <?php if (strip_tags($item["contents"]) === "/delete"): ?>opacity-75<?php endif; ?>"> + <?= $item["name"] ?> + <?php if (strip_tags($item["contents"]) === "/delete"): ?> + <span class="badge bg-warning rounded-pill text-black">Deleting in <?= round((($item["last"]["date"] + 86400) - time()) / 3600) ?> hours</span> + <?php else: ?> + <span class="relative-time text-muted" data-relative-timestamp="<?= $item["last"]["date"] ?>"><?= timeAgo($item["last"]["date"]) ?></span> + <?php endif; ?> + </a> + <?php endforeach; ?></div> + + <hr> + <h4>Marked for deletion</h4><div class="list-group"> + <?php foreach ($deletable as $item): ?> + <a href="/-/docs/<?= $item["id"] ?>" id="document-<?= $item["id"] ?>" class="list-group-item list-group-item-action document-listing <?php if (strip_tags($item["contents"]) === "/delete"): ?>opacity-75<?php endif; ?>"> + <?= $item["name"] ?> + <?php if (strip_tags($item["contents"]) === "/delete"): ?> + <span class="badge bg-warning rounded-pill text-black">Deleting in <?= round((($item["last"]["date"] + 86400) - time()) / 3600) ?> hours</span> + <?php else: ?> + <span class="relative-time text-muted" data-relative-timestamp="<?= $item["last"]["date"] ?>"><?= timeAgo($item["last"]["date"]) ?></span> + <?php endif; ?> + </a> + <?php endforeach; ?></div> + </div> + + <hr> + <div id="page-content"> + <a href="/-/docs/add">Create a new document</a> + </div> + <?php endif; ?> + </div> +</div> + +<script> + setInterval(async () => { + Array.from(document.getElementsByClassName("relative-time")).forEach((el) => { + el.innerText = timeAgo(parseInt(el.getAttribute("data-relative-timestamp")) * 1000); + }) + }, 1000) + + function timeAgo(time) { + if (!isNaN(parseInt(time))) { + time = new Date(time).getTime(); + } + + let periods = ["sec.", "mn.", "hr.", "d.", "wk.", "mo.", "y.", "ages"]; + + let lengths = ["60", "60", "24", "7", "4.35", "12", "100"]; + + let now = new Date().getTime(); + + let difference = Math.round((now - time) / 1000); + let tense; + let period; + + if (difference <= 10 && difference >= 0) { + return "now"; + } else if (difference > 0) { + tense = "ago"; + } else { + tense = "later"; + } + + let j; + + for (j = 0; difference >= lengths[j] && j < lengths.length - 1; j++) { + difference /= lengths[j]; + } + + difference = Math.round(difference); + + period = periods[j]; + + return `${difference} ${period} ${tense}`; + } +</script> +<style> + .list-group-item { + color: #fff; + background-color: #222; + border: 1px solid rgba(255, 255, 255, .125); + } + + .list-group-item.disabled { + color: #fff; + background-color: #222; + border-color: rgba(255, 255, 255, .125); + opacity: .75; + } + + .list-group-item:hover { + background-color: #252525; + color: #ddd; + } + + .list-group-item:active, .list-group-item:focus { + background-color: #272727; + color: #bbb; + } +</style> + +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?> diff --git a/pages/edit-private.php b/pages/edit-private.php new file mode 100644 index 0000000..ac93e06 --- /dev/null +++ b/pages/edit-private.php @@ -0,0 +1,68 @@ +<?php + +function getSubsystemByID(string $id) { + global $subsystems; + $subsystem = null; + + foreach ($subsystems as $ss) { + if ($ss["source"] === $id) { + $subsystem = $ss; + } + } + + return $subsystem; +} + +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; + +if (!isset($_GET['_']) || trim($_GET['_']) === "") header("Location: /?error=Invalid request") and die(); + +$parts = explode("/", $_GET['_']); +array_shift($parts); +array_shift($parts); +$system = $parts[0]; +$member = ($parts[1] ?? null) === "" ? null : $parts[1]; + +if ($system !== "cloudburst" && $system !== "raindrops") header("Location: /?error=Invalid system name: " . $system) and die(); +$systemCommonName = $system === "cloudburst" ? "Cloudburst System" : "Raindrops System"; +$systemID = $system === "cloudburst" ? "ynmuc" : "gdapd"; + +$subsystems = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-subsystems.json"), true) ?? []; + +if ($member === null) { + header("Location: /?error=Unsupported target: system") and die(); +} else { + $isSubsystem = false; + $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $systemID . "-members.json"), true); + $memberData = null; + $memberCommonName = null; + $memberID = null; + + foreach ($members as $m) { + if ($m['name'] === $member) { + $memberData = $m; + $memberCommonName = $m['display_name'] ?? $m['name']; + $memberID = $m['id']; + } + } + + if ($memberData === null) { + if (in_array($member, array_map(function ($i) { + return $i["source"]; + }, $subsystems))) { + $isSubsystem = true; + $subsystemID = $member; + $subsystem = getSubsystemByID($subsystemID); + $subsystemData = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-subsystem-$subsystem[source].json"), true); + $subsystemCommonName = $subsystemData["name"] ?? $subsystemID; + + require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/subsysedit.php'; + } else { + header("Location: /?error=System member or subsystem not found") and die(); + } + } + + require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/edit-private.php'; +} + +exit;
\ No newline at end of file diff --git a/pages/edit.php b/pages/edit.php index ae007be..8e6de91 100644 --- a/pages/edit.php +++ b/pages/edit.php @@ -13,8 +13,7 @@ function getSubsystemByID(string $id) { return $subsystem; } -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $isLoggedIn; -if (!$isLoggedIn) header("Location: /-/login") and die(); +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; if (!isset($_GET['_']) || trim($_GET['_']) === "") header("Location: /?error=Invalid request") and die(); diff --git a/pages/emergency.php b/pages/emergency.php index ba2a35e..55ed49a 100644 --- a/pages/emergency.php +++ b/pages/emergency.php @@ -1,10 +1,7 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $isLoggedIn; -if (!$isLoggedIn) header("Location: /-/login") and die(); - -$emergencyHeader = true; -$title = "Emergency alert"; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; +$emergencyHeader = true; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; ?> diff --git a/pages/fronting.php b/pages/fronting.php index 261cf03..3e613c6 100644 --- a/pages/fronting.php +++ b/pages/fronting.php @@ -1,4 +1,9 @@ -<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $isLoggedIn; if (!$isLoggedIn) header("Location: /-/login") and die(); $title = "Front planner"; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; ?> +<?php + +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; + +?> <br> <div class="container"> diff --git a/pages/home.php b/pages/home.php index 340df44..a2fe0c3 100644 --- a/pages/home.php +++ b/pages/home.php @@ -1,4 +1,4 @@ -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; ?> +<?php if (isset($_GET['error'])) header("HTTP/1.1 404 Not Found"); require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; ?> <br> <div class="container"> diff --git a/pages/login.php b/pages/login.php index 8611f5f..ebae1ae 100644 --- a/pages/login.php +++ b/pages/login.php @@ -1,6 +1,7 @@ <?php -$title = "Login"; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; ?> diff --git a/pages/nicknames.php b/pages/nicknames.php index 050c275..4c06818 100644 --- a/pages/nicknames.php +++ b/pages/nicknames.php @@ -1,9 +1,7 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $isLoggedIn; -if (!$isLoggedIn) header("Location: /-/login") and die(); - -$title = "Relations nicknames"; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; $members = scoreOrderGlobal(); $relations = []; diff --git a/pages/page.php b/pages/page.php index a00a0f1..cab5dcd 100644 --- a/pages/page.php +++ b/pages/page.php @@ -27,7 +27,7 @@ if (($parts[0] !== "cloudburst" && $parts[0] !== "raindrops") && (!(count($parts } $system = $parts[0]; -$member = ($parts[1] ?? null) === "" ? null : $parts[1]; +$member = (isset($parts[1]) ? $parts[1] : null) === "" ? null : (isset($parts[1]) ? $parts[1] : null); if ($system !== "cloudburst" && $system !== "raindrops") header("Location: /?error=Invalid system ID") and die(); $systemCommonName = $system === "cloudburst" ? "Cloudburst System" : "Raindrops System"; diff --git a/pages/parser.php b/pages/parser.php index b49fd00..1c3dea4 100644 --- a/pages/parser.php +++ b/pages/parser.php @@ -1,4 +1,9 @@ -<?php $title = "Message parser"; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; ?> +<?php + +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; + +?> <br> <div class="container"> @@ -57,7 +62,7 @@ <br> <div id="host-alert" class="alert alert-secondary"> - The entered message does not contain a prefix/suffix corresponding to a member of the selected system(s); therefore, the host was selected as a fallback. We assume that the host is talking when there is no prefix/suffix in the current message. + The entered message does not contain a prefix/suffix corresponding to a member of the selected system(s); therefore, the most common fronter was selected as a fallback. While the most common fronter is supposed to use their prefix too, we assume they are talking when there is no prefix/suffix in the current message. </div> <script> @@ -90,6 +95,8 @@ $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-members.json"), true); foreach ($members as $member) { + if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-$member[id]-metadata.json")) continue; + $data = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-$member[id]-metadata.json"), true)); if ($data["host"]) { echo $member['id']; @@ -101,6 +108,8 @@ $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-members.json"), true); foreach ($members as $member) { + if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-$member[id]-metadata.json")) continue; + $data = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-$member[id]-metadata.json"), true)); if ($data["host"]) { echo $member['id']; @@ -204,7 +213,6 @@ document.getElementById("result-" + system + "-name").innerText = member['display_name'] ?? member['name']; document.getElementById("result-" + system + "-prefix").innerText = member['proxy_tags'][0]['prefix'] + (member['proxy_tags'][0]['suffix'] !== null ? "..." + member['proxy_tags'][0]['suffix'] : ""); - if (prefix !== null) { if (suffix !== null) { textHTML = "<span><span class='prefix'>" + prefix + "</span>" + text + "<span class='suffix'>" + suffix + "</span></span>"; diff --git a/pages/pleasure.php b/pages/pleasure.php index 295e597..14b5440 100644 --- a/pages/pleasure.php +++ b/pages/pleasure.php @@ -1,10 +1,7 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $isLoggedIn; -if (!$isLoggedIn) header("Location: /-/login") and die(); - -$emergencyHeader = true; -$title = "Pleasure alert"; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; +$emergencyHeader = true; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; ?> diff --git a/pages/prefix.php b/pages/prefix.php index cba68b2..2b1149b 100644 --- a/pages/prefix.php +++ b/pages/prefix.php @@ -1,4 +1,9 @@ -<?php $title = "Prefix generator"; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; ?> +<?php + +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; + +?> <br> <div class="container"> diff --git a/pages/relations.php b/pages/relations.php index d0f5583..aac2839 100644 --- a/pages/relations.php +++ b/pages/relations.php @@ -1,48 +1,71 @@ -<?php $title = "Relations"; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; ?> +<?php + +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; + +?> <br> <div class="container"> <div id="page-content"> <h2>Relations</h2> - <?php foreach (scoreOrderGlobal() as $member): if (count($member["_metadata"]["marefriends"]) > 0 || count($member["_metadata"]["sisters"]) > 0): ?> + <?php foreach (withCaretakersDown(scoreOrderGlobal()) as $member): if (count($member["_metadata"]["marefriends"]) > 0 || count($member["_metadata"]["sisters"]) > 0): ?> <div class="relation" style="background-color:rgba(255, 255, 255, .1);margin-bottom:10px;padding:10px;border-radius:10px;display:grid;grid-template-columns: 1.5fr <?= $member["_metadata"]["little"] === 2 ? "2fr 2fr 2fr" : "3fr 3fr" ?>;"> <a class="relation-intro" style="background-color:rgba(255, 255, 255, .05);border-right:1px solid rgba(255, 255, 255, .1);margin:-10px;padding:10px;border-top-left-radius:10px;border-bottom-left-radius:10px;color: white;text-decoration: none;" href="/<?= $member["name"] ?>"> <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . resolveMember($member['name']) . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> </a> - <div class="relation-item relation-item-marefriends" style="margin-left:10px;padding:0 20px;"> - <b style="padding-right:5px;">Marefriends:</b><span class="list-separator-mobile"><br></span> - <?php if (count($member["_metadata"]["marefriends"]) === 0): ?> - <span class="text-muted">None</span> - <?php else: ?> - <?php $index = 0; foreach ($member["_metadata"]["marefriends"] as $id): $mfSystem = explode("/", $id)[0]; $marefriend = getSystemMember(explode("/", $id)[0], explode("/", $id)[1]); ?> - <a class="member-link" href="/<?= $marefriend["name"] ?>"><img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $marefriend['name'] . ".png") ? "-" . $marefriend['name'] : "" ?>.png" style="width:24px;"> <?= getMiniName($marefriend["display_name"] ?? $marefriend["name"]) ?></a><?php if ($index + 2 <= count($member["_metadata"]["marefriends"])) echo('<span class="list-separator-desktop">, </span><span class="list-separator-mobile"><br></span>'); $index++; ?> - <?php endforeach; ?> - <?php endif; ?> - </div> + <table class="relation-item relation-item-marefriends" style="margin-left:10px;padding:0 20px;"> + <tbody><tr> + <td style="width: 50%;text-align:right;"> + <b style="padding-right:5px;">Marefriends:</b><span class="list-separator-mobile"><br></span> + </td> + <td style="width: 50%;text-align:left;"> + <?php if (count($member["_metadata"]["marefriends"]) === 0): ?> + <span class="text-muted">None</span> + <?php else: ?> + <?php foreach ($member["_metadata"]["marefriends"] as $id): $mfSystem = explode("/", $id)[0]; $marefriend = getSystemMember(explode("/", $id)[0], explode("/", $id)[1]); ?> + <a title="<?= getMiniName($marefriend["display_name"] ?? $marefriend["name"]) ?>" data-bs-toggle="tooltip" class="member-link tooltip-nohelp" href="/<?= $marefriend["name"] ?>"><img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $marefriend['name'] . ".png") ? "-" . $marefriend['name'] : "" ?>.png" style="width:24px;"></a> + <?php endforeach; ?> + <?php endif; ?> + </td> + </tr></tbody> + </table> - <div class="relation-item relation-item-sisters" style="padding:0 20px;"> - <b style="padding-right:5px;">Sisters:</b><span class="list-separator-mobile"><br></span> - <?php if (count($member["_metadata"]["sisters"]) === 0): ?> - <span class="text-muted">None</span> - <?php else: ?> - <?php $index = 0; foreach ($member["_metadata"]["sisters"] as $id): $mfSystem = explode("/", $id)[0]; $marefriend = getSystemMember(explode("/", $id)[0], explode("/", $id)[1]); ?> - <a class="member-link" href="/<?= $marefriend["name"] ?>"><img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $marefriend['name'] . ".png") ? "-" . $marefriend['name'] : "" ?>.png" style="width:24px;"> <?= getMiniName($marefriend["display_name"] ?? $marefriend["name"]) ?></a><?php if ($index + 2 <= count($member["_metadata"]["sisters"])) echo('<span class="list-separator-desktop">, </span><span class="list-separator-mobile"><br></span>'); $index++; ?> - <?php endforeach; ?> - <?php endif; ?> - </div> + <table class="relation-item relation-item-sisters" style="padding:0 20px;"> + <tbody><tr> + <td style="width: 50%;text-align:right;"> + <b style="padding-right:5px;">Sisters:</b><span class="list-separator-mobile"><br></span> + </td> + <td style="width: 50%;text-align:left;"> + <?php if (count($member["_metadata"]["sisters"]) === 0): ?> + <span class="text-muted">None</span> + <?php else: ?> + <?php foreach ($member["_metadata"]["sisters"] as $id): $mfSystem = explode("/", $id)[0]; $marefriend = getSystemMember(explode("/", $id)[0], explode("/", $id)[1]); ?> + <a title="<?= getMiniName($marefriend["display_name"] ?? $marefriend["name"]) ?>" data-bs-toggle="tooltip" class="member-link tooltip-nohelp" href="/<?= $marefriend["name"] ?>"><img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $marefriend['name'] . ".png") ? "-" . $marefriend['name'] : "" ?>.png" style="width:24px;"></a> + <?php endforeach; ?> + <?php endif; ?> + </td> + </tr></tbody> + </table> <?php if ($member["_metadata"]["little"] === 2): ?> - <div class="relation-item relation-item-sisters" style="padding:0 20px;"> - <b style="padding-right:5px;">Caretakers:</b><span class="list-separator-mobile"><br></span> - <?php if (count($member["_metadata"]["caretakers"]) === 0): ?> - <span class="text-muted">None</span> - <?php else: ?> - <?php $index = 0; foreach ($member["_metadata"]["caretakers"] as $id): $mfSystem = explode("/", $id)[0]; $marefriend = getSystemMember(explode("/", $id)[0], explode("/", $id)[1]); ?> - <a class="member-link" href="/<?= $marefriend["name"] ?>"><img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $marefriend['name'] . ".png") ? "-" . $marefriend['name'] : "" ?>.png" style="width:24px;"> <?= getMiniName($marefriend["display_name"] ?? $marefriend["name"]) ?></a><?php if ($index + 2 <= count($member["_metadata"]["sisters"])) echo('<span class="list-separator-desktop">, </span><span class="list-separator-mobile"><br></span>'); $index++; ?> - <?php endforeach; ?> - <?php endif; ?> - </div> + <table class="relation-item relation-item-sisters" style="padding:0 20px;"> + <tbody><tr> + <td style="width: 50%;text-align:right;"> + <b style="padding-right:5px;">Caretakers:</b><span class="list-separator-mobile"><br></span> + </td> + <td style="width: 50%;text-align:left;"> + <?php if (count($member["_metadata"]["caretakers"]) === 0): ?> + <span class="text-muted">None</span> + <?php else: ?> + <?php foreach ($member["_metadata"]["caretakers"] as $id): $mfSystem = explode("/", $id)[0]; $marefriend = getSystemMember(explode("/", $id)[0], explode("/", $id)[1]); ?> + <a title="<?= getMiniName($marefriend["display_name"] ?? $marefriend["name"]) ?>" data-bs-toggle="tooltip" class="member-link tooltip-nohelp" href="/<?= $marefriend["name"] ?>"><img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $marefriend['name'] . ".png") ? "-" . $marefriend['name'] : "" ?>.png" style="width:24px;"></a> + <?php endforeach; ?> + <?php endif; ?> + </td> + </tr></tbody> + </table> <?php endif; ?> </div> <?php endif; endforeach; ?> diff --git a/pages/rules.php b/pages/rules.php index b1759dc..9148d89 100644 --- a/pages/rules.php +++ b/pages/rules.php @@ -1,7 +1,6 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $isLoggedIn; -if (!$isLoggedIn) header("Location: /-/login") and die(); +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; if (isset($_POST["updateRules"])) { header("Content-Type: text/plain"); @@ -35,7 +34,7 @@ if (isset($_POST["updateRules"])) { die(); } -$title = "Systems rules"; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; ?> @@ -73,7 +72,7 @@ $title = "Systems rules"; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/he </summary> <?php if (in_array(false, $rule["approved"])): ?> <div style="margin-top:10px;" class="alert alert-warning"> - <b>This rule has not yet been approved.</b> All rules need to be approved by the protectors from both systems. This rule is still missing approval from <?php + <b>This rule has not yet been approved.</b> All rules need to be approved by the primary protectors from both systems. This rule is still missing approval from <?php if ($rule["approved"][0] === false) { if ($rule["approved"][1] === false) { diff --git a/pages/score.php b/pages/score.php index 043a695..370d757 100644 --- a/pages/score.php +++ b/pages/score.php @@ -1,9 +1,7 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $isLoggedIn; -if (!$isLoggedIn) header("Location: /-/login") and die(); - -$title = "Score system testing"; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; ?> @@ -16,7 +14,7 @@ $title = "Score system testing"; require_once $_SERVER['DOCUMENT_ROOT'] . '/incl $scores = []; foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-members.json"), true) as $member) { - if ($member["name"] !== "unknown" && $member["name"] !== "fusion" && !str_ends_with($member["name"], "-travelling")) { + if ($member["name"] !== "unknown" && $member["name"] !== "fusion" && $member["name"] !== "new" && !str_ends_with($member["name"], "-travelling")) { require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/score.php"; $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-$member[id]-metadata.json"), true)); $score = calculateScore($metadata, $member["display_name"] ?? $member["name"]); @@ -37,7 +35,7 @@ $title = "Score system testing"; require_once $_SERVER['DOCUMENT_ROOT'] . '/incl $scores = []; foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-members.json"), true) as $member) { - if ($member["name"] !== "unknown" && $member["name"] !== "fusion" && !str_ends_with($member["name"], "-travelling")) { + if ($member["name"] !== "unknown" && $member["name"] !== "fusion" && $member["name"] !== "new" && !str_ends_with($member["name"], "-travelling")) { $name = $member["display_name"] ?? $member["name"]; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/score.php"; $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-$member[id]-metadata.json"), true)); @@ -73,7 +71,7 @@ $title = "Score system testing"; require_once $_SERVER['DOCUMENT_ROOT'] . '/incl $scores = []; foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-members.json"), true) as $member) { - if ($member["name"] !== "unknown" && $member["name"] !== "fusion" && !str_ends_with($member["name"], "-travelling")) { + if ($member["name"] !== "unknown" && $member["name"] !== "fusion" && $member["name"] !== "new" && !str_ends_with($member["name"], "-travelling")) { require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/score.php"; $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-$member[id]-metadata.json"), true)); $score = calculateScore($metadata, $member["display_name"] ?? $member["name"]); @@ -94,7 +92,7 @@ $title = "Score system testing"; require_once $_SERVER['DOCUMENT_ROOT'] . '/incl $scores = []; foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-members.json"), true) as $member) { - if ($member["name"] !== "unknown" && $member["name"] !== "fusion" && !str_ends_with($member["name"], "-travelling")) { + if ($member["name"] !== "unknown" && $member["name"] !== "fusion" && $member["name"] !== "new" && !str_ends_with($member["name"], "-travelling")) { $name = $member["display_name"] ?? $member["name"]; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/score.php"; $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-$member[id]-metadata.json"), true)); @@ -129,7 +127,7 @@ $title = "Score system testing"; require_once $_SERVER['DOCUMENT_ROOT'] . '/incl $scores = []; foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-members.json"), true) as $member) { - if ($member["name"] !== "unknown" && $member["name"] !== "fusion" && !str_ends_with($member["name"], "-travelling")) { + if ($member["name"] !== "unknown" && $member["name"] !== "fusion" && $member["name"] !== "new" && !str_ends_with($member["name"], "-travelling")) { require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/score.php"; $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-$member[id]-metadata.json"), true)); $score = calculateScore($metadata, $member["display_name"] ?? $member["name"]); @@ -138,7 +136,7 @@ $title = "Score system testing"; require_once $_SERVER['DOCUMENT_ROOT'] . '/incl } } foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-members.json"), true) as $member) { - if ($member["name"] !== "unknown" && $member["name"] !== "fusion" && !str_ends_with($member["name"], "-travelling")) { + if ($member["name"] !== "unknown" && $member["name"] !== "fusion" && $member["name"] !== "new" && !str_ends_with($member["name"], "-travelling")) { require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/score.php"; $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-$member[id]-metadata.json"), true)); $score = calculateScore($metadata, $member["display_name"] ?? $member["name"]); @@ -159,7 +157,7 @@ $title = "Score system testing"; require_once $_SERVER['DOCUMENT_ROOT'] . '/incl $scores = []; foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-members.json"), true) as $member) { - if ($member["name"] !== "unknown" && $member["name"] !== "fusion" && !str_ends_with($member["name"], "-travelling")) { + if ($member["name"] !== "unknown" && $member["name"] !== "fusion" && $member["name"] !== "new" && !str_ends_with($member["name"], "-travelling")) { $name = $member["display_name"] ?? $member["name"]; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/score.php"; $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-$member[id]-metadata.json"), true)); @@ -174,7 +172,7 @@ $title = "Score system testing"; require_once $_SERVER['DOCUMENT_ROOT'] . '/incl } } foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-members.json"), true) as $member) { - if ($member["name"] !== "unknown" && $member["name"] !== "fusion" && !str_ends_with($member["name"], "-travelling")) { + if ($member["name"] !== "unknown" && $member["name"] !== "fusion" && $member["name"] !== "new" && !str_ends_with($member["name"], "-travelling")) { $name = $member["display_name"] ?? $member["name"]; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/score.php"; $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-$member[id]-metadata.json"), true)); diff --git a/pages/splitting.php b/pages/splitting.php index 7b5b1f5..d50ede8 100644 --- a/pages/splitting.php +++ b/pages/splitting.php @@ -1,9 +1,7 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $isLoggedIn; -if (!$isLoggedIn) header("Location: /-/login") and die(); - -$title = "Members by splitting date"; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; ?> diff --git a/pages/terminology.php b/pages/terminology.php index f73d401..955e470 100644 --- a/pages/terminology.php +++ b/pages/terminology.php @@ -1,4 +1,9 @@ -<?php $title = "Terminology"; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; ?> +<?php + +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; + +?> <br> <div class="container"> diff --git a/pages/together.php b/pages/together.php index 4e39736..65786f5 100644 --- a/pages/together.php +++ b/pages/together.php @@ -1,9 +1,7 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $isLoggedIn; -if (!$isLoggedIn) header("Location: /-/login") and die(); - -$title = "Watch Together"; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; global $WebSocketAddress; diff --git a/pages/toys.php b/pages/toys.php index e4e5def..e0fb1fe 100644 --- a/pages/toys.php +++ b/pages/toys.php @@ -1,7 +1,6 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $isLoggedIn; -if (!$isLoggedIn) header("Location: /-/login") and die(); +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; if (isset($_POST['deleteAction'])) { $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/toys.json"), true); @@ -164,7 +163,6 @@ $parts = explode("/", $pagename); $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/toys.json"), true); $selected = null; -$title = "Toys database"; if (isset($parts[1])) { $id = $parts[1]; @@ -180,7 +178,7 @@ if (isset($parts[1])) { header("Location: /-/toys/?nf&id=" . $id); die(); } else { - $title = $selected["name"] . " · Toys database"; + $title = $selected["name"] . " · " . $title; } } @@ -220,18 +218,18 @@ global $_PROFILE; </h2> <p> <a onclick="event.target.blur();" data-bs-toggle="modal" data-bs-target="#editor" href="#">Edit</a> · - <?php if ($item["sexual"]): ?> + <?php if ($selected["sexual"]): ?> <span style="" class="badge rounded-pill bg-danger">Sexual</span> <?php else: ?> <span style="" class="badge rounded-pill bg-success">Pleasurable</span> <?php endif; ?> - <?php if (!isset($item["verified"])): ?><span class="badge bg-warning rounded-pill text-black">Unverified</span><?php endif; ?> - <?php if (isset($item["untested"])): ?><span class="badge bg-info rounded-pill">Untested</span><?php endif; ?> - <?php if ($item["water"] === "in"): ?> + <?php if (!isset($selected["verified"])): ?><span class="badge bg-warning rounded-pill text-black">Unverified</span><?php endif; ?> + <?php if (isset($selected["untested"])): ?><span class="badge bg-info rounded-pill">Untested</span><?php endif; ?> + <?php if ($selected["water"] === "in"): ?> <span style="" class="badge rounded-pill bg-primary">Underwater</span> - <?php elseif ($item["water"] === "out"): ?> + <?php elseif ($selected["water"] === "out"): ?> <span style="background-color:#d63384;" class="badge rounded-pill">Outside of water</span> - <?php elseif ($item["water"] === "playground"): ?> + <?php elseif ($selected["water"] === "playground"): ?> <span class="badge rounded-pill" style="background-color:#20c997;">In playground</span> <?php else: ?> <span style="" class="badge rounded-pill bg-primary">Underwater</span> @@ -356,17 +354,19 @@ global $_PROFILE; if ($action["name"] !== $currentName) $names[$action["name"]] = [ "id" => $action["id"], "water" => $action["water"], - "ponies" => $action["ponies"] + "ponies" => $action["ponies"], + "sexual" => $action["sexual"] ]; } foreach ($names as $name => $data) { $namesByDistance[] = [ "name" => $name, - "distance" => levenshtein($currentName, $name) + ((int)($data["type"] !== $selected["type"]) * 2), + "distance" => levenshtein($currentName, $name) + ((int)($data["water"] !== $selected["water"]) * 2), "id" => $data["id"], "water" => $data["water"], - "ponies" => $data["ponies"] + "ponies" => $data["ponies"], + "sexual" => $data["sexual"] ]; } @@ -382,7 +382,7 @@ global $_PROFILE; foreach ($namesByDistance as $item): if ($index < 3): ?> <div class="col-md-4" style="margin-bottom:20px;"> - <a class="linked-card" href="/-/actions/<?= $item["id"] ?>"><div class="card"> + <a class="linked-card" href="/-/toys/<?= $item["id"] ?>"><div class="card"> <div class="card-body"> <h4 class="card-title"><?= $item["name"] ?></h4> <p class="card-text"> @@ -522,7 +522,7 @@ global $_PROFILE; foreach ($relations as $id => $relation): ?> - <label style="display:block;" class="creator-relation <?= $selected["type"] === "mixed" ? "mixed" : "" ?> <?= in_array($id, $inFileRelations) ? "checked" : "" ?>"> + <label style="display:block;" class="creator-relation <?= in_array($id, $inFileRelations) ? "checked" : "" ?>"> <input <?= in_array($id, $inFileRelations) ? "checked" : "" ?> name="relations[<?= $id ?>][member]" style="display:none;" type="checkbox" class="checkbox-input"> <img style="vertical-align: middle;width:24px;height:24px;" src="<?= $relation["images"][0] ?>"> diff --git a/pages/travelling.php b/pages/travelling.php index c40ebab..95c7851 100644 --- a/pages/travelling.php +++ b/pages/travelling.php @@ -1,7 +1,6 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $isLoggedIn; -if (!$isLoggedIn) header("Location: /-/login") and die(); +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; $travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling.json"), true); $app = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true); @@ -94,11 +93,11 @@ if (isset($_GET['toggleTravel'])) { } header("Location: /-/travelling"); - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling.json", json_encode($travelling, JSON_PRETTY_PRINT)); + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling.json", utf8_encode(json_encode($travelling, JSON_PRETTY_PRINT))); die(); } -$title = "System travels manager"; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; global $travelling; ?> @@ -125,7 +124,7 @@ global $travelling; <div class="relation-item" style="display:flex;align-items:center;margin-left:10px;padding:0 20px;"> <div> - <b style="padding-right:5px;">Current System:</b><span class="list-separator-mobile"><br></span> + <b style="padding-right:5px;">Current system:</b><span class="list-separator-mobile"><br></span> <?php $system = $member['_system'] === "gdapd" ? ($travelling[$member['id']]["travelling"] ? "ynmuc" : "gdapd") : ($travelling[$member['id']]["travelling"] ? "gdapd" : "ynmuc"); ?> <a class="member-link" href="/<?= $system === "gdapd" ? "raindrops" : "cloudburst" ?>"><img style="width:24px;border-radius:5px;" src="/assets/uploads/<?= $system === "gdapd" ? "raindrops" : "cloudburst" ?>.png"> <?= $system === "gdapd" ? "Raindrops" : "Cloudburst" ?> System</a> <?php if ($travelling[$member['id']]["travelling"]): ?> diff --git a/pages/wakeup.php b/pages/wakeup.php new file mode 100644 index 0000000..c90d93e --- /dev/null +++ b/pages/wakeup.php @@ -0,0 +1,15 @@ +<?php + +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn; +$emergencyHeader = true; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; + +?> + +<br> +<div class="container"> + <div id="page-content"> + <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/wakeup.php"; ?> + </div> +</div> + +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?> |