summaryrefslogtreecommitdiff
path: root/api
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2023-02-05 13:00:59 +0100
committerMinteck <contact@minteck.org>2023-02-05 13:00:59 +0100
commitabd342282b48d742cca1740f76d220037fd13800 (patch)
tree49654e39819b4bca60d0c64f716495551b92d143 /api
parentc6df470866ce00f91345888eac6d8aa76db694dc (diff)
downloadpluralconnect-abd342282b48d742cca1740f76d220037fd13800.tar.gz
pluralconnect-abd342282b48d742cca1740f76d220037fd13800.tar.bz2
pluralconnect-abd342282b48d742cca1740f76d220037fd13800.zip
Updated 6 files, added 2 files and renamed assets/uploads/pt-twilight.png (automated)
Diffstat (limited to 'api')
-rw-r--r--api/pluralkit-integration.php26
-rw-r--r--api/test1.php9
2 files changed, 27 insertions, 8 deletions
diff --git a/api/pluralkit-integration.php b/api/pluralkit-integration.php
index 6d1166c..b3badd7 100644
--- a/api/pluralkit-integration.php
+++ b/api/pluralkit-integration.php
@@ -1,5 +1,7 @@
<?php
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/agewarning.inc";
+
$user = $_GET['user'] ?? null;
$inputJSON = file_get_contents('php://input');
$input = json_decode($inputJSON, true);
@@ -34,8 +36,10 @@ if ($input['system_id'] === "7d9f543e-f742-40f6-9d07-86c3f2983124") {
$lastFronter = json_decode(@file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/last.json"), true) ?? "";
if ($input["type"] === "CREATE_SWITCH" || $input["type"] === "UPDATE_SWITCH" || $input["type"] === "DELETE_SWITCH") {
- file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/fronters.json", file_get_contents("https://pluralkit.equestria.dev/v2/systems/$input[system_id]/fronters"));
- file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/switches.json", file_get_contents("https://pluralkit.equestria.dev/v2/systems/$input[system_id]/switches"));
+ sleep(1.5);
+ file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/fronters.json", file_get_contents("https://api.pluralkit.me/v2/systems/$input[system_id]/fronters"));
+ sleep(1.5);
+ file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/switches.json", file_get_contents("https://api.pluralkit.me/v2/systems/$input[system_id]/switches"));
$fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/fronters.json"), true);
$currentFronter = $fronters["members"][0]["id"];
@@ -45,6 +49,24 @@ if ($input["type"] === "CREATE_SWITCH" || $input["type"] === "UPDATE_SWITCH" ||
file_put_contents("/mnt/ponytown-chat/tokens/" . $ponytown, $fronters["members"][0]["display_name"]);
+ if (count($fronters["members"]) > 0) {
+ foreach ($fronters["members"] as $member) {
+ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $member["id"] . ".json")) {
+ $metadata = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $member["id"] . ".json"), true);
+
+ if (!isset($metadata["birth"])) {
+ showWarning($member["display_name"] ?? $member["name"], $member["name"], $system);
+ } else if (isset($metadata['birth']["age"]) && $metadata["birth"]["age"] === 0 && (!isset($metadata['birth']["year"]) || $metadata["birth"]["year"] < 1900)) {
+ showWarning($member["display_name"] ?? $member["name"], $member["name"], $system);
+ } else if (isset($metadata['birth']["year"]) && $metadata["birth"]["year"] < 1900) {
+ showWarning($member["display_name"] ?? $member["name"], $member["name"], $system);
+ } else if (!isset($metadata['birth']["year"]) && !isset($metadata['birth']["age"])) {
+ showWarning($member["display_name"] ?? $member["name"], $member["name"], $system);
+ }
+ }
+ }
+ }
+
if (count($fronters["members"]) > 1) {
$context = stream_context_create([
'http' => [
diff --git a/api/test1.php b/api/test1.php
index 6d25f85..a8c9c97 100644
--- a/api/test1.php
+++ b/api/test1.php
@@ -1,8 +1,5 @@
<?php
-$img = imagecreate(2048, 1024);
-$color = imagecolorallocate($img, 255, 0, 0);
-
-header("Content-type: image/jpeg");
-imagejpeg($img);
-imagedestroy($img); \ No newline at end of file
+die();
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/agewarning.inc";
+showWarning("Zoom Zephyrwing", "zoomzephyrwing", "gdapd"); \ No newline at end of file