summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaindropsSys <contact@minteck.org>2023-04-13 22:07:44 +0200
committerRaindropsSys <contact@minteck.org>2023-04-13 22:07:44 +0200
commiteb7405f92bd01ab59a056ff5df6d2f1d6b30f0ce (patch)
treec15e12e96e0e83b665e4931df50bc034620fde3e
parenteafc2b02a66838fdadb2da70d5b1a9aa04051de6 (diff)
downloadpluralconnect-eb7405f92bd01ab59a056ff5df6d2f1d6b30f0ce.tar.gz
pluralconnect-eb7405f92bd01ab59a056ff5df6d2f1d6b30f0ce.tar.bz2
pluralconnect-eb7405f92bd01ab59a056ff5df6d2f1d6b30f0ce.zip
Updated 13 files and added 2 files (automated)
-rw-r--r--assets/logo/banner.js7
-rw-r--r--assets/logo/custom.css2
-rw-r--r--assets/species/merpony.pngbin0 -> 68751 bytes
-rw-r--r--includes/components/details.inc13
-rw-r--r--includes/components/planner.inc6
-rw-r--r--includes/fragments/member.inc103
-rw-r--r--includes/fragments/metadata.inc25
-rw-r--r--includes/jobs/UpdateAssets.php4
-rw-r--r--includes/util/banner.inc24
-rw-r--r--pages/api/badger.php1
-rw-r--r--pages/api/design.php54
-rw-r--r--pages/byspecies.inc3
-rw-r--r--pages/jobs.inc18
-rw-r--r--pages/metadata.inc11
-rw-r--r--pages/money.inc2
15 files changed, 233 insertions, 40 deletions
diff --git a/assets/logo/banner.js b/assets/logo/banner.js
index 02a8298..7a13759 100644
--- a/assets/logo/banner.js
+++ b/assets/logo/banner.js
@@ -55,6 +55,7 @@ async function refreshBanner(_, french) {
if (data['relations']['caretakers'] && data['relations']['caretakers'].length > 0) active++;
if (data['relations']['sexfriends'] && data['relations']['sexfriends'].length > 0) active++;
if (data['relations']['sisters'] && data['relations']['sisters'].length > 0) active++;
+ if (data['relations']['friends'] && data['relations']['friends'].length > 0) active++;
document.getElementById("member-banner").innerHTML = `
@@ -159,6 +160,12 @@ async function refreshBanner(_, french) {
${data['relations']['caretakers'].length === 0 ? '-' : ''}
</span>
` : ''}
+ ${data['relations']['friends'] && data['relations']['friends'].length > 0 ? `<span>
+ <b>${french ? (data['relations']['friends'].length > 1 ? 'Amies ' : 'Amie ') : `Friend${data['relations']['friends'].length > 1 ? 's' : ''}`}: </b>${data['relations']['sisters'].length > 1 ? '<span class="list-separator-mobile"><br></span>' : ''}
+ ${data['relations']['friends'].map(relation => `
+ <a title="${relation['name']}" data-bs-toggle="tooltip" class="member-link tooltip-nohelp" href="${relation['link']}"><img src="${offline ? relation['icon_offline'] : `${relation['icon']}`}" style="width:24px;"></a>`).join(``)}
+ ${data['relations']['friends'].length === 0 ? '-' : ''}
+ </span>` : ``}
</div>
` : '<div style="margin-top:5px;">&nbsp;</div>'}
</div>
diff --git a/assets/logo/custom.css b/assets/logo/custom.css
index 75c1d19..0d35c4b 100644
--- a/assets/logo/custom.css
+++ b/assets/logo/custom.css
@@ -678,7 +678,7 @@ peh-muted {
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
display: grid;
- grid-template-columns: repeat(5, 1fr);
+ grid-template-columns: repeat(4, 1fr);
text-align: center;
}
diff --git a/assets/species/merpony.png b/assets/species/merpony.png
new file mode 100644
index 0000000..504f6f2
--- /dev/null
+++ b/assets/species/merpony.png
Binary files differ
diff --git a/includes/components/details.inc b/includes/components/details.inc
index 6a9f241..7b02808 100644
--- a/includes/components/details.inc
+++ b/includes/components/details.inc
@@ -1,5 +1,5 @@
<?php global $isLoggedIn; global $metadata; global $memberData; global $isLowerLoggedIn; global $systemID; global $app; global $lang; global $pages; $pronouns = getMemberPronouns($memberData['pronouns']); ?>
-<div id="member-details" class="<?= (($isLoggedIn || $isLowerLoggedIn) && $systemID !== $app["other"]["id"]) ? 'member-details-loggedIn' : 'member-details-loggedIn2' ?>" style="<?php if (!$isLoggedIn && !$isLowerLoggedIn): ?>grid-template-columns: repeat(4, 1fr);<?php endif; ?> background-color: <?= isset($memberData["color"]) ? '#' . $memberData["color"] . "33" : "transparent" ?>; margin-left: -20px; margin-right: -20px;">
+<div id="member-details" class="<?= (($isLoggedIn || $isLowerLoggedIn) && $systemID !== $app["other"]["id"]) ? 'member-details-loggedIn' : 'member-details-loggedIn2' ?>" style="<?php if (!$isLoggedIn && !$isLowerLoggedIn): ?>grid-template-columns: repeat(3, 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"]) {
@@ -53,16 +53,7 @@
<?php endif; ?>
<?php endif; ?>
</div>
- <?php if ($systemID !== $app["other"]["id"]): if ($isLoggedIn || $isLowerLoggedIn): ?>
- <div>
- <b><?= $lang["details"]["code"] ?></b><span class="member-small-separator"><br></span>
- <?php if (isset($metadata["code"]) && trim($metadata["code"]) !== ""): ?>
- <code style="color: white;"><?= strtoupper(substr($metadata["code"], 0, 3)) ?></code>
- <?php else: ?>
- -
- <?php endif; ?>
- </div>
- <?php endif; ?>
+ <?php if ($systemID !== $app["other"]["id"]): ?>
<div>
<b>Primary interest:</b><span class="member-small-separator"><br></span>
<?php if (isset($metadata["interest"]) && trim($metadata["interest"]) !== ""): ?>
diff --git a/includes/components/planner.inc b/includes/components/planner.inc
index 9be9cb7..aed4e56 100644
--- a/includes/components/planner.inc
+++ b/includes/components/planner.inc
@@ -520,7 +520,9 @@ function day($display, $diff): void { if ($diff < 0) $disabled = true; else $dis
document.getElementById("associated-results").innerHTML = "";
for (let pony of availablePonies) {
- document.getElementById("associated-results").innerHTML += document.getElementById("list-pony-" + pony).outerHTML;
+ if (document.getElementById("list-pony-" + pony)) {
+ document.getElementById("associated-results").innerHTML += document.getElementById("list-pony-" + pony).outerHTML;
+ }
}
document.getElementById("list").style.display = "none";
@@ -970,7 +972,7 @@ function day($display, $diff): void { if ($diff < 0) $disabled = true; else $dis
document.getElementById("search-results").innerHTML = "";
for (let result of results) {
- document.getElementById("search-results").innerHTML += document.getElementById("list-pony-" + result.id).outerHTML;
+ if (document.getElementById("list-pony-" + result.id)) document.getElementById("search-results").innerHTML += document.getElementById("list-pony-" + result.id).outerHTML;
}
console.log(results);
diff --git a/includes/fragments/member.inc b/includes/fragments/member.inc
index f1169c8..6fbf3ad 100644
--- a/includes/fragments/member.inc
+++ b/includes/fragments/member.inc
@@ -2,6 +2,8 @@
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc";
+if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/designs")) mkdir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/designs");
+
if ($memberData["name"] === "fusion") {
$title = ($memberCommonName === "fusion" ? $lang["member"]["merge"] : $memberCommonName);
} else {
@@ -48,12 +50,34 @@ if ($memberData["name"] === "fusion") {
}
}
+if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/designs/" . $memberID . ".json")) file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/designs/" . $memberID . ".json", json_encode([
+ "_main" => [
+ "name" => "Main",
+ "note" => "Everyday appearance",
+ "image" => null
+ ]
+]));
+
+if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/ponies/" . $memberID . ".png")) {
+ $designs = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/designs/" . $memberID . ".json"), true);
+ $designs["_main"]["image"] = base64_encode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/assets/ponies/" . $memberData["id"] . ".png"));
+}
+
?>
<div id="member-banner-container" style="width: calc(100% - 300px);height: <?= !isset($memberData["banner"]) ? "33vh" : "65vh" ?>;position: fixed;background-image: url('<?= getAsset($systemID, $memberID, !isset($memberData["banner"]) ? "avatars" : "banners") ?>');background-size: cover;background-position: center; top: 0;">
<div id="member-banner-inner" style="height: 100%;width: 100%;background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,.25) 50%, rgba(0,0,0,1) 100%);<?= !isset($memberData["banner"]) ? "backdrop-filter:blur(100px);" : "" ?>"></div>
</div>
+<style>
+ .input-inherit {
+ all: inherit;
+ width: 200px;
+ height: max-content;
+ margin: 0;
+ }
+</style>
+
<script>
window.onscroll = () => {
document.getElementById("member-banner-container").style.height = (<?= !isset($memberData["banner"]) ? "33" : "65" ?> - ((window.scrollY / window.screen.availHeight) * 100)) + "vh";
@@ -63,12 +87,90 @@ if ($memberData["name"] === "fusion") {
document.getElementById("private-page-link").style.display = "none";
document.getElementById("private-page-hidden").style.display = "block";
}
+
+ function updateDesignName(id) {
+ if (id === "_main" && document.getElementById("design-" + id + "-name").value.trim() === "") {
+ document.getElementById("design-" + id + "-name").value = "Main";
+ } else {
+ fetch("/api/design/?member=<?= $memberID ?>&type=name&id=" + id + "&value=" + encodeURIComponent(btoa(document.getElementById("design-" + id + "-name").value))).then((a) => {
+ a.text().then((b) => {
+ if (b.trim() === "&") {
+ location.reload();
+ }
+ })
+ })
+ }
+ }
+
+ function updateDesignNote(id) {
+ fetch("/api/design/?member=<?= $memberID ?>&type=note&id=" + id + "&value=" + encodeURIComponent(btoa(document.getElementById("design-" + id + "-note").value)));
+ }
+
+ function _arrayBufferToBase64( buffer ) {
+ var binary = '';
+ var bytes = new Uint8Array( buffer );
+ var len = bytes.byteLength;
+ for (var i = 0; i < len; i++) {
+ binary += String.fromCharCode( bytes[ i ] );
+ }
+ return window.btoa( binary );
+ }
+
+ async function uploadNewDesign() {
+ let handles = await window.showOpenFilePicker({
+ multiple: false
+ });
+
+ if (handles.length >= 1) {
+ let file = await handles[0].getFile();
+
+ if (file.size > 2*1024**2) {} else {
+ let reader = new FileReader();
+ reader.readAsArrayBuffer(file);
+
+ reader.onload = () => {
+ let content = _arrayBufferToBase64(reader.result);
+
+ fetch("/api/design/?member=<?= $memberID ?>&type=upload", {
+ method: "post",
+ body: JSON.stringify({
+ file: content
+ })
+ }).then(() => {
+ location.reload();
+ });
+ }
+
+ reader.onerror = () => {}
+ }
+ }
+ }
</script>
<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; ?>">
<?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;">
+ <div style="background-color: rgba(200, 200, 200, .05); border-radius: 10px; padding: 10px 20px; overflow-x: scroll; display: flex; grid-gap: 20px;">
+ <?php foreach ($designs as $id => $design): if (isset($design)): ?>
+ <div style="display: grid; grid-template-rows: 208px 48px; width: max-content;">
+ <div style="display: flex; align-items: center; justify-content: center;">
+ <img src="data:image/png;base64,<?= $design["image"] ?>" style="height: 208px;">
+ </div>
+ <div style="text-align: center; margin-top: 5px; height: 48px; width: max-content;">
+ <b><input onkeyup="updateDesignName('<?= $id ?>');" maxlength="100" class="input-inherit" value="<?= $design["name"] ?>" id="design-<?= $id ?>-name"></b><br><input onkeyup="updateDesignNote('<?= $id ?>');" maxlength="100" class="input-inherit" value="<?= $design["note"] ?>" id="design-<?= $id ?>-note">
+ </div>
+ </div>
+ <?php endif; endforeach; ?>
+
+ <div onclick="uploadNewDesign();" style="cursor: pointer; display: flex; height: 256px; align-items: center; justify-content: center; width: 64px;">
+ <img src="/assets/icons/add.svg" style="filter: invert(1); opacity: .5; width: 64px;">
+ </div>
+ </div>
+ </div>
+ <?php endif; ?>
<div id="page-content">
<?php if ($memberData["name"] === "unknown"): ?>
@@ -98,7 +200,6 @@ if ($memberData["name"] === "fusion") {
<br>
<?php else: ?>
<?php if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/$memberID-private.html") && $isLoggedIn): ?>
- <br>
<?php
$text = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/$memberID-private.html");
diff --git a/includes/fragments/metadata.inc b/includes/fragments/metadata.inc
index 7a3779a..0d2187c 100644
--- a/includes/fragments/metadata.inc
+++ b/includes/fragments/metadata.inc
@@ -49,6 +49,7 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $member
<option <?= $metadata["species"][0] === "batpony" ? "selected" : "" ?> value="batpony">Bat pony</option>
<option <?= $metadata["species"][0] === "crystal" ? "selected" : "" ?> value="crystal">Crystal pony</option>
<option <?= $metadata["species"][0] === "changeling" ? "selected" : "" ?> value="changeling">Changeling</option>
+ <option <?= $metadata["species"][0] === "merpony" ? "selected" : "" ?> value="merpony">Merpony</option>
</select>
<select class="tooltip-nohelp form-select" style='display:inline-block;filter:invert(1) hue-rotate(180deg);background-image:url("data:image/svg+xml,%3csvg xmlns=&apos;http://www.w3.org/2000/svg&apos; viewBox=&apos;0 0 16 16&apos;%3e%3cpath fill=&apos;none&apos; stroke=&apos;%23000000&apos; stroke-linecap=&apos;round&apos; stroke-linejoin=&apos;round&apos; stroke-width=&apos;2&apos; d=&apos;M2 5l6 6 6-6&apos;/%3e%3c/svg%3e");' name="species[1]">
<option <?= !isset($metadata["species"][1]) || $metadata["species"][1] === "" ? "selected" : "" ?> value="">None</option>
@@ -59,6 +60,7 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $member
<option <?= $metadata["species"][1] === "batpony" ? "selected" : "" ?> value="batpony">Bat pony</option>
<option <?= $metadata["species"][1] === "crystal" ? "selected" : "" ?> value="crystal">Crystal pony</option>
<option <?= $metadata["species"][1] === "changeling" ? "selected" : "" ?> value="changeling">Changeling</option>
+ <option <?= $metadata["species"][1] === "merpony" ? "selected" : "" ?> value="merpony">Merpony</option>
</select>
</div>
</div>
@@ -110,25 +112,14 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $member
<b>Caretakers (full IDs, comma-separated)</b><br>
<input name="caretakers" class="form-control" style="filter: invert(1) hue-rotate(180deg);" type="text" value="<?= implode(", ", $metadata["caretakers"]) ?>">
</p>
-
- <?php if ($systemID !== $app["other"]["id"]): ?>
- <hr>
-
- <h3>Technical details</h3>
-
<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"] ?? "" ?>">
+ <b>Friends (full IDs, comma-separated)</b><br>
+ <input name="friends" class="form-control" style="filter: invert(1) hue-rotate(180deg);" type="text" value="<?= implode(", ", $metadata["friends"] ?? []) ?>">
</p>
- <p>
- <b>Member code</b><br>
- <input name="membc" class="form-control" style="filter: invert(1) hue-rotate(180deg);" type="text" value="<?= $metadata["code"] ?? "" ?>">
- </p>
- <?php endif; ?>
<hr>
- <h3>Age information</h3>
+ <h3>Age and interests</h3>
<p>
<b>Birth date (use January 1<sup>st</sup> for none, fixed age takes priority over birth year if applicable)</b><br>
@@ -138,6 +129,12 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $member
<b>Age (for ponies with fixed age, takes priority over birth year)</b><br>
<input name="age" class="form-control" style="filter: invert(1) hue-rotate(180deg);" type="text" pattern="^(-\d{1,2}|\d{1,2}(-\d{1,2}|))$" value="<?= $metadata["birth"]["age"] ?? "" ?>">
</p>
+ <?php if ($systemID !== $app["other"]["id"]): ?>
+ <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>
+ <?php endif; ?>
<hr>
diff --git a/includes/jobs/UpdateAssets.php b/includes/jobs/UpdateAssets.php
index 0c05686..2b5bba2 100644
--- a/includes/jobs/UpdateAssets.php
+++ b/includes/jobs/UpdateAssets.php
@@ -48,7 +48,7 @@ function downloadAssets($system, $path = null) {
$id = preg_replace("/^([\da-f]{8})-([\da-f]{4})-([\da-f]{4})-([\da-f]{4})-([\da-f]{12})$/", "$1$2$3$4$5", $general["uuid"]) . preg_replace("/^([\da-f]{8})-([\da-f]{4})-([\da-f]{4})-([\da-f]{4})-([\da-f]{12})$/", "$1$2$3$4$5", $member["uuid"]);
if ($options["type"] === "members") {
- echo("Downloading member assets\n");
+ echo("Downloading member assets (" . ($member["display_name"] ?? $member["name"]) . ", " . $member["id"] . ")\n");
if (isset($member["avatar_url"])) {
echo(" /avatars/$id.webp\n");
file_put_contents("/tmp/img." . pathinfo($member['avatar_url'], PATHINFO_EXTENSION), file_get_contents($member['avatar_url']));
@@ -79,7 +79,7 @@ function downloadAssets($system, $path = null) {
}
if ($options["type"] === "ponytown") {
- echo("Downloading Pony Town assets\n");
+ echo("Downloading Pony Town assets (" . ($member["display_name"] ?? $member["name"]) . ", " . $member["id"] . ")\n");
if (file_exists("" . $_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member["name"] . ".png")) {
$url = "" . $_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member["name"] . ".png";
} else {
diff --git a/includes/util/banner.inc b/includes/util/banner.inc
index 947e5c6..0db683f 100644
--- a/includes/util/banner.inc
+++ b/includes/util/banner.inc
@@ -132,6 +132,7 @@ function getMemberBannerData(string $id, string $system, bool $french = false) {
"batpony" => $metadata["robot"] ? "Robot Poney chauve souris" : (!$metadata["plush"] ? "Poney chauve souris" : "Poney chauve souris en peluche"),
"unicorn" => $metadata["robot"] ? "Robot licorne" : (!$metadata["plush"] ? "Licorne" : "Licorne en peluche"),
"changeling" => "Changelin",
+ "merpony" => "Poney sirène",
default => $species . "_" . $metadata["robot"]
};
} else {
@@ -143,6 +144,7 @@ function getMemberBannerData(string $id, string $system, bool $french = false) {
"batpony" => $metadata["robot"] ? "Robot bat pony" : (!$metadata["plush"] ? "Bat pony" : "Bat pony plush"),
"unicorn" => $metadata["robot"] ? "Robot unicorn" : (!$metadata["plush"] ? "Unicorn" : "Unicorn plush"),
"changeling" => "Changeling",
+ "merpony" => "Merpony",
default => $species . "_" . $metadata["robot"]
};
}
@@ -242,6 +244,25 @@ function getMemberBannerData(string $id, string $system, bool $french = false) {
];
}
+ $friends = [];
+ foreach ($metadata["friends"] ?? [] as $marefriend) {
+ $mfSystem = explode("/", $marefriend)[0];
+ $mfMemberID = explode("/", $marefriend)[1];
+ $mfMember = array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$mfSystem/members.json"), true), function ($item) use ($mfMemberID) {
+ return $item["id"] === $mfMemberID;
+ });
+ sort($mfMember);
+ $mfMember = $mfMember[0];
+
+ if (!($mfSystem === $app["other"]["id"] && !$isLoggedIn && !$isLowerLoggedIn)) $friends[] = [
+ "id" => $marefriend,
+ "link" => "/" . ($mfMember["name"]),
+ "icon" => getAsset($mfSystem, $mfMemberID, "heads"),
+ "name" => $mfMember["display_name"] ?? $mfMember["name"],
+ "full_name" => $mfMember["display_name"] ?? $mfMember["name"]
+ ];
+ }
+
$caretakers = null;
if ($metadata["little"] >= 2) {
@@ -479,7 +500,8 @@ function getMemberBannerData(string $id, string $system, bool $french = false) {
'marefriends' => $marefriends ?? [],
'sexfriends' => $sexfriends ?? null,
'sisters' => $sisters ?? [],
- 'caretakers' => $caretakers ?? []
+ 'caretakers' => $caretakers ?? [],
+ 'friends' => $friends ?? []
]
];
} \ No newline at end of file
diff --git a/pages/api/badger.php b/pages/api/badger.php
index 76f017e..3e8d04a 100644
--- a/pages/api/badger.php
+++ b/pages/api/badger.php
@@ -39,6 +39,7 @@ die(json_encode(array_map(function ($i) {
"batpony" => $i["_metadata"]["robot"] ? "Robot bat pony" : (!$i["_metadata"]["plush"] ? "Bat pony" : "Bat pony plush"),
"unicorn" => $i["_metadata"]["robot"] ? "Robot unicorn" : (!$i["_metadata"]["plush"] ? "Unicorn" : "Unicorn plush"),
"changeling" => "Changeling",
+ "merpony" => "Merpony",
default => $i["_metadata"]["species"][0] . "_" . $i["_metadata"]["robot"]
},
"age" => getAge($i["_metadata"]),
diff --git a/pages/api/design.php b/pages/api/design.php
new file mode 100644
index 0000000..512677d
--- /dev/null
+++ b/pages/api/design.php
@@ -0,0 +1,54 @@
+<?php
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn;
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/random.inc";
+
+if (!$isLoggedIn || !isset($_GET["type"]) || !isset($_GET["member"])) die("Not logged in or missing operand");
+if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/ponies/" . $_GET["member"] . ".png")) die("No initial Pony Town character");
+
+$designs = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/designs/" . $_GET["member"] . ".json"), true);
+
+$inputJSON = file_get_contents('php://input');
+$input = json_decode($inputJSON, true);
+
+switch ($_GET["type"]) {
+ case "name":
+ $designs[$_GET["id"]]["name"] = trim(strip_tags(substr(base64_decode($_GET["value"]), 0, 100)));
+
+ if (trim(strip_tags(substr(base64_decode($_GET["value"]), 0, 100))) === "" && $_GET["id"] !== "_main") {
+ unset($designs[$_GET["id"]]);
+ echo("&");
+ }
+
+ break;
+
+ case "note":
+ $designs[$_GET["id"]]["note"] = trim(strip_tags(substr(base64_decode($_GET["value"]), 0, 100)));
+ break;
+
+ case "upload":
+ $id = random();
+
+ $file = base64_decode($input["file"]);
+ $image = @imagecreatefromstring($file);
+
+ imagealphablending($image, false);
+ imagesavealpha($image, true);
+
+ imagepng($image, "/tmp/temp-" . $id . ".png");
+ $text = base64_encode(file_get_contents("/tmp/temp-" . $id . ".png"));
+ unlink("/tmp/temp-" . $id . ".png");
+
+ $designs[$id] = [
+ "name" => "Untitled",
+ "note" => "ID: " . $id,
+ "image" => $text
+ ];
+
+ break;
+
+ default:
+ die("Invalid type");
+}
+
+file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/designs/" . $_GET["member"] . ".json", json_encode($designs)); \ No newline at end of file
diff --git a/pages/byspecies.inc b/pages/byspecies.inc
index ee2b372..d2a2930 100644
--- a/pages/byspecies.inc
+++ b/pages/byspecies.inc
@@ -30,6 +30,7 @@ function species(array $members, string $id, string $name) { global $systemID; g
$batpony = [];
$crystal = [];
$changeling = [];
+ $merpony = [];
foreach ($members as $member) {
foreach ($member["_metadata"]["species"] as $species) {
@@ -40,6 +41,7 @@ function species(array $members, string $id, string $name) { global $systemID; g
if ($species === "batpony") $batpony[] = $member;
if ($species === "crystal") $crystal[] = $member;
if ($species === "changeling") $changeling[] = $member;
+ if ($species === "merpony") $merpony[] = $member;
}
}
@@ -52,6 +54,7 @@ function species(array $members, string $id, string $name) { global $systemID; g
<?php species($batpony, "batpony", $lang["species"]["batpony"][3]); ?>
<?php species($crystal, "crystal", $lang["species"]["crystal"][3]); ?>
<?php species($changeling, "changeling", "Changelings"); ?>
+ <?php species($merpony, "merpony", "Merponies"); ?>
</div>
<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/footer.inc'; ?> \ No newline at end of file
diff --git a/pages/jobs.inc b/pages/jobs.inc
index 109b484..6723175 100644
--- a/pages/jobs.inc
+++ b/pages/jobs.inc
@@ -1,10 +1,18 @@
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages;
-require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc';
+require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/util/functions.inc';
$history = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/history.json"), true);
+if (isset($_GET["enqueue"]) && isset($history[(int)$_GET["enqueue"]])) {
+ createJob(explode("(", $history[(int)$_GET["enqueue"]]["name"])[0], $history[(int)$_GET["enqueue"]]["options"]);
+ header("Location: /-/jobs/?enqueued");
+ die();
+}
+
+require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc';
+
?>
<style>
@@ -60,8 +68,12 @@ $history = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/
<div id="page-content">
<h2>Jobs history</h2>
+ <?php if (isset($_GET["enqueued"])): ?>
+ <div class="alert alert-success">Successfully enqueued a new job, it will be run shortly and appear on this page once it has finished.</div>
+ <?php endif; ?>
+
<div class="list-group">
- <?php foreach ($history as $item): ?>
+ <?php foreach ($history as $index => $item): ?>
<details class="list-group-item">
<summary style="list-style: none; display: grid; grid-template-columns: 3fr repeat(2, 1fr);">
<div><?= $item["name"] ?></div>
@@ -72,7 +84,7 @@ $history = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/
<div class="list-group" style="margin-top: 10px;">
<div class="list-group-item">
<p>
- <b>Duration:</b> <?= $item["time"] ?>ms
+ <b>Duration:</b> <?= $item["time"] ?>ms · <a href="/-/jobs/?enqueue=<?= $index ?>">Enqueue again</a>
<b></b>
</p>
diff --git a/pages/metadata.inc b/pages/metadata.inc
index 04579a8..b254ceb 100644
--- a/pages/metadata.inc
+++ b/pages/metadata.inc
@@ -53,10 +53,6 @@ if ($member === null) {
header("Content-Type: text/plain");
- if (isset($_GET["bitset"]) && is_numeric($_GET["bitset"])) {
- $toUpdate["bitset"] = (int)$_GET["bitset"];
- }
-
if (isset($_GET["food"]) && is_numeric($_GET["food"])) {
$toUpdate["food"] = (int)$_GET["food"];
}
@@ -125,6 +121,12 @@ if ($member === null) {
}));
}
+ if (isset($_GET["friends"])) {
+ $toUpdate["friends"] = array_values(array_filter(array_map(function ($i) { return trim($i); }, explode(",", $_GET["friends"])), function ($i) use ($regex) {
+ return !!preg_match($regex, $i);
+ }));
+ }
+
if (isset($_GET['regressed'])) {
if (!!preg_match("/^[a-z]{5}$/m", $_GET['regressed'])) {
$toUpdate["regression"] = $_GET['regressed'];
@@ -175,6 +177,7 @@ if ($member === null) {
}
if (isset($metadata["bitset"])) unset($metadata["bitset"]);
+ if (isset($metadata["code"])) unset($metadata["code"]);
if (trim($metadata["species"][1]) === "") unset($metadata["species"][1]);
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $memberID . ".json", json_encode($metadata));
diff --git a/pages/money.inc b/pages/money.inc
index 387f5c0..cf07063 100644
--- a/pages/money.inc
+++ b/pages/money.inc
@@ -1,7 +1,7 @@
<?php
$minimumRaindrops = 200;
-$minimumCloudburst = 1000;
+$minimumCloudburst = 2871.32;
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; global $_PROFILE;
$parts = explode("/", $_GET["_"]);