summaryrefslogtreecommitdiff
path: root/pages
diff options
context:
space:
mode:
Diffstat (limited to 'pages')
-rw-r--r--pages/byfront.inc31
-rw-r--r--pages/logout.inc8
-rw-r--r--pages/profiles.inc4
-rw-r--r--pages/travelling.inc8
4 files changed, 35 insertions, 16 deletions
diff --git a/pages/byfront.inc b/pages/byfront.inc
index 88da2f5..93fe3d5 100644
--- a/pages/byfront.inc
+++ b/pages/byfront.inc
@@ -90,12 +90,35 @@ $travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includ
})))
]; uasort($members, function ($a, $b) {
return $b["_lastFronted"] - $a["_lastFronted"];
- }); $members = array_reverse($members); foreach ($members as $member): if ($member["_lastFronted"] !== -1 && $member["_lastFronted"] !== time()): ?>
- <div class="relation" style="background-color:<?php if ($member["_metadata"]["less_frequent"] || $member["_metadata"]["persecutor"]): ?><?php if ($member["_lastFronted"] > time() - (86400 * 21)): ?>rgba(255, 255, 255, .1)<?php else: ?><?php if ($member["_lastFronted"] > time() - (86400 * 37)): ?>rgba(255, 227, 0, 0.17)<?php else: ?>rgba(255,55,55,0.17)<?php endif; ?>;<?php endif; ?><?php else: ?><?php if ($member["_lastFronted"] > time() - (86400 * 21)): ?>rgba(255, 255, 255, .1)<?php else: ?><?php if ($member["_lastFronted"] > time() - (86400 * 30)): ?>rgba(255, 227, 0, 0.17)<?php else: ?>rgba(255,55,55,0.17)<?php endif; ?>;<?php endif; ?><?php endif; ?>;margin-bottom:10px;padding:10px;border-radius:10px;display:grid;grid-template-columns: 1fr 2fr max-content;<?php if ($travelling[$member['id']]["travelling"]): ?>opacity: 0.75;<?php endif; ?>">
+ }); $members = array_reverse($members); foreach ($members as $member): if ($member["_lastFronted"] !== -1 && $member["_lastFronted"] !== time()):
+
+ $metadata = $member["_metadata"];
+
+ if (!isset($metadata["birth"]["year"]) || $metadata["birth"]["age"] > 0) {
+ if ($metadata["birth"]["age"] === -1) {
+ $age = abs(log(0));
+ } elseif ($metadata["birth"]["age"] <= 0) {
+ $age = null;
+ } else {
+ $age = $metadata["birth"]["age"];
+ }
+ } else {
+ if ($metadata["birth"]["year"] <= 1900) {
+ $age = null;
+ } else {
+ $age = (int)date('Y') - $metadata["birth"]["year"] + (strtotime(date('Y') . "-" . $metadata["birth"]["date"]) <= time() ? 0 : -1);
+ }
+ }
+
+ if (isset($age) && $age > 0 && time() > 1677628800): ?>
+ <div class="relation" style="background-color:<?php if ($member["_metadata"]["less_frequent"] || $member["_metadata"]["persecutor"]): ?><?php if ($member["_lastFronted"] > time() - (86400 * 21)): ?>rgba(255, 255, 255, .1)<?php else: ?><?php if ($member["_lastFronted"] > time() - (86400 * 37)): ?>rgba(255, 227, 0, 0.17)rgba(128,54,54,0.17)<?php endif; ?>;<?php endif; ?><?php else: ?><?php if ($member["_lastFronted"] > time() - (86400 * 21)): ?>rgba(255, 255, 255, .1)<?php else: ?><?php if ($member["_lastFronted"] > time() - (86400 * 30)): ?>rgba(255, 227, 0, 0.17)<?php else: ?>rgba(255,55,55,0.17)<?php endif; ?>;<?php endif; ?><?php endif; ?>;margin-bottom:10px;padding:10px;border-radius:10px;display:grid;grid-template-columns: 1fr 2fr max-content;<?php if ($travelling[$member['id']]["travelling"]): ?>opacity: 0.75;<?php endif; ?><?php if (isset($member["_metadata"]["not_fronting"]) && $member["_metadata"]["not_fronting"]): ?>background-color:rgba(255, 255, 255, .1) !important;<?php endif; ?>">
<a class="relation-intro" style="background-color:rgba(255, 255, 255, .05);border-right:1px solid rgba(255, 255, 255, .1);margin:-10px;padding:10px;border-top-left-radius:10px;border-bottom-left-radius:10px;color: white;display:flex;align-items:center;text-decoration: none;" href="/<?= $member["name"] ?>">
<img src="<?= getAsset($member['system'], $member["id"], "heads") ?>" style="width:24px;">&nbsp;<?= $member["display_name"] ?? $member["name"] ?>
<span style="display: inline-block;margin-left: auto;">
- <?php if ($member["_metadata"]["less_frequent"]): ?>
+ <?php if ($member["_metadata"]["not_fronting"]): ?>
+ <span class="badge bg-info rounded-pill text-black">No</span>
+ <?php endif; ?>
+ <?php if ($member["_metadata"]["less_frequent"] && !(isset($member["_metadata"]["not_fronting"]) && $member["_metadata"]["not_fronting"])): ?>
<span class="badge bg-success rounded-pill">Less</span>
<?php endif; ?>
<?php if ($member["_metadata"]["persecutor"]): ?>
@@ -121,7 +144,7 @@ $travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includ
<?php endif; ?>
</div>
</div>
- <?php endif; endforeach; ?>
+ <?php endif; endif; endforeach; ?>
<style>
@media (max-width: 991px) {
diff --git a/pages/logout.inc b/pages/logout.inc
index 0263278..37d89ed 100644
--- a/pages/logout.inc
+++ b/pages/logout.inc
@@ -3,12 +3,8 @@
if (isset($_COOKIE['PEH2_SESSION_TOKEN'])) {
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . str_replace(".", "", str_replace("/", "", $_COOKIE['PEH2_SESSION_TOKEN'])))) {
unlink($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . str_replace(".", "", str_replace("/", "", $_COOKIE['PEH2_SESSION_TOKEN'])));
- }
-}
-
-if (isset($_COOKIE['PEH2_USER_TOKEN'])) {
- if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens-public/" . str_replace(".", "", str_replace("/", "", $_COOKIE['PEH2_USER_TOKEN'])))) {
- unlink($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens-public/" . str_replace(".", "", str_replace("/", "", $_COOKIE['PEH2_USER_TOKEN'])));
+ } elseif (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/lowertokens/" . str_replace(".", "", str_replace("/", "", $_COOKIE['PEH2_SESSION_TOKEN'])))) {
+ unlink($_SERVER['DOCUMENT_ROOT'] . "/includes/lowertokens/" . str_replace(".", "", str_replace("/", "", $_COOKIE['PEH2_SESSION_TOKEN'])));
}
}
diff --git a/pages/profiles.inc b/pages/profiles.inc
index f24d5d9..dd6df4b 100644
--- a/pages/profiles.inc
+++ b/pages/profiles.inc
@@ -1,6 +1,6 @@
<?php
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; global $_PROFILE;
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; global $_PROFILE; global $isLowerLoggedIn;
require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc';
require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/profiles.inc';
@@ -27,7 +27,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/profiles.inc';
?>
- <?php if (count($fronters) > 0): $me = $fronters[0]; $me = array_values(array_filter($ordered, function ($i) use ($me) { return $i["id"] === $me["id"]; }))[0]; ?>
+ <?php if (!$isLowerLoggedIn && count($fronters) > 0): $me = $fronters[0]; $me = array_values(array_filter($ordered, function ($i) use ($me) { return $i["id"] === $me["id"]; }))[0]; ?>
<p>Hi <b><?= $me["display_name"] ?></b>,
<?php if ($me["_score"]["progress"] === 1): ?>
your profile is complete, congratulations!
diff --git a/pages/travelling.inc b/pages/travelling.inc
index 674d739..46b1a7f 100644
--- a/pages/travelling.inc
+++ b/pages/travelling.inc
@@ -1,12 +1,12 @@
<?php
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages;
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; global $isLowerLoggedIn;
$travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling/travelling.json"), true);
$app = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true);
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.inc";
-if (isset($_GET['toggleTravel'])) {
+if (isset($_GET['toggleTravel']) && $isLoggedIn) {
if (isset($travelling[$_GET['member']])) {
$id = $_GET['member'];
$equestria = isset($_GET['equestria']);
@@ -152,7 +152,7 @@ global $travelling;
<div>
<?php if ($travelling[$member['id']]["travelling"]): ?>
<div class="dropdown">
- <button type="button" class="btn btn-outline-danger dropdown-toggle" data-bs-toggle="dropdown">
+ <button type="button" class="btn btn-outline-danger dropdown-toggle" data-bs-toggle="dropdown" <?= $isLowerLoggedIn ? "disabled" : "" ?>>
Stop travelling
</button>
<ul class="dropdown-menu">
@@ -161,7 +161,7 @@ global $travelling;
</div>
<?php else: ?>
<div class="dropdown">
- <button type="button" class="btn btn-outline-success dropdown-toggle" data-bs-toggle="dropdown">
+ <button type="button" class="btn btn-outline-success dropdown-toggle" data-bs-toggle="dropdown" <?= $isLowerLoggedIn ? "disabled" : "" ?>>
Start travelling
</button>
<ul class="dropdown-menu">