summaryrefslogtreecommitdiff
path: root/pages/public.inc
diff options
context:
space:
mode:
authorRaindropsSys <raindrops@equestria.dev>2024-03-30 23:40:33 +0100
committerRaindropsSys <raindrops@equestria.dev>2024-03-30 23:40:33 +0100
commit6b796258d413f00e498ce7f80f73a9f6c061f29c (patch)
tree49e64a5dd4cde2acff7f0a93ed3f8e20e1cb2dc8 /pages/public.inc
parent5860551daa0f60103ad24e93da29f401a653f144 (diff)
downloadpluralconnect-6b796258d413f00e498ce7f80f73a9f6c061f29c.tar.gz
pluralconnect-6b796258d413f00e498ce7f80f73a9f6c061f29c.tar.bz2
pluralconnect-6b796258d413f00e498ce7f80f73a9f6c061f29c.zip
Updated 5 files, added 2 files, deleted 495 files and renamed 7 files (automated)
Diffstat (limited to 'pages/public.inc')
-rw-r--r--pages/public.inc203
1 files changed, 0 insertions, 203 deletions
diff --git a/pages/public.inc b/pages/public.inc
deleted file mode 100644
index f714f89..0000000
--- a/pages/public.inc
+++ /dev/null
@@ -1,203 +0,0 @@
-<?php
-
-if (isset($_GET["ec"])) {
- header("HTTP/1.1 " . $_GET["ec"] . " Error");
-}
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; $title = ""; global $isNormallyLoggedIn; global $_PROFILE; global $lang; global $pages; global $isLowerLoggedIn; global $app; global $isLoggedIn;
-$isOrigLoggedIn = $isLoggedIn; $isOrigLowerLoggedIn = $isLowerLoggedIn;
-
-if ($isOrigLowerLoggedIn || $isOrigLoggedIn) {
- $title = "Public home page";
-}
-
-require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; global $readOnly;
-$isLoggedIn = false; $isLowerLoggedIn = false;
-
-global $use2023UI;
-
-function banner() { $isLoggedIn = false; $isLowerLoggedIn = false; $byColor = getMembersByColor(false, true); global $lang; global $use2023UI; ?>
- <div style="text-align: center;">
- <img alt="" src="/assets/logo/newlogo-ng.png" style="width:128px;">
- <p style="z-index:999;position:relative;background:transparent;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 class="rainbow-item" style="overflow: hidden;"></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);position:relative;left:10px;">
- <?php foreach ($byColor as $member): ?><div>
- <span style="display: inline-block;background: transparent;position:absolute;width: 0;height: 0;margin-top: 17px;box-shadow: 0 6px 20px 20px #<?= $member["color"] ?>;z-index: 9;margin-left: 8px;opacity: .75;"></span>
- </div><?php endforeach; ?>
- </div>
- <div id="banner-lower" style="padding:5px 10px;background:#3332328a;position:relative;z-index: 999;backdrop-filter: blur(30px);">
- <h2 style="margin-top: 20px;">Ponycule</h2>
- <?php if ($isLoggedIn || $isLowerLoggedIn): ?>
- <p><?= count($byColor) ?> ponies in 4 plural systems</p>
- <?php else: ?>
- <p><?= count($byColor) ?> ponies in 3 plural systems</p>
- <?php endif; ?>
- </div>
- </div>
-<?php }
-
-function members() { $isLoggedIn = false; $isLowerLoggedIn = false; global $app; ?>
- <div id="new-homepage" style="margin-top:20px;">
-
- <div id="new-homepage-systems" <?php if ($isLoggedIn || $isLowerLoggedIn): ?>style="grid-template-columns: repeat(3, 1fr);"<?php endif; ?>>
- <?php newHomepage("gdapd", "raindrops", true); ?>
- <?php if ($isLoggedIn || $isLowerLoggedIn) newHomepage($app["other"]["id"], $app["other"]["slug"], true); ?>
- <?php newHomepage("hrbom", "moonglow", true); ?>
- </div>
-
- </div>
-<?php } ?>
-
-<br>
-<div class="container">
- <?php if (isset($_GET['em'])): ?>
- <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><?= $lang["home"]["error"] ?> </b><?= strip_tags(base64_decode($_GET['em'])) ?>
- </div>
- <?php endif; ?>
-
- <div class="alert alert-warning alert-dismissible" id="gpuWarning" style="display: none;">
- <button onclick='window.history.pushState({"html":null,"pageTitle":document.title},"", "/");' type="button" class="btn-close" data-bs-dismiss="alert"></button>
- <b>GPU acceleration is turned off or not supported.</b> A lot of visual effects on this website rely on GPU acceleration, which is currently disabled on your browser, meaning the website's overall look will be affected. Please enable GPU acceleration in your browser settings.
- </div>
-
- <?php if ($readOnly && $isNormallyLoggedIn || $readOnly && $isLowerLoggedIn): ?>
- <div class="alert alert-warning">
- <b>Notice: </b>This website is temporarily under maintenance and the administrators have locked the database. Although you are logged in as <?= $_PROFILE['name'] ?>, you cannot access any of the logged-in features while the website is under maintenance. <a href="/-/emergency">Alerts dispatching</a> remains possible in case of an emergency.
- </div>
- <?php endif; ?>
-
-
- <?php
-
- if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/home.json")) file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/home.json", "{}");
- $cache = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/home.json"), true);
- if (!isset($cache["banner"])) $cache["banner"] = [];
- if (!isset($cache["members"])) $cache["members"] = [];
-
- if (!isset($cache["banner"]["public"])) {
- ob_start();
-
- $isLoggedInOldState = $isLoggedIn;
- $isLowerLoggedInOldState = $isLowerLoggedIn;
- $isLoggedIn = false;
- $isLowerLoggedIn = false;
- banner();
- $isLoggedIn = $isLoggedInOldState;
- $isLowerLoggedIn = $isLowerLoggedInOldState;
-
- $cache["banner"]["public"] = ob_get_contents();
- ob_end_clean();
- }
-
- if (!isset($cache["banner"]["private"])) {
- ob_start();
-
- $isLoggedInOldState = $isLoggedIn;
- $isLowerLoggedInOldState = $isLowerLoggedIn;
- $isLoggedIn = true;
- $isLowerLoggedIn = true;
- banner();
- $isLoggedIn = $isLoggedInOldState;
- $isLowerLoggedIn = $isLowerLoggedInOldState;
-
- $cache["banner"]["private"] = ob_get_contents();
- ob_end_clean();
- }
-
- if (!isset($cache["members"]["public"])) {
- ob_start();
-
- $isLoggedInOldState = $isLoggedIn;
- $isLowerLoggedInOldState = $isLowerLoggedIn;
- $isLoggedIn = false;
- $isLowerLoggedIn = false;
- members();
- $isLoggedIn = $isLoggedInOldState;
- $isLowerLoggedIn = $isLowerLoggedInOldState;
-
- $cache["members"]["public"] = ob_get_contents();
- ob_end_clean();
- }
-
- if (!isset($cache["members"]["private"])) {
- ob_start();
-
- $isLoggedInOldState = $isLoggedIn;
- $isLowerLoggedInOldState = $isLowerLoggedIn;
- $isLoggedIn = true;
- $isLowerLoggedIn = true;
- members();
- $isLoggedIn = $isLoggedInOldState;
- $isLowerLoggedIn = $isLowerLoggedInOldState;
-
- $cache["members"]["private"] = ob_get_contents();
- ob_end_clean();
- }
-
- if ($isLowerLoggedIn || $isLoggedIn) {
- echo($cache["banner"]["private"]);
- } else {
- echo($cache["banner"]["public"]);
- }
-
- ?>
- <div id="timeline-container" style="background: #3332328a;padding: 5px 10px;border-top:1px solid rgba(255,255,255,.1);border-bottom-left-radius: 10px;border-bottom-right-radius: 10px;">
- <div id="timeline"></div>
- <script>
- async function refreshTimeline() {
- document.getElementById("timeline").innerHTML = await (await fetch("/api/timeline?gdapd&hrbom<?= ($isLowerLoggedIn || $isLoggedIn) ? "&" . $app["other"]["id"] : "" ?>&hrbom")).text();
-
- Array.from(document.getElementsByClassName("dynamic-time")).forEach((el) => {
- let time = el.getAttribute("data-time");
- el.innerText = new Date(parseInt(time) * 1000).toTimeString().split(":").splice(0, 2).join(":");
- });
-
- Array.from(document.getElementsByClassName("dynamic-time-mobile")).forEach((el) => {
- let time = el.getAttribute("data-time");
- el.innerText = new Date(parseInt(time) * 1000).toTimeString().split(":")[0] + ":";
- });
- }
-
- setInterval(refreshTimeline, 10000);
- refreshTimeline();
- </script>
- </div>
-
- <!--<div class="alert alert-warning" style="margin-top:20px;">
- <b>Notice:</b> The administrators are currently trying a new optimisation technique based on a virtual file system (chvfs). Data loss, corruption or inconsistency may happen and should be reported on <a href="https://bugs.equestria.dev/issues/CH" target="_blank">bugs.equestria.dev</a>.
- </div>-->
-
- <?php if (isset($_COOKIE["PEH2_SESSION_TOKEN"]) && $_COOKIE["PEH2_SESSION_TOKEN"] !== "" && !$isOrigLoggedIn && !$isOrigLowerLoggedIn): ?>
- <div class="alert alert-warning" style="margin-top:20px;">
- <b>You were previously logged in to Ponycule, </b>however you have been logged out due to inactivity, due to your device being removed, or due to switching to a new authentication system (such as the v3). Please log in again. <a href="https://bugs.equestria.dev/issue/CH-56/Better-session-security" target="_blank">Learn more.</a>
- </div>
- <?php endif; ?>
-
- <?php
-
- if ($isLowerLoggedIn || $isLoggedIn) {
- echo($cache["members"]["private"]);
- } else {
- echo($cache["members"]["public"]);
- }
-
- ?>
-</div>
-
-<style>
-<?php if ($use2023UI): ?>
-.old-ui {
- display: none;
-}
-<?php else: ?>
-.new-ui {
- display: none;
-}
-<?php endif; ?>
-</style>
-
-<?php file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/home.json", json_encode($cache)); require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/footer.inc'; ?>