summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2023-01-10 14:54:04 +0100
committerMinteck <contact@minteck.org>2023-01-10 14:54:04 +0100
commit99c1d9af689e5325f3cf535c4007b3aeb8325229 (patch)
treee663b3c2ebdbd67c818ac0c5147f0ce1d2463cda /includes
parent9871b03912fc28ad38b4037ebf26a78aa937baba (diff)
downloadpluralconnect-99c1d9af689e5325f3cf535c4007b3aeb8325229.tar.gz
pluralconnect-99c1d9af689e5325f3cf535c4007b3aeb8325229.tar.bz2
pluralconnect-99c1d9af689e5325f3cf535c4007b3aeb8325229.zip
Update - This is an automated commit
Diffstat (limited to 'includes')
-rw-r--r--includes/banner.inc2
-rw-r--r--includes/bitset.inc1
-rw-r--r--includes/details.inc28
-rw-r--r--includes/exchange.txt1
-rw-r--r--includes/metadata.inc4
-rw-r--r--includes/navigation.inc7
-rw-r--r--includes/pages.json9
-rw-r--r--includes/planner.inc66
-rw-r--r--includes/refresh.php11
9 files changed, 116 insertions, 13 deletions
diff --git a/includes/banner.inc b/includes/banner.inc
index 67d066f..cbae0b2 100644
--- a/includes/banner.inc
+++ b/includes/banner.inc
@@ -256,7 +256,7 @@ function getMemberBannerData(string $id, string $system, bool $french = false) {
$caretakers = null;
- if ($metadata["little"] === 2) {
+ if ($metadata["little"] >= 2) {
$caretakers = [];
foreach ($metadata["caretakers"] as $marefriend) {
$mfSystem = explode("/", $marefriend)[0];
diff --git a/includes/bitset.inc b/includes/bitset.inc
index f45beb1..955d953 100644
--- a/includes/bitset.inc
+++ b/includes/bitset.inc
@@ -114,6 +114,7 @@ function parseMetadata ($metadata) {
$m["birth"] = $metadata["birth"] ?? null;
$m["heat"] = $metadata["heat"] ?? null;
$m["code"] = $metadata["code"] ?? null;
+ $m["interest"] = $metadata["interest"] ?? null;
} else {
$m = $metadata;
}
diff --git a/includes/details.inc b/includes/details.inc
index 08ba52a..6002acd 100644
--- a/includes/details.inc
+++ b/includes/details.inc
@@ -1,5 +1,5 @@
<?php global $isLoggedIn; global $metadata; global $memberData; global $lang; global $pages; $pronouns = getMemberPronouns($memberData['pronouns']); ?>
-<div id="member-details" class="<?= $isLoggedIn ? 'member-details-loggedIn' : '' ?>" style="<?php if (!$isLoggedIn): ?>grid-template-columns: repeat(3, 1fr);<?php endif; ?> background-color: <?= isset($memberData["color"]) ? '#' . $memberData["color"] . "33" : "transparent" ?>; margin-left: -20px; margin-right: -20px;">
+<div id="member-details" class="<?= $isLoggedIn ? 'member-details-loggedIn' : '' ?>" style="<?php if (!$isLoggedIn): ?>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"]) {
@@ -52,14 +52,6 @@
<?php endif; ?>
<?php endif; ?>
</div>
- <div>
- <b>Birthday:</b><span class="member-small-separator"><br></span>
- <?php if (isset($metadata["birth"]["date"]) && trim($metadata["birth"]["date"]) !== "" && $metadata["birth"]["date"] !== "01-01"): ?>
- <?= date('F jS', strtotime(date('Y') . "-" . $metadata["birth"]["date"])) ?>
- <?php else: ?>
- -
- <?php endif; ?>
- </div>
<?php endif; ?>
<div>
<b><?= $lang["details"]["code"] ?></b><span class="member-small-separator"><br></span>
@@ -69,6 +61,14 @@
-
<?php endif; ?>
</div>
+ <div>
+ <b>Primary interest:</b><span class="member-small-separator"><br></span>
+ <?php if (isset($metadata["interest"]) && trim($metadata["interest"]) !== ""): ?>
+ <?= trim($metadata["interest"]) ?>
+ <?php else: ?>
+ -
+ <?php endif; ?>
+ </div>
</div>
<?php if ($isLoggedIn): ?>
<div id="member-details-2" style="background-color: <?= isset($memberData["color"]) ? '#' . $memberData["color"] . "33" : "transparent" ?>; margin-left: -20px; margin-right: -20px;">
@@ -105,7 +105,7 @@
<div>
<style>
#member-details-2 {
- grid-template-columns: 2fr 1fr;
+ grid-template-columns: 2fr 1fr 1fr;
}
</style>
<div style="display: flex; align-items: center; justify-content: center; height: 100%;opacity:.5;">This member is too young to have a sexual relationship.</div>
@@ -131,6 +131,14 @@
break;
} ?><?php if ($metadata["polyamorous"]["romantic"]): ?> (poly)<?php endif; ?>
</div>
+ <div>
+ <b>Birthday:</b><span class="member-small-separator"><br></span>
+ <?php if (isset($metadata["birth"]["date"]) && trim($metadata["birth"]["date"]) !== "" && $metadata["birth"]["date"] !== "01-01"): ?>
+ <?= date('F jS', strtotime(date('Y') . "-" . $metadata["birth"]["date"])) ?>
+ <?php else: ?>
+ -
+ <?php endif; ?>
+ </div>
<!--<div>
<b>Item 4:</b><span class="member-small-separator"><br></span>
Value 4
diff --git a/includes/exchange.txt b/includes/exchange.txt
new file mode 100644
index 0000000..79156ae
--- /dev/null
+++ b/includes/exchange.txt
@@ -0,0 +1 @@
+0.88 \ No newline at end of file
diff --git a/includes/metadata.inc b/includes/metadata.inc
index 04b6a9e..078984d 100644
--- a/includes/metadata.inc
+++ b/includes/metadata.inc
@@ -34,6 +34,10 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $member
<input name="caretakers" class="form-control" style="filter: invert(1) hue-rotate(180deg);" type="text" value="<?= implode(", ", $metadata["caretakers"]) ?>">
</p>
<p>
+ <b>Primary interest (keep it short):</b><br>
+ <input name="interest" class="form-control" style="filter: invert(1) hue-rotate(180deg);" type="text" value="<?= $metadata["interest"] ?? "" ?>">
+ </p>
+ <p>
<b>Age regressed version (local ID):</b><br>
<input name="regressed" class="form-control" style="filter: invert(1) hue-rotate(180deg);" type="text" value="<?= $metadata["regressed"] ?? "" ?>">
</p>
diff --git a/includes/navigation.inc b/includes/navigation.inc
index 345b168..3db5d21 100644
--- a/includes/navigation.inc
+++ b/includes/navigation.inc
@@ -68,6 +68,13 @@ $navigation_admin = [
"stepped" => null
],
[
+ "name" => $pages["money"]["name"][$lang["_name"]] . " <span class='badge bg-success rounded-pill'>Beta</span>",
+ "icon" => "/assets/icons/money.svg",
+ "invert" => true,
+ "link" => "/-/money",
+ "stepped" => null
+ ],
+ [
"name" => $pages["rules"]["name"][$lang["_name"]],
"icon" => "/assets/icons/rules.svg",
"invert" => true,
diff --git a/includes/pages.json b/includes/pages.json
index a55c748..777351b 100644
--- a/includes/pages.json
+++ b/includes/pages.json
@@ -188,6 +188,15 @@
"admin": true,
"rail": false
},
+ "money": {
+ "name": {
+ "en": "Money tracker",
+ "fr": "Money tracker"
+ },
+ "short": "Money",
+ "admin": true,
+ "rail": false
+ },
"nicknames": {
"name": {
"en": "Relations nicknames",
diff --git a/includes/planner.inc b/includes/planner.inc
index 2234b84..003d3cc 100644
--- a/includes/planner.inc
+++ b/includes/planner.inc
@@ -8,6 +8,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLogg
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/banner.inc";
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/rainbow.inc";
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.inc";
+global $_PROFILE;
$cloudburst = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/planner/ynmuc.json"), true);
$raindrops = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/planner/gdapd.json"), true);
@@ -70,6 +71,67 @@ foreach ($raindrops as $id => $day) {
}
}
+$school = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/school.json"), true);
+
+function formatTime($time) {
+ if ($time === "0:00") return "midnight";
+ if ($time === "12:00") return "noon";
+
+ $parts = explode(":", $time);
+ $hours = (int)$parts[0];
+ $ampm = "";
+
+ if ($hours === 0 || $hours === 12) {
+ $ampm = ($hours === 0 ? "am" : "pm");
+ $hours = 12;
+ } else {
+ if ($hours > 12) {
+ $ampm = "pm";
+ $hours = $hours - 12;
+ } else {
+ $ampm = "am";
+ }
+ }
+
+ if ((int)$parts[1] > 0) {
+ return $hours . ":" . $parts[1] . $ampm;
+ } else {
+ return $hours . $ampm;
+ }
+}
+
+function school($time, $first = false) {
+ global $school;
+ global $_PROFILE;
+
+ $day = date('Y-m-d', $time);
+ $parts = [];
+
+ if (isset($school[$day])) {
+ if (isset($school[$day]["wakeUp"]["timestamp"])) {
+ $parts[] = "waking up at " . formatTime($school[$day]["wakeUp"][$_PROFILE["login"]]) . " (your time)";
+ }
+
+ if (isset($school[$day]["sleep"]["timestamp"])) {
+ $parts[] = "sleeping at " . formatTime($school[$day]["sleep"][$_PROFILE["login"]]) . " (your time)";
+ }
+ }
+
+ if (count($parts) > 0) {
+ if ($first) {
+ return ucfirst(implode(", ", $parts));
+ } else {
+ return " ยท " . implode(", ", $parts);
+ }
+ } else {
+ if ($first) {
+ return "-";
+ } else {
+ return "";
+ }
+ }
+}
+
function day($display, $diff): void { if ($diff < 0) $disabled = true; else $disabled = false; global $cloudburst; global $raindrops; ?>
<?php if (!isset($display)) {
$display = date('l', time() + (86400 * $diff));
@@ -201,9 +263,9 @@ function day($display, $diff): void { if ($diff < 0) $disabled = true; else $dis
<td colspan="10" style="padding: 0;border:none;">
<div style="padding: 5px 10px;border: 1px solid #404040;margin:-1px;border-bottom-left-radius: 10px;border-bottom-right-radius: 10px;">
<?php if (count($dayCloudburst) > 0 && count($dayRaindrops) > 0): ?>
- <?= getMiniName(getMemberWithoutSystem($dayCloudburst[count($dayCloudburst) - 1][0])["display_name"] ?? getMemberWithoutSystem($dayCloudburst[count($dayCloudburst) - 1][0])["name"]) ?> will sleep with <?= getMiniName(getMemberWithoutSystem($dayRaindrops[count($dayRaindrops) - 1][0])["display_name"] ?? getMemberWithoutSystem($dayRaindrops[count($dayRaindrops) - 1][0])["name"]) ?>
+ <?= getMiniName(getMemberWithoutSystem($dayCloudburst[count($dayCloudburst) - 1][0])["display_name"] ?? getMemberWithoutSystem($dayCloudburst[count($dayCloudburst) - 1][0])["name"]) ?> will sleep with <?= getMiniName(getMemberWithoutSystem($dayRaindrops[count($dayRaindrops) - 1][0])["display_name"] ?? getMemberWithoutSystem($dayRaindrops[count($dayRaindrops) - 1][0])["name"]) ?><?= school(time() + 86400 * $diff, false) ?>
<?php else: ?>
- Unable to calculate who will sleep with who
+ <?= school(time() + 86400 * $diff, true) ?>
<?php endif; ?>
</div>
</td>
diff --git a/includes/refresh.php b/includes/refresh.php
index fe01414..30107e0 100644
--- a/includes/refresh.php
+++ b/includes/refresh.php
@@ -266,6 +266,17 @@ $times["favicons"] = microtime(true) - $currentOpStart;
echo("Generated favicons\n");
+echo("Fetching school information...\n");
+file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/school.json", "{}");
+
+$currentOpStart = microtime(true);
+chdir("../school");
+exec("node index.js");
+chdir("../includes");
+$times["school"] = microtime(true) - $currentOpStart;
+
+echo("Fetched school information\n");
+
echo("Downloading assets...\n");
$currentOpStart = microtime(true);