diff options
author | Minteck <contact@minteck.org> | 2022-12-10 22:27:08 +0100 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2022-12-10 22:27:08 +0100 |
commit | 30303a3ad0d0f31d93c25f42bfd10d70e8277b72 (patch) | |
tree | 622964e7895c759232aff28230394aa5cc747be9 | |
parent | f850a8a53efd719fef6c8784c5af7b89dd9a6a2f (diff) | |
download | pluralconnect-30303a3ad0d0f31d93c25f42bfd10d70e8277b72.tar.gz pluralconnect-30303a3ad0d0f31d93c25f42bfd10d70e8277b72.tar.bz2 pluralconnect-30303a3ad0d0f31d93c25f42bfd10d70e8277b72.zip |
Update
143 files changed, 2645 insertions, 2075 deletions
diff --git a/Authentication/PublicCallback/index.php b/Authentication/PublicCallback/index.php index 54980b1..7f6a11b 100644 --- a/Authentication/PublicCallback/index.php +++ b/Authentication/PublicCallback/index.php @@ -1,51 +1,3 @@ <?php -$channel = "public"; -$server = "auth.equestria.horse"; - -header("Content-Type: text/plain"); -// TODO: handle errors - -if (!isset($_GET['code'])) { - die(); -} - -$appdata = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true)[$channel]; - -$crl = curl_init('https://' . $server . '/hub/api/rest/oauth2/token'); -curl_setopt($crl, CURLOPT_RETURNTRANSFER, true); -curl_setopt($crl, CURLINFO_HEADER_OUT, true); -curl_setopt($crl, CURLOPT_POST, true); -curl_setopt($crl, CURLOPT_HTTPHEADER, [ - "Authorization: Basic " . base64_encode($appdata["id"] . ":" . $appdata["secret"]), - "Content-Type: application/x-www-form-urlencoded", - "Accept: application/json" -]); -curl_setopt($crl, CURLOPT_POSTFIELDS, "grant_type=authorization_code&redirect_uri=" . urlencode("http" . ($_SERVER['HTTPS'] ? "s" : "") . "://" . $_SERVER['HTTP_HOST'] . "/Authentication/PublicCallback") . "&code=" . $_GET['code']); - -$result = curl_exec($crl); -$result = json_decode($result, true); - -curl_close($crl); - -if (isset($result["access_token"])) { - $crl = curl_init('https://' . $server . '/hub/api/rest/users/me'); - curl_setopt($crl, CURLOPT_RETURNTRANSFER, true); - curl_setopt($crl, CURLINFO_HEADER_OUT, true); - curl_setopt($crl, CURLOPT_HTTPHEADER, [ - "Authorization: Bearer " . $result["access_token"], - "Accept: application/json" - ]); - - $result = curl_exec($crl); - $result = json_decode($result, true); - - if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens-public")) mkdir($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens-public"); - - $token = bin2hex(random_bytes(32)); - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens-public/" . $token, json_encode($result)); - header("Set-Cookie: PEH2_USER_TOKEN=" . $token . "; SameSite=None; Path=/; Secure; HttpOnly; Expires=" . date("r", time() + (86400 * 730))); - - header("Location: /Authentication/Success"); - die(); -}
\ No newline at end of file +return;
\ No newline at end of file diff --git a/Authentication/PublicStart/index.php b/Authentication/PublicStart/index.php index c0ed9c6..7f6a11b 100644 --- a/Authentication/PublicStart/index.php +++ b/Authentication/PublicStart/index.php @@ -1,7 +1,3 @@ <?php -$channel = "public"; -$server = "auth.equestria.horse"; - -header("Location: https://$server/hub/api/rest/oauth2/auth?client_id=" . json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true)[$channel]["id"] . "&response_type=code&redirect_uri=http" . ($_SERVER['HTTPS'] ? "s" : "") . "://" . $_SERVER['HTTP_HOST'] . "/Authentication/PublicCallback&scope=Hub&request_credentials=default&access_type=offline"); -die(); +return;
\ No newline at end of file diff --git a/api/camera.php b/api/camera.php new file mode 100644 index 0000000..cbf7efc --- /dev/null +++ b/api/camera.php @@ -0,0 +1,6 @@ +<?php + +if (!isset($_GET['t']) || preg_match("/[^a-zA-Z\d]/m", $_GET['t'])) die(); + +header("Content-Type: image/jpeg"); +die(base64_decode(exec('ssh root@192.168.1.27 "cd /root/alarm; node open.js ' . $_GET['t'] . '"')));
\ No newline at end of file diff --git a/api/pluralkit-integration.php b/api/pluralkit-integration.php index 0bc5d23..6d1166c 100644 --- a/api/pluralkit-integration.php +++ b/api/pluralkit-integration.php @@ -93,6 +93,36 @@ if ($input["type"] === "CREATE_SWITCH" || $input["type"] === "UPDATE_SWITCH" || if ($system === "gdapd") { $topic = "public-switches-raindrops"; + + if (count($fronters["members"]) > 0) { + file_get_contents('https://' . $ntfy["server"] . '/public-switches-fr', false, stream_context_create([ + 'http' => [ + 'method' => 'POST', + 'header' => + "Content-Type: text/plain\r\n" . + "Title: 🐴 $name vient de switch\r\n" . + "Priority: default\r\n" . + "Tags: switch\r\n" . + "Actions: view, Voir sur Cold Haze, https://fr.equestria.horse/" . $fronters["members"][0]["name"] . "/, clear=true\r\n" . + "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), + 'content' => ($fronters["members"][0]["display_name"] ?? $fronters["members"][0]["name"]) . " est désormais au front" + ] + ])); + } else { + file_get_contents('https://' . $ntfy["server"] . '/public-switches-fr', false, stream_context_create([ + 'http' => [ + 'method' => 'POST', + 'header' => + "Content-Type: text/plain\r\n" . + "Title: 🐴 $name vient de switch\r\n" . + "Priority: default\r\n" . + "Tags: switch\r\n" . + "Actions: view, Voir sur Cold Haze, https://fr.equestria.horse/, clear=true\r\n" . + "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), + 'content' => "Le poney de trait est désormais au front" + ] + ])); + } } else { $topic = "public-switches-cloudburst"; } @@ -1,9 +1,6 @@ <?php -if (!isset($_COOKIE["PEH2_LANGUAGE"])) { - $_COOKIE["PEH2_LANGUAGE"] = "en"; - setcookie("PEH2_LANGUAGE", "en", time() + (86400 * 365), "/"); -} +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/language.inc"; global $lang; global $pages; if (str_ends_with($_GET['_'], "/")) { $pagename = substr($_GET['_'], 0, strlen($_GET['_']) - 1); @@ -18,7 +15,7 @@ if (in_array($toplevel, ["editor", "icons", "species", "uploads"])) { if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/" . $toplevel . "/" . $filename)) { header("Location: /assets/" . $toplevel . "/" . $filename) and die(); } else { - header("Location: /?error=File not found") and die(); + header("Location: /?error=" . $lang["app"]["file"]) and die(); } } elseif ($toplevel === "") { require_once $_SERVER['DOCUMENT_ROOT'] . "/pages/home.inc"; @@ -30,7 +27,7 @@ if (in_array($toplevel, ["editor", "icons", "species", "uploads"])) { if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/pages/" . $toplevel . ".inc")) { require_once $_SERVER['DOCUMENT_ROOT'] . "/pages/" . $toplevel . ".inc"; } else { - header("Location: /?error=Page not found: " . strip_tags($pagename)) and die(); + header("Location: /?error=" . $lang["app"]["page"] . " " . strip_tags($pagename)) and die(); } } else if ($toplevel === "api") { if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/pages/" . $toplevel . ".inc")) { diff --git a/app/banner.js b/app/banner.js index 7401572..dc1a06b 100644 --- a/app/banner.js +++ b/app/banner.js @@ -116,9 +116,9 @@ async function refreshBanner(offline, french) { <img id="member-icon-mobile" src="${offline ? JSON.parse(await localforage.getItem("images")).profile[data['icon']['offline'].split(".")[0].split("-")[1]][data['icon']['offline'].split(".")[0].split("-")[2]] : (data['icon']['online'] ?? (data['id'] === "fusion" ? '/assets/logo/logo.png' : data['system']['icon']))}" alt="" style="background-color:rgba(255, 255, 255, .125);width:36px;height:36px;border-radius:999px;display:none;margin-right:5px;"> <span style="vertical-align: middle;"> ${data['id'] === "unknown" ? ` - <span class="text-muted">Unknown member (${data['system']['name']} System)</span> + <span class="text-muted">${french ? "Membre inconnu" : "Unknown member"} (${data['system']['name']} System)</span> ` : data['id'] === "fusion" ? (data['name'] === "fusion" ? ` - <span class="text-muted">Multiple merged members</span> + <span class="text-muted">${french ? "Plusieurs membres fusionnés" : "Multiple merged members"}</span> ` : data['name']) : data['name']} </span> </h3> @@ -128,26 +128,26 @@ async function refreshBanner(offline, french) { ${data['badges'].length === 0 ? " " : ""} </div> - <div style="display:grid;grid-template-columns: repeat(${data['median'] || data['id'] === "unknown" ? 4 : data['id'] === "fusion" ? 3 : 5}, 1fr);" id="member-card"> + <div style="display:grid;grid-template-columns: repeat(${data['median'] || data['id'] === "unknown" ? (french ? 3 : 4) : data['id'] === "fusion" ? (french ? 2 : 3) : (french ? 4 : 5)}, 1fr);" id="member-card"> <span> <b>${french ? `Préfixe${data['prefixes'].length > 1 ? 's' : ''} ` : `Prefix${data['prefixes'].length > 1 ? 'es' : ''}`}: </b><span class="member-small-separator"><br></span> <code style="color: white;">${data['prefixes'].join('</code>, <code style="color: white;">')}</code> </span> - <span> + ${french ? "" : `<span> <b>${french ? "Pronoms :" : "Pronouns:"} </b><span class="member-small-separator"><br></span> ${data['id'] === "fusion" ? "she/her" : data['pronouns']} - </span> + </span>`} ${!data['median'] && data['id'] !== "unknown" ? ` <span> ${data["id"] === "fusion" ? ` - <b>Fronting since: </b><span class="member-small-separator"><br></span> + <b>${french ? "Fronte depuis " : "Fronting since"}: </b><span class="member-small-separator"><br></span> ${data['last_fronted'] ? ` ${data['last_fronted']['now'] ? ` <span class="relative-time" data-relative-timestamp="${data['last_fronted']['timestamp']}">${data['last_fronted']['relative']}</span><br> ` : ` - <span class="text-muted">Not fronting</span><br> + <span class="text-muted">${french ? "Pas au front" : "Not fronting"}</span><br> `} - ` : `<span class="text-muted">Not fronting</span><br> `}` : ` + ` : `<span class="text-muted">${french ? "Pas au front" : "Not fronting"}</span><br> `}` : ` <b>${french ? "Front :" : "Last fronted:"} </b><span class="member-small-separator"><br></span> ${data['last_fronted'] ? ` ${data['last_fronted']['now'] ? ` @@ -162,26 +162,26 @@ async function refreshBanner(offline, french) { ` : ''} ${data['id'] !== "fusion" ? ` <span> - ${data['id'] === "unknown" ? "<b>Species: </b> best to ask" : ` - <span class="member-small-only"><b>Species: </b></span> + ${data['id'] === "unknown" ? (french ? "<b>Espèce : </b> préférez demander" : "<b>Species: </b> best to ask") : ` + <span class="member-small-only"><b>${french ? "Espèce :" : "Species:"} </b></span> ${data['species'].map(species => ` <img data-bs-toggle="tooltip" title="${species['name']}" style="width:32px;vertical-align: middle;position:relative;top:-5px;" src="${offline ? species['icon_offline'] : `/assets/species/${species['icon']}`}" alt="${species['name']}"> `).join("")}`} </span>` : ''} ${data['id'] !== "fusion" ? ` <span> - <span class="member-small-only"><b>System: </b></span> - <a class="member-link" href="${data['system']['page']}"><img style="width:24px;border-radius:5px;" src="${offline ? data['system']['icon_offline'] : `/assets/uploads/${data['system']['icon']}`}"> ${data['system']['name']}</a> + <span class="member-small-only"><b>${french ? "Position :" : "Location:"} </b></span> + ${data['system']['page'] ? `<a class="member-link" href="${data['system']['page']}"><img style="width:24px;" src="${offline ? data['system']['icon_offline'] : `/assets/uploads/${data['system']['icon']}`}"> ${data['system']['name']}</a>` : `<img style="width:24px;" src="${offline ? data['system']['icon_offline'] : `/assets/uploads/${data['system']['icon']}`}"> ${data['system']['name']}`} ${data['system']['subsystem'] ? ` - <br><span class="member-small-only"><b>Subsystem: </b></span><a class="member-link" href="${data['system']['subsystem']['page']}"><img style="width:24px;border-radius:5px;" src="/assets/uploads/${data['system']['subsystem']['icon']}"> ${data['system']['subsystem']['name']}</a> - ` : data['system']['temporary'] ? '<br>(temporary)' : ''} + <br><span class="member-small-only"><b>${french ? "Sous-système :" : "Subsystem:"} </b></span><a class="member-link" href="${data['system']['subsystem']['page']}"><img style="width:24px;border-radius:5px;" src="/assets/uploads/${data['system']['subsystem']['icon']}"> ${data['system']['subsystem']['name']}</a> + ` : data['system']['temporary'] ? (french ? '<br>(temporaire)' : '<br>(temporary)') : ''} </span> ` : ''} </div> ${data['id'] !== "unknown" && data['id'] !== "fusion" ? ` <div style="display:grid;grid-template-columns: repeat(${data["little"] ? "3" : "2"}, 1fr);margin-top:5px;" id="member-relations"> <span> - <b>${french ? (data['relations']['marefriends'].length > 1 ? 'Partenaires ' : 'Partenaire ') : `Marefriend${data['relations']['marefriends'].length > 1 ? 's' : ''}`}: </b>${data['relations']['marefriends'].length > 1 ? '<span class="list-separator-mobile"><br></span>' : ''} + <b>${french ? (data['relations']['marefriends'].length > 1 ? 'Copines ' : 'Copine ') : `Marefriend${data['relations']['marefriends'].length > 1 ? 's' : ''}`}: </b>${data['relations']['marefriends'].length > 1 ? '<span class="list-separator-mobile"><br></span>' : ''} ${data['relations']['marefriends'].map(relation => ` <a title="${relation['name']}" data-bs-toggle="tooltip" class="member-link tooltip-nohelp" href="${relation['link']}"><img src="${offline ? relation['icon_offline'] : `${relation['icon']}`}" style="width:24px;"></a>`).join(``)} ${data['relations']['marefriends'].length === 0 ? '-' : ''} @@ -194,7 +194,7 @@ async function refreshBanner(offline, french) { </span> ${data['little'] ? ` <span> - <b>${french ? (data['relations']['sisters'].length > 1 ? 'Caretakers ' : 'Caretaker ') : `Caretaker${data['relations']['caretakers'].length > 1 ? 's' : ''}`}: </b>${data['relations']['caretakers'].length > 1 ? '<span class="list-separator-mobile"><br></span>' : ''} + <b>${french ? (data['relations']['sisters'].length > 1 ? 'Gardiens ' : 'Gardien ') : `Caretaker${data['relations']['caretakers'].length > 1 ? 's' : ''}`}: </b>${data['relations']['caretakers'].length > 1 ? '<span class="list-separator-mobile"><br></span>' : ''} ${data['relations']['caretakers'].map(relation => ` <a title="${relation['name']}" data-bs-toggle="tooltip" class="member-link tooltip-nohelp" href="${relation['link']}"><img src="${offline ? relation['icon_offline'] : `${relation['icon']}`}" style="width:24px;"></a>`).join(``)} ${data['relations']['caretakers'].length === 0 ? '-' : ''} diff --git a/app/fronters/ponies/exudo.png b/app/fronters/ponies/exudo.png Binary files differnew file mode 100644 index 0000000..858d7e1 --- /dev/null +++ b/app/fronters/ponies/exudo.png diff --git a/app/fronters/ponies/qcemf.png b/app/fronters/ponies/qcemf.png Binary files differnew file mode 100644 index 0000000..ce17c8b --- /dev/null +++ b/app/fronters/ponies/qcemf.png diff --git a/app/fronters/ponies/ughya.png b/app/fronters/ponies/ughya.png Binary files differnew file mode 100644 index 0000000..64cf8f8 --- /dev/null +++ b/app/fronters/ponies/ughya.png diff --git a/app/fronters/profiles/auvwc.png b/app/fronters/profiles/auvwc.png Binary files differindex 38bb8d5..818d389 100644 --- a/app/fronters/profiles/auvwc.png +++ b/app/fronters/profiles/auvwc.png diff --git a/app/fronters/profiles/bbrig.png b/app/fronters/profiles/bbrig.png Binary files differindex a874921..d2681bc 100644 --- a/app/fronters/profiles/bbrig.png +++ b/app/fronters/profiles/bbrig.png diff --git a/app/fronters/profiles/ckqsw.png b/app/fronters/profiles/ckqsw.png Binary files differindex 8a74ec0..3006642 100644 --- a/app/fronters/profiles/ckqsw.png +++ b/app/fronters/profiles/ckqsw.png diff --git a/app/fronters/profiles/dogwu.png b/app/fronters/profiles/dogwu.png Binary files differindex 731f0f7..b6559f5 100644 --- a/app/fronters/profiles/dogwu.png +++ b/app/fronters/profiles/dogwu.png diff --git a/app/fronters/profiles/eebmh.png b/app/fronters/profiles/eebmh.png Binary files differindex e037bf8..a759b56 100644 --- a/app/fronters/profiles/eebmh.png +++ b/app/fronters/profiles/eebmh.png diff --git a/app/fronters/profiles/erefx.png b/app/fronters/profiles/erefx.png Binary files differindex 06e26b2..7bc4806 100644 --- a/app/fronters/profiles/erefx.png +++ b/app/fronters/profiles/erefx.png diff --git a/app/fronters/profiles/erknz.png b/app/fronters/profiles/erknz.png Binary files differindex 5d6bb7f..2078744 100644 --- a/app/fronters/profiles/erknz.png +++ b/app/fronters/profiles/erknz.png diff --git a/app/fronters/profiles/exnwc.png b/app/fronters/profiles/exnwc.png Binary files differindex 465d7bf..9d47e6c 100644 --- a/app/fronters/profiles/exnwc.png +++ b/app/fronters/profiles/exnwc.png diff --git a/app/fronters/profiles/exudo.png b/app/fronters/profiles/exudo.png Binary files differnew file mode 100644 index 0000000..76c987c --- /dev/null +++ b/app/fronters/profiles/exudo.png diff --git a/app/fronters/profiles/fdaay.png b/app/fronters/profiles/fdaay.png Binary files differindex 03ce335..2444822 100644 --- a/app/fronters/profiles/fdaay.png +++ b/app/fronters/profiles/fdaay.png diff --git a/app/fronters/profiles/gevde.png b/app/fronters/profiles/gevde.png Binary files differindex 2d0d73a..37675e7 100644 --- a/app/fronters/profiles/gevde.png +++ b/app/fronters/profiles/gevde.png diff --git a/app/fronters/profiles/gfhsr.png b/app/fronters/profiles/gfhsr.png Binary files differindex 09daf26..a0fe18d 100644 --- a/app/fronters/profiles/gfhsr.png +++ b/app/fronters/profiles/gfhsr.png diff --git a/app/fronters/profiles/ghrby.png b/app/fronters/profiles/ghrby.png Binary files differindex a1e3231..97d0d1b 100644 --- a/app/fronters/profiles/ghrby.png +++ b/app/fronters/profiles/ghrby.png diff --git a/app/fronters/profiles/hpwyq.png b/app/fronters/profiles/hpwyq.png Binary files differindex 1df8bf1..cb6d7b0 100644 --- a/app/fronters/profiles/hpwyq.png +++ b/app/fronters/profiles/hpwyq.png diff --git a/app/fronters/profiles/irxyh.png b/app/fronters/profiles/irxyh.png Binary files differindex d4937ff..7c9577b 100644 --- a/app/fronters/profiles/irxyh.png +++ b/app/fronters/profiles/irxyh.png diff --git a/app/fronters/profiles/jnbae.png b/app/fronters/profiles/jnbae.png Binary files differindex 8b9d6f3..a06a031 100644 --- a/app/fronters/profiles/jnbae.png +++ b/app/fronters/profiles/jnbae.png diff --git a/app/fronters/profiles/khsbb.png b/app/fronters/profiles/khsbb.png Binary files differindex cdd2c7d..6d45bb9 100644 --- a/app/fronters/profiles/khsbb.png +++ b/app/fronters/profiles/khsbb.png diff --git a/app/fronters/profiles/kkhbw.png b/app/fronters/profiles/kkhbw.png Binary files differindex fa1a5ae..9822fe3 100644 --- a/app/fronters/profiles/kkhbw.png +++ b/app/fronters/profiles/kkhbw.png diff --git a/app/fronters/profiles/lllfw.png b/app/fronters/profiles/lllfw.png Binary files differindex 7e2e24b..889d471 100644 --- a/app/fronters/profiles/lllfw.png +++ b/app/fronters/profiles/lllfw.png diff --git a/app/fronters/profiles/lzlaq.png b/app/fronters/profiles/lzlaq.png Binary files differindex 85cffe4..297d756 100644 --- a/app/fronters/profiles/lzlaq.png +++ b/app/fronters/profiles/lzlaq.png diff --git a/app/fronters/profiles/mglyq.png b/app/fronters/profiles/mglyq.png Binary files differindex b29b2f6..71544d7 100644 --- a/app/fronters/profiles/mglyq.png +++ b/app/fronters/profiles/mglyq.png diff --git a/app/fronters/profiles/mhnqy.png b/app/fronters/profiles/mhnqy.png Binary files differindex c2c8248..370ca37 100644 --- a/app/fronters/profiles/mhnqy.png +++ b/app/fronters/profiles/mhnqy.png diff --git a/app/fronters/profiles/mvaws.png b/app/fronters/profiles/mvaws.png Binary files differindex 8c0dc21..5af3777 100644 --- a/app/fronters/profiles/mvaws.png +++ b/app/fronters/profiles/mvaws.png diff --git a/app/fronters/profiles/pabmo.png b/app/fronters/profiles/pabmo.png Binary files differindex 4794b04..5ad9dfc 100644 --- a/app/fronters/profiles/pabmo.png +++ b/app/fronters/profiles/pabmo.png diff --git a/app/fronters/profiles/ptgor.png b/app/fronters/profiles/ptgor.png Binary files differindex bc53c40..6e2bb89 100644 --- a/app/fronters/profiles/ptgor.png +++ b/app/fronters/profiles/ptgor.png diff --git a/app/fronters/profiles/qbzxm.png b/app/fronters/profiles/qbzxm.png Binary files differindex 14b167b..5478e33 100644 --- a/app/fronters/profiles/qbzxm.png +++ b/app/fronters/profiles/qbzxm.png diff --git a/app/fronters/profiles/qcemf.png b/app/fronters/profiles/qcemf.png Binary files differnew file mode 100644 index 0000000..fd99d2b --- /dev/null +++ b/app/fronters/profiles/qcemf.png diff --git a/app/fronters/profiles/qraku.png b/app/fronters/profiles/qraku.png Binary files differindex f75f702..fed1048 100644 --- a/app/fronters/profiles/qraku.png +++ b/app/fronters/profiles/qraku.png diff --git a/app/fronters/profiles/rdstg.png b/app/fronters/profiles/rdstg.png Binary files differindex 26c2939..08c94ff 100644 --- a/app/fronters/profiles/rdstg.png +++ b/app/fronters/profiles/rdstg.png diff --git a/app/fronters/profiles/rirgf.png b/app/fronters/profiles/rirgf.png Binary files differindex dc44de0..ecc0e18 100644 --- a/app/fronters/profiles/rirgf.png +++ b/app/fronters/profiles/rirgf.png diff --git a/app/fronters/profiles/rpjok.png b/app/fronters/profiles/rpjok.png Binary files differindex e77e62c..ca6970b 100644 --- a/app/fronters/profiles/rpjok.png +++ b/app/fronters/profiles/rpjok.png diff --git a/app/fronters/profiles/sbxze.png b/app/fronters/profiles/sbxze.png Binary files differindex 360562f..ee3cfbf 100644 --- a/app/fronters/profiles/sbxze.png +++ b/app/fronters/profiles/sbxze.png diff --git a/app/fronters/profiles/sehke.png b/app/fronters/profiles/sehke.png Binary files differindex 95e00cb..ac12f48 100644 --- a/app/fronters/profiles/sehke.png +++ b/app/fronters/profiles/sehke.png diff --git a/app/fronters/profiles/sjuao.png b/app/fronters/profiles/sjuao.png Binary files differindex e9ca5ba..39ae38e 100644 --- a/app/fronters/profiles/sjuao.png +++ b/app/fronters/profiles/sjuao.png diff --git a/app/fronters/profiles/tfbob.png b/app/fronters/profiles/tfbob.png Binary files differindex 27c24f1..913b60f 100644 --- a/app/fronters/profiles/tfbob.png +++ b/app/fronters/profiles/tfbob.png diff --git a/app/fronters/profiles/tjrhc.png b/app/fronters/profiles/tjrhc.png Binary files differindex 90501f5..e17fef7 100644 --- a/app/fronters/profiles/tjrhc.png +++ b/app/fronters/profiles/tjrhc.png diff --git a/app/fronters/profiles/ufadt.png b/app/fronters/profiles/ufadt.png Binary files differindex 421ad2f..c893102 100644 --- a/app/fronters/profiles/ufadt.png +++ b/app/fronters/profiles/ufadt.png diff --git a/app/fronters/profiles/ughya.png b/app/fronters/profiles/ughya.png Binary files differnew file mode 100644 index 0000000..2726a76 --- /dev/null +++ b/app/fronters/profiles/ughya.png diff --git a/app/fronters/profiles/vncoa.png b/app/fronters/profiles/vncoa.png Binary files differindex 0c6f3a3..9f97376 100644 --- a/app/fronters/profiles/vncoa.png +++ b/app/fronters/profiles/vncoa.png diff --git a/app/fronters/profiles/vvsxf.png b/app/fronters/profiles/vvsxf.png Binary files differindex 138b61e..c53ea62 100644 --- a/app/fronters/profiles/vvsxf.png +++ b/app/fronters/profiles/vvsxf.png diff --git a/app/fronters/profiles/xbvwt.png b/app/fronters/profiles/xbvwt.png Binary files differindex 31d0d87..b1774d2 100644 --- a/app/fronters/profiles/xbvwt.png +++ b/app/fronters/profiles/xbvwt.png diff --git a/app/fronters/profiles/xcjhj.png b/app/fronters/profiles/xcjhj.png Binary files differindex 387c16a..24318ae 100644 --- a/app/fronters/profiles/xcjhj.png +++ b/app/fronters/profiles/xcjhj.png diff --git a/app/fronters/profiles/yhbrc.png b/app/fronters/profiles/yhbrc.png Binary files differindex c5c8092..800b3b7 100644 --- a/app/fronters/profiles/yhbrc.png +++ b/app/fronters/profiles/yhbrc.png diff --git a/app/fronters/profiles/zajrk.png b/app/fronters/profiles/zajrk.png Binary files differindex 6209ab9..b6d5ca3 100644 --- a/app/fronters/profiles/zajrk.png +++ b/app/fronters/profiles/zajrk.png diff --git a/app/fronters/profiles/zdtsg.png b/app/fronters/profiles/zdtsg.png Binary files differindex 8826b75..b8e61a3 100644 --- a/app/fronters/profiles/zdtsg.png +++ b/app/fronters/profiles/zdtsg.png diff --git a/app/fronters/profiles/zhtzs.png b/app/fronters/profiles/zhtzs.png Binary files differindex 11ff9ec..fddb711 100644 --- a/app/fronters/profiles/zhtzs.png +++ b/app/fronters/profiles/zhtzs.png diff --git a/app/fronters/profiles/ztfjz.png b/app/fronters/profiles/ztfjz.png Binary files differindex 53db137..e766a35 100644 --- a/app/fronters/profiles/ztfjz.png +++ b/app/fronters/profiles/ztfjz.png diff --git a/app/fronters/profiles/zzise.png b/app/fronters/profiles/zzise.png Binary files differindex 5ce368f..88217e3 100644 --- a/app/fronters/profiles/zzise.png +++ b/app/fronters/profiles/zzise.png @@ -64,6 +64,7 @@ let filesToCache = [ "/app/fronters/ponies/erefx.png", "/app/fronters/ponies/erknz.png", "/app/fronters/ponies/exnwc.png", + "/app/fronters/ponies/exudo.png", "/app/fronters/ponies/fdaay.png", "/app/fronters/ponies/gevde.png", "/app/fronters/ponies/gfhsr.png", @@ -79,6 +80,7 @@ let filesToCache = [ "/app/fronters/ponies/nabky.png", "/app/fronters/ponies/pabmo.png", "/app/fronters/ponies/qbzxm.png", + "/app/fronters/ponies/qcemf.png", "/app/fronters/ponies/qraku.png", "/app/fronters/ponies/rirgf.png", "/app/fronters/ponies/rpjok.png", @@ -86,6 +88,7 @@ let filesToCache = [ "/app/fronters/ponies/sehke.png", "/app/fronters/ponies/tfbob.png", "/app/fronters/ponies/ufadt.png", + "/app/fronters/ponies/ughya.png", "/app/fronters/ponies/vncoa.png", "/app/fronters/ponies/vvsxf.png", "/app/fronters/ponies/xbvwt.png", @@ -109,6 +112,7 @@ let filesToCache = [ "/app/fronters/profiles/erknz.png", "/app/fronters/profiles/exidq.png", "/app/fronters/profiles/exnwc.png", + "/app/fronters/profiles/exudo.png", "/app/fronters/profiles/ezqym.png", "/app/fronters/profiles/ezvzp.png", "/app/fronters/profiles/famxl.png", @@ -146,6 +150,7 @@ let filesToCache = [ "/app/fronters/profiles/ptgor.png", "/app/fronters/profiles/ptgqh.png", "/app/fronters/profiles/qbzxm.png", + "/app/fronters/profiles/qcemf.png", "/app/fronters/profiles/qlsfo.png", "/app/fronters/profiles/qraku.png", "/app/fronters/profiles/qzbpf.png", @@ -169,6 +174,7 @@ let filesToCache = [ "/app/fronters/profiles/trefr.png", "/app/fronters/profiles/tviaq.png", "/app/fronters/profiles/ufadt.png", + "/app/fronters/profiles/ughya.png", "/app/fronters/profiles/uicxr.png", "/app/fronters/profiles/vahcl.png", "/app/fronters/profiles/vaxyy.png", @@ -231,10 +237,13 @@ let filesToCache = [ "/assets/uploads/pt-izzymoonbow.png", "/assets/uploads/pt-lavender.png", "/assets/uploads/pt-lilacbloom.png", + "/assets/uploads/pt-luna.png", "/assets/uploads/pt-mintygrape.png", "/assets/uploads/pt-mistybrightdawn.png", "/assets/uploads/pt-mistycloud.png", "/assets/uploads/pt-mossystorm.png", + "/assets/uploads/pt-nightmaremoon.png", + "/assets/uploads/pt-opaline.png", "/assets/uploads/pt-pipppetals.png", "/assets/uploads/pt-plushie.png", "/assets/uploads/pt-poseybloom.png", diff --git a/assets/icons/age.svg b/assets/icons/age.svg new file mode 100644 index 0000000..0286c15 --- /dev/null +++ b/assets/icons/age.svg @@ -0,0 +1 @@ +<svg width="24" height="24" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M15.25 13c.966 0 1.75.784 1.75 1.75v4.5A1.75 1.75 0 0 1 15.25 21H3.75A1.75 1.75 0 0 1 2 19.25v-4.5c0-.966.783-1.75 1.75-1.75h11.5ZM21 14.899v5.351a.75.75 0 0 1-1.494.102l-.006-.102v-5.338a3.006 3.006 0 0 0 1.5-.013Zm-5.75-.399H3.75a.25.25 0 0 0-.25.25v4.5c0 .138.111.25.25.25h11.5a.25.25 0 0 0 .25-.25v-4.5a.25.25 0 0 0-.25-.25Zm5-4.408a1.908 1.908 0 1 1 0 3.816 1.908 1.908 0 0 1 0-3.816ZM15.244 3c.967 0 1.75.784 1.75 1.75v4.5a1.75 1.75 0 0 1-1.75 1.75h-11.5a1.75 1.75 0 0 1-1.75-1.75v-4.5a1.75 1.75 0 0 1 1.607-1.744L3.745 3h11.5Zm0 1.5h-11.5l-.057.007a.25.25 0 0 0-.193.243v4.5c0 .138.112.25.25.25h11.5a.25.25 0 0 0 .25-.25v-4.5a.25.25 0 0 0-.25-.25ZM20.25 3a.75.75 0 0 1 .743.648L21 3.75v5.351a3.004 3.004 0 0 0-1.5-.013V3.75a.75.75 0 0 1 .75-.75Z" fill="#000000"/></svg>
\ No newline at end of file diff --git a/assets/icons/badges/week.svg b/assets/icons/badges/week.svg new file mode 100644 index 0000000..e0fbc09 --- /dev/null +++ b/assets/icons/badges/week.svg @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generator: Adobe Illustrator 26.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> +<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" + viewBox="0 0 48 48" style="enable-background:new 0 0 48 48;" xml:space="preserve"> +<style type="text/css"> + .st0{fill:url(#SVGID_1_);} +</style> +<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="11.2196" y1="36.595" x2="40.3573" y2="7.4573"> + <stop offset="0" style="stop-color:#008F11"/> + <stop offset="1" style="stop-color:#00D419"/> +</linearGradient> +<path class="st0" d="M23.8,41.8c-2.5,0-4.8-0.5-7-1.4s-4.1-2.2-5.6-3.8s-2.9-3.5-3.8-5.7c-0.9-2.2-1.4-4.5-1.4-7 + c0-2.4,0.5-4.7,1.4-6.9s2.2-4,3.8-5.6s3.5-2.9,5.7-3.8s4.5-1.4,6.9-1.4c2.6,0,5.1,0.6,7.5,1.7s4.4,2.7,6.1,4.8V7.4h2.9v10.2H30v-2.9 + h5.3c-1.4-1.7-3.2-3.1-5.2-4.1S26,9.1,23.8,9.1c-4.1,0-7.6,1.4-10.6,4.3s-4.3,6.3-4.3,10.5s1.4,7.7,4.3,10.6s6.4,4.4,10.6,4.4 + c4,0,7.4-1.4,10.3-4.2s4.3-6.2,4.4-10.2h3c-0.1,4.9-1.9,9-5.3,12.3C32.8,40.1,28.6,41.8,23.8,41.8z M30.2,32.3l-8-7.8v-11h3v9.8l7,7 + L30.2,32.3z"/> +</svg> diff --git a/assets/icons/banner.svg b/assets/icons/banner.svg new file mode 100644 index 0000000..ae786bf --- /dev/null +++ b/assets/icons/banner.svg @@ -0,0 +1 @@ +<svg width="24" height="24" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M2 7.25A3.25 3.25 0 0 1 5.25 4h13.5A3.25 3.25 0 0 1 22 7.25V13h-.258a3.74 3.74 0 0 0-1.242-2.545V7.25a1.75 1.75 0 0 0-1.75-1.75H5.25A1.75 1.75 0 0 0 3.5 7.25v9.5c0 .966.784 1.75 1.75 1.75H12v.5c0 .34.04.674.118 1H5.25A3.25 3.25 0 0 1 2 16.75v-9.5ZM21.5 17a1.5 1.5 0 0 1 1.5 1.5v.5c0 1.971-1.86 4-5 4-3.14 0-5-2.029-5-4v-.5a1.5 1.5 0 0 1 1.5-1.5h7ZM18 10.5a2.75 2.75 0 1 1 0 5.5 2.75 2.75 0 0 1 0-5.5Z" fill="#000000"/></svg>
\ No newline at end of file diff --git a/assets/icons/color.svg b/assets/icons/color.svg new file mode 100644 index 0000000..8cfce41 --- /dev/null +++ b/assets/icons/color.svg @@ -0,0 +1 @@ +<svg width="24" height="24" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M21.03 2.97a3.578 3.578 0 0 0-5.06 0L14 4.94l-.013-.013a1.75 1.75 0 0 0-2.475 0l-.585.586a1.75 1.75 0 0 0 0 2.474l.012.013-6.78 6.78a2.25 2.25 0 0 0-.659 1.591v.688l-1.28 2.347c-.836 1.533.841 3.21 2.374 2.374l2.347-1.28h.688a2.25 2.25 0 0 0 1.59-.659L16 13.061l.012.012a1.75 1.75 0 0 0 2.475 0l.586-.585a1.75 1.75 0 0 0 0-2.475L19.061 10l1.97-1.97a3.578 3.578 0 0 0 0-5.06ZM12 9.06 14.94 12l-6.78 6.78a.75.75 0 0 1-.531.22H6.75a.75.75 0 0 0-.359.092l-2.515 1.372a.234.234 0 0 1-.159.032.264.264 0 0 1-.138-.075.264.264 0 0 1-.075-.138.234.234 0 0 1 .033-.159l1.372-2.515A.75.75 0 0 0 5 17.25v-.879a.75.75 0 0 1 .22-.53L12 9.061Z" fill="#000000"/></svg>
\ No newline at end of file diff --git a/assets/icons/ponytown.svg b/assets/icons/ponytown.svg new file mode 100644 index 0000000..cb9d7aa --- /dev/null +++ b/assets/icons/ponytown.svg @@ -0,0 +1 @@ +<svg width="24" height="24" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M20.026 12.192a2.002 2.002 0 0 1-.577.598l-6.05 4.084a2.5 2.5 0 0 1-2.798 0l-6.05-4.084a2 2 0 0 1-.779-2.29l6.841 4.56a2.5 2.5 0 0 0 2.613.098l.16-.098 6.841-4.56a1.996 1.996 0 0 1-.201 1.692Zm.201 1.558a1.996 1.996 0 0 1-.778 2.29l-6.05 4.084a2.5 2.5 0 0 1-2.798 0l-6.05-4.084a2 2 0 0 1-.779-2.29l6.841 4.56a2.5 2.5 0 0 0 2.613.098l.16-.098 6.841-4.56Zm-6.84-10.325 6.365 4.243a1 1 0 0 1 0 1.664l-6.365 4.244a2.5 2.5 0 0 1-2.774 0L4.248 9.332a1 1 0 0 1 0-1.664l6.365-4.243a2.5 2.5 0 0 1 2.774 0ZM11.56 4.606l-.116.067L5.705 8.5l5.74 3.828a1 1 0 0 0 .994.066l.116-.066L18.294 8.5l-5.74-3.827a1 1 0 0 0-.993-.067Z" fill="#000000"/></svg>
\ No newline at end of file diff --git a/assets/icons/profiles.svg b/assets/icons/profiles.svg new file mode 100644 index 0000000..4c46935 --- /dev/null +++ b/assets/icons/profiles.svg @@ -0,0 +1 @@ +<svg width="24" height="24" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M21 18.251a2.249 2.249 0 0 0-2.25-2.249H5.25a2.249 2.249 0 1 0 0 4.498h13.5A2.249 2.249 0 0 0 21 18.251Zm-4-6.5a2.249 2.249 0 0 0-2.25-2.249h-9.5a2.25 2.25 0 1 0 0 4.498h9.5A2.249 2.249 0 0 0 17 11.751Zm-4-6.5a2.25 2.25 0 0 0-2.25-2.25l-5.5.001a2.25 2.25 0 0 0 0 4.498h5.5A2.25 2.25 0 0 0 13 5.251Zm6.5 13a.75.75 0 0 1-.75.75H5.25a.75.75 0 0 1 0-1.499h13.5c.415 0 .75.335.75.749Zm-4-6.5a.75.75 0 0 1-.75.75h-9.5a.75.75 0 0 1 0-1.499h9.5c.415 0 .75.335.75.749Zm-4-6.5a.75.75 0 0 1-.75.75h-5.5a.75.75 0 0 1 0-1.5h5.5a.75.75 0 0 1 .75.75Z" fill="#000000"/></svg>
\ No newline at end of file diff --git a/assets/icons/reference.svg b/assets/icons/reference.svg new file mode 100644 index 0000000..76e6ef0 --- /dev/null +++ b/assets/icons/reference.svg @@ -0,0 +1 @@ +<svg width="24" height="24" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M4 6c0-.69.315-1.293.774-1.78.455-.482 1.079-.883 1.793-1.202C7.996 2.377 9.917 2 12 2c2.083 0 4.004.377 5.433 1.018.714.32 1.338.72 1.793 1.202.459.487.774 1.09.774 1.78v12c0 .69-.315 1.293-.774 1.78-.455.482-1.079.883-1.793 1.203C16.004 21.623 14.083 22 12 22c-2.083 0-4.004-.377-5.433-1.017-.714-.32-1.338-.72-1.793-1.203C4.315 19.293 4 18.69 4 18V6Zm1.5 0c0 .207.09.46.365.75.279.296.717.596 1.315.864 1.195.535 2.899.886 4.82.886 1.921 0 3.625-.35 4.82-.886.598-.268 1.036-.568 1.315-.864.275-.29.365-.543.365-.75 0-.207-.09-.46-.365-.75-.279-.296-.717-.596-1.315-.864C15.625 3.851 13.92 3.5 12 3.5c-1.921 0-3.625.35-4.82.886-.598.268-1.036.568-1.315.864-.275.29-.365.543-.365.75Zm13 2.392c-.32.22-.68.417-1.067.59C16.004 9.623 14.083 10 12 10c-2.083 0-4.004-.377-5.433-1.018a6.801 6.801 0 0 1-1.067-.59V18c0 .207.09.46.365.75.279.296.717.596 1.315.864 1.195.535 2.899.886 4.82.886 1.921 0 3.625-.35 4.82-.886.598-.268 1.036-.568 1.315-.864.275-.29.365-.543.365-.75V8.392Z" fill="#000000"/></svg>
\ No newline at end of file diff --git a/assets/logo/equestria.png b/assets/logo/equestria.png Binary files differnew file mode 100644 index 0000000..aecab40 --- /dev/null +++ b/assets/logo/equestria.png diff --git a/assets/uploads/pt-luna.png b/assets/uploads/pt-luna.png Binary files differnew file mode 100644 index 0000000..804690a --- /dev/null +++ b/assets/uploads/pt-luna.png diff --git a/assets/uploads/pt-nightmaremoon.png b/assets/uploads/pt-nightmaremoon.png Binary files differnew file mode 100644 index 0000000..c6ffb3f --- /dev/null +++ b/assets/uploads/pt-nightmaremoon.png diff --git a/assets/uploads/pt-opaline.png b/assets/uploads/pt-opaline.png Binary files differnew file mode 100644 index 0000000..261f40d --- /dev/null +++ b/assets/uploads/pt-opaline.png diff --git a/genqqx.js b/genqqx.js new file mode 100644 index 0000000..a43c109 --- /dev/null +++ b/genqqx.js @@ -0,0 +1,29 @@ +let original = require('./i18n/en.json'); + +function replaceText(source, name) { + console.log(name); + + if (source instanceof Array) { + for (let index in source) { + if (typeof source[index] === "string") { + source[index] = name + ":" + index; + } else if (typeof source[index] === "object") { + source[index] = replaceText(source[index], name + ":" + index); + } + } + } else if (typeof source === "object") { + for (let itemName in source) { + if (typeof source[itemName] === "string") { + source[itemName] = (name + "_" + itemName).toUpperCase(); + } else if (typeof source[itemName] === "object") { + source[itemName] = replaceText(source[itemName], (name + "_" + itemName).toUpperCase()); + } + } + } + + return source; +} + +modified = replaceText(original, "lang"); +modified["_name"] = "en"; +require('fs').writeFileSync("./i18n/qqx.json", JSON.stringify(modified, null, 2));
\ No newline at end of file diff --git a/i18n/en.json b/i18n/en.json new file mode 100644 index 0000000..65ccfce --- /dev/null +++ b/i18n/en.json @@ -0,0 +1,308 @@ +{ + "_french": false, + "_name": "en", + "app": { + "page": "Page not found:", + "file": "File not found" + }, + "details": { + "food": "Food:", + "memory": "Shared memory:", + "food_states": [ + "Not needed", + "Not animals", + "Not meat", + "All" + ], + "memory_states": [ + "None", + "Partial", + "Full" + ] + }, + "footer": { + "copyright": "Equestria.dev Developers", + "update": "Data updated", + "separator": "", + "took": "took", + "failure": "reported 1 failure", + "failures": [ "reported ", " failures" ], + "no_failure": "no failures reported", + "no_update": "not updating" + }, + "fullbanner": { + "visit": [ + "is visiting the", + ", therefore %1 %2 currently not in the " + ] + }, + "member": { + "merge": "Multiple merged members", + "unknown": [ + "Hello there!", + "I'm currently not totally sure who I am (it's a thing that can happen with plurality), but I am using this pony as a temporary identity to stay calm and not panic while I figure out what is going on and who I am.", + "I can either be an existing headmate who cannot work out they are fronting (this can sometimes happen when one of us gets pushed out of front), multiple headmates blurring who cannot work out who we are, or a new pony trying to figure out their identity (this can sometimes take a while).", + "In all cases, feel free to ask!" + ], + "fusion": [ + "Hello there!", + "I'm the result of more than one pony temporarily merging together to the point they are unable to be told apart (this can be done for various reasons). We have not registered this switch for the \"Unknown\" member since this merge is made on purpose.", + "Below is the list of who is merged, we can be either from a single system or from different systems." + ], + "no_fusion": "No members are currently merged." + }, + "navigation": { + "login": "Not logged in", + "admin": "Administrator", + "apps": "Applications", + "debug": "Debugging", + "general": "Global", + "about": "About us", + "subsystems": "Subsystems", + "members": "Members", + "search": "Search in the website..." + }, + "search": { + "title": "Website Search", + "placeholder": "Start typing to search for something on the entire website.", + "categories": [ + "Ponies", + "Pages", + "Actions", + "Documents", + "Toys" + ], + "view": "View page" + }, + "subsystem": { + "fronter": "Fronter:", + "last": "Last fronter:", + "members": "Members:", + "parent": "Parent system:", + "intro": "You are viewing the page of a subsystem of the" + }, + "system": { + "fronter": "Fronter:", + "more": "More than one", + "with": "with", + "last": "Last fronter:", + "members": "Members:", + "traveller": "traveller", + "travellers": "travellers", + "switch": "Last switch:" + }, + "titlebar": { + "top": "Go back to top", + "debug": [ + "Reported failures", + "Processing times" + ], + "subsystem": "Parent system", + "member": "System" + }, + "compare": { + "title": "Compare members of the", + "member": [ + "Member", + "Member", + "Member", + "Member", + "Member", + "Mmbr." + ], + "species": [ + "Species", + "Species", + "Species", + "Species", + "Spec.", + "Spec." + ], + "relations": [ + "Relations", + "Relations", + "Relations", + "Relations", + "Relt.", + "Relt." + ], + "memory": [ + "Memory", + "Memory", + "Memory", + "Memory", + "Mem.", + "Mem." + ], + "fictive": [ + "Fictive", + "Fictive", + "Fictive", + "Fictive", + "Fic.", + "Fic." + ], + "little": [ + "Little", + "Little", + "Little", + "Little", + "Ltl.", + "Ltl." + ], + "protector": [ + "Protector", + "Protector", + "Protect.", + "Protect.", + "Prt.", + "Prt." + ], + "status": [ + "Marefriend", + "Sister", + "Caretaker" + ], + "state": [ + "Yes", + "Partial", + "No", + "Younger", + "Yes, but currently travelling" + ] + }, + "species": { + "earth": [ + "Robot earth pony", + "Earth pony plush", + "Earth pony", + "Earth ponies" + ], + "alicorn": [ + "Robot alicorn", + "Alicorn plush", + "Alicorn", + "Alicorns" + ], + "crystal": [ + "Robot crystal pony", + "Crystal pony plush", + "Crystal pony", + "Crystal ponies" + ], + "pegasus": [ + "Robot pegasus", + "Pegasus plush", + "Pegasus", + "Pegasi" + ], + "batpony": [ + "Robot bat pony", + "Bat pony plush", + "Bat pony", + "Bat ponies" + ], + "unicorn": [ + "Robot unicorn", + "Unicorn plush", + "Unicorn", + "Unicorns" + ] + }, + "history": { + "title": "Front history in the", + "timezone": "Times on this page are shown using your local timezone (%1). Days start at %2 (00:00 on UTC).", + "fallback": "Fallback pony" + }, + "species_compare": { + "title": "%1 members by species" + }, + "tree": { + "title": "System tree for the" + }, + "debug": { + "docs_cleanup": "Deleting scheduled documents", + "important_backup": "Differential backups", + "restore": "Failure protection", + "backups": "Encrypted off-site backups", + "calendar": "Google Calendar integration", + "version": "Version information", + "logo": "Website logo processing", + "favicons": "Favicons processing", + "assets": "External assets download", + "general": "General info about", + "members": "Members in the", + "fronters": "Current fronter(s) in the", + "switches": "Switch history from the", + "in": "in", + "unknown": "Unknown", + "images": "%1's images", + "description": "This page provides debugging information to troubleshoot unexpectedly long update times or reported failures.", + "warning": { + "title": "The data is not updated periodically anymore.", + "intro": "This can be due to multiple things:", + "list": [ + "the data updater has been disabled temporarily for maintenance;", + "the data updater cannot start on the server;", + "the server was down for an extended period of time" + ], + "admin": "If you are an administrator and think this is not normal, you may investigate the issue." + }, + "general_title": "General information", + "time": "Update date:", + "duration": "Total duration:", + "long": "Longest operation:", + "times": "Processing times", + "failures": "Reported failures", + "no_failure": "The data updater has not reported any update failure in the last run.", + "failure": "The following files have failed to update:" + }, + "government": { + "council": [ + "Systems Council", + "-" + ], + "head": [ + "H. S. O.", + "Head of System Operations", + "-" + ], + "protector1": [ + "P. P.", + "Primary Protector", + "-" + ], + "protectors": [ + "Protectors", + "-" + ] + }, + "home": { + "error": "Error:", + "intro": "ponies in 2 plural systems" + }, + "login": { + "title": "Login", + "maintenance": [ + "Login is temporarily disabled.", + "Login on this website has been temporarily disabled by the administrators for maintenance purposes." + ], + "select": "Select how you want to log in to", + "private": [ + "Equestria.dev Private Authentication", + "For website administrators, allows to change content and access private information.", + "Continue" + ] + }, + "page": { + "system": "Invalid system ID", + "page": "Page not found:" + }, + "relations": { + "title": "Relations", + "marefriends": "Marefriends:", + "no": "None", + "sisters": "Sisters:", + "caretakers": "Caretakers:" + } +}
\ No newline at end of file diff --git a/i18n/fr.json b/i18n/fr.json new file mode 100644 index 0000000..65cc9ce --- /dev/null +++ b/i18n/fr.json @@ -0,0 +1,308 @@ +{ + "_french": true, + "_name": "fr", + "app": { + "page": "Page introuvable :", + "file": "Fichier introuvable" + }, + "details": { + "food": "Nourriture :", + "memory": "Mémoire :", + "food_states": [ + "Pas besoin", + "Pas d'animaux", + "Pas de viande", + "TOut" + ], + "memory_states": [ + "Pas partagée", + "Partiellement", + "Partagée" + ] + }, + "footer": { + "copyright": "Développeurs d'Equestria.dev", + "update": "Données mises à jour", + "separator": "", + "took": "cela à pris", + "failure": "1 échec signalé", + "failures": [ "", " échec signalé" ], + "no_failure": "aucun échec signalé", + "no_update": "ne se met pas à jour" + }, + "fullbanner": { + "visit": [ + "visite actuellement", + ", elle n'est donc actuellement pas dans " + ] + }, + "member": { + "merge": "Plusieurs membres fusionnés", + "unknown": [ + "Bonjour !", + "Je ne suis actuellement pas vraiment sure de qui je suis (c'est quelque chose qui peut arriver), mais j'utilise ce poney comme identité temporaire pour rester calme et ne pas paniquer pendant que je détermine ce qu'il se passe et qui je suis.", + "Je peux être soit un membre existant qui ne peut pas savoir qu'elle est au front (ça peut arriver quand l'un d'entre nous se fait pousser en dehors du front), plusieurs membres floutés qui ne peuvent pas déterminer qui ils sont, ou un nouveau membre essayant de trouver son identité (cela peut parfois prendre longtemps).", + "Dans tous les cas, n'hésitez pas à demander !" + ], + "fusion": [ + "Bonjour !", + "Je suis le résultat de plus d'un poney qui fusionnent temporairement ensemble au point qu'ils sont impossible d'être distingués (cela peut se produire pour des raisons variées). Nous n'avons pas enregistré ce switch avec le membre \"Inconnu\" car cette fusion est faite volontairement.", + "Ci-dessous se trouve la liste de qui est fusionné, nous pouvons être soit d'un seul et même système, soit de systèmes différents." + ], + "no_fusion": "Aucun membre n'est actuellement fusionné." + }, + "navigation": { + "login": "Pas connecté", + "admin": "Administrateur", + "apps": "Applications", + "debug": "Débogage", + "general": "Général", + "about": "À propos de nous", + "subsystems": "Sous-systèmes", + "members": "Membres", + "search": "Rechercher sur le site..." + }, + "search": { + "title": "Recherche sur le site", + "placeholder": "Commencez à taper pour rechercher quelque chose sur l'entièreté du site.", + "categories": [ + "Poneys", + "Pages", + "Actions", + "Documents", + "Jouets" + ], + "view": "Voir la page" + }, + "subsystem": { + "fronter": "Fronteuse :", + "last": "Front. préc. :", + "members": "Membres :", + "parent": "Système parent :", + "intro": "Vous lisez la page d'un sous-système de " + }, + "system": { + "fronter": "Fronteuse :", + "more": "Plus d'une", + "with": "avec", + "last": "Front. préc. :", + "members": "Membres :", + "traveller": "voyageur", + "travellers": "voyageurs", + "switch": "Dern. switch :" + }, + "titlebar": { + "top": "Retourner en haut", + "debug": [ + "Échecs signalés", + "Temps de traitement" + ], + "subsystem": "Système parent", + "member": "Système" + }, + "compare": { + "title": "Comparaison des membres de ", + "member": [ + "Membre", + "Membre", + "Membre", + "Membre", + "Membre", + "Memb." + ], + "species": [ + "Espèce", + "Espèce", + "Espèce", + "Espèce", + "Esp.", + "Esp." + ], + "relations": [ + "Relations", + "Relations", + "Relations", + "Relations", + "Relt.", + "Relt." + ], + "memory": [ + "Mémoire", + "Mémoire", + "Mémoire", + "Mémoire", + "Mém.", + "Mém." + ], + "fictive": [ + "Fictive", + "Fictive", + "Fictive", + "Fictive", + "Fic.", + "Fic." + ], + "little": [ + "Petite", + "Petite", + "Petite", + "Petite", + "Pt.", + "Ptt." + ], + "protector": [ + "Protectrice", + "Protectrice", + "Protect.", + "Protect.", + "Prt.", + "Prt." + ], + "status": [ + "Copine", + "Sœur", + "Garde" + ], + "state": [ + "Oui", + "Partiel", + "Non", + "Plus jeune", + "Oui, mais actuellement en voyage" + ] + }, + "species": { + "earth": [ + "Robot poney terrestre", + "Poney terrestre en peluche", + "Poney terrestre", + "Poneys terrestres" + ], + "alicorn": [ + "Robot alicorne", + "Alicorne en peluche", + "Alicorne", + "Alicornes" + ], + "crystal": [ + "Robot poney de crystal", + "Poney de crystal en peluche", + "Poney de crystal", + "Poneys de crystal" + ], + "pegasus": [ + "Robot pégase", + "Pégase en peluche", + "Pégase", + "Pégases" + ], + "batpony": [ + "Robot poney chauve-souris", + "Poney chauve-souris en peluche", + "Poney chauve-souris", + "Poneys chauve-souris" + ], + "unicorn": [ + "Robot licorne", + "Licorne en peluche", + "Licorne", + "Licornes" + ] + }, + "history": { + "title": "Historique de front pour", + "timezone": "Les heures sur cette page utilisent votre fuseau horaire local (%1). Les jours commencent à %2 (00:00 sur l'heure GMT).", + "fallback": "Poney de retrait" + }, + "species_compare": { + "title": "Membres de %1 par espèce" + }, + "tree": { + "title": "Arbre de système pour" + }, + "debug": { + "docs_cleanup": "Suppression de documents programmée", + "important_backup": "Sauvegardes différentielles", + "restore": "Protection contre les échecs", + "backups": "Sauvegardes hors site chiffrées", + "calendar": "Intégration Google Agenda", + "version": "Information de version", + "logo": "Traitement du logo du site", + "favicons": "Traitement des icônes de page", + "assets": "Téléchargement des images externes", + "general": "Informations générales sur", + "members": "Membres de", + "fronters": "Fronteurs actuels dans", + "switches": "Historique de switch dans", + "in": "dans", + "unknown": "Inconnu", + "images": "Images de %1", + "description": "Cette page fournit des informations permettant de diagnostiquer des temps de mise à jour étonnamment longs ou des échecs signalés.", + "warning": { + "title": "Ces données ne sont plus mises à jour régulièrement.", + "intro": "Cela peut-être causé par plusieurs choses :", + "list": [ + "le programme de mise à jour a été temporairement désactivé pour de la maintenance ;", + "le programme de mise à jour ne parvient pas à démarrer sur le serveur ;", + "le serveur était arrêté pour une longue période de temps" + ], + "admin": "Si vous êtes un administrateur et pensez que cela n'est pas normal, vous pouvez investiguer le problème." + }, + "general_title": "Informations générales", + "time": "Date de mise à jour :", + "duration": "Durée totale :", + "long": "Opération la plus longue :", + "times": "Temps de traitement", + "failures": "Échecs signalés", + "no_failure": "Le programme de mise à jour n'a signalé aucun échec lors de la dernière exécution.", + "failure": "Les fichiers suivants n'ont pas pu être mis à jour :" + }, + "government": { + "council": [ + "Conseil des systèmes", + "-" + ], + "head": [ + "T. O. S.", + "Tête des opérations du système", + "-" + ], + "protector1": [ + "P. P.", + "Protectrice principale", + "-" + ], + "protectors": [ + "Protectrices", + "-" + ] + }, + "home": { + "error": "Erreur :", + "intro": "poneys dans 2 systèmes plural" + }, + "login": { + "title": "Connexion", + "maintenance": [ + "La connexion est temporairement désactivée.", + "La connexion sur ce site a été temporairement désactivée par les administrateurs pour des raisons de maintenance." + ], + "select": "Sélectionnez comment vous souhaitez vous connecter à", + "private": [ + "Authentification privée Equestria.dev", + "Pour les administrateurs du site, permet de modifier le contenu et d'accéder aux informations privées.", + "Continuer" + ] + }, + "page": { + "system": "ID de système invalide", + "page": "Page introuvable :" + }, + "relations": { + "title": "Relations", + "marefriends": "Copines :", + "no": "Aucune", + "sisters": "Sœeurs :", + "caretakers": "Gardes :" + } +}
\ No newline at end of file diff --git a/i18n/qqx.json b/i18n/qqx.json new file mode 100644 index 0000000..5f6ffd2 --- /dev/null +++ b/i18n/qqx.json @@ -0,0 +1,314 @@ +{ + "_french": false, + "_name": "en", + "app": { + "page": "LANG_APP_PAGE", + "file": "LANG_APP_FILE" + }, + "details": { + "food": "LANG_DETAILS_FOOD", + "memory": "LANG_DETAILS_MEMORY", + "food_states": [ + "LANG_DETAILS_FOOD_STATES:0", + "LANG_DETAILS_FOOD_STATES:1", + "LANG_DETAILS_FOOD_STATES:2", + "LANG_DETAILS_FOOD_STATES:3" + ], + "memory_states": [ + "LANG_DETAILS_MEMORY_STATES:0", + "LANG_DETAILS_MEMORY_STATES:1", + "LANG_DETAILS_MEMORY_STATES:2" + ] + }, + "footer": { + "copyright": "LANG_FOOTER_COPYRIGHT", + "update": "LANG_FOOTER_UPDATE", + "separator": "LANG_FOOTER_SEPARATOR", + "took": "LANG_FOOTER_TOOK", + "failure": "LANG_FOOTER_FAILURE", + "failures": [ + "LANG_FOOTER_FAILURES:0", + "LANG_FOOTER_FAILURES:1" + ], + "no_failure": "LANG_FOOTER_NO_FAILURE", + "no_update": "LANG_FOOTER_NO_UPDATE" + }, + "fullbanner": { + "visit": [ + "LANG_FULLBANNER_VISIT:0", + "LANG_FULLBANNER_VISIT:1" + ] + }, + "member": { + "merge": "LANG_MEMBER_MERGE", + "unknown": [ + "LANG_MEMBER_UNKNOWN:0", + "LANG_MEMBER_UNKNOWN:1", + "LANG_MEMBER_UNKNOWN:2", + "LANG_MEMBER_UNKNOWN:3" + ], + "fusion": [ + "LANG_MEMBER_FUSION:0", + "LANG_MEMBER_FUSION:1", + "LANG_MEMBER_FUSION:2" + ], + "no_fusion": "LANG_MEMBER_NO_FUSION" + }, + "navigation": { + "login": "LANG_NAVIGATION_LOGIN", + "admin": "LANG_NAVIGATION_ADMIN", + "apps": "LANG_NAVIGATION_APPS", + "debug": "LANG_NAVIGATION_DEBUG", + "general": "LANG_NAVIGATION_GENERAL", + "about": "LANG_NAVIGATION_ABOUT", + "subsystems": "LANG_NAVIGATION_SUBSYSTEMS", + "members": "LANG_NAVIGATION_MEMBERS", + "search": "LANG_NAVIGATION_SEARCH" + }, + "search": { + "title": "LANG_SEARCH_TITLE", + "placeholder": "LANG_SEARCH_PLACEHOLDER", + "categories": [ + "LANG_SEARCH_CATEGORIES:0", + "LANG_SEARCH_CATEGORIES:1", + "LANG_SEARCH_CATEGORIES:2", + "LANG_SEARCH_CATEGORIES:3", + "LANG_SEARCH_CATEGORIES:4" + ], + "view": "LANG_SEARCH_VIEW" + }, + "subsystem": { + "fronter": "LANG_SUBSYSTEM_FRONTER", + "last": "LANG_SUBSYSTEM_LAST", + "members": "LANG_SUBSYSTEM_MEMBERS", + "parent": "LANG_SUBSYSTEM_PARENT", + "intro": "LANG_SUBSYSTEM_INTRO" + }, + "system": { + "fronter": "LANG_SYSTEM_FRONTER", + "more": "LANG_SYSTEM_MORE", + "with": "LANG_SYSTEM_WITH", + "last": "LANG_SYSTEM_LAST", + "members": "LANG_SYSTEM_MEMBERS", + "traveller": "LANG_SYSTEM_TRAVELLER", + "travellers": "LANG_SYSTEM_TRAVELLERS", + "switch": "LANG_SYSTEM_SWITCH" + }, + "titlebar": { + "top": "LANG_TITLEBAR_TOP", + "debug": [ + "LANG_TITLEBAR_DEBUG:0", + "LANG_TITLEBAR_DEBUG:1" + ], + "subsystem": "LANG_TITLEBAR_SUBSYSTEM", + "member": "LANG_TITLEBAR_MEMBER" + }, + "compare": { + "title": "LANG_COMPARE_TITLE", + "member": [ + "LANG_COMPARE_MEMBER:0", + "LANG_COMPARE_MEMBER:1", + "LANG_COMPARE_MEMBER:2", + "LANG_COMPARE_MEMBER:3", + "LANG_COMPARE_MEMBER:4", + "LANG_COMPARE_MEMBER:5" + ], + "species": [ + "LANG_COMPARE_SPECIES:0", + "LANG_COMPARE_SPECIES:1", + "LANG_COMPARE_SPECIES:2", + "LANG_COMPARE_SPECIES:3", + "LANG_COMPARE_SPECIES:4", + "LANG_COMPARE_SPECIES:5" + ], + "relations": [ + "LANG_COMPARE_RELATIONS:0", + "LANG_COMPARE_RELATIONS:1", + "LANG_COMPARE_RELATIONS:2", + "LANG_COMPARE_RELATIONS:3", + "LANG_COMPARE_RELATIONS:4", + "LANG_COMPARE_RELATIONS:5" + ], + "memory": [ + "LANG_COMPARE_MEMORY:0", + "LANG_COMPARE_MEMORY:1", + "LANG_COMPARE_MEMORY:2", + "LANG_COMPARE_MEMORY:3", + "LANG_COMPARE_MEMORY:4", + "LANG_COMPARE_MEMORY:5" + ], + "fictive": [ + "LANG_COMPARE_FICTIVE:0", + "LANG_COMPARE_FICTIVE:1", + "LANG_COMPARE_FICTIVE:2", + "LANG_COMPARE_FICTIVE:3", + "LANG_COMPARE_FICTIVE:4", + "LANG_COMPARE_FICTIVE:5" + ], + "little": [ + "LANG_COMPARE_LITTLE:0", + "LANG_COMPARE_LITTLE:1", + "LANG_COMPARE_LITTLE:2", + "LANG_COMPARE_LITTLE:3", + "LANG_COMPARE_LITTLE:4", + "LANG_COMPARE_LITTLE:5" + ], + "protector": [ + "LANG_COMPARE_PROTECTOR:0", + "LANG_COMPARE_PROTECTOR:1", + "LANG_COMPARE_PROTECTOR:2", + "LANG_COMPARE_PROTECTOR:3", + "LANG_COMPARE_PROTECTOR:4", + "LANG_COMPARE_PROTECTOR:5" + ], + "status": [ + "LANG_COMPARE_STATUS:0", + "LANG_COMPARE_STATUS:1", + "LANG_COMPARE_STATUS:2" + ], + "state": [ + "LANG_COMPARE_STATE:0", + "LANG_COMPARE_STATE:1", + "LANG_COMPARE_STATE:2", + "LANG_COMPARE_STATE:3", + "LANG_COMPARE_STATE:4" + ] + }, + "species": { + "earth": [ + "LANG_SPECIES_EARTH:0", + "LANG_SPECIES_EARTH:1", + "LANG_SPECIES_EARTH:2", + "LANG_SPECIES_EARTH:3" + ], + "alicorn": [ + "LANG_SPECIES_ALICORN:0", + "LANG_SPECIES_ALICORN:1", + "LANG_SPECIES_ALICORN:2", + "LANG_SPECIES_ALICORN:3" + ], + "crystal": [ + "LANG_SPECIES_CRYSTAL:0", + "LANG_SPECIES_CRYSTAL:1", + "LANG_SPECIES_CRYSTAL:2", + "LANG_SPECIES_CRYSTAL:3" + ], + "pegasus": [ + "LANG_SPECIES_PEGASUS:0", + "LANG_SPECIES_PEGASUS:1", + "LANG_SPECIES_PEGASUS:2", + "LANG_SPECIES_PEGASUS:3" + ], + "batpony": [ + "LANG_SPECIES_BATPONY:0", + "LANG_SPECIES_BATPONY:1", + "LANG_SPECIES_BATPONY:2", + "LANG_SPECIES_BATPONY:3" + ], + "unicorn": [ + "LANG_SPECIES_UNICORN:0", + "LANG_SPECIES_UNICORN:1", + "LANG_SPECIES_UNICORN:2", + "LANG_SPECIES_UNICORN:3" + ] + }, + "history": { + "title": "LANG_HISTORY_TITLE", + "timezone": "LANG_HISTORY_TIMEZONE", + "fallback": "LANG_HISTORY_FALLBACK" + }, + "species_compare": { + "title": "LANG_SPECIES_COMPARE_TITLE" + }, + "tree": { + "title": "LANG_TREE_TITLE" + }, + "alphabet": { + "title": "LANG_ALPHABET_TITLE" + }, + "debug": { + "docs_cleanup": "LANG_DEBUG_DOCS_CLEANUP", + "important_backup": "LANG_DEBUG_IMPORTANT_BACKUP", + "restore": "LANG_DEBUG_RESTORE", + "backups": "LANG_DEBUG_BACKUPS", + "calendar": "LANG_DEBUG_CALENDAR", + "version": "LANG_DEBUG_VERSION", + "logo": "LANG_DEBUG_LOGO", + "favicons": "LANG_DEBUG_FAVICONS", + "assets": "LANG_DEBUG_ASSETS", + "general": "LANG_DEBUG_GENERAL", + "members": "LANG_DEBUG_MEMBERS", + "fronters": "LANG_DEBUG_FRONTERS", + "switches": "LANG_DEBUG_SWITCHES", + "in": "LANG_DEBUG_IN", + "unknown": "LANG_DEBUG_UNKNOWN", + "images": "LANG_DEBUG_IMAGES", + "description": "LANG_DEBUG_DESCRIPTION", + "warning": { + "title": "LANG_DEBUG_WARNING_TITLE", + "intro": "LANG_DEBUG_WARNING_INTRO", + "list": [ + "LANG_DEBUG_WARNING_LIST:0", + "LANG_DEBUG_WARNING_LIST:1", + "LANG_DEBUG_WARNING_LIST:2" + ], + "admin": "LANG_DEBUG_WARNING_ADMIN" + }, + "general_title": "LANG_DEBUG_GENERAL_TITLE", + "time": "LANG_DEBUG_TIME", + "duration": "LANG_DEBUG_DURATION", + "long": "LANG_DEBUG_LONG", + "times": "LANG_DEBUG_TIMES", + "failures": "LANG_DEBUG_FAILURES", + "no_failure": "LANG_DEBUG_NO_FAILURE", + "failure": "LANG_DEBUG_FAILURE" + }, + "government": { + "council": [ + "LANG_GOVERNMENT_COUNCIL:0", + "LANG_GOVERNMENT_COUNCIL:1" + ], + "head": [ + "LANG_GOVERNMENT_HEAD:0", + "LANG_GOVERNMENT_HEAD:1", + "LANG_GOVERNMENT_HEAD:2" + ], + "protector1": [ + "LANG_GOVERNMENT_PROTECTOR1:0", + "LANG_GOVERNMENT_PROTECTOR1:1", + "LANG_GOVERNMENT_PROTECTOR1:2" + ], + "protectors": [ + "LANG_GOVERNMENT_PROTECTORS:0", + "LANG_GOVERNMENT_PROTECTORS:1" + ] + }, + "home": { + "error": "LANG_HOME_ERROR", + "intro": "LANG_HOME_INTRO" + }, + "login": { + "title": "LANG_LOGIN_TITLE", + "maintenance": [ + "LANG_LOGIN_MAINTENANCE:0", + "LANG_LOGIN_MAINTENANCE:1" + ], + "select": "LANG_LOGIN_SELECT", + "private": [ + "LANG_LOGIN_PRIVATE:0", + "LANG_LOGIN_PRIVATE:1", + "LANG_LOGIN_PRIVATE:2" + ] + }, + "page": { + "system": "LANG_PAGE_SYSTEM", + "page": "LANG_PAGE_PAGE" + }, + "relations": { + "title": "LANG_RELATIONS_TITLE", + "marefriends": "LANG_RELATIONS_MAREFRIENDS", + "no": "LANG_RELATIONS_NO", + "sisters": "LANG_RELATIONS_SISTERS", + "caretakers": "LANG_RELATIONS_CARETAKERS" + } +}
\ No newline at end of file diff --git a/includes/ai.inc b/includes/ai.inc deleted file mode 100644 index 8f5f7ba..0000000 --- a/includes/ai.inc +++ /dev/null @@ -1,311 +0,0 @@ -<?php - -global $memberData; -global $metadata; -global $systemCommonName; -global $system; - -$profile = [ - hexdec(substr(md5($memberData["id"]), 0, 1)), - hexdec(substr(sha1($memberData["id"]), 0, 1)), - hexdec(substr(md5(strrev($memberData["id"])), 0, 1)), - hexdec(substr(sha1(strrev($memberData["id"])), 0, 1)), - hexdec(substr(md5(strtoupper($memberData["id"])), 0, 1)), - hexdec(substr(sha1(strtoupper($memberData["id"])), 0, 1)), - hexdec(substr(md5(strtoupper(strrev($memberData["id"]))), 0, 1)), - hexdec(substr(sha1(strtoupper(strrev($memberData["id"]))), 0, 1)), -]; - -if (!function_exists("component")) { - function component(int $parts, int $num, int $index = 0): bool { - global $profile; - - $item = round(15 / $parts); - $split = (int)round($profile[$index] / $item); - - return $split === $num; - } -} - -if (!function_exists("shouldHaveAn")) { - function shouldHaveAn(string $str): bool { - if (in_array(substr(strtolower($str), 0, 1), ["a", "e", "i", "o", "u", "y", "h"])) { - return true; - } else { - return false; - } - } -} - -if (!function_exists("getSpeciesName")) { - function getSpeciesName(string $species, bool $canHaveMareSuffix = false): string { - global $metadata; - - return match ($species) { - "earth" => $metadata["robot"] ? - "robot earth pony" : - (!$metadata["plush"] ? "earth pony" . (component(2, 2) && $canHaveMareSuffix ? " mare" : "") : - "earth pony" . (component(2, 2) && $canHaveMareSuffix ? " mare" : "") . " plush"), - "alicorn" => $metadata["robot"] ? - "robot alicorn" : - (!$metadata["plush"] ? "alicorn" . (component(2, 2) && $canHaveMareSuffix ? " mare" : "") : - "alicorn" . (component(2, 2) && $canHaveMareSuffix ? " mare" : "") . " plush"), - "crystal" => $metadata["robot"] ? - "robot crystal pony" : - (!$metadata["plush"] ? "crystal pony" : - "crystal pony plush"), - "pegasus" => $metadata["robot"] ? - "robot pegasus" : - (!$metadata["plush"] ? "pegasus" . (component(2, 2) && $canHaveMareSuffix ? " mare" : "") : - "pegasus" . (component(2, 2) && $canHaveMareSuffix ? " mare" : "") . " plush"), - "batpony" => $metadata["robot"] ? - "robot batpony" : - (!$metadata["plush"] ? "batpony" . (component(2, 2) && $canHaveMareSuffix ? " mare" : "") : - "batpony" . (component(2, 2) && $canHaveMareSuffix ? " mare" : "") . " plush"), - "unicorn" => $metadata["robot"] ? - "robot unicorn" : - (!$metadata["plush"] ? "unicorn" . (component(2, 2) && $canHaveMareSuffix ? " mare" : "") : - "unicorn" . (component(2, 2) && $canHaveMareSuffix ? " mare" : "") . " plush"), - default => $species . "_" . $metadata["robot"] - }; - } -} - -if (!function_exists("listing")) { - function listing(array $list): string { - $out = ""; - - foreach (array_values($list) as $index => $value) { - $mem = getSystemMember(explode("/", $value)[0], explode("/", $value)[1]); - $value = "<a href='/" . $mem["name"] . "'>" . getMiniName($mem["display_name"] ?? $mem["name"]) . "</a>"; - - if ($index === 0) { - $out = $value; - } else if ($index < count(array_values($list)) - 1) { - $out .= ", " . $value; - } else { - $out .= " and " . $value; - } - } - - return $out; - } -} - -$iam = 0; -$multipleNames = count(explode("/", $memberData["display_name"])) > 1; - -$otherNames = explode("/", $memberData["display_name"]); -array_shift($otherNames); - -if ($memberData["name"] === "scootaloo" && ((int)date('N') - 1) % 2 === 0) { - $metadata["marefriends"] = array_reverse($metadata["marefriends"]); -} - -?> - -<!-- Intro --> -<p> -<?php if (component(4, 1)): ?> - Hello, -<?php elseif (component(4, 2)): ?> - Hi, -<?php elseif (component(4, 3)): ?> - Hey, -<?php else: ?> - Hey there!</p><p> -<?php endif; ?> - -<!-- Name --> -<?= component(3, 2, 2) ? (component(4, 4) ? "My name is" : "my name is") : (component(3, 1, 2) ? "I am" : "I'm") ?> <?= explode("/", $memberData["display_name"] ?? $memberData["name"])[0] ?><?= $multipleNames && component(2, 1, 4) ? " (or " . implode("/", $otherNames) . ")" : "" ?>, - -<!-- Role --> -<?= component(2, 2, 1) ? "I'm " : "I am " ?><?php $iam++; ?> -<?php if ($metadata["host"]): ?>the most common fronter -<?php elseif ($metadata["protector"]): ?>a protector -<?php else: ?><?= component(2, 2, 0) ? "part" : "a member" ?> <?php endif; ?> -of the <a href="/<?= $system ?>"><?= $systemCommonName ?></a>,<?php if (isset($metadata["median"])): ?> - <?php if ($metadata["little"] > 0): $source = getMember($metadata["median"]); ?><?php $iam++; ?><?= component(2, 2, 2) ? "I'm " : "I am " ?><?php $iam++; ?><?= component(2, 2, 4) ? "an age regressed version of" : "age regressed from" ?> <a href="/<?= $source["name"] ?>"><?= getMiniName($source["display_name"] ?? $source["name"]) ?></a>,<?php endif; ?> -<?php endif; ?> <?= ($iam >= 3) ? "and" : (component(2, 2, 1) ? "I'm" : "I am") ?><?php $iam++; ?> - -<!-- Species --> -<?php if ($iam >= 3 && component(2, 1, 4)): ?>also <?php endif; ?> -<?php if (count($metadata["species"]) === 2): ?> -<?= component(2, 1) ? "both " : "" ?>a<?= shouldHaveAn(getSpeciesName($metadata["species"][0])) ? "n" : "" ?> <?= getSpeciesName($metadata["species"][0]) ?> and a<?= shouldHaveAn(getSpeciesName($metadata["species"][1])) ? "n" : "" ?> <?= getSpeciesName($metadata["species"][1], true) ?> -<?php elseif (count($metadata["species"]) === 3): ?> -a<?= shouldHaveAn(getSpeciesName($metadata["species"][0])) ? "n" : "" ?> <?= getSpeciesName($metadata["species"][0]) ?>, a<?= shouldHaveAn(getSpeciesName($metadata["species"][1])) ? "n" : "" ?> <?= getSpeciesName($metadata["species"][1]) ?> and a<?= shouldHaveAn(getSpeciesName($metadata["species"][2])) ? "n" : "" ?> <?= getSpeciesName($metadata["species"][2], true) ?> -<?php else: ?> -a<?= shouldHaveAn(getSpeciesName($metadata["species"][0])) ? "n" : "" ?> <?= getSpeciesName($metadata["species"][0], true) ?><?php endif; ?><?php if ($iam >= 3 && component(2, 2, 4)): ?> too<?php endif; ?><!-- Pronouns --><?php if (isset($memberData["pronouns"]) && $memberData["pronouns"] !== "she/her"): ?> -, <?= component(3, 1, 3) ? "I use " . $memberData["pronouns"] . " pronouns" : (component(3, 2, 3) ? "my pronouns are " . $memberData["pronouns"] : "I go with " . $memberData["pronouns"]) ?> -<?php endif; ?>. - -</p> - -<p> -<!-- Shared memory --> -<?php $iamFacts = 0; $factGiven = false; if ($metadata["shared_memory"] === 1): ?> - <?php $factGiven = true; - if (component(3, 1, 4)): ?> - Depending on the circumstances, I may not share memories with my headmates - <?php elseif (component(3, 2, 4)): ?> - I may not share memories with my headmates depending on the circumstances - <?php else: ?> - I sometimes <?= component(2, 2, 1) ? "don't" : "do not" ?> share memories with my headmates - <?php endif; ?> -<?php elseif ($metadata["shared_memory"] === 0): ?> - <?php $factGiven = true; - if (component(3, 1, 4)): ?> - I <?= component(2, 2, 1) ? "don't" : "do not" ?> share memories with my headmates - <?php elseif (component(3, 2, 4)): ?> - I <?= component(2, 2, 1) ? "don't" : "do not" ?> have access to my headmates' memories - <?php else: ?> - I <?= component(2, 2, 1) ? "can't" : "cannot" ?> have access to my headmates' memories - <?php endif; ?> -<?php endif; ?> - -<!-- Fictive --> -<?php if ($metadata["fictive"]): ?> - <?php if (component(3, 1, 5)): ?><?= $factGiven ? " and" : ""?> - <?= component(2, 2, 0) ? "I'm" : "I am" ?><?php $iamFacts++; ?> a fictive - <?php elseif (component(3, 2, 5)): ?><?= $factGiven ? " and" : ""?> - <?= component(2, 2, 0) ? "I'm" : "I am" ?><?php $iamFacts++; ?> from Equestria - <?php else: ?><?= $factGiven ? " and" : ""?> - I come from Equestria - <?php endif; ?> -<?php $factGiven = true; endif; ?> - -<!-- Less frequent --> -<?php if ($metadata["less_frequent"]): ?> - <?php if (component(3, 1, 5)): ?><?= $factGiven ? " and" : ""?> - <?= component(2, 2, 0) ? "I'm" : "I am" ?><?php $iamFacts++; ?> fronting less often - <?php elseif (component(3, 2, 5)): ?><?= $factGiven ? " and" : ""?> - <?= component(2, 2, 0) ? "I'm" : "I am" ?><?php $iamFacts++; ?> less often at front - <?php else: ?><?= $factGiven ? " and" : ""?> - I like to front less often - <?php endif; ?> -<?php $factGiven = true; endif; ?> - -<!-- Non verbal IRL --> -<?php if ($metadata["nonverbal"]): ?> - <?php if (component(3, 1, 5)): ?><?= $factGiven ? " and" : ""?> - <?= component(2, 2, 0) ? "I'm" : "I am" ?><?php $iamFacts++; ?> nonverbal in real life - <?php elseif (component(3, 2, 5)): ?><?= $factGiven ? " and" : ""?> - <?= component(2, 2, 0) ? "I'm" : "I am" ?><?php $iamFacts++; ?> not talking in real life - <?php else: ?><?= $factGiven ? " and" : ""?> - I don't talk in real life - <?php endif; ?> -<?php $factGiven = true; endif; ?> - -<!-- Age regression --> -<?php if ($metadata["little"] === 1): ?> - <?php if (component(3, 1, 5)): ?><?= $factGiven ? " and" : ""?> - <?php if ($iamFacts > 0): ?><?php else: ?><?= component(2, 2, 0) ? "I'm" : "I am" ?><?php $iamFacts++; endif; ?> - an age regressor - <?php elseif (component(3, 2, 5)): ?><?= $factGiven ? " and" : ""?> - <?php if ($iamFacts > 0): ?><?php else: ?><?= component(2, 2, 0) ? "I'm" : "I am" ?><?php $iamFacts++; endif; ?> - capable of age regression - <?php else: ?><?= $factGiven ? " and" : ""?> - I can age regress - <?php endif; ?> -<?php $factGiven = true; endif; ?> - -<!-- Younger --> -<?php if ($metadata["little"] === 3): ?> - <?php if (component(3, 1, 5)): ?><?= $factGiven ? " and" : ""?> - <?php if ($iamFacts > 0): ?><?php else: ?><?= component(2, 2, 0) ? "I'm" : "I am" ?><?php $iamFacts++; endif; ?> - younger than the body is - <?php elseif (component(3, 2, 5)): ?><?= $factGiven ? " and" : ""?> - <?php if ($iamFacts > 0): ?><?php else: ?><?= component(2, 2, 0) ? "I'm" : "I am" ?><?php $iamFacts++; endif; ?> - younger but not enough to be considered a little - <?php else: ?><?= $factGiven ? " and" : ""?> - I feel <?= component(2, 2, 5) ? "kinda" : "kind of" ?> younger than my headmates - <?php endif; ?> -<?php $factGiven = true; endif; ?> - -<!-- Age spells --> -<?php if ($metadata["age_spells"] && $metadata["little"] !== 1 && !(isset($metadata["median"]) && $metadata["little"] > 0)): ?> - <?php if (component(3, 1, 4)): ?><?= $factGiven ? " and" : ""?> - <?php if ($iamFacts > 0): ?><?php else: ?><?= component(2, 2, 0) ? "I'm" : "I am" ?><?php $iamFacts++; endif; ?> - affected by spells to make me feel younger - <?php elseif (component(3, 2, 4)): ?><?= $factGiven ? " and" : ""?> - <?php if ($iamFacts > 0): ?><?php else: ?><?= component(2, 2, 0) ? "I'm" : "I am" ?><?php $iamFacts++; endif; ?> - affected by age spells - <?php else: ?><?= $factGiven ? " and" : ""?> - age regression spells can affect me - <?php endif; ?> -<?php $factGiven = true; endif; ?> - -<!-- Little --> -<?php if ($metadata["little"] === 2): ?> - <?php if (component(3, 1, 5)): ?><?= $factGiven ? " and" : ""?> - <?php if ($iamFacts > 0): ?><?php else: ?><?= component(2, 2, 0) ? "I'm" : "I am" ?><?php $iamFacts++; endif; ?> - a lot younger than the body is - <?php elseif (component(3, 2, 5)): ?><?= $factGiven ? " and" : ""?> - <?php if ($iamFacts > 0): ?><?php else: ?><?= component(2, 2, 0) ? "I'm" : "I am" ?><?php $iamFacts++; endif; ?> - a little - <?php else: ?><?= $factGiven ? " and" : ""?> - I feel a lot younger than my headmates - <?php endif; ?> -<?php $factGiven = true; endif; ?> - -</p> - -<p> - -<!-- Marefriends --> -<?php $factGiven = false; $iamFacts = 0; if (count($metadata["marefriends"]) > 0): ?> - <?php if (component(4, 1, 5)): ?><?= $factGiven ? " and" : ""?> - <?php if ($iamFacts > 0): ?><?php else: ?><?= component(2, 2, 0) ? "I'm" : "I am" ?><?php $iamFacts++; endif; ?> - <?php if (count($metadata["marefriends"]) > 1): ?>in relationships with<?php else: ?>in a relationship with<?php endif; ?> <?= listing($metadata["marefriends"]) ?> - <?php elseif (component(4, 2, 5)): ?><?= $factGiven ? " and" : ""?> - <?php if ($iamFacts > 0): ?><?php else: ?><?php endif; ?> - <?php if (count($metadata["marefriends"]) > 1): ?>My marefriends are<?php else: ?>My marefriend is<?php endif; ?> <?= listing($metadata["marefriends"]) ?> - <?php elseif (component(4, 3, 5)): ?><?= $factGiven ? " and" : ""?> - <?php if ($iamFacts > 0): ?><?php else: ?><?php endif; ?> - <?= listing($metadata["marefriends"]) ?> <?php if (count($metadata["marefriends"]) > 1): ?>are my marefriends<?php else: ?>is my marefriend<?php endif; ?> - <?php else: ?><?= $factGiven ? " and" : ""?> - I love <?= listing($metadata["marefriends"]) ?> - <?php endif; ?> -<?php $factGiven = true; endif; ?> - -<!-- Sisters --> -<?php if (count($metadata["sisters"]) > 0): ?> - <?php if (component(4, 1, 5)): ?><?= $factGiven ? " and" : ""?> - <?php if ($iamFacts > 0): ?><?php else: ?><?= component(2, 2, 0) ? "I'm" : "I am" ?><?php $iamFacts++; endif; ?> - <?php if (count($metadata["sisters"]) > 1): ?>in relationships with<?php else: ?>in a relationship with<?php endif; ?> <?= listing($metadata["sisters"]) ?> - <?php elseif (component(4, 2, 5)): ?><?= $factGiven ? " and" : ""?> - <?php if ($iamFacts > 0): ?><?php else: ?><?php endif; ?> - <?= $factGiven ? "my" : "My"?><?php if (count($metadata["sisters"]) > 1): ?> sisters are<?php else: ?> sister is<?php endif; ?> <?= listing($metadata["sisters"]) ?> - <?php elseif (component(4, 3, 5)): ?><?= $factGiven ? " and" : ""?> - <?php if ($iamFacts > 0): ?><?php else: ?><?php endif; ?> - <?= listing($metadata["sisters"]) ?> <?php if (count($metadata["sisters"]) > 1): ?>are my sisters<?php else: ?>is my sister<?php endif; ?> - <?php else: ?><?= $factGiven ? " and" : ""?> - <?php if ($factGiven): ?> - I also love <?= listing($metadata["sisters"]) ?> as sister<?php if (count($metadata["sisters"]) > 1): ?>s<?php endif; ?> - <?php else: ?> - <?= listing($metadata["sisters"]) ?> <?php if (count($metadata["sisters"]) > 1): ?>are my family<?php else: ?>is my family<?php endif; ?> - <?php endif; ?> - <?php endif; ?> -<?php $factGiven = true; endif; ?> - -<!-- Caretakers --> -<?php if (count($metadata["caretakers"]) > 0): ?> - <?php if (component(4, 1, 5)): ?><?= $factGiven ? " and" : ""?> - <?php if ($iamFacts > 0): ?><?php else: ?><?= component(2, 2, 0) ? "I'm" : "I am" ?><?php $iamFacts++; endif; ?> - being taken care of by <?= listing($metadata["caretakers"]) ?> - <?php elseif (component(4, 2, 5)): ?><?= $factGiven ? " and" : ""?> - <?php if ($iamFacts > 0): ?><?php else: ?><?php endif; ?> - <?= $factGiven ? "the" : "The"?><?php if (count($metadata["caretakers"]) > 1): ?> mares who take care of me are<?php else: ?> mare who takes care of me is<?php endif; ?> <?= listing($metadata["caretakers"]) ?> - <?php elseif (component(4, 3, 5)): ?><?= $factGiven ? " and" : ""?> - <?php if ($iamFacts > 0): ?><?php else: ?><?php endif; ?> - <?= listing($metadata["caretakers"]) ?> <?php if (count($metadata["caretakers"]) > 1): ?>are my caretakers<?php else: ?>is my caretaker<?php endif; ?> - <?php else: ?><?= $factGiven ? " and" : ""?> - <?php if ($factGiven): ?> - I like having <?= listing($metadata["caretakers"]) ?> take care of me - <?php else: ?> - <?= listing($metadata["caretakers"]) ?> take care of me - <?php endif; ?> - <?php endif; ?> -<?php $factGiven = true; endif; ?> - -</p>
\ No newline at end of file diff --git a/includes/assets.inc b/includes/assets.inc index 3f9971a..05296ce 100644 --- a/includes/assets.inc +++ b/includes/assets.inc @@ -13,7 +13,6 @@ function downloadAssets($system) { echo(" /avatars/$id.webp\n"); file_put_contents("/tmp/img." . pathinfo($general['avatar_url'], PATHINFO_EXTENSION), file_get_contents($general['avatar_url'])); exec("convert -resize 512x512 \"" . "/tmp/img." . pathinfo($general['avatar_url'], PATHINFO_EXTENSION) . "\" ../assets/avatars/" . $id . ".webp"); - exec("convert -resize 512x512 \"" . "/tmp/img." . pathinfo($general['avatar_url'], PATHINFO_EXTENSION) . "\" ../assets/uploads/" . ($id === "gdapd" ? "raindrops" : "cloudburst") . ".png"); unlink("/tmp/img." . pathinfo($general['avatar_url'], PATHINFO_EXTENSION)); } diff --git a/includes/banner.inc b/includes/banner.inc index e1b06be..d62ba97 100644 --- a/includes/banner.inc +++ b/includes/banner.inc @@ -1,6 +1,6 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn; global $lang; global $pages; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/pronouns.inc"; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.inc"; @@ -47,6 +47,9 @@ function getMemberBannerData(string $id, string $system, bool $french = false) { global $subsystems; global $travelling; global $isLoggedIn; + global $lang; + + $french = $lang["_french"]; $subsystems = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/subsystems/$system.json"), true) ?? []; @@ -188,7 +191,7 @@ function getMemberBannerData(string $id, string $system, bool $french = false) { ]; } - if ($travelling[$member['id']]["travelling"]) { + if ($travelling[$member['id']]["travelling"] && !$travelling[$member['id']]["equestria"]) { $systemData['page'] = "/" . ($system === "gdapd" ? "cloudburst" : "raindrops"); $systemData['icon'] = ($system === "gdapd" ? "cloudburst" : "raindrops") . ".png"; $systemData['name'] = $system === "gdapd" ? "Cloudburst" : "Raindrops"; @@ -197,6 +200,16 @@ function getMemberBannerData(string $id, string $system, bool $french = false) { $systemData['temporary'] = true; } + + if ($travelling[$member['id']]["travelling"] && $travelling[$member['id']]["equestria"]) { + $systemData['page'] = null; + $systemData['icon'] = "../logo/equestria.png"; + $systemData['name'] = "Equestria"; + $systemData['full_name'] = "Equestria"; + $systemData['subsystem'] = null; + $systemData['temporary'] = true; + } + $marefriends = []; foreach ($metadata["marefriends"] as $marefriend) { $mfSystem = explode("/", $marefriend)[0]; @@ -268,7 +281,7 @@ function getMemberBannerData(string $id, string $system, bool $french = false) { "html" => ( $french ? - '<span data-bs-toggle="tooltip" data-bs-html="true" title="<b>Fronteuse la plus présente</b><br>' . ucfirst(getMemberPronouns($member['pronouns'])["subjective"]) . ' ' . (getMemberPronouns($member['pronouns'])["third"] ? "is" : "are") . ' the one who fronts the most often in ' . getMemberPronouns($member['pronouns'])["possessive_det"] . ' system." class="badge rounded-pill bg-primary">Fronteuse la plus présente</span>' + '<span data-bs-toggle="tooltip" data-bs-html="true" title="<b>Fronteuse la plus présente</b><br>Elle est le membre qui fronte le plus dans son système." class="badge rounded-pill bg-primary">Fronteuse la plus présente</span>' : '<span data-bs-toggle="tooltip" data-bs-html="true" title="<b>Most common fronter</b><br>' . ucfirst(getMemberPronouns($member['pronouns'])["subjective"]) . ' ' . (getMemberPronouns($member['pronouns'])["third"] ? "is" : "are") . ' the one who fronts the most often in ' . getMemberPronouns($member['pronouns'])["possessive_det"] . ' system." class="badge rounded-pill bg-primary">Most common fronter</span>' ) @@ -276,13 +289,13 @@ function getMemberBannerData(string $id, string $system, bool $french = false) { } } - if (($metadata["age_spells"] ?? false) && !$french) { + /*if (($metadata["age_spells"] ?? false) && !$french) { $badges[] = [ "id" => "age_spells", "color" => "#6f42c1", "html" => '<span data-bs-toggle="tooltip" data-bs-html="true" title="<b>Affected by age spells</b><br>' . ucfirst(getMemberPronouns($member['pronouns'])["subjective"]) . ' can feel younger than ' . getMemberPronouns($member['pronouns'])["subjective"] . ' actually ' . (getMemberPronouns($member['pronouns'])["third"] ? "is" : "are") . ' when somepony else casts an age spell on ' . getMemberPronouns($member['pronouns'])["object"] . '." class="badge rounded-pill" style="background-color: #6f42c1;">Affected by age spells</span>' ]; - } + }*/ if ($metadata["fictive"] ?? false) { $badges[] = [ @@ -291,18 +304,38 @@ function getMemberBannerData(string $id, string $system, bool $french = false) { "html" => ( $french ? - '<span data-bs-toggle="tooltip" data-bs-html="true" title="<b>Fictive</b><br>' . ucfirst(getMemberPronouns($member['pronouns'])["subjective"]) . ' ' . (getMemberPronouns($member['pronouns'])["third"] ? "is" : "are") . ' based on the personality, look and behavior of a character that is fictional in this world." class="badge rounded-pill bg-info">Fictive</span>' + '<span data-bs-toggle="tooltip" data-bs-html="true" title="<b>Fictive</b><br>Elle est basée sur la personnalité, apparence et comportement d\'un personnage qui est fictif dans ce monde." class="badge rounded-pill bg-info">Fictive</span>' : '<span data-bs-toggle="tooltip" data-bs-html="true" title="<b>Fictive</b><br>' . ucfirst(getMemberPronouns($member['pronouns'])["subjective"]) . ' ' . (getMemberPronouns($member['pronouns'])["third"] ? "is" : "are") . ' based on the personality, look and behavior of a character that is fictional in this world." class="badge rounded-pill bg-info">Fictive</span>' ) ]; } + if ($metadata["persecutor"] ?? false) { + $badges[] = [ + "id" => "persecutor", + "color" => "danger", + "html" => ( + $french + ? + '<span data-bs-toggle="tooltip" data-bs-html="true" title="<b>Persécutrice</b><br>Elle se comporte de façon nuisible à l\'égart des autres ou des autres membres du système, potentiellement comme une tentative malavisée de protéger le système." class="badge rounded-pill bg-danger">Persécutrice</span>' + : + '<span data-bs-toggle="tooltip" data-bs-html="true" title="<b>Persecutor</b><br>' . ucfirst(getMemberPronouns($member['pronouns'])["subjective"]) . ' ' . (getMemberPronouns($member['pronouns'])["third"] ? "acts" : "act") . ' harmfully towards other system members and/or others, potentially as a misguided attempt to protect the system." class="badge rounded-pill bg-danger">Persecutor</span>' + ) + ]; + } + if ($metadata["less_frequent"] ?? false) { $badges[] = [ "id" => "nonverbal", "color" => "#fd7e14", - "html" => '<span data-bs-toggle="tooltip" data-bs-html="true" title="<b>Fronts less often</b><br>' . ucfirst(getMemberPronouns($member['pronouns'])["subjective"]) . ' ' . (getMemberPronouns($member['pronouns'])["third"] ? "front" : "fronts") . ' less often than ' . getMemberPronouns($member['pronouns'])["possessive_det"] . ' headmates, this can due to various reasons." class="badge rounded-pill" style="background-color:#fd7e14;">Fronts less often</span>' + "html" => ( + $french + ? + '<span data-bs-toggle="tooltip" data-bs-html="true" title="<b>Fronts less often</b><br>' . ucfirst(getMemberPronouns($member['pronouns'])["subjective"]) . ' ' . (getMemberPronouns($member['pronouns'])["third"] ? "front" : "fronts") . ' less often than ' . getMemberPronouns($member['pronouns'])["possessive_det"] . ' headmates, this can due to various reasons." class="badge rounded-pill" style="background-color:#fd7e14;">Fronte moins souvent</span>' + : + '<span data-bs-toggle="tooltip" data-bs-html="true" title="<b>Fronts less often</b><br>' . ucfirst(getMemberPronouns($member['pronouns'])["subjective"]) . ' ' . (getMemberPronouns($member['pronouns'])["third"] ? "front" : "fronts") . ' less often than ' . getMemberPronouns($member['pronouns'])["possessive_det"] . ' headmates, this can due to various reasons." class="badge rounded-pill" style="background-color:#fd7e14;">Fronts less often</span>' + ) ]; } @@ -310,7 +343,13 @@ function getMemberBannerData(string $id, string $system, bool $french = false) { $badges[] = [ "id" => "nonverbal", "color" => "#20c997", - "html" => '<span data-bs-toggle="tooltip" data-bs-html="true" title="<b>Non verbal IRL</b><br>' . ucfirst(getMemberPronouns($member['pronouns'])["subjective"]) . ' ' . (getMemberPronouns($member['pronouns'])["third"] ? "is" : "are") . ' non verbal in real life, although text communication is still possible." class="badge rounded-pill" style="background-color:#20c997;">Non verbal IRL</span>' + "html" => ( + $french + ? + '<span data-bs-toggle="tooltip" data-bs-html="true" title="<b>Non verbale dans la réalité</b><br>' . ucfirst(getMemberPronouns($member['pronouns'])["subjective"]) . ' ' . (getMemberPronouns($member['pronouns'])["third"] ? "is" : "are") . ' non verbal in real life, although text communication is still possible." class="badge rounded-pill" style="background-color:#20c997;">Non verbal IRL</span>' + : + '<span data-bs-toggle="tooltip" data-bs-html="true" title="<b>Non verbal IRL</b><br>' . ucfirst(getMemberPronouns($member['pronouns'])["subjective"]) . ' ' . (getMemberPronouns($member['pronouns'])["third"] ? "is" : "are") . ' non verbal in real life, although text communication is still possible." class="badge rounded-pill" style="background-color:#20c997;">Non verbal IRL</span>' + ) ]; } @@ -330,6 +369,20 @@ function getMemberBannerData(string $id, string $system, bool $french = false) { ]; } + if (($metadata["leader"] ?? false) && $isLoggedIn) { + $badges[] = [ + "id" => "leader", + "color" => "d6a833", + "html" => ( + $french + ? + '<span data-bs-toggle="tooltip" data-bs-html="true" title="<b>Leader</b><br>' . ucfirst(getMemberPronouns($member['pronouns'])["subjective"]) . ' ' . (getMemberPronouns($member['pronouns'])["third"] ? "is" : "are") . ' a leader in ' . getMemberPronouns($member['pronouns'])["possessive_det"] . ' system." class="badge rounded-pill" style="background-color:#fd7e14;">Dirigeante</span>' + : + '<span data-bs-toggle="tooltip" data-bs-html="true" title="<b>Leader</b><br>' . ucfirst(getMemberPronouns($member['pronouns'])["subjective"]) . ' ' . (getMemberPronouns($member['pronouns'])["third"] ? "is" : "are") . ' a leader in ' . getMemberPronouns($member['pronouns'])["possessive_det"] . ' system." class="badge rounded-pill" style="background-color:#fd7e14;">Leader</span>' + ) + ]; + } + if ($metadata["protector"] ?? false) { $badges[] = [ "id" => "protector", @@ -337,7 +390,7 @@ function getMemberBannerData(string $id, string $system, bool $french = false) { "html" => ( $french ? - '<span data-bs-toggle="tooltip" data-bs-html="true" title="<b>' . (getMemberPronouns($member['pronouns'])["gender"] === "female" ? "Protectrice" : (getMemberPronouns($member['pronouns'])["gender"] === "male" ? "Protecteur" : "Protecteur·ice")) . '</b><br>' . ucfirst(getMemberPronouns($member['pronouns'])["subjective"]) . ' ' . (getMemberPronouns($member['pronouns'])["third"] ? "is" : "are") . ' a protector in the system and will front when somepony cannot handle it anymore." class="badge rounded-pill bg-black">' . (getMemberPronouns($member['pronouns'])["gender"] === "female" ? "Protectrice" : (getMemberPronouns($member['pronouns'])["gender"] === "male" ? "Protecteur" : "Protecteur·ice")) . '</span>' + '<span data-bs-toggle="tooltip" data-bs-html="true" title="<b>' . (getMemberPronouns($member['pronouns'])["gender"] === "female" ? "Protectrice" : (getMemberPronouns($member['pronouns'])["gender"] === "male" ? "Protecteur" : "Protectrice")) . '</b><br>' . ucfirst(getMemberPronouns($member['pronouns'])["subjective"]) . ' ' . (getMemberPronouns($member['pronouns'])["third"] ? "is" : "are") . ' a protector in the system and will front when somepony cannot handle it anymore." class="badge rounded-pill bg-black">' . (getMemberPronouns($member['pronouns'])["gender"] === "female" ? "Protectrice" : (getMemberPronouns($member['pronouns'])["gender"] === "male" ? "Protecteur" : "Protectrice")) . '</span>' : '<span data-bs-toggle="tooltip" data-bs-html="true" title="<b>Protector</b><br>' . ucfirst(getMemberPronouns($member['pronouns'])["subjective"]) . ' ' . (getMemberPronouns($member['pronouns'])["third"] ? "is" : "are") . ' a protector in the system and will front when somepony cannot handle it anymore." class="badge rounded-pill bg-black">Protector</span>' ) @@ -386,18 +439,6 @@ function getMemberBannerData(string $id, string $system, bool $french = false) { '<span data-bs-toggle="tooltip" data-bs-html="true" title="<b>Age regressor</b><br>' . ucfirst(getMemberPronouns($member['pronouns'])["subjective"]) . ' ' . (getMemberPronouns($member['pronouns'])["third"] ? "is" : "are") . ' capable of regressing ' . getMemberPronouns($member['pronouns'])["possessive_det"] . ' mental age, which causes ' . getMemberPronouns($member['pronouns'])["object"] . ' to become ' . (getMiniName($regression["display_name"] ?? $regression["name"])) . ', temporarily behaving and feeling younger than the body is." class="badge rounded-pill bg-secondary">Age regresses into <a href="/' . $regression["name"] . '">'. (getMiniName($regression["display_name"] ?? $regression["name"])) . '</a></span>' ) ]; - } else { - $badges[] = [ - "id" => "regressor", - "color" => "secondary", - "html" => ( - $french - ? - '<span data-bs-toggle="tooltip" data-bs-html="true" title="<b>Régresseur d\'âge</b><br>' . ucfirst(getMemberPronouns($member['pronouns'])["subjective"]) . ' ' . (getMemberPronouns($member['pronouns'])["third"] ? "is" : "are") . ' capable of regressing ' . getMemberPronouns($member['pronouns'])["possessive_det"] . ' mental age, temporarily behaving and feeling younger than the body is." class="badge rounded-pill bg-secondary">Régresseur d\'âge</span>' - : - '<span data-bs-toggle="tooltip" data-bs-html="true" title="<b>Age regressor</b><br>' . ucfirst(getMemberPronouns($member['pronouns'])["subjective"]) . ' ' . (getMemberPronouns($member['pronouns'])["third"] ? "is" : "are") . ' capable of regressing ' . getMemberPronouns($member['pronouns'])["possessive_det"] . ' mental age, temporarily behaving and feeling younger than the body is." class="badge rounded-pill bg-secondary">Age regressor</span>' - ) - ]; } } diff --git a/includes/bitset.inc b/includes/bitset.inc index 1d026e5..0bd5c4d 100644 --- a/includes/bitset.inc +++ b/includes/bitset.inc @@ -11,6 +11,8 @@ function parseBitset ($bitset) { $lessFrequent = substr($bin, 14, 1) !== "0"; $sexuallyActive = substr($bin, 13, 1) !== "0"; $ageRegressor = substr($bin, 12, 1) !== "0"; + $leader = substr($bin, 11, 1) !== "0"; + $persecutor = substr($bin, 10, 1) !== "0"; $magic = bindec(substr($bin, 18, 3)); $sensitivity = bindec(substr($bin, 21, 3)); $protector = substr($bin, 29, 1) !== "0"; @@ -76,6 +78,8 @@ function parseBitset ($bitset) { 'less_frequent' => $lessFrequent, 'age_spells' => $age, 'age_regressor' => $ageRegressor, + 'leader' => $leader, + 'persecutor' => $persecutor, 'sexually_active' => $sexuallyActive, 'species' => array_filter([ $species1, @@ -92,7 +96,7 @@ function parseMetadata ($metadata) { if ($metadata["bitset"]) { $m = parseBitset($metadata["bitset"]); $m["marefriends"] = $metadata["marefriends"] ?? []; - $m["bitset"] = $metadata["bitset"] ?? []; + $m["bitset"] = $metadata["bitset"] ?? 0; $m["sisters"] = $metadata["sisters"] ?? []; $m["regression"] = $metadata["regression"] ?? null; $m["caretakers"] = $metadata["caretakers"] ?? []; diff --git a/includes/details.inc b/includes/details.inc index abd07bc..e4ee519 100644 --- a/includes/details.inc +++ b/includes/details.inc @@ -1,31 +1,20 @@ -<?php global $isLoggedIn; global $metadata; global $memberData; ?> -<div id="member-details" class="<?= $isLoggedIn ? 'member-details-loggedIn' : '' ?>" style="<?php if (!$isLoggedIn): ?>grid-template-columns: repeat(3, 1fr);<?php endif; ?> background-color: <?= isset($memberData["color"]) ? '#' . $memberData["color"] . "33" : "transparent" ?>; margin-left: -20px; margin-right: -20px;"> +<?php global $isLoggedIn; global $metadata; global $memberData; global $lang; global $pages; ?> +<div id="member-details" class="<?= $isLoggedIn ? 'member-details-loggedIn' : '' ?>" style="<?php if (!$isLoggedIn): ?>grid-template-columns: repeat(2, 1fr);<?php endif; ?> background-color: <?= isset($memberData["color"]) ? '#' . $memberData["color"] . "33" : "transparent" ?>; margin-left: -20px; margin-right: -20px;"> <div> - <b>Food:</b><span class="member-small-separator"><br></span> + <b><?= $lang["details"]["food"] ?></b><span class="member-small-separator"><br></span> <?= match ($metadata["food"]) { - 0 => "<span data-bs-toggle='tooltip' title='" . ucfirst(str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["possessive_det"])) . " species indicates that " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["subjective"]) . ' ' . (getMemberPronouns($memberData["pronouns"])["third"] ? "doesn't" : "don't") . " need to eat food, therefore " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["subjective"]) . " can eat all foods.'>Not needed</span>", - 1 => "<span data-bs-toggle='tooltip' title='" . ucfirst(str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["subjective"])) . " can't eat fish or meat.'>Not animals</span>", - 2 => "<span data-bs-toggle='tooltip' title='" . ucfirst(str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["subjective"])) . " can't eat meat, but can eat fish.'>Not meat</span>", - 3 => "<span data-bs-toggle='tooltip' title='" . ucfirst(str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["subjective"])) . " can eat all foods, meat and fish included.'>All</span>", + 0 => "<span data-bs-toggle='tooltip' title='" . ucfirst(str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["possessive_det"])) . " species indicates that " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["subjective"]) . ' ' . (getMemberPronouns($memberData["pronouns"])["third"] ? "doesn't" : "don't") . " need to eat food, therefore " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["subjective"]) . " can eat all foods.'>" . $lang["details"]["food_states"][0] . "</span>", + 1 => "<span data-bs-toggle='tooltip' title='" . ucfirst(str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["subjective"])) . " can't eat fish or meat.'>" . $lang["details"]["food_states"][1] . "</span>", + 2 => "<span data-bs-toggle='tooltip' title='" . ucfirst(str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["subjective"])) . " can't eat meat, but can eat fish.'>" . $lang["details"]["food_states"][2] . "</span>", + 3 => "<span data-bs-toggle='tooltip' title='" . ucfirst(str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["subjective"])) . " can eat all foods, meat and fish included.'>" . $lang["details"]["food_states"][3] . "</span>", } ?> </div> <div> - <b>Shared memory:</b><span class="member-small-separator"><br></span> + <b><?= $lang["details"]["memory"] ?></b><span class="member-small-separator"><br></span> <?= match ($metadata["shared_memory"]) { - 0 => "<span data-bs-toggle='tooltip' title='" . str_replace("'", "'", ucfirst(getMemberPronouns($memberData['pronouns'])["subjective"])) . (getMemberPronouns($memberData["pronouns"])["third"] ? " doesn't directly share" : " don't directly share") . " memory with " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["possessive_det"]) . " headmates, but is able to (slowly) query it if that is needed.'>None</span>", - 1 => "<span data-bs-toggle='tooltip' title='" . str_replace("'", "'", ucfirst(getMemberPronouns($memberData['pronouns'])["subjective"])) . (getMemberPronouns($memberData["pronouns"])["third"] ? " doesn't directly shares" : " don't directly share") . " all memories with " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["possessive_det"]) . " headmates, but may be able to share certain memories and/or share memories at will.'>Partial</span>", - 2 => "<span data-bs-toggle='tooltip' title='" . str_replace("'", "'", ucfirst(getMemberPronouns($memberData['pronouns'])["subjective"])) . (getMemberPronouns($memberData["pronouns"])["third"] ? " shares" : " share") . " all memories with " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["possessive_det"]) . " headmates.'>Full</span>", - } ?> - </div> - <div> - <b>Magic:</b><span class="member-small-separator"><br></span> - <?= match ($metadata["magic"]) { - 0 => "<span data-bs-toggle='tooltip' title='" . str_replace("'", "'", ucfirst(getMemberPronouns($memberData['pronouns'])["subjective"])) . " is unable to use magic at all.'>None</span>", - 1 => "<span data-bs-toggle='tooltip' title='" . str_replace("'", "'", ucfirst(getMemberPronouns($memberData['pronouns'])["subjective"])) . " can use magic in rare cases, such as when somepony else is pouring magic into " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["object"]) . " or when a physical event occurs.'>In some cases</span>", - 2 => "<span data-bs-toggle='tooltip' title='" . str_replace("'", "'", ucfirst(getMemberPronouns($memberData['pronouns'])["subjective"])) . " can cast spells using " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["possessive_det"]) . " horn.'>Horn</span>", - 3 => "<span data-bs-toggle='tooltip' title='" . str_replace("'", "'", ucfirst(getMemberPronouns($memberData['pronouns'])["subjective"])) . " can cast spells using " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["possessive_det"]) . " wings.'>Wings</span>", - 4 => "<span data-bs-toggle='tooltip' title='" . str_replace("'", "'", ucfirst(getMemberPronouns($memberData['pronouns'])["subjective"])) . " can cast spells using both " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["possessive_det"]) . " horn and wings.'>Horn and wings</span>", - 5 => "<span data-bs-toggle='tooltip' title='" . str_replace("'", "'", ucfirst(getMemberPronouns($memberData['pronouns'])["subjective"])) . " can cast spells using another part of " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["possessive_det"]) . " body that is neither a horn or wings.'>Yes</span>", + 0 => "<span data-bs-toggle='tooltip' title='" . str_replace("'", "'", ucfirst(getMemberPronouns($memberData['pronouns'])["subjective"])) . (getMemberPronouns($memberData["pronouns"])["third"] ? " doesn't directly share" : " don't directly share") . " memory with " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["possessive_det"]) . " headmates, but is able to (slowly) query it if that is needed.'>" . $lang["details"]["memory_states"][0] . "</span>", + 1 => "<span data-bs-toggle='tooltip' title='" . str_replace("'", "'", ucfirst(getMemberPronouns($memberData['pronouns'])["subjective"])) . (getMemberPronouns($memberData["pronouns"])["third"] ? " doesn't directly shares" : " don't directly share") . " all memories with " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["possessive_det"]) . " headmates, but may be able to share certain memories and/or share memories at will.'>" . $lang["details"]["memory_states"][1] . "</span>", + 2 => "<span data-bs-toggle='tooltip' title='" . str_replace("'", "'", ucfirst(getMemberPronouns($memberData['pronouns'])["subjective"])) . (getMemberPronouns($memberData["pronouns"])["third"] ? " shares" : " share") . " all memories with " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["possessive_det"]) . " headmates.'>" . $lang["details"]["memory_states"][2] . "</span>", } ?> </div> <?php if ($isLoggedIn): ?> diff --git a/includes/footer.inc b/includes/footer.inc index 6cf833c..b95ea78 100644 --- a/includes/footer.inc +++ b/includes/footer.inc @@ -4,17 +4,22 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.inc"; ?> -<hr> -<div class="container text-muted"> - <?php - - $refresh = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/refresh.json"), true); - $version = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/version.json"), true); - - ?> - © <?= date("Y") ?> <a href="https://equestria.horse" target="_blank" class="text-muted">Equestria.dev Developers</a> · version 2.<?= $version["build"] ?>.<?= hexdec(substr($version["hash"], 0, 4)) ?>.<?= $version["revision"] ?><br> - <a href="/-/debug" class="text-muted" style="text-decoration: none;">Data updated <?= trim(timeAgo($refresh["timestamp"])) ?> (<?php if (time() - $refresh["timestamp"] > 360): ?>not updating; <?php endif; ?><?= date('D j M, G:i:s T', (int)$refresh["timestamp"]) ?>; took <?= round($refresh["duration"] * 1000) ?> ms, <?= count($refresh["restored"]) > 0 ? (count($refresh["restored"]) > 1 ? "reported " . count($refresh["restored"]) . " failures" : "reported 1 failure") : "no failures reported" ?>)</a> - <br><br><br><br><br> +<div id="footer-pre"></div> +<div id="footer"> + <hr> + <div class="container text-muted"> + <?php + + $refresh = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/refresh.json"), true); + $version = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/version.json"), true); + + global $lang; global $pages; + + ?> + © <?= date("Y") ?> <a href="https://equestria.horse" target="_blank" class="text-muted"><?= $lang["footer"]["copyright"] ?></a> · version 2.<?= $version["build"] ?>.<?= hexdec(substr($version["hash"], 0, 4)) ?>.<?= $version["revision"] ?><br> + <a href="/-/debug" class="text-muted" style="text-decoration: none;"><?= $lang["footer"]["update"] ?> <?= trim(timeAgo($refresh["timestamp"], $lang["_french"])) ?> (<?php if (time() - $refresh["timestamp"] > 360): ?><?= $lang["footer"]["no_update"] ?><?= $lang["footer"]["separator"] ?>; <?php endif; ?><?= date('D j M, G:i:s T', (int)$refresh["timestamp"]) ?><?= $lang["footer"]["separator"] ?>; <?= $lang["footer"]["took"] ?> <?= round($refresh["duration"] * 1000) ?> ms, <?= count($refresh["restored"]) > 0 ? (count($refresh["restored"]) > 1 ? $lang["footer"]["failures"][0] . count($refresh["restored"]) . $lang["footer"]["failures"][1] : $lang["footer"]["failure"]) : $lang["footer"]["no_failure"] ?>)</a> + <br><br><br><br><br> + </div> </div> <script> diff --git a/includes/fullbanner.inc b/includes/fullbanner.inc index 1c449d3..24e0295 100644 --- a/includes/fullbanner.inc +++ b/includes/fullbanner.inc @@ -1,4 +1,4 @@ -<?php global $memberData; global $memberID; global $systemID; global $metadata; global $travelling; global $systemCommonName; global $member; ?> +<?php global $memberData; global $memberID; global $systemID; global $metadata; global $travelling; global $systemCommonName; global $member; global $lang; global $pages; ?> <script> window.currentMemberData = JSON.parse(atob(`<?= base64_encode(json_encode(getMemberBannerData($memberID, $systemID, false))) ?>`)); </script> @@ -11,7 +11,7 @@ <div id="member-banner"></div> <?php endif; ?> -<script src="/app/banner.js"></script><script>refreshBanner(false)</script> +<script src="/app/banner.js"></script><script>refreshBanner(false, <?= $lang["_french"] ? "true" : "false" ?>)</script> <br> <?php global $isLoggedIn; if ($isLoggedIn && $memberData["name"] !== "unknown" && $memberData["name"] !== "fusion"): ?> @@ -53,24 +53,27 @@ <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/score.inc"; $score = calculateScore($metadata, $memberData["display_name"] ?? $memberData["name"]); ?> <li> <b>Score breakdown:</b> <code><?= $score["total"] ?></code> - <ul> - <li><b>Most common fronter score:</b> <code><?= $score["host"] ?></code></li> - <li><b>Relationships score:</b> <code><?= $score["relations"] ?></code></li> - <li><b>Fictive score:</b> <code><?= $score["fictive"] ?></code></li> - <li><b>Median score:</b> <code><?= $score["median"] ?></code></li> - <li><b>Species score:</b> <code><?= $score["species"] ?></code></li> - <li><b>Little score:</b> <code><?= $score["little"] ?></code></li> - <li><b>Not talking score:</b> <code><?= $score["not_talking"] ?></code></li> - <li><b>Protector score:</b> <code><?= $score["protector"] ?></code></li> - <li><b>Name score:</b> <code><?= $score["name"] ?></code></li> - <li><b>Shared memory score:</b> <code><?= $score["shared_memory"] ?></code></li> - </ul> - </li> - <li><b>Full metadata:</b> <ul><?php + <ul><?php foreach ($metadata as $type => $usage) { if (is_string($usage)) { echo("<li><b>" . $type . ":</b> " . $usage . "</li>"); + } else if (is_array($usage)) { + if (count($usage) === 0) { + echo("<li><b>" . $type . ":</b> []</li>"); + } else { + echo("<li><b>" . $type . ":</b><ul>"); + + foreach ($usage as $key => $item) { + if (is_string($item)) { + echo("<li><b>" . $key . ":</b> " . $item . "</li>"); + } else { + echo("<li><b>" . $key . ":</b> " . json_encode($item, JSON_UNESCAPED_SLASHES) . "</li>"); + } + } + + echo("</ul></li>"); + } } else { echo("<li><b>" . $type . ":</b> " . json_encode($usage, JSON_UNESCAPED_SLASHES) . "</li>"); } @@ -78,25 +81,15 @@ ?></ul></li> </ul> - - <br> - <div style="filter:invert(0);" class="alert alert-warning"> - <b>AI-generated page:</b> - <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/ai.inc"; ?> - </div> </details> </div> <?php endif; ?> -<?php if ($travelling[$memberID]['travelling']): ?> +<?php if ($travelling[$memberID]['travelling'] && !$travelling[$memberID]['equestria']): ?> <div class="alert alert-primary"> - <?= getMiniName($memberData["display_name"] ?? $memberData["name"]) ?> is visiting the <?= $systemID === "ynmuc" ? "Raindrops System" : "Cloudburst System" ?>, therefore <?= getMemberPronouns($memberData["pronouns"])["subjective"] ?> <?= getMemberPronouns($memberData["pronouns"])["third"] ? "is" : "are" ?> currently not in the <?= $systemCommonName ?>. + <?= getMiniName($memberData["display_name"] ?? $memberData["name"]) ?> <?= $lang["fullbanner"]["visit"][0] ?> <?= $systemID === "ynmuc" ? "Raindrops System" : "Cloudburst System" ?><?= str_replace("%1", getMemberPronouns($memberData["pronouns"])["subjective"], str_replace("%2", getMemberPronouns($memberData["pronouns"])["third"] ? "is" : "are", $lang["fullbanner"]["visit"][1])) ?><?= $systemCommonName ?>. </div> -<?php endif; ?> -<?php if ($memberData["name"] === "new"): ?> - <div class="alert alert-secondary"> - <p>Hello there!</p> - <p>I'm currently a new headmate slowly figuring myself out.</p> - <p>Give me some time to figure myself out and see this page change as I find new stuff about my identity. Don't be too worried if I accidentally get pushed to front, it's something that can happen sometimes.</p> - <span>Thanks!</span> +<?php elseif ($travelling[$memberID]['travelling'] && $travelling[$memberID]['equestria']): ?> + <div class="alert alert-primary"> + <?= getMiniName($memberData["display_name"] ?? $memberData["name"]) ?> is on a trip to Equestria. <?= str_replace("%1", getMemberPronouns($memberData["pronouns"])["subjective"], str_replace("%2", getMemberPronouns($memberData["pronouns"])["third"] ? "is" : "are", "Therefore %1 %2 currently not in the ")) ?><?= $systemCommonName ?>. </div> <?php endif; ?>
\ No newline at end of file diff --git a/includes/functions.inc b/includes/functions.inc index c3ec313..cc94f11 100644 --- a/includes/functions.inc +++ b/includes/functions.inc @@ -179,6 +179,10 @@ if (!function_exists("getMiniName")) { $parts = explode(" ", $name); if (strlen($parts[0]) > 3 && !str_ends_with($parts[0], "e") && $parts[0] !== "Filly" && $parts[0] !== "Windy" && (isset($parts[1]) && $parts[1] !== "Brightdawn")) { + if ($parts[0] === "Princess") { + array_shift($parts); + } + if (str_contains($parts[0], "/")) { return explode("/", $parts[0])[0]; } else { @@ -250,7 +254,7 @@ if (!function_exists("showMembersFromList")) { function showMembersFromList(array $list) { foreach ($list as $member) { if ($member['name'] !== "unknown" && $member['name'] !== "fusion") { echo('<!-- ' . ($member['display_name'] ?? $member['name']) . ' --> -<a href="/' . $member['name'] . '" style="text-decoration:none !important;filter:none !important;"><div class="hpd-item-card" style="background-color:rgba(255, 255, 255, .1);border:1px solid ' . (isset($member['color']) ? "#" . $member['color'] . "55" : "transparent") . ';outline-color:' . (isset($member['color']) ? "#" . $member['color'] . "55" : "transparent") . ';border-radius:10px;text-align:center;display:flex;align-items:center;justify-content:center;padding:5px;"><div> +<a href="/' . $member['name'] . '" style="text-decoration:none !important;filter:none !important;"><div class="hpd-item-card" style="background-color:rgba(255, 255, 255, .1);border:1px solid ' . (isset($member['color']) ? "#" . $member['color'] . "55" : "transparent") . ';outline-color:' . (isset($member['color']) ? "#" . $member['color'] . "55" : "transparent") . ';border-radius:10px;text-align:center;display:flex;align-items:center;justify-content:center;padding:5px;' . ($member["equestria"] ? 'opacity:.5;' : '') . '"><div> <img alt="" src="' . getAsset($member["system"], $member["id"]) . '" style="border-radius:999px;background-color:rgba(0, 0, 0, .25);height:48px;display:block;margin-left:auto;margin-right:auto;"> <div style="text-decoration:none;color:white;margin-top:5px;">' . ($member['display_name'] ?? $member['name']) . '</div> <div style="text-decoration:none !important;color:black !important;"><code style="text-decoration:none !important;color:white !important;">' . (isset($member['travelling']) && $member['travelling'] ? "+" . ($member['proxy_tags'][0]['prefix'] ?? " ") : ($member['proxy_tags'][0]['prefix'] ?? " ")) . '</code></div> @@ -301,18 +305,19 @@ if (!function_exists("showSystem")) { echo(' <div style="display:grid;grid-template-columns:repeat(6, 1fr);padding-left:10px;grid-gap:10px;">'); } - showMembersFromList(scoreOrder([...array_map(function ($i) use ($id) { + showMembersFromList(scoreOrder([...array_map(function ($i) use ($id, $travelling) { $i["travelling"] = false; $i["system"] = $id; + $i["equestria"] = $travelling[$i['id']]['travelling'] && $travelling[$i['id']]['equestria']; return $i; }, array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$id/members.json"), true), function ($i) use ($travelling) { - return !(isset($travelling[$i['id']]) && $travelling[$i['id']]['travelling']); + return !(isset($travelling[$i['id']]) && $travelling[$i['id']]['travelling'] && (!isset($travelling[$i['id']]['equestria']) || !$travelling[$i['id']]['equestria'])); })), ...array_map(function ($i) use ($id) { $i["travelling"] = true; $i["system"] = ($id === "gdapd" ? "ynmuc" : "gdapd"); return $i; }, array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($id === "gdapd" ? "ynmuc" : "gdapd") . "/members.json"), true), function ($i) use ($travelling) { - return isset($travelling[$i['id']]) && $travelling[$i['id']]['travelling']; + return isset($travelling[$i['id']]) && $travelling[$i['id']]['travelling'] && (!isset($travelling[$i['id']]['equestria']) || !$travelling[$i['id']]['equestria']); }))], $id)); echo('</div> @@ -349,23 +354,30 @@ if (!function_exists("getMember")) { } if (!function_exists("timeAgo")) { - function timeAgo($time): string { + function timeAgo($time, $french = false): string { if (!is_numeric($time)) { $time = strtotime($time); } $periods = ["sec.", "mn.", "hr.", "d.", "wk.", "mo.", "y.", "ages"]; + $periods_fr = ["sec.", "mn.", "hr.", "j.", "sem.", "m.", "a.", "des années"]; $lengths = array("60", "60", "24", "7", "4.35", "12", "100"); $now = time(); $difference = $now - $time; if ($difference <= 10 && $difference >= 0) { - return $tense = "now"; + if ($french) { + return $tense_fr = "à l'instant"; + } else { + return $tense = "now"; + } } elseif ($difference > 0) { $tense = "ago"; + $tense_fr = "il y a"; } else { $tense = "later"; + $tense_fr = "dans"; } for ($j = 0; $difference >= $lengths[$j] && $j < count($lengths)-1; $j++) { @@ -374,8 +386,13 @@ if (!function_exists("timeAgo")) { $difference = round($difference); - $period = $periods[$j]; - return "{$difference} {$period} {$tense}"; + if ($french) { + $period = $periods_fr[$j]; + return "{$tense_fr} {$difference} {$period}"; + } else { + $period = $periods[$j]; + return "{$difference} {$period} {$tense}"; + } } } @@ -412,21 +429,37 @@ if (!function_exists("timeIn")) { if (!function_exists("duration")) { function duration($seconds) { + global $lang; global $pages; + if ($seconds >= 60) { if (floor($seconds / 60) >= 60) { if (floor($seconds / 3600) >= 24) { $days = floor($seconds / 86400); - return $days . " day" . ($days > 1 ? "s" : ""); + + if ($lang["_french"]) { + return $days . " jour" . ($days > 1 ? "s" : ""); + } else { + return $days . " day" . ($days > 1 ? "s" : ""); + } } else { $hours = floor($seconds / 3600); - return $hours . " hour" . ($hours > 1 ? "s" : ""); + + if ($lang["_french"]) { + return $hours . " heure" . ($hours > 1 ? "s" : ""); + } else { + return $hours . " hour" . ($hours > 1 ? "s" : ""); + } } } else { $minutes = floor($seconds / 60); return $minutes . " minute" . ($minutes > 1 ? "s" : ""); } } else { - return $seconds . " seconds"; + if ($lang["_french"]) { + return $seconds . " secondes"; + } else { + return $seconds . " seconds"; + } } } } diff --git a/includes/header.inc b/includes/header.inc index 2d95799..d338f78 100644 --- a/includes/header.inc +++ b/includes/header.inc @@ -710,7 +710,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/ical/main.php"; border-bottom-left-radius: 10px; border-bottom-right-radius: 10px; display: grid; - grid-template-columns: repeat(6, 1fr); + grid-template-columns: repeat(5, 1fr); text-align: center; } @@ -780,7 +780,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/ical/main.php"; <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/mobilenav.inc"; ?> - <div style="margin-top: 34px;"></div> + <div id="titlebar-separator" style="margin-top: 34px;"></div> <style> body { diff --git a/includes/init.inc b/includes/init.inc index 7265c0e..53a6328 100644 --- a/includes/init.inc +++ b/includes/init.inc @@ -4,12 +4,13 @@ global $title; global $toplevel; global $emergencyHeader; global $pages; +global $lang; global $pages; $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true); require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn; if (in_array($toplevel, array_keys($pages))) { - $title = $pages[$toplevel]["name"]; + $title = $pages[$toplevel]["name"][$lang["_name"]]; if ($pages[$toplevel]["admin"]) { $readOnly = false; diff --git a/includes/language.inc b/includes/language.inc new file mode 100644 index 0000000..ddeee3b --- /dev/null +++ b/includes/language.inc @@ -0,0 +1,14 @@ +<?php + +if ($_SERVER['HTTP_HOST'] === "fr.equestria.horse") { + $default = "fr"; +} else { + $default = "en"; +} + +$lf = $_COOKIE['PEH2_LANGUAGE'] ?? $default; + +if (str_contains("/", $lf)) $lf = "en"; +if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/i18n/" . $lf . ".json")) $lf = "en"; + +$lang = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/i18n/" . $lf . ".json"), true);
\ No newline at end of file diff --git a/includes/logo.inc b/includes/logo.inc index 9b4a03f..17026c7 100644 --- a/includes/logo.inc +++ b/includes/logo.inc @@ -104,4 +104,112 @@ $img3 = imageCreateCorners("/tmp/image.png", $columns * 10); unlink("/tmp/image.png"); imagepng($img3, $_SERVER['DOCUMENT_ROOT'] . "/assets/logo/newlogo-template.png"); -imagepng($img3, "/tmp/ponieslogo2.png");
\ No newline at end of file +imagepng($img3, "/tmp/ponieslogo2.png"); + +// -------------------------- + +$columns = ceil(sqrt(count(array_filter(scoreOrderGlobal(), function ($i) { + return $i["_system"] === "gdapd"; +})))); +echo(" Using " . $columns . " columns\n"); + +$members = array_values(array_filter(scoreOrderGlobal(), function ($i) { + return $i["_system"] === "gdapd"; +})); + +usort($members, function ($a, $b) { + $vr = hexdec(substr($a["color"], 0, 2)); + $vg = hexdec(substr($a["color"], 2, 2)); + $vb = hexdec(substr($a["color"], 4, 2)); + + $hsl = rgbToHsl($vr, $vg, $vb); + if ($hsl[0] == 0) $hsl[0] = 360; + $ra = $hsl[0]; + + $vr = hexdec(substr($b["color"], 0, 2)); + $vg = hexdec(substr($b["color"], 2, 2)); + $vb = hexdec(substr($b["color"], 4, 2)); + + $hsl = rgbToHsl($vr, $vg, $vb); + if ($hsl[0] == 0) $hsl[0] = 360; + $rb = $hsl[0]; + + return $ra - $rb; +}); + +echo(" " . count($members) . " members\n"); + +$packs = []; +$currentPack = []; + +foreach ($members as $member) { + if (count($currentPack) >= $columns) { + $packs[] = $currentPack; + $currentPack = []; + } + + $currentPack[] = $member["color"]; +} + +if (count($currentPack) > 0) $packs[] = $currentPack; + +$newPacks = []; +foreach ($packs as $pack) { + usort($pack, function ($a, $b) { + $vra = hexdec(substr($a, 0, 2)); + $vga = hexdec(substr($a, 2, 2)); + $vba = hexdec(substr($a, 4, 2)); + + $hsla = rgbToHsl($vra, $vga, $vba); + $ra = $hsla[2] * $hsla[1]; + + $vrb = hexdec(substr($b, 0, 2)); + $vgb = hexdec(substr($b, 2, 2)); + $vbb = hexdec(substr($b, 4, 2)); + + $hslb = rgbToHsl($vrb, $vgb, $vbb); + $rb = $hslb[2] * $hslb[1]; + + return $rb < $ra; + }); + + while (count($pack) < $columns) $pack[] = "ffffff"; + + $newPacks[] = $pack; +} + +$img = imagecreatetruecolor($columns, $columns); +$factor = 64; + +for ($y = 0; $y < $columns; ++$y) { + for ($x = 0; $x < $columns; ++$x) { + if (isset($newPacks[$y][$x])) { + imagesetpixel($img, $x, $y, imagecolorallocate($img, hexdec(substr($newPacks[$y][$x], 0, 2)), hexdec(substr($newPacks[$y][$x], 2, 2)), hexdec(substr($newPacks[$y][$x], 4, 2)))); + } else { + imagesetpixel($img, $x, $y, imagecolorallocate($img, 255, 255, 255)); + } + } +} + +$img2 = imagecreatetruecolor($columns * $factor, $columns * $factor); +imagecopyresampled($img2, $img, 0, 0, 0, 0, $columns * $factor, $columns * $factor, $columns, $columns); + +imagepng($img2, "/tmp/image.png"); +$img3 = imageCreateCorners("/tmp/image.png", $columns * 10); +unlink("/tmp/image.png"); + +imagepng($img3, $_SERVER['DOCUMENT_ROOT'] . "/assets/logo/newlogo2.png"); +imagepng($img3, "/tmp/ponieslogo1a.png"); + +for ($x = 1; $x <= 120; $x++) { + imagefilter($img2, IMG_FILTER_GAUSSIAN_BLUR); +} + +imagefilter($img2, IMG_FILTER_BRIGHTNESS, -100); + +imagepng($img2, "/tmp/image.png"); +$img3 = imageCreateCorners("/tmp/image.png", $columns * 10); +unlink("/tmp/image.png"); + +imagepng($img3, $_SERVER['DOCUMENT_ROOT'] . "/assets/logo/newlogo2-template.png"); +imagepng($img3, "/tmp/ponieslogo2a.png");
\ No newline at end of file diff --git a/includes/member.inc b/includes/member.inc index 02f7769..8734471 100644 --- a/includes/member.inc +++ b/includes/member.inc @@ -1,7 +1,7 @@ -<?php global $system; global $systemCommonName; global $systemID; global $member; global $memberData; global $memberCommonName; global $memberID; +<?php global $system; global $systemCommonName; global $systemID; global $member; global $memberData; global $memberCommonName; global $memberID; global $lang; global $pages; if ($memberData["name"] === "fusion") { - $title = ($memberCommonName === "fusion" ? "Multiple merged members" : $memberCommonName); + $title = ($memberCommonName === "fusion" ? $lang["member"]["merge"] : $memberCommonName); } else { $title = $memberCommonName . " · " . $systemCommonName; } @@ -57,28 +57,28 @@ if ($memberData["name"] === "fusion") { <div id="page-content"> <?php if ($memberData["name"] === "unknown"): ?> <div class="alert alert-secondary"> - <p>Hello there!</p> - <p>I'm currently not totally sure who I am (it's a thing that can happen with plurality), but I am using <?= $systemID === "ynmuc" ? "Twilight Sparkle" : "Scootaloo" ?> as a temporary identity to stay calm and not panic while I figure out what is going on and who I am.</p> - <p>I can either be an existing headmate who cannot work out they are fronting (this can sometimes happen when one of us gets pushed out of front), multiple headmates blurring who cannot work out who we are, or a new pony trying to figure out their identity (this can sometimes take a while).</p> - <span>In all cases, feel free to ask!</span> + <p><?= $lang["member"]["unknown"][0] ?></p> + <p><?= $lang["member"]["unknown"][1] ?></p> + <p><?= $lang["member"]["unknown"][2] ?></p> + <span><?= $lang["member"]["unknown"][3] ?></span> </div> <?php elseif ($memberData["name"] === "fusion"): ?> <div class="alert alert-secondary"> - <p>Hello there!</p> - <p>I'm the result of more than one pony temporarily merging together to the point they are unable to be told apart (this can be done for various reasons). We have not registered this switch for the "Unknown" member since this merge is made on purpose.</p> - <p>Below is the list of who is merged, we can be either from a single system or from different systems.</p> + <p><?= $lang["member"]["fusion"][0] ?></p> + <p><?= $lang["member"]["fusion"][1] ?></p> + <p><?= $lang["member"]["fusion"][2] ?></p> <div class="list-group"> <?php $foundFusion = false; $fusionOn = false; foreach ($fusionRaindrops ? $frontersRaindrops['members'] : $frontersCloudburst['members'] as $fronter): if ($fronter["name"] !== "fusion"): if ($fusionOn): $foundFusion = true; $name = str_ends_with($fronter['name'], "-travelling") ? substr($fronter['name'], 0, strlen($fronter['name']) - 11) : $fronter['name'] ?> <a class="list-group-item list-group-item-action text-black" href="/<?= $name ?>"><img src="<?= getAsset($system, $fronter["id"], "heads") ?>" style="filter:invert(1) hue-rotate(180deg);width:24px;"> <?= $fronter["display_name"] ?? $name ?></a> <?php endif; else: $fusionOn = true; endif; endforeach; ?> </div> <?php if (!$foundFusion): ?> - <i>No members are currently merged.</i> + <i><?= $lang["member"]["no_fusion"] ?></i> <?php endif; ?> </div> <?php else: ?> <?php global $isLoggedIn; if ($isLoggedIn): ?> - <small style="opacity:.5;display:block;">(edit: <a href="/-/edit/<?= $system ?>/<?= $memberData['name'] ?>">public</a>, <a href="/-/edit-private/<?= $system ?>/<?= $memberData['name'] ?>">private</a>)</small> + <small style="opacity:.5;display:block;">(edit: <a href="/-/metadata/<?= $system ?>/<?= $memberData['name'] ?>">metadata</a>, <a href="/-/edit/<?= $system ?>/<?= $memberData['name'] ?>">public</a>, <a href="/-/edit-private/<?= $system ?>/<?= $memberData['name'] ?>">private</a>)</small> <?php endif; ?> <?php if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/$memberID-private.html") && $isLoggedIn): ?> @@ -88,9 +88,6 @@ if ($memberData["name"] === "fusion") { <?php if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/$memberID.html")): ?> <?= file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/$memberID.html") ?> - <?php else: ?> - <p class="text-muted">This page is automatically generated and may not be 100% accurate.</p> - <?php require $_SERVER['DOCUMENT_ROOT'] . "/includes/ai.inc"; ?> <?php endif; ?> <?php endif; ?> </div> diff --git a/includes/member/hierarchy.inc b/includes/member/hierarchy.inc deleted file mode 100644 index acf954b..0000000 --- a/includes/member/hierarchy.inc +++ /dev/null @@ -1,179 +0,0 @@ -<?php global $system; -global $systemCommonName; -global $systemID; -global $member; -global $memberData; -global $memberCommonName; -global $memberID; -$title = "Member hierarchy · " . $memberCommonName . " · " . $systemCommonName; -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; - -$travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling/travelling.json"), true); - -$metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $memberID . ".json"), true)); - -$allMembers = scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $systemID . "/members.json"), true), $systemID); -$allMembers2 = scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($systemID === "gdapd" ? "ynmuc" : "gdapd") . "/members.json"), true), $systemID === "gdapd" ? "ynmuc" : "gdapd"); - -$systemCommonData = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $systemID . "/general.json"), true); - -if ($travelling[$memberID]["travelling"]) { - $allMembers = scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($systemID === "gdapd" ? "ynmuc" : "gdapd") . "/members.json"), true), $systemID === "gdapd" ? "ynmuc" : "gdapd"); - $allMembers2 = scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $systemID . "/members.json"), true), $systemID); - - $systemCommonData = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($systemID === "gdapd" ? "ynmuc" : "gdapd") . "/general.json"), true); - - $system = $systemID === "gdapd" ? "cloudburst" : "raindrops"; - $systemCommonName = $systemID === "gdapd" ? "Cloudburst System" : "Raindrops System"; -} - -$memberData["system"] = $memberData["_system"] = $systemID; - -?> - - <br> - <div class="container"> - <h2><?= getMiniName($memberCommonName) ?>'s hierarchy</h2> - <br> - - <?php - - $takingCare = [ - ...array_filter($allMembers, function ($i) use ($systemID, $memberData) { - return in_array($systemID . "/" . $memberData["id"], $i["_metadata"]["caretakers"]) && $i["id"] !== $memberData["id"]; - }), - ...array_filter($allMembers2, function ($i) use ($systemID, $memberData) { - return in_array($systemID . "/" . $memberData["id"], $i["_metadata"]["caretakers"]) && $i["id"] !== $memberData["id"]; - }) - ]; - - $protected = array_filter($allMembers, function ($i) use ($memberData) { - return $i["_metadata"]["protector"] && $i["id"] !== $memberData["id"]; - }); - - $caretakers = array_map(function ($i) { - return getSystemMember(explode("/", $i)[0], explode("/", $i)[1]); - }, $metadata["caretakers"]); - - ?> - - <p class="text-muted" style="text-align: center;"><b>Part of:</b></p> - <div class="row"> - <div class="cell" style="width:20%;display:inline-block;margin-left:auto;margin-right:auto;"> - <a href="/<?= $system ?>" style="text-decoration:none !important;filter:none !important;"> - <div class="hpd-item-card" - style="background-color:rgba(255, 255, 255, .1);border:1px solid #<?= $systemCommonData["color"] ?? "ffffff" ?>55;outline-color:#<?= $systemCommonData["color"] ?? "ffffff" ?>55;border-radius:10px;text-align:center;display:flex;align-items:center;justify-content:center;padding:5px;"> - <div> - <img alt="" - src="/assets/uploads/<?= $system ?>.png" - style="height:48px;display:block;margin-left:auto;margin-right:auto;"> - <div style="text-decoration:none;color:white;margin-top:5px;"><?= $systemCommonName ?></div> - </div> - </div> - </a> - </div> - </div> - - <hr> - - <?php if (count($protected) > 0): ?> - <p class="text-muted" style="text-align: center;"><b>Protected by:</b></p> - <div class="row"> - <?php foreach ($protected as $selectedMember): ?> - <div class="cell" style="width:20%;display:inline-block;margin-left:auto;margin-right:auto;"> - <?php showMembersFromList([$selectedMember]) ?> - </div> - <?php endforeach; ?> - </div> - - <hr> - <?php endif; ?> - - <?php if (count($caretakers) > 0): ?> - <p class="text-muted" style="text-align: center;"><b>Taken care of by:</b></p> - <div class="row"> - <?php foreach ($caretakers as $selectedMember): ?> - <div class="cell" style="width:20%;display:inline-block;margin-left:auto;margin-right:auto;"> - <?php showMembersFromList([$selectedMember]) ?> - </div> - <?php endforeach; ?> - </div> - - <hr> - <?php endif; ?> - - <p class="text-muted" style="text-align: center;"><b>Member:</b></p> - <div class="row"> - <div class="cell" style="width:20%;display:inline-block;margin-left:auto;margin-right:auto;"> - <?php showMembersFromList([$memberData]) ?> - </div> - </div> - - <?php if (count($takingCare) > 0): ?> - <hr> - - <p class="text-muted" style="text-align: center;"><b>Taking care of:</b></p> - <div class="row"> - <?php foreach ($takingCare as $selectedMember): ?> - <div class="cell" style="width:20%;display:inline-block;margin-left:auto;margin-right:auto;"> - <?php showMembersFromList([$selectedMember]) ?> - </div> - <?php endforeach; ?> - </div> - <?php endif; ?> - </div> - - <style> - .row { - margin-bottom: 20px; - } - - @media (max-width: 750px) { - #hpd-cloudburst > div, #hpd-raindrops > div { - grid-template-columns: repeat(1, 1fr) !important; - } - - .hpd-item-card img { - display: inline-block !important; - margin-right: 5px !important; - height: 32px !important; - } - - #hpd-cloudburst > div, #hpd-raindrops > div { - grid-gap: 5px !important; - } - - .hpd-item-card div { - display: inline-block !important; - } - - .hpd-item-card div:nth-child(3)::before { - content: "("; - padding-left: 5px; - color: white !important; - } - - .hpd-item-card div:nth-child(3)::after { - content: ")"; - color: white !important; - } - - div.cell { - grid-row-gap: 5px !important; - width: 100% !important; - margin-bottom: 5px; - } - - div.cell:nth-last-child(1) { - margin-bottom: 0 !important; - } - } - - @media (max-width: 997px) { - .cell { - width: 30% !important; - } - } - </style> - -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?>
\ No newline at end of file diff --git a/includes/member/tree.inc b/includes/member/tree.inc deleted file mode 100644 index 2e94951..0000000 --- a/includes/member/tree.inc +++ /dev/null @@ -1,8 +0,0 @@ -<?php - -global $parts; -$parts[3] = "hierarchy"; -array_shift($parts); - -header("Location: /" . implode("/", $parts)); -die();
\ No newline at end of file diff --git a/includes/metadata.inc b/includes/metadata.inc new file mode 100644 index 0000000..1aa7329 --- /dev/null +++ b/includes/metadata.inc @@ -0,0 +1,105 @@ +<?php global $system; global $systemCommonName; global $systemID; global $member; global $memberData; global $memberCommonName; global $memberID; $title = "Editing metadata for " . $memberCommonName . " · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; + +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)); +} + +?> + +<br> +<div class="container" id="page-content"> + <h2><?= $memberData["display_name"] ?? $memberData["name"] ?></h2> + <?php if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $memberID . ".json")): ?> + <form> + <input name="submit" type="hidden"> + <p> + <b>File</b><br> + <?= $_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $memberID . ".json" ?> + </p> + <p> + <b>Bitset</b><br> + <code id="bitset-text"><?= $metadata["bitset"] ?></code> · <a data-bs-toggle="modal" data-bs-target="#bitset" href="#">Edit...</a> + <input name="bitset" id="bitset-value" type="hidden" value="<?= $metadata["bitset"] ?>"> + </p> + <p> + <b>Marefriends (full IDs, comma-separated):</b><br> + <input name="marefriends" class="form-control" style="filter: invert(1) hue-rotate(180deg);" type="text" value="<?= implode(", ", $metadata["marefriends"]) ?>"> + </p> + <p> + <b>Sisters (full IDs, comma-separated):</b><br> + <input name="sisters" class="form-control" style="filter: invert(1) hue-rotate(180deg);" type="text" value="<?= implode(", ", $metadata["sisters"]) ?>"> + </p> + <p> + <b>Caretakers (full IDs, comma-separated):</b><br> + <input name="caretakers" class="form-control" style="filter: invert(1) hue-rotate(180deg);" type="text" value="<?= implode(", ", $metadata["caretakers"]) ?>"> + </p> + <p> + <b>Age regressed version (local ID):</b><br> + <input name="regressed" class="form-control" style="filter: invert(1) hue-rotate(180deg);" type="text" value="<?= $metadata["regressed"] ?? "" ?>"> + </p> + <p> + <b>Birth date (use January 1<sup>st</sup> for none):</b><br> + <input name="birth" class="form-control" style="filter: invert(1) hue-rotate(180deg);" type="date" value="<?= $metadata["birth"]["year"] ?? "" ?>-<?= $metadata["birth"]["date"] ?? "" ?>"> + </p> + <p> + <b>Age (for ponies with fixed age):</b><br> + <input name="age" class="form-control" style="filter: invert(1) hue-rotate(180deg);" type="number" value="<?= $metadata["birth"]["age"] ?? "" ?>"> + </p> + <input name="submit" class="btn btn-outline-primary" value="Save and quit" type="submit"> + </form> + <?php else: ?> + <div class="alert alert-warning"> + This member does not have a metadata file. This file needs to be initially created by an administrator before it can be edited using this page. + </div> + <?php endif; ?> +</div> + +<div class="modal fade" id="bitset"> + <div class="modal-dialog modal-xl"> + <div class="modal-content"> + <div class="modal-header"> + <h4 class="modal-title"> + <img src="/assets/icons/bitset.svg" style="filter: invert(1); vertical-align: middle; height: 32px; margin-right: 10px;"> + <span style="vertical-align: middle;">Bitset editor</span> + </h4> + <button type="button" class="btn-close" data-bs-dismiss="modal"></button> + </div> + <div class="modal-body"> + <iframe src="/-/bitset?embed=<?= $metadata["bitset"] ?>"></iframe> + <script> + setInterval(() => { + try { + document.getElementById("bitset-text").innerText = document.getElementById("bitset-value").value = document.getElementsByTagName("iframe")[0].contentDocument.getElementById("output-dec").innerText; + } catch (e) {} + }) + </script> + </div> + </div> + </div> +</div> + +<style> + .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); + } + + iframe { + width: calc(100% + 2rem); + min-height: calc(100% + 2rem); + border-bottom-left-radius: .3rem; + border-bottom-right-radius: .3rem; + height: 60vh; + margin: -1rem -1rem calc(-1rem - 6px); + } +</style> + +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?>
\ No newline at end of file diff --git a/includes/navbar.inc b/includes/navbar.inc index 379f102..3e68493 100644 --- a/includes/navbar.inc +++ b/includes/navbar.inc @@ -1,4 +1,4 @@ -<?php global $isLoggedIn; global $isUserLoggedIn; global $demoHeader; global $pages; global $useNewUI; global $navigation; ?> +<?php global $isLoggedIn; global $isUserLoggedIn; global $demoHeader; global $pages; global $useNewUI; global $navigation; global $lang; global $pages; ?> <?php if (!$useNewUI): ?> <nav class="navbar navbar-expand-<?= $isLoggedIn ? 'xl' : 'lg' ?> bg-dark navbar-dark fixed-top" style="height:60px;"> @@ -24,12 +24,12 @@ <li><h5 class="dropdown-header"><?= $category["name"] ?></h5></li> <?php endif; ?> - <?php foreach ($category["items"] as $link): ?> + <?php foreach ($category["items"] as $link): if (isset($link)): ?> <li><a class="dropdown-item" href="<?= $link["link"] ?>"> <img src="<?= $link["icon"] ?>" <?php if ($link["invert"]): ?>class="dropdown-icon"<?php endif; ?> alt="" style="width:24px; border-radius: 5px; vertical-align: middle;"> <span style="vertical-align: middle;<?= isset($link["stepped"]) ? "color: $link[stepped];" : "" ?>"><?= isset($link["stepped"]) ? "<b>$link[name]</b>" : $link["name"] ?></span> </a></li> - <?php endforeach; ?> + <?php endif; endforeach; ?> <?php endforeach; ?> </ul> </li> @@ -59,7 +59,7 @@ <a class="nav-link" href="/-/login"> <?php global $_PROFILE; ?> <span style="vertical-align: middle;"> - Not logged in + <?= $lang["navitation"]["login"] ?> </span> <img alt="" src="/assets/icons/login.svg" style="filter:invert(1);width:24px;vertical-align: middle;"> </a> diff --git a/includes/navigation.inc b/includes/navigation.inc index 8e6e8cd..bdafe99 100644 --- a/includes/navigation.inc +++ b/includes/navigation.inc @@ -14,10 +14,11 @@ $raindrops_subsystemsNotMember = array_values(array_filter($subsystems2, functio global $navigation; global $toplevel; +global $lang; global $pages; $navigation_admin = [ "admin" => true, - "name" => "Administrator", + "name" => $lang["navigation"]["admin"], "icon" => "/assets/icons/admin.svg", "invert" => true, "items" => [ @@ -26,21 +27,21 @@ $navigation_admin = [ "minimal" => true, "items" => [ [ - "name" => $pages["emergency"]["name"], + "name" => $pages["emergency"]["name"][$lang["_name"]], "icon" => "/assets/icons/emergency.svg", "invert" => false, "link" => "/-/emergency", "stepped" => "rgb(220,53,69)" ], [ - "name" => $pages["wakeup"]["name"], + "name" => $pages["wakeup"]["name"][$lang["_name"]], "icon" => "/assets/icons/wakeup.svg", "invert" => false, "link" => "/-/wakeup", "stepped" => "rgb(13,202,240)" ], [ - "name" => $pages["pleasure"]["name"], + "name" => $pages["pleasure"]["name"][$lang["_name"]], "icon" => "/assets/icons/pleasure.svg", "invert" => false, "link" => "/-/pleasure", @@ -49,102 +50,109 @@ $navigation_admin = [ ] ], "apps" => [ - "name" => "Applications", + "name" => $lang["navigation"]["apps"], "minimal" => false, "items" => [ [ - "name" => $pages["dashboard"]["name"], + "name" => $pages["dashboard"]["name"][$lang["_name"]], "icon" => "/assets/icons/dashboard.svg", "invert" => true, "link" => "/-/dashboard", "stepped" => null ], [ - "name" => $pages["about"]["name"], + "name" => $pages["about"]["name"][$lang["_name"]], "icon" => "/assets/icons/about.svg", "invert" => true, "link" => "/-/about", "stepped" => null ], [ - "name" => $pages["fronting"]["name"], + "name" => $pages["fronting"]["name"][$lang["_name"]], "icon" => "/assets/icons/fronting.svg", "invert" => true, "link" => "/-/fronting", "stepped" => null ], [ - "name" => $pages["actions"]["name"], + "name" => $pages["profiles"]["name"][$lang["_name"]], + "icon" => "/assets/icons/profiles.svg", + "invert" => true, + "link" => "/-/profiles", + "stepped" => null + ], + [ + "name" => $pages["actions"]["name"][$lang["_name"]], "icon" => "/assets/icons/actions.svg", "invert" => true, "link" => "/-/actions", "stepped" => null ], [ - "name" => $pages["rules-old"]["name"], + "name" => $pages["rules-old"]["name"][$lang["_name"]], "icon" => "/assets/icons/rules-old.svg", "invert" => true, "link" => "/-/rules-old", "stepped" => null ], [ - "name" => $pages["docs"]["name"], + "name" => $pages["docs"]["name"][$lang["_name"]], "icon" => "/assets/icons/docs.svg", "invert" => true, "link" => "/-/docs", "stepped" => null ], [ - "name" => $pages["computers"]["name"], + "name" => $pages["computers"]["name"][$lang["_name"]], "icon" => "/assets/icons/computers.svg", "invert" => true, "link" => "/-/computers", "stepped" => null ], [ - "name" => $pages["nicknames"]["name"], + "name" => $pages["nicknames"]["name"][$lang["_name"]], "icon" => "/assets/icons/nicknames.svg", "invert" => true, "link" => "/-/nicknames", "stepped" => null ], [ - "name" => $pages["together"]["name"], + "name" => $pages["together"]["name"][$lang["_name"]], "icon" => "/assets/icons/together.svg", "invert" => true, "link" => "/-/together", "stepped" => null ], [ - "name" => $pages["splitting"]["name"], + "name" => $pages["splitting"]["name"][$lang["_name"]], "icon" => "/assets/icons/splitting.svg", "invert" => true, "link" => "/-/splitting", "stepped" => null ], [ - "name" => $pages["byfront"]["name"], + "name" => $pages["byfront"]["name"][$lang["_name"]], "icon" => "/assets/icons/byfront.svg", "invert" => true, "link" => "/-/byfront", "stepped" => null ], [ - "name" => $pages["travelling"]["name"], + "name" => $pages["travelling"]["name"][$lang["_name"]], "icon" => "/assets/icons/travelling.svg", "invert" => true, "link" => "/-/travelling", "stepped" => null ], [ - "name" => $pages["stats"]["name"], + "name" => $pages["stats"]["name"][$lang["_name"]], "icon" => "/assets/icons/stats.svg", "invert" => true, "link" => "/-/stats", "stepped" => null ], [ - "name" => $pages["toys"]["name"], + "name" => $pages["toys"]["name"][$lang["_name"]], "icon" => "/assets/icons/toys.svg", "invert" => true, "link" => "/-/toys", @@ -153,32 +161,32 @@ $navigation_admin = [ ] ], "debug" => [ - "name" => "Debugging", + "name" => $lang["navigation"]["debug"], "minimal" => false, "items" => [ [ - "name" => $pages["debug"]["name"], + "name" => $pages["debug"]["name"][$lang["_name"]], "icon" => "/assets/icons/debug.svg", "invert" => true, "link" => "/-/debug", "stepped" => null ], [ - "name" => $pages["bitset"]["name"], + "name" => $pages["bitset"]["name"][$lang["_name"]], "icon" => "/assets/icons/bitset.svg", "invert" => true, "link" => "/-/bitset", "stepped" => null ], [ - "name" => $pages["score"]["name"], + "name" => $pages["score"]["name"][$lang["_name"]], "icon" => "/assets/icons/score.svg", "invert" => true, "link" => "/-/score", "stepped" => null ], [ - "name" => $pages["logout"]["name"], + "name" => $pages["logout"]["name"][$lang["_name"]], "icon" => "/assets/icons/logout.svg", "invert" => true, "link" => "/-/logout", @@ -190,7 +198,7 @@ $navigation_admin = [ ]; $navigation_global = [ "admin" => false, - "name" => "Global", + "name" => $lang["navigation"]["general"], "icon" => "/assets/icons/global.svg", "invert" => true, "items" => [ @@ -199,66 +207,53 @@ $navigation_global = [ "minimal" => false, "items" => [ [ - "name" => $pages["home"]["name"], + "name" => $pages["home"]["name"][$lang["_name"]], "icon" => "/assets/icons/home.svg", "invert" => true, "link" => "/", "stepped" => null ], [ - "name" => $pages["disclaimers"]["name"], + "name" => $pages["disclaimers"]["name"][$lang["_name"]], "icon" => "/assets/icons/disclaimers.svg", "invert" => true, "link" => "/-/disclaimers", "stepped" => null ], [ - "name" => $pages["relations"]["name"], + "name" => $pages["relations"]["name"][$lang["_name"]], "icon" => "/assets/icons/relations.svg", "invert" => true, "link" => "/-/relations", "stepped" => null ], - [ - "name" => $pages["government"]["name"], + ($_SERVER['HTTP_HOST'] !== "fr.equestria.horse" ? [ + "name" => $pages["government"]["name"][$lang["_name"]], "icon" => "/assets/icons/government.svg", "invert" => true, "link" => "/-/government", "stepped" => null - ], - [ - "name" => $pages["terminology"]["name"], - "icon" => "/assets/icons/terminology.svg", - "invert" => true, - "link" => "/-/terminology", - "stepped" => null - ] - ] - ], - /*"tools" => [ - "name" => "Tools", - "minimal" => false, - "items" => [ + ] : null), [ - "name" => $pages["parser"]["name"], - "icon" => "/assets/icons/parser.svg", + "name" => $pages["alphabet"]["name"][$lang["_name"]], + "icon" => "/assets/icons/alphabet.svg", "invert" => true, - "link" => "/-/parser", + "link" => "/-/alphabet", "stepped" => null ], [ - "name" => $pages["prefix"]["name"], - "icon" => "/assets/icons/prefix.svg", + "name" => $pages["terminology"]["name"][$lang["_name"]], + "icon" => "/assets/icons/terminology.svg", "invert" => true, - "link" => "/-/prefix", + "link" => "/-/terminology", "stepped" => null ] ] - ]*/ + ] ] ]; $navigation_cloudburst = [ - "admin" => false, + "admin" => $_SERVER['HTTP_HOST'] === "fr.equestria.horse", "name" => "Cloudburst System", "icon" => getAsset("ynmuc"), "invert" => false, @@ -268,16 +263,44 @@ $navigation_cloudburst = [ "minimal" => false, "items" => [ [ - "name" => "About us", + "name" => $lang["navigation"]["about"], "icon" => "/assets/icons/about.svg", "invert" => true, "link" => "/cloudburst", "stepped" => null + ], + [ + "name" => $pages["s:history"]["name"][$lang["_name"]], + "icon" => "/assets/icons/history.svg", + "invert" => true, + "link" => "/cloudburst/-/history", + "stepped" => null + ], + [ + "name" => $pages["s:compare"]["name"][$lang["_name"]], + "icon" => "/assets/icons/compare.svg", + "invert" => true, + "link" => "/cloudburst/-/compare", + "stepped" => null + ], + [ + "name" => $pages["s:tree"]["name"][$lang["_name"]], + "icon" => "/assets/icons/tree.svg", + "invert" => true, + "link" => "/cloudburst/-/tree", + "stepped" => null + ], + [ + "name" => $pages["s:species"]["name"][$lang["_name"]], + "icon" => "/assets/icons/species.svg", + "invert" => true, + "link" => "/cloudburst/-/species", + "stepped" => null ] ] ], "subsystems" => [ - "name" => "Subsystems", + "name" => $lang["navigation"]["subsystems"], "minimal" => false, "items" => array_map(function ($subsystem) { $ssData = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/subsystems/ynmuc-" . $subsystem['source'] . ".json"), true); @@ -292,7 +315,7 @@ $navigation_cloudburst = [ }, $cloudburst_subsystemsNotMember) ], "members" => [ - "name" => "Members", + "name" => $lang["navigation"]["members"], "minimal" => false, "items" => array_map(function ($member) { return [ @@ -319,16 +342,44 @@ $navigation_raindrops = [ "minimal" => false, "items" => [ [ - "name" => "About us", + "name" => $lang["navigation"]["about"], "icon" => "/assets/icons/about.svg", "invert" => true, "link" => "/raindrops", "stepped" => null + ], + [ + "name" => $pages["s:history"]["name"][$lang["_name"]], + "icon" => "/assets/icons/history.svg", + "invert" => true, + "link" => "/raindrops/-/history", + "stepped" => null + ], + [ + "name" => $pages["s:compare"]["name"][$lang["_name"]], + "icon" => "/assets/icons/compare.svg", + "invert" => true, + "link" => "/raindrops/-/compare", + "stepped" => null + ], + [ + "name" => $pages["s:tree"]["name"][$lang["_name"]], + "icon" => "/assets/icons/tree.svg", + "invert" => true, + "link" => "/raindrops/-/tree", + "stepped" => null + ], + [ + "name" => $pages["s:species"]["name"][$lang["_name"]], + "icon" => "/assets/icons/species.svg", + "invert" => true, + "link" => "/raindrops/-/species", + "stepped" => null ] ] ], "subsystems" => [ - "name" => "Subsystems", + "name" => $lang["navigation"]["subsystems"], "minimal" => false, "items" => array_map(function ($subsystem) { $ssData = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/subsystems/gdapd-" . $subsystem['source'] . ".json"), true); @@ -343,7 +394,7 @@ $navigation_raindrops = [ }, $raindrops_subsystemsNotMember) ], "members" => [ - "name" => "Members", + "name" => $lang["navigation"]["members"], "minimal" => false, "items" => array_map(function ($member) { return [ diff --git a/includes/pages.json b/includes/pages.json index 659de57..4c6fcf5 100644 --- a/includes/pages.json +++ b/includes/pages.json @@ -1,252 +1,369 @@ { "about": { - "name": "About Cold Haze", + "name": { + "en": "About Cold Haze", + "fr": "About Cold Haze" + }, "short": "About", "admin": true, "rail": true }, "actions": { - "name": "Actions database", + "name": { + "en": "Actions database", + "fr": "Actions database" + }, "short": "Actions", "admin": true, "rail": true }, "alphabet": { - "name": "Members by prefix letters", + "name": { + "en": "Members by prefix letters", + "fr": "Par lettre du préfixe" + }, "short": null, "admin": false, "rail": false }, "api": { - "name": "API", + "name": { + "en": "API", + "fr": "API" + }, "short": null, "admin": false, "rail": false }, "app": { - "name": "Mobile application", + "name": { + "en": "Mobile application", + "fr": "Application mobile" + }, "short": null, "admin": false, "rail": false }, "bitset": { - "name": "Bitset calculator", + "name": { + "en": "Bitset calculator", + "fr": "Bitset calculator" + }, "short": "Bitset", "admin": true, "rail": true }, "byfront": { - "name": "Members by last fronted", + "name": { + "en": "Members by last fronted", + "fr": "Members by last fronted" + }, "short": "Last fronts", "admin": true, "rail": true }, "computers": { - "name": "Computers", + "name": { + "en": "Computers", + "fr": "Computers" + }, "short": "PCs", "admin": true, "rail": true }, "dashboard": { - "name": "Dashboard", + "name": { + "en": "Dashboard", + "fr": "Dashboard" + }, "short": null, "admin": true, "rail": true }, "debug": { - "name": "Data updater debugging", + "name": { + "en": "Data updater debugging", + "fr": "Débogage des mises à jour" + }, "short": null, "admin": false, "rail": true }, - "demo": { - "name": "Demo interface", - "short": null, - "admin": false, - "rail": false - }, "docs": { - "name": "Documents", + "name": { + "en": "Documents", + "fr": "Documents" + }, "short": "Docs", "admin": true, "rail": true }, "disclaimers": { - "name": "Disclaimers", + "name": { + "en": "Disclaimers", + "fr": "Avertissements" + }, "short": null, "admin": false, "rail": false }, "edit": { - "name": "Editor", + "name": { + "en": "Editor", + "fr": "Editor" + }, "short": null, "admin": true, "rail": false }, "edit-private": { - "name": "Editor (private)", + "name": { + "en": "Editor (private)", + "fr": "Editor (private)" + }, "short": null, "admin": true, "rail": false }, "emergency": { - "name": "Emergency alert", + "name": { + "en": "Emergency alert", + "fr": "Emergency alert" + }, "short": null, "admin": true, "rail": true }, "fronting": { - "name": "Front planner", + "name": { + "en": "Front planner", + "fr": "Front planner" + }, "short": null, "admin": true, "rail": true }, "government": { - "name": "Government", + "name": { + "en": "Government", + "fr": "Gouvernement" + }, "short": null, "admin": false, "rail": false }, "home": { - "name": "Home", + "name": { + "en": "Home", + "fr": "Accueil" + }, "short": null, "admin": false, "rail": false }, "login": { - "name": "Login", + "name": { + "en": "Login", + "fr": "Connexion" + }, "short": null, "admin": false, "rail": false }, "logout": { - "name": "Logout", + "name": { + "en": "Logout", + "fr": "Déconnexion" + }, "short": null, "admin": false, "rail": false }, + "metadata": { + "name": { + "en": "Metadata editor", + "fr": "Metadata editor" + }, + "short": "Metadata", + "admin": true, + "rail": false + }, "nicknames": { - "name": "Relations nicknames", + "name": { + "en": "Relations nicknames", + "fr": "Relations nicknames" + }, "short": "Nicknames", "admin": true, "rail": true }, "page": { - "name": "Member/system page", - "short": null, - "admin": false, - "rail": false - }, - "parser": { - "name": "Message parser", + "name": { + "en": "Member/system page", + "fr": "Page de membre/système" + }, "short": null, "admin": false, "rail": false }, "pleasure": { - "name": "Pleasure alert", + "name": { + "en": "Pleasure alert", + "fr": "Pleasure alert" + }, "short": null, "admin": true, "rail": true }, - "prefix": { - "name": "Prefix generator", + "profiles": { + "name": { + "en": "Profile scores", + "fr": "Profile scores" + }, "short": null, - "admin": false, - "rail": false + "admin": true, + "rail": true }, "relations": { - "name": "Relations", + "name": { + "en": "Relations", + "fr": "Relations" + }, "short": null, "admin": false, "rail": false }, "rules": { - "name": "General rules", + "name": { + "en": "General rules", + "fr": "General rules" + }, "short": "Rules", "admin": true, "rail": true }, "rules-old": { - "name": "Systems rules (legacy)", + "name": { + "en": "Systems rules (legacy)", + "fr": "Systems rules (legacy)" + }, "short": "Rules (old)", "admin": true, "rail": true }, "s:compare": { - "name": "Compare members", + "name": { + "en": "Compare members", + "fr": "Comparer les membres" + }, "short": null, "admin": false, "rail": false }, "s:history": { - "name": "Front history", + "name": { + "en": "Front history", + "fr": "Historique de front" + }, "short": null, "admin": false, "rail": false }, "s:species": { - "name": "Members by species", + "name": { + "en": "Members by species", + "fr": "Membres par espèce" + }, "short": null, "admin": false, "rail": false }, "s:tree": { - "name": "System tree", + "name": { + "en": "System tree", + "fr": "Arbre du système" + }, "short": null, "admin": false, "rail": false }, "score": { - "name": "Score system testing", + "name": { + "en": "Score system testing", + "fr": "Score system testing" + }, "short": null, "admin": true, "rail": true }, "splitting": { - "name": "Members by splitting date", + "name": { + "en": "Members by splitting date", + "fr": "Members by splitting date" + }, "short": "Splits", "admin": true, "rail": true }, "stats": { - "name": "Statistics", + "name": { + "en": "Statistics", + "fr": "Statistics" + }, "short": "Stats", "admin": true, "rail": true }, "terminology": { - "name": "Terminology", + "name": { + "en": "Terminology", + "fr": "Terminologie" + }, "short": null, "admin": false, "rail": true }, "together": { - "name": "Watch Together", + "name": { + "en": "Watch Together", + "fr": "Watch Together" + }, "short": "Together", "admin": true, "rail": false }, "together-dev": { - "name": "Watch Together (dev)", + "name": { + "en": "Watch Together (dev)", + "fr": "Watch Together (dev)" + }, "short": null, "admin": true, "rail": false }, "toys": { - "name": "Toys database", + "name": { + "en": "Toys database", + "fr": "Toys database" + }, "short": "Toys", "admin": true, "rail": true }, "travelling": { - "name": "System travels manager", + "name": { + "en": "System travels manager", + "fr": "System travels manager" + }, "short": "Travels", "admin": true, "rail": true }, "wakeup": { - "name": "Wake-up alert", + "name": { + "en": "Wake-up alert", + "fr": "Wake-up alert" + }, "short": null, "admin": true, "rail": true diff --git a/includes/pane.inc b/includes/pane.inc index 6aa7f98..e95747e 100644 --- a/includes/pane.inc +++ b/includes/pane.inc @@ -1,5 +1,27 @@ -<?php global $isLoggedIn; global $isUserLoggedIn; global $pages; global $navigation; $byColor = getMembersByColor(); ?> +<?php global $isLoggedIn; global $isUserLoggedIn; global $pages; global $navigation; $byColor = getMembersByColor($_SERVER['HTTP_HOST'] === "fr.equestria.horse"); global $lang; global $pages; ?> +<?php if ($_SERVER['HTTP_HOST'] === "fr.equestria.horse"): ?> +<div id="pane-header-background" style="background-image: linear-gradient(90deg, <?php + +$index = 0; +$list = array_map(function ($i) { return $i["color"]; }, $byColor); +$length = count($list); + +foreach ($list as $color) { + $perc = ($index / $length) * 100; + echo("#${color}33 $perc%"); + + $index++; + if ($index < $length) echo(", "); +} + +?>)"> + <a href="/" id="pane-header" class="login-link-clickable" style="color: white; text-decoration: none; padding: 20px; display: block; text-align: center; border-bottom: 1px solid rgba(255, 255, 255, .25);"> + <img src="/assets/logo/newlogo2.png" alt="" style="width:32px;vertical-align: middle;margin-right:5px;"> + <span style="vertical-align: middle; font-weight: bold;">Cold Haze</span> + </a> +</div> +<?php else: ?> <div id="pane-header-background" style="background-image: linear-gradient(90deg, <?php $index = 0; @@ -23,15 +45,16 @@ foreach ($list as $color) { <?php if ($isLoggedIn || $isUserLoggedIn): ?> <a onclick="toggleGlobalSearch();" id="login-link" class="login-link-clickable"> - Search in the website... + <?= $lang["navigation"]["search"] ?> </a> <?php elseif (!$isLoggedIn && !$isUserLoggedIn): ?> <a href="/-/login" id="login-link" class="login-link-clickable"> <?php global $_PROFILE; ?> <img alt="" src="/assets/icons/login.svg" style="filter:invert(1);width:24px;vertical-align: middle;"> - <span style="vertical-align: middle;">Not logged in</span> + <span style="vertical-align: middle;"><?= $lang["navigation"]["login"] ?></span> </a> <?php endif; ?> +<?php endif; ?> <?php foreach ($navigation as $id => $item): if (!$item["admin"] || $isLoggedIn): ?> @@ -46,12 +69,12 @@ foreach ($list as $color) { <?php if (isset($category["name"])): ?> <div class="pane-group-category-title"><?= $category["name"] ?></div> <?php endif; ?> - <?php foreach ($category["items"] as $link): ?> + <?php foreach ($category["items"] as $link): if (isset($link)): ?> <a class="pane-group-item" href="<?= $link["link"] ?>"> <img src="<?= $link["icon"] ?>" <?php if ($link["invert"]): ?>class="dropdown-icon"<?php endif; ?> alt="" style="width:24px; border-radius: 5px; vertical-align: middle;"> <?php if (!$category["minimal"]): ?><span style="vertical-align: middle;<?= isset($link["stepped"]) ? "color: $link[stepped];" : "" ?>"><?= isset($link["stepped"]) ? "<b>$link[name]</b>" : $link["name"] ?></span><?php endif; ?> </a> - <?php endforeach; ?> + <?php endif; endforeach; ?> </div> <?php endforeach; ?> </div> diff --git a/includes/profiles.inc b/includes/profiles.inc new file mode 100644 index 0000000..66274c7 --- /dev/null +++ b/includes/profiles.inc @@ -0,0 +1,97 @@ +<?php + +function calculateProfileScore($member) { + $values = [ + ((isset($member["_metadata"]["birth"]["age"]) && $member["_metadata"]["birth"]["age"] > 0) || isset($member["_metadata"]["birth"]["year"]) && $member["_metadata"]["birth"]["year"] > 1900) || ((isset($member["_metadata"]["birth"]["age"]) && $member["_metadata"]["birth"]["age"] === -1) && in_array("alicorn", $member["_metadata"]["species"])), + isset($member["_metadata"]["birth"]["date"]) && trim($member["_metadata"]["birth"]["date"]) !== "" && $member["_metadata"]["birth"]["date"] !== "01-01", + file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/" . $member["id"] . ".html") && strlen(preg_replace("/[^a-zA-Z0-9]/m", "", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/" . $member["id"] . ".html"))) > 200, + file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/" . $member["id"] . "-private.html") && strlen(preg_replace("/[^a-zA-Z0-9]/m", "", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/" . $member["id"] . "-private.html"))) > 200, + isset($member["banner"]), + file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member["name"] . ".png"), + isset($member["color"]) + ]; + + $result = [ + "values" => $values, + "pages" => [], + "characters" => [], + "score" => (float)array_reduce($values, function ($a, $b) { + return $a + $b; + }), + "score2" => (float)array_reduce($values, function ($a, $b) { + return $a + $b; + }), + "actions" => [] + ]; + + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/" . $member["id"] . ".html") && strlen(preg_replace("/[^a-zA-Z0-9]/m", "", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/" . $member["id"] . ".html"))) <= 200) { + $result["pages"][] = true; + $result["score"] += strlen(preg_replace("/[^a-zA-Z0-9]/m", "", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/" . $member["id"] . ".html"))) / 201; + } else { + $result["pages"][] = false; + } + + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/" . $member["id"] . "-private.html") && strlen(preg_replace("/[^a-zA-Z0-9]/m", "", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/" . $member["id"] . "-private.html"))) <= 200) { + $result["pages"][] = true; + $result["score"] += strlen(preg_replace("/[^a-zA-Z0-9]/m", "", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/" . $member["id"] . "-private.html"))) / 201; + } else { + $result["pages"][] = false; + } + + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/" . $member["id"] . ".html")) { + $result["characters"][] = strlen(preg_replace("/[^a-zA-Z0-9]/m", "", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/" . $member["id"] . ".html"))); + } else { + $result["characters"][] = -1; + } + + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/" . $member["id"] . "-private.html")) { + $result["characters"][] = strlen(preg_replace("/[^a-zA-Z0-9]/m", "", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/" . $member["id"] . "-private.html"))); + } else { + $result["characters"][] = -1; + } + + if (!((isset($member["_metadata"]["birth"]["age"]) && $member["_metadata"]["birth"]["age"] > 0) || isset($member["_metadata"]["birth"]["year"]) && $member["_metadata"]["birth"]["year"] > 1900) && !(isset($member["_metadata"]["birth"]["age"]) && $member["_metadata"]["birth"]["age"] === -1) && in_array("alicorn", $member["_metadata"]["species"])) { + $result["score"] += 0.5; + } + + $result["progress"] = $result["score"] / 7; + $result["sortable"] = (int)($result["progress"] * 100000000000000); + + if (!$result["values"][5]) { + $result["actions"][] = "a Pony Town character"; + } + + if (!$result["values"][6]) { + $result["actions"][] = "a color"; + } + + if (!$result["values"][2]) { + if ($result["characters"][0] === -1) { + $result["actions"][] = "a public page"; + } else { + $result["actions"][] = (200 - $result["characters"][0]) . " characters to the public page"; + } + } + + if (!$result["values"][3]) { + if ($result["characters"][1] === -1) { + $result["actions"][] = "a private page"; + } else { + $result["actions"][] = (200 - $result["characters"][1]) . " characters to the private page"; + } + } + + if (!$result["values"][4]) { + $result["actions"][] = "a banner"; + } + + if (!$result["values"][0]) { + $result["actions"][] = "an age"; + } + + if (!$result["values"][1]) { + $result["actions"][] = "a birthdate"; + } + + return $result; +}
\ No newline at end of file diff --git a/includes/rainbow.inc b/includes/rainbow.inc index 470f288..fba960e 100644 --- a/includes/rainbow.inc +++ b/includes/rainbow.inc @@ -4,8 +4,15 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.inc"; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/bitset.inc"; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/score.inc"; -function rainbow(): array { +function rainbow($hideCloudburst = false): array { $members = scoreOrderGlobal(); + + if ($hideCloudburst) { + $members = array_filter($members, function ($i) { + return $i["_system"] === "gdapd"; + }); + } + $data = []; foreach ($members as $member) { @@ -33,8 +40,8 @@ function rainbow(): array { return $data; } -function getMembersByColor(): array { - $members = rainbow(); +function getMembersByColor($hideCloudburst = false): array { + $members = rainbow($hideCloudburst); uasort($members, function ($a, $b) { return $a['hsl'][0] - $b['hsl'][0]; }); diff --git a/includes/score.inc b/includes/score.inc index 21baf67..703b9cc 100644 --- a/includes/score.inc +++ b/includes/score.inc @@ -1,7 +1,6 @@ <?php function calculateScore($metadata, $name) { - $scoreHost = $metadata["host"] ? 10000 : 0; $scoreFictive = $metadata["fictive"] ? 200 : 0; $scoreLittle = $metadata["little"] === 2 ? 100 : ($metadata["little"] === 1 ? 50 : ($metadata["little"] === 3 ? 75 : 0)); $scoreNotTalking = $metadata["not_talking"] ? -200 : 0; @@ -13,16 +12,17 @@ function calculateScore($metadata, $name) { $relations = (count($metadata["marefriends"]) * ($metadata["little"] ? 1 : 2)) + count($metadata["sisters"]); $scoreRelations = $relations * 50; + $scoreLeader = $metadata["leader"] ? 10000 : 0; + $scorePersecutor = $metadata["persecutor"] ? -10000 : 0; + $scoreAdd = 0; if ($name === "Cloudy Dreams") $scoreAdd += 250; - if ($name === "Zoom Zephyrwing") $scoreAdd += 2500; - if ($name === "Thunder") $scoreAdd += 2500; - if ($name === "Scoots/Mia") $scoreAdd -= 495; + if ($name === "Scootaloo") $scoreAdd -= 235; - $score = $scoreHost + $scoreFictive + $scoreLittle + $scoreNotTalking + $scoreProtector + $scoreSharedMemory + $scoreRelations + $scoreSpecies + $scoreName + $scoreMedian + $scoreAdd; + $score = $scoreLeader + $scorePersecutor + $scoreFictive + $scoreLittle + $scoreNotTalking + $scoreProtector + $scoreSharedMemory + $scoreRelations + $scoreSpecies + $scoreName + $scoreMedian + $scoreAdd; return [ - "host" => $scoreHost, + "leader" => $scoreLeader, "fictive" => $scoreFictive, "little" => $scoreLittle, "median" => $scoreMedian, @@ -32,6 +32,7 @@ function calculateScore($metadata, $name) { "shared_memory" => $scoreSharedMemory, "relations" => $scoreRelations, "species" => $scoreSpecies, + "persecutor" => $scorePersecutor, "additional" => $scoreAdd, "total" => $score ]; diff --git a/includes/search.inc b/includes/search.inc index f240363..c125556 100644 --- a/includes/search.inc +++ b/includes/search.inc @@ -1,13 +1,15 @@ +<?php global $lang; global $pages; ?> + <div id="global-search-container" style="display: none; position: fixed; z-index: 99999999;background-color: rgba(0, 0, 0, .75); inset: 0; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); align-items: center; justify-content: center;"> <div id="global-search-box" style="background: rgba(50, 50, 50, .5); color: white; backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px); border-radius: 15px; width: 768px; max-width: 90vw;"> <div id="global-search-input-container" onclick="document.getElementById('global-search-input').focus();" style="cursor:text;padding: 10px 50px; font-size: 22px; border: 1px solid rgba(100, 100, 100, .5); border-top-left-radius: 15px; border-top-right-radius: 15px; width: 768px; max-width: 90vw;"> - <span onchange="globalSearchPlaceholder(); globalSearch();" onkeyup="globalSearchPlaceholder(); globalSearch();" onkeydown="globalSearchPlaceholder(); globalSearch();" type="text" id="global-search-input" style="vertical-align: middle; display:inline-block; background: transparent; color: white; border: none;" spellcheck="false" contenteditable="true"></span><span id="global-search-placeholder" style="opacity:.5;">Website Search</span><span id="global-search-autocomplete" style="vertical-align: middle; opacity:.5;"></span><span id="global-search-action" style="vertical-align: middle; opacity:.5;font-size:16px;"></span> + <span onchange="globalSearchPlaceholder(); globalSearch();" onkeyup="globalSearchPlaceholder(); globalSearch();" onkeydown="globalSearchPlaceholder(); globalSearch();" type="text" id="global-search-input" style="vertical-align: middle; display:inline-block; background: transparent; color: white; border: none;" spellcheck="false" contenteditable="true"></span><span id="global-search-placeholder" style="opacity:.5;"><?= $lang["search"]["title"] ?></span><span id="global-search-autocomplete" style="vertical-align: middle; opacity:.5;"></span><span id="global-search-action" style="vertical-align: middle; opacity:.5;font-size:16px;"></span> </div> <div id="global-search-results" style="border-bottom-left-radius: 15px; border-bottom-right-radius: 15px; border-top-style: none; border-right: 1px solid rgba(100, 100, 100, .5); border-bottom: 1px solid rgba(100, 100, 100, .5); border-left: 1px solid rgba(100, 100, 100, .5); width: 768px; max-width: 90vw; height: 400px; max-height: calc(90vh - 60px);"> <div id="global-search-intro" style="display: flex; align-items: center; justify-content: center; height: 100%; text-align: center;"> <div style="opacity: .5;"> <img src="/assets/logo/logo.png" style="width: 64px; height: 64px; margin-bottom: 10px;"> - <p>Start typing to search for something on the entire website.</p> + <p><?= $lang["search"]["placeholder"] ?></p> </div> </div> <div id="global-search-list" style="overflow: auto; display: flex; align-items: center; justify-content: center; height: 100%; text-align: center;"></div> @@ -22,9 +24,9 @@ const pages_list = JSON.parse(atob(`<?php $base = array_values(array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/pages"), function ($i) { - return !str_starts_with($i, ".") && $i !== "page.inc" && $i !== "api.inc" && $i !== "demo.inc" && $i !== "logout.inc" && $i !== "edit.inc" && $i !== "edit-private.inc" && $i !== "app.inc" && !str_ends_with($i, ".bak.php") && !str_ends_with($i, ".old.php") && !str_ends_with($i, "-dev.php") && !str_ends_with($i, ".bak.inc") && !str_ends_with($i, ".old.inc") && !str_ends_with($i, "-dev.inc"); + return !str_starts_with($i, ".") && $i !== "page.inc" && $i !== "api.inc" && $i !== "demo.inc" && $i !== "logout.inc" && $i !== "edit.inc" && $i !== "metadata.inc" && $i !== "edit-private.inc" && $i !== "app.inc" && !str_ends_with($i, ".bak.php") && !str_ends_with($i, ".old.php") && !str_ends_with($i, "-dev.php") && !str_ends_with($i, ".bak.inc") && !str_ends_with($i, ".old.inc") && !str_ends_with($i, "-dev.inc"); })); - $list = array_values(array_filter(array_map(function ($i) { + $list = array_values(array_filter(array_map(function ($i) use ($lang) { global $pages; global $isLoggedIn; @@ -32,8 +34,8 @@ return null; } else { return [ - 'name' => in_array(substr($i, 0, strlen($i) - 4), array_keys($pages)) ? $pages[substr($i, 0, strlen($i) - 4)]["name"] : substr($i, 0, strlen($i) - 4), - 'description' => in_array(substr($i, 0, strlen($i) - 4), array_keys($pages)) ? ($pages[substr($i, 0, strlen($i) - 4)]["short"] ?? $pages[substr($i, 0, strlen($i) - 4)]["name"]) : substr($i, 0, strlen($i) - 4), + 'name' => in_array(substr($i, 0, strlen($i) - 4), array_keys($pages)) ? $pages[substr($i, 0, strlen($i) - 4)]["name"][$lang["_name"]] : substr($i, 0, strlen($i) - 4), + 'description' => in_array(substr($i, 0, strlen($i) - 4), array_keys($pages)) ? ($pages[substr($i, 0, strlen($i) - 4)]["short"] ?? $pages[substr($i, 0, strlen($i) - 4)]["name"][$lang["_name"]]) : substr($i, 0, strlen($i) - 4), 'url' => "/-/" . substr($i, 0, strlen($i) - 4), 'icon' => "/assets/icons/" . (file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/icons/" . substr($i, 0, strlen($i) - 4) . ".svg") ? substr($i, 0, strlen($i) - 4) : "") . ".svg", 'invert' => true @@ -279,7 +281,7 @@ if (isAutocomplete) { document.getElementById("global-search-autocomplete").innerText = firstResult.name.substring(count); - document.getElementById("global-search-action").innerText = " — View page"; + document.getElementById("global-search-action").innerText = " — <?= $lang["search"]["view"] ?>"; } else { document.getElementById("global-search-autocomplete").innerText = ""; document.getElementById("global-search-action").innerText = " — " + firstResult.name; @@ -319,7 +321,7 @@ scores = results.map((i) => { return i.score; }); let results_ponies = { category: { - name: "Ponies", + name: "<?= $lang["search"]["categories"][0] ?>", id: "ponies" }, average: scores.length > 0 ? scores.reduce((a, b) => { return a + b; }) / results.length : 1, @@ -333,7 +335,7 @@ scores = results.map((i) => { return i.score; }); let results_pages = { category: { - name: "Pages", + name: "<?= $lang["search"]["categories"][1] ?>", id: "pages" }, average: scores.length > 0 ? scores.reduce((a, b) => { return a + b; }) / results.length : 1, @@ -347,7 +349,7 @@ scores = results.map((i) => { return i.score; }); let results_actions = { category: { - name: "Actions", + name: "<?= $lang["search"]["categories"][2] ?>", id: "actions" }, average: scores.length > 0 ? scores.reduce((a, b) => { return a + b; }) / results.length : 1, @@ -361,7 +363,7 @@ scores = results.map((i) => { return i.score; }); let results_documents = { category: { - name: "Documents", + name: "<?= $lang["search"]["categories"][3] ?>", id: "docs" }, average: scores.length > 0 ? scores.reduce((a, b) => { return a + b; }) / results.length : 1, @@ -375,7 +377,7 @@ scores = results.map((i) => { return i.score; }); let results_toys = { category: { - name: "Toys", + name: "<?= $lang["search"]["categories"][4] ?>", id: "toys" }, average: scores.length > 0 ? scores.reduce((a, b) => { return a + b; }) / results.length : 1, diff --git a/includes/short.inc b/includes/short.inc index 6883cc7..98efd20 100644 --- a/includes/short.inc +++ b/includes/short.inc @@ -4,7 +4,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.inc"; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/bitset.inc"; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/score.inc"; -global $toplevel; +global $toplevel; global $lang; global $pages; header("Content-Type: text/plain"); $members = scoreOrderGlobal(); @@ -45,8 +45,8 @@ if (in_array($toplevel, array_keys($list)) && $list[$toplevel]) { if ($toplevel !== "unknown") { header("Location: " . $list[$toplevel]); } else { - header("Location: /?error=Page not found: " . strip_tags($toplevel)) and die(); + header("Location: /?error=" . $lang["app"]["page"] . " " . strip_tags($toplevel)) and die(); } } else { - header("Location: /?error=Page not found: " . strip_tags($toplevel)) and die(); + header("Location: /?error=" . $lang["app"]["page"] . " " . strip_tags($toplevel)) and die(); }
\ No newline at end of file diff --git a/includes/subsysbanner.inc b/includes/subsysbanner.inc index 176380f..2f85dc3 100644 --- a/includes/subsysbanner.inc +++ b/includes/subsysbanner.inc @@ -9,6 +9,7 @@ global $system; global $subsystemData; global $subsystemID; global $subsystem; +global $lang; global $pages; $fronters = array_map(function ($item) { return $item["id"]; @@ -23,7 +24,7 @@ $fronters = array_map(function ($item) { <h3 style="height:max-content;"><?= $subsystemData["name"] ?></h3> <div style="height:max-content;display:grid;grid-template-columns: repeat(4, 1fr);" id="member-card"> <span> - <b>Fronter:</b> + <b><?= $lang["subsystem"]["fronter"] ?></b> <?php if (in_array($fronters[0], $subsystem["members"])): $member = getMember($fronters[0]); ?> <a class="member-link" href="/<?= $member["name"] ?>"><img src="<?= getAsset($member['system'], $member["id"], "heads") ?>" style="width:24px;"> <?= getMiniName($member["display_name"] ?? $member["name"]) ?></a> <?php else: ?> @@ -49,14 +50,14 @@ $fronters = array_map(function ($item) { } ?> - <b>Last fronter: </b><a class="member-link" href="/<?= $member["name"] ?>"><img src="<?= getAsset($systemID + <b><?= $lang["subsystem"]["last"] ?> </b><a class="member-link" href="/<?= $member["name"] ?>"><img src="<?= getAsset($systemID , $member["id"], "heads") ?>" style="width:24px;"> <?= getMiniName($member["display_name"] ?? $member["name"]) ?></a> </span> <span> - <b>Members:</b> <?= count($subsystem["members"]) ?> + <b><?= $lang["subsystem"]["members"] ?></b> <?= count($subsystem["members"]) ?> </span> <span> - <b>Parent system:</b> <a class="member-link" href="/<?= $system ?>"><img style="width:24px;border-radius:5px;" src="/assets/uploads/<?= $system ?>.png"> <?= getMiniName($systemCommonName) ?></a> + <b><?= $lang["subsystem"]["parent"] ?></b> <a class="member-link" href="/<?= $system ?>"><img style="width:24px;border-radius:5px;" src="/assets/uploads/<?= $system ?>.png"> <?= getMiniName($systemCommonName) ?></a> </span> </div> </div> @@ -65,6 +66,6 @@ $fronters = array_map(function ($item) { <div id="system-actions" style="margin-top:10px;padding:5px 10px;background:rgba(255, 255, 255, .1);border-radius:10px;"> <div style="padding: 5px 10px;text-align: center;"> - You are viewing the page of a subsystem of the <b><a style="color:white;text-decoration: none;" href="/<?= $system ?>"><?= $systemCommonName ?></a></b>. + <?= $lang["subsystem"]["intro"] ?> <b><a style="color:white;text-decoration: none;" href="/<?= $system ?>"><?= $systemCommonName ?></a></b>. </div> </div>
\ No newline at end of file diff --git a/includes/sysbanner.inc b/includes/sysbanner.inc index e1789f7..5c85a20 100644 --- a/includes/sysbanner.inc +++ b/includes/sysbanner.inc @@ -6,6 +6,7 @@ global $memberID; global $systemCommonName; global $systemID; global $system; +global $lang; global $pages; $travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling/travelling.json"), true); $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true); @@ -44,17 +45,17 @@ $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pa </span>--> <span> <?php $fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/fronters.json"), true); ?> - <b>Fronter: </b> + <b><?= $lang["system"]["fronter"] ?> </b> <?php if (isset($fronters["members"][0])): ?> <?php $member = $fronters["members"][0]; ?> - <a class="member-link" href="/<?= $member["name"] ?>"><img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= getMiniName($member["display_name"] ?? ($member["name"] === "fusion" ? "<peh-muted>More than one</peh-muted>" : $member["name"])) ?></a> + <a class="member-link" href="/<?= $member["name"] ?>"><img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= getMiniName($member["display_name"] ?? ($member["name"] === "fusion" ? "<peh-muted>" . $lang["system"]["more"] . "</peh-muted>" : $member["name"])) ?></a> <?php if (count($fronters["members"]) > 1): ?> - <br>(with - <?php if (isset($fronters["members"][1])): ?><?php $member2 = $fronters["members"][1]; ?><a class="member-link" href="/<?= $member2["name"] ?>"><img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= getMiniName($member2["display_name"] ?? ($member2["name"] === "fusion" ? "<peh-muted>More than one</peh-muted>" : $member2["name"])) ?></a><?php endif; ?><?php if (isset($fronters["members"][2])): ?><?php $member2 = $fronters["members"][2]; ?>, <a class="member-link" href="/<?= $member2["name"] ?>"><img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= getMiniName($member2["display_name"] ?? ($member2["name"] === "fusion" ? "<peh-muted>More than one</peh-muted>" : $member2["name"])) ?></a><?php endif; ?><?php if (isset($fronters["members"][3])): ?><?php $member2 = $fronters["members"][3]; ?>, <a class="member-link" href="/<?= $member2["name"] ?>"><img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= getMiniName($member2["display_name"] ?? ($member2["name"] === "fusion" ? "<peh-muted>More than one</peh-muted>" : $member2["name"])) ?></a><?php endif; ?>)<?php endif; ?> + <br>(<?= $lang["system"]["with"] ?> + <?php if (isset($fronters["members"][1])): ?><?php $member2 = $fronters["members"][1]; ?><a class="member-link" href="/<?= $member2["name"] ?>"><img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= getMiniName($member2["display_name"] ?? ($member2["name"] === "fusion" ? "<peh-muted>" . $lang["system"]["more"] . "</peh-muted>" : $member2["name"])) ?></a><?php endif; ?><?php if (isset($fronters["members"][2])): ?><?php $member2 = $fronters["members"][2]; ?>, <a class="member-link" href="/<?= $member2["name"] ?>"><img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= getMiniName($member2["display_name"] ?? ($member2["name"] === "fusion" ? "<peh-muted>" . $lang["system"]["more"] . "</peh-muted>" : $member2["name"])) ?></a><?php endif; ?><?php if (isset($fronters["members"][3])): ?><?php $member2 = $fronters["members"][3]; ?>, <a class="member-link" href="/<?= $member2["name"] ?>"><img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= getMiniName($member2["display_name"] ?? ($member2["name"] === "fusion" ? "<peh-muted>" . $lang["system"]["more"] . "</peh-muted>" : $member2["name"])) ?></a><?php endif; ?>)<?php endif; ?> <?php else: ?>-<?php endif; ?> </span> <span> - <b>Last fronter: </b> + <b><?= $lang["system"]["last"] ?> </b> <?php $previous = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/switches.json"), true)[1]["members"]; @@ -71,9 +72,9 @@ $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pa } ?> - <a class="member-link" href="/<?= $member["name"] ?>"><img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= getMiniName($member["display_name"] ?? ($member["name"] === "fusion" ? "<peh-muted>More than one</peh-muted>" : $member["name"])) ?></a> + <a class="member-link" href="/<?= $member["name"] ?>"><img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= getMiniName($member["display_name"] ?? ($member["name"] === "fusion" ? "<peh-muted>" . $lang["system"]["more"] . "</peh-muted>" : $member["name"])) ?></a> <?php if (count($previous) > 1): ?> - <br>(with <?php if (isset($previous[1])): ?><?php $member2 = getMemberWithoutSystem($previous[1]); ?><a class="member-link" href="/<?= $member2["name"] ?>"><img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= getMiniName($member2["display_name"] ?? ($member2["name"] === "fusion" ? "<peh-muted>More than one</peh-muted>" : $member2["name"])) ?></a><?php endif; ?><?php if (isset($previous[2])): ?><?php $member2 = getMemberWithoutSystem($previous[2]); ?>, <a class="member-link" href="/<?= $member2["name"] ?>"><img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= getMiniName($member2["display_name"] ?? ($member2["name"] === "fusion" ? "<peh-muted>More than one</peh-muted>" : $member2["name"])) ?></a><?php endif; ?><?php if (isset($previous[3])): ?><?php $member2 = getMemberWithoutSystem($previous[3]); ?>, <a class="member-link" href="/<?= $member2["name"] ?>"><img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= getMiniName($member2["display_name"] ?? ($member2["name"] === "fusion" ? "<peh-muted>More than one</peh-muted>" : $member2["name"])) ?></a><?php endif; ?>) + <br>(<?= $lang["system"]["with"] ?> <?php if (isset($previous[1])): ?><?php $member2 = getMemberWithoutSystem($previous[1]); ?><a class="member-link" href="/<?= $member2["name"] ?>"><img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= getMiniName($member2["display_name"] ?? ($member2["name"] === "fusion" ? "<peh-muted>" . $lang["system"]["more"] . "</peh-muted>" : $member2["name"])) ?></a><?php endif; ?><?php if (isset($previous[2])): ?><?php $member2 = getMemberWithoutSystem($previous[2]); ?>, <a class="member-link" href="/<?= $member2["name"] ?>"><img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= getMiniName($member2["display_name"] ?? ($member2["name"] === "fusion" ? "<peh-muted>" . $lang["system"]["more"] . "</peh-muted>" : $member2["name"])) ?></a><?php endif; ?><?php if (isset($previous[3])): ?><?php $member2 = getMemberWithoutSystem($previous[3]); ?>, <a class="member-link" href="/<?= $member2["name"] ?>"><img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= getMiniName($member2["display_name"] ?? ($member2["name"] === "fusion" ? "<peh-muted>" . $lang["system"]["more"] . "</peh-muted>" : $member2["name"])) ?></a><?php endif; ?>) <?php endif; ?> <?php else: ?>-<?php endif; ?> </span> @@ -85,16 +86,16 @@ $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pa }); ?> - <b>Members: </b><?= count(scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/members.json"), true), $systemID)) ?><?php + <b><?= $lang["system"]["members"] ?> </b><?= count(scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/members.json"), true), $systemID)) ?><?php if (count($travellers) > 0) { - echo("<br>+ " . count($travellers) . " traveller" . (count($travellers) > 1 ? "s" : "")); + echo("<br>+ " . count($travellers) . " " . (count($travellers) > 1 ? $lang["system"]["traveller"] : $lang["system"]["travellers"])); } ?> </span> <span> - <b>Last switch: </b><span data-bs-toggle="tooltip" title="<?= date("D j M Y, G:i:s (e)", strtotime(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/fronters.json"), true)["timestamp"])) ?>"><?= timeAgo(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/fronters.json"), true)["timestamp"]) ?></span> + <b><?= $lang["system"]["switch"] ?> </b><span data-bs-toggle="tooltip" title="<?= date("D j M Y, G:i:s (e)", strtotime(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/fronters.json"), true)["timestamp"])) ?>"><?= timeAgo(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/fronters.json"), true)["timestamp"]) ?></span> </span> </div> </div> @@ -102,20 +103,20 @@ $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pa </div> <div id="system-actions" style="padding:5px 30px;display:grid;grid-template-columns: 1fr 1fr 1fr 1fr;background-color:rgba(255, 255, 255, .025);margin-left: -20px; margin-right: -20px;"> - <a title="Front history" data-bs-toggle="tooltip" style="display:inline-block;padding:5px 10px;text-align: center" class="system-action tooltip-nohelp" href="/<?= $system ?>/-/history"> + <a title="<?= $pages["s:history"]["name"][$lang["_name"]] ?>" data-bs-toggle="tooltip" style="display:inline-block;padding:5px 10px;text-align: center" class="system-action tooltip-nohelp" href="/<?= $system ?>/-/history"> <img src="/assets/icons/history.svg" style="vertical-align: middle;height: 24px;width: 24px;filter: invert(1)" alt=""> - <span style="vertical-align: middle;" class="list-separator-desktop"><?= $pages["s:history"]["name"] ?></span> + <span style="vertical-align: middle;" class="list-separator-desktop"><?= $pages["s:history"]["name"][$lang["_name"]] ?></span> </a> - <a title="Compare members" data-bs-toggle="tooltip" style="display:inline-block;padding:5px 10px;text-align: center" class="system-action tooltip-nohelp" href="/<?= $system ?>/-/compare"> + <a title="<?= $pages["s:compare"]["name"][$lang["_name"]] ?>" data-bs-toggle="tooltip" style="display:inline-block;padding:5px 10px;text-align: center" class="system-action tooltip-nohelp" href="/<?= $system ?>/-/compare"> <img src="/assets/icons/compare.svg" style="vertical-align: middle;height: 24px;width: 24px;filter: invert(1)" alt=""> - <span style="vertical-align: middle;" class="list-separator-desktop"><?= $pages["s:compare"]["name"] ?></span> + <span style="vertical-align: middle;" class="list-separator-desktop"><?= $pages["s:compare"]["name"][$lang["_name"]] ?></span> </a> - <a title="System tree" data-bs-toggle="tooltip" style="display:inline-block;padding:5px 10px;text-align: center" class="system-action tooltip-nohelp" href="/<?= $system ?>/-/tree"> + <a title="<?= $pages["s:tree"]["name"][$lang["_name"]] ?>" data-bs-toggle="tooltip" style="display:inline-block;padding:5px 10px;text-align: center" class="system-action tooltip-nohelp" href="/<?= $system ?>/-/tree"> <img src="/assets/icons/tree.svg" style="vertical-align: middle;height: 24px;width: 24px;filter: invert(1)" alt=""> - <span style="vertical-align: middle;" class="list-separator-desktop"><?= $pages["s:tree"]["name"] ?></span> + <span style="vertical-align: middle;" class="list-separator-desktop"><?= $pages["s:tree"]["name"][$lang["_name"]] ?></span> </a> - <a title="Members by species" data-bs-toggle="tooltip" style="display:inline-block;padding:5px 10px;text-align: center" class="system-action tooltip-nohelp" href="/<?= $system ?>/-/species"> + <a title="Members <?= $pages["s:species"]["name"][$lang["_name"]] ?>" data-bs-toggle="tooltip" style="display:inline-block;padding:5px 10px;text-align: center" class="system-action tooltip-nohelp" href="/<?= $system ?>/-/species"> <img src="/assets/icons/species.svg" style="vertical-align: middle;height: 24px;width: 24px;filter: invert(1)" alt=""> - <span style="vertical-align: middle;" class="list-separator-desktop"><?= $pages["s:species"]["name"] ?></span> + <span style="vertical-align: middle;" class="list-separator-desktop"><?= $pages["s:species"]["name"][$lang["_name"]] ?></span> </a> </div>
\ No newline at end of file diff --git a/includes/system/compare.inc b/includes/system/compare.inc index d7fbdc6..4f9711d 100644 --- a/includes/system/compare.inc +++ b/includes/system/compare.inc @@ -1,4 +1,4 @@ -<?php global $system; global $systemCommonName; global $systemID; $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true); $title = $pages["s:compare"]["name"] . " · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; global $travelling; +<?php global $system; global $lang; global $pages; global $systemCommonName; global $systemID; $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true); $title = $pages["s:compare"]["name"][$lang["_name"]] . " · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; global $travelling; $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/members.json"), true); @@ -19,75 +19,69 @@ function getMember(string $id) { <br> <div class="container"> - <h2>Compare members of the <?= $systemCommonName ?></h2> + <h2><?= $lang["compare"]["title"] ?> <?= $systemCommonName ?></h2> <div class="comparison"> <span class="comparison-header comparison-item"> - <span class="comparison-header-l0">Member</span> - <span class="comparison-header-l1">Member</span> - <span class="comparison-header-l2">Member</span> - <span class="comparison-header-l3">Member</span> - <span class="comparison-header-l4">Member</span> - <span class="comparison-header-l5"><abbr title="Member" data-bs-toggle="tooltip">Mmbr.</abbr></span> + <span class="comparison-header-l0"><abbr title="<?= $lang["compare"]["member"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["member"][0] ?></abbr></span> + <span class="comparison-header-l1"><abbr title="<?= $lang["compare"]["member"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["member"][1] ?></abbr></span> + <span class="comparison-header-l2"><abbr title="<?= $lang["compare"]["member"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["member"][2] ?></abbr></span> + <span class="comparison-header-l3"><abbr title="<?= $lang["compare"]["member"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["member"][3] ?></abbr></span> + <span class="comparison-header-l4"><abbr title="<?= $lang["compare"]["member"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["member"][4] ?></abbr></span> + <span class="comparison-header-l5"><abbr title="<?= $lang["compare"]["member"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["member"][5] ?></abbr></span> </span> <span class="comparison-header comparison-item"> - <span class="comparison-header-l0">Species</span> - <span class="comparison-header-l1">Species</span> - <span class="comparison-header-l2">Species</span> - <span class="comparison-header-l3">Species</span> - <span class="comparison-header-l4"><abbr title="Species" data-bs-toggle="tooltip">Spec.</abbr></span> - <span class="comparison-header-l5"><abbr title="Species" data-bs-toggle="tooltip">Spec.</abbr></span> + <span class="comparison-header-l0"><abbr title="<?= $lang["compare"]["species"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["species"][0] ?></abbr></span> + <span class="comparison-header-l1"><abbr title="<?= $lang["compare"]["species"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["species"][1] ?></abbr></span> + <span class="comparison-header-l2"><abbr title="<?= $lang["compare"]["species"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["species"][2] ?></abbr></span> + <span class="comparison-header-l3"><abbr title="<?= $lang["compare"]["species"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["species"][3] ?></abbr></span> + <span class="comparison-header-l4"><abbr title="<?= $lang["compare"]["species"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["species"][4] ?></abbr></span> + <span class="comparison-header-l5"><abbr title="<?= $lang["compare"]["species"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["species"][5] ?></abbr></span> </span> <span class="comparison-header comparison-item"> - <span class="comparison-header-l0">Relations</span> - <span class="comparison-header-l1">Relations</span> - <span class="comparison-header-l2">Relations</span> - <span class="comparison-header-l3">Relations</span> - <span class="comparison-header-l4"><abbr title="Relations" data-bs-toggle="tooltip">Relt.</abbr></span> - <span class="comparison-header-l5"><abbr title="Relations" data-bs-toggle="tooltip">Relt.</abbr></span> + <span class="comparison-header-l0"><abbr title="<?= $lang["compare"]["relations"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["relations"][0] ?></abbr></span> + <span class="comparison-header-l1"><abbr title="<?= $lang["compare"]["relations"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["relations"][1] ?></abbr></span> + <span class="comparison-header-l2"><abbr title="<?= $lang["compare"]["relations"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["relations"][2] ?></abbr></span> + <span class="comparison-header-l3"><abbr title="<?= $lang["compare"]["relations"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["relations"][3] ?></abbr></span> + <span class="comparison-header-l4"><abbr title="<?= $lang["compare"]["relations"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["relations"][4] ?></abbr></span> + <span class="comparison-header-l5"><abbr title="<?= $lang["compare"]["relations"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["relations"][5] ?></abbr></span> </span> <span class="comparison-header comparison-item"> - <span class="comparison-header-l0">Memory</span> - <span class="comparison-header-l1">Memory</span> - <span class="comparison-header-l2">Memory</span> - <span class="comparison-header-l3">Memory</span> - <span class="comparison-header-l4"><abbr title="Memory" data-bs-toggle="tooltip">Mem.</abbr></span> - <span class="comparison-header-l5"><abbr title="Memory" data-bs-toggle="tooltip">Mem.</abbr></span> + <span class="comparison-header-l0"><abbr title="<?= $lang["compare"]["memory"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["memory"][0] ?></abbr></span> + <span class="comparison-header-l1"><abbr title="<?= $lang["compare"]["memory"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["memory"][1] ?></abbr></span> + <span class="comparison-header-l2"><abbr title="<?= $lang["compare"]["memory"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["memory"][2] ?></abbr></span> + <span class="comparison-header-l3"><abbr title="<?= $lang["compare"]["memory"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["memory"][3] ?></abbr></span> + <span class="comparison-header-l4"><abbr title="<?= $lang["compare"]["memory"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["memory"][4] ?></abbr></span> + <span class="comparison-header-l5"><abbr title="<?= $lang["compare"]["memory"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["memory"][5] ?></abbr></span> </span> <span class="comparison-header comparison-item"> - <span class="comparison-header-l0">Fictive</span> - <span class="comparison-header-l1">Fictive</span> - <span class="comparison-header-l2">Fictive</span> - <span class="comparison-header-l3">Fictive</span> - <span class="comparison-header-l4"><abbr title="Fictive" data-bs-toggle="tooltip">Fic.</abbr></span> - <span class="comparison-header-l5"><abbr title="Fictive" data-bs-toggle="tooltip">Fic.</abbr></span> + <span class="comparison-header-l0"><abbr title="<?= $lang["compare"]["fictive"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["fictive"][0] ?></abbr></span> + <span class="comparison-header-l1"><abbr title="<?= $lang["compare"]["fictive"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["fictive"][1] ?></abbr></span> + <span class="comparison-header-l2"><abbr title="<?= $lang["compare"]["fictive"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["fictive"][2] ?></abbr></span> + <span class="comparison-header-l3"><abbr title="<?= $lang["compare"]["fictive"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["fictive"][3] ?></abbr></span> + <span class="comparison-header-l4"><abbr title="<?= $lang["compare"]["fictive"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["fictive"][4] ?></abbr></span> + <span class="comparison-header-l5"><abbr title="<?= $lang["compare"]["fictive"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["fictive"][5] ?></abbr></span> </span> <span class="comparison-header comparison-item"> - <span class="comparison-header-l0">Little</span> - <span class="comparison-header-l1">Little</span> - <span class="comparison-header-l2">Little</span> - <span class="comparison-header-l3">Little</span> - <span class="comparison-header-l4"><abbr title="Little" data-bs-toggle="tooltip">Ltl.</abbr></span> - <span class="comparison-header-l5"><abbr title="Little" data-bs-toggle="tooltip">Ltl.</abbr></span> + <span class="comparison-header-l0"><abbr title="<?= $lang["compare"]["little"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["little"][0] ?></abbr></span> + <span class="comparison-header-l1"><abbr title="<?= $lang["compare"]["little"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["little"][1] ?></abbr></span> + <span class="comparison-header-l2"><abbr title="<?= $lang["compare"]["little"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["little"][2] ?></abbr></span> + <span class="comparison-header-l3"><abbr title="<?= $lang["compare"]["little"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["little"][3] ?></abbr></span> + <span class="comparison-header-l4"><abbr title="<?= $lang["compare"]["little"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["little"][4] ?></abbr></span> + <span class="comparison-header-l5"><abbr title="<?= $lang["compare"]["little"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["little"][5] ?></abbr></span> </span> <span class="comparison-header comparison-item"> - <span class="comparison-header-l0">Protector</span> - <span class="comparison-header-l1">Protector</span> - <span class="comparison-header-l2"><abbr title="Protector" data-bs-toggle="tooltip">Protect.</abbr></span> - <span class="comparison-header-l3"><abbr title="Protector" data-bs-toggle="tooltip">Protect.</abbr></span> - <span class="comparison-header-l4"><abbr title="Protector" data-bs-toggle="tooltip">Prt.</abbr></span> - <span class="comparison-header-l5"><abbr title="Protector" data-bs-toggle="tooltip">Prt.</abbr></span> + <span class="comparison-header-l0"><abbr title="<?= $lang["compare"]["protector"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["protector"][0] ?></abbr></span> + <span class="comparison-header-l1"><abbr title="<?= $lang["compare"]["protector"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["protector"][1] ?></abbr></span> + <span class="comparison-header-l2"><abbr title="<?= $lang["compare"]["protector"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["protector"][2] ?></abbr></span> + <span class="comparison-header-l3"><abbr title="<?= $lang["compare"]["protector"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["protector"][3] ?></abbr></span> + <span class="comparison-header-l4"><abbr title="<?= $lang["compare"]["protector"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["protector"][4] ?></abbr></span> + <span class="comparison-header-l5"><abbr title="<?= $lang["compare"]["protector"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["protector"][5] ?></abbr></span> </span> <?php foreach (scoreOrder($members, $systemID) as $member): $metadata = $member["_metadata"]; - if ($member["name"] === "scootaloo") { - if ((int)date('j') % 2 === 0) { - $metadata["marefriends"] = array_reverse($metadata["marefriends"]); - } - } - ?> <a title="<?= $member["display_name"] ?? $member["name"] ?>" data-bs-toggle="tooltip" class="member-link comparison-item comparison-item-clickable" href="/<?= $member["name"] ?>"> <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <span style="vertical-align: middle;"><span class="comparison-name-full"><?= $member["display_name"] ?? $member["name"] ?></span><span class="comparison-name-small"><?= getMiniName($member["display_name"] ?? $member["name"]) ?></span></span> @@ -97,27 +91,27 @@ function getMember(string $id) { <?php foreach ($metadata["species"] ?? [] as $species): ?> <img data-bs-toggle="tooltip" title="<?php switch ($species) { case "earth": - if ($metadata["robot"]) echo "Robot earth pony"; else if ($metadata["plush"]) echo "Earth pony plush"; else echo "Earth pony"; + if ($metadata["robot"]) echo $lang["species"]["earth"][0]; else if ($metadata["plush"]) echo $lang["species"]["earth"][1]; else echo $lang["species"]["earth"][2]; break; case "alicorn": - if ($metadata["robot"]) echo "Robot alicorn"; else if ($metadata["plush"]) echo "Alicorn plush"; else echo "Alicorn"; + if ($metadata["robot"]) echo $lang["species"]["alicorn"][0]; else if ($metadata["plush"]) echo $lang["species"]["alicorn"][1]; else echo $lang["species"]["alicorn"][2]; break; case "crystal": - if ($metadata["robot"]) echo "Robot crystal pony"; else if ($metadata["plush"]) echo "Crystal pony plush"; else echo "Crystal pony"; + if ($metadata["robot"]) echo $lang["species"]["crystal"][0]; else if ($metadata["plush"]) echo $lang["species"]["crystal"][1]; else echo $lang["species"]["crystal"][2]; break; case "pegasus": - if ($metadata["robot"]) echo "Robot pegasus"; else if ($metadata["plush"]) echo "Pegasus plush"; else echo "Pegasus"; + if ($metadata["robot"]) echo $lang["species"]["pegasus"][0]; else if ($metadata["plush"]) echo $lang["species"]["pegasus"][1]; else echo $lang["species"]["pegasus"][2]; break; case "batpony": - if ($metadata["robot"]) echo "Robot bat pony"; else if ($metadata["plush"]) echo "Bat pony plush"; else echo "Bat pony"; + if ($metadata["robot"]) echo $lang["species"]["batpony"][0]; else if ($metadata["plush"]) echo $lang["species"]["batpony"][1]; else echo $lang["species"]["batpony"][2]; break; case "unicorn": - if ($metadata["robot"]) echo "Robot unicorn"; else if ($metadata["plush"]) echo "Unicorn plush"; else echo "Unicorn"; + if ($metadata["robot"]) echo $lang["species"]["unicorn"][0]; else if ($metadata["plush"]) echo $lang["species"]["unicorn"][1]; else echo $lang["species"]["unicorn"][2]; break; default: @@ -135,51 +129,51 @@ function getMember(string $id) { <?php $index = 0; foreach ($metadata["marefriends"] as $marefriend): $mfSystem = explode("/", $marefriend)[0]; $mfMemberID = explode("/", $marefriend)[1]; $mfMember = array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$mfSystem/members.json"), true), function ($item) { global $mfMemberID; return $item["id"] === $mfMemberID; - }); sort($mfMember); $mfMember = $mfMember[0]; ?><a title="<b><?= $mfMember["display_name"] ?? $mfMember["name"] ?></b><br>Marefriend" data-bs-toggle="tooltip" data-bs-html="true" class="member-link tooltip-nohelp" href="/<?= $mfMember["name"] ?>"><img src="<?= getAsset($mfSystem, $mfMember["id"], "heads") ?>" style="width:24px;"></a><?php $index++; endforeach; ?><?php $index = 0; foreach ($metadata["sisters"] as $marefriend): $mfSystem = explode("/", $marefriend)[0]; $mfMemberID = explode("/", $marefriend)[1]; $mfMember = array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$mfSystem/members.json"), true), function ($item) { + }); sort($mfMember); $mfMember = $mfMember[0]; ?><a title="<b><?= $mfMember["display_name"] ?? $mfMember["name"] ?></b><br><?= $lang["compare"]["status"][0] ?>" data-bs-toggle="tooltip" data-bs-html="true" class="member-link tooltip-nohelp" href="/<?= $mfMember["name"] ?>"><img src="<?= getAsset($mfSystem, $mfMember["id"], "heads") ?>" style="width:24px;"></a><?php $index++; endforeach; ?><?php $index = 0; foreach ($metadata["sisters"] as $marefriend): $mfSystem = explode("/", $marefriend)[0]; $mfMemberID = explode("/", $marefriend)[1]; $mfMember = array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$mfSystem/members.json"), true), function ($item) { global $mfMemberID; return $item["id"] === $mfMemberID; - }); sort($mfMember); $mfMember = $mfMember[0]; ?><a title="<b><?= $mfMember["display_name"] ?? $mfMember["name"] ?></b><br>Sister" data-bs-toggle="tooltip" data-bs-html="true" class="member-link tooltip-nohelp" href="/<?= $mfMember["name"] ?>"><img src="<?= getAsset($mfSystem, $mfMember["id"], "heads") ?>" style="width:24px;"></a><?php $index++; endforeach; ?><?php $index = 0; foreach ($metadata["caretakers"] as $marefriend): $mfSystem = explode("/", $marefriend)[0]; $mfMemberID = explode("/", $marefriend)[1]; $mfMember = array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$mfSystem/members.json"), true), function ($item) { + }); sort($mfMember); $mfMember = $mfMember[0]; ?><a title="<b><?= $mfMember["display_name"] ?? $mfMember["name"] ?></b><br><?= $lang["compare"]["status"][1] ?>" data-bs-toggle="tooltip" data-bs-html="true" class="member-link tooltip-nohelp" href="/<?= $mfMember["name"] ?>"><img src="<?= getAsset($mfSystem, $mfMember["id"], "heads") ?>" style="width:24px;"></a><?php $index++; endforeach; ?><?php $index = 0; foreach ($metadata["caretakers"] as $marefriend): $mfSystem = explode("/", $marefriend)[0]; $mfMemberID = explode("/", $marefriend)[1]; $mfMember = array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$mfSystem/members.json"), true), function ($item) { global $mfMemberID; return $item["id"] === $mfMemberID; - }); sort($mfMember); $mfMember = $mfMember[0]; ?><a title="<b><?= $mfMember["display_name"] ?? $mfMember["name"] ?></b><br>Caretaker" data-bs-toggle="tooltip" data-bs-html="true" class="member-link tooltip-nohelp" href="/<?= $mfMember["name"] ?>"><img src="<?= getAsset($mfSystem, $mfMember["id"], "heads") ?>" style="width:24px;"></a><?php $index++; endforeach; ?> + }); sort($mfMember); $mfMember = $mfMember[0]; ?><a title="<b><?= $mfMember["display_name"] ?? $mfMember["name"] ?></b><br><?= $lang["compare"]["status"][2] ?>" data-bs-toggle="tooltip" data-bs-html="true" class="member-link tooltip-nohelp" href="/<?= $mfMember["name"] ?>"><img src="<?= getAsset($mfSystem, $mfMember["id"], "heads") ?>" style="width:24px;"></a><?php $index++; endforeach; ?> </span> </span> <span class="comparison-item"> <?php if ($metadata["shared_memory"] > 0): ?> <?php if ($metadata["shared_memory"] === 1): ?> - <img data-bs-toggle="tooltip" title="Partial" src="/assets/icons/partial.svg" alt="Partial" style="width:24px;"> + <img data-bs-toggle="tooltip" title="<?= $lang["compare"]["state"][1] ?>" src="/assets/icons/partial.svg" alt="<?= $lang["compare"]["state"][1] ?>" style="width:24px;"> <?php else: ?> - <img data-bs-toggle="tooltip" title="Yes" src="/assets/icons/complete.svg" alt="Yes" style="width:24px;"> + <img data-bs-toggle="tooltip" title="<?= $lang["compare"]["state"][0] ?>" src="/assets/icons/complete.svg" alt="<?= $lang["compare"]["state"][0] ?>" style="width:24px;"> <?php endif; ?> <?php else: ?> - <img data-bs-toggle="tooltip" title="No" src="/assets/icons/none.svg" alt="No" style="width:24px;"> + <img data-bs-toggle="tooltip" title="<?= $lang["compare"]["state"][2] ?>" src="/assets/icons/none.svg" alt="<?= $lang["compare"]["state"][2] ?>" style="width:24px;"> <?php endif; ?> </span> <span class="comparison-item"> <?php if ($metadata["fictive"]): ?> - <img data-bs-toggle="tooltip" title="Yes" src="/assets/icons/complete.svg" alt="Yes" style="width:24px;"> + <img data-bs-toggle="tooltip" title="<?= $lang["compare"]["state"][0] ?>" src="/assets/icons/complete.svg" alt="<?= $lang["compare"]["state"][0] ?>" style="width:24px;"> <?php else: ?> - <img data-bs-toggle="tooltip" title="No" src="/assets/icons/none.svg" alt="No" style="width:24px;"> + <img data-bs-toggle="tooltip" title="<?= $lang["compare"]["state"][2] ?>" src="/assets/icons/none.svg" alt="<?= $lang["compare"]["state"][2] ?>" style="width:24px;"> <?php endif; ?> </span> <span class="comparison-item"> - <?php if ($metadata["little"] >= 2): ?> - <img data-bs-toggle="tooltip" title="Yes" src="/assets/icons/complete.svg" alt="Yes" style="width:24px;"> - <?php elseif ($metadata["little"] === 1): ?> - <img data-bs-toggle="tooltip" title="Age regressor" src="/assets/icons/partial.svg" alt="Partial" style="width:24px;"> + <?php if ($metadata["little"] === 2): ?> + <img data-bs-toggle="tooltip" title="<?= $lang["compare"]["state"][0] ?>" src="/assets/icons/complete.svg" alt="<?= $lang["compare"]["state"][0] ?>" style="width:24px;"> + <?php elseif ($metadata["little"] === 3): ?> + <img data-bs-toggle="tooltip" title="<?= $lang["compare"]["state"][3] ?>" src="/assets/icons/partial.svg" alt="<?= $lang["compare"]["state"][1] ?>" style="width:24px;"> <?php else: ?> - <img data-bs-toggle="tooltip" title="No" src="/assets/icons/none.svg" alt="No" style="width:24px;"> + <img data-bs-toggle="tooltip" title="<?= $lang["compare"]["state"][2] ?>" src="/assets/icons/none.svg" alt="<?= $lang["compare"]["state"][2] ?>" style="width:24px;"> <?php endif; ?> </span> <span class="comparison-item"> <?php if ($metadata["protector"]): ?> <?php if ($travelling[$member["id"]]["travelling"]): ?> - <img data-bs-toggle="tooltip" title="Yes, but currently travelling" src="/assets/icons/partial.svg" alt="Yes, but currently travelling" style="width:24px;"> + <img data-bs-toggle="tooltip" title="<?= $lang["compare"]["state"][4] ?>" src="/assets/icons/partial.svg" alt="<?= $lang["compare"]["state"][4] ?>" style="width:24px;"> <?php else: ?> - <img data-bs-toggle="tooltip" title="Yes" src="/assets/icons/complete.svg" alt="Yes" style="width:24px;"> + <img data-bs-toggle="tooltip" title="<?= $lang["compare"]["state"][0] ?>" src="/assets/icons/complete.svg" alt="<?= $lang["compare"]["state"][0] ?>" style="width:24px;"> <?php endif; ?> <?php else: ?> - <img data-bs-toggle="tooltip" title="No" src="/assets/icons/none.svg" alt="No" style="width:24px;"> + <img data-bs-toggle="tooltip" title="<?= $lang["compare"]["state"][2] ?>" src="/assets/icons/none.svg" alt="<?= $lang["compare"]["state"][2] ?>" style="width:24px;"> <?php endif; ?> </span> <?php endforeach; ?> diff --git a/includes/system/history.inc b/includes/system/history.inc index 31a7c73..b66b8c4 100644 --- a/includes/system/history.inc +++ b/includes/system/history.inc @@ -1,4 +1,4 @@ -<?php global $system; global $systemCommonName; $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true); $title = $pages["s:history"]["name"] . " · " . $systemCommonName; global $systemID; $title = "Front history · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; +<?php global $system; global $lang; global $pages; global $systemCommonName; $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true); $title = $pages["s:history"]["name"][$lang["_name"]] . " · " . $systemCommonName; global $systemID; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; function getMember(string $id) { global $systemID; @@ -28,6 +28,40 @@ function getMember(string $id) { } }); + function frenchIfRequired($original) { + global $lang; + + if ($lang["_french"]) { + if ($original === "Today") return "Aujourd'hui"; + if ($original === "Yesterday") return "Hier"; + + $original = str_replace("Jan", "janv.", $original); + $original = str_replace("Feb", "fév.", $original); + $original = str_replace("Mar", "mars", $original); + $original = str_replace("Apr", "avr.", $original); + $original = str_replace("May", "mai", $original); + $original = str_replace("Jun", "juin", $original); + $original = str_replace("Jul", "juil.", $original); + $original = str_replace("Aug", "août", $original); + $original = str_replace("Sep", "sept.", $original); + $original = str_replace("Oct", "oct.", $original); + $original = str_replace("Nov", "nov.", $original); + $original = str_replace("Dec", "déc.", $original); + + $original = str_replace("Mon", "Lun.", $original); + $original = str_replace("Tue", "Mar.", $original); + $original = str_replace("Wed", "Mer.", $original); + $original = str_replace("Thu", "Jeu.", $original); + $original = str_replace("Fri", "Ven.", $original); + $original = str_replace("Sat", "Sam.", $original); + $original = str_replace("Sun", "Dim.", $original); + + return $original; + } else { + return $original; + } + } + function getSwitchesForDay(int $day) { global $switches; @@ -76,9 +110,9 @@ function getMember(string $id) { } ?> - <h2>Front history in the <?= $systemCommonName ?></h2> + <h2><?= $lang["history"]["title"] ?> <?= $systemCommonName ?></h2> <div class="alert alert-warning" id="timezone" style="display: none;"> - Times on this page are now shown using your local timezone (<span id="timezone-name">-</span>). Days start at <span id="day-start">-</span> (00:00 on UTC). + <?= str_replace("%1", '<span id="timezone-name">-</span>', str_replace("%2", '<span id="day-start">-</span>', $lang["history"]["timezone"])) ?> <script> document.getElementById("day-start").innerText = new Date(<?= strtotime(date('Y-m-d')) ?> * 1000).toTimeString().substring(0, 5); document.getElementById("timezone-name").innerText = new Date().toTimeString().split("(")[1].split(")")[0]; @@ -99,7 +133,7 @@ function getMember(string $id) { $switchesDay = getSwitchesForDay($day[1]); $switchesDay[] = getSwitchBefore($switchesDay[count($switchesDay) - 1]["id"]); ?> - <h4 style="margin-top:15px;"><?= $day[0] ?></h4> + <h4 style="margin-top:15px;"><?= frenchIfRequired($day[0]) ?></h4> <?php foreach ($switchesDay as $switch): $switch["timestamp"] = strtotime($switch["timestamp"]); ?> <?php if (isset($switch["members"][0])): $member = getMemberWithoutSystem($switch["members"][0]); ?> <div class="fronter"> @@ -111,7 +145,7 @@ function getMember(string $id) { <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> </a> <?php if (count($switch["members"]) > 1): ?> - (with + (<?= $lang["system"]["with"] ?> <?php if (isset($switch["members"][1])): $member2 = getMember($switch["members"][1]); ?><a class="member-link" href="/<?= $member2["name"] ?>"><img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a><?php endif; ?><?php if (isset($switch["members"][2])): $member2 = getMember($switch["members"][2]); ?>, <a class="member-link" href="/<?= $member2["name"] ?>"><img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a><?php endif; ?><?php if (isset($switch["members"][3])): $member2 = getMember($switch["members"][3]); ?>, <a class="member-link" href="/<?= $member2["name"] ?>"><img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a><?php endif; ?>) <?php endif; ?> </span> @@ -122,7 +156,7 @@ function getMember(string $id) { <?= isNotToday($switch["timestamp"], $day[1]) ? "00:00" : date('H:i', $switch["timestamp"]) ?> </span> <span class="fronter-profile" style="vertical-align: middle;"> - <span class="text-muted">Fallback pony</span> + <span class="text-muted"><?= $lang["history"]["fallback"] ?></span> </span> </div> <?php endif; ?> diff --git a/includes/system/species.inc b/includes/system/species.inc index fb1ba69..45a0178 100644 --- a/includes/system/species.inc +++ b/includes/system/species.inc @@ -1,4 +1,4 @@ -<?php global $system; global $systemCommonName; global $systemID; $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true); $title = $pages["s:species"]["name"] . " · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; global $travelling; +<?php global $system; global $systemCommonName; global $lang; global $pages; global $systemID; $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true); $title = $pages["s:species"]["name"][$lang["_name"]] . " · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; global $travelling; $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/members.json"), true); $members = scoreOrder($members, $systemID); @@ -36,7 +36,7 @@ function species(array $members, string $id, string $name) { global $systemID; g <br> <div class="container" id="page-content"> - <h2><?= $systemCommonName ?> members by species</h2> + <h2><?= str_replace("%1", $systemCommonName, $lang["species_compare"]["title"]) ?></h2> <?php $earth = []; @@ -59,12 +59,12 @@ function species(array $members, string $id, string $name) { global $systemID; g ?> - <?php species($earth, "earth", "Earth ponies"); ?> - <?php species($pegasus, "pegasus", "Pegasi"); ?> - <?php species($unicorn, "unicorn", "Unicorns"); ?> - <?php species($alicorn, "alicorn", "Alicorns"); ?> - <?php species($batpony, "batpony", "Bat ponies"); ?> - <?php species($crystal, "crystal", "Crystal ponies"); ?> + <?php species($earth, "earth", $lang["species"]["earth"][3]); ?> + <?php species($pegasus, "pegasus", $lang["species"]["pegasus"][3]); ?> + <?php species($unicorn, "unicorn", $lang["species"]["unicorn"][3]); ?> + <?php species($alicorn, "alicorn", $lang["species"]["alicorn"][3]); ?> + <?php species($batpony, "batpony", $lang["species"]["batpony"][3]); ?> + <?php species($crystal, "crystal", $lang["species"]["crystal"][3]); ?> </div> <?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?>
\ No newline at end of file diff --git a/includes/system/subsystem.inc b/includes/system/subsystem.inc index b7d73f1..3269df7 100644 --- a/includes/system/subsystem.inc +++ b/includes/system/subsystem.inc @@ -1,4 +1,4 @@ -<?php global $system; global $systemCommonName; global $parts; global $systemID; +<?php global $system; global $systemCommonName; global $lang; global $pages; global $parts; global $systemID; if (str_ends_with($_GET['_'], "/subsystem")) header("Location: /?error=Invalid subsystem ID") and die(); diff --git a/includes/system/tree.inc b/includes/system/tree.inc index 92e7c08..6a2d1cc 100644 --- a/includes/system/tree.inc +++ b/includes/system/tree.inc @@ -1,4 +1,4 @@ -<?php global $system; global $systemCommonName; global $systemID; $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true); $title = $pages["s:tree"]["name"] . " · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; +<?php global $system; global $systemCommonName; global $lang; global $pages; global $systemID; $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true); $title = $pages["s:tree"]["name"][$lang["_name"]] . " · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/members.json"), true); $members = scoreOrder($members, $systemID); @@ -61,16 +61,16 @@ function getMemberSubsystem(array $member) { <br> <div class="container" id="page-content"> - <h2>System tree for the <?= $systemCommonName ?></h2> + <h2><?= $lang["tree"]["title"] ?> <?= $systemCommonName ?></h2> <a class="tree-root member-link" href="/<?= $system ?>"> - <img src="/assets/uploads/<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/" . $system . ".png") ? $system : "" ?>.png" style="width:24px;"> <span style="vertical-align: middle;"><?= $systemCommonName ?></span></a> + <img src="/assets/uploads/<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/" . $system . ".png") ? $system : "" ?>.png" style="height:24px;"> <span style="vertical-align: middle;"><?= $systemCommonName ?></span></a> <?php $first = true; ?> <?php foreach ($subsystems as $subsystem): if ($subsystem["source_type"] === "trait"): ?> <div class="tree-l0"> <div class="tree-l0-separator<?= $first ? " tree-first-separator" : "" ?>"> </div> <div class="tree-inner"> <a class="member-link" href="/<?= $systemID === "gdapd" ? "raindrops" : "cloudburst" ?>/-/subsystem/<?= $subsystem["source"] ?>"> - <img src="/assets/uploads/ss-<?= $subsystem["source"] ?>.png" style="width:24px;border-radius:5px;"> <span style="vertical-align: middle;"><?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/subsystems/$systemID-$subsystem[source].json") ? json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/subsystems/$systemID-$subsystem[source].json"), true)["name"] : $subsystem["source"] ?></span> + <img src="/assets/uploads/ss-<?= $subsystem["source"] ?>.png" style="height:24px;border-radius:5px;"> <span style="vertical-align: middle;"><?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/subsystems/$systemID-$subsystem[source].json") ? json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/subsystems/$systemID-$subsystem[source].json"), true)["name"] : $subsystem["source"] ?></span> </a> </div> <?php $ssfirst = true; foreach ($subsystem["members"] as $ssm): $ssmember = getMember($ssm); ?> @@ -79,7 +79,7 @@ function getMemberSubsystem(array $member) { <div class="tree-l1-separator<?= $ssfirst ? " tree-first-separator" : "" ?>"> </div> <div class="tree-inner"> <a class="member-link" href="/<?= $ssmember["name"] ?>"> - <img src="<?= getAsset($systemID, $ssmember["id"], "heads") ?>" style="width:24px;"> <span style="vertical-align: middle;"><?= $ssmember["display_name"] ?? $ssmember["name"] ?></span> + <img src="<?= getAsset($systemID, $ssmember["id"], "heads") ?>" style="height:24px;"> <span style="vertical-align: middle;"><?= $ssmember["display_name"] ?? $ssmember["name"] ?></span> </a> </div> </div> @@ -91,7 +91,7 @@ function getMemberSubsystem(array $member) { <div class="tree-l0-separator<?= $first ? " tree-first-separator" : "" ?>"> </div> <div class="tree-inner"> <a class="member-link" href="/<?= $member["name"] ?>"> - <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <span style="vertical-align: middle;"><?= $member["display_name"] ?? $member["name"] ?></span> + <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="height:24px;"> <span style="vertical-align: middle;"><?= $member["display_name"] ?? $member["name"] ?></span> </a> </div> <?php if (memberHasSubsystem($member)): ?> @@ -101,7 +101,7 @@ function getMemberSubsystem(array $member) { <div class="tree-l1-separator<?= $ssfirst ? " tree-first-separator" : "" ?>"> </div> <div class="tree-inner"> <a class="member-link" href="/<?= $ssmember["name"] ?>"> - <img src="<?= getAsset($systemID, $ssmember["id"], "heads") ?>" style="width:24px;"> <span style="vertical-align: middle;"><?= $ssmember["display_name"] ?? $ssmember["name"] ?></span> + <img src="<?= getAsset($systemID, $ssmember["id"], "heads") ?>" style="height:24px;"> <span style="vertical-align: middle;"><?= $ssmember["display_name"] ?? $ssmember["name"] ?></span> </a> </div> </div> diff --git a/includes/titlebar.inc b/includes/titlebar.inc index 5166f08..b0c1e8b 100644 --- a/includes/titlebar.inc +++ b/includes/titlebar.inc @@ -1,4 +1,4 @@ -<?php global $toplevel; global $system; global $isLoggedIn; $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true); ?> +<?php global $toplevel; global $system; global $isLoggedIn; global $lang; global $pages; $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true); global $lang; global $pages; ?> <span> <?php @@ -16,7 +16,7 @@ $part3 = null; if (isset($pages[$name])) { if (($name === "docs" || $name === "toys" || $name === "actions" || $name === "computers") && isset($parts[2])) { $part3 = "<a class='title-bar-backlink' href='/-/dashboard'>Dashboard</a>"; - $part2 = "<a class='title-bar-backlink' href='/-/$name'>" . $pages[$name]['name'] . "</a>"; + $part2 = "<a class='title-bar-backlink' href='/-/$name'>" . $pages[$name]['name'][$lang["_name"]] . "</a>"; if ($name === "docs") { $actionsProfile = "docs-item"; @@ -32,10 +32,10 @@ if (isset($pages[$name])) { } } else { if ($pages[$name]["admin"]) { - $part1 = $pages[$name]['name']; + $part1 = $pages[$name]['name'][$lang["_name"]]; $part2 = "<a class='title-bar-backlink' href='/-/dashboard'>Dashboard</a>"; } else { - $part1 = $pages[$name]['name']; + $part1 = $pages[$name]['name'][$lang["_name"]]; } } } elseif ($name === "cloudburst") { @@ -46,7 +46,7 @@ if (isset($pages[$name])) { $actionsProfile = "subsystem"; $part1 = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/subsystems/ynmuc-$parts[3].json"), true)["name"]; } else { - $part1 = $pages["s:" . $parts[2]]['name'] ?? $parts[2]; + $part1 = $pages["s:" . $parts[2]]['name'][$lang["_name"]] ?? $parts[2]; } } else { $actionsProfile = "system"; @@ -60,7 +60,7 @@ if (isset($pages[$name])) { $actionsProfile = "subsystem"; $part1 = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/subsystems/gdapd-$parts[3].json"), true)["name"]; } else { - $part1 = $pages["s:" . $parts[2]]['name'] ?? $parts[2]; + $part1 = $pages["s:" . $parts[2]]['name'][$lang["_name"]] ?? $parts[2]; } } else { $actionsProfile = "system"; @@ -147,7 +147,7 @@ echo("</span>"); $links = [ "default" => [ [ - "name" => "Go back to top", + "name" => $lang["titlebar"]["top"], "link" => [ "type" => "js", "text" => "document.body.scrollTop = 0; document.documentElement.scrollTop = 0;" @@ -185,7 +185,7 @@ $links = [ "invert" => true ], [ - "name" => "Go back to top", + "name" => $lang["titlebar"]["top"], "link" => [ "type" => "js", "text" => "document.body.scrollTop = 0; document.documentElement.scrollTop = 0;" @@ -234,7 +234,7 @@ $links = [ "invert" => true ], [ - "name" => "Go back to top", + "name" => $lang["titlebar"]["top"], "link" => [ "type" => "js", "text" => "document.body.scrollTop = 0; document.documentElement.scrollTop = 0;" @@ -254,7 +254,7 @@ $links = [ "invert" => true ], [ - "name" => "Go back to top", + "name" => $lang["titlebar"]["top"], "link" => [ "type" => "js", "text" => "document.body.scrollTop = 0; document.documentElement.scrollTop = 0;" @@ -274,7 +274,7 @@ $links = [ "invert" => true ], [ - "name" => "Go back to top", + "name" => $lang["titlebar"]["top"], "link" => [ "type" => "js", "text" => "document.body.scrollTop = 0; document.documentElement.scrollTop = 0;" @@ -285,7 +285,7 @@ $links = [ ], "member" => [ [ - "name" => "System", + "name" => $lang["titlebar"]["member"], "link" => [ "type" => "url", "text" => "/$system" @@ -294,7 +294,7 @@ $links = [ "invert" => true ], [ - "name" => $pages["edit-private"]["name"], + "name" => $pages["edit-private"]["name"][$lang["_name"]], "link" => [ "type" => "url", "text" => "/-/edit-private/$system/$name" @@ -304,7 +304,7 @@ $links = [ "show" => $isLoggedIn ], [ - "name" => $pages["edit"]["name"], + "name" => $pages["edit"]["name"][$lang["_name"]], "link" => [ "type" => "url", "text" => "/-/edit/$system/$name" @@ -314,7 +314,7 @@ $links = [ "show" => $isLoggedIn ], [ - "name" => "Go back to top", + "name" => $lang["titlebar"]["top"], "link" => [ "type" => "js", "text" => "document.body.scrollTop = 0; document.documentElement.scrollTop = 0;" @@ -325,7 +325,7 @@ $links = [ ], "subsystem" => [ [ - "name" => "Parent system", + "name" => $lang["titlebar"]["subsystem"], "link" => [ "type" => "url", "text" => "/$parts[0]" @@ -334,7 +334,7 @@ $links = [ "invert" => true ], [ - "name" => $pages["edit"]["name"], + "name" => $pages["edit"]["name"][$lang["_name"]], "link" => [ "type" => "url", "text" => "/-/edit/$system/" . ($parts[3] ?? null) @@ -344,7 +344,7 @@ $links = [ "show" => $isLoggedIn ], [ - "name" => "Go back to top", + "name" => $lang["titlebar"]["top"], "link" => [ "type" => "js", "text" => "document.body.scrollTop = 0; document.documentElement.scrollTop = 0;" @@ -355,15 +355,6 @@ $links = [ ], "home" => [ [ - "name" => "Cloudburst System", - "link" => [ - "type" => "url", - "text" => "/cloudburst" - ], - "icon" => "/assets/avatars/ade46823206b4b0cad3ccaae934a5f3b.webp", - "invert" => false - ], - [ "name" => "Raindrops System", "link" => [ "type" => "url", @@ -373,7 +364,7 @@ $links = [ "invert" => false ], [ - "name" => "Go back to top", + "name" => $lang["titlebar"]["top"], "link" => [ "type" => "js", "text" => "document.body.scrollTop = 0; document.documentElement.scrollTop = 0;" @@ -442,7 +433,7 @@ $links = [ "invert" => true ], [ - "name" => "Go back to top", + "name" => $lang["titlebar"]["top"], "link" => [ "type" => "js", "text" => "document.body.scrollTop = 0; document.documentElement.scrollTop = 0;" @@ -462,7 +453,7 @@ $links = [ "invert" => true ], [ - "name" => "Go back to top", + "name" => $lang["titlebar"]["top"], "link" => [ "type" => "js", "text" => "document.body.scrollTop = 0; document.documentElement.scrollTop = 0;" @@ -473,7 +464,7 @@ $links = [ ], "debug" => [ [ - "name" => "Reported failures", + "name" => $lang["titlebar"]["debug"][0], "link" => [ "type" => "url", "text" => "#failures" @@ -482,7 +473,7 @@ $links = [ "invert" => true ], [ - "name" => "Processing times", + "name" => $lang["titlebar"]["debug"][1], "link" => [ "type" => "url", "text" => "#times" @@ -491,7 +482,7 @@ $links = [ "invert" => true ], [ - "name" => "Go back to top", + "name" => $lang["titlebar"]["top"], "link" => [ "type" => "js", "text" => "document.body.scrollTop = 0; document.documentElement.scrollTop = 0;" @@ -542,7 +533,7 @@ $links = [ ], "system" => [ [ - "name" => $pages["s:history"]["name"], + "name" => $pages["s:history"]["name"][$lang["_name"]], "link" => [ "type" => "url", "text" => "/$name/-/history" @@ -551,7 +542,7 @@ $links = [ "invert" => true ], [ - "name" => $pages["s:compare"]["name"], + "name" => $pages["s:compare"]["name"][$lang["_name"]], "link" => [ "type" => "url", "text" => "/$name/-/compare" @@ -560,7 +551,7 @@ $links = [ "invert" => true ], [ - "name" => $pages["s:tree"]["name"], + "name" => $pages["s:tree"]["name"][$lang["_name"]], "link" => [ "type" => "url", "text" => "/$name/-/tree" @@ -569,7 +560,7 @@ $links = [ "invert" => true ], [ - "name" => $pages["s:species"]["name"], + "name" => $pages["s:species"]["name"][$lang["_name"]], "link" => [ "type" => "url", "text" => "/$name/-/species" @@ -578,7 +569,7 @@ $links = [ "invert" => true ], [ - "name" => $pages["edit"]["name"], + "name" => $pages["edit"]["name"][$lang["_name"]], "link" => [ "type" => "url", "text" => "/-/edit/$name" @@ -588,7 +579,7 @@ $links = [ "show" => $isLoggedIn ], [ - "name" => "Go back to top", + "name" => $lang["titlebar"]["top"], "link" => [ "type" => "js", "text" => "document.body.scrollTop = 0; document.documentElement.scrollTop = 0;" @@ -599,6 +590,18 @@ $links = [ ] ]; +if ($_SERVER['HTTP_HOST'] !== "fr.equestria.horse") { + array_unshift($links["home"], [ + "name" => "Cloudburst System", + "link" => [ + "type" => "url", + "text" => "/cloudburst" + ], + "icon" => "/assets/avatars/ade46823206b4b0cad3ccaae934a5f3b.webp", + "invert" => false + ]); +} + $linksList = $links[isset($links[$actionsProfile]) ? $actionsProfile : "default"]; ?><!-- (<code><?= $actionsProfile ?></code>)--><!--<pre><?php var_dump($parts); ?></pre>--> diff --git a/includes/travelling.inc b/includes/travelling.inc index b0b58f0..18bf22e 100644 --- a/includes/travelling.inc +++ b/includes/travelling.inc @@ -25,6 +25,10 @@ foreach ($members as $member) { @file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling/travelling.json", utf8_encode(json_encode($travelling, JSON_PRETTY_PRINT))); } + + if (!isset($travelling[$member["id"]]["equestria"])) { + $travelling[$member["id"]]["equestria"] = false; + } } function withTravelers(array $members, string $system): array { @@ -35,13 +39,13 @@ function withTravelers(array $members, string $system): array { $i['system'] = $system; return $i; }, array_filter($members, function ($i) use ($travelling) { - return !(isset($travelling[$i['id']]) && $travelling[$i['id']]['travelling']); + return !(isset($travelling[$i['id']]) && $travelling[$i['id']]['travelling'] && (!isset($travelling[$i['id']]['equestria']) || !$travelling[$i['id']]['equestria'])); })), ...array_filter(array_map(function ($i) use ($system) { $i['system'] = $system === "gdapd" ? "ynmuc" : "gdapd"; return $i; }, json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($system === "gdapd" ? "ynmuc" : "gdapd") . "/members.json"), true)), function ($i) use ($travelling) { - return isset($travelling[$i['id']]) && $travelling[$i['id']]['travelling']; + return isset($travelling[$i['id']]) && $travelling[$i['id']]['travelling'] && (!isset($travelling[$i['id']]['equestria']) || !$travelling[$i['id']]['equestria']); }) ]; }
\ No newline at end of file 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'; ?> diff --git a/updatepages.js b/updatepages.js new file mode 100644 index 0000000..a22bef4 --- /dev/null +++ b/updatepages.js @@ -0,0 +1,17 @@ +let original = require('./includes/pages.json'); + +let languages = [ + "fr" +] + +for (let page in original) { + let data = original[page]; + + for (let lang of languages) { + data["name"][lang] = data["name"]["en"]; + } + + original[page] = data; +} + +require('fs').writeFileSync("./includes/pages.json", JSON.stringify(original, null, 2));
\ No newline at end of file |