summaryrefslogtreecommitdiff
path: root/pages/api/badger.php
diff options
context:
space:
mode:
authorRaindropsSys <raindrops@equestria.dev>2024-03-29 22:05:35 +0100
committerRaindropsSys <raindrops@equestria.dev>2024-03-29 22:05:35 +0100
commit5860551daa0f60103ad24e93da29f401a653f144 (patch)
tree9ad97e04152a6edc11d5096c87880978df39086a /pages/api/badger.php
parenta51979ad60074db84af78a06d30fcb888ccb0b03 (diff)
downloadpluralconnect-5860551daa0f60103ad24e93da29f401a653f144.tar.gz
pluralconnect-5860551daa0f60103ad24e93da29f401a653f144.tar.bz2
pluralconnect-5860551daa0f60103ad24e93da29f401a653f144.zip
Updated 20 files, added 6 files, deleted 144 files and renamed .idea/ponycule.iml (automated)
Diffstat (limited to 'pages/api/badger.php')
-rw-r--r--pages/api/badger.php52
1 files changed, 0 insertions, 52 deletions
diff --git a/pages/api/badger.php b/pages/api/badger.php
deleted file mode 100644
index d54e69f..0000000
--- a/pages/api/badger.php
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc";
-
-global $isLoggedIn; global $isLowerLoggedIn;
-$isLoggedIn = false; $isLowerLoggedIn = false;
-
-$list = scoreOrderGlobal();
-
-function getAge($metadata) {
- if (!isset($metadata["birth"]["year"]) || $metadata["birth"]["age"] > 0) {
- if ($metadata["birth"]["age"] === -1) {
- $age = " - Eternal";
- } elseif ($metadata["birth"]["age"] <= 0) {
- $age = "";
- } else {
- $age = " - " . ($metadata["birth"]["age"]);
- }
- } else {
- if ($metadata["birth"]["year"] <= 1900) {
- $age = "";
- } else {
- $age = " - " . ((int)date('Y') - $metadata["birth"]["year"] + (strtotime(date('Y') . "-" . $metadata["birth"]["date"]) <= time() ? 0 : -1));
- }
- }
-
- return $age;
-}
-
-header("Content-Type: application/json");
-die(json_encode(array_map(function ($i) {
- return [
- "id" => $i["id"],
- "name" => $i["display_name"] ?? $i["name"],
- "system" => $i["system"],
- "pronouns" => $i["pronouns"],
- "species" => match ($i["_metadata"]["species"][0]) {
- "earth" => $i["_metadata"]["robot"] ? "Robot earth pony" : (!$i["_metadata"]["plush"] ? "Earth pony" : "Earth pony plush"),
- "alicorn" => $i["_metadata"]["robot"] ? "Robot alicorn" : (!$i["_metadata"]["plush"] ? "Alicorn" : "Alicorn plush"),
- "crystal" => $i["_metadata"]["robot"] ? "Robot crystal pony" : (!$i["_metadata"]["plush"] ? "Crystal pony" : "Crystal pony plush"),
- "pegasus" => $i["_metadata"]["robot"] ? "Robot pegasus" : (!$i["_metadata"]["plush"] ? "Pegasus" : "Pegasus plush"),
- "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",
- "human" => "Human",
- "merpony" => "Merpony",
- default => $i["_metadata"]["species"][0] . "_" . $i["_metadata"]["robot"]
- },
- "age" => getAge($i["_metadata"]),
- "avatar" => "https://ponycule.p.equestria.dev" . getAsset($i["system"], $i["id"], "heads")
- ];
-}, $list), JSON_PRETTY_PRINT)); \ No newline at end of file