summaryrefslogtreecommitdiff
path: root/pages
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 /pages
parenteafc2b02a66838fdadb2da70d5b1a9aa04051de6 (diff)
downloadpluralconnect-eb7405f92bd01ab59a056ff5df6d2f1d6b30f0ce.tar.gz
pluralconnect-eb7405f92bd01ab59a056ff5df6d2f1d6b30f0ce.tar.bz2
pluralconnect-eb7405f92bd01ab59a056ff5df6d2f1d6b30f0ce.zip
Updated 13 files and added 2 files (automated)
Diffstat (limited to 'pages')
-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
6 files changed, 81 insertions, 8 deletions
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["_"]);