diff options
Diffstat (limited to 'includes')
-rw-r--r-- | includes/components/details.inc (renamed from includes/details.inc) | 4 | ||||
-rw-r--r-- | includes/components/emergency.inc (renamed from includes/emergency.inc) | 0 | ||||
-rw-r--r-- | includes/components/footer.inc (renamed from includes/footer.inc) | 4 | ||||
-rw-r--r-- | includes/components/fullbanner.inc (renamed from includes/fullbanner.inc) | 2 | ||||
-rw-r--r-- | includes/components/header.inc (renamed from includes/header.inc) | 33 | ||||
-rw-r--r-- | includes/components/mobilenav.inc (renamed from includes/mobilenav.inc) | 2 | ||||
-rw-r--r-- | includes/components/navigation.inc (renamed from includes/navigation.inc) | 10 | ||||
-rw-r--r-- | includes/components/pane.inc (renamed from includes/pane.inc) | 2 | ||||
-rw-r--r-- | includes/components/planner.inc (renamed from includes/planner.inc) | 16 | ||||
-rw-r--r-- | includes/components/search.inc (renamed from includes/search.inc) | 0 | ||||
-rw-r--r-- | includes/components/sysbanner.inc (renamed from includes/sysbanner.inc) | 2 | ||||
-rw-r--r-- | includes/components/wakeup.inc (renamed from includes/wakeup.inc) | 0 | ||||
-rw-r--r-- | includes/exchange.txt | 2 | ||||
-rw-r--r-- | includes/fragments/edit-private.inc (renamed from includes/edit-private.inc) | 6 | ||||
-rw-r--r-- | includes/fragments/edit.inc (renamed from includes/edit.inc) | 6 | ||||
-rw-r--r-- | includes/fragments/member.inc (renamed from includes/member.inc) | 10 | ||||
-rw-r--r-- | includes/fragments/metadata.inc (renamed from includes/metadata.inc) | 6 | ||||
-rw-r--r-- | includes/fragments/sysedit.inc (renamed from includes/sysedit.inc) | 8 | ||||
-rw-r--r-- | includes/fragments/system.inc (renamed from includes/system.inc) | 6 | ||||
-rw-r--r-- | includes/init.inc | 6 | ||||
-rw-r--r-- | includes/language.inc | 10 | ||||
-rw-r--r-- | includes/pages.json | 2 | ||||
-rw-r--r-- | includes/rail.inc | 167 | ||||
-rw-r--r-- | includes/refresh.php | 8 | ||||
-rw-r--r-- | includes/refresh/assets.inc (renamed from includes/assets.inc) | 30 | ||||
-rw-r--r-- | includes/refresh/backup.inc (renamed from includes/backup.inc) | 25 | ||||
-rw-r--r-- | includes/refresh/cleanup.inc (renamed from includes/cleanup.inc) | 21 | ||||
-rw-r--r-- | includes/refresh/logo.inc (renamed from includes/logo.inc) | 6 | ||||
-rw-r--r-- | includes/system/compare.inc | 4 | ||||
-rw-r--r-- | includes/system/history.inc | 4 | ||||
-rw-r--r-- | includes/titlebar.inc | 606 | ||||
-rw-r--r-- | includes/util/Parsedown.php (renamed from includes/Parsedown.php) | 0 | ||||
-rw-r--r-- | includes/util/agewarning.inc (renamed from includes/agewarning.inc) | 0 | ||||
-rw-r--r-- | includes/util/banner.inc (renamed from includes/banner.inc) | 6 | ||||
-rw-r--r-- | includes/util/bitset.inc (renamed from includes/bitset.inc) | 0 | ||||
-rw-r--r-- | includes/util/functions.inc (renamed from includes/functions.inc) | 10 | ||||
-rw-r--r-- | includes/util/homepage.inc (renamed from includes/homepage.inc) | 2 | ||||
-rw-r--r-- | includes/util/language.inc | 3 | ||||
-rw-r--r-- | includes/util/profiles.inc (renamed from includes/profiles.inc) | 0 | ||||
-rw-r--r-- | includes/util/pronouns.inc (renamed from includes/pronouns.inc) | 0 | ||||
-rw-r--r-- | includes/util/rainbow.inc (renamed from includes/rainbow.inc) | 6 | ||||
-rw-r--r-- | includes/util/random.inc (renamed from includes/random.inc) | 0 | ||||
-rw-r--r-- | includes/util/score.inc (renamed from includes/score.inc) | 0 | ||||
-rw-r--r-- | includes/util/session.inc (renamed from includes/session.inc) | 2 | ||||
-rw-r--r-- | includes/util/short.inc (renamed from includes/short.inc) | 6 | ||||
-rw-r--r-- | includes/util/travelling.inc (renamed from includes/travelling.inc) | 0 |
46 files changed, 109 insertions, 934 deletions
diff --git a/includes/details.inc b/includes/components/details.inc index 7f96884..b7d0ebe 100644 --- a/includes/details.inc +++ b/includes/components/details.inc @@ -1,5 +1,5 @@ <?php global $isLoggedIn; global $metadata; global $memberData; global $isLowerLoggedIn; global $systemID; global $app; global $lang; global $pages; $pronouns = getMemberPronouns($memberData['pronouns']); ?> -<div id="member-details" class="<?= (($isLoggedIn || $isLowerLoggedIn) && $systemID !== $app["other"]["id"]) ? 'member-details-loggedIn' : '' ?>" style="<?php if ((!$isLoggedIn && !$isLowerLoggedIn) || $systemID === $app["other"]["id"]): ?>grid-template-columns: repeat(4, 1fr);<?php endif; ?> background-color: <?= isset($memberData["color"]) ? '#' . $memberData["color"] . "33" : "transparent" ?>; margin-left: -20px; margin-right: -20px;"> +<div id="member-details" class="<?= (($isLoggedIn || $isLowerLoggedIn) && $systemID !== $app["other"]["id"]) ? 'member-details-loggedIn' : 'member-details-loggedIn2' ?>" style="<?php if (!$isLoggedIn && !$isLowerLoggedIn): ?>grid-template-columns: repeat(4, 1fr);<?php endif; ?> background-color: <?= isset($memberData["color"]) ? '#' . $memberData["color"] . "33" : "transparent" ?>; margin-left: -20px; margin-right: -20px;"> <div> <b><?= $lang["details"]["food"] ?></b><span class="member-small-separator"><br></span> <?= match ($metadata["food"]) { @@ -17,7 +17,6 @@ 2 => "<span data-bs-toggle='tooltip' title='" . str_replace("'", "'", ucfirst($pronouns["subjective"])) . ($pronouns["third"] ? " shares" : " share") . " all memories with " . str_replace("'", "'", $pronouns["possessive_det"]) . " headmates.'>" . $lang["details"]["memory_states"][2] . "</span>", } ?> </div> - <?php if ($systemID !== $app["other"]["id"]): ?> <?php if ($isLoggedIn || $isLowerLoggedIn): ?> <div> <b>Age:</b><span class="member-small-separator"><br></span> @@ -56,6 +55,7 @@ <?php endif; ?> </div> <?php endif; ?> + <?php if ($systemID !== $app["other"]["id"]): ?> <div> <b><?= $lang["details"]["code"] ?></b><span class="member-small-separator"><br></span> <?php if (isset($metadata["code"]) && trim($metadata["code"]) !== ""): ?> diff --git a/includes/emergency.inc b/includes/components/emergency.inc index 5490985..5490985 100644 --- a/includes/emergency.inc +++ b/includes/components/emergency.inc diff --git a/includes/footer.inc b/includes/components/footer.inc index b2fb277..2cef58f 100644 --- a/includes/footer.inc +++ b/includes/components/footer.inc @@ -1,7 +1,7 @@ <?php global $pageFile; -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.inc"; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; ?> @@ -36,7 +36,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.inc"; }) </script> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/search.inc"; ?> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/components/search.inc"; ?> </body> </html>
\ No newline at end of file diff --git a/includes/fullbanner.inc b/includes/components/fullbanner.inc index 4f78101..ddd59df 100644 --- a/includes/fullbanner.inc +++ b/includes/components/fullbanner.inc @@ -5,7 +5,7 @@ <?php if ($memberData["name"] !== "unknown" && $memberData["name"] !== "fusion"): ?> <div id="member-banner-container"> <div id="member-banner"></div> - <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/details.inc"; ?> + <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/components/details.inc"; ?> </div> <?php else: ?> <div id="member-banner"></div> diff --git a/includes/header.inc b/includes/components/header.inc index 02cb190..7c4cfc8 100644 --- a/includes/header.inc +++ b/includes/components/header.inc @@ -12,7 +12,7 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/.test")) { $isNormallyLoggedIn = false; -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn; global $isUserLoggedIn; global $isLowerLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $isUserLoggedIn; global $isLowerLoggedIn; if ($readOnly && $isLoggedIn || $readOnly && $isUserLoggedIn) { $isLoggedIn = false; $isUserLoggedIn = false; @@ -49,13 +49,13 @@ $page = $pages[$toplevel] ?? [ "rail" => false ]; -require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/travelling.inc"; global $travelling; -require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/score.inc"; -require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/pronouns.inc"; -require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/bitset.inc"; -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/banner.inc"; -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/rainbow.inc"; -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.inc"; +require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/util/travelling.inc"; global $travelling; +require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/util/score.inc"; +require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/util/pronouns.inc"; +require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/util/bitset.inc"; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/banner.inc"; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/rainbow.inc"; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; ?> <!doctype html> @@ -70,7 +70,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.inc"; <link rel="shortcut icon" href="/assets/logo/newlogo<?= $isLoggedIn || $isLowerLoggedIn ? "3" : "" ?>.png" type="image/png"> </head> <body<?php if ($page["rail"] && $isLoggedIn && !$useNewUI): ?> id="admin-page"<?php endif; ?>> - <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/navigation.inc"; global $navigation; ?> + <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/components/navigation.inc"; global $navigation; ?> <?php if (!$useNewUI): ?> <div style="margin-top: 60px;" id="top-of-page"></div> @@ -78,16 +78,10 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.inc"; <?php if ($useNewUI): ?> <aside id="navigation-pane"> - <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/pane.inc"; ?> + <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/components/pane.inc"; ?> </aside> - <div id="title-bar"> - <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/titlebar.inc"; ?> - </div> - - <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/mobilenav.inc"; ?> - - <div id="titlebar-separator" style="margin-top: 34px;"></div> + <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/components/mobilenav.inc"; ?> <style> body { @@ -95,7 +89,6 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.inc"; } .modal.show { - top: 34px; left: 300px; width: calc(100% - 300px); } @@ -225,7 +218,3 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.inc"; } </style> <?php endif; ?> - -<?php if ($page["rail"] && $isLoggedIn && !$useNewUI): ?> - <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/rail.inc"; ?> -<?php endif; ?> diff --git a/includes/mobilenav.inc b/includes/components/mobilenav.inc index ed778ec..646738c 100644 --- a/includes/mobilenav.inc +++ b/includes/components/mobilenav.inc @@ -8,7 +8,7 @@ </a> <?php foreach ($navigation as $id => $item): if (!$item["admin"] || $isLoggedIn): ?> <a onclick="toggleMobileNavigation('<?= $id ?>');" title="<?= $item["name"] ?>" data-bs-toggle="tooltip" id="mobile-navigation-item-<?= $id ?>" class="tooltip-nohelp mobile-navigation-item"> - <img src="<?= $item["icon"] ?>" <?php if ($item["invert"]): ?>class="dropdown-icon"<?php endif; ?> alt="" style="width:24px;vertical-align: middle;"> + <img src="<?= $item["icon"] ?>" <?php if ($item["invert"]): ?>class="dropdown-icon"<?php endif; ?> alt="" style="width:24px;vertical-align: middle;border-radius:3px;"> </a> <?php endif; endforeach; ?> </div> diff --git a/includes/navigation.inc b/includes/components/navigation.inc index 976cfff..beb92bb 100644 --- a/includes/navigation.inc +++ b/includes/components/navigation.inc @@ -39,14 +39,6 @@ $navigation_admin = [ "minimal" => false, "items" => [ [ - "name" => $pages["about"]["name"][$lang["_name"]], - "icon" => "/assets/icons/about.svg", - "invert" => true, - "link" => "/-/about", - "stepped" => null, - "private" => false - ], - [ "name" => $pages["fronting"]["name"][$lang["_name"]], "icon" => "/assets/icons/fronting.svg", "invert" => true, @@ -233,7 +225,7 @@ $navigation_global = [ ] ]; $navigation_cloudburst = [ - "admin" => $_SERVER['HTTP_HOST'] === "fr.equestria.horse", + "admin" => false, "name" => "Cloudburst System", "icon" => getAsset("ynmuc"), "invert" => false, diff --git a/includes/pane.inc b/includes/components/pane.inc index d135eac..28ccd71 100644 --- a/includes/pane.inc +++ b/includes/components/pane.inc @@ -37,7 +37,7 @@ foreach ($list as $color) { <div class="pane-group" id="pane-group-<?= $id ?>"> <div class="pane-group-title"> - <img src="<?= $item["icon"] ?>" <?php if ($item["invert"]): ?>class="dropdown-icon"<?php endif; ?> alt="" style="width:24px;vertical-align: middle;"> + <img src="<?= $item["icon"] ?>" <?php if ($item["invert"]): ?>class="dropdown-icon"<?php endif; ?> alt="" style=" border-radius: 2px;width:24px;vertical-align: middle;"> <span style="vertical-align: middle;"><?= $item["name"] ?></span> </div> diff --git a/includes/planner.inc b/includes/components/planner.inc index e553627..a7ec44f 100644 --- a/includes/planner.inc +++ b/includes/components/planner.inc @@ -1,13 +1,13 @@ <?php -require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/travelling.inc"; global $travelling; -require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/score.inc"; -require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/pronouns.inc"; -require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/bitset.inc"; -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn; global $isUserLoggedIn; global $isLowerLoggedIn; -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/banner.inc"; -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/rainbow.inc"; -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.inc"; +require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/util/travelling.inc"; global $travelling; +require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/util/score.inc"; +require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/util/pronouns.inc"; +require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/util/bitset.inc"; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $isUserLoggedIn; global $isLowerLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/banner.inc"; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/rainbow.inc"; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; global $_PROFILE; $cloudburst = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/planner/ynmuc.json"), true); diff --git a/includes/search.inc b/includes/components/search.inc index 278ec41..278ec41 100644 --- a/includes/search.inc +++ b/includes/components/search.inc diff --git a/includes/sysbanner.inc b/includes/components/sysbanner.inc index 763c961..8819617 100644 --- a/includes/sysbanner.inc +++ b/includes/components/sysbanner.inc @@ -15,7 +15,7 @@ $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pa <div id="system-info" style="display:grid;grid-template-columns: 128px 1fr;background-color:rgba(255, 255, 255, .05);margin-left: -20px; margin-right: -20px;margin-top:-20px;padding: 20px 20px 10px;"> <div style="display: flex; align-items: center; justify-content: center;"> - <img src="<?= getAsset($systemID) ?>" alt="" style="width:128px;max-height:128px;border-top-left-radius:10px;border-bottom-left-radius:10px;"> + <img src="<?= getAsset($systemID) ?>" alt="" style="width:128px;max-height:128px;border-radius:10px;"> </div> <div style="padding:10px 10px 10px 20px;text-align:center;"> <div style="display: grid; grid-template-columns: 1fr;height:100%;grid-template-rows: max-content max-content 1fr;"> diff --git a/includes/wakeup.inc b/includes/components/wakeup.inc index 587e705..587e705 100644 --- a/includes/wakeup.inc +++ b/includes/components/wakeup.inc diff --git a/includes/exchange.txt b/includes/exchange.txt index 79156ae..07cccdc 100644 --- a/includes/exchange.txt +++ b/includes/exchange.txt @@ -1 +1 @@ -0.88
\ No newline at end of file +0.89
\ No newline at end of file diff --git a/includes/edit-private.inc b/includes/fragments/edit-private.inc index 69f50d8..998dfdd 100644 --- a/includes/edit-private.inc +++ b/includes/fragments/edit-private.inc @@ -1,4 +1,4 @@ -<?php global $system; global $systemCommonName; global $systemID; global $member; global $memberData; global $memberCommonName; global $memberID; $title = "Editing " . $memberCommonName . " (private page) · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; +<?php global $system; global $systemCommonName; global $systemID; global $member; global $memberData; global $memberCommonName; global $memberID; $title = "Editing " . $memberCommonName . " (private page) · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/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)); @@ -8,7 +8,7 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $member <br> <div class="container"> - <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/fullbanner.inc"; ?> + <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/components/fullbanner.inc"; ?> <p class="text-muted" id="page-content"> <span id="editor-save-status" class="text-muted">Saved</span> · <span id="editor-size"><?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/$memberID-private.html") ? strlen(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/$memberID-private.html")) : "0" ?></span> bytes · <a href="/<?= $memberData["name"] ?>">View page</a> @@ -139,4 +139,4 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $member </script> </div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?>
\ No newline at end of file +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/footer.inc'; ?>
\ No newline at end of file diff --git a/includes/edit.inc b/includes/fragments/edit.inc index 61e9f29..b5617f2 100644 --- a/includes/edit.inc +++ b/includes/fragments/edit.inc @@ -1,4 +1,4 @@ -<?php global $system; global $systemCommonName; global $systemID; global $member; global $memberData; global $memberCommonName; global $memberID; $title = "Editing " . $memberCommonName . " (public page) · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; +<?php global $system; global $systemCommonName; global $systemID; global $member; global $memberData; global $memberCommonName; global $memberID; $title = "Editing " . $memberCommonName . " (public page) · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/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)); @@ -8,7 +8,7 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $member <br> <div class="container"> - <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/fullbanner.inc"; ?> + <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/components/fullbanner.inc"; ?> <p class="text-muted" id="page-content"> <span id="editor-save-status" class="text-muted">Saved</span> · <span id="editor-size"><?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/$memberID-private.html") ? strlen(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/$memberID-private.html")) : "0" ?></span> bytes · <a href="/<?= $memberData["name"] ?>">View page</a> @@ -139,4 +139,4 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $member </script> </div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?>
\ No newline at end of file +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/footer.inc'; ?>
\ No newline at end of file diff --git a/includes/member.inc b/includes/fragments/member.inc index b98d0f5..4eed308 100644 --- a/includes/member.inc +++ b/includes/fragments/member.inc @@ -6,7 +6,7 @@ if ($memberData["name"] === "fusion") { $title = $memberCommonName . " · " . $systemCommonName; } -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; $travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling/travelling.json"), true); @@ -53,7 +53,7 @@ if ($memberData["name"] === "fusion") { <br> <div class="container"> <div id="member-page" style="background-color: rgba(26,26,26,0.8);border-radius: 10px;padding:20px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);margin-top:<?= !isset($memberData["banner"]) ? "15vh" : "30vh" ?>;<?php if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/$memberID.html") && !($isLoggedIn && file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/$memberID-private.html"))): ?> padding-bottom: 0 !important;<?php endif; ?>"> - <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/fullbanner.inc"; ?> + <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/components/fullbanner.inc"; ?> <div id="page-content"> <?php if ($memberData["name"] === "unknown"): ?> @@ -98,7 +98,7 @@ if ($memberData["name"] === "fusion") { </div> <div class="container"> - <?php global $isLoggedIn; if ($isLoggedIn): ?> + <?php global $isLoggedIn; global $isLowerLoggedIn; if ($isLoggedIn || ($isLowerLoggedIn && $systemID === $app["other"]["id"])): ?> <hr> <details> @@ -137,7 +137,7 @@ if ($memberData["name"] === "fusion") { <li><b>Protector:</b> <code><?= $metadata["protector"] ? "1" : "0" ?></code> (<?= $metadata["protector"] ? "Yes" : "No" ?>)</li> <li><b>Little:</b> <code><?= $metadata["little"] ?></code> (<?= $metadata["little"] === 2 ? "Is a little" : ($metadata["little"] === 1 ? "Is an age regressor" : ($metadata["little"] === 3 ? "Not a little, but younger" : "No")) ?>)</li> <li><b>Relations count:</b> <code><?= count($metadata["marefriends"]) + count($metadata["sisters"]) ?></code></li> - <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/score.inc"; ?> + <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/score.inc"; ?> <li> <b>Score breakdown:</b> <code>-</code> <ul><li>-</ul></li> @@ -147,4 +147,4 @@ if ($memberData["name"] === "fusion") { <?php endif; ?> </div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?>
\ No newline at end of file +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/footer.inc'; ?>
\ No newline at end of file diff --git a/includes/metadata.inc b/includes/fragments/metadata.inc index 485666a..e143153 100644 --- a/includes/metadata.inc +++ b/includes/fragments/metadata.inc @@ -1,4 +1,4 @@ -<?php global $system; global $app; 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'; +<?php global $system; global $app; global $systemCommonName; global $systemID; global $member; global $memberData; global $memberCommonName; global $memberID; $title = "Editing metadata for " . $memberCommonName . " · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/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)); @@ -120,6 +120,7 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $member <b>Member code</b><br> <input name="membc" class="form-control" style="filter: invert(1) hue-rotate(180deg);" type="text" value="<?= $metadata["code"] ?? "" ?>"> </p> + <?php endif; ?> <hr> @@ -133,7 +134,6 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $member <b>Age (for ponies with fixed age)</b><br> <input name="age" class="form-control" style="filter: invert(1) hue-rotate(180deg);" type="text" pattern="^\d{1,2}(-\d{1,2}|)$" value="<?= $metadata["birth"]["age"] ?? "" ?>"> </p> - <?php endif; ?> <hr> @@ -166,4 +166,4 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $member <?php endif; ?> </div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?>
\ No newline at end of file +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/footer.inc'; ?>
\ No newline at end of file diff --git a/includes/sysedit.inc b/includes/fragments/sysedit.inc index 22ec670..1b341b0 100644 --- a/includes/sysedit.inc +++ b/includes/fragments/sysedit.inc @@ -1,4 +1,4 @@ -<?php global $system; global $systemCommonName; global $systemID; $title = "Editing " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; +<?php global $system; global $systemCommonName; global $systemID; $title = "Editing " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; ?> @@ -11,7 +11,7 @@ <div class="container"> <div id="system-page" style="background-color: rgba(26,26,26,0.8);border-radius: 10px;padding:20px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);margin-top:30vh;"> - <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/sysbanner.inc"; ?> + <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/components/sysbanner.inc"; ?> <br> <p class="text-muted"> @@ -147,7 +147,7 @@ </script> </div> </div> - <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/sysbanner.inc"; ?> + <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/components/sysbanner.inc"; ?> </div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?>
\ No newline at end of file +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/footer.inc'; ?>
\ No newline at end of file diff --git a/includes/system.inc b/includes/fragments/system.inc index ae624f9..030c743 100644 --- a/includes/system.inc +++ b/includes/fragments/system.inc @@ -1,4 +1,4 @@ -<?php global $system; global $isLowerLoggedIn; global $systemCommonName; global $systemID; $title = $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; global $app; global $isLoggedIn; +<?php global $system; global $isLowerLoggedIn; global $systemCommonName; global $systemID; $title = $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; global $app; global $isLoggedIn; ?> @@ -16,7 +16,7 @@ <div class="container"> <div id="system-page" style="background-color: rgba(26,26,26,0.8);border-radius: 10px;padding:20px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);margin-top:30vh;"> - <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/sysbanner.inc"; ?> + <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/components/sysbanner.inc"; ?> <br> <div id="page-content"> @@ -49,4 +49,4 @@ } </style> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?>
\ No newline at end of file +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/footer.inc'; ?>
\ No newline at end of file diff --git a/includes/init.inc b/includes/init.inc index 5fb9ea2..ba523aa 100644 --- a/includes/init.inc +++ b/includes/init.inc @@ -7,7 +7,7 @@ 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; global $isLowerLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $isLowerLoggedIn; if (in_array($toplevel, array_keys($pages))) { $title = $pages[$toplevel]["name"][$lang["_name"]]; @@ -23,9 +23,9 @@ if (in_array($toplevel, array_keys($pages))) { } if ($pages[$toplevel]["limited"]) { - if ((!$isLoggedIn && !$isLowerLoggedIn) || ($readOnly && !$emergencyHeader)) header("Location: /-/login/?return=$toplevel") and die(); + if ((!$isLoggedIn && !$isLowerLoggedIn) || ($readOnly && !$emergencyHeader)) header("Location: /-/login/?return=/-/$toplevel") and die(); } else { - if (!$isLoggedIn || ($readOnly && !$emergencyHeader)) header("Location: /-/login/?return=$toplevel") and die(); + if (!$isLoggedIn || ($readOnly && !$emergencyHeader)) header("Location: /-/login/?return=/-/$toplevel") and die(); } } } else { diff --git a/includes/language.inc b/includes/language.inc deleted file mode 100644 index 424af3b..0000000 --- a/includes/language.inc +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -$default = "en"; - -$lf = $_COOKIE['PEH2_LANGUAGE'] ?? $default; - -if (str_contains("/", $lf)) $lf = "en"; -if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/i18n/" . $lf . ".json")) $lf = "en"; - -$lang = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/i18n/" . $lf . ".json"), true);
\ No newline at end of file diff --git a/includes/pages.json b/includes/pages.json index 8e21cc9..f5e665f 100644 --- a/includes/pages.json +++ b/includes/pages.json @@ -206,7 +206,7 @@ }, "short": "Metadata", "admin": true, - "limited": false, + "limited": true, "rail": false }, "money": { diff --git a/includes/rail.inc b/includes/rail.inc deleted file mode 100644 index e78815e..0000000 --- a/includes/rail.inc +++ /dev/null @@ -1,167 +0,0 @@ -<?php global $pages; ?> -<div id="rail" style="position: fixed;top: 60px;left: 0;bottom: 0;background: rgba(255, 255, 255, .1);width: 32px; display: grid; grid-template-rows: max-content 1fr;"> - <div> - <a id="rl-1" class="rail-link" href="/-/dashboard" style="padding: 4px; display: block;"> - <img alt="" src="/assets/icons/home.svg" style="filter: invert(1); height: 24px; display:block;"> - </a> - <a id="rl-2" class="rail-link" href="/-/fronting" style="padding: 4px; display: block;"> - <img alt="" src="/assets/icons/fronting.svg" style="filter: invert(1); height: 24px; display:block;"> - </a> - <a id="rl-3" class="rail-link" href="/-/actions" style="padding: 4px; display: block;"> - <img alt="" src="/assets/icons/actions.svg" style="filter: invert(1); height: 24px; display:block;"> - </a> - <a id="rl-4" class="rail-link" href="/-/rules" style="padding: 4px; display: block;"> - <img alt="" src="/assets/icons/rules.svg" style="filter: invert(1); height: 24px; display:block;"> - </a> - <a id="rl-5" class="rail-link" href="/-/docs" style="padding: 4px; display: block;"> - <img alt="" src="/assets/icons/docs.svg" style="filter: invert(1); height: 24px; display:block;"> - </a> - <a id="rl-6" class="rail-link" href="/-/nicknames" style="padding: 4px; display: block;"> - <img alt="" src="/assets/icons/nicknames.svg" style="filter: invert(1); height: 24px; display:block;"> - </a> - <a id="rl-7" class="rail-link" href="/-/together" style="padding: 4px; display: block;"> - <img alt="" src="/assets/icons/together.svg" style="filter: invert(1); height: 24px; display:block;"> - </a> - <a id="rl-8" class="rail-link" href="/-/splitting" style="padding: 4px; display: block;"> - <img alt="" src="/assets/icons/splitting.svg" style="filter: invert(1); height: 24px; display:block;"> - </a> - <a id="rl-9" class="rail-link" href="/-/byfront" style="padding: 4px; display: block;"> - <img alt="" src="/assets/icons/byfront.svg" style="filter: invert(1); height: 24px; display:block;"> - </a> - <a id="rl-10" class="rail-link" href="/-/bitset" style="padding: 4px; display: block;"> - <img alt="" src="/assets/icons/bitset.svg" style="filter: invert(1); height: 24px; display:block;"> - </a> - <a id="rl-11" class="rail-link" href="/-/travelling" style="padding: 4px; display: block;"> - <img alt="" src="/assets/icons/travelling.svg" style="filter: invert(1); height: 24px; display:block;"> - </a> - <a id="rl-12" class="rail-link" href="/-/toys" style="padding: 4px; display: block;"> - <img alt="" src="/assets/icons/toys.svg" style="filter: invert(1); height: 24px; display:block;"> - </a> - <a id="rl-16" class="rail-link" href="/-/stats" style="padding: 4px; display: block;"> - <img alt="" src="/assets/icons/stats.svg" style="filter: invert(1) brightness(2000%); height: 24px; display:block;"> - </a> - <a id="rl-87" class="rail-link" href="/-/emergency" style="padding: 4px; display: block;"> - <img alt="" src="/assets/icons/emergency.svg" style="height: 24px; display:block;"> - </a> - <a id="rl-88" class="rail-link" href="/-/wakeup" style="padding: 4px; display: block;"> - <img alt="" src="/assets/icons/wakeup.svg" style="height: 24px; display:block;"> - </a> - <a id="rl-89" class="rail-link" href="/-/pleasure" style="padding: 4px; display: block;"> - <img alt="" src="/assets/icons/pleasure.svg" style="height: 24px; display:block;"> - </a> - </div> - <div style="margin-top: auto; height: max-content;"> - <a id="rl-98" class="rail-link" href="/-/debug" style="padding: 4px; display: block;"> - <img alt="" src="/assets/icons/debug.svg" style="filter: invert(1); height: 24px; display:block;"> - </a> - <a id="rl-99" class="rail-link" href="/-/about" style="padding: 4px; display: block;"> - <img alt="" src="/assets/icons/about.svg" style="filter: invert(1) brightness(2000%); height: 24px; display:block;"> - </a> - </div> -</div> -<div id="rail-text" style="position: fixed;top: 60px;left: 32px;bottom: 0; z-index: 9999999; opacity: 0; pointer-events: none; display: grid; grid-template-rows: max-content 1fr;"> - <div> - <div id="rlt-1" class="rail-text-item" style="height: 32px; display: flex; align-items: center; padding-left: 10px; opacity: 0;"> - <?= $pages["dashboard"]["name"] ?> - </div> - <div id="rlt-2" class="rail-text-item" style="height: 32px; display: flex; align-items: center; padding-left: 10px; opacity: 0;"> - <?= $pages["fronting"]["name"] ?> - </div> - <div id="rlt-3" class="rail-text-item" style="height: 32px; display: flex; align-items: center; padding-left: 10px; opacity: 0;"> - <?= $pages["actions"]["name"] ?> - </div> - <div id="rlt-4" class="rail-text-item" style="height: 32px; display: flex; align-items: center; padding-left: 10px; opacity: 0;"> - <?= $pages["rules"]["name"] ?> - </div> - <div id="rlt-5" class="rail-text-item" style="height: 32px; display: flex; align-items: center; padding-left: 10px; opacity: 0;"> - <?= $pages["docs"]["name"] ?> - </div> - <div id="rlt-6" class="rail-text-item" style="height: 32px; display: flex; align-items: center; padding-left: 10px; opacity: 0;"> - <?= $pages["nicknames"]["name"] ?> - </div> - <div id="rlt-7" class="rail-text-item" style="height: 32px; display: flex; align-items: center; padding-left: 10px; opacity: 0;"> - <?= $pages["together"]["name"] ?> - </div> - <div id="rlt-8" class="rail-text-item" style="height: 32px; display: flex; align-items: center; padding-left: 10px; opacity: 0;"> - <?= $pages["splitting"]["name"] ?> - </div> - <div id="rlt-9" class="rail-text-item" style="height: 32px; display: flex; align-items: center; padding-left: 10px; opacity: 0;"> - <?= $pages["byfront"]["name"] ?> - </div> - <div id="rlt-10" class="rail-text-item" style="height: 32px; display: flex; align-items: center; padding-left: 10px; opacity: 0;"> - <?= $pages["bitset"]["name"] ?> - </div> - <div id="rlt-11" class="rail-text-item" style="height: 32px; display: flex; align-items: center; padding-left: 10px; opacity: 0;"> - <?= $pages["travelling"]["name"] ?> - </div> - <div id="rlt-12" class="rail-text-item" style="height: 32px; display: flex; align-items: center; padding-left: 10px; opacity: 0;"> - <?= $pages["toys"]["name"] ?> - </div> - <div id="rlt-16" class="rail-text-item" style="height: 32px; display: flex; align-items: center; padding-left: 10px; opacity: 0;"> - <?= $pages["stats"]["name"] ?> - </div> - <div id="rlt-87" class="rail-text-item text-danger fw-bold" style="height: 32px; display: flex; align-items: center; padding-left: 10px; opacity: 0;"> - <?= $pages["emergency"]["name"] ?> - </div> - <div id="rlt-88" class="rail-text-item text-info fw-bold" style="height: 32px; display: flex; align-items: center; padding-left: 10px; opacity: 0;"> - <?= $pages["wakeup"]["name"] ?> - </div> - <div id="rlt-89" class="rail-text-item text-success fw-bold" style="height: 32px; display: flex; align-items: center; padding-left: 10px; opacity: 0;"> - <?= $pages["pleasure"]["name"] ?> - </div> - </div> - <div style="margin-top: auto; height: max-content;"> - <div id="rlt-98" class="rail-text-item" style="height: 32px; display: flex; align-items: center; padding-left: 10px; opacity: 0;"> - <?= $pages["debug"]["name"] ?> - </div> - <div id="rlt-99" class="rail-text-item" style="height: 32px; display: flex; align-items: center; padding-left: 10px; opacity: 0;"> - <?= $pages["about"]["name"] ?> - </div> - </div> -</div> - -<style> - .rail-link:hover { - background: rgba(255, 255, 255, .1); - border-top: 1px solid #555; - border-bottom: 1px solid #555; - padding: 3px 4px !important; - } - - .rail-text-item { - border: 1px solid #555; - border-left: none; - padding-right: 10px; - border-top-right-radius: 999px; - border-bottom-right-radius: 999px; - width: 0; - } - - .rail-text-item.hovered { - background: #313131; - opacity: 1 !important; - width: max-content !important; - } -</style> - -<script> - Array.from(document.getElementsByClassName("rail-link")).forEach((i) => { - let rt = document.getElementById("rlt-" + i.id.split("-")[1]); - - i.onmouseenter = () => { - rt.classList.add("hovered"); - } - - i.onmouseleave = () => { - rt.classList.remove("hovered"); - } - }) - - document.getElementById("rail").onmouseenter = () => { - document.getElementById("rail-text").style.opacity = "1"; - } - - document.getElementById("rail").onmouseleave = () => { - document.getElementById("rail-text").style.opacity = "0"; - } -</script>
\ No newline at end of file diff --git a/includes/refresh.php b/includes/refresh.php index 65c570c..e561559 100644 --- a/includes/refresh.php +++ b/includes/refresh.php @@ -43,7 +43,7 @@ foreach ($deletable as $item) { } $times["docs_cleanup"] = microtime(true) - $currentOpStart; -require_once "./cleanup.inc"; +require_once "./refresh/cleanup.inc"; $currentOpStart = microtime(true); $version = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/version.json"), true); @@ -250,7 +250,7 @@ echo("Backing up...\n"); $lastBackup = (int)trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/backup.txt")); if (time() - $lastBackup >= 3600) { - require_once "./backup.inc"; + require_once "./refresh/backup.inc"; file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/backup.txt", time()); echo("Backup completed\n"); } else { @@ -260,7 +260,7 @@ if (time() - $lastBackup >= 3600) { echo("Generating logo...\n"); $currentOpStart = microtime(true); -require_once "./logo.inc"; +require_once "./refresh/logo.inc"; $times["logo"] = microtime(true) - $currentOpStart; echo("Generated logo\n"); @@ -279,7 +279,7 @@ echo("Fetched school information\n"); echo("Downloading assets...\n"); $currentOpStart = microtime(true); -require_once "./assets.inc"; +require_once "./refresh/assets.inc"; $times["assets"] = microtime(true) - $currentOpStart; echo("Downloading assets\n"); diff --git a/includes/assets.inc b/includes/refresh/assets.inc index 3f2d652..b27840a 100644 --- a/includes/assets.inc +++ b/includes/refresh/assets.inc @@ -2,10 +2,10 @@ global $app; -if (!file_exists("../assets/avatars")) mkdir("../assets/avatars"); -if (!file_exists("../assets/banners")) mkdir("../assets/banners"); -if (!file_exists("../assets/heads")) mkdir("../assets/heads"); -if (!file_exists("../assets/bodies")) mkdir("../assets/bodies"); +if (!file_exists("" . $_SERVER['DOCUMENT_ROOT'] . "/assets/avatars")) mkdir("" . $_SERVER['DOCUMENT_ROOT'] . "/assets/avatars"); +if (!file_exists("" . $_SERVER['DOCUMENT_ROOT'] . "/assets/banners")) mkdir("" . $_SERVER['DOCUMENT_ROOT'] . "/assets/banners"); +if (!file_exists("" . $_SERVER['DOCUMENT_ROOT'] . "/assets/heads")) mkdir("" . $_SERVER['DOCUMENT_ROOT'] . "/assets/heads"); +if (!file_exists("" . $_SERVER['DOCUMENT_ROOT'] . "/assets/bodies")) mkdir("" . $_SERVER['DOCUMENT_ROOT'] . "/assets/bodies"); function downloadAssets($system, $path = null) { if (!isset($path)) { @@ -18,7 +18,7 @@ function downloadAssets($system, $path = null) { $id = preg_replace("/^([\da-f]{8})-([\da-f]{4})-([\da-f]{4})-([\da-f]{4})-([\da-f]{12})$/", "$1$2$3$4$5", $general["uuid"]); 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) . "\" " . $_SERVER['DOCUMENT_ROOT'] . "/assets/avatars/" . $id . ".webp"); unlink("/tmp/img." . pathinfo($general['avatar_url'], PATHINFO_EXTENSION)); } @@ -26,7 +26,7 @@ function downloadAssets($system, $path = null) { $id = preg_replace("/^([\da-f]{8})-([\da-f]{4})-([\da-f]{4})-([\da-f]{4})-([\da-f]{12})$/", "$1$2$3$4$5", $general["uuid"]); echo(" /banners/$id.webp\n"); file_put_contents("/tmp/img." . pathinfo($general['banner'], PATHINFO_EXTENSION), file_get_contents($general['banner'])); - exec("convert -resize 2048x2048 \"" . "/tmp/img." . pathinfo($general['banner'], PATHINFO_EXTENSION) ."\" ../assets/banners/" . $id . ".webp"); + exec("convert -resize 2048x2048 \"" . "/tmp/img." . pathinfo($general['banner'], PATHINFO_EXTENSION) ."\" " . $_SERVER['DOCUMENT_ROOT'] . "/assets/banners/" . $id . ".webp"); unlink("/tmp/img." . pathinfo($general['banner'], PATHINFO_EXTENSION)); } @@ -38,7 +38,7 @@ function downloadAssets($system, $path = null) { if (isset($member["avatar_url"])) { echo(" /avatars/$id.webp\n"); file_put_contents("/tmp/img." . pathinfo($member['avatar_url'], PATHINFO_EXTENSION), file_get_contents($member['avatar_url'])); - exec("convert -resize 512x512 \"" . "/tmp/img." . pathinfo($member['avatar_url'], PATHINFO_EXTENSION) . "\" ../assets/avatars/" . $id . ".webp"); + exec("convert -resize 512x512 \"" . "/tmp/img." . pathinfo($member['avatar_url'], PATHINFO_EXTENSION) . "\" " . $_SERVER['DOCUMENT_ROOT'] . "/assets/avatars/" . $id . ".webp"); unlink("/tmp/img." . pathinfo($member['avatar_url'], PATHINFO_EXTENSION)); } @@ -46,7 +46,7 @@ function downloadAssets($system, $path = null) { if (isset($member["banner"])) { file_put_contents("/tmp/img." . pathinfo($member['banner'], PATHINFO_EXTENSION), file_get_contents($member['banner'])); - exec("convert -resize 2048x2048 \"" . "/tmp/img." . pathinfo($member['banner'], PATHINFO_EXTENSION) . "\" ../assets/banners/" . $id . ".webp"); + exec("convert -resize 2048x2048 \"" . "/tmp/img." . pathinfo($member['banner'], PATHINFO_EXTENSION) . "\" " . $_SERVER['DOCUMENT_ROOT'] . "/assets/banners/" . $id . ".webp"); unlink("/tmp/img." . pathinfo($member['banner'], PATHINFO_EXTENSION)); } else { $img = imagecreate(2048, 1024); @@ -59,21 +59,21 @@ function downloadAssets($system, $path = null) { imagejpeg($img, "/tmp/img.jpeg", 100); imagedestroy($img); - exec("convert -resize 2048x2048 \"/tmp/img.jpeg\" ../assets/banners/" . $id . ".webp"); + exec("convert -resize 2048x2048 \"/tmp/img.jpeg\" " . $_SERVER['DOCUMENT_ROOT'] . "/assets/banners/" . $id . ".webp"); unlink("/tmp/img.jpeg"); } - if (file_exists("../assets/uploads/pt-" . $member["name"] . ".png")) { - $url = "../assets/uploads/pt-" . $member["name"] . ".png"; + if (file_exists("" . $_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member["name"] . ".png")) { + $url = "" . $_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member["name"] . ".png"; } else { - $url = "../assets/uploads/pt.png"; + $url = "" . $_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt.png"; } echo(" /heads/$id.png\n"); - exec("convert \"" . $url . "\" ../assets/heads/" . $id . ".png"); + exec("convert \"" . $url . "\" " . $_SERVER['DOCUMENT_ROOT'] . "/assets/heads/" . $id . ".png"); - if (file_exists("../assets/ponies/" . $member["id"] . ".png")) { + if (file_exists("" . $_SERVER['DOCUMENT_ROOT'] . "/assets/ponies/" . $member["id"] . ".png")) { echo(" /bodies/$id.png\n"); - exec("convert \"" . "../assets/ponies/" . $member["id"] . ".png" . "\" ../assets/bodies/" . $id . ".png"); + exec("convert \"" . "" . $_SERVER['DOCUMENT_ROOT'] . "/assets/ponies/" . $member["id"] . ".png" . "\" " . $_SERVER['DOCUMENT_ROOT'] . "/assets/bodies/" . $id . ".png"); } } } diff --git a/includes/backup.inc b/includes/refresh/backup.inc index 6196389..879704d 100644 --- a/includes/backup.inc +++ b/includes/refresh/backup.inc @@ -53,17 +53,17 @@ function pkcs7_pad($data, $size) { return $data . str_repeat(chr($length), $length); } -if (!file_exists("./data/backup.ponieskey")) { +if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/backup.ponieskey")) { echo(" Creating encryption key...\n"); $key = openssl_random_pseudo_bytes(512); $iv = openssl_random_pseudo_bytes(16); - file_put_contents("./data/backup.ponieskey", base64_encode(json_encode([ + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/backup.ponieskey", base64_encode(json_encode([ "iv" => bin2hex($iv), "key" => bin2hex($key) ]))); } else { echo(" Reading encryption key...\n"); - $key_raw = json_decode(base64_decode(file_get_contents("./data/backup.ponieskey")), true); + $key_raw = json_decode(base64_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/backup.ponieskey")), true); $key = hex2bin($key_raw["key"]); $iv = hex2bin($key_raw["iv"]); } @@ -73,30 +73,25 @@ $payload = json_encode($data); $encrypted = openssl_encrypt(pkcs7_pad($payload, 16), 'AES-256-CBC', $key, OPENSSL_RAW_DATA, $iv); echo(" Writing backup...\n"); -file_put_contents("./data/backup.poniesbackup", $encrypted); -@mkdir("./data/encrypted"); +file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/backup.poniesbackup", $encrypted); +@mkdir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/encrypted"); $id = str_replace(":", "-", date('c')); -copy("./data/backup.poniesbackup", "./data/encrypted/" . $id . ".poniesbackup"); +copy($_SERVER['DOCUMENT_ROOT'] . "/includes/data/backup.poniesbackup", $_SERVER['DOCUMENT_ROOT'] . "/includes/data/encrypted/" . $id . ".poniesbackup"); echo(" Uploading to servers...\n"); echo(" zephyrheights... upload\n"); -exec("scp ./data/encrypted/" . $id . ".poniesbackup root@zephyrheights.equestria.dev:/opt/ponies"); +exec("scp -P 2222 " . $_SERVER['DOCUMENT_ROOT'] . "/includes/data/encrypted/" . $id . ".poniesbackup root@zephyrheights.equestria.dev:/opt/ponies"); echo(" zephyrheights... cleaning up\n"); -exec('ssh root@zephyrheights.equestria.dev bash /opt/clean.sh'); - -echo(" canterlot... upload\n"); -exec("scp ./data/encrypted/" . $id . ".poniesbackup root@canterlot.equestria.dev:/opt/ponies"); -echo(" canterlot... cleaning up\n"); -exec('ssh root@canterlot.equestria.dev bash /opt/clean.sh'); +exec('ssh -p 2222 root@zephyrheights.equestria.dev bash -c "cd /opt/ponies; ls -tp | grep -v \'/$\' | tail -n +20 | xargs -I {} rm -- {}"'); if (file_exists("/opt/ponies")) { echo(" bridlewood... copy\n"); - copy("./data/encrypted/" . $id . ".poniesbackup", "/opt/ponies/" . $id . ".poniesbackup"); + copy($_SERVER['DOCUMENT_ROOT'] . "/includes/data/encrypted/" . $id . ".poniesbackup", "/opt/ponies/" . $id . ".poniesbackup"); echo(" bridlewood... cleaning up\n"); exec('bash -c "cd /opt/ponies; ls -tp | grep -v \'/$\' | tail -n +20 | xargs -I {} rm -- {}"'); } echo(" Cleaning up...\n"); -unlink("./data/encrypted/" . $id . ".poniesbackup");
\ No newline at end of file +unlink($_SERVER['DOCUMENT_ROOT'] . "/includes/data/encrypted/" . $id . ".poniesbackup");
\ No newline at end of file diff --git a/includes/cleanup.inc b/includes/refresh/cleanup.inc index 1d02081..39ec41a 100644 --- a/includes/cleanup.inc +++ b/includes/refresh/cleanup.inc @@ -4,10 +4,6 @@ $screens = array_values(array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/inclu return !str_starts_with($i, "."); })); -$windows = array_values(array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/windows"), function ($i) { - return !str_starts_with($i, "."); -})); - $computers = array_values(array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/metadata"), function ($i) { return !str_starts_with($i, "."); })); @@ -25,21 +21,4 @@ foreach ($screens as $screen) { } if ($delete) unlink($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/screens/" . $screen); -} - -foreach ($windows as $window) { - $delete = true; - $id = explode(".", explode("-", $window)[2])[0]; - - foreach ($computers as $file) { - $computer = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/metadata/" . $file), true); - - foreach ($computer["windows"] as $sel) { - $id2 = sha1($sel["gid"]); - - if ($id2 === $id) $delete = false; - } - } - - if ($delete) unlink($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/windows/" . $window); }
\ No newline at end of file diff --git a/includes/logo.inc b/includes/refresh/logo.inc index 466dbb2..3e88140 100644 --- a/includes/logo.inc +++ b/includes/refresh/logo.inc @@ -1,8 +1,8 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.inc"; -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/bitset.inc"; -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/score.inc"; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/bitset.inc"; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/score.inc"; $columns = ceil(sqrt(count(scoreOrderGlobal()))); echo(" Using " . $columns . " columns\n"); diff --git a/includes/system/compare.inc b/includes/system/compare.inc index 768522f..7e683fa 100644 --- a/includes/system/compare.inc +++ b/includes/system/compare.inc @@ -1,4 +1,4 @@ -<?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; global $app; +<?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/components/header.inc'; global $travelling; global $app; $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/members.json"), true); @@ -184,4 +184,4 @@ $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/ </div> </div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?>
\ No newline at end of file +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/footer.inc'; ?>
\ No newline at end of file diff --git a/includes/system/history.inc b/includes/system/history.inc index 199f0ba..281e62d 100644 --- a/includes/system/history.inc +++ b/includes/system/history.inc @@ -1,4 +1,4 @@ -<?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; global $app; 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; global $app; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; ?> @@ -159,4 +159,4 @@ document.getElementById("timezone").style.display = ""; </script> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?>
\ No newline at end of file +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/footer.inc'; ?>
\ No newline at end of file diff --git a/includes/titlebar.inc b/includes/titlebar.inc deleted file mode 100644 index e941179..0000000 --- a/includes/titlebar.inc +++ /dev/null @@ -1,606 +0,0 @@ -<?php global $toplevel; global $system; global $isLoggedIn; global $lang; global $isLowerLoggedIn; global $pages; $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true); global $lang; global $pages; global $app; ?> -<span> - <?php - -$membersNames = array_map(function ($i) { - return $i["name"]; -}, scoreOrderGlobal()); -$parts = explode("/", $_GET['_']); -$name = $toplevel === "" ? "home" : $toplevel; - -$actionsProfile = "default"; -$part1 = "<page>"; -$part2 = null; -$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'][$lang["_name"]] . "</a>"; - - if ($name === "docs") { - $actionsProfile = "docs-item"; - $part1 = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/docs/" . $parts[2] . ".json"), true)["name"]; - } elseif ($name === "computers") { - $part1 = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/metadata/" . $parts[2] . ".json"), true)["host"]; - } else { - $actionsProfile = "$name-item"; - $list = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($name === "toys" ? "toys/toys" : "actions/actions") . ".json"), true); - $part1 = array_values(array_filter($list, function ($i) use ($parts) { - return $i["id"] === $parts[2]; - }))[0]["name"]; - } - } else { - if ($pages[$name]["admin"]) { - $part1 = $pages[$name]['name'][$lang["_name"]]; - $part2 = "<a class='title-bar-backlink' href='/-/dashboard'>Dashboard</a>"; - } else { - $part1 = $pages[$name]['name'][$lang["_name"]]; - } - } -} elseif ($name === "cloudburst") { - if (isset($parts[2])) { - $part2 = "<a class='title-bar-backlink' href='/cloudburst'>Cloudburst System</a>"; - - $part1 = $pages["s:" . $parts[2]]['name'][$lang["_name"]] ?? $parts[2]; - } else { - $actionsProfile = "system"; - $part1 = "Cloudburst System"; - } -} elseif ($name === "raindrops") { - if (isset($parts[2])) { - $part2 = "<a class='title-bar-backlink' href='/raindrops'>Raindrops System</a>"; - - $part1 = $pages["s:" . $parts[2]]['name'][$lang["_name"]] ?? $parts[2]; - } else { - $actionsProfile = "system"; - $part1 = "Raindrops System"; - } -} elseif ($name === $app["other"]["slug"]) { - if (isset($parts[2])) { - $part2 = "<a class='title-bar-backlink' href='/" . $app["other"]["slug"] . "'>" . $app["other"]["name"] . "</a>"; - - $part1 = $pages["s:" . $parts[2]]['name'][$lang["_name"]] ?? $parts[2]; - } else { - $actionsProfile = "system"; - $part1 = $app["other"]["name"]; - } -} else { - $member = getMemberFromName($name); - $actionsProfile = "member"; - - if ($member["_system"] === $app["other"]["id"]) { - $actionsProfile = "member-other"; - } - - if (isset($member)) { - $memberName = $member["display_name"] ?? $member["name"]; - $part1 = "$memberName"; - - if ($member["_system"] === "gdapd") { - $part2 = "<a class='title-bar-backlink' href='/raindrops'>Raindrops System</a>"; - } elseif ($member["_system"] === "ynmuc") { - $part2 = "<a class='title-bar-backlink' href='/cloudburst'>Cloudburst System</a>"; - } else { - $part2 = "<a class='title-bar-backlink' href='/" . $app["other"]["slug"] . "'>" . $app["other"]["name"] . "</a>"; - } - } else { - $part1 = "$name"; - } -} - -if ($actionsProfile === "default") { - switch ($name) { - case "home": - $actionsProfile = "home"; - break; - - case "emergency": - case "wakeup": - case "pleasure": - $actionsProfile = "alert"; - break; - - case "fronting": - $actionsProfile = "planner"; - break; - - case "actions": - case "toys": - $actionsProfile = "actions-or-toys"; - break; - - case "docs": - $actionsProfile = "docs"; - break; - - case "edit": - case "edit-private": - if (count($parts) === 3) $actionsProfile = "editor-system"; - if (count($parts) > 3 && in_array($parts[3], $membersNames)) $actionsProfile = "editor-member"; - break; - - case "debug": - $actionsProfile = "debug"; - break; - - case "bitset": - $actionsProfile = "bitset"; - break; - - case "computers": - if (count($parts) === 3) $actionsProfile = "computers"; - if (count($parts) === 4) $actionsProfile = "computers-remote"; - break; - } -} - -echo("<span id='title-bar-parts-desktop''>"); -if (isset($part3)) { - echo "$part3 > $part2 > <b>$part1</b>"; -} elseif (isset($part2)) { - echo "$part2 > <b>$part1</b>"; -} else { - echo "<b>$part1</b>"; -} -echo("</span>"); -echo("<span id='title-bar-parts-mobile' style='display:none;'>"); -echo "<b>$part1</b>"; -echo("</span>"); - -$links = [ - "default" => [ - [ - "name" => $lang["titlebar"]["top"], - "link" => [ - "type" => "js", - "text" => "document.body.scrollTop = 0; document.documentElement.scrollTop = 0;" - ], - "icon" => "/assets/icons/up.svg", - "invert" => true - ] - ], - "computers" => [ - [ - "name" => "Remote control", - "link" => [ - "type" => "url", - "text" => "/-/computers/" . ($parts[2] ?? null) . "/control" - ], - "icon" => "/assets/icons/computers-remote.svg", - "invert" => true - ], - [ - "name" => $lang["titlebar"]["top"], - "link" => [ - "type" => "js", - "text" => "document.body.scrollTop = 0; document.documentElement.scrollTop = 0;" - ], - "icon" => "/assets/icons/up.svg", - "invert" => true - ] - ], - "computers-remote" => [ - [ - "name" => "Enable controlling", - "link" => [ - "type" => "js", - "text" => "enableControl();" - ], - "icon" => "/assets/icons/computers-on.svg", - "invert" => true - ], - [ - "name" => "Disable controlling", - "link" => [ - "type" => "js", - "text" => "disableControl();" - ], - "icon" => "/assets/icons/computers-off.svg", - "invert" => true - ], - [ - "name" => "Back to computer info", - "link" => [ - "type" => "url", - "text" => "/-/computers/" . ($parts[2] ?? null) - ], - "icon" => "/assets/icons/up.svg", - "invert" => true - ] - ], - "editor-member" => [ - [ - "name" => "View page", - "link" => [ - "type" => "url", - "text" => "/" . ($parts[3] ?? null) - ], - "icon" => "/assets/icons/view.svg", - "invert" => true - ], - [ - "name" => $lang["titlebar"]["top"], - "link" => [ - "type" => "js", - "text" => "document.body.scrollTop = 0; document.documentElement.scrollTop = 0;" - ], - "icon" => "/assets/icons/up.svg", - "invert" => true - ] - ], - "editor-system" => [ - [ - "name" => "View page", - "link" => [ - "type" => "url", - "text" => "/" . ($parts[2] ?? null) - ], - "icon" => "/assets/icons/view.svg", - "invert" => true - ], - [ - "name" => $lang["titlebar"]["top"], - "link" => [ - "type" => "js", - "text" => "document.body.scrollTop = 0; document.documentElement.scrollTop = 0;" - ], - "icon" => "/assets/icons/up.svg", - "invert" => true - ] - ], - "member" => [ - [ - "name" => $lang["titlebar"]["member"], - "link" => [ - "type" => "url", - "text" => "/$system" - ], - "icon" => "/assets/icons/parent.svg", - "invert" => true - ], - [ - "name" => $pages["edit-private"]["name"][$lang["_name"]], - "link" => [ - "type" => "url", - "text" => "/-/edit-private/$system/$name" - ], - "icon" => "/assets/icons/edit-private.svg", - "invert" => true, - "show" => $isLoggedIn - ], - [ - "name" => $pages["edit"]["name"][$lang["_name"]], - "link" => [ - "type" => "url", - "text" => "/-/edit/$system/$name" - ], - "icon" => "/assets/icons/edit.svg", - "invert" => true, - "show" => $isLoggedIn - ], - [ - "name" => $lang["titlebar"]["top"], - "link" => [ - "type" => "js", - "text" => "document.body.scrollTop = 0; document.documentElement.scrollTop = 0;" - ], - "icon" => "/assets/icons/up.svg", - "invert" => true - ] - ], - "member-other" => [ - [ - "name" => $lang["titlebar"]["member"], - "link" => [ - "type" => "url", - "text" => "/$system" - ], - "icon" => "/assets/icons/parent.svg", - "invert" => true - ], - [ - "name" => $pages["edit"]["name"][$lang["_name"]], - "link" => [ - "type" => "url", - "text" => "/-/edit/$system/$name" - ], - "icon" => "/assets/icons/edit.svg", - "invert" => true, - "show" => $isLoggedIn - ], - [ - "name" => $lang["titlebar"]["top"], - "link" => [ - "type" => "js", - "text" => "document.body.scrollTop = 0; document.documentElement.scrollTop = 0;" - ], - "icon" => "/assets/icons/up.svg", - "invert" => true - ] - ], - "home" => [ - [ - "name" => "Raindrops System", - "link" => [ - "type" => "url", - "text" => "/raindrops" - ], - "icon" => "/assets/avatars/7d9f543ef74240f69d0786c3f2983124.webp", - "invert" => false - ], - [ - "name" => $lang["titlebar"]["top"], - "link" => [ - "type" => "js", - "text" => "document.body.scrollTop = 0; document.documentElement.scrollTop = 0;" - ], - "icon" => "/assets/icons/up.svg", - "invert" => true - ] - ], - "planner" => [ - [ - "name" => "Add in the Cloudburst System", - "link" => [ - "type" => "js", - "text" => "document.getElementById('planner-add-link-cloudburst-0').click()" - ], - "icon" => "/assets/icons/add-cloudburst.svg", - "invert" => false - ], - [ - "name" => "Add in the Raindrops System", - "link" => [ - "type" => "js", - "text" => "document.getElementById('planner-add-link-raindrops-0').click()" - ], - "icon" => "/assets/icons/add-raindrops.svg", - "invert" => false - ] - ], - "actions-or-toys" => [ - [ - "name" => "Search", - "link" => [ - "type" => "js", - "text" => "document.body.scrollTop = 0; document.documentElement.scrollTop = 0; document.getElementById('search').focus();" - ], - "icon" => "/assets/icons/search.svg", - "invert" => true - ], - [ - "name" => "Add", - "link" => [ - "type" => "js", - "text" => "(new bootstrap.Modal(document.getElementById('creator'))).show(); setInterval(() => { document.getElementById('creator-title').focus(); }, 500);" - ], - "icon" => "/assets/icons/add.svg", - "invert" => true - ] - ], - "docs" => [ - [ - "name" => "Marked for deletion", - "link" => [ - "type" => "url", - "text" => "#deletable" - ], - "icon" => "/assets/icons/delete.svg", - "invert" => true - ], - [ - "name" => "Create new", - "link" => [ - "type" => "url", - "text" => "/-/docs/add" - ], - "icon" => "/assets/icons/add.svg", - "invert" => true - ], - [ - "name" => $lang["titlebar"]["top"], - "link" => [ - "type" => "js", - "text" => "document.body.scrollTop = 0; document.documentElement.scrollTop = 0;" - ], - "icon" => "/assets/icons/up.svg", - "invert" => true - ] - ], - "docs-item" => [ - [ - "name" => "Save", - "link" => [ - "type" => "js", - "text" => "save();" - ], - "icon" => "/assets/icons/save.svg", - "invert" => true - ], - [ - "name" => $lang["titlebar"]["top"], - "link" => [ - "type" => "js", - "text" => "document.body.scrollTop = 0; document.documentElement.scrollTop = 0;" - ], - "icon" => "/assets/icons/up.svg", - "invert" => true - ] - ], - "debug" => [ - [ - "name" => $lang["titlebar"]["debug"][0], - "link" => [ - "type" => "url", - "text" => "#failures" - ], - "icon" => "/assets/icons/failures.svg", - "invert" => true - ], - [ - "name" => $lang["titlebar"]["debug"][1], - "link" => [ - "type" => "url", - "text" => "#times" - ], - "icon" => "/assets/icons/time.svg", - "invert" => true - ], - [ - "name" => $lang["titlebar"]["top"], - "link" => [ - "type" => "js", - "text" => "document.body.scrollTop = 0; document.documentElement.scrollTop = 0;" - ], - "icon" => "/assets/icons/up.svg", - "invert" => true - ] - ], - "bitset" => [ - [ - "name" => "Copy bitset", - "link" => [ - "type" => "js", - "text" => "navigator.clipboard.writeText(document.getElementById('input').value);" - ], - "icon" => "/assets/icons/copy.svg", - "invert" => true - ], - [ - "name" => "Reset", - "link" => [ - "type" => "js", - "text" => "document.getElementById('input').value = '2048'; calculateInput();" - ], - "icon" => "/assets/icons/reset.svg", - "invert" => true - ] - ], - "alert" => [ - [ - "name" => "Turn alert on", - "link" => [ - "type" => "js", - "text" => "if (document.getElementById('btn-on').style.display === 'block') (new bootstrap.Modal(document.getElementById('turn-on'))).show();" - ], - "icon" => "/assets/icons/alert-on.svg", - "invert" => true - ], - [ - "name" => "Turn alert off", - "link" => [ - "type" => "js", - "text" => "if (document.getElementById('btn-off').style.display === 'block') (new bootstrap.Modal(document.getElementById('turn-off'))).show();" - ], - "icon" => "/assets/icons/alert-off.svg", - "invert" => true - ] - ], - "system" => [ - [ - "name" => $pages["s:history"]["name"][$lang["_name"]], - "link" => [ - "type" => "url", - "text" => "/$name/-/history" - ], - "icon" => "/assets/icons/history.svg", - "invert" => true - ], - [ - "name" => $pages["s:compare"]["name"][$lang["_name"]], - "link" => [ - "type" => "url", - "text" => "/$name/-/compare" - ], - "icon" => "/assets/icons/compare.svg", - "invert" => true - ], - [ - "name" => $pages["edit"]["name"][$lang["_name"]], - "link" => [ - "type" => "url", - "text" => "/-/edit/$name" - ], - "icon" => "/assets/icons/edit.svg", - "invert" => true, - "show" => $isLoggedIn - ], - [ - "name" => $lang["titlebar"]["top"], - "link" => [ - "type" => "js", - "text" => "document.body.scrollTop = 0; document.documentElement.scrollTop = 0;" - ], - "icon" => "/assets/icons/up.svg", - "invert" => true - ] - ] -]; - -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 - ]); -} - -if ($isLowerLoggedIn || $isLoggedIn) { - $links["home"][] = [ - "name" => $app["other"]["name"], - "link" => [ - "type" => "url", - "text" => "/" . $app["other"]["slug"] - ], - "icon" => "/assets/avatars/" . str_replace("-", "", $app["other"]["uuid"]) . ".webp", - "invert" => false - ]; - - $links["home"] = [ - array_values(array_filter($links["home"], function ($i) { return $i["name"] === "Cloudburst System"; }))[0], - array_values(array_filter($links["home"], function ($i) { return $i["name"] === "Raindrops System"; }))[0], - array_values(array_filter($links["home"], function ($i) use ($app) { return $i["name"] === $app["other"]["name"]; }))[0], - array_values(array_filter($links["home"], function ($i) { return $i["link"]["type"] === "js"; }))[0] - ]; -} - -$linksList = $links[isset($links[$actionsProfile]) ? $actionsProfile : "default"]; - -?> - <span id="title-bar-actions"> - <?php foreach ($linksList as $index => $link): if (!(isset($link["show"]) && !$link["show"])): ?><a style="height: 33px; display: inline-block; padding: 4px;" id="title-bar-action-<?= $index ?>" <?php if ($link["link"]["type"] === "url"): ?>href<?php else: ?>onclick<?php endif; ?>="<?= $link["link"]["text"] ?>" title="<?= $link["name"] ?>" data-bs-toggle="tooltip" class="title-bar-action tooltip-nohelp"><img src="<?= $link["icon"] ?>" <?php if ($link["invert"]): ?>class="dropdown-icon"<?php endif; ?> alt="" style="width:24px;vertical-align: middle;"></a><?php endif; endforeach; ?> - </span> -</span> - -<style> - .title-bar-backlink { - color: white !important; - text-decoration: none; - } - - .title-bar-backlink:hover { - opacity: .75; - } - - #title-bar-actions { - position: fixed; - right: 0; - height: 34px; - top: 0; - display: block; - border-left: 1px solid rgba(255, 255, 255, .25); - } - - .title-bar-action { - cursor: pointer; - } - - .title-bar-action:hover { - background-color: rgba(255, 255, 255, .1); - } -</style>
\ No newline at end of file diff --git a/includes/Parsedown.php b/includes/util/Parsedown.php index 3e29589..3e29589 100644 --- a/includes/Parsedown.php +++ b/includes/util/Parsedown.php diff --git a/includes/agewarning.inc b/includes/util/agewarning.inc index 1f51647..1f51647 100644 --- a/includes/agewarning.inc +++ b/includes/util/agewarning.inc diff --git a/includes/banner.inc b/includes/util/banner.inc index a95c51d..46d9ce5 100644 --- a/includes/banner.inc +++ b/includes/util/banner.inc @@ -1,8 +1,8 @@ <?php -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"; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $lang; global $pages; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/pronouns.inc"; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; $travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling/travelling.json"), true); diff --git a/includes/bitset.inc b/includes/util/bitset.inc index 131cb39..131cb39 100644 --- a/includes/bitset.inc +++ b/includes/util/bitset.inc diff --git a/includes/functions.inc b/includes/util/functions.inc index e9024d1..24b059a 100644 --- a/includes/functions.inc +++ b/includes/util/functions.inc @@ -1,8 +1,8 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/score.inc"; -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/bitset.inc"; -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/homepage.inc"; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/score.inc"; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/bitset.inc"; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/homepage.inc"; if (!function_exists("peh_error")) { function peh_error($message, $code = 500): void { @@ -26,14 +26,14 @@ if (!function_exists("getAsset")) { }, $members); if (in_array($memberID, $list)) { - $id2 = preg_replace("/^([\da-f]{8})-([\da-f]{4})-([\da-f]{4})-([\da-f]{4})-([\da-f]{12})$/", "$1$2$3$4$5", getMemberWithoutSystem($memberID)["uuid"]); + $id2 = preg_replace("/^([\da-f]{8})-([\da-f]{4})-([\da-f]{4})-([\da-f]{4})-([\da-f]{12})$/", "$1$2$3$4$5", (getMemberWithoutSystem($memberID) ?? ['uuid' => ''])["uuid"]); } else { return "/error/nomember/?s=$systemID&m=$memberID&t=$type"; } $id = $id1 . $id2; - if (str_ends_with(getMemberWithoutSystem($memberID)["name"], "-travelling")) { + if (str_ends_with((getMemberWithoutSystem($memberID) ?? ['name' => ''])["name"], "-travelling")) { $id1 = preg_replace("/^([\da-f]{8})-([\da-f]{4})-([\da-f]{4})-([\da-f]{4})-([\da-f]{12})$/", "$1$2$3$4$5", json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($systemID === "gdapd" ? "ynmuc" : "gdapd") . "/general.json"), true)["uuid"]); $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($systemID === "gdapd" ? "ynmuc" : "gdapd") . "/members.json"), true); diff --git a/includes/homepage.inc b/includes/util/homepage.inc index 900d8f1..ebb99da 100644 --- a/includes/homepage.inc +++ b/includes/util/homepage.inc @@ -12,7 +12,7 @@ function newHomepage($id, $page, $title) { <?php if ($title): ?> <a href="/<?= $page ?>" style="height: 48px; display: flex; align-items: center; justify-content: center; border-top-left-radius: 10px; border-top-right-radius: 10px; text-align: center; text-decoration: none; color: white; background-color: #<?= $system["color"] ?? "000000" ?>55" class="new-homepage-system-title" id="new-homepage-system-<?= $id ?>-title"> <div> - <img src="<?= getAsset($id) ?>" style="width: 48px; vertical-align: middle;"><b style="vertical-align: middle; margin-left: 5px;"><?= $system["name"] ?></b> + <img src="<?= getAsset($id) ?>" style="border-radius: 5px;width: 48px; vertical-align: middle;"><b style="vertical-align: middle; margin-left: 5px;"><?= $system["name"] ?></b> </div> </a> <?php endif; ?> diff --git a/includes/util/language.inc b/includes/util/language.inc new file mode 100644 index 0000000..e24255f --- /dev/null +++ b/includes/util/language.inc @@ -0,0 +1,3 @@ +<?php + +$lang = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/i18n/en.json"), true);
\ No newline at end of file diff --git a/includes/profiles.inc b/includes/util/profiles.inc index 66274c7..66274c7 100644 --- a/includes/profiles.inc +++ b/includes/util/profiles.inc diff --git a/includes/pronouns.inc b/includes/util/pronouns.inc index 6ab2487..6ab2487 100644 --- a/includes/pronouns.inc +++ b/includes/util/pronouns.inc diff --git a/includes/rainbow.inc b/includes/util/rainbow.inc index 01b234c..66ac2fc 100644 --- a/includes/rainbow.inc +++ b/includes/util/rainbow.inc @@ -1,8 +1,8 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.inc"; -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/bitset.inc"; -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/score.inc"; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/bitset.inc"; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/score.inc"; function rainbow($hideCloudburst = false): array { $members = scoreOrderGlobal(); diff --git a/includes/random.inc b/includes/util/random.inc index b6e7905..b6e7905 100644 --- a/includes/random.inc +++ b/includes/util/random.inc diff --git a/includes/score.inc b/includes/util/score.inc index 57c7a75..57c7a75 100644 --- a/includes/score.inc +++ b/includes/util/score.inc diff --git a/includes/session.inc b/includes/util/session.inc index b99cc81..7a6b931 100644 --- a/includes/session.inc +++ b/includes/util/session.inc @@ -1,6 +1,6 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.inc"; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; global $isLoggedIn; global $isLowerLoggedIn; diff --git a/includes/short.inc b/includes/util/short.inc index 1c4760c..39e42b0 100644 --- a/includes/short.inc +++ b/includes/util/short.inc @@ -1,8 +1,8 @@ <?php -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.inc"; -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/bitset.inc"; -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/score.inc"; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/bitset.inc"; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/score.inc"; global $toplevel; global $lang; global $pages; diff --git a/includes/travelling.inc b/includes/util/travelling.inc index 0d1696a..0d1696a 100644 --- a/includes/travelling.inc +++ b/includes/util/travelling.inc |