From 29928887e733f3bc2c2baaf06dafd495a006753b Mon Sep 17 00:00:00 2001 From: Minteck Date: Fri, 3 Mar 2023 07:04:02 +0100 Subject: Updated 18 files and added 10 files (automated) --- .gitignore | 8 +- assets/editor/ponytown/step1.png | Bin 0 -> 3093 bytes assets/editor/ponytown/step2.png | Bin 0 -> 7770 bytes assets/editor/ponytown/step2b.png | Bin 0 -> 3098 bytes assets/editor/ponytown/step3.png | Bin 0 -> 2911 bytes assets/editor/ponytown/step4.png | Bin 0 -> 2318 bytes assets/editor/ponytown/step4b.png | Bin 0 -> 33531 bytes assets/editor/ponytown/step5.png | Bin 0 -> 3709 bytes assets/editor/ponytown/step9.png | Bin 0 -> 35735 bytes assets/logo/banner.js | 32 ++--- assets/logo/custom.css | 4 + assets/uploads/pt-scootaloo.png | Bin 4147 -> 613 bytes includes/assets.inc | 8 +- includes/external/school/index.js | 2 +- includes/functions.inc | 26 ++-- includes/homepage.inc | 12 +- includes/member.inc | 4 +- includes/pages.json | 10 ++ includes/sysbanner.inc | 32 ----- includes/titlebar.inc | 2 +- includes/travelling.inc | 33 ++--- pages/api/ponytown.php | 117 +++++++++++++++++ pages/docs.inc | 2 +- pages/home.old.inc | 12 -- pages/money.inc | 55 +++++++- pages/ponytown.inc | 258 ++++++++++++++++++++++++++++++++++++++ pages/rules.inc | 2 +- pages/stats.inc | 3 - 28 files changed, 510 insertions(+), 112 deletions(-) create mode 100644 assets/editor/ponytown/step1.png create mode 100644 assets/editor/ponytown/step2.png create mode 100644 assets/editor/ponytown/step2b.png create mode 100644 assets/editor/ponytown/step3.png create mode 100644 assets/editor/ponytown/step4.png create mode 100644 assets/editor/ponytown/step4b.png create mode 100644 assets/editor/ponytown/step5.png create mode 100644 assets/editor/ponytown/step9.png create mode 100644 pages/api/ponytown.php create mode 100644 pages/ponytown.inc diff --git a/.gitignore b/.gitignore index ecc9c95..72fe9ef 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,10 @@ assets/banners assets/bodies assets/heads assets/ponies -assets/uploads \ No newline at end of file +assets/uploads +includes/external/discord/*.js +includes/external/discord/*.js.map +includes/external/discord/**.js +includes/external/discord/**.js.map +includes/external/discord/**/*.js +includes/external/discord/**/*.js.map \ No newline at end of file diff --git a/assets/editor/ponytown/step1.png b/assets/editor/ponytown/step1.png new file mode 100644 index 0000000..ad99540 Binary files /dev/null and b/assets/editor/ponytown/step1.png differ diff --git a/assets/editor/ponytown/step2.png b/assets/editor/ponytown/step2.png new file mode 100644 index 0000000..baad7c9 Binary files /dev/null and b/assets/editor/ponytown/step2.png differ diff --git a/assets/editor/ponytown/step2b.png b/assets/editor/ponytown/step2b.png new file mode 100644 index 0000000..64d8eca Binary files /dev/null and b/assets/editor/ponytown/step2b.png differ diff --git a/assets/editor/ponytown/step3.png b/assets/editor/ponytown/step3.png new file mode 100644 index 0000000..0daab07 Binary files /dev/null and b/assets/editor/ponytown/step3.png differ diff --git a/assets/editor/ponytown/step4.png b/assets/editor/ponytown/step4.png new file mode 100644 index 0000000..188c4d5 Binary files /dev/null and b/assets/editor/ponytown/step4.png differ diff --git a/assets/editor/ponytown/step4b.png b/assets/editor/ponytown/step4b.png new file mode 100644 index 0000000..341995d Binary files /dev/null and b/assets/editor/ponytown/step4b.png differ diff --git a/assets/editor/ponytown/step5.png b/assets/editor/ponytown/step5.png new file mode 100644 index 0000000..203c3f5 Binary files /dev/null and b/assets/editor/ponytown/step5.png differ diff --git a/assets/editor/ponytown/step9.png b/assets/editor/ponytown/step9.png new file mode 100644 index 0000000..d3134ee Binary files /dev/null and b/assets/editor/ponytown/step9.png differ diff --git a/assets/logo/banner.js b/assets/logo/banner.js index 38a88aa..3f41912 100644 --- a/assets/logo/banner.js +++ b/assets/logo/banner.js @@ -6,11 +6,7 @@ function timeAgo(time) { time = new Date(time).getTime(); } - let periods = ["sec.", "mn.", "hr.", "d.", "wk.", "mo.", "y.", "ages"]; - - if (bannerFrench) { - periods = ["sec.", "min.", "h.", "j.", "sem.", "mois", "an.", "des années"]; - } + let periods = ["sec", "min", "hr", "d", "wk", "mo", "y", "ages"]; let lengths = ["60", "60", "24", "7", "4.35", "12", "100"]; @@ -20,22 +16,12 @@ function timeAgo(time) { let tense; let period; - if (bannerFrench) { - if (difference <= 10 && difference >= 0) { - return "à l'instant"; - } else if (difference > 0) { - tense = "il y a"; - } else { - tense = "dans"; - } + if (difference <= 10 && difference >= 0) { + return "now"; + } else if (difference > 0) { + tense = "ago"; } else { - if (difference <= 10 && difference >= 0) { - return "now"; - } else if (difference > 0) { - tense = "ago"; - } else { - tense = "later"; - } + tense = "later"; } let j; @@ -48,11 +34,7 @@ function timeAgo(time) { period = periods[j]; - if (bannerFrench) { - return `${tense} ${difference} ${period}`; - } else { - return `${difference} ${period} ${tense}`; - } + return `${difference} ${period} ${tense}`; } async function refreshBanner(_, french) { diff --git a/assets/logo/custom.css b/assets/logo/custom.css index 4237274..adde95f 100644 --- a/assets/logo/custom.css +++ b/assets/logo/custom.css @@ -1,3 +1,7 @@ +img { + image-rendering: pixelated !important; +} + #admin-page { margin-left: 32px; } diff --git a/assets/uploads/pt-scootaloo.png b/assets/uploads/pt-scootaloo.png index 436d6a3..c1823b8 100644 Binary files a/assets/uploads/pt-scootaloo.png and b/assets/uploads/pt-scootaloo.png differ diff --git a/includes/assets.inc b/includes/assets.inc index b64c821..3f2d652 100644 --- a/includes/assets.inc +++ b/includes/assets.inc @@ -68,12 +68,12 @@ function downloadAssets($system, $path = null) { } else { $url = "../assets/uploads/pt.png"; } - echo(" /heads/$id.webp\n"); - exec("convert -resize 64x64 \"" . $url . "\" ../assets/heads/" . $id . ".webp"); + echo(" /heads/$id.png\n"); + exec("convert \"" . $url . "\" ../assets/heads/" . $id . ".png"); if (file_exists("../assets/ponies/" . $member["id"] . ".png")) { - echo(" /bodies/$id.webp\n"); - exec("convert -resize 128x128 \"" . "../assets/ponies/" . $member["id"] . ".png" . "\" ../assets/bodies/" . $id . ".webp"); + echo(" /bodies/$id.png\n"); + exec("convert \"" . "../assets/ponies/" . $member["id"] . ".png" . "\" ../assets/bodies/" . $id . ".png"); } } } diff --git a/includes/external/school/index.js b/includes/external/school/index.js index ad601d6..c8f053c 100644 --- a/includes/external/school/index.js +++ b/includes/external/school/index.js @@ -196,5 +196,5 @@ async function display(offset) { } console.log(json); - require('fs').writeFileSync("../includes/data/school.json", JSON.stringify(json)); + require('fs').writeFileSync("../../data/school.json", JSON.stringify(json)); })() \ No newline at end of file diff --git a/includes/functions.inc b/includes/functions.inc index 1d467a0..e9024d1 100644 --- a/includes/functions.inc +++ b/includes/functions.inc @@ -53,10 +53,18 @@ if (!function_exists("getAsset")) { $id = $id1; } - if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/" . $type . "/" . $id . ".webp")) { - return "/assets/" . $type . "/" . $id . ".webp"; + if ($type === "bodies" || $type === "heads") { + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/" . $type . "/" . $id . ".png")) { + return "/assets/" . $type . "/" . $id . ".png"; + } else { + return "/error/nofile/?s=$systemID&m=$memberID&t=$type"; + } } else { - return "/error/nofile/?s=$systemID&m=$memberID&t=$type"; + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/" . $type . "/" . $id . ".webp")) { + return "/assets/" . $type . "/" . $id . ".webp"; + } else { + return "/error/nofile/?s=$systemID&m=$memberID&t=$type"; + } } } else { return "/error/nosys/?s=$systemID&m=$memberID&t=$type"; @@ -266,8 +274,7 @@ if (!function_exists("getMemberWithoutSystem")) { if (!function_exists("showMembersFromList")) { function showMembersFromList(array $list) { foreach ($list as $member) { if ($member['name'] !== "unknown" && $member['name'] !== "fusion") { - echo(' -
+ echo('
' . ($member['display_name'] ?? $member['name']) . '
' . (isset($member['travelling']) && $member['travelling'] ? "+" . ($member['proxy_tags'][0]['prefix'] ?? " ") : ($member['proxy_tags'][0]['prefix'] ?? " ")) . '
@@ -302,14 +309,11 @@ if (!function_exists("showSystem")) { $global = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . (isset($app["other"]) && $id === $app["other"]["id"] ? "other" : $id) . "/general.json"), true); if ($hideTitle) { - echo(' -
'); + echo('
'); } else { - echo(' -
'); + echo('
'); } - if (!$hideTitle) echo(' - + if (!$hideTitle) echo('

' . $name . '
'); diff --git a/includes/homepage.inc b/includes/homepage.inc index c078e89..900d8f1 100644 --- a/includes/homepage.inc +++ b/includes/homepage.inc @@ -4,6 +4,7 @@ global $app; global $travelling; function newHomepage($id, $page, $title) { + global $travelling; $system = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $id . "/general.json"), true); ?> @@ -17,10 +18,17 @@ function newHomepage($id, $page, $title) { diff --git a/includes/member.inc b/includes/member.inc index 8d03285..b98d0f5 100644 --- a/includes/member.inc +++ b/includes/member.inc @@ -104,9 +104,9 @@ if ($memberData["name"] === "fusion") {
- (edit: metadata, page) + (edit: metadata, pony town, page) - (edit: metadata, public, private) + (edit: metadata, pony town, public, private)
diff --git a/includes/pages.json b/includes/pages.json index f2326c0..2a7bbe6 100644 --- a/includes/pages.json +++ b/includes/pages.json @@ -239,6 +239,16 @@ "limited": false, "rail": true }, + "ponytown": { + "name": { + "en": "Pony Town uploader", + "fr": "Pony Town uploader" + }, + "short": null, + "admin": true, + "limited": true, + "rail": true + }, "profiles": { "name": { "en": "Profile scores", diff --git a/includes/sysbanner.inc b/includes/sysbanner.inc index 2ca3ee8..763c961 100644 --- a/includes/sysbanner.inc +++ b/includes/sysbanner.inc @@ -21,30 +21,6 @@ $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pa

- @@ -117,12 +93,4 @@ $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pa - -
\ No newline at end of file diff --git a/includes/titlebar.inc b/includes/titlebar.inc index a6ccd67..e941179 100644 --- a/includes/titlebar.inc +++ b/includes/titlebar.inc @@ -571,7 +571,7 @@ if ($isLowerLoggedIn || $isLoggedIn) { $linksList = $links[isset($links[$actionsProfile]) ? $actionsProfile : "default"]; -?> +?> $link): if (!(isset($link["show"]) && !$link["show"])): ?>hrefonclick="" title="" data-bs-toggle="tooltip" class="title-bar-action tooltip-nohelp">" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> diff --git a/includes/travelling.inc b/includes/travelling.inc index 4487956..0d1696a 100644 --- a/includes/travelling.inc +++ b/includes/travelling.inc @@ -39,19 +39,24 @@ foreach ($members as $member) { function withTravelers(array $members, string $system): array { global $travelling; - - return [ - ...array_map(function ($i) use ($system) { - $i['system'] = $system; - return $i; - }, array_filter($members, function ($i) use ($travelling) { - return !(isset($travelling[$i['id']]) && $travelling[$i['id']]['travelling'] && (!isset($travelling[$i['id']]['equestria']) || !$travelling[$i['id']]['equestria'])); - })), - ...array_filter(array_map(function ($i) use ($system) { - $i['system'] = $system === "gdapd" ? "ynmuc" : "gdapd"; - return $i; - }, json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($system === "gdapd" ? "ynmuc" : "gdapd") . "/members.json"), true)), function ($i) use ($travelling) { - return isset($travelling[$i['id']]) && $travelling[$i['id']]['travelling'] && (!isset($travelling[$i['id']]['equestria']) || !$travelling[$i['id']]['equestria']); - }) + global $app; + + if ($system === $app["other"]["id"]) { + return $members; + } else { + return [ + ...array_map(function ($i) use ($system) { + $i['system'] = $system; + return $i; + }, array_filter($members, function ($i) use ($travelling) { + return !(isset($travelling[$i['id']]) && $travelling[$i['id']]['travelling'] && (!isset($travelling[$i['id']]['equestria']) || !$travelling[$i['id']]['equestria'])); + })), + ...array_filter(array_map(function ($i) use ($system) { + $i['system'] = $system === "gdapd" ? "ynmuc" : "gdapd"; + return $i; + }, json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($system === "gdapd" ? "ynmuc" : "gdapd") . "/members.json"), true)), function ($i) use ($travelling) { + return isset($travelling[$i['id']]) && $travelling[$i['id']]['travelling'] && (!isset($travelling[$i['id']]['equestria']) || !$travelling[$i['id']]['equestria']); + }) ]; + } } \ No newline at end of file diff --git a/pages/api/ponytown.php b/pages/api/ponytown.php new file mode 100644 index 0000000..f41ac01 --- /dev/null +++ b/pages/api/ponytown.php @@ -0,0 +1,117 @@ + 70) { + $errors[] = "0x{$_}000002A: Image #" . $_ . " is wider than it should, are you sure you set zoom to 1x? Maybe you inverted the files?"; + } + + if ($_ === 1 && $size[1] > 70) { + $errors[] = "0x{$_}000002B: Image #" . $_ . " is higher than it should, are you sure you set zoom to 1x? Maybe you inverted the files?"; + } + + if ($_ === 2 && $size[0] > 35) { + $errors[] = "0x{$_}000002A: Image #" . $_ . " is wider than it should, are you sure you set zoom to 1x? Maybe you inverted the files?"; + } + + if ($_ === 2 && $size[1] > 35) { + $errors[] = "0x{$_}000002B: Image #" . $_ . " is higher than it should, are you sure you set zoom to 1x? Maybe you inverted the files?"; + } +} + +if (count($errors) === 0 && isset($_GET["real"])) { + foreach ([1, 2] as $_) { + $input = $json_object[$_ - 1]; + + $mime = explode(";", substr($input, 5))[0]; + $file = base64_decode(explode(",", explode(";", substr($input, 5))[1])[1]); + + $image = @imagecreatefromstring($file); + + imagealphablending($image, false); + imagesavealpha($image, true); + + if ($_ === 1) { + imagepng($image, $_SERVER['DOCUMENT_ROOT'] . "/assets/ponies/" . $member["id"] . ".png"); + } else { + imagepng($image, $_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member["name"] . ".png"); + } + } +} + +die(json_encode([ + "success" => count($errors) === 0, + "errors" => $errors +])); \ No newline at end of file diff --git a/pages/docs.inc b/pages/docs.inc index 3b212df..2e43727 100644 --- a/pages/docs.inc +++ b/pages/docs.inc @@ -345,7 +345,7 @@ function showDocument($item) { ?> time = new Date(time).getTime(); } - let periods = ["sec.", "mn.", "hr.", "d.", "wk.", "mo.", "y.", "ages"]; + let periods = ["sec", "min", "hr", "d", "wk", "mo", "y", "ages"]; let lengths = ["60", "60", "24", "7", "4.35", "12", "100"]; diff --git a/pages/home.old.inc b/pages/home.old.inc index 4249947..f918549 100644 --- a/pages/home.old.inc +++ b/pages/home.old.inc @@ -47,18 +47,6 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; require_once $_SE

- - - -
diff --git a/pages/money.inc b/pages/money.inc index b297231..257b87f 100644 --- a/pages/money.inc +++ b/pages/money.inc @@ -1,5 +1,8 @@ $account["currency"] === "gbp" ? "£" : "€" . abs((float)$_GET["amount"]) . " were " . ((float)$_GET["amount"] >= 0 ? "added" : "removed") . " just now" . (trim($_GET["description"]) !== "" ? ": " . $_GET["description"] : "") + 'content' => ($account["currency"] === "gbp" ? "£" : "€") . abs((float)$_GET["amount"]) . " were " . ((float)$_GET["amount"] >= 0 ? "added" : "removed") . " just now" . (trim($_GET["description"]) !== "" ? ": " . $_GET["description"] : "") ] ])); @@ -96,7 +99,7 @@ if ((isset($_GET["create"]) || isset($_GET["delete"])) && isset($parts[2])) { "Title: " . (getMember($myId)["display_name"] ?? getMember($myId)["name"]) . " deleted a transaction from " . $account["name"] . " (" . ucfirst($account["owner"]) . ")\r\n" . "Tags: bits\r\n" . "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => $account["currency"] === "gbp" ? "£" : "€" . abs((float)$account["transactions"][(int)$_GET["id"]]["amount"]) . " " . ((float)$account["transactions"][(int)$_GET["id"]]["amount"] >= 0 ? "advance" : "withdrawal") . " created by " . (getMemberWithoutSystem($account["transactions"][(int)$_GET["id"]]["author"])["display_name"] ?? getMemberWithoutSystem($account["transactions"][(int)$_GET["id"]]["author"])["name"]) . " " . timeAgo($account["transactions"][(int)$_GET["id"]]["date"]) + 'content' => ($account["currency"] === "gbp" ? "£" : "€") . abs((float)$account["transactions"][(int)$_GET["id"]]["amount"]) . " " . ((float)$account["transactions"][(int)$_GET["id"]]["amount"] >= 0 ? "advance" : "withdrawal") . " created by " . (getMemberWithoutSystem($account["transactions"][(int)$_GET["id"]]["author"])["display_name"] ?? getMemberWithoutSystem($account["transactions"][(int)$_GET["id"]]["author"])["name"]) . " " . timeAgo($account["transactions"][(int)$_GET["id"]]["date"]) ] ])); @@ -297,6 +300,30 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc';
+ +
+ $minimumCloudburst) { + $part2 = ($allAccounts - $minimumCloudburst) / $allAccounts; + $part1 = 1 - $part2; + $difference = $allAccounts - $minimumCloudburst; + } else { + $part1 = 1; + $part2 = 0; + $difference = $minimumCloudburst - $allAccounts; + } + + ?> +
+
+
+

">£ $minimumCloudburst): ?> (%) $minimumCloudburst ? "over" : "under" ?> the minimum

+
+ +
+ $minimumRaindrops) { + $part2 = ($allAccounts - $minimumRaindrops) / $allAccounts; + $part1 = 1 - $part2; + $difference = $allAccounts - $minimumRaindrops; + } else { + $part1 = 1; + $part2 = 0; + $difference = $minimumRaindrops - $allAccounts; + } + + ?> +
+
+
+

">€ $minimumCloudburst): ?> (%) $minimumRaindrops ? "over" : "under" ?> the minimum

+ + +
+
+
+

Pony Town uploader for

+ + +
Successfully uploaded a new Pony Town character for this member, it may take a few minutes to update across the website.
+ + +
+
+
+

Current version

+ +
+
+ " style="width: 100%; border: 1px dashed rgba(255, 255, 255, .5); border-radius: 10px;"> +
+
+ " style="width: 100%; border: 1px dashed rgba(255, 255, 255, .5); border-radius: 10px;"> +
+
+ + 60): ?> +

This Pony Town character needs to be updated.
Cold Haze now relies on pixel-perfect versions of one's Pony Town character to work properly, and the current character for this member is not compliant or non-existant.

+ +
+
+ +
+
+

Upload a new version

+ +
+
    +
  1. Open Pony Town [main, event, eventblue, eventgreen, breezy], login if needed, and select the right pony
  2. +
  3. Click on edit
  4. +
  5. Focus on Export and click on Image export zoom
  6. +
  7. In the menu, select 1x
  8. +
  9. Click on Image export settings and uncheck everything, like this:
    [all settings unchecked]
  10. +
  11. Click on PNG and download the file to your device
  12. +
  13. Upload this file here (yes this is a button):
  14. +
  15. Go back to Pony Town, click on Image export settings again
  16. +
  17. Check "Head only", and nothing else, like this:
    [Head only checked]
  18. +
  19. Click on PNG once again and download the file to your device
  20. +
  21. Upload this file (the second one) here (yes this is also a button):
  22. +
  23. We will check if you used the correct settings and save it if everything is good.
  24. +
+
+ + + + + + +
+
+ + +
+
+
+ + \ No newline at end of file diff --git a/pages/rules.inc b/pages/rules.inc index 7257cf1..ec007df 100644 --- a/pages/rules.inc +++ b/pages/rules.inc @@ -117,7 +117,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc';