summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
Diffstat (limited to 'includes')
-rw-r--r--includes/components/explicit.php128
-rw-r--r--includes/components/header.inc24
-rw-r--r--includes/components/mobilenav.inc2
-rw-r--r--includes/external/school/index.js9
-rw-r--r--includes/fragments/member.inc4
-rw-r--r--includes/fragments/sysedit.inc2
6 files changed, 162 insertions, 7 deletions
diff --git a/includes/components/explicit.php b/includes/components/explicit.php
new file mode 100644
index 0000000..9b3b159
--- /dev/null
+++ b/includes/components/explicit.php
@@ -0,0 +1,128 @@
+<?php global $isLoggedIn; global $isLowerLoggedIn; global $_PROFILE; global $app; if ($isLoggedIn || $isLowerLoggedIn): ?>
+<div class="modal" id="explicit-modal" data-bs-backdrop="static" data-bs-keyboard="false">
+ <div class="modal-dialog">
+ <div class="modal-content">
+ <div class="modal-body" style="text-align: center;">
+ <img alt="" style="width: 64px; height: 64px;" src="/assets/icons/explicit.svg">
+ <h3>This content is sexually explicit</h3>
+
+ <p>This page shows uncensored graphically explicit sexual content that you may not want to see in some cases. Please refrain from visiting this part of the website in a public place.</p>
+ <p>By continuing, you agree to be presented with sexually explicit content that is not appropriate for everyone.</p>
+
+ <span onclick="explicitConfirm();" id="explicit-modal-confirm" class="btn btn-primary">Continue</span>
+ <span onclick="explicitCancel();" id="explicit-modal-cancel" class="btn btn-outline-secondary">Go back</span>
+
+ <label style="margin-top:10px; display: block; text-align: left; opacity: .5;">
+ <input checked type="checkbox" class="form-check-input" id="explicit-modal-hour">
+ Don't show for the next hour
+ </label>
+ </div>
+ </div>
+ </div>
+</div>
+
+<style>
+ #explicit-modal .modal-header {
+ border-bottom: 1px solid #353738;
+ }
+
+ #explicit-modal .modal-content {
+ border: 1px solid rgba(255, 255, 255, .2);
+ background-color: #111;
+ }
+</style>
+
+<!--suppress JSVoidFunctionReturnValueUsed -->
+<script>
+ window.explicitModal = new bootstrap.Modal(document.getElementById("explicit-modal"));
+ window.ip = "<?= $_SERVER['REMOTE_ADDR'] ?>";
+ window.front = "<?php
+
+ $front = [];
+ $id = null;
+
+ if ($_PROFILE["login"] === "raindrops") {
+ $id = "gdapd";
+ } else if ($_PROFILE["login"] === "cloudburst") {
+ $id = "ynmuc";
+ } else {
+ $id = $app["other"]["id"];
+ }
+
+ $fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$id/fronters.json"), true)["members"];
+ $front = array_map(function ($i) {
+ return $i["id"];
+ }, $fronters);
+
+ echo(implode(",", $front));
+
+ ?>";
+ window.age = <?php
+
+ if (isset($front[0]) && file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $front[0] . ".json")) {
+ $metadata = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $front[0] . ".json"), true);
+ $age = null;
+
+ if (isset($metadata["birth"]["age"]) && $metadata["birth"]["age"] !== 0) {
+ $age = $metadata["birth"]["age"];
+ } else if (isset($metadata["birth"]["year"]) && $metadata["birth"]["year"] > 1990) {
+ $age = (int)date('Y') - $metadata["birth"]["year"] + (strtotime(date('Y') . "-" . $metadata["birth"]["date"]) <= time() ? 0 : -1);
+ }
+
+ if (is_string($age) && isset(explode("-", $age)[1]) && is_numeric(explode("-", $age)[1])) {
+ $age = (int)explode("-", $age)[1];
+ }
+
+ echo($age);
+ }
+
+ ?>;
+ window.explicitCancelAction = "back";
+
+ function requestExplicit(ifNotAgreed, allowUnderage) {
+ window.explicitCancelAction = ifNotAgreed;
+
+ if (!allowUnderage && (window.age < 15 || !window.age)) {
+ document.getElementById("explicit-modal-confirm").classList.add("disabled");
+ document.getElementById("explicit-modal-hour").disabled = true;
+
+ window.explicitModal.show();
+ document.getElementById("explicit-modal").classList.add("fade");
+ }
+
+ if (!localStorage.getItem("explicit-consent")) {
+ window.explicitModal.show();
+ document.getElementById("explicit-modal").classList.add("fade");
+ } else {
+ let parts = localStorage.getItem("explicit-consent").split("|");
+
+ if (parts[0] !== window.front || parts[1] !== window.ip || new Date().getTime() - parseInt(parts[2]) > 3600000) {
+ window.explicitModal.show();
+ document.getElementById("explicit-modal").classList.add("fade");
+ }
+ }
+ }
+
+ function explicitConfirm() {
+ window.explicitModal.hide();
+
+ if (document.getElementById("explicit-modal-hour").checked) {
+ localStorage.setItem("explicit-consent", window.front + "|" + window.ip + "|" + new Date().getTime());
+ }
+ }
+
+ function explicitCancel() {
+ if (window.explicitCancelAction === "refresh") {
+ location.reload();
+ } else {
+ if (history.length > 1) {
+ if (history.back() === undefined) {
+ location.href = "https://ponies.equestria.horse";
+ }
+ } else {
+ location.href = "https://ponies.equestria.horse";
+ }
+ }
+ }
+</script>
+<?php endif; ?>
diff --git a/includes/components/header.inc b/includes/components/header.inc
index c87e5a5..34b30e6 100644
--- a/includes/components/header.inc
+++ b/includes/components/header.inc
@@ -85,6 +85,10 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc";
width: calc(100% - 300px);
}
+ .modal {
+ left: 150px;
+ }
+
nav {
display: none !important;
}
@@ -124,8 +128,8 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc";
right: 0;
height: 48px;
background: rgba(0, 0, 0, .75);
- backdrop-filter: blur(10px);
- -webkit-backdrop-filter: blur(10px);
+ backdrop-filter: blur(30px);
+ -webkit-backdrop-filter: blur(30px);
border-top: 1px solid rgba(255, 255, 255, .25);
z-index: 999999;
}
@@ -136,6 +140,10 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc";
width: calc(100% - 250px) !important;
}
+ .modal {
+ left: 125px !important;
+ }
+
#title-bar {
left: 250px !important;
}
@@ -159,6 +167,10 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc";
width: calc(100% - 200px) !important;
}
+ .modal {
+ left: 100px !important;
+ }
+
#title-bar {
left: 200px !important;
}
@@ -178,6 +190,10 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc";
width: 100% !important;
}
+ .modal {
+ left: 0 !important;
+ }
+
#title-bar {
left: 0 !important;
}
@@ -238,4 +254,6 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc";
display: none;
}
</style>
-<?php } $GLOBALS["ColdHazePerformance"]["header"] = (microtime(true) - $start) * 1000; $start = microtime(true); ?>
+<?php }
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/components/explicit.php";
+$GLOBALS["ColdHazePerformance"]["header"] = (microtime(true) - $start) * 1000; $start = microtime(true); ?>
diff --git a/includes/components/mobilenav.inc b/includes/components/mobilenav.inc
index f83597f..7b49434 100644
--- a/includes/components/mobilenav.inc
+++ b/includes/components/mobilenav.inc
@@ -14,7 +14,7 @@
</div>
</div>
-<div id="mobile-navigation-box-container" style="display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 48px; background-color: rgba(0, 0, 0, .75); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); z-index: 99999; overflow: auto;">
+<div id="mobile-navigation-box-container" style="display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 48px; background-color: rgba(0, 0, 0, .75); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px); z-index: 99999; overflow: auto;">
<?php foreach ($navigation as $id => $item): if (!$item["admin"] || $isLoggedIn): ?>
<div id="mobile-navigation-box-<?= $id ?>" style="display: none; margin-top: 10px; margin-bottom: 10px;" class="mobile-navigation-box container">
<div class="pane-group-title">
diff --git a/includes/external/school/index.js b/includes/external/school/index.js
index 58947ec..00f3435 100644
--- a/includes/external/school/index.js
+++ b/includes/external/school/index.js
@@ -6,6 +6,11 @@ const url = config.pronote.url;
const username = config.pronote.user;
const password = config.pronote.password;
+process.on('unhandledRejection', (e) => {
+ console.error(e);
+ process.exit(2);
+})
+
async function getTimetable(offset, last) {
const timetable = lessons;
@@ -129,8 +134,12 @@ async function display(offset) {
}
(async () => {
+ console.log("Logging in...");
+ console.log("URL is", url + ", username is", username + ", password is", password);
global.session = await pronote.login(url, username, password);
+ console.log("Gathering timetable...");
global.lessons = await session.timetable(new Date(new Date() - (86400000 * 3)), new Date(new Date().getTime() + (86400000 * 7)));
+ console.log("Processing...");
await updateSleepTime(0);
await display(-2);
diff --git a/includes/fragments/member.inc b/includes/fragments/member.inc
index 6fbf3ad..1db0dd2 100644
--- a/includes/fragments/member.inc
+++ b/includes/fragments/member.inc
@@ -149,7 +149,7 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/ponies/" . $memberID . ".pn
<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; ?>">
+ <div id="member-page" style="background-color: rgba(26,26,26,0.8);border-radius: 10px;padding:20px; backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);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/components/fullbanner.inc"; ?>
<?php $member = $memberData; if (($isLoggedIn || $isLowerLoggedIn) && file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/ponies/" . $member["id"] . ".png")): ?>
<div style="padding-top: 20px; padding-bottom: 20px;">
@@ -210,7 +210,7 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/ponies/" . $memberID . ".pn
}
if ($censor) {
- echo("<a href='#' id='private-page-link' onclick='showPrivate();'>Show private page (NSFW)</a><div id='private-page-hidden' style='display: none;'>" . $text . "</div>");
+ echo("<a href='#' id='private-page-link' onclick='requestExplicit(\"refresh\"); showPrivate();'>Show private page (NSFW)</a><div id='private-page-hidden' style='display: none;'>" . $text . "</div>");
} else {
echo($text);
}
diff --git a/includes/fragments/sysedit.inc b/includes/fragments/sysedit.inc
index 1b341b0..a743e03 100644
--- a/includes/fragments/sysedit.inc
+++ b/includes/fragments/sysedit.inc
@@ -10,7 +10,7 @@
<div class="container">
<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;">
+ <div id="system-page" style="background-color: rgba(26,26,26,0.8);border-radius: 10px;padding:20px; backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);margin-top:30vh;">
<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/components/sysbanner.inc"; ?>
<br>