summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2023-03-03 07:04:02 +0100
committerMinteck <contact@minteck.org>2023-03-03 07:04:02 +0100
commit29928887e733f3bc2c2baaf06dafd495a006753b (patch)
tree90f5fa4c5273f201cc2d26086298ad094d9dadda /includes
parent3d77712a9ab014635c75a33ea0f491bbda6aead3 (diff)
downloadpluralconnect-29928887e733f3bc2c2baaf06dafd495a006753b.tar.gz
pluralconnect-29928887e733f3bc2c2baaf06dafd495a006753b.tar.bz2
pluralconnect-29928887e733f3bc2c2baaf06dafd495a006753b.zip
Updated 18 files and added 10 files (automated)
Diffstat (limited to 'includes')
-rw-r--r--includes/assets.inc8
-rw-r--r--includes/external/school/index.js2
-rw-r--r--includes/functions.inc26
-rw-r--r--includes/homepage.inc12
-rw-r--r--includes/member.inc4
-rw-r--r--includes/pages.json10
-rw-r--r--includes/sysbanner.inc32
-rw-r--r--includes/titlebar.inc2
-rw-r--r--includes/travelling.inc33
9 files changed, 62 insertions, 67 deletions
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('<!-- ' . ($member['display_name'] ?? $member['name']) . ' -->
-<a href="/' . $member['name'] . '" style="text-decoration:none !important;filter:none !important;"><div class="hpd-item-card" style="background-color:rgba(255, 255, 255, .1);border:1px solid ' . (isset($member['color']) ? "#" . $member['color'] . "55" : "transparent") . ';outline-color:' . (isset($member['color']) ? "#" . $member['color'] . "55" : "transparent") . ';border-radius:10px;text-align:center;display:flex;align-items:center;justify-content:center;padding:5px;' . (isset($member["equestria"]) && $member["equestria"] ? 'opacity:.5;' : '') . '"><div>
+ echo('<a href="/' . $member['name'] . '" style="text-decoration:none !important;filter:none !important;"><div class="hpd-item-card" style="background-color:rgba(255, 255, 255, .1);border:1px solid ' . (isset($member['color']) ? "#" . $member['color'] . "55" : "transparent") . ';outline-color:' . (isset($member['color']) ? "#" . $member['color'] . "55" : "transparent") . ';border-radius:10px;text-align:center;display:flex;align-items:center;justify-content:center;padding:5px;' . (isset($member["equestria"]) && $member["equestria"] ? 'opacity:.5;' : '') . '"><div>
<img alt="" src="' . getAsset($member["system"], $member["id"]) . '" style="border-radius:999px;background-color:rgba(0, 0, 0, .25);height:48px;width:48px;display:block;margin-left:auto;margin-right:auto;">
<div style="text-decoration:none;color:white;margin-top:5px;">' . ($member['display_name'] ?? $member['name']) . '</div>
<div style="text-decoration:none !important;color:black !important;"><code style="text-decoration:none !important;color:white !important;">' . (isset($member['travelling']) && $member['travelling'] ? "+" . ($member['proxy_tags'][0]['prefix'] ?? "&nbsp;") : ($member['proxy_tags'][0]['prefix'] ?? "&nbsp;")) . '</code></div>
@@ -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('<!-- ' . $name . ' -->
-<div id="hpd-' . ($id === "gdapd" ? "raindrops" : ($id === "ynmuc" ? "cloudburst" : "other")) . '" style="background:rgba(255, 255, 255, .1);border-radius:10px;padding:10px;display:grid;grid-template-columns: 1fr;margin-bottom:10px;">');
+ echo('<div id="hpd-' . ($id === "gdapd" ? "raindrops" : ($id === "ynmuc" ? "cloudburst" : "other")) . '" style="background:rgba(255, 255, 255, .1);border-radius:10px;padding:10px;display:grid;grid-template-columns: 1fr;margin-bottom:10px;">');
} else {
- echo('<!-- ' . $name . ' -->
-<div id="hpd-' . ($id === "gdapd" ? "raindrops" : ($id === "ynmuc" ? "cloudburst" : "other")) . '" style="background:rgba(255, 255, 255, .1);border-radius:10px;padding:10px 10px 10px 20px;display:grid;grid-template-columns: 128px 1fr;margin-bottom:10px;">');
+ echo('<div id="hpd-' . ($id === "gdapd" ? "raindrops" : ($id === "ynmuc" ? "cloudburst" : "other")) . '" style="background:rgba(255, 255, 255, .1);border-radius:10px;padding:10px 10px 10px 20px;display:grid;grid-template-columns: 128px 1fr;margin-bottom:10px;">');
}
- if (!$hideTitle) echo('<!-- System Name -->
-<a style="display:flex;margin: -10px -20px;align-items:center;justify-content:center;text-align:center;padding: 10px 20px;border-radius: 10px;background: #' . $global['color'] . '55;width: 148px;text-decoration:none;color:white;filter:none !important;" href="/' . ($id === "gdapd" ? "raindrops" : ($id === $app["other"]["id"] ? $app["other"]["slug"] : "cloudburst")) . '" class="hpd-system">
+ if (!$hideTitle) echo('<a style="display:flex;margin: -10px -20px;align-items:center;justify-content:center;text-align:center;padding: 10px 20px;border-radius: 10px;background: #' . $global['color'] . '55;width: 148px;text-decoration:none;color:white;filter:none !important;" href="/' . ($id === "gdapd" ? "raindrops" : ($id === $app["other"]["id"] ? $app["other"]["slug"] : "cloudburst")) . '" class="hpd-system">
<div style="text-align:center;"><img src="' . getAsset($id) . '" style="width:64px;"><br>' . $name . '</div>
</a>');
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) {
<?php endif; ?>
<div class="new-homepage-system-list" id="new-homepage-system-<?= $id ?>-list">
- <?php $list = array_values(withTravelers(scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $id . "/members.json"), true), $id), $id)); foreach ($list as $index => $member): ?>
+ <?php $list = array_values(scoreOrder(withTravelers(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $id . "/members.json"), true), $id), $id)); foreach ($list as $index => $member): ?>
<a href="/<?= $member["name"] ?>" class="new-homepage-link <?= $index === count($list) - 1 ? "new-homepage-link-last" : "" ?>" style="color: white !important; text-decoration: none !important; display: block; background-color: #<?= $member["color"] ?>22; padding: 5px 10px;">
- <img src="<?= getAsset($id, $member["id"]) ?>" style="width: 32px; height: 32px; vertical-align: middle; background-color: rgba(0, 0, 0, .25); border-radius: 999px;">
+ <img src="<?= getAsset(($travelling[$member["id"]]["travelling"] && !$travelling[$member["id"]]["equestria"]) ? ($id === "gdapd" ? "ynmuc" : "gdapd") : $id, $member["id"]) ?>" style="width: 32px; height: 32px; vertical-align: middle; background-color: rgba(0, 0, 0, .25); border-radius: 999px;">
<span style="width: calc(100% - 37px); vertical-align: middle; margin-left: 5px;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;"><?= $member["display_name"] ?? $member["name"] ?></span>
+ <span style="vertical-align: middle; float:right;">
+ <?php if ($travelling[$member["id"]]["travelling"] && $travelling[$member["id"]]["equestria"]): ?>
+ <img src="/assets/logo/equestria.png" style="width: 24px; height: 24px; margin-top: 5px;">
+ <?php elseif ($travelling[$member["id"]]["travelling"]): ?>
+ <img src="<?= getAsset($id === "gdapd" ? "ynmuc" : "gdapd") ?>" style="width: 24px; height: 24px; margin-top: 5px;">
+ <?php endif; ?>
+ </span>
</a>
<?php endforeach; ?>
</div>
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") {
<details>
<summary style="list-style: none;">
<?php if ($systemID === $app["other"]["id"]): ?>
- <small style="opacity:.5;display:block;">(edit: <a href="/-/metadata/<?= $system ?>/<?= $memberData['name'] ?>">metadata</a>, <a href="/-/edit/<?= $system ?>/<?= $memberData['name'] ?>">page</a>)</small>
+ <small style="opacity:.5;display:block;">(edit: <a href="/-/metadata/<?= $system ?>/<?= $memberData['name'] ?>">metadata</a>, <a href="/-/ponytown/<?= $memberData['id'] ?>">pony town</a>, <a href="/-/edit/<?= $system ?>/<?= $memberData['name'] ?>">page</a>)</small>
<?php else: ?>
- <small style="opacity:.5;display:block;">(edit: <a href="/-/metadata/<?= $system ?>/<?= $memberData['name'] ?>">metadata</a>, <a href="/-/edit/<?= $system ?>/<?= $memberData['name'] ?>">public</a>, <a href="/-/edit-private/<?= $system ?>/<?= $memberData['name'] ?>">private</a>)</small>
+ <small style="opacity:.5;display:block;">(edit: <a href="/-/metadata/<?= $system ?>/<?= $memberData['name'] ?>">metadata</a>, <a href="/-/ponytown/<?= $memberData['id'] ?>">pony town</a>, <a href="/-/edit/<?= $system ?>/<?= $memberData['name'] ?>">public</a>, <a href="/-/edit-private/<?= $system ?>/<?= $memberData['name'] ?>">private</a>)</small>
<?php endif; ?>
</summary>
<div class="alert alert-dark">
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
<div style="display: grid; grid-template-columns: 1fr;height:100%;grid-template-rows: max-content max-content 1fr;">
<h3 style="height:max-content;"><?= $systemCommonName ?></h3>
<div style="height:max-content;display:grid;grid-template-columns: repeat(4, 1fr);" id="member-card">
- <!--<span>
- <b><abbr title="Most common fronter" data-bs-toggle="tooltip">MCF</abbr>: </b><?php
-
- $foundHost = false;
- $hostGoneTravelling = false;
-
- $members = array_filter(scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/members.json"), true), $systemID), function ($i) use ($travelling) {
- global $hostGoneTravelling;
- if ($travelling[$i['id']]['travelling'] && $i["_metadata"]["host"]) $hostGoneTravelling = true;
- return true;
- });
- foreach ($members as $member) {
- $data = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$member[id].json"), true));
- if ($data["host"]): $foundHost = true; ?>
- <a class="member-link" href="/<?= $member["name"] ?>"><img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= getMiniName($member["display_name"] ?? $member["name"]) ?></a>
- <?php endif;
- }
-
- if (!$foundHost) echo("-");
- if ($hostGoneTravelling) echo("<br>(travelling)");
-
- ?>
-
- </span>-->
<span>
<?php $fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/fronters.json"), true); ?>
<b><?= $lang["system"]["fronter"] ?> </b>
@@ -117,12 +93,4 @@ $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pa
<img src="/assets/icons/compare.svg" style="vertical-align: middle;height: 24px;width: 24px;filter: invert(1)" alt="">
<span style="vertical-align: middle;" class="list-separator-desktop"><?= $pages["s:compare"]["name"][$lang["_name"]] ?></span>
</a>
- <!--<a title="<?= $pages["s:tree"]["name"][$lang["_name"]] ?>" data-bs-toggle="tooltip" style="display:inline-block;padding:5px 10px;text-align: center" class="system-action tooltip-nohelp" href="/<?= $system ?>/-/tree">
- <img src="/assets/icons/tree.svg" style="vertical-align: middle;height: 24px;width: 24px;filter: invert(1)" alt="">
- <span style="vertical-align: middle;" class="list-separator-desktop"><?= $pages["s:tree"]["name"][$lang["_name"]] ?></span>
- </a>-->
- <!--<a title="<?= $pages["s:species"]["name"][$lang["_name"]] ?>" data-bs-toggle="tooltip" style="display:inline-block;padding:5px 10px;text-align: center" class="system-action tooltip-nohelp" href="/<?= $system ?>/-/species">
- <img src="/assets/icons/species.svg" style="vertical-align: middle;height: 24px;width: 24px;filter: invert(1)" alt="">
- <span style="vertical-align: middle;" class="list-separator-desktop"><?= $pages["s:species"]["name"][$lang["_name"]] ?></span>
- </a>-->
</div> \ 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"];
-?><!-- (<code><?= $actionsProfile ?></code>)--><!--<pre><?php var_dump($parts); ?></pre>-->
+?>
<span id="title-bar-actions">
<?php foreach ($linksList as $index => $link): if (!(isset($link["show"]) && !$link["show"])): ?><a style="height: 33px; display: inline-block; padding: 4px;" id="title-bar-action-<?= $index ?>" <?php if ($link["link"]["type"] === "url"): ?>href<?php else: ?>onclick<?php endif; ?>="<?= $link["link"]["text"] ?>" title="<?= $link["name"] ?>" data-bs-toggle="tooltip" class="title-bar-action tooltip-nohelp"><img src="<?= $link["icon"] ?>" <?php if ($link["invert"]): ?>class="dropdown-icon"<?php endif; ?> alt="" style="width:24px;vertical-align: middle;"></a><?php endif; endforeach; ?>
</span>
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