summaryrefslogtreecommitdiff
path: root/includes/assets.inc
diff options
context:
space:
mode:
Diffstat (limited to 'includes/assets.inc')
-rw-r--r--includes/assets.inc18
1 files changed, 14 insertions, 4 deletions
diff --git a/includes/assets.inc b/includes/assets.inc
index 05296ce..4f74a6e 100644
--- a/includes/assets.inc
+++ b/includes/assets.inc
@@ -1,12 +1,18 @@
<?php
+global $app;
+
if (!file_exists("../assets/avatars")) mkdir("../assets/avatars");
if (!file_exists("../assets/banners")) mkdir("../assets/banners");
if (!file_exists("../assets/heads")) mkdir("../assets/heads");
if (!file_exists("../assets/bodies")) mkdir("../assets/bodies");
-function downloadAssets($system) {
- $general = json_decode(file_get_contents("./data/$system/general.json"), true);
+function downloadAssets($system, $path = null) {
+ if (!isset($path)) {
+ $path = $system;
+ }
+
+ $general = json_decode(file_get_contents("./data/$path/general.json"), true);
if (isset($general["avatar_url"])) {
$id = preg_replace("/^([\da-f]{8})-([\da-f]{4})-([\da-f]{4})-([\da-f]{4})-([\da-f]{12})$/", "$1$2$3$4$5", $general["uuid"]);
@@ -24,7 +30,7 @@ function downloadAssets($system) {
unlink("/tmp/img." . pathinfo($general['banner'], PATHINFO_EXTENSION));
}
- $members = json_decode(file_get_contents("./data/$system/members.json"), true);
+ $members = json_decode(file_get_contents("./data/$path/members.json"), true);
foreach ($members as $member) {
$id = preg_replace("/^([\da-f]{8})-([\da-f]{4})-([\da-f]{4})-([\da-f]{4})-([\da-f]{12})$/", "$1$2$3$4$5", $general["uuid"]) . preg_replace("/^([\da-f]{8})-([\da-f]{4})-([\da-f]{4})-([\da-f]{4})-([\da-f]{12})$/", "$1$2$3$4$5", $member["uuid"]);
@@ -73,4 +79,8 @@ function downloadAssets($system) {
}
downloadAssets("gdapd");
-downloadAssets("ynmuc"); \ No newline at end of file
+downloadAssets("ynmuc");
+
+if (isset($app["other"]) && isset($app["other"]["id"]) && isset($app["other"]["token"])) {
+ downloadAssets($app["other"]["id"], "other");
+} \ No newline at end of file