summaryrefslogtreecommitdiff
path: root/includes/util
diff options
context:
space:
mode:
authorRaindropsSys <contact@minteck.org>2023-07-20 18:29:09 +0200
committerRaindropsSys <contact@minteck.org>2023-07-20 18:29:09 +0200
commit46251292b5c8b431de66aeff473594ccec60e04c (patch)
treec9f2c196e50f064a66625813660148379212d9d7 /includes/util
parent93c96fd1d89782570de9478c26f17b406e9dd7a0 (diff)
downloadpluralconnect-46251292b5c8b431de66aeff473594ccec60e04c.tar.gz
pluralconnect-46251292b5c8b431de66aeff473594ccec60e04c.tar.bz2
pluralconnect-46251292b5c8b431de66aeff473594ccec60e04c.zip
Updated 19 files and added 26 files (automated)
Diffstat (limited to 'includes/util')
-rw-r--r--includes/util/banner.inc23
-rw-r--r--includes/util/evening.inc68
2 files changed, 80 insertions, 11 deletions
diff --git a/includes/util/banner.inc b/includes/util/banner.inc
index dfda86d..63e30c6 100644
--- a/includes/util/banner.inc
+++ b/includes/util/banner.inc
@@ -24,6 +24,7 @@ function getMemberBannerData(string $id, string $system, bool $french = false) {
global $isLowerLoggedIn;
global $lang;
global $Parsedown;
+ global $use2023UI;
$french = $lang["_french"];
@@ -295,7 +296,7 @@ function getMemberBannerData(string $id, string $system, bool $french = false) {
$badges[] = [
"id" => "fictive",
"color" => "info",
- "html" => '<span data-bs-toggle="tooltip" data-bs-html="true" title="<b>Equestrian</b><br>' . ucfirst(getMemberPronouns($member['pronouns'])["subjective"]) . ' ' . (getMemberPronouns($member['pronouns'])["third"] ? "is" : "are") . ' based on the personality, look and behavior of a character that is from Equestria." class="badge rounded-pill bg-info" style="height: 24px;"><img style="width: 16px;" src="/assets/logo/equestria.png"><span style="vertical-align: middle;">&nbsp;Equestrian</span></span>'
+ "html" => '<span data-bs-toggle="tooltip" data-bs-html="true" title="<b>Equestrian</b><br>' . ucfirst(getMemberPronouns($member['pronouns'])["subjective"]) . ' ' . (getMemberPronouns($member['pronouns'])["third"] ? "is" : "are") . ' based on the personality, look and behavior of a character that is from Equestria." class="badge rounded-pill bg-' . ($use2023UI ? "success" : "info") . '" style="height: 24px;"><img style="width: 16px;" src="/assets/logo/equestria.png"><span style="vertical-align: middle;">&nbsp;Equestrian</span></span>'
];
}
@@ -303,7 +304,7 @@ function getMemberBannerData(string $id, string $system, bool $french = false) {
$badges[] = [
"id" => "fictive2",
"color" => "d63384",
- "html" => '<span data-bs-toggle="tooltip" data-bs-html="true" title="<b>Fictive</b><br>' . ucfirst(getMemberPronouns($member['pronouns'])["subjective"]) . ' ' . (getMemberPronouns($member['pronouns'])["third"] ? "is" : "are") . ' based on the personality, look and behavior of a character that is from Celeste." class="badge rounded-pill" style="height: 24px;background-color: #d63384;"><img style="width: 16px;" src="/assets/logo/celeste.png"><span style="vertical-align: middle;">&nbsp;Fictive</span></span>'
+ "html" => '<span data-bs-toggle="tooltip" data-bs-html="true" title="<b>Fictive</b><br>' . ucfirst(getMemberPronouns($member['pronouns'])["subjective"]) . ' ' . (getMemberPronouns($member['pronouns'])["third"] ? "is" : "are") . ' based on the personality, look and behavior of a character that is from Celeste." class="badge rounded-pill ' . ($use2023UI ? "bg-success" : "") . '" style="height: 24px;' . (!$use2023UI ? "background-color: #d63384;" : "") . '"><img style="width: 16px;" src="/assets/logo/celeste.png"><span style="vertical-align: middle;">&nbsp;Fictive</span></span>'
];
}
@@ -311,7 +312,7 @@ function getMemberBannerData(string $id, string $system, bool $french = false) {
$badges[] = [
"id" => "persecutor",
"color" => "danger",
- "html" => '<span data-bs-toggle="tooltip" data-bs-html="true" title="<b>Persecutor</b><br>' . ucfirst(getMemberPronouns($member['pronouns'])["subjective"]) . ' ' . (getMemberPronouns($member['pronouns'])["third"] ? "acts" : "act") . ' harmfully towards other system members and/or others, potentially as a misguided attempt to protect the system." class="badge rounded-pill bg-danger" style="height:24px;display: inline-flex;align-items: center;position: relative;top: 1px;"><span>Persecutor</span></span>'
+ "html" => '<span data-bs-toggle="tooltip" data-bs-html="true" title="<b>Persecutor</b><br>' . ucfirst(getMemberPronouns($member['pronouns'])["subjective"]) . ' ' . (getMemberPronouns($member['pronouns'])["third"] ? "acts" : "act") . ' harmfully towards other system members and/or others, potentially as a misguided attempt to protect the system." class="badge rounded-pill bg-' . ($use2023UI ? "success" : "danger") . '" style="height:24px;display: inline-flex;align-items: center;position: relative;top: 1px;"><span>Persecutor</span></span>'
];
}
@@ -319,7 +320,7 @@ function getMemberBannerData(string $id, string $system, bool $french = false) {
$badges[] = [
"id" => "nonverbal",
"color" => "#6610f2",
- "html" => '<span data-bs-toggle="tooltip" data-bs-html="true" title="<b>Fronts less often</b><br>' . ucfirst(getMemberPronouns($member['pronouns'])["subjective"]) . ' ' . (getMemberPronouns($member['pronouns'])["third"] ? "front" : "fronts") . ' less often than ' . getMemberPronouns($member['pronouns'])["possessive_det"] . ' headmates, this can be due to various reasons." class="badge rounded-pill" style="background-color:#6610f2;height:24px;display: inline-flex;align-items: center;position: relative;top: 1px;"><span>Fronts less often</span></span>'
+ "html" => '<span data-bs-toggle="tooltip" data-bs-html="true" title="<b>Fronts less often</b><br>' . ucfirst(getMemberPronouns($member['pronouns'])["subjective"]) . ' ' . (getMemberPronouns($member['pronouns'])["third"] ? "front" : "fronts") . ' less often than ' . getMemberPronouns($member['pronouns'])["possessive_det"] . ' headmates, this can be due to various reasons." class="badge rounded-pill ' . ($use2023UI ? "bg-success" : "") . '" style="' . (!$use2023UI ? "background-color:#6610f2;" : "") . 'height:24px;display: inline-flex;align-items: center;position: relative;top: 1px;"><span>Fronts less often</span></span>'
];
}
@@ -327,7 +328,7 @@ function getMemberBannerData(string $id, string $system, bool $french = false) {
$badges[] = [
"id" => "nonverbal",
"color" => "#20c997",
- "html" => '<span data-bs-toggle="tooltip" data-bs-html="true" title="<b>Non verbal IRL</b><br>' . ucfirst(getMemberPronouns($member['pronouns'])["subjective"]) . ' ' . (getMemberPronouns($member['pronouns'])["third"] ? "is" : "are") . ' non verbal in real life, although text communication is still possible." class="badge rounded-pill" style="background-color:#20c997;height:24px;display: inline-flex;align-items: center;position: relative;top: 1px;"><span>Non verbal IRL</span></span>'
+ "html" => '<span data-bs-toggle="tooltip" data-bs-html="true" title="<b>Non verbal IRL</b><br>' . ucfirst(getMemberPronouns($member['pronouns'])["subjective"]) . ' ' . (getMemberPronouns($member['pronouns'])["third"] ? "is" : "are") . ' non verbal in real life, although text communication is still possible." class="badge rounded-pill ' . ($use2023UI ? "bg-success" : "") . '" style="' . (!$use2023UI ? "background-color:#20c997;" : "") . 'height:24px;display: inline-flex;align-items: center;position: relative;top: 1px;"><span>Non verbal IRL</span></span>'
];
}
@@ -335,7 +336,7 @@ function getMemberBannerData(string $id, string $system, bool $french = false) {
$badges[] = [
"id" => "fusion",
"color" => "333333",
- "html" => '<span data-bs-toggle="tooltip" data-bs-html="true" title="<b>Fusion</b><br>She is the result of multiple ponies purposefully merging in a way that makes them impossible to tell apart." class="badge rounded-pill" style="background-color:#333333;height:24px;display: inline-flex;align-items: center;position: relative;top: 1px;"><span>Fusion</span></span>'
+ "html" => '<span data-bs-toggle="tooltip" data-bs-html="true" title="<b>Fusion</b><br>She is the result of multiple ponies purposefully merging in a way that makes them impossible to tell apart." class="badge rounded-pill ' . ($use2023UI ? "bg-success" : "") . '" style="' . (!$use2023UI ? "background-color:#333333;" : "") . 'height:24px;display: inline-flex;align-items: center;position: relative;top: 1px;"><span>Fusion</span></span>'
];
}
@@ -343,7 +344,7 @@ function getMemberBannerData(string $id, string $system, bool $french = false) {
$badges[] = [
"id" => "host",
"color" => "fc6735",
- "html" => '<span data-bs-toggle="tooltip" data-bs-html="true" title="<b>Host</b><br>' . ucfirst(getMemberPronouns($member['pronouns'])["subjective"]) . ' ' . (getMemberPronouns($member['pronouns'])["third"] ? "is" : "are") . ' the host in ' . getMemberPronouns($member['pronouns'])["possessive_det"] . ' system." class="badge rounded-pill" style="background-color:#fc6735;height:24px;display:inline-flex;align-items:center;position:relative;top:1px;"><span>Host</span></span>'
+ "html" => '<span data-bs-toggle="tooltip" data-bs-html="true" title="<b>Host</b><br>' . ucfirst(getMemberPronouns($member['pronouns'])["subjective"]) . ' ' . (getMemberPronouns($member['pronouns'])["third"] ? "is" : "are") . ' the host in ' . getMemberPronouns($member['pronouns'])["possessive_det"] . ' system." class="badge rounded-pill ' . ($use2023UI ? "bg-success" : "") . '" style="' . (!$use2023UI ? "background-color:#fc6735;" : "") . 'height:24px;display:inline-flex;align-items:center;position:relative;top:1px;"><span>Host</span></span>'
];
}
@@ -351,7 +352,7 @@ function getMemberBannerData(string $id, string $system, bool $french = false) {
$badges[] = [
"id" => "leader",
"color" => "d6a833",
- "html" => '<span data-bs-toggle="tooltip" data-bs-html="true" title="<b>Leader</b><br>' . ucfirst(getMemberPronouns($member['pronouns'])["subjective"]) . ' ' . (getMemberPronouns($member['pronouns'])["third"] ? "is" : "are") . ' a leader in ' . getMemberPronouns($member['pronouns'])["possessive_det"] . ' system." class="badge rounded-pill" style="background-color:#fd7e14;height:24px;display: inline-flex;align-items: center;position: relative;top: 1px;"><span>Leader</span></span>'
+ "html" => '<span data-bs-toggle="tooltip" data-bs-html="true" title="<b>Leader</b><br>' . ucfirst(getMemberPronouns($member['pronouns'])["subjective"]) . ' ' . (getMemberPronouns($member['pronouns'])["third"] ? "is" : "are") . ' a leader in ' . getMemberPronouns($member['pronouns'])["possessive_det"] . ' system." class="badge rounded-pill ' . ($use2023UI ? "bg-success" : "") . '" style="' . (!$use2023UI ? "background-color:#fd7e14;" : "") . 'height:24px;display: inline-flex;align-items: center;position: relative;top: 1px;"><span>Leader</span></span>'
];
}
@@ -359,7 +360,7 @@ function getMemberBannerData(string $id, string $system, bool $french = false) {
$badges[] = [
"id" => "protector",
"color" => "black",
- "html" => '<span style="height:24px;display: inline-flex;align-items: center;position: relative;top: 1px;" data-bs-toggle="tooltip" data-bs-html="true" title="<b>Protector</b><br>' . ucfirst(getMemberPronouns($member['pronouns'])["subjective"]) . ' ' . (getMemberPronouns($member['pronouns'])["third"] ? "is" : "are") . ' a protector in the system and will front when somepony cannot handle it anymore." class="badge rounded-pill bg-black"><span>Protector</span></span>'
+ "html" => '<span style="height:24px;display: inline-flex;align-items: center;position: relative;top: 1px;" data-bs-toggle="tooltip" data-bs-html="true" title="<b>Protector</b><br>' . ucfirst(getMemberPronouns($member['pronouns'])["subjective"]) . ' ' . (getMemberPronouns($member['pronouns'])["third"] ? "is" : "are") . ' a protector in the system and will front when somepony cannot handle it anymore." class="badge rounded-pill bg-' . ($use2023UI ? "success" : "black") . '"><span>Protector</span></span>'
];
}
@@ -375,7 +376,7 @@ function getMemberBannerData(string $id, string $system, bool $french = false) {
$badges[] = [
"id" => "younger",
"color" => "dark",
- "html" => '<span style="height:24px;display: inline-flex;align-items: center;position: relative;top: 1px;" data-bs-toggle="tooltip" data-bs-html="true" title="<b>Younger</b><br>' . ucfirst(getMemberPronouns($member['pronouns'])["subjective"]) . ' ' . (getMemberPronouns($member['pronouns'])["third"] ? "is" : "are") . ' younger than the body, but not young enough to be classified as a little." class="badge rounded-pill bg-dark"><span>Younger</span></span>'
+ "html" => '<span style="height:24px;display: inline-flex;align-items: center;position: relative;top: 1px;" data-bs-toggle="tooltip" data-bs-html="true" title="<b>Younger</b><br>' . ucfirst(getMemberPronouns($member['pronouns'])["subjective"]) . ' ' . (getMemberPronouns($member['pronouns'])["third"] ? "is" : "are") . ' younger than the body, but not young enough to be classified as a little." class="badge rounded-pill bg-' . ($use2023UI ? "success" : "dark") . '"><span>Younger</span></span>'
];
}
@@ -383,7 +384,7 @@ function getMemberBannerData(string $id, string $system, bool $french = false) {
$badges[] = [
"id" => "alcohol",
"color" => "secondary",
- "html" => '<span style="height:24px;display: inline-flex;align-items: center;position: relative;top: 1px;" data-bs-toggle="tooltip" data-bs-html="true" title="<b>Alcohol</b><br>' . ucfirst(getMemberPronouns($member['pronouns'])["subjective"]) . ' drinks alcohol, and thus may be drunk or hungover at times." class="badge rounded-pill bg-secondary"><span>Alcohol</span></span>'
+ "html" => '<span style="height:24px;display: inline-flex;align-items: center;position: relative;top: 1px;" data-bs-toggle="tooltip" data-bs-html="true" title="<b>Alcohol</b><br>' . ucfirst(getMemberPronouns($member['pronouns'])["subjective"]) . ' drinks alcohol, and thus may be drunk or hungover at times." class="badge rounded-pill bg-' . ($use2023UI ? "success" : "secondary") . '"><span>Alcohol</span></span>'
];
}
diff --git a/includes/util/evening.inc b/includes/util/evening.inc
new file mode 100644
index 0000000..58e511e
--- /dev/null
+++ b/includes/util/evening.inc
@@ -0,0 +1,68 @@
+<?php
+
+if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/evening/ignored.json")) file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/evening/ignored.json", "[]");
+if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/evening/locked.json")) file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/evening/locked.json", "{}");
+
+if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/evening.json")) unlink($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/evening.json");
+
+global $use2023UI;
+
+$pairs = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/evening/pairs.json"), true);
+$ignored = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/evening/ignored.json"), true);
+$locked = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/evening/locked.json"), true);
+
+if (isset($_GET["ignore"]) && isset($_GET["day"])) {
+ if ($_GET["ignore"] === "1") {
+ if (preg_match("/^\d{4}-\d{2}-\d{2}$/m", $_GET["day"]) === false) {
+ header("Location: /$_GET[_]");
+ die();
+ }
+
+ if (!in_array($_GET["day"], $ignored)) {
+ $ignored[] = $_GET["day"];
+ }
+
+ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/evening.json")) unlink($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/evening.json");
+
+ file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/evening/ignored.json", json_encode($ignored));
+ header("Location: /$_GET[_]");
+ die();
+ } elseif ($_GET["ignore"] === "0") {
+ if (preg_match("/^\d{4}-\d{2}-\d{2}$/m", $_GET["day"]) === false) {
+ header("Location: /$_GET[_]");
+ die();
+ }
+
+ if (in_array($_GET["day"], $ignored)) {
+ unset($ignored[array_search($_GET["day"], $ignored)]);
+ }
+
+ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/evening.json")) unlink($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/evening.json");
+
+ file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/evening/ignored.json", json_encode($ignored));
+ header("Location: /$_GET[_]");
+ die();
+ }
+
+ die();
+}
+
+if (isset($_GET["lock"]) && isset($_GET["day"]) && isset($_GET["data"])) {
+ if (isset($locked[$_GET["day"]])) {
+ unset($locked[$_GET["day"]]);
+
+ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/evening.json")) unlink($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/evening.json");
+
+ file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/evening/locked.json", json_encode($locked));
+ header("Location: /$_GET[_]");
+ die();
+ } else {
+ $locked[$_GET["day"]] = $_GET["data"];
+
+ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/evening.json")) unlink($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/evening.json");
+
+ file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/evening/locked.json", json_encode($locked));
+ header("Location: /$_GET[_]");
+ die();
+ }
+} \ No newline at end of file