diff options
author | RaindropsSys <contact@minteck.org> | 2023-04-20 16:20:07 +0200 |
---|---|---|
committer | RaindropsSys <contact@minteck.org> | 2023-04-20 16:20:07 +0200 |
commit | b4bcb0912c5fe1c7f00c7ac76e5b67620781d3cc (patch) | |
tree | 027238ccdf43719ae4bbb65eedeaf9823fff6471 /includes/components | |
parent | b484fc41a94e18f679f2494d598ac3d0ae72e3f8 (diff) | |
download | pluralconnect-b4bcb0912c5fe1c7f00c7ac76e5b67620781d3cc.tar.gz pluralconnect-b4bcb0912c5fe1c7f00c7ac76e5b67620781d3cc.tar.bz2 pluralconnect-b4bcb0912c5fe1c7f00c7ac76e5b67620781d3cc.zip |
Updated 12 files and added 3 files (automated)
Diffstat (limited to 'includes/components')
-rw-r--r-- | includes/components/explicit.php | 128 | ||||
-rw-r--r-- | includes/components/header.inc | 24 | ||||
-rw-r--r-- | includes/components/mobilenav.inc | 2 |
3 files changed, 150 insertions, 4 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"> |