summaryrefslogtreecommitdiff
path: root/api
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2023-02-23 19:34:56 +0100
committerMinteck <contact@minteck.org>2023-02-23 19:34:56 +0100
commit3d1cd02f27518f1a04374c7c8320cd5d82ede6e9 (patch)
tree75be5fba4368472fb11c8015aee026b2b9a71888 /api
parent8cc1f13c17fa2fb5a4410542d39e650e02945634 (diff)
downloadpluralconnect-3d1cd02f27518f1a04374c7c8320cd5d82ede6e9.tar.gz
pluralconnect-3d1cd02f27518f1a04374c7c8320cd5d82ede6e9.tar.bz2
pluralconnect-3d1cd02f27518f1a04374c7c8320cd5d82ede6e9.zip
Updated 40 files, added 37 files, deleted 1103 files and renamed 3905 files (automated)
Diffstat (limited to 'api')
-rw-r--r--api/app-images.php43
-rw-r--r--api/camera.php6
-rw-r--r--api/cloudburst-banners.php19
-rw-r--r--api/cloudburst-data.php44
-rw-r--r--api/cloudburst-scored.php9
-rw-r--r--api/cloudburst.php6
-rw-r--r--api/computer.php50
-rw-r--r--api/data.php12
-rw-r--r--api/desktop-app.php81
-rw-r--r--api/docs.php29
-rw-r--r--api/emergency-real.php22
-rw-r--r--api/emergency.php22
-rw-r--r--api/eval.php12
-rw-r--r--api/fronter.php113
-rw-r--r--api/me-picture.php22
-rw-r--r--api/me.php13
-rw-r--r--api/pleasure-real.php35
-rw-r--r--api/pleasure.php35
-rw-r--r--api/pluralkit-integration.php176
-rw-r--r--api/raindrops-banners.php19
-rw-r--r--api/raindrops-data.php44
-rw-r--r--api/raindrops-img-round.php94
-rw-r--r--api/raindrops-img.php11
-rw-r--r--api/raindrops-img2-round.php94
-rw-r--r--api/raindrops-scored.php9
-rw-r--r--api/raindrops-two.php8
-rw-r--r--api/raindrops.php6
-rw-r--r--api/save-private.php43
-rw-r--r--api/save.php45
-rw-r--r--api/session.php6
-rw-r--r--api/test.php4
-rw-r--r--api/test1.php5
-rw-r--r--api/token.php7
-rw-r--r--api/video.php34
-rw-r--r--api/wakeup-real.php28
-rw-r--r--api/wakeup.php28
36 files changed, 0 insertions, 1234 deletions
diff --git a/api/app-images.php b/api/app-images.php
deleted file mode 100644
index dea66cb..0000000
--- a/api/app-images.php
+++ /dev/null
@@ -1,43 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn;
-if (!$isLoggedIn) header("Location: /-/login") and die();
-global $_PROFILE;
-
-$data = [
- "ponytown" => [],
- "profile" => [],
- "misc" => []
-];
-
-$data["misc"]["systems"] = [
- "cloudburst.png" => "data:image/png;base64," . base64_encode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/cloudburst.png")),
- "raindrops.png" => "data:image/png;base64," . base64_encode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/raindrops.png"))
-];
-
-foreach (array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads"), function ($i) { return str_starts_with($i, "ss-") && str_ends_with($i, ".png"); }) as $file) {
- $data["misc"]["systems"][$file] = "data:image/png;base64," . base64_encode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/" . $file));
-}
-
-$data["misc"]["species"] = [];
-
-foreach (array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/assets/species"), function ($i) { return !str_starts_with($i, "."); }) as $file) {
- $name = substr($file, 0, strlen($file) - 4);
- $data["misc"]["species"][$name] = "data:" . mime_content_type($_SERVER['DOCUMENT_ROOT'] . "/assets/species/" . $file) . ";base64," . base64_encode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/assets/species/" . $file));
-}
-
-foreach (array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/images"), function ($i) { return !str_starts_with($i, "."); }) as $file) {
- $name = explode(".", $file)[0];
- $parts = explode("-", $name);
- $type = mime_content_type($_SERVER['DOCUMENT_ROOT'] . "/includes/data/images/" . $file);
- $category = match ($parts[0]) {
- "pt" => "ponytown",
- "pf" => "profile"
- };
-
- if (!isset($data[$category][$parts[1]])) $data[$category][$parts[1]] = [];
- $data[$category][$parts[1]][$parts[2]] = "data:" . $type . ";base64," . base64_encode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/images/" . $file));
-}
-
-header("Content-Type: application/json");
-die(json_encode($data, JSON_PRETTY_PRINT)); \ No newline at end of file
diff --git a/api/camera.php b/api/camera.php
deleted file mode 100644
index cbf7efc..0000000
--- a/api/camera.php
+++ /dev/null
@@ -1,6 +0,0 @@
-<?php
-
-if (!isset($_GET['t']) || preg_match("/[^a-zA-Z\d]/m", $_GET['t'])) die();
-
-header("Content-Type: image/jpeg");
-die(base64_decode(exec('ssh root@192.168.1.27 "cd /root/alarm; node open.js ' . $_GET['t'] . '"'))); \ No newline at end of file
diff --git a/api/cloudburst-banners.php b/api/cloudburst-banners.php
deleted file mode 100644
index 62e6936..0000000
--- a/api/cloudburst-banners.php
+++ /dev/null
@@ -1,19 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn;
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/bitset.inc";
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/banner.inc";
-if (!$isLoggedIn) header("Location: /-/login") and die();
-
-$data = [];
-
-foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/members.json"), true) as $member) {
- if ($member['name'] === "unknown") continue;
- if ($member['name'] === "fusion") continue;
- if ($member['name'] === "new") continue;
-
- $data[$member['name']] = getMemberBannerData($member['id'], "ynmuc");
-}
-
-header("Content-Type: application/json");
-die(json_encode($data, JSON_PRETTY_PRINT)); \ No newline at end of file
diff --git a/api/cloudburst-data.php b/api/cloudburst-data.php
deleted file mode 100644
index edddd2d..0000000
--- a/api/cloudburst-data.php
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn;
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/bitset.inc";
-if (!$isLoggedIn) header("Location: /-/login") and die();
-
-$data = [];
-$data["members"] = [];
-
-foreach (array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data"), function ($i) { return !str_starts_with($i, "."); }) as $file) {
- if (str_starts_with($file, "ynmuc-") && !(str_ends_with($file, "/members.json") || str_ends_with($file, "/content.html") || str_ends_with($file, "/general.json") || str_ends_with($file, "/switches.json"))) {
- $name = substr(explode(".", $file)[0], 6);
- $parts = explode("-", $name);
-
- if (explode(".", $file)[1] === "json") {
- if (strlen($parts[0]) === 5) {
- if (!isset($data["members"][$parts[0]])) $data["members"][$parts[0]] = [
- "metadata" => null,
- "content" => null
- ];
- if ($parts[1] === "metadata") {
- $data["members"][$parts[0]][$parts[1]] = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $file), true));
- } else {
- $data["members"][$parts[0]][$parts[1]] = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $file), true);
- }
- } else {
- $data[$name] = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $file), true);
- }
- } else {
- if (strlen($parts[0]) === 5) {
- if (!isset($data["members"][$parts[0]])) $data["members"][$parts[0]] = [
- "metadata" => null,
- "content" => null
- ];
- $data["members"][$parts[0]][$parts[1]] = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $file);
- } else {
- $data[$name] = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $file);
- }
- }
- }
-}
-
-header("Content-Type: application/json");
-die(json_encode($data, JSON_PRETTY_PRINT)); \ No newline at end of file
diff --git a/api/cloudburst-scored.php b/api/cloudburst-scored.php
deleted file mode 100644
index 649b4fc..0000000
--- a/api/cloudburst-scored.php
+++ /dev/null
@@ -1,9 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn;
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/score.inc";
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/bitset.inc";
-if (!$isLoggedIn) header("Location: /-/login") and die();
-
-header("Content-Type: application/json");
-die(json_encode(array_values(scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/members.json"), true), "ynmuc")), JSON_PRETTY_PRINT)); \ No newline at end of file
diff --git a/api/cloudburst.php b/api/cloudburst.php
deleted file mode 100644
index efdcd73..0000000
--- a/api/cloudburst.php
+++ /dev/null
@@ -1,6 +0,0 @@
-<?php
-
-header("Content-Type: text/plain");
-
-$fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/content.html"), true);
-echo($fronters['members'][0]['display_name'] ?? $fronters['members'][0]['name']); \ No newline at end of file
diff --git a/api/computer.php b/api/computer.php
deleted file mode 100644
index cd065e7..0000000
--- a/api/computer.php
+++ /dev/null
@@ -1,50 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn; global $_PROFILE;
-if (!$isLoggedIn) header("Location: /-/login") and die();
-
-$request_raw = file_get_contents('php://input');
-$json_object = json_decode($request_raw, true);
-
-$host = md5($json_object['host']);
-
-switch ($_GET['type']) {
- case "heartbeat":
- if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/metadata/" . $_PROFILE['login'] . "-" . $host . ".json")) {
- $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/metadata/" . $_PROFILE['login'] . "-" . $host . ".json"), true);
- $data["date"] = date('c');
- file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/metadata/" . $_PROFILE['login'] . "-" . $host . ".json", json_encode($data));
- }
- break;
-
- case "screenshot":
- $id = $json_object['id'];
- $data = base64_decode($json_object['data']);
-
- if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/screens")) mkdir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/screens");
- file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/screens/" . $_PROFILE['login'] . "-" . $host . "-" . $id . ".jpg", $data);
- break;
-
- case "window":
- $id = sha1($json_object['id']);
- $data = base64_decode($json_object['data']);
-
- if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/windows")) mkdir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/windows");
- file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/windows/" . $_PROFILE['login'] . "-" . $host . "-" . $id . ".jpg", $data);
-
- if (isset($json_object['icon'])) {
- $data2 = base64_decode($json_object['icon']);
- file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/windows/" . $_PROFILE['login'] . "-" . $host . "-" . $id . ".png", $data2);
- } else {
- file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/windows/" . $_PROFILE['login'] . "-" . $host . "-" . $id . ".png", "");
- }
-
- break;
-
- case "data":
- if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/metadata")) mkdir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/metadata");
- file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/metadata/" . $_PROFILE['login'] . "-" . $host . ".json", json_encode($json_object));
- break;
-}
-
-die("OK"); \ No newline at end of file
diff --git a/api/data.php b/api/data.php
deleted file mode 100644
index 0a1b01b..0000000
--- a/api/data.php
+++ /dev/null
@@ -1,12 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn;
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/bitset.inc";
-if (!$isLoggedIn) header("Location: /-/login") and die();
-
-if (!isset($_GET['f']) || !file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $_GET['f'])) {
- die();
-} else {
- header("Content-Type: " . mime_content_type($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $_GET['f']));
- die(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $_GET['f']));
-} \ No newline at end of file
diff --git a/api/desktop-app.php b/api/desktop-app.php
deleted file mode 100644
index 2d0f0bf..0000000
--- a/api/desktop-app.php
+++ /dev/null
@@ -1,81 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/bitset.inc";
-
-if (!isset($_GET["id"])) die();
-
-if (isset($_GET["config"])) {
- $data = [];
-
- $keys = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/permitted.json"), true);
- $proceed = false;
-
- if (in_array($_GET["id"], array_keys($keys))) {
- $proceed = true;
- $fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $keys[$_GET["id"]]["system"] . "/fronters.json"), true)["members"];
-
- if (count($fronters) > 0) {
- $fronter = $fronters[0];
- $info = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $fronter["id"] . ".json"), true);
- $info = parseMetadata($info);
-
- if (isset($info["birth"]["age"]) && $info["birth"]["age"] < 16 && $info["birth"]["age"] > 0) {
- $proceed = false;
- } else if (isset($info["birth"]["year"]) && $info["birth"]["year"] > 1900) {
- if (!isset($info["birth"]["date"])) $info["birth"]["date"] = "01-01";
-
- $age = (int)date('Y') - $info["birth"]["year"] + (strtotime(date('Y') . "-" . $info["birth"]["date"]) <= time() ? 0 : -1);
-
- if ($age < 16) {
- $proceed = false;
- }
- }
- }
- }
-
- if ($proceed) {
- if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/app-usage.json")) file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/app-usage.json", "{}");
- $usage = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/app-usage.json"), true);
- $usage[$_GET['id']] = date('c');
- file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/app-usage.json", json_encode($usage));
-
- $data = $keys[$_GET["id"]]["config"] ?? [];
- }
-} else {
- $data = [
- "success" => true,
- "valid" => false,
- "underage" => false,
- "normal" => false
- ];
-
- $keys = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/permitted.json"), true);
-
- if (in_array($_GET["id"], array_keys($keys))) {
- $data["valid"] = true;
-
- $fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $keys[$_GET["id"]]["system"] . "/fronters.json"), true)["members"];
-
- if (count($fronters) > 0) {
- $fronter = $fronters[0];
- $info = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $fronter["id"] . ".json"), true);
- $info = parseMetadata($info);
-
- $data["normal"] = $info["sexually_active"];
-
- if (isset($info["birth"]["age"]) && $info["birth"]["age"] < 16 && $info["birth"]["age"] > 0) {
- $data["underage"] = true;
- } else if (isset($info["birth"]["year"]) && $info["birth"]["year"] > 1900) {
- if (!isset($info["birth"]["date"])) $info["birth"]["date"] = "01-01";
-
- $age = (int)date('Y') - $info["birth"]["year"] + (strtotime(date('Y') . "-" . $info["birth"]["date"]) <= time() ? 0 : -1);
-
- if ($age < 16) {
- $data["underage"] = true;
- }
- }
- }
- }
-}
-
-die(json_encode($data)); \ No newline at end of file
diff --git a/api/docs.php b/api/docs.php
deleted file mode 100644
index 89e9216..0000000
--- a/api/docs.php
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn; global $_PROFILE;
-if (!$isLoggedIn) header("Location: /-/login") and die();
-
-$request_raw = file_get_contents('php://input');
-$json_object = json_decode($request_raw, true);
-
-$select = $_GET['id'] ?? null;
-
-if (isset($select)) {
- if (ctype_alnum($select) && file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/docs/" . $select . ".json")) {
- $id = $select;
- $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/docs/" . $select . ".json"), true);
- } else {
- die("Not found");
- }
-} else {
- die("Not set");
-}
-
-if ($json_object["content"]) $data["contents"] = $json_object["content"];
-if ($json_object["name"]) $data["name"] = $json_object["name"];
-if ($json_object["category"]) $data["category"] = trim($json_object["category"]) !== "" && trim($json_object["category"]) !== "Unsorted" && trim($json_object["category"]) !== "unsorted" && trim($json_object["category"]) !== "/no" && trim($json_object["category"]) !== "Unsort" && trim($json_object["category"]) !== "unsort" ? $json_object["category"] : null;
-
-$data["last"]["date"] = time();
-$data["last"]["author"] = $_PROFILE['login'];
-
-file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/docs/" . $select . ".json", utf8_encode(json_encode($data))); \ No newline at end of file
diff --git a/api/emergency-real.php b/api/emergency-real.php
deleted file mode 100644
index 2dd7172..0000000
--- a/api/emergency-real.php
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn;
-if (!$isLoggedIn) header("Location: /-/login") and die();
-global $_PROFILE;
-
-$ntfy = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true)["ntfy"];
-
-file_get_contents('https://' . $ntfy["server"] . '/' . $ntfy["topic"], false, stream_context_create([
- 'http' => [
- 'method' => 'POST',
- 'header' =>
- "Content-Type: text/plain\r\n" .
- "Title: ⚠️🆘 EMERGENCY ⚠️🆘\r\n" .
- "Priority: urgent\r\n" .
- "Tags: emergency\r\n" .
- "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]),
- 'content' => "This is an emergency, " . $_PROFILE['name'] . " is in need of IMMEDIATE help. Please act now!"
- ]
-]));
-
-die(); \ No newline at end of file
diff --git a/api/emergency.php b/api/emergency.php
deleted file mode 100644
index e0726e7..0000000
--- a/api/emergency.php
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn;
-if (!$isLoggedIn) header("Location: /-/login") and die();
-global $_PROFILE;
-
-$ntfy = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true)["ntfy"];
-
-file_get_contents('https://' . $ntfy["server"] . '/' . $ntfy["topic"], false, stream_context_create([
- 'http' => [
- 'method' => 'POST',
- 'header' =>
- "Content-Type: text/plain\r\n" .
- "Title: [Test] ⚠️🆘 EMERGENCY ⚠️🆘\r\n" .
- "Priority: urgent\r\n" .
- "Tags: emergency\r\n" .
- "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]),
- 'content' => "[This notification is test] This is an emergency, " . $_PROFILE['name'] . " is in need of IMMEDIATE help. Please act now! [This notification is test]"
- ]
-]));
-
-die(); \ No newline at end of file
diff --git a/api/eval.php b/api/eval.php
deleted file mode 100644
index cebf38b..0000000
--- a/api/eval.php
+++ /dev/null
@@ -1,12 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn;
-if (!$isLoggedIn) header("Location: /-/login") and die();
-
-header("Content-Type: text/plain");
-
-if (isset($_GET["c"])) {
- var_dump(eval($_GET['c']));
-} else {
- die();
-} \ No newline at end of file
diff --git a/api/fronter.php b/api/fronter.php
deleted file mode 100644
index c41562f..0000000
--- a/api/fronter.php
+++ /dev/null
@@ -1,113 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn; global $isLowerLoggedIn;
-if (!$isLoggedIn || $isLowerLoggedIn) {
- header("Location: /-/login");
- die();
-}
-
-$system = $_GET['s'] ?? null;
-$member = $_GET['m'] ?? null;
-$index = (int)$_GET['i'] ?? null;
-$type = $_GET['t'] ?? null;
-$date = $_GET['d'] ?? null;
-
-if (!isset($system) || trim($system) === "" || strlen($system) !== 5 || !preg_match("/[a-z]/i", $system) || ($system !== "gdapd" && $system !== "ynmuc"))
- header("Location: /?error=System not found") and die();
-
-if (!isset($type) || trim($type) === "")
- header("Location: /?error=Type not found") and die();
-
-if (!isset($date) || trim($date) === "" || strlen($date) !== 10 || !preg_match("/[\d-]/i", $date))
- header("Location: /?error=Date not found") and die();
-
-$list = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/planner/$system.json"), true);
-
-function moveElement(&$array, $a, $b) {
- $out = array_splice($array, $a, 1);
- array_splice($array, $b, 0, $out);
-}
-
-switch ($type) {
- case "add":
- if (!isset($member) || trim($member) === "" || strlen($member) !== 5 || !preg_match("/[a-z]/i", $member))
- if ($member !== null && $member !== "null") header("Location: /?error=System member not found") and die();
-
- if (!isset($list[$date])) $list[$date] = [];
- $list[$date][] = [$member, null];
- break;
-
- case "cofront":
- if (!isset($index) || trim($index) === "" || is_integer($index))
- if ($index !== null && $index !== "null") header("Location: /?error=Invalid index") and die();
-
- $day = $list[$date];
-
- if (!isset($day[$index]))
- if ($index !== null && $index !== "null") header("Location: /?error=Index not found") and die();
-
- if (!isset($member) || trim($member) === "" || strlen($member) !== 5 || !preg_match("/[a-z]/i", $member))
- if ($member !== null && $member !== "null") header("Location: /?error=System member not found") and die();
-
- $list[$date][$index][1] = $member;
- break;
-
- case "delete":
- if (!isset($index) || trim($index) === "" || is_integer($index))
- if ($index !== null && $index !== "null") header("Location: /?error=Invalid index") and die();
-
- $day = $list[$date];
-
- if (!isset($day[$index]))
- if ($index !== null && $index !== "null") header("Location: /?error=Index not found") and die();
-
- unset($day[$index]);
- $list[$date] = array_values($day);
-
- break;
-
- case "codelete":
- if (!isset($index) || trim($index) === "" || is_integer($index))
- if ($index !== null && $index !== "null") header("Location: /?error=Invalid index") and die();
-
- $day = $list[$date];
-
- if (!isset($day[$index]))
- if ($index !== null && $index !== "null") header("Location: /?error=Index not found") and die();
-
- $list[$date][$index][1] = null;
-
- break;
-
- case "down":
- if (!isset($index) || trim($index) === "" || is_integer($index))
- if ($index !== null && $index !== "null") header("Location: /?error=Invalid index") and die();
-
- if (!isset($day[$index]))
- if ($index !== null && $index !== "null") header("Location: /?error=Index not found") and die();
-
- $day = $list[$date];
- moveElement($list[$date], $index, $index + 1 < count($list[$date]) ? $index + 1 : $index);
-
- break;
-
- case "up":
- if (!isset($index) || trim($index) === "" || is_integer($index))
- if ($index !== null && $index !== "null") header("Location: /?error=Invalid index") and die();
-
- if (!isset($day[$index]))
- if ($index !== null && $index !== "null") header("Location: /?error=Index not found") and die();
-
- $day = $list[$date];
- moveElement($list[$date], $index, $index - 1 > -1 ? $index - 1 : $index);
-
- break;
-
- default:
- header("Location: /?error=Invalid type name") and die();
- break;
-}
-
-file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/planner/$system.json", json_encode($list));
-
-die(); \ No newline at end of file
diff --git a/api/me-picture.php b/api/me-picture.php
deleted file mode 100644
index 3f0bce0..0000000
--- a/api/me-picture.php
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn;
-if (!$isLoggedIn) header("Location: /-/login") and die();
-global $_PROFILE;
-
-header("Content-Type: application/json");
-
-$fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($_PROFILE['name'] === "Cloudburst System" ? "ynmuc" : "gdapd") . "/fronters.json"), true);
-$member = $fronters["members"][0];
-
-if (isset($member["avatar_url"])) {
- $tempfile = "/tmp/avatar-" . rand(0, 999999) . ".jpg";
- file_put_contents($tempfile . "-original", file_get_contents($member["avatar_url"]));
- exec("convert -resize 256x256 -quality 50 \"" . $tempfile . "-original" . "\" \"" . $tempfile . "\"", $output);
-
- echo("data:image/jpg;base64," . base64_encode(file_get_contents($tempfile)));
- unlink($tempfile . "-original");
- unlink($tempfile);
-} else {
- die();
-} \ No newline at end of file
diff --git a/api/me.php b/api/me.php
deleted file mode 100644
index 385e662..0000000
--- a/api/me.php
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn;
-if (!$isLoggedIn) header("Location: /-/login") and die();
-global $_PROFILE;
-
-header("Content-Type: application/json");
-
-if ($_PROFILE['login'] === "raindrops") {
- die('{"name": "Raindrops System", "id": "raindrops", "pluralkit": "gdapd"}');
-} else {
- die('{"name": "Cloudburst System", "id": "cloudburst", "pluralkit": "ynmuc"}');
-}
diff --git a/api/pleasure-real.php b/api/pleasure-real.php
deleted file mode 100644
index 27f2fcf..0000000
--- a/api/pleasure-real.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn;
-if (!$isLoggedIn) header("Location: /-/login") and die();
-global $_PROFILE;
-
-$frontCloudburst = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/content.html"), true)["members"];
-$frontRaindrops = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/content.html"), true)["members"];
-
-if ($frontCloudburst[0]["id"] === "erknz" && $frontRaindrops[0]["id"] === "qbzxm") {
- if ($_PROFILE['login'] === "raindrops") $pony = "Cloudy"; else $pony = "Lavender";
-} else if ($frontCloudburst[0]["id"] === "zzise" && $frontRaindrops[0]["id"] === "tfbob") {
- if ($_PROFILE['login'] === "raindrops") $pony = "Violet"; else $pony = "Sky Dream";
-} else if ($frontCloudburst[0]["id"] === "vncoa" && $frontRaindrops[0]["id"] === "qraku") {
- if ($_PROFILE['login'] === "raindrops") $pony = "Starry"; else $pony = "Minty";
-} else {
- $pony = "somepony";
-}
-
-$ntfy = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true)["ntfy"];
-
-file_get_contents('https://' . $ntfy["server"] . '/' . $ntfy["topic"], false, stream_context_create([
- 'http' => [
- 'method' => 'POST',
- 'header' =>
- "Content-Type: text/plain\r\n" .
- "Title: 🏩 $pony wants to play for a bit\r\n" .
- "Priority: high\r\n" .
- "Tags: pleasure\r\n" .
- "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]),
- 'content' => "Hey, $pony wants to play and have fun for a bit, get up!"
- ]
-]));
-
-die(); \ No newline at end of file
diff --git a/api/pleasure.php b/api/pleasure.php
deleted file mode 100644
index 1a561df..0000000
--- a/api/pleasure.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn;
-if (!$isLoggedIn) header("Location: /-/login") and die();
-global $_PROFILE;
-
-$frontCloudburst = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/content.html"), true)["members"];
-$frontRaindrops = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/content.html"), true)["members"];
-
-if ($frontCloudburst[0]["id"] === "erknz" && $frontRaindrops[0]["id"] === "qbzxm") {
- if ($_PROFILE['login'] === "raindrops") $pony = "Cloudy"; else $pony = "Lavender";
-} else if ($frontCloudburst[0]["id"] === "zzise" && $frontRaindrops[0]["id"] === "tfbob") {
- if ($_PROFILE['login'] === "raindrops") $pony = "Violet"; else $pony = "Sky Dream";
-} else if ($frontCloudburst[0]["id"] === "vncoa" && $frontRaindrops[0]["id"] === "qraku") {
- if ($_PROFILE['login'] === "raindrops") $pony = "Starry"; else $pony = "Minty";
-} else {
- $pony = "somepony";
-}
-
-$ntfy = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true)["ntfy"];
-
-file_get_contents('https://' . $ntfy["server"] . '/' . $ntfy["topic"], false, stream_context_create([
- 'http' => [
- 'method' => 'POST',
- 'header' =>
- "Content-Type: text/plain\r\n" .
- "Title: [Test] 🏩 $pony wants to play for a bit\r\n" .
- "Priority: high\r\n" .
- "Tags: pleasure\r\n" .
- "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]),
- 'content' => "[This notification is test] Hey, $pony wants to play and have fun for a bit, get up! [This notification is test]"
- ]
-]));
-
-die(); \ No newline at end of file
diff --git a/api/pluralkit-integration.php b/api/pluralkit-integration.php
deleted file mode 100644
index 0793873..0000000
--- a/api/pluralkit-integration.php
+++ /dev/null
@@ -1,176 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/agewarning.inc";
-
-$app = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true);
-$user = $_GET['user'] ?? null;
-$inputJSON = file_get_contents('php://input');
-$input = json_decode($inputJSON, true);
-$data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true)["webhook"];
-
-if (isset(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true)["ponytown"][$user])) {
- $ponytown = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true)["ponytown"][$user];
-} else {
- header("HTTP/1.1 404 Not Found") and die();
-}
-
-if ($user === null) {
- header("HTTP/1.1 500 Internal Server Error") and die();
-}
-
-if (!in_array($user, array_keys($data))) {
- header("HTTP/1.1 404 Not Found") and die();
-}
-
-if ($input["signing_token"] !== $data[$user]) {
- header("HTTP/1.1 401 Unauthorized") and die();
-}
-
-if ($input['system_id'] === "7d9f543e-f742-40f6-9d07-86c3f2983124") {
- $system = "gdapd";
- $name = "Raindrops System";
-} elseif ($input['system_id'] === "ade46823-206b-4b0c-ad3c-caae934a5f3b") {
- $system = "ynmuc";
- $name = "Cloudburst System";
-} elseif (isset($app["other"]) && $input["system_id"] === $app["other"]["uuid"]) {
- $system = $app["other"]["id"];
- $name = $app["other"]["name"];
-} else {
- die();
-}
-
-$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") {
- if ($system === $app["other"]["id"]) {
- file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/fronters.json", file_get_contents("https://pluralkit.equestria.dev/v2/systems/$input[system_id]/fronters"), false, stream_context_create([
- 'http' => [
- 'method' => 'GET',
- 'header' =>
- "Authorization: " . $app["other"]["token"] . "\r\n"
- ]
- ]));
- file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/switches.json", file_get_contents("https://pluralkit.equestria.dev/v2/systems/$input[system_id]/switches"), false, stream_context_create([
- 'http' => [
- 'method' => 'GET',
- 'header' =>
- "Authorization: " . $app["other"]["token"] . "\r\n"
- ]
- ]));
- } else {
- 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"));
- }
-
- $fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/fronters.json"), true);
- $currentFronter = $fronters["members"][0]["id"];
- file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/last.json", json_encode($currentFronter));
-
- $ntfy = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true)["ntfy"];
-
- if (count($fronters["members"]) > 0 && ($system !== $app["other"]["id"] || !isset($app["other"]))) {
- 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 ($system !== $app["other"]["id"] || !isset($app["other"])) {
- if (count($fronters["members"]) > 1) {
- $context = stream_context_create([
- 'http' => [
- 'method' => 'POST',
- 'header' =>
- "Content-Type: text/plain\r\n" .
- "Title: 🐴 Switch occurred in the $name\r\n" .
- "Priority: default\r\n" .
- "Tags: switch\r\n" .
- "Actions: view, Open " . $fronters["members"][0]["display_name"] . " on Cold Haze, https://ponies.equestria.horse/" . $fronters["members"][0]["name"] . "/, clear=true;view, Open " . $fronters["members"][1]["display_name"] . " on Cold Haze, https://ponies.equestria.horse/" . $fronters["members"][1]["name"] . "/, clear=true\r\n" .
- "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]),
- 'content' => ($fronters["members"][0]["display_name"] ?? $fronters["members"][0]["name"]) . " and " . ($fronters["members"][1]["display_name"] ?? $fronters["members"][1]["name"]) . " switched in just now"
- ]
- ]);
- } else if (count($fronters["members"]) > 0) {
- $context = stream_context_create([
- 'http' => [
- 'method' => 'POST',
- 'header' =>
- "Content-Type: text/plain\r\n" .
- "Title: 🐴 Switch occurred in the $name\r\n" .
- "Priority: default\r\n" .
- "Tags: switch\r\n" .
- "Actions: view, Open on Cold Haze, https://ponies.equestria.horse/" . $fronters["members"][0]["name"] . "/, clear=true\r\n" .
- "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]),
- 'content' => ($fronters["members"][0]["display_name"] ?? $fronters["members"][0]["name"]) . " switched in just now"
- ]
- ]);
- } else {
- $context = stream_context_create([
- 'http' => [
- 'method' => 'POST',
- 'header' =>
- "Content-Type: text/plain\r\n" .
- "Title: 🐴 Switch occurred in the $name\r\n" .
- "Priority: default\r\n" .
- "Tags: switch\r\n" .
- "Actions: view, Open on Cold Haze, https://ponies.equestria.horse/, clear=true\r\n" .
- "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]),
- 'content' => "The fallback pony switched in just now"
- ]
- ]);
- }
-
- file_get_contents('https://' . $ntfy["server"] . '/public-switches', false, $context);
- }
-
- if ($system === "gdapd") {
- $topic = "public-switches-raindrops";
-
- if (count($fronters["members"]) > 0) {
- file_get_contents('https://' . $ntfy["server"] . '/public-switches-fr', false, stream_context_create([
- 'http' => [
- 'method' => 'POST',
- 'header' =>
- "Content-Type: text/plain\r\n" .
- "Title: 🐴 $name vient de switch\r\n" .
- "Priority: default\r\n" .
- "Tags: switch\r\n" .
- "Actions: view, Voir sur Cold Haze, https://fr.equestria.horse/" . $fronters["members"][0]["name"] . "/, clear=true\r\n" .
- "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]),
- 'content' => ($fronters["members"][0]["display_name"] ?? $fronters["members"][0]["name"]) . " est désormais au front"
- ]
- ]));
- } else {
- file_get_contents('https://' . $ntfy["server"] . '/public-switches-fr', false, stream_context_create([
- 'http' => [
- 'method' => 'POST',
- 'header' =>
- "Content-Type: text/plain\r\n" .
- "Title: 🐴 $name vient de switch\r\n" .
- "Priority: default\r\n" .
- "Tags: switch\r\n" .
- "Actions: view, Voir sur Cold Haze, https://fr.equestria.horse/, clear=true\r\n" .
- "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]),
- 'content' => "Le poney de trait est désormais au front"
- ]
- ]));
- }
- } else if ($system === "ynmuc") {
- $topic = "public-switches-cloudburst";
- } else {
- $topic = "main";
- }
-
- file_get_contents('https://' . $ntfy["server"] . '/' . $topic, false, $context);
-} \ No newline at end of file
diff --git a/api/raindrops-banners.php b/api/raindrops-banners.php
deleted file mode 100644
index 97fc954..0000000
--- a/api/raindrops-banners.php
+++ /dev/null
@@ -1,19 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn;
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/bitset.inc";
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/banner.inc";
-if (!$isLoggedIn) header("Location: /-/login") and die();
-
-$data = [];
-
-foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true) as $member) {
- if ($member['name'] === "unknown") continue;
- if ($member['name'] === "fusion") continue;
- if ($member['name'] === "new") continue;
-
- $data[$member['name']] = getMemberBannerData($member['id'], "gdapd");
-}
-
-header("Content-Type: application/json");
-die(json_encode($data, JSON_PRETTY_PRINT)); \ No newline at end of file
diff --git a/api/raindrops-data.php b/api/raindrops-data.php
deleted file mode 100644
index 492f561..0000000
--- a/api/raindrops-data.php
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn;
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/bitset.inc";
-if (!$isLoggedIn) header("Location: /-/login") and die();
-
-$data = [];
-$data["members"] = [];
-
-foreach (array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data"), function ($i) { return !str_starts_with($i, "."); }) as $file) {
- if (str_starts_with($file, "gdapd-") && !(str_ends_with($file, "/members.json") || str_ends_with($file, "/fronters.json") || str_ends_with($file, "/general.json") || str_ends_with($file, "/switches.json"))) {
- $name = substr(explode(".", $file)[0], 6);
- $parts = explode("-", $name);
-
- if (explode(".", $file)[1] === "json") {
- if (strlen($parts[0]) === 5) {
- if (!isset($data["members"][$parts[0]])) $data["members"][$parts[0]] = [
- "metadata" => null,
- "content" => null
- ];
- if ($parts[1] === "metadata") {
- $data["members"][$parts[0]][$parts[1]] = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $file), true));
- } else {
- $data["members"][$parts[0]][$parts[1]] = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $file), true);
- }
- } else {
- $data[$name] = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $file), true);
- }
- } else {
- if (strlen($parts[0]) === 5) {
- if (!isset($data["members"][$parts[0]])) $data["members"][$parts[0]] = [
- "metadata" => null,
- "content" => null
- ];
- $data["members"][$parts[0]][$parts[1]] = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $file);
- } else {
- $data[$name] = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $file);
- }
- }
- }
-}
-
-header("Content-Type: application/json");
-die(json_encode($data, JSON_PRETTY_PRINT)); \ No newline at end of file
diff --git a/api/raindrops-img-round.php b/api/raindrops-img-round.php
deleted file mode 100644
index f733cc8..0000000
--- a/api/raindrops-img-round.php
+++ /dev/null
@@ -1,94 +0,0 @@
-<?php
-
-$fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/fronters.json"), true);
-
-$url = isset($fronters['members'][0]) ? ($fronters['members'][0]["avatar_url"] ?? "/assets/uploads/raindrops.png") : "/assets/uploads/raindrops.png";
-file_put_contents("/tmp/temp", file_get_contents($url));
-
-function imageCreateCorners($sourceImageFile, $radius) {
- # test source image
- if (file_exists($sourceImageFile)) {
- $res = is_array($info = getimagesize($sourceImageFile));
- }
- else $res = false;
-
- # open image
- if ($res) {
- $w = $info[0];
- $h = $info[1];
- switch ($info['mime']) {
- case 'image/jpeg': $src = imagecreatefromjpeg($sourceImageFile);
- break;
- case 'image/gif': $src = imagecreatefromgif($sourceImageFile);
- break;
- case 'image/png': $src = imagecreatefrompng($sourceImageFile);
- break;
- default:
- $res = false;
- }
- }
-
- # create corners
- if ($res) {
-
- $q = 10; # change this if you want
- $radius *= $q;
-
- # find unique color
- do {
- $r = rand(0, 255);
- $g = rand(0, 255);
- $b = rand(0, 255);
- }
- while (imagecolorexact($src, $r, $g, $b) < 0);
-
- $nw = $w*$q;
- $nh = $h*$q;
-
- $img = imagecreatetruecolor($nw, $nh);
- $alphacolor = imagecolorallocatealpha($img, $r, $g, $b, 127);
- imagealphablending($img, false);
- imagesavealpha($img, true);
- imagefilledrectangle($img, 0, 0, $nw, $nh, $alphacolor);
-
- imagefill($img, 0, 0, $alphacolor);
- imagecopyresampled($img, $src, 0, 0, 0, 0, $nw, $nh, $w, $h);
-
- imagearc($img, $radius-1, $radius-1, $radius*2, $radius*2, 180, 270, $alphacolor);
- imagefilltoborder($img, 0, 0, $alphacolor, $alphacolor);
- imagearc($img, $nw-$radius, $radius-1, $radius*2, $radius*2, 270, 0, $alphacolor);
- imagefilltoborder($img, $nw-1, 0, $alphacolor, $alphacolor);
- imagearc($img, $radius-1, $nh-$radius, $radius*2, $radius*2, 90, 180, $alphacolor);
- imagefilltoborder($img, 0, $nh-1, $alphacolor, $alphacolor);
- imagearc($img, $nw-$radius, $nh-$radius, $radius*2, $radius*2, 0, 90, $alphacolor);
- imagefilltoborder($img, $nw-1, $nh-1, $alphacolor, $alphacolor);
- imagealphablending($img, true);
- imagecolortransparent($img, $alphacolor);
-
- # resize image down
- $dest = imagecreatetruecolor($w, $h);
- imagealphablending($dest, false);
- imagesavealpha($dest, true);
- imagefilledrectangle($dest, 0, 0, $w, $h, $alphacolor);
- imagecopyresampled($dest, $img, 0, 0, 0, 0, $w, $h, $nw, $nh);
-
- # output image
- $res = $dest;
- imagedestroy($src);
- imagedestroy($img);
- }
-
- return $res;
-}
-
-header("Content-Type: image/png");
-
-$id = bin2hex(random_bytes(8));
-exec('convert -size 128x128 xc:none -draw "roundrectangle 0,0,128,128,128,128" /tmp/' . $id . '-mask.png', $out);
-
-exec('convert -resize 128x128 "/tmp/temp" /tmp/' . $id . '-source.png');
-exec('convert /tmp/' . $id . '-source.png -matte /tmp/' . $id . '-mask.png -compose DstIn -composite /tmp/' . $id . '.png', $out2);
-
-unlink("/tmp/temp");
-
-echo(file_get_contents('/tmp/' . $id . '.png')); \ No newline at end of file
diff --git a/api/raindrops-img.php b/api/raindrops-img.php
deleted file mode 100644
index 4cbac6b..0000000
--- a/api/raindrops-img.php
+++ /dev/null
@@ -1,11 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.inc";
-$fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/fronters.json"), true);
-
-$url = isset($fronters['members'][0]) ? ($fronters['members'][0]["avatar_url"] ? $_SERVER['DOCUMENT_ROOT'] . getAsset("gdapd", $fronters['members'][0]["id"]) : $_SERVER['DOCUMENT_ROOT'] . "/uploads/raindrops.png") : $_SERVER['DOCUMENT_ROOT'] . "/uploads/raindrops.png";
-file_put_contents("/tmp/temp", file_get_contents($url));
-header("Content-Type: " . mime_content_type("/tmp/temp"));
-unlink("/tmp/temp");
-
-echo(file_get_contents($url)); \ No newline at end of file
diff --git a/api/raindrops-img2-round.php b/api/raindrops-img2-round.php
deleted file mode 100644
index 8ca6c81..0000000
--- a/api/raindrops-img2-round.php
+++ /dev/null
@@ -1,94 +0,0 @@
-<?php
-
-$fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/fronters.json"), true);
-
-$url = isset($fronters['members'][1]) ? ($fronters['members'][1]["avatar_url"] ?? "/assets/uploads/raindrops.png") : "/assets/uploads/raindrops.png";
-file_put_contents("/tmp/temp", file_get_contents($url));
-
-function imageCreateCorners($sourceImageFile, $radius) {
- # test source image
- if (file_exists($sourceImageFile)) {
- $res = is_array($info = getimagesize($sourceImageFile));
- }
- else $res = false;
-
- # open image
- if ($res) {
- $w = $info[0];
- $h = $info[1];
- switch ($info['mime']) {
- case 'image/jpeg': $src = imagecreatefromjpeg($sourceImageFile);
- break;
- case 'image/gif': $src = imagecreatefromgif($sourceImageFile);
- break;
- case 'image/png': $src = imagecreatefrompng($sourceImageFile);
- break;
- default:
- $res = false;
- }
- }
-
- # create corners
- if ($res) {
-
- $q = 10; # change this if you want
- $radius *= $q;
-
- # find unique color
- do {
- $r = rand(0, 255);
- $g = rand(0, 255);
- $b = rand(0, 255);
- }
- while (imagecolorexact($src, $r, $g, $b) < 0);
-
- $nw = $w*$q;
- $nh = $h*$q;
-
- $img = imagecreatetruecolor($nw, $nh);
- $alphacolor = imagecolorallocatealpha($img, $r, $g, $b, 127);
- imagealphablending($img, false);
- imagesavealpha($img, true);
- imagefilledrectangle($img, 0, 0, $nw, $nh, $alphacolor);
-
- imagefill($img, 0, 0, $alphacolor);
- imagecopyresampled($img, $src, 0, 0, 0, 0, $nw, $nh, $w, $h);
-
- imagearc($img, $radius-1, $radius-1, $radius*2, $radius*2, 180, 270, $alphacolor);
- imagefilltoborder($img, 0, 0, $alphacolor, $alphacolor);
- imagearc($img, $nw-$radius, $radius-1, $radius*2, $radius*2, 270, 0, $alphacolor);
- imagefilltoborder($img, $nw-1, 0, $alphacolor, $alphacolor);
- imagearc($img, $radius-1, $nh-$radius, $radius*2, $radius*2, 90, 180, $alphacolor);
- imagefilltoborder($img, 0, $nh-1, $alphacolor, $alphacolor);
- imagearc($img, $nw-$radius, $nh-$radius, $radius*2, $radius*2, 0, 90, $alphacolor);
- imagefilltoborder($img, $nw-1, $nh-1, $alphacolor, $alphacolor);
- imagealphablending($img, true);
- imagecolortransparent($img, $alphacolor);
-
- # resize image down
- $dest = imagecreatetruecolor($w, $h);
- imagealphablending($dest, false);
- imagesavealpha($dest, true);
- imagefilledrectangle($dest, 0, 0, $w, $h, $alphacolor);
- imagecopyresampled($dest, $img, 0, 0, 0, 0, $w, $h, $nw, $nh);
-
- # output image
- $res = $dest;
- imagedestroy($src);
- imagedestroy($img);
- }
-
- return $res;
-}
-
-header("Content-Type: image/png");
-
-$id = bin2hex(random_bytes(8));
-exec('convert -size 128x128 xc:none -draw "roundrectangle 0,0,128,128,128,128" /tmp/' . $id . '-mask.png', $out);
-
-exec('convert -resize 128x128 "/tmp/temp" /tmp/' . $id . '-source.png');
-exec('convert /tmp/' . $id . '-source.png -matte /tmp/' . $id . '-mask.png -compose DstIn -composite /tmp/' . $id . '.png', $out2);
-
-unlink("/tmp/temp");
-
-echo(file_get_contents('/tmp/' . $id . '.png')); \ No newline at end of file
diff --git a/api/raindrops-scored.php b/api/raindrops-scored.php
deleted file mode 100644
index 75da62a..0000000
--- a/api/raindrops-scored.php
+++ /dev/null
@@ -1,9 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn;
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/score.inc";
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/bitset.inc";
-if (!$isLoggedIn) header("Location: /-/login") and die();
-
-header("Content-Type: application/json");
-die(json_encode(array_values(scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true), "gdapd")), JSON_PRETTY_PRINT)); \ No newline at end of file
diff --git a/api/raindrops-two.php b/api/raindrops-two.php
deleted file mode 100644
index 2fa09f2..0000000
--- a/api/raindrops-two.php
+++ /dev/null
@@ -1,8 +0,0 @@
-<?php
-
-header("Content-Type: text/plain");
-
-$fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/fronters.json"), true);
-echo(json_encode([
- "multiple" => count($fronters["members"]) > 1
-])); \ No newline at end of file
diff --git a/api/raindrops.php b/api/raindrops.php
deleted file mode 100644
index c44faa6..0000000
--- a/api/raindrops.php
+++ /dev/null
@@ -1,6 +0,0 @@
-<?php
-
-header("Content-Type: text/plain");
-
-$fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/fronters.json"), true);
-echo($fronters['members'][0]['display_name'] ?? $fronters['members'][0]['name']); \ No newline at end of file
diff --git a/api/save-private.php b/api/save-private.php
deleted file mode 100644
index a7430ad..0000000
--- a/api/save-private.php
+++ /dev/null
@@ -1,43 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn;
-if (!$isLoggedIn) header("Location: /-/login") and die();
-
-$request_raw = file_get_contents('php://input');
-$json_object = json_decode($request_raw, true);
-
-$system = $_GET['system'] ?? null;
-$member = $_GET['member'] ?? null;
-$subsystem = $_GET['subsystem'] ?? null;
-$content = $json_object['content'] ?? null;
-
-if (!isset($system) || trim($system) === "" || strlen($system) !== 5 || !preg_match("/[a-z]/i", $system))
- header("Location: /?error=System not found") and die();
-
-if (!isset($member) || trim($member) === "" || strlen($member) !== 5 || !preg_match("/[a-z]/i", $member))
- if ($member !== null && $member !== "null") header("Location: /?error=System member not found") and die();
-
-if (!isset($subsystem) || trim($subsystem) === "" || !preg_match("/[a-z\d]/i", $subsystem))
- if ($subsystem !== null && $subsystem !== "null") header("Location: /?error=Subsystem not found") and die();
-
-if (!isset($content))
- header("Location: /?error=No content") and die();
-
-if ($member !== null && $member !== "null") {
- $file = $_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/" . $member . "-private.html";
-} else {
- if ($subsystem !== null && $subsystem !== "null") {
- $file = $_SERVER['DOCUMENT_ROOT'] . "/includes/data/subsystems/" . $system . "-" . $subsystem . ".html";
- } else {
- $file = $_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/" . $system . ".html";
- }
-}
-
-if (trim($content) === "") {
- if (file_exists($file)) {
- unlink($file);
- }
- die();
-}
-
-file_put_contents($file, $content); \ No newline at end of file
diff --git a/api/save.php b/api/save.php
deleted file mode 100644
index 864f86e..0000000
--- a/api/save.php
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn; global $isLowerLoggedIn; global $app;
-if (!$isLoggedIn && !$isLowerLoggedIn) header("Location: /-/login") and die();
-
-$request_raw = file_get_contents('php://input');
-$json_object = json_decode($request_raw, true);
-
-$system = $_GET['system'] ?? null;
-$member = $_GET['member'] ?? null;
-$subsystem = $_GET['subsystem'] ?? null;
-$content = $json_object['content'] ?? null;
-
-if (!isset($system) || trim($system) === "" || strlen($system) !== 5 || !preg_match("/[a-z]/i", $system))
- header("Location: /?error=System not found") and die();
-
-if (!isset($member) || trim($member) === "" || strlen($member) !== 5 || !preg_match("/[a-z]/i", $member))
- if ($member !== null && $member !== "null") header("Location: /?error=System member not found") and die();
-
-if (!isset($subsystem) || trim($subsystem) === "" || !preg_match("/[a-z\d]/i", $subsystem))
- if ($subsystem !== null && $subsystem !== "null") header("Location: /?error=Subsystem not found") and die();
-
-if ($isLowerLoggedIn && $system !== $app["other"]["id"]) die();
-
-if (!isset($content))
- header("Location: /?error=No content") and die();
-
-if ($member !== null && $member !== "null") {
- $file = $_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/" . $member . ".html";
-} else {
- if ($subsystem !== null && $subsystem !== "null") {
- $file = $_SERVER['DOCUMENT_ROOT'] . "/includes/data/subsystems/" . $system . "-" . $subsystem . ".html";
- } else {
- $file = $_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $system . "/content.html";
- }
-}
-
-if (trim($content) === "") {
- if (file_exists($file)) {
- unlink($file);
- }
- die();
-}
-
-file_put_contents($file, $content); \ No newline at end of file
diff --git a/api/session.php b/api/session.php
deleted file mode 100644
index 55d2fd3..0000000
--- a/api/session.php
+++ /dev/null
@@ -1,6 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn;
-
-header("Content-Type: text/plain");
-die($isLoggedIn ? "VALID" : "ERROR"); \ No newline at end of file
diff --git a/api/test.php b/api/test.php
deleted file mode 100644
index 627c0e1..0000000
--- a/api/test.php
+++ /dev/null
@@ -1,4 +0,0 @@
-<?php
-
-header("Content-Type: text/plain");
-die("SUCCESS"); \ No newline at end of file
diff --git a/api/test1.php b/api/test1.php
deleted file mode 100644
index a8c9c97..0000000
--- a/api/test1.php
+++ /dev/null
@@ -1,5 +0,0 @@
-<?php
-
-die();
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/agewarning.inc";
-showWarning("Zoom Zephyrwing", "zoomzephyrwing", "gdapd"); \ No newline at end of file
diff --git a/api/token.php b/api/token.php
deleted file mode 100644
index 99b9158..0000000
--- a/api/token.php
+++ /dev/null
@@ -1,7 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn;
-if (!$isLoggedIn) header("Location: /-/login") and die();
-
-header("Content-Type: text/plain");
-die($_COOKIE['PEH2_SESSION_TOKEN']); \ No newline at end of file
diff --git a/api/video.php b/api/video.php
deleted file mode 100644
index 21af642..0000000
--- a/api/video.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn;
-if (!$isLoggedIn) header("Location: /-/login") and die();
-
-if (isset($_GET['id'])) {
- header("Content-Type: application/json");
- $data = json_decode(exec("yt-dlp -q -x --no-playlist --skip-download --dump-json \"https://www.youtube.com/watch?v=" . str_replace('"', '\'', $_GET['id']) . "\""), true);
- $qualities = array_values(array_filter(array_map(function ($i) {
- return [
- "quality" => $i["height"],
- "id" => $i['format_id']
- ];
- }, $data["formats"]), function ($i) {
- return !is_null($i["quality"]);
- }));
- $hd = array_values(array_filter($qualities, function ($i) {
- return $i["quality"] >= 720;
- }));
- $selected = count($hd) > 0 ? $hd[0] : $qualities[count($qualities) - 1];
- $stream = array_values(array_filter($data["formats"], function ($i) use ($selected) {
- return $i["height"] === $selected["quality"] && $i["acodec"] !== null && $i["acodec"] !== "none";
- }))[0];
-
- echo(json_encode([
- "title" => $data["fulltitle"],
- "author" => $data["channel"],
- "duration" => $data["duration"],
- "stream" => $selected,
- "url" => $stream["url"],
- "duration_pretty" => $data["duration_string"],
- "poster" => $data["thumbnail"],
- ], JSON_PRETTY_PRINT));
-} \ No newline at end of file
diff --git a/api/wakeup-real.php b/api/wakeup-real.php
deleted file mode 100644
index 2267a4e..0000000
--- a/api/wakeup-real.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn;
-if (!$isLoggedIn) header("Location: /-/login") and die();
-global $_PROFILE;
-
-$frontCloudburst = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/fronters.json"), true)["members"];
-$frontRaindrops = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/fronters.json"), true)["members"];
-
-$pony = "somepony";
-if ($_PROFILE['login'] === "raindrops") $pony = $frontRaindrops[0]["display_name"]; else $pony = $frontCloudburst[0]["display_name"];
-
-$ntfy = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true)["ntfy"];
-
-file_get_contents('https://' . $ntfy["server"] . '/' . $ntfy["topic"], false, stream_context_create([
- 'http' => [
- 'method' => 'POST',
- 'header' =>
- "Content-Type: text/plain\r\n" .
- "Title: 🥱 Wake up!\r\n" .
- "Priority: high\r\n" .
- "Tags: wakeup\r\n" .
- "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]),
- 'content' => "Hey, $pony wants you to wake up!"
- ]
-]));
-
-die(); \ No newline at end of file
diff --git a/api/wakeup.php b/api/wakeup.php
deleted file mode 100644
index 69b0a68..0000000
--- a/api/wakeup.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn;
-if (!$isLoggedIn) header("Location: /-/login") and die();
-global $_PROFILE;
-
-$frontCloudburst = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/fronters.json"), true)["members"];
-$frontRaindrops = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/fronters.json"), true)["members"];
-
-$pony = "somepony";
-if ($_PROFILE['login'] === "raindrops") $pony = $frontRaindrops[0]["display_name"]; else $pony = $frontCloudburst[0]["display_name"];
-
-$ntfy = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true)["ntfy"];
-
-file_get_contents('https://' . $ntfy["server"] . '/' . $ntfy["topic"], false, stream_context_create([
- 'http' => [
- 'method' => 'POST',
- 'header' =>
- "Content-Type: text/plain\r\n" .
- "Title: [Test] 🥱 Wake up!\r\n" .
- "Priority: high\r\n" .
- "Tags: wakeup\r\n" .
- "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]),
- 'content' => "[This notification is test] Hey, $pony wants you to wake up! [This notification is test]"
- ]
-]));
-
-die(); \ No newline at end of file