diff options
Diffstat (limited to 'pages')
35 files changed, 536 insertions, 1081 deletions
diff --git a/pages/about.inc b/pages/about.inc index 3e89cf5..855d9b1 100644 --- a/pages/about.inc +++ b/pages/about.inc @@ -1,6 +1,6 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; $version = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/version.json"), true); diff --git a/pages/actions.inc b/pages/actions.inc index eb83f16..40a359a 100644 --- a/pages/actions.inc +++ b/pages/actions.inc @@ -1,6 +1,6 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; if (isset($_POST['deleteAction'])) { $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/actions/actions.json"), true); diff --git a/pages/alphabet.inc b/pages/alphabet.inc index 167ba92..55cb130 100644 --- a/pages/alphabet.inc +++ b/pages/alphabet.inc @@ -1,6 +1,6 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; ?> @@ -8,7 +8,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; <br> <div class="container"> <div id="page-content"> - <h2>Members by prefix letters</h2> + <h2><?= $pages["alphabet"]["name"][$lang["_name"]] ?></h2> <?php $members = scoreOrderGlobal(); ?> <div> diff --git a/pages/bitset.inc b/pages/bitset.inc index b608c73..6d05e8e 100644 --- a/pages/bitset.inc +++ b/pages/bitset.inc @@ -1,10 +1,33 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; ?> +<?php if (isset($_GET['embed'])): ?> +<style> + #page-content, #title-bar, #mobile-navigation, #titlebar-separator, #footer { + display: none !important; + } + + #footer-pre { + height: 20px; + } + + body { + background-color: transparent !important; + } +</style> + +<script> + window.addEventListener("load", () => { + document.getElementById("input").value = "<?= $_GET['embed'] ?>"; + calculateInput(); + }) +</script> +<?php endif; ?> + <br> <div class="container"> <div id="page-content"> @@ -21,10 +44,10 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; <div data-bs-toggle="tooltip" title="Value reserved for future use" id="binary-bit-8" 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-9" 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-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="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="Persecutor" id="binary-bit-11" class="font-monospace tooltip-nohelp" style="color:#197387;text-align: center;cursor: pointer;">0</div> + <div data-bs-toggle="tooltip" title="Leader" id="binary-bit-12" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#877e19;">0</div> + <div data-bs-toggle="tooltip" title="Age regressor (deprecated)" id="binary-bit-13" class="font-monospace tooltip-nohelp" style="color: #383838;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: rgb(59,196,46);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> @@ -32,9 +55,9 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; <div data-bs-toggle="tooltip" title="Ability to use magic" id="binary-bit-19" class="font-monospace tooltip-nohelp" style="color: #fd7e14;text-align: center;cursor: pointer;">0</div> <div data-bs-toggle="tooltip" title="Ability to use magic" id="binary-bit-20" class="font-monospace tooltip-nohelp" style="color: #fd7e14;text-align: center;cursor: pointer;">0</div> <div data-bs-toggle="tooltip" title="Ability to use magic" id="binary-bit-21" class="font-monospace tooltip-nohelp" style="color: #fd7e14;text-align: center;cursor: pointer;">0</div> - <div data-bs-toggle="tooltip" title="Affectionative or sexual sensitivity" id="binary-bit-22" class="font-monospace tooltip-nohelp" style="color:#ffc107; text-align: center;cursor: pointer;">0</div> - <div data-bs-toggle="tooltip" title="Affectionative or sexual sensitivity" id="binary-bit-23" class="font-monospace tooltip-nohelp" style="color:#ffc107; text-align: center;cursor: pointer;">0</div> - <div data-bs-toggle="tooltip" title="Affectionative or sexual sensitivity" id="binary-bit-24" class="font-monospace tooltip-nohelp" style="color:#ffc107; text-align: center;cursor: pointer;">0</div> + <div data-bs-toggle="tooltip" title="Affectionative or sexual sensitivity" id="binary-bit-22" class="font-monospace tooltip-nohelp" style="color:#3340d0; text-align: center;cursor: pointer;">0</div> + <div data-bs-toggle="tooltip" title="Affectionative or sexual sensitivity" id="binary-bit-23" class="font-monospace tooltip-nohelp" style="color:#3340d0; text-align: center;cursor: pointer;">0</div> + <div data-bs-toggle="tooltip" title="Affectionative or sexual sensitivity" id="binary-bit-24" class="font-monospace tooltip-nohelp" style="color:#3340d0; text-align: center;cursor: pointer;">0</div> <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> @@ -43,7 +66,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; <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="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="Most common fronter (deprecated)" id="binary-bit-33" class="font-monospace tooltip-nohelp" style="color:#383838;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> @@ -58,7 +81,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; <div data-bs-toggle="tooltip" title="3rd species" id="binary-bit-45" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#abfa77;">0</div> <div data-bs-toggle="tooltip" title="Robot" id="binary-bit-46" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;">0</div> <div data-bs-toggle="tooltip" title="Plush" id="binary-bit-47" class="font-monospace tooltip-nohelp" style="text-align: center;cursor: pointer;color:#6610f2;">0</div> - <div data-bs-toggle="tooltip" title="Affected by age spells" id="binary-bit-48" class="font-monospace tooltip-nohelp" style="color:#6f42c1;text-align: center;cursor: pointer;">0</div> + <div data-bs-toggle="tooltip" title="Affected by age spells (deprecated)" id="binary-bit-48" class="font-monospace tooltip-nohelp" style="color:#383838;text-align: center;cursor: pointer;">0</div> </div> <br> <p> @@ -110,6 +133,8 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; let lessFrequent = binString.substring(14, 15) !== "0"; let sexuallyActive = binString.substring(13, 14) !== "0"; let ageRegressor = binString.substring(12, 13) !== "0"; + let leader = binString.substring(11, 12) !== "0"; + let persecutor = binString.substring(10, 11) !== "0"; document.getElementById("value-0").value = sharedMemory; document.getElementById("value-1").value = little; @@ -131,6 +156,8 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; document.getElementById("value-17").checked = lessFrequent; document.getElementById("value-18").checked = sexuallyActive; document.getElementById("value-19").checked = ageRegressor; + document.getElementById("value-20").checked = leader; + document.getElementById("value-21").checked = persecutor; } } @@ -183,6 +210,8 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; let sensitivity = parseInt(binString.substring(5 + 16, 8 + 16), 2); let sexuallyActive = binString.substring(13, 14) !== "0"; let ageRegressor = binString.substring(12, 13) !== "0"; + let leader = binString.substring(11, 12) !== "0"; + let persecutor = binString.substring(10, 11) !== "0"; document.getElementById("value-0").value = sharedMemory; document.getElementById("value-1").value = little; @@ -204,6 +233,8 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; document.getElementById("value-17").checked = lessFrequent; document.getElementById("value-18").checked = sexuallyActive; document.getElementById("value-19").checked = ageRegressor; + document.getElementById("value-20").checked = leader; + document.getElementById("value-21").checked = persecutor; calculateOutput(); @@ -231,6 +262,8 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; let val17 = document.getElementById("value-17").checked; let val18 = document.getElementById("value-18").checked; let val19 = document.getElementById("value-19").checked; + let val20 = document.getElementById("value-20").checked; + let val21 = document.getElementById("value-21").checked; let val0bin = parseInt(val0).toString(2); val0bin = val0bin.length === 1 ? "0" + val0bin : val0bin; @@ -263,8 +296,10 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; let val17bin = val17 ? "1" : "0"; let val18bin = val18 ? "1" : "0"; let val19bin = val19 ? "1" : "0"; + let val20bin = val20 ? "1" : "0"; + let val21bin = val21 ? "1" : "0"; - let bin = "000000000000" + val19bin + val18bin + val17bin + val16bin + val11bin + val12bin + val13bin + val0bin + val4bin + val1bin + val5bin + val6bin + val7bin + val8bin + val2bin + val3bin + val14bin + val9bin + val10bin + val15bin; + let bin = "0000000000" + val21bin + val20bin + 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,7 +323,6 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; <option value="1">Partial direct access</option> <option value="0" selected>No direct access</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> <b>Food: </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-11" onchange="updateFromSelection();"> <option value="0" selected>Doesn't need to eat</option> @@ -296,7 +330,6 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; <option value="2">Can't eat meat</option> <option value="3">Can eat everything</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> <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> @@ -304,7 +337,6 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; <option value="3">Younger</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> <b>Species: </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-2" onchange="updateFromSelection();"> <option value="0000" disabled>None</option> @@ -333,77 +365,93 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; <option value="0101">Bat pony</option> <option value="0110">Crystal pony</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> - <b>Magic: </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-12" onchange="updateFromSelection();"> - <option value="0" selected>Can't use magic</option> - <option value="1">Can use magic in some cases</option> - <option value="2">Can use magic with a horn</option> - <option value="3">Can use magic with wings</option> - <option value="4">Can use magic with wings and a horn</option> - <option value="5">Can use magic with another part of the body</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> + <div style="display: none;"> + <b>Magic: </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-12" onchange="updateFromSelection();"> + <option value="0" selected>Can't use magic</option> + <option value="1" disabled>Can use magic in some cases (deprecated)</option> + <option value="2">Can use magic with a horn</option> + <option value="3">Can use magic with wings</option> + <option value="4">Can use magic with wings and a horn</option> + <option value="5">Can use magic with another part of the body</option> + </select> + <br> + </div> <b>Sensitivity: </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-13" onchange="updateFromSelection();"> <option value="0" selected>None</option> - <option value="1">May be sensitive</option> + <option value="1" disabled>May be sensitive (deprecated)</option> <option value="2">Affectionately sensitive</option> <option value="3">Sexually sensitive</option> - <option value="4">Sensitive in both ways</option> + <option value="4" disabled>Sensitive in both ways (deprecated)</option> </select> - <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"> </p> <p> <label style="margin-bottom:5px;"> <input type="checkbox" id="value-4" onchange="updateFromSelection();"> Part of a median system - </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><br> <label style="margin-bottom:5px;"> <input type="checkbox" id="value-5" onchange="updateFromSelection();"> Protector - </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><br> + <label style="margin-bottom:5px;"> + <input type="checkbox" id="value-20" onchange="updateFromSelection();"> + Leader + </label><br> <label style="margin-bottom:5px;"> <input type="checkbox" id="value-6" onchange="updateFromSelection();"> Fictive - </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><br> + <label style="margin-bottom:5px;"> + <input type="checkbox" id="value-18" onchange="updateFromSelection();"> + Sexually active + </label><br> <label style="margin-bottom:5px;"> <input type="checkbox" id="value-7" onchange="updateFromSelection();"> Not talking - </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();"> - 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><br> <label style="margin-bottom:5px;"> <input type="checkbox" id="value-9" onchange="updateFromSelection();"> Robot - </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><br> <label style="margin-bottom:5px;"> <input type="checkbox" id="value-10" onchange="updateFromSelection();"> Plush - </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-15" onchange="updateFromSelection();"> - Affected by age spells - </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><br> <label style="margin-bottom:5px;"> <input type="checkbox" id="value-16" onchange="updateFromSelection();"> Non verbal in real life - </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><br> <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"><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><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> + <input type="checkbox" id="value-21" onchange="updateFromSelection();"> + Persecutor + </label><br> </p> + + <hr> + <details> + <summary>Show deprecated options</summary> + + <br> + <p> + <label style="margin-bottom:5px;"> + <input type="checkbox" id="value-8" onchange="updateFromSelection();"> + 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-15" onchange="updateFromSelection();"> + Affected by age spells + </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> + </details> </div> <?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> diff --git a/pages/byfront.inc b/pages/byfront.inc index 77556a2..ca2a6c2 100644 --- a/pages/byfront.inc +++ b/pages/byfront.inc @@ -1,6 +1,6 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; $travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling/travelling.json"), true); @@ -48,7 +48,7 @@ $travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includ return $i; }, array_values(array_filter(scoreOrderGlobal(), function ($i) { - return $i["_system"] === "ynmuc"; + return $i["_system"] === "ynmuc" && !$i["_metadata"]["persecutor"]; }))), ...array_map(function ($i) { $system = "gdapd"; @@ -86,15 +86,18 @@ $travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includ return $i; }, array_values(array_filter(scoreOrderGlobal(), function ($i) { - return $i["_system"] === "gdapd"; + return $i["_system"] === "gdapd" && !$i["_metadata"]["persecutor"]; }))) ]; uasort($members, function ($a, $b) { return $b["_lastFronted"] - $a["_lastFronted"]; }); $members = array_reverse($members); foreach ($members as $member): if ($member["_lastFronted"] !== -1 && $member["_lastFronted"] !== time()): ?> - <div class="relation" style="background-color:<?php if ($member["_lastFronted"] > time() - (86400 * 14)): ?>rgba(255, 255, 255, .1)<?php else: ?><?php if ($member["_lastFronted"] > time() - (86400 * 30)): ?>rgba(255, 227, 0, 0.17)<?php else: ?>rgba(255,55,55,0.17)<?php endif; ?>;<?php endif; ?>;margin-bottom:10px;padding:10px;border-radius:10px;display:grid;grid-template-columns: 1fr 2fr max-content;<?php if ($travelling[$member['id']]["travelling"]): ?>opacity: 0.75;<?php endif; ?>"> + <div class="relation" style="background-color:<?php if ($member["_metadata"]["less_frequent"]): ?><?php if ($member["_lastFronted"] > time() - (86400 * 21)): ?>rgba(255, 255, 255, .1)<?php else: ?><?php if ($member["_lastFronted"] > time() - (86400 * 37)): ?>rgba(255, 227, 0, 0.17)<?php else: ?>rgba(255,55,55,0.17)<?php endif; ?>;<?php endif; ?><?php else: ?><?php if ($member["_lastFronted"] > time() - (86400 * 21)): ?>rgba(255, 255, 255, .1)<?php else: ?><?php if ($member["_lastFronted"] > time() - (86400 * 30)): ?>rgba(255, 227, 0, 0.17)<?php else: ?>rgba(255,55,55,0.17)<?php endif; ?>;<?php endif; ?><?php endif; ?>;margin-bottom:10px;padding:10px;border-radius:10px;display:grid;grid-template-columns: 1fr 2fr max-content;<?php if ($travelling[$member['id']]["travelling"]): ?>opacity: 0.75;<?php endif; ?>"> <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="<?= getAsset($member['system'], $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> <span style="display: inline-block;margin-left: auto;"> + <?php if ($member["_metadata"]["less_frequent"]): ?> + <span class="badge bg-success rounded-pill">Less</span> + <?php endif; ?> <?php if ($member["_metadata"]["shared_memory"] !== 2): ?> <span class="badge text-black bg-warning rounded-pill">Memory</span> <?php endif; ?> diff --git a/pages/computers.inc b/pages/computers.inc index c2d6437..6880d48 100644 --- a/pages/computers.inc +++ b/pages/computers.inc @@ -1,6 +1,6 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $pagename; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; global $pagename; $computer = []; $parts = explode("/", $pagename); diff --git a/pages/dashboard.inc b/pages/dashboard.inc index 07a75e8..08e063b 100644 --- a/pages/dashboard.inc +++ b/pages/dashboard.inc @@ -1,6 +1,6 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $pages; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; global $pages; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; global $_PROFILE; use om\IcalParser; diff --git a/pages/debug.inc b/pages/debug.inc index e316a6f..1327af5 100644 --- a/pages/debug.inc +++ b/pages/debug.inc @@ -1,18 +1,20 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; 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"; - if ($item === "version") return "Version information"; - if ($item === "logo") return "Website logo processing"; - if ($item === "favicons") return "Favicons processing"; - if ($item === "assets") return "External assets download"; + global $lang; global $pages; + + if ($item === "docs_cleanup") return $lang["debug"]["docs_cleanup"]; + if ($item === "important_backup") return $lang["debug"]["important_backup"]; + if ($item === "restore") return $lang["debug"]["restore"]; + if ($item === "backups") return $lang["debug"]["backups"]; + if ($item === "calendar") return $lang["debug"]["calendar"]; + if ($item === "version") return $lang["debug"]["version"]; + if ($item === "logo") return $lang["debug"]["logo"]; + if ($item === "favicons") return $lang["debug"]["favicons"]; + if ($item === "assets") return $lang["debug"]["assets"]; if (str_starts_with($item, "system-")) { $system = explode("-", $item)[2]; @@ -20,11 +22,11 @@ function itemToName(string $item): string { $systemName = $system === "gdapd" ? "Raindrops System" : "Cloudburst System"; return match ($type) { - "general" => "General info about $systemName", - "members" => "Members in the $systemName", - "fronters" => "Current fronter(s) in the $systemName", - "switches" => "Switch history from the $systemName", - default => "$type in $systemName", + "general" => $lang["debug"]["general"] . " $systemName", + "members" => $lang["debug"]["members"] . " $systemName", + "fronters" => $lang["debug"]["fronters"] . " $systemName", + "switches" => $lang["debug"]["switches"] . " $systemName", + default => "$type " . $lang["debug"]["in"] . " $systemName", }; } @@ -35,9 +37,9 @@ function itemToName(string $item): string { $member = getSystemMember($system, $id) ?? [ "name" => $id, "display_name" => $id, "id" => $id ]; if ($member["name"] === "unknown") { - return "Unknown (" . $systemName . ")'s images"; + return str_replace("%1", $lang["debug"]["unknown"] . " (" . $systemName . ")", $lang["debug"]["images"]); } else { - return getMiniName($member["display_name"] ?? $member["name"]) . "'s images"; + return str_replace("%1", getMiniName($member["display_name"] ?? $member["name"]), $lang["debug"]["images"]); } } @@ -51,32 +53,32 @@ function itemToName(string $item): string { <?php $data = json_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/refresh.json"), true); ?> <div id="page-content"> - <h2>Data updater debugging</h2> - <p>This page provides debugging information to troubleshoot unexpectedly long update times or reported failures.</p> + <h2><?= $pages["debug"]["name"][$lang["_name"]] ?></h2> + <p><?= $lang["debug"]["description"] ?></p> <?php if (time() - $data["timestamp"] > 360): ?> <div class="alert alert-warning"> <p> - <b>The data is not updated periodically anymore.</b> + <b><?= $lang["debug"]["warning"]["title"] ?></b> </p> - This can be due to multiple things: + <?= $lang["debug"]["warning"]["intro"] ?> <ul> - <li>the data updater has been disabled temporarily for maintenance;</li> - <li>the data updater cannot start on the server;</li> - <li>the server was down for an extended period of time</li> + <li><?= $lang["debug"]["warning"]["list"][0] ?></li> + <li><?= $lang["debug"]["warning"]["list"][1] ?></li> + <li><?= $lang["debug"]["warning"]["list"][2] ?></li> </ul> - If you are an administrator and think this is not normal, you may investigate the issue. + <?= $lang["debug"]["warning"]["admin"] ?> </div> <?php endif; ?> - <h4>General information</h4> + <h4><?= $lang["debug"]["general_title"] ?></h4> <ul> - <li><b>Update date:</b> <?php $dt = DateTime::createFromFormat('U.u', $data["timestamp"]); echo($dt->format("l j F Y, G:i:s.u T")); ?></li> - <li><b>Total duration:</b> <?= round($data["duration"] * 1000) ?> ms</li> - <li><b>Longest operation:</b> <?= itemToName(array_search(max(array_values($data["times"])), $data["times"])) ?? "-" ?> (<?= round(max(array_values($data["times"])) * 1000) ?> ms, <?= round((max(array_values($data["times"])) / $data["duration"]) * 100, 2) ?>%)</li> + <li><b><?= $lang["debug"]["time"] ?></b> <?php $dt = DateTime::createFromFormat('U.u', $data["timestamp"]); echo($dt->format("l j F Y, G:i:s.u T")); ?></li> + <li><b><?= $lang["debug"]["duration"] ?></b> <?= round($data["duration"] * 1000) ?> ms</li> + <li><b><?= $lang["debug"]["long"] ?></b> <?= itemToName(array_search(max(array_values($data["times"])), $data["times"])) ?? "-" ?> (<?= round(max(array_values($data["times"])) * 1000) ?> ms, <?= round((max(array_values($data["times"])) / $data["duration"]) * 100, 2) ?>%)</li> </ul> - <h4 id="times">Processing times</h4> + <h4 id="times"><?= $lang["debug"]["times"] ?></h4> <div> <?php foreach ($data["times"] as $item => $time): ?><span class="element tooltip-nohelp" title="<b><?= itemToName($item) ?></b><br>(<?= round($time * 1000) ?> ms)" data-bs-toggle="tooltip" data-bs-html="true" style="opacity:.75;display:inline-block;background:#<?= substr(md5($item), 0, 6) ?>;height:8px;margin:4px 0;width:<?= ($time / $data["duration"]) * 100 ?>%"></span><?php endforeach; ?> </div> @@ -86,11 +88,11 @@ function itemToName(string $item): string { <?php endforeach; ?> </ul> - <h4 id="failures">Reported failures</h4> + <h4 id="failures"><?= $lang["debug"]["failures"] ?></h4> <?php if (count($data["restored"]) < 1): ?> - <p><i>The data updater has not reported any update failure in the last run.</i></p> + <p><i><?= $lang["debug"]["no_failure"] ?></i></p> <?php else: ?> - <p>The following files have failed to update:</p> + <p><?= $lang["debug"]["failure"] ?></p> <ul> <?php foreach ($data["restored"] as $item): ?> <li><code><?= $item ?></code></li> diff --git a/pages/demo.inc b/pages/demo.inc index d469908..47e0775 100644 --- a/pages/demo.inc +++ b/pages/demo.inc @@ -1,129 +1,4 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; -$demoHeader = true; $emergencyHeader = true; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; - -?> - -<script src="/app/banner.js"></script> -<br> -<div class="container"> - <div> - <div id="header" style="text-align: center;"> - <img alt="" src="/assets/uploads/raindrops.png" style="width:128px;"> - <h3>Raindrops System</h3> - <p>Système plural de <?= count(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true)) - 2 ?> poneys</p> - <hr> - </div> - - <div id="list"> - <div class="list-group"> - <?php foreach (scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true), "gdapd") as $member): ?> - <a onclick="showMember('<?= $member["id"] ?>');" class="list-group-item"> - <img src="<?= getAsset($member['system'], $member["id"], "heads") ?>" style="width:32px;vertical-align: middle;"> - <span style="vertical-align: middle;margin-left: 5px;"> - <b><?= $member["display_name"] ?? $member["name"] ?></b> - </span> - </a> - <?php endforeach; ?> - </div> - </div> - </div> -</div> - -<div class="modal fade" id="member"> - <div class="modal-dialog modal-xl"> - <div class="modal-content"> - <div class="modal-header"> - <h4 class="modal-title"> - <img id="modal-img" src="/assets/uploads/pt.png" style="width:32px;vertical-align: middle;"> - <span style="vertical-align: middle;"><span id="modal-member">Member</span> · Raindrops System</span> - </h4> - <button type="button" class="btn-close" data-bs-dismiss="modal"></button> - </div> - - <div class="modal-body"> - <?php foreach (scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true), "gdapd") as $member): ?> - <div class="modal-member-content" id="modal-member-content-<?= $member["id"] ?>"> - <script> - <?php global $memberData; $memberData = $member; ?> - window.currentMemberData = JSON.parse(atob(`<?= base64_encode(json_encode(getMemberBannerData($member["id"], "gdapd", true))) ?>`)); - </script> - <div id="member-banner"></div> - <script> - refreshBanner(false, true); - document.getElementById("member-banner").id = ""; - </script> - </div> - <?php endforeach; ?> - </div> - </div> - </div> -</div> - -<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; - } - - a { - cursor: pointer; - } - - .modal-header { - border-bottom: 1px solid #353738; - } - - .modal-content { - border: 1px solid rgba(255, 255, 255, .2); - background-color: #111; - } - - .btn-close { - filter: invert(1); - } -</style> - -<script> - window._phpMembers = JSON.parse(atob(`<?= base64_encode(json_encode(array_values(scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true), "gdapd")))) ?>`)); - window.members = {}; - - for (let member of window._phpMembers) { - window.members[member.id] = member; - } - - function showMember(id) { - let member = members[id]; - document.getElementById("modal-member").innerText = member["display_name"]; - document.getElementById("modal-img").src = "/assets/uploads/pt-" + member["name"] + ".png"; - - Array.from(document.getElementsByClassName("modal-member-content")).forEach((i) => { - i.style.display = "none"; - }); - document.getElementById("modal-member-content-" + id).style.display = ""; - - let modal = new bootstrap.Modal(document.getElementById('member')); - modal.show(); - } -</script> - -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> +header("Location: /"); +die();
\ No newline at end of file diff --git a/pages/disclaimers.inc b/pages/disclaimers.inc index ae3d04e..7f15bcc 100644 --- a/pages/disclaimers.inc +++ b/pages/disclaimers.inc @@ -1,6 +1,6 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; ?> @@ -8,7 +8,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; <br> <div class="container"> <div id="page-content"> - <?= file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/content/disclaimers.html") ?> + <?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/content/disclaimers.$lang[_name].html") ? file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/content/disclaimers.$lang[_name].html") : file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/content/disclaimers.html") ?> </div> </div> diff --git a/pages/docs.inc b/pages/docs.inc index ff97ed3..f4ffcc3 100644 --- a/pages/docs.inc +++ b/pages/docs.inc @@ -1,6 +1,6 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $_PROFILE; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; global $_PROFILE; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/random.inc"; $parts = explode("/", $_GET['_']); diff --git a/pages/edit-private.inc b/pages/edit-private.inc index 880effe..9564f7a 100644 --- a/pages/edit-private.inc +++ b/pages/edit-private.inc @@ -13,7 +13,7 @@ function getSubsystemByID(string $id) { return $subsystem; } -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; if (!isset($_GET['_']) || trim($_GET['_']) === "") header("Location: /?error=Invalid request") and die(); diff --git a/pages/edit.inc b/pages/edit.inc index 4333044..021ae4b 100644 --- a/pages/edit.inc +++ b/pages/edit.inc @@ -13,7 +13,7 @@ function getSubsystemByID(string $id) { return $subsystem; } -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; if (!isset($_GET['_']) || trim($_GET['_']) === "") header("Location: /?error=Invalid request") and die(); diff --git a/pages/emergency.inc b/pages/emergency.inc index c13a62e..0d34251 100644 --- a/pages/emergency.inc +++ b/pages/emergency.inc @@ -1,6 +1,6 @@ <?php -$emergencyHeader = true; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +$emergencyHeader = true; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; ?> diff --git a/pages/fronting.inc b/pages/fronting.inc index c1d8ead..a2b5cb0 100644 --- a/pages/fronting.inc +++ b/pages/fronting.inc @@ -1,6 +1,6 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; ?> diff --git a/pages/government.inc b/pages/government.inc index 4698c55..08fb63c 100644 --- a/pages/government.inc +++ b/pages/government.inc @@ -1,6 +1,6 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; ?> @@ -8,7 +8,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; <br> <div class="container"> <div> - <h2>Cold Haze Government</h2> + <h2><?= $pages["government"]["name"][$lang["_name"]] ?></h2> <?php $members = scoreOrderGlobal(); @@ -21,8 +21,8 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; ?> - <div title="<b>System Council</b><br>-" data-bs-toggle="tooltip" data-bs-html="true" style="text-align: center;border-radius:10px;background:#222; padding: 10px; margin-top: 15px;"> - <b>Systems Council</b> + <div title="<b><?= $lang["government"]["council"][0] ?></b><br><?= $lang["government"]["council"][1] ?>" data-bs-toggle="tooltip" data-bs-html="true" style="text-align: center;border-radius:10px;background:#222; padding: 10px; margin-top: 15px;"> + <b><?= $lang["government"]["council"][0] ?></b> <div style="margin-top: 10px; display: flex; justify-content: center;"> <a class="gov-link" href="/<?= $ghrby["name"] ?>" style="color: white !important; text-decoration: none;"><div style="margin-right: 10px;"> <img style="width:48px; height: 48px; border-radius: 999px; background-color: #333;" src="<?= getAsset("ynmuc", "ghrby") ?>"><br> @@ -41,8 +41,8 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; <b style="vertical-align: middle;">Cloudburst System</b> </p> <div style="display: grid; grid-template-columns: 1.5fr 1fr; grid-column-gap: 15px;"> - <div title="<b>Head of System Operations</b><br>-" data-bs-toggle="tooltip" data-bs-html="true" style="text-align: center;border-radius:10px;background:#023100; padding: 10px;"> - <b><span class="list-separator-mobile">H. S. O.</span><span class="list-separator-desktop">Head of System Operations</span></b> + <div title="<b><?= $lang["government"]["head"][1] ?></b><br><?= $lang["government"]["head"][2] ?>" data-bs-toggle="tooltip" data-bs-html="true" style="text-align: center;border-radius:10px;background:#023100; padding: 10px;"> + <b><span class="list-separator-mobile"><?= $lang["government"]["head"][0] ?></span><span class="list-separator-desktop"><?= $lang["government"]["head"][1] ?></span></b> <div style="margin-top: 10px; display: flex; justify-content: center;"> <a class="gov-link" href="/<?= $ghrby["name"] ?>" style="color: white !important; text-decoration: none;"><div> <img style="width:48px; height: 48px; border-radius: 999px; background-color: #333;" src="<?= getAsset("ynmuc", "ghrby") ?>"> @@ -50,8 +50,8 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; </div></a> </div> </div> - <div title="<b>Primary Protector</b><br>-" data-bs-toggle="tooltip" data-bs-html="true" style="text-align: center;border-radius:10px;background:#002d31; padding: 10px;"> - <b><span class="list-separator-mobile">P. P.</span><span class="list-separator-desktop">Primary Protector</span></b> + <div title="<b><?= $lang["government"]["protector1"][1] ?></b><br><?= $lang["government"]["protector1"][2] ?>" data-bs-toggle="tooltip" data-bs-html="true" style="text-align: center;border-radius:10px;background:#002d31; padding: 10px;"> + <b><span class="list-separator-mobile"><?= $lang["government"]["protector1"][0] ?></span><span class="list-separator-desktop"><?= $lang["government"]["protector1"][1] ?></span></b> <div style="margin-top: 10px; display: flex; justify-content: center;"> <a class="gov-link" href="/<?= $zzise["name"] ?>" style="color: white !important; text-decoration: none;"><div> <img style="width:48px; height: 48px; border-radius: 999px; background-color: #333;" src="<?= getAsset("ynmuc", "zzise") ?>"> @@ -68,8 +68,8 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; <b style="vertical-align: middle;">Raindrops System</b> </p> <div style="display: grid; grid-template-columns: 1.5fr 1fr; grid-column-gap: 15px;"> - <div title="<b>Head of System Operations</b><br>-" data-bs-toggle="tooltip" data-bs-html="true" style="text-align: center;border-radius:10px;background:#023100; padding: 10px;"> - <b><span class="list-separator-mobile">H. S. O.</span><span class="list-separator-desktop">Head of System Operations</span></b> + <div title="<b><?= $lang["government"]["head"][1] ?></b><br><?= $lang["government"]["head"][2] ?>" data-bs-toggle="tooltip" data-bs-html="true" style="text-align: center;border-radius:10px;background:#023100; padding: 10px;"> + <b><span class="list-separator-mobile"><?= $lang["government"]["head"][0] ?></span><span class="list-separator-desktop"><?= $lang["government"]["head"][1] ?></span></b> <div style="margin-top: 10px; display: flex; justify-content: center;"> <a class="gov-link" href="/<?= $auvwc["name"] ?>" style="color: white !important; text-decoration: none;"><div> <img style="width:48px; height: 48px; border-radius: 999px; background-color: #333;" src="<?= getAsset("gdapd", "auvwc") ?>"> @@ -77,8 +77,8 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; </div></a> </div> </div> - <div title="<b>Primary Protector</b><br>-" data-bs-toggle="tooltip" data-bs-html="true" style="text-align: center;border-radius:10px;background:#002d31; padding: 10px;"> - <b><span class="list-separator-mobile">P. P.</span><span class="list-separator-desktop">Primary Protector</span></b> + <div title="<b><?= $lang["government"]["protector1"][1] ?></b><br><?= $lang["government"]["protector1"][2] ?>" data-bs-toggle="tooltip" data-bs-html="true" style="text-align: center;border-radius:10px;background:#002d31; padding: 10px;"> + <b><span class="list-separator-mobile"><?= $lang["government"]["protector1"][0] ?></span><span class="list-separator-desktop"><?= $lang["government"]["protector1"][1] ?></span></b> <div style="margin-top: 10px; display: flex; justify-content: center;"> <a class="gov-link" href="/<?= $qbzxm["name"] ?>" style="color: white !important; text-decoration: none;"><div> <img style="width:48px; height: 48px; border-radius: 999px; background-color: #333;" src="<?= getAsset("gdapd", "qbzxm") ?>"> @@ -90,9 +90,9 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; </div> </div> <div style="display: grid; grid-template-columns: 1fr 1px 1fr; grid-column-gap: 15px;"> - <div title="<b>Protectors</b><br>-" data-bs-toggle="tooltip" data-bs-html="true" style="margin-top: 15px;"> + <div title="<b><?= $lang["government"]["protectors"][0] ?></b><br><?= $lang["government"]["protectors"][1] ?>" data-bs-toggle="tooltip" data-bs-html="true" style="margin-top: 15px;"> <div style="text-align: center;border-radius:10px;background:#311a00; padding: 10px;"> - <b>Protectors</b> + <b><?= $lang["government"]["protectors"][0] ?></b> <div style="margin-top: 10px; display: flex; justify-content: center;"> <a class="gov-link" href="/<?= $zzise["name"] ?>" style="color: white !important; text-decoration: none;"><div style="margin-right: 20px;"> <img style="width:48px; height: 48px; border-radius: 999px; background-color: #333;" src="<?= getAsset("ynmuc", "zzise") ?>"> @@ -106,9 +106,9 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; </div> </div> <div style="background:rgba(255, 255, 255, .2);"></div> - <div title="<b>Protectors</b><br>-" data-bs-toggle="tooltip" data-bs-html="true" style="margin-top: 15px;"> + <div title="<b><?= $lang["government"]["protectors"][0] ?></b><br><?= $lang["government"]["protectors"][1] ?>" data-bs-toggle="tooltip" data-bs-html="true" style="margin-top: 15px;"> <div style="text-align: center;border-radius:10px;background:#311a00; padding: 10px;"> - <b>Protectors</b> + <b><?= $lang["government"]["protectors"][0] ?></b> <div style="margin-top: 10px; display: flex; justify-content: center;"> <a class="gov-link" href="/<?= $qbzxm["name"] ?>" style="color: white !important; text-decoration: none;"><div style="margin-right: 20px;"> <img style="width:48px; height: 48px; border-radius: 999px; background-color: #333;" src="<?= getAsset("gdapd", "qbzxm") ?>"> diff --git a/pages/home.inc b/pages/home.inc index 54426a9..7d26e68 100644 --- a/pages/home.inc +++ b/pages/home.inc @@ -1,11 +1,11 @@ -<?php if (isset($_GET['error'])) header("HTTP/1.1 404 Not Found"); require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; global $readOnly; global $isNormallyLoggedIn; global $_PROFILE; ?> +<?php if (isset($_GET['error'])) header("HTTP/1.1 404 Not Found"); require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; global $readOnly; global $isNormallyLoggedIn; global $_PROFILE; global $lang; global $pages; ?> <br> <div class="container"> <?php if (isset($_GET['error'])): ?> <div class="alert alert-danger alert-dismissible"> <button onclick='window.history.pushState({"html":null,"pageTitle":document.title},"", "/");' type="button" class="btn-close" data-bs-dismiss="alert"></button> - <b>Error: </b><?= strip_tags($_GET['error']) ?> + <b><?= $lang["home"]["error"] ?> </b><?= strip_tags($_GET['error']) ?> </div> <?php endif; ?> @@ -15,56 +15,39 @@ </div> <?php endif; ?> - <?php global $travelling; if (!isset($_GET['legacy'])): $byColor = getMembersByColor(); ?> - <div style="text-align: center;"> - <img alt="" src="/assets/logo/newlogo.png" style="width:128px;"> - <p style="z-index:999;position:relative;background:black;margin: 20px -10px 0 -20px;padding-right:30px;height:32px;text-align: center;display:grid;grid-template-columns: repeat(<?= count($byColor) ?>, 1fr);"> - <?php foreach ($byColor as $member): ?><a data-bs-html="true" class="rainbow-item tooltip-nohelp" title="<b><?= $member["display_name"] ?? $member["name"] ?></b><br><?= ($travelling[$member['id']]["travelling"] ? $member["_system"] === "ynmuc" : $member["_system"] === "gdapd") ? "Raindrops System" : "Cloudburst System" ?>" data-bs-toggle="tooltip" style="overflow: hidden;" href="/<?= $member["name"] ?>"><img src="<?= getAsset($member["_system"], $member["id"], "heads") ?>" style="height:32px;position:absolute;z-index:99;"></a><?php endforeach; ?> - </p> - <div style="margin-top:-33px;margin-bottom:0;margin-left:-20px;margin-right:20px;height:32px;text-align: center;display:grid;grid-template-columns: repeat(<?= count($byColor) ?>, 1fr);"> - <?php foreach ($byColor as $member): ?><div> - <span style="display: inline-block;background: transparent;position:absolute;width: 20px;height: 15px;margin-top: 17px;box-shadow: 0 6px 20px 7px #<?= $member["color"] ?>;z-index: 9;margin-left: 8px;opacity: .75;"></span> - </div><?php endforeach; ?> - </div> - <div style="padding:5px 10px;background:#222;border-bottom-left-radius: 10px;border-bottom-right-radius: 10px;"> - <h2 style="margin-top: 20px;">Cold Haze</h2> - <p><?= count($byColor) ?> ponies in 2 plural systems</p> - </div> + <?php global $travelling; $byColor = getMembersByColor($_SERVER['HTTP_HOST'] === "fr.equestria.horse"); ?> + <div style="text-align: center;"> + <img alt="" src="/assets/logo/newlogo<?php if ($_SERVER['HTTP_HOST'] === "fr.equestria.horse"): ?>2<?php endif; ?>.png" style="width:128px;"> + <p style="z-index:999;position:relative;background:black;margin: 20px -10px 0 -20px;padding-right:30px;height:32px;text-align: center;display:grid;grid-template-columns: repeat(<?= count($byColor) ?>, 1fr);"> + <?php foreach ($byColor as $member): ?><a data-bs-html="true" class="rainbow-item tooltip-nohelp" title="<b><?= $member["display_name"] ?? $member["name"] ?></b><br><?= ($travelling[$member['id']]["travelling"] ? $member["_system"] === "ynmuc" : $member["_system"] === "gdapd") ? "Raindrops System" : "Cloudburst System" ?>" data-bs-toggle="tooltip" style="overflow: hidden;" href="/<?= $member["name"] ?>"><img src="<?= getAsset($member["_system"], $member["id"], "heads") ?>" style="height:32px;position:absolute;z-index:99;"></a><?php endforeach; ?> + </p> + <div style="margin-top:-33px;margin-bottom:0;margin-left:-20px;margin-right:20px;height:32px;text-align: center;display:grid;grid-template-columns: repeat(<?= count($byColor) ?>, 1fr);"> + <?php foreach ($byColor as $member): ?><div> + <span style="display: inline-block;background: transparent;position:absolute;width: 20px;height: 15px;margin-top: 17px;box-shadow: 0 6px 20px 7px #<?= $member["color"] ?>;z-index: 9;margin-left: 8px;opacity: .75;"></span> + </div><?php endforeach; ?> </div> - <hr style="border-color:rgba(255, 255, 255, .25);"> - <?php else: ?> - <div style="background:rgba(255, 255, 255, .1);max-width:100%;width:max-content;display:grid;grid-template-columns:128px 1fr;border-radius:10px;margin-left:auto;margin-right:auto;color:white;"> - - <!-- Logo --> - <img src="/assets/uploads/logo.jpg" alt="" style="width:128px;border-top-left-radius:10px;border-bottom-left-radius:10px;"> - - <!-- Banner text --> - <div style="padding:20px;display:flex;align-items:center;justify-content:center;"> - <div> - - <!-- Main title --> - <span style="font-weight:bold;font-size:24px;">Cold Haze</span><br> - - <!-- Tagline --> - <span style="font-weight:normal;font-size:16px;">Just a small safe place for two plural systems</span> - - </div> - </div> - + <div style="padding:5px 10px;background:#222;border-bottom-left-radius: 10px;border-bottom-right-radius: 10px;"> + <h2 style="margin-top: 20px;">Cold Haze</h2> + <?php if ($_SERVER['HTTP_HOST'] === "fr.equestria.horse"): ?> + <p><?= count($byColor) ?> poneys dans une tête</p> + <?php else: ?> + <p><?= count($byColor) ?> <?= $lang["home"]["intro"] ?></p> + <?php endif; ?> </div> - <?php endif; ?> + </div> + <hr style="border-color:rgba(255, 255, 255, .25);"> <?php global $isLoggedIn; if ($isLoggedIn && ((int)date('H') >= 20 || (int)date('H') < 6)): ?> <a href="/-/emergency" style="text-decoration: none;margin-top:15px;display:block;"> <div class="alert alert-danger"> - <b>Are you in need of help?</b> If you need immediate help from a loved one, you may want to enable the emergency alert by clicking here, even if that will wake up the <?= $_PROFILE['name'] === "Raindrops System" ? "Cloudburst System" : "Raindrops System" ?>. Use it as you need. + <b>Are you in need of help?</b> If you need immediate help from a loved one, you may want to enable the emergency alert by clicking here, even if that wakes up the <?= $_PROFILE['name'] === "Raindrops System" ? "Cloudburst System" : "Raindrops System" ?>. Use it as you need. </div> </a> <?php endif; ?> <div id="homepage-desktop" style="margin-top:10px;"> - <?php cloudburst(false); ?> + <?php if ($_SERVER['HTTP_HOST'] !== "fr.equestria.horse") cloudburst(false); ?> <?php raindrops(false); ?> </div> diff --git a/pages/login.inc b/pages/login.inc index ffbe2d7..cfe363c 100644 --- a/pages/login.inc +++ b/pages/login.inc @@ -1,6 +1,6 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; global $readOnly; global $isNormallyLoggedIn; ?> @@ -8,41 +8,32 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; global $readOnl <br> <div class="container"> <div> - <h2>Login</h2> + <h2><?= $pages["login"]["name"][$lang["_name"]] ?></h2> <?php if ($readOnly): ?> <div class="alert alert-warning"> - <b>Login is temporarily disabled. </b>Login on this website has been temporarily disabled by the administrators for maintenance purposes. + <b><?= $lang["login"]["maintenance"][0] ?> </b><?= $lang["login"]["maintenance"][1] ?> </div> <?php else: ?> <?php global $isLoggedIn; if ($isLoggedIn): ?> <div class="alert alert-warning"> <b>You are already logged in.</b> If you want to login to a different account or using a different authentication method, you may do so now. </div> - <?php endif; ?> - <p>Select how you want to log into Cold Haze.</p> + <?php else: ?> + <p><?= $lang["login"]["select"] ?> Cold Haze.</p> <div class="row"> <div class="col-md-6"> <div class="card" style="margin-bottom:10px;text-align: center;"> <div class="card-body"> - <img src="https://git.equestria.dev/equestria.dev/design/raw/branch/mane/logo/dark/banner.svg" style="height:48px;" alt=""> - <h4 class="card-title" style="margin-top:15px;">Equestria.dev Private Authentication</h4> - <p>For website administrators, allows to change content and access private information.</p> - <a href="/Authentication/Start" class="btn btn-primary">Continue</a> - </div> - </div> - </div> - <div class="col-md-6"> - <div class="card" style="margin-bottom:10px;text-align: center;"> - <div class="card-body"> - <img src="https://equestria.horse/assets/favicon.png" style="height:48px;" alt=""><img src="/assets/logo/gitlab.svg" style="height:48px;margin-left:15px;" alt=""><img src="/assets/logo/github.svg" style="height:48px;margin-left:15px;" alt=""> - <h4 class="card-title" style="margin-top:15px;">Equestria.horse/GitLab/GitHub</h4> - <p>For website users, allows to view more content, ask questions, and set notes for members.</p> - <a href="#" class="btn btn-primary disabled">Continue</a> + <!--<img src="https://git.equestria.dev/equestria.dev/design/raw/branch/mane/logo/dark/banner.svg" style="height:48px;" alt="">--> + <h4 class="card-title" style="margin-top:15px;"><?= $lang["login"]["private"][0] ?></h4> + <p><?= $lang["login"]["private"][1] ?></p> + <a href="/Authentication/Start" class="btn btn-primary"><?= $lang["login"]["private"][2] ?></a> </div> </div> </div> + <div class="col-md-6"></div> </div> - <?php endif; ?> + <?php endif; endif; ?> </div> </div> diff --git a/pages/metadata.inc b/pages/metadata.inc new file mode 100644 index 0000000..ecb8aba --- /dev/null +++ b/pages/metadata.inc @@ -0,0 +1,123 @@ +<?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.inc"; global $title; global $isLoggedIn; global $lang; global $pages; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.inc"; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/bitset.inc"; + +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 = !isset($parts[1]) || $parts[1] === "" ? 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/subsystems/$systemID.json"), true) ?? []; + +if ($member === null) { + require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/sysedit.inc'; +} 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) { + header("Location: /?error=Not found") and die(); + } + + if (isset($_GET["submit"])) { + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $memberID . ".json")) { + $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $memberID . ".json"), true)); + } else { + die(); + } + + $toUpdate = []; + + header("Content-Type: text/plain"); + + if (isset($_GET["bitset"]) && is_numeric($_GET["bitset"])) { + $toUpdate["bitset"] = (int)$_GET["bitset"]; + } + + if (isset($_GET["marefriends"])) { + $toUpdate["marefriends"] = array_values(array_filter(array_map(function ($i) { return trim($i); }, explode(",", $_GET["marefriends"])), function ($i) { + return !!preg_match("/^(ynmuc|gdapd)\/[a-z]{5}$/m", $i); + })); + } + + if (isset($_GET["sisters"])) { + $toUpdate["sisters"] = array_values(array_filter(array_map(function ($i) { return trim($i); }, explode(",", $_GET["sisters"])), function ($i) { + return !!preg_match("/^(ynmuc|gdapd)\/[a-z]{5}$/m", $i); + })); + } + + if (isset($_GET["caretakers"])) { + $toUpdate["caretakers"] = array_values(array_filter(array_map(function ($i) { return trim($i); }, explode(",", $_GET["caretakers"])), function ($i) { + return !!preg_match("/^(ynmuc|gdapd)\/[a-z]{5}$/m", $i); + })); + } + + if (isset($_GET['regressed'])) { + if (!!preg_match("/^[a-z]{5}$/m", $_GET['regressed'])) { + $toUpdate["regression"] = $_GET['regressed']; + } else { + $toUpdate["regression"] = null; + } + } + + $toUpdate["birth"] = [ + "date" => "01-01", + "year" => null, + "age" => 0 + ]; + + if (isset($_GET["age"]) && is_numeric($_GET["age"])) { + $toUpdate["birth"]["age"] = (int)$_GET["age"]; + } + + if (isset($_GET["birth"]) && trim($_GET['birth']) !== "" && !!preg_match("/^\d{4}-\d{2}-\d{2}$/m", $_GET['birth'])) { + $toUpdate["birth"]["year"] = (int)substr($_GET["birth"],0, 4); + $toUpdate["birth"]["date"] = substr($_GET["birth"],5); + } + + foreach ($toUpdate as $item => $value) { + $metadata[$item] = $value; + } + + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $memberID . ".json", json_encode($metadata)); + + header("Location: /" . $_GET['_']); + } else { + require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/metadata.inc'; + } +} + +exit;
\ No newline at end of file diff --git a/pages/nicknames.inc b/pages/nicknames.inc index 434477f..2799703 100644 --- a/pages/nicknames.inc +++ b/pages/nicknames.inc @@ -1,6 +1,6 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; $members = scoreOrderGlobal(); diff --git a/pages/page.inc b/pages/page.inc index 22291e2..d13dd2f 100644 --- a/pages/page.inc +++ b/pages/page.inc @@ -1,5 +1,7 @@ <?php +global $lang; global $pages; + $travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling/travelling.json"), true); if (!isset($_GET['_']) || trim($_GET['_']) === "") header("Location: /?error=Invalid request") and die(); @@ -29,7 +31,7 @@ if (($parts[0] !== "cloudburst" && $parts[0] !== "raindrops") && (!(count($parts $system = $parts[0]; $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(); +if ($system !== "cloudburst" && $system !== "raindrops") header("Location: /?error=" . $lang["page"]["system"]) and die(); $systemCommonName = $system === "cloudburst" ? "Cloudburst System" : "Raindrops System"; $systemID = $system === "cloudburst" ? "ynmuc" : "gdapd"; @@ -43,7 +45,7 @@ if ($member === null) { $_SystemPage = $parts[2]; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/system/' . $parts[2] . '.inc'; } else { - header("Location: /?error=Page not found: " . $parts[2]) and die(); + header("Location: /?error=" . $lang["page"]["system"] . " " . $parts[2]) and die(); } } else { $memberFoundInAnotherSystem = false; @@ -89,7 +91,7 @@ if ($member === null) { $_MemberPage = $parts[3]; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/member/' . $parts[3] . '.inc'; } else { - header("Location: /?error=Page not found: " . $parts[3]) and die(); + header("Location: /?error=" . $lang["page"]["system"] . " " . $parts[3]) and die(); } die(); } diff --git a/pages/parser.inc b/pages/parser.inc index 283006b..47e0775 100644 --- a/pages/parser.inc +++ b/pages/parser.inc @@ -1,259 +1,4 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; - -?> - -<br> -<div class="container"> - <div id="page-content"> - <h2>Message parser</h2> - <p>Enter a message here, and we will tell you which system member this message came from.</p> - - <div class="alert alert-warning"> - <b>Notice:</b> The prefix generator and message parser pages will be removed from Cold Haze starting November 1<sup>st</sup>, due to being unused, difficult to maintain and containing outdated information. Feel free to ask a system member if you need help figuring out who sent a specific message. - </div> - - <div style="display:grid;grid-template-columns:1fr 2fr;grid-gap:10px;"> - <select id="system" title="Existing prefixes from..." class="tooltip-nohelp form-select" style='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");' onchange="update();"> - <option value="all">(all systems)</option> - <option value="cloudburst">Cloudburst System</option> - <option value="raindrops">Raindrops System</option> - </select> - <span contenteditable="true" title="Message" class="tooltip-nohelp form-control" id="message" style="word-break: break-all;color:white;background:#111;border-color:#222;" onchange="update();" onkeydown="update();" onkeyup="update();"><span></span></span> - <script> - const input = document.getElementById('message'); - - input.addEventListener('keypress', (e) => { - if (e.code === "Enter") e.preventDefault(); - }); - </script> - </div> - - <br> - - <div id="result-cloudburst-outer" style="width: max-content;padding: 10px;background: #151515;border-radius: 30px;text-align: center;"> - <span style="display:block;margin-bottom:7px;font-weight: bold;">Cloudburst System</span> - <div id="result-cloudburst" style="background: #222;width: max-content;border-radius: 999px;display: grid;padding: 10px 20px 10px 10px;grid-template-columns: 36px 1fr;grid-gap: 10px;"> - <div style="align-items: center;justify-content: center;display: flex;"> - <img src="" alt="" style="width: 36px;height: 36px;vertical-align: middle;border-radius: 999px;background: #333;" id="result-cloudburst-avatar"> - </div> - <div style="display: flex;align-items: center;justify-content: center;"> - <div> - <span style="font-weight: bold;" id="result-cloudburst-name">Name</span> - <span style="padding-left: 2px;">(<code id="result-cloudburst-prefix">Prefix</code>)</span> - </div> - </div> - </div> - </div> - - <div id="result-raindrops-outer" style="margin-top:10px;width: max-content;padding: 10px;background: #151515;border-radius: 30px;text-align: center;"> - <span style="display:block;margin-bottom:7px;font-weight: bold;">Raindrops System</span> - <div id="result-raindrops" style="background: #222;width: max-content;border-radius: 999px;display: grid;padding: 10px 20px 10px 10px;grid-template-columns: 36px 1fr;grid-gap: 10px;"> - <div style="align-items: center;justify-content: center;display: flex;"> - <img src="" alt="" style="width: 36px;height: 36px;vertical-align: middle;border-radius: 999px;background: #333;" id="result-raindrops-avatar"> - </div> - <div style="display: flex;align-items: center;justify-content: center;"> - <div> - <span style="font-weight: bold;" id="result-raindrops-name">Name</span> - <span style="padding-left: 2px;">(<code id="result-raindrops-prefix">Prefix</code>)</span> - </div> - </div> - </div> - </div> - </div> - - <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 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> - function setCursor(pos) { - let el = document.getElementById("message"); - let selection = window.getSelection(); - let range = document.createRange(); - - selection.removeAllRanges(); - range.selectNodeContents(el); - range.collapse(false); - selection.addRange(range); - el.focus(); - } - - let existing = <?php - - $existing1 = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/members.json"), true); - $existing2 = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true); - - echo(json_encode([ - "cloudburst" => $existing1, - "raindrops" => $existing2 - ])); - - ?>; - - let host = { - raindrops: "<?php - - $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/metadata/$member[id].json")) continue; - - $data = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$member[id].json"), true)); - if ($data["host"]) { - echo $member['id']; - } - } - - ?>", - cloudburst: "<?php - - $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/metadata/$member[id].json")) continue; - - $data = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$member[id].json"), true)); - if ($data["host"]) { - echo $member['id']; - } - } - - ?>", - } - - function update() { - let data; - let member; - let system = document.getElementById("system").value; - let text = document.getElementById("message").innerText; - - switch (system) { - case "all": - document.getElementById("result-raindrops-outer").style.display = ""; - document.getElementById("result-cloudburst-outer").style.display = ""; - document.getElementById("result-raindrops-outer").style.marginTop = "10px"; - break; - - case "raindrops": - document.getElementById("result-raindrops-outer").style.display = ""; - document.getElementById("result-cloudburst-outer").style.display = "none"; - document.getElementById("result-raindrops-outer").style.marginTop = "0"; - data = existing['raindrops']; - break; - - case "cloudburst": - document.getElementById("result-raindrops-outer").style.display = "none"; - document.getElementById("result-cloudburst-outer").style.display = ""; - document.getElementById("result-raindrops-outer").style.marginTop = "0"; - data = existing['cloudburst']; - break; - } - - if (system === "all") { - updateParsed(text, "raindrops", existing["raindrops"]) - updateParsed(text, "cloudburst", existing["cloudburst"]) - } else { - updateParsed(text, system, existing[system]) - } - } - - function updateParsed(text, system, data) { - let textHTML = "<span>" + text + "</span>"; - let member; - let prefix = null; - let suffix = null; - let matched = false; - - for (member of data) { - for (let proxy of member['proxy_tags']) { - if (proxy.prefix !== null && text.startsWith(proxy.prefix)) { - if (proxy.suffix !== null) { - if (text.endsWith(proxy.suffix)) { - matched = true; - prefix = proxy.prefix; - suffix = proxy.suffix; - text = text.substring(proxy.prefix.length, text.length - proxy.suffix.length); - break; - } - } else { - matched = true; - prefix = proxy.prefix; - suffix = null; - text = text.substring(proxy.prefix.length, text.length); - break; - } - } else if (proxy.suffix !== null && text.endsWith(proxy.suffix)) { - if (proxy.prefix !== null) { - if (text.startsWith(proxy.prefix)) { - matched = true; - prefix = proxy.prefix; - suffix = proxy.suffix; - text = text.substring(proxy.prefix.length, text.length - proxy.suffix.length); - break; - } - } else { - matched = true; - prefix = null; - suffix = proxy.suffix; - text = text.substring(0, text.length - proxy.suffix.length); - break; - } - } - } - - if (matched) break; - } - - if (!matched) { - document.getElementById("host-alert").style.display = "block"; - member = data.filter((i) => i['id'] === host[system])[0]; - } else { - document.getElementById("host-alert").style.display = "none"; - } - - document.getElementById("result-" + system + "-avatar").src = member['avatar_url']; - 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>"; - } else { - textHTML = "<span><span class='prefix'>" + prefix + "</span>" + text + "</span>"; - } - } else if (suffix !== null) { - textHTML = "<span>" + text + "<span class='suffix'>" + suffix + "</span></span>"; - } - - document.getElementById("message").innerHTML = textHTML; - try { setCursor(document.getElementById("message").innerHTML.length); } catch (e) { - console.error(e); - } - } - - update(); - </script> - <style> - .tooltip-inner { - text-align: left !important; - } - - .text-peh-nowrap { - text-overflow: ellipsis; - white-space: nowrap; - overflow: hidden; - } - - .prefix { - color: #88de70; - } - - .suffix { - color: #de7070; - } - </style> -</div> - -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> +header("Location: /"); +die();
\ No newline at end of file diff --git a/pages/pleasure.inc b/pages/pleasure.inc index f59d187..30ccf3d 100644 --- a/pages/pleasure.inc +++ b/pages/pleasure.inc @@ -1,6 +1,6 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; $emergencyHeader = true; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; ?> diff --git a/pages/prefix.inc b/pages/prefix.inc index 0b1f3a3..47e0775 100644 --- a/pages/prefix.inc +++ b/pages/prefix.inc @@ -1,455 +1,4 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; - -?> - -<br> -<div class="container"> - <div id="page-content"> - <h2>Prefix generator</h2> - <p>This prefix generator will take into account the prefixes from the existing members to try to generate new original prefixes for a potential new member.</p> - - <div class="alert alert-warning"> - <b>Notice:</b> The prefix generator and message parser pages will be removed from Cold Haze starting November 1<sup>st</sup>, due to being unused, difficult to maintain and containing outdated information. Feel free to ask a system member if you need help figuring out who sent a specific message. - </div> - - <div style="display:grid;grid-template-columns:1fr 1fr 1fr;grid-gap:10px;"> - <select id="system" title="Existing prefixes from..." class="tooltip-nohelp form-select" style='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");' onchange="update();"> - <optgroup label="General Options"> - <option value="all">All systems</option> - <option value="none">Ignore existing prefixes</option> - </optgroup> - <optgroup label="Individual Systems"> - <option value="cloudburst">Cloudburst System</option> - <option value="raindrops">Raindrops System</option> - </optgroup> - </select> - <input title="First Name" type="text" class="tooltip-nohelp form-control" id="first-name" placeholder="First Name" style="color:white;background:#111;border-color:#222;" onchange="update();" onkeydown="update();" onkeyup="update();"> - <input title="Last Name" type="text" class="tooltip-nohelp form-control" id="last-name" placeholder="Last Name (optional)" style="color:white;background:#111;border-color:#222;" onchange="update();" onkeydown="update();" onkeyup="update();"> - </div> - - <br> - <div id="already" class="alert alert-primary" style="display:none;"> - There is already a member named <b id="already-name">Name</b> in one of the systems, their primary prefix is currently <code id="already-prefix">???</code> - </div> - <div id="results-singular" style="display:none;"> - <h4>Generated Prefix</h4> - <p>Below is a generated prefix for a member who goes by the entered name. We managed to generate only a single prefix for this name.</p> - </div> - <div id="results-none"> - <h4>Generated Prefix</h4> - <p>We couldn't generate a prefix for a member who goes by this name, try tuning your settings.</p> - </div> - <div id="results-plural" style="display:none;"> - <h4>Generated Prefixes</h4> - <p>Below is a list of generated prefixes for a member who goes by the entered name. The prefixes are ordered by relevance, the first prefix being the most relevant one. Hover over a prefix to see what makes it revelent or not</p> - </div> - <ol id="generated"> - <li><code>{...}</code></li> - </ol> - <p id="hidden-message" style="display:none;"><span id="hidden-count">0</span> <span id="hidden-plural">entries have been hidden because they are existing prefixes </span><span id="hidden-singular">entry has been hidden because it is an existing prefix </span>in the selected system<span id="hidden-sys-plural">s</span>.</p> - </div> - - <script> - let existing = <?php - - $existing1 = []; - foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/members.json"), true) as $member) { - if ($member["name"] !== "unknown") { - foreach ($member['proxy_tags'] as $tag) { - if (!$tag["prefix"]) { - $existing1[] = "..." . $tag["suffix"]; - } else if (!$tag["suffix"]) { - $existing1[] = $tag["prefix"]; - } else { - $existing1[] = $tag["prefix"] . "..." . $tag["suffix"]; - } - } - } - } - - - $existing2 = []; - foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true) as $member) { - if ($member["name"] !== "unknown") { - foreach ($member['proxy_tags'] as $tag) { - if (!$tag["prefix"]) { - $existing2[] = "..." . $tag["suffix"]; - } else if (!$tag["suffix"]) { - $existing2[] = $tag["prefix"]; - } else { - $existing2[] = $tag["prefix"] . "..." . $tag["suffix"]; - } - } - } - } - - echo(json_encode([ - "cloudburst" => $existing1, - "raindrops" => $existing2 - ])); - - ?>; - - let prefixesUsedBy = <?php - - $existing1 = []; - foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/members.json"), true) as $member) { - if ($member["name"] !== "unknown") { - foreach ($member['proxy_tags'] as $tag) { - if (!$tag["prefix"]) { - $existing1["..." . $tag["suffix"]] = $member["display_name"] ?? $member["name"]; - } else if (!$tag["suffix"]) { - $existing1[$tag["prefix"]] = $member["display_name"] ?? $member["name"]; - } else { - $existing1[$tag["prefix"] . "..." . $tag["suffix"]] = $member["display_name"] ?? $member["name"]; - } - } - } - } - - - $existing2 = []; - foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true) as $member) { - if ($member["name"] !== "unknown") { - foreach ($member['proxy_tags'] as $tag) { - if (!$tag["prefix"]) { - $existing2["..." . $tag["suffix"]] = $member["display_name"] ?? $member["name"]; - } else if (!$tag["suffix"]) { - $existing2[$tag["prefix"]] = $member["display_name"] ?? $member["name"]; - } else { - $existing2[$tag["prefix"] . "..." . $tag["suffix"]] = $member["display_name"] ?? $member["name"]; - } - } - } - } - - echo(json_encode([ - "cloudburst" => $existing1, - "raindrops" => $existing2 - ])); - - ?>; - - let o; - let membersByPrefixCloudburst = {}; - let membersByPrefixRaindrops = {}; - - o = prefixesUsedBy["cloudburst"]; - Object.keys(o).map((i) => { if (!membersByPrefixCloudburst[o[i]]) membersByPrefixCloudburst[o[i]] = []; membersByPrefixCloudburst[o[i]].push(i); }); - - o = prefixesUsedBy["raindrops"]; - Object.keys(o).map((i) => { if (!membersByPrefixRaindrops[o[i]]) membersByPrefixRaindrops[o[i]] = []; membersByPrefixRaindrops[o[i]].push(i); }); - - function update() { - let generated = []; - let toIgnore = []; - - let system = document.getElementById("system").value; - let firstName = document.getElementById("first-name").value.toLowerCase().trim().replace(/[^a-z]/gm, ""); - let lastName = document.getElementById("last-name").value.toLowerCase().trim().replace(/[^a-z]/gm, ""); - - document.getElementById("already").style.display = "none"; - if (Object.keys(membersByPrefixRaindrops).map(i => i.toLowerCase().trim().replace(/[^a-z ]/gm, "")).includes((firstName + " " + lastName).trim())) { - let data = { - name: Object.keys(membersByPrefixRaindrops)[Object.keys(membersByPrefixRaindrops).map(i => i.toLowerCase().trim().replace(/[^a-z ]/gm, "")).indexOf((firstName + " " + lastName).trim())], - prefix: membersByPrefixRaindrops[Object.keys(membersByPrefixRaindrops)[Object.keys(membersByPrefixRaindrops).map(i => i.toLowerCase().trim().replace(/[^a-z ]/gm, "")).indexOf((firstName + " " + lastName).trim())]][0] - }; - console.log(data); - - document.getElementById("already-name").innerText = data.name; - document.getElementById("already-prefix").innerText = data.prefix; - document.getElementById("already").style.display = ""; - } - if (Object.keys(membersByPrefixCloudburst).map(i => i.toLowerCase().trim().replace(/[^a-z ]/gm, "")).includes((firstName + " " + lastName).trim())) { - let data = { - name: Object.keys(membersByPrefixCloudburst)[Object.keys(membersByPrefixCloudburst).map(i => i.toLowerCase().trim().replace(/[^a-z ]/gm, "")).indexOf((firstName + " " + lastName).trim())], - prefix: membersByPrefixCloudburst[Object.keys(membersByPrefixCloudburst)[Object.keys(membersByPrefixCloudburst).map(i => i.toLowerCase().trim().replace(/[^a-z ]/gm, "")).indexOf((firstName + " " + lastName).trim())]][0] - }; - console.log(data); - - document.getElementById("already-name").innerText = data.name; - document.getElementById("already-prefix").innerText = data.prefix; - document.getElementById("already").style.display = ""; - } - - switch (system) { - case "all": - toIgnore = [...existing["cloudburst"], ...existing["raindrops"]]; - document.getElementById("hidden-sys-plural").style.display = ""; - break; - - case "raindrops": - toIgnore = existing["raindrops"]; - document.getElementById("hidden-sys-plural").style.display = "none"; - break; - - case "cloudburst": - toIgnore = existing["cloudburst"]; - document.getElementById("hidden-sys-plural").style.display = "none"; - break; - - case "none": - toIgnore = []; - document.getElementById("hidden-sys-plural").style.display = ""; - break; - } - - if (firstName.length > 0) { - generated.push({ - prefix: firstName.substring(0, 1) + ".", - rules: ["<span class='text-warning'>firstNameFirstLetter</span>"] - }); - } - - if (lastName.length > 0) { - generated.push({ - prefix: lastName.substring(0, 1) + ".", - rules: ["<span class='text-warning'>lastNameFirstLetter</span>"] - }); - } - - if (firstName.length > 1) { - generated.push({ - prefix: firstName.substring(0, 2) + ".", - rules: ["<span class='text-warning'>firstNameFirstTwoLetters</span>"] - }); - } - - if (firstName.length > 0 && lastName.length > 0) { - generated.push({ - prefix: firstName.substring(0, 1) + lastName.substring(0, 1) + ".", - rules: ["<span class='text-warning'>lastNameFirstTwoLetters</span>"] - }); - } - - if (firstName.length > 1) { - for (let i = 2; i < firstName.length + 1; i++) { - if (!( - firstName.substring(i - 1, i) === "a" || - firstName.substring(i - 1, i) === "e" || - firstName.substring(i - 1, i) === "i" || - firstName.substring(i - 1, i) === "o" || - firstName.substring(i - 1, i) === "u" || - firstName.substring(i - 1, i) === "y" - )) { - generated.push({ - prefix: firstName.substring(i - 1, i) + ".", - rules: ["<span class='text-warning'>firstNameLetterConsonant</span>"] - }); - } - } - } - - if (lastName.length > 1) { - for (let i = 2; i < lastName.length + 1; i++) { - if (!( - lastName.substring(i - 1, i) === "a" || - lastName.substring(i - 1, i) === "e" || - lastName.substring(i - 1, i) === "i" || - lastName.substring(i - 1, i) === "o" || - lastName.substring(i - 1, i) === "u" || - lastName.substring(i - 1, i) === "y" - )) { - generated.push({ - prefix: lastName.substring(i - 1, i) + ".", - rules: ["<span class='text-warning'>lastNameLetterConsonant</span>"] - }); - } - } - } - - if (firstName.length > 1) { - for (let i = 2; i < firstName.length + 1; i++) { - if ( - firstName.substring(i - 1, i) === "a" || - firstName.substring(i - 1, i) === "e" || - firstName.substring(i - 1, i) === "i" || - firstName.substring(i - 1, i) === "o" || - firstName.substring(i - 1, i) === "u" || - firstName.substring(i - 1, i) === "y" - ) { - generated.push({ - prefix: firstName.substring(i - 1, i) + ".", - rules: ["<span class='text-warning'>firstNameLetterVowel</span>"] - }); - } - } - } - - if (lastName.length > 1) { - for (let i = 2; i < lastName.length; i++) { - if ( - lastName.substring(i - 1, i) === "a" || - lastName.substring(i - 1, i) === "e" || - lastName.substring(i - 1, i) === "i" || - lastName.substring(i - 1, i) === "o" || - lastName.substring(i - 1, i) === "u" || - lastName.substring(i - 1, i) === "y" - ) { - generated.push({ - prefix: lastName.substring(i - 1, i + 1) + ".", - rules: ["<span class='text-warning'>lastNameTwoLettersVowel</span>"] - }); - } - } - } - - if (firstName.length > 2) { - for (let i = 2; i < firstName.length; i++) { - if (!( - firstName.substring(i - 1, i) === "a" || - firstName.substring(i - 1, i) === "e" || - firstName.substring(i - 1, i) === "i" || - firstName.substring(i - 1, i) === "o" || - firstName.substring(i - 1, i) === "u" || - firstName.substring(i - 1, i) === "y" - )) { - generated.push({ - prefix: firstName.substring(i - 1, i + 1) + ".", - rules: ["<span class='text-warning'>firstNameTwoLettersConsonant</span>"] - }); - } - } - } - - if (lastName.length > 2) { - for (let i = 2; i < lastName.length; i++) { - if (!( - lastName.substring(i - 1, i) === "a" || - lastName.substring(i - 1, i) === "e" || - lastName.substring(i - 1, i) === "i" || - lastName.substring(i - 1, i) === "o" || - lastName.substring(i - 1, i) === "u" || - lastName.substring(i - 1, i) === "y" - )) { - generated.push({ - prefix: lastName.substring(i - 1, i + 1) + ".", - rules: ["<span class='text-warning'>lastNameTwoLettersConsonant</span>"] - }); - } - } - } - - if (firstName.length > 2) { - for (let i = 2; i < firstName.length; i++) { - if ( - firstName.substring(i - 1, i) === "a" || - firstName.substring(i - 1, i) === "e" || - firstName.substring(i - 1, i) === "i" || - firstName.substring(i - 1, i) === "o" || - firstName.substring(i - 1, i) === "u" || - firstName.substring(i - 1, i) === "y" - ) { - generated.push({ - prefix: firstName.substring(i - 1, i + 1) + ".", - rules: ["<span class='text-warning'>firstNameTwoLettersVowel</span>"] - }); - } - } - } - - if (lastName.length > 2) { - for (let i = 2; i < lastName.length; i++) { - if ( - lastName.substring(i - 1, i) === "a" || - lastName.substring(i - 1, i) === "e" || - lastName.substring(i - 1, i) === "i" || - lastName.substring(i - 1, i) === "o" || - lastName.substring(i - 1, i) === "u" || - lastName.substring(i - 1, i) === "y" - ) { - generated.push({ - prefix: lastName.substring(i - 1, i + 1) + ".", - rules: ["<span class='text-warning'>lastNameTwoLettersVowel</span>"] - }); - } - } - } - - generated = generated.filter((c, index) => { - return generated.map((i) => { return i.prefix; }).indexOf(c.prefix) === index; - }); - - let generatedVowels = generated.filter((i) => { - return i.prefix.match(/[aeiouy]/); - }).map((i) => { - i.rules.push("<span class='text-danger'>containsVowels</span>"); - return i; - }); - - let generatedNotVowels = generated.filter((i) => { - return !i.prefix.match(/[aeiouy]/); - }).map((i) => { - i.rules.push("<span class='text-success'>notContainsVowels</span>"); - return i; - }); - - generated = [...generatedNotVowels, ... generatedVowels]; - - generated.sort((a, b) => { - return a.prefix.length - b.prefix.length; - }); - - let totalLength = generated.length; - generated = generated.filter((i) => { - return !toIgnore.includes(i.prefix); - }); - let lengthAfterIgnore = generated.length; - let ignoredCount = totalLength - lengthAfterIgnore; - - document.getElementById("hidden-count").innerText = ignoredCount.toString(); - document.getElementById("hidden-plural").style.display = ignoredCount === 1 ? "none" : "inline"; - document.getElementById("hidden-singular").style.display = ignoredCount === 1 ? "inline" : "none"; - document.getElementById("hidden-message").style.display = ignoredCount === 0 ? "none" : ""; - - document.getElementById("results-none").style.display = "none"; - document.getElementById("results-singular").style.display = "none"; - document.getElementById("results-plural").style.display = "none"; - - if (generated.length === 0) { - document.getElementById("generated").innerHTML = "<li><code>{...}</code></li>"; - document.getElementById("results-none").style.display = ""; - } else { - let html = []; - let index = 1; - - for (let prefix of generated) { - if (prefix.prefix === "n." || prefix.prefix === "g.") continue; - - html.push(`<li><code data-bs-toggle="tooltip" data-bs-html="true" data-bs-placement="right" title="<b>Prefix:</b> <code>${prefix.prefix}</code><br><b>Score:</b> ${((1 - (index/generated.length))*100).toFixed(2)}%<hr><div class='text-peh-nowrap'>- ${prefix.rules.join("</div><div class='text-peh-nowrap'>- ")}</div><hr><div class='text-peh-nowrap'>- <span class='text-${existing["cloudburst"].includes(prefix.prefix) ? "danger" : "success"}'>Cloudburst</span> ${existing["cloudburst"].includes(prefix.prefix) ? ` (${prefixesUsedBy["cloudburst"][prefix.prefix]})` : ""}</div><div class='text-peh-nowrap'>- <span class='text-${existing["raindrops"].includes(prefix.prefix) ? "danger" : "success"}'>Raindrops</span> ${existing["raindrops"].includes(prefix.prefix) ? ` (${prefixesUsedBy["raindrops"][prefix.prefix]})` : ""}">${prefix.prefix}</code></li>`); - - index++; - } - - document.getElementById("generated").innerHTML = html.join(""); - - document.getElementById(generated.length > 1 ? "results-plural" : "results-singular").style.display = ""; - } - - let tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')) - let tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) { - return new bootstrap.Tooltip(tooltipTriggerEl) - }); - - Array.from(document.querySelectorAll('[data-bs-toggle="tooltip"]')).forEach((item) => { - item.style.cursor = "help"; - }) - } - </script> - <style> - .tooltip-inner { - text-align: left !important; - } - - .text-peh-nowrap { - text-overflow: ellipsis; - white-space: nowrap; - overflow: hidden; - } - </style> -</div> - -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> +header("Location: /"); +die();
\ No newline at end of file diff --git a/pages/profiles.inc b/pages/profiles.inc new file mode 100644 index 0000000..f24d5d9 --- /dev/null +++ b/pages/profiles.inc @@ -0,0 +1,104 @@ +<?php + +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; global $_PROFILE; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/profiles.inc'; + +?> + +<br> +<div class="container"> + <div id="page-content"> + <h2>Profile scores</h2> + <?php + + $ordered = scoreOrderGlobal(); + + $ordered = array_map(function ($i) { + $i["_score"] = calculateProfileScore($i); + return $i; + }, $ordered); + + usort($ordered, function ($a, $b) { + return $b["_score"]["sortable"] - $a["_score"]["sortable"]; + }); + + $fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($_PROFILE['login'] === "raindrops" ? "gdapd" : "ynmuc") . "/fronters.json"), true)["members"]; + + ?> + + <?php if (count($fronters) > 0): $me = $fronters[0]; $me = array_values(array_filter($ordered, function ($i) use ($me) { return $i["id"] === $me["id"]; }))[0]; ?> + <p>Hi <b><?= $me["display_name"] ?></b>, + <?php if ($me["_score"]["progress"] === 1): ?> + your profile is complete, congratulations! + <?php else: ?> + <?php if (count($me["_score"]["actions"]) > 2): ?> + your profile is not complete, here is all you need to do: + <?php else: ?> + your profile is almost complete, all there's left to do is + <?php endif; ?> + <?php endif; ?> + + <?php if (count($me["_score"]["actions"]) > 2 || count($me["_score"]["actions"]) === 0): ?></p><?php endif; ?> + + <?php if ($me["_score"]["progress"] === 1): ?> + <p>You will be getting a Complete Profile badge pretty soon, so watch out for it.</p> + <?php elseif (count($me["_score"]["actions"]) > 2): ?> + <ul> + <?php $index = -1; foreach ($me["_score"]["actions"] as $action): $index++; ?> + <li>add <?= $action ?><?= $index !== count($me["_score"]["actions"]) - 1 ? ($index !== count($me["_score"]["actions"]) - 2 ? ";" : "; and") : "" ?></li> + <?php endforeach; ?> + </ul> + <?php else: ?> + add <?= implode(" and ", $me["_score"]["actions"]) ?>. + <p>Once you are done, you will get a Complete Profile badge.</p> + <?php endif; ?> + + <hr> + <?php endif; ?> + + <?php foreach ($ordered 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: 1.5fr 6fr;"> + <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="<?= getAsset($member["system"], $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> + </a> + + <div style="margin: -10px -10px -10px 10px;background: linear-gradient(90deg, rgba(255, 255, 255, .1) 0%, rgba(255, 255, 255, .1) <?= round($member["_score"]["progress"] * 100) ?>%, transparent <?= round($member["_score"]["progress"] * 100) ?>.000001%);border-top-right-radius: 10px;border-bottom-right-radius: 10px;display: flex;align-items: center;"> + <div style="margin-left: 10px; width: 100%;"> + <?php if (count($member["_score"]["actions"]) < 3): ?> + Add <?= implode(" and ", $member["_score"]["actions"]) ?> to get to 100% + <?php else: ?> + <?= round($member["_score"]["progress"] * 100) ?>% complete + <?php endif; ?> + + <div id="icons" style="float:right; margin-right: 10px;"> + <span title="<?= $member["_score"]["values"][5] ? "This member has a Pony Town character" : "This member does not have a Pony Town character" ?>" data-bs-toggle="tooltip"> + <img alt="" src="/assets/icons/ponytown.svg" style="filter: invert(1); opacity: <?= $member["_score"]["values"][5] ? "1" : ".25" ?>;"> + </span> + <span title="<?= $member["_score"]["values"][6] ? "This member has a color" : "This member does not have a color" ?>" data-bs-toggle="tooltip"> + <img alt="" src="/assets/icons/color.svg" style="filter: invert(1); opacity: <?= $member["_score"]["values"][6] ? "1" : ".25" ?>;"> + </span> + <span title="<?= $member["_score"]["values"][2] ? "This member has a public page that is over 200 letters long" : ($member["_score"]["pages"][0] ? "This member has a public page but it is only " . $member["_score"]["characters"][0] . " characters long" : "This member does not have a public page") ?>" data-bs-toggle="tooltip"> + <img alt="" src="/assets/icons/global.svg" style="filter: invert(1); opacity: <?= $member["_score"]["values"][2] ? "1" : ($member["_score"]["pages"][0] ? ".5" : ".25") ?>;"> + </span> + <span title="<?= $member["_score"]["values"][3] ? "This member has a public page that is over 200 letters long" : ($member["_score"]["pages"][1] ? "This member has a public page but it is only " . $member["_score"]["characters"][1] . " characters long" : "This member does not have a public page") ?>" data-bs-toggle="tooltip"> + <img alt="" src="/assets/icons/logout.svg" style="filter: invert(1); opacity: <?= $member["_score"]["values"][3] ? "1" : ($member["_score"]["pages"][1] ? ".5" : ".25") ?>;"> + </span> + <span title="<?= $member["_score"]["values"][0] ? "This member has their age entered" : (in_array("alicorn", $member["_metadata"]["species"]) ? "This member does not have their age entered, but this might be because they are an alicorn" : "This member does not have their age entered") ?>" data-bs-toggle="tooltip"> + <img alt="" src="/assets/icons/age.svg" style="filter: invert(1); opacity: <?= $member["_score"]["values"][0] ? "1" : (in_array("alicorn", $member["_metadata"]["species"]) ? ".5" : ".25") ?>;"> + </span> + <span title="<?= $member["_score"]["values"][4] ? "This member has a banner" : "This member does not have a banner" ?>" data-bs-toggle="tooltip"> + <img alt="" src="/assets/icons/banner.svg" style="filter: invert(1); opacity: <?= $member["_score"]["values"][4] ? "1" : ".25" ?>;"> + </span> + <span title="<?= $member["_score"]["values"][1] ? "This member has their birth date entered" : "This member does not have their birth date entered" ?>" data-bs-toggle="tooltip"> + <img alt="" src="/assets/icons/splitting.svg" style="filter: invert(1); opacity: <?= $member["_score"]["values"][1] ? "1" : ".25" ?>;"> + </span> + </div> + </div> + </div> + </div> + <?php endforeach; ?> + </div> +</div> + +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?> diff --git a/pages/relations.inc b/pages/relations.inc index 80520da..ce0d65c 100644 --- a/pages/relations.inc +++ b/pages/relations.inc @@ -1,6 +1,6 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; ?> @@ -8,8 +8,14 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; <br> <div class="container"> <div id="page-content"> - <h2>Relations</h2> - <?php foreach (withCaretakersDown(scoreOrderGlobal()) as $member): if (count($member["_metadata"]["marefriends"]) > 0 || count($member["_metadata"]["sisters"]) > 0): ?> + <h2><?= $pages["relations"]["name"][$lang["_name"]] ?></h2> + <?php foreach (withCaretakersDown(array_filter(scoreOrderGlobal(), function ($i) { + if ($_SERVER['HTTP_HOST'] === "fr.equestria.horse" && $i["_system"] !== "gdapd") { + return false; + } else { + return true; + } + })) as $member): if (count($member["_metadata"]["marefriends"]) > 0 || count($member["_metadata"]["sisters"]) > 0 || count($member["_metadata"]["caretakers"]) > 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="<?= getAsset($member["system"], $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> @@ -18,11 +24,11 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; <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> + <b style="padding-right:5px;"><?= $lang["relations"]["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> + <span class="text-muted"><?= $lang["relations"]["no"] ?></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="<?= getAsset($mfSystem, $marefriend["id"], "heads") ?>" style="width:24px;"></a> @@ -35,11 +41,11 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; <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> + <b style="padding-right:5px;"><?= $lang["relations"]["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> + <span class="text-muted"><?= $lang["relations"]["no"] ?></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="<?= getAsset($mfSystem, $marefriend["id"], "heads") ?>" style="width:24px;"></a> @@ -53,11 +59,11 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; <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> + <b style="padding-right:5px;"><?= $lang["relations"]["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> + <span class="text-muted"><?= $lang["relations"]["no"] ?></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="<?= getAsset($mfSystem, $marefriend["id"], "heads") ?>" style="width:24px;"></a> diff --git a/pages/rules-old.inc b/pages/rules-old.inc index 21ae7e6..1fd7f94 100644 --- a/pages/rules-old.inc +++ b/pages/rules-old.inc @@ -1,6 +1,6 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; if (isset($_POST["updateRules"])) { header("Content-Type: text/plain"); diff --git a/pages/rules.inc b/pages/rules.inc index eee3508..cf88eb1 100644 --- a/pages/rules.inc +++ b/pages/rules.inc @@ -1,6 +1,6 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; ?> diff --git a/pages/score.inc b/pages/score.inc index e04f9e7..97e666c 100644 --- a/pages/score.inc +++ b/pages/score.inc @@ -1,6 +1,6 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; ?> diff --git a/pages/splitting.inc b/pages/splitting.inc index 81571a6..520b2c8 100644 --- a/pages/splitting.inc +++ b/pages/splitting.inc @@ -1,6 +1,6 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; ?> diff --git a/pages/stats.inc b/pages/stats.inc index bd537f9..75b9e9d 100644 --- a/pages/stats.inc +++ b/pages/stats.inc @@ -1,6 +1,6 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; $switchesRaindrops = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/switches.json"), true); diff --git a/pages/terminology.inc b/pages/terminology.inc index c115bcf..ec810eb 100644 --- a/pages/terminology.inc +++ b/pages/terminology.inc @@ -1,6 +1,6 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; ?> @@ -8,7 +8,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; <br> <div class="container"> <div id="page-content"> - <?= file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/content/terminology.html") ?> + <?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/content/terminology.$lang[_name].html") ? file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/content/terminology.$lang[_name].html") : file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/content/terminology.html") ?> </div> </div> diff --git a/pages/together.inc b/pages/together.inc index 3799630..c210fa5 100644 --- a/pages/together.inc +++ b/pages/together.inc @@ -1,7 +1,7 @@ <?php $_GET['old'] = ""; -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; global $WebSocketAddress; diff --git a/pages/travelling.inc b/pages/travelling.inc index b7b772b..a38ea87 100644 --- a/pages/travelling.inc +++ b/pages/travelling.inc @@ -1,6 +1,6 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; $travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling/travelling.json"), true); $app = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true); @@ -9,6 +9,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.inc"; if (isset($_GET['toggleTravel'])) { if (isset($travelling[$_GET['member']])) { $id = $_GET['member']; + $equestria = isset($_GET['member']); $member = getSystemMember(getMemberSystem($id), $id); $system = getMemberSystem($id); $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$id.json"), true)); @@ -43,51 +44,55 @@ if (isset($_GET['toggleTravel'])) { } } else { $travelling[$_GET['member']]["travelling"] = true; + $travelling[$_GET['member']]["equestria"] = $equestria; $travelling[$_GET['member']]["pluralkit"] = null; $travelling[$_GET['member']]["history"][] = [ "start" => date("c"), - "end" => null + "end" => null, + "equestria" => $equestria ]; - // Insert code here to run after a travelling member is ADDED. - // $id is the member ID (e.g. rirgf) - // $member is the member - // $system is the system the member comes from - // $metadata is the ponies.equestria.horse metadata - // $travellingMember is unset here - // Store the travelling member ID in $travelling[$id]['pluralkit'] - $reqOptions = [ - 'http' => [ - 'method' => "POST", - 'header' => "Authorization: " . $app["pluralkit"][$travellingSystem === "gdapd" ? "raindrops" : "cloudburst"] . "\r\n" . - "Content-Type: application/json", - 'content' => json_encode([ - 'name' => "$member[name]-travelling", - 'display_name' => $member["display_name"], - 'color' => $member["color"], - 'birthday' => $member["birthday"], - 'created' => $member["created"], - 'pronouns' => $member["pronouns"], - 'avatar_url' => $member["avatar_url"], - 'banner' => $member["banner"], - 'description' => "**This pony is visiting this system from the " . ($system === "gdapd" ? "Raindrops System" : "Cloudburst System") . ". They are not a permanent member of this system**\n\n$member[description]", - 'proxy_tags' => array_map(function ($i) { - $i["prefix"] = "+" . $i['prefix']; - return $i; - }, $member["proxy_tags"]), - 'privacy' => $member["privacy"] - ]) - ] - ]; + if (!$equestria) { + // Insert code here to run after a travelling member is ADDED. + // $id is the member ID (e.g. rirgf) + // $member is the member + // $system is the system the member comes from + // $metadata is the ponies.equestria.horse metadata + // $travellingMember is unset here + // Store the travelling member ID in $travelling[$id]['pluralkit'] + $reqOptions = [ + 'http' => [ + 'method' => "POST", + 'header' => "Authorization: " . $app["pluralkit"][$travellingSystem === "gdapd" ? "raindrops" : "cloudburst"] . "\r\n" . + "Content-Type: application/json", + 'content' => json_encode([ + 'name' => "$member[name]-travelling", + 'display_name' => $member["display_name"], + 'color' => $member["color"], + 'birthday' => $member["birthday"], + 'created' => $member["created"], + 'pronouns' => $member["pronouns"], + 'avatar_url' => $member["avatar_url"], + 'banner' => $member["banner"], + 'description' => "**This pony is visiting this system from the " . ($system === "gdapd" ? "Raindrops System" : "Cloudburst System") . ". They are not a permanent member of this system**\n\n$member[description]", + 'proxy_tags' => array_map(function ($i) { + $i["prefix"] = "+" . $i['prefix']; + return $i; + }, $member["proxy_tags"]), + 'privacy' => $member["privacy"] + ]) + ] + ]; - $reqContext = stream_context_create($reqOptions); + $reqContext = stream_context_create($reqOptions); - sleep(1); - $member = json_decode(file_get_contents("https://api.pluralkit.me/v2/members", false, $reqContext), true); + sleep(1); + $member = json_decode(file_get_contents("https://api.pluralkit.me/v2/members", false, $reqContext), true); - // Member exists? - if (isset($member)) { - $travelling[$id]['pluralkit'] = $member["id"]; + // Member exists? + if (isset($member)) { + $travelling[$id]['pluralkit'] = $member["id"]; + } } } } @@ -120,9 +125,9 @@ global $travelling; ...array_values(array_filter(scoreOrderGlobal(), function ($i) use ($travelling) { return $travelling[$i['id']]["travelling"]; })), - ...array_values(array_filter(scoreOrderGlobal(), function ($i) use ($travelling) { - return !$travelling[$i['id']]["travelling"]; - })) + ...array_values(array_filter(scoreOrderGlobal(), function ($i) use ($travelling) { + return !$travelling[$i['id']]["travelling"]; + })) ] 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"] ?>"> @@ -131,9 +136,13 @@ 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 location:</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"); ?> + <?php if ($travelling[$member['id']]["travelling"] && $travelling[$member['id']]["equestria"]): ?> + <img style="width:24px;" src="/assets/logo/equestria.png"> Equestria + <?php else: ?> <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 endif; ?> <?php if ($travelling[$member['id']]["travelling"]): ?> <span class="text-muted">(<?= timeAgo($travelling[$member['id']]["history"][count($travelling[$member['id']]["history"]) - 1]["start"]) ?>)</span> <?php endif; ?> @@ -142,9 +151,24 @@ global $travelling; <div> <?php if ($travelling[$member['id']]["travelling"]): ?> - <a href="?toggleTravel&member=<?= $member['id'] ?>" class="btn btn-outline-danger">Stop travelling</a> + <div class="dropdown"> + <button type="button" class="btn btn-outline-danger dropdown-toggle" data-bs-toggle="dropdown"> + Stop travelling + </button> + <ul class="dropdown-menu"> + <li><a class="dropdown-item" href="?toggleTravel&member=<?= $member['id'] ?>">Stop travelling</a></li> + </ul> + </div> <?php else: ?> - <a href="?toggleTravel&member=<?= $member['id'] ?>" class="btn btn-outline-success">Start travelling</a> + <div class="dropdown"> + <button type="button" class="btn btn-outline-success dropdown-toggle" data-bs-toggle="dropdown"> + Start travelling + </button> + <ul class="dropdown-menu"> + <li><a class="dropdown-item" href="?toggleTravel&member=<?= $member['id'] ?>"><img style="width:24px;border-radius:5px;" src="/assets/uploads/<?= $system === "gdapd" ? "cloudburst" : "raindrops" ?>.png"> <?= $system === "gdapd" ? "Cloudburst" : "Raindrops" ?> System</a></li> + <li><a class="dropdown-item" href="?toggleTravel&equestria&member=<?= $member['id'] ?>"><img style="width:24px;" src="/assets/logo/equestria.png"> Equestria</a></li> + </ul> + </div> <?php endif; ?> </div> </div> diff --git a/pages/wakeup.inc b/pages/wakeup.inc index 2438a27..9df2c3e 100644 --- a/pages/wakeup.inc +++ b/pages/wakeup.inc @@ -1,6 +1,6 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; $emergencyHeader = true; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; ?> |