aboutsummaryrefslogtreecommitdiff
path: root/admin/pluralkit
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-04-06 21:52:16 +0200
committerMinteck <contact@minteck.org>2022-04-06 21:52:16 +0200
commit9989797ecd50074ea8006613ce4b03e3b38f0e89 (patch)
tree9539df25f47f4da122b1bfcbbd3e0a2ab1a125dd /admin/pluralkit
parent01632caf82659e4e8025b4fad91ff7388b369770 (diff)
downloadcloudsdale-9989797ecd50074ea8006613ce4b03e3b38f0e89.tar.gz
cloudsdale-9989797ecd50074ea8006613ce4b03e3b38f0e89.tar.bz2
cloudsdale-9989797ecd50074ea8006613ce4b03e3b38f0e89.zip
Admin panel done
Diffstat (limited to 'admin/pluralkit')
-rw-r--r--admin/pluralkit/index.php50
1 files changed, 50 insertions, 0 deletions
diff --git a/admin/pluralkit/index.php b/admin/pluralkit/index.php
new file mode 100644
index 0000000..c976882
--- /dev/null
+++ b/admin/pluralkit/index.php
@@ -0,0 +1,50 @@
+<?php require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/admin/session.php"; global $_USER; ?>
+<?php
+
+if (isset($_GET['submit'])) {
+ if (isset($_GET["system-id"])) {
+ file_put_contents($_SERVER["DOCUMENT_ROOT"] . "/data/pluralkit.json", json_encode([
+ "system" => $_GET['system-id']
+ ], JSON_PRETTY_PRINT));
+ header("Location: /admin/pluralkit");
+ die();
+ }
+}
+
+?>
+<?php require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/admin/header.php"; ?>
+
+<br>
+<div class="container">
+ <h1>PluralKit Configuration</h1>
+
+ <p><b>Current System:</b> <?php
+
+ $config = json_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/data/pluralkit.json"), true);
+ $data = @file_get_contents("https://api.pluralkit.me/v2/systems/$config[system]");
+
+ if (isset($data) && $data !== false):
+ $parsed = json_decode($data, true);
+ ?>
+ <img src="<?= $parsed["avatar_url"] ?>" id="system-icon"><?= $parsed["name"] ?> (<code><?= $parsed["id"] ?></code>)
+ <?php else: ?>
+ <span class="text-danger">Not found, please make sure the ID is entered correctly</span>
+ <?php endif; ?></p>
+ <form class="input-group mb-3" style="max-width: 500px;">
+ <input name="system-id" value="<?= $config['system'] ?>" type="text" class="form-control" placeholder="System ID">
+ <input type="hidden" name="submit">
+ <button class="btn btn-primary" type="submit">Save and apply</button>
+ </form>
+</div>
+
+<style>
+ #system-icon {
+ border-radius: 999px;
+ width: 24px;
+ vertical-align: middle;
+ background: lightgray;
+ margin-right: 5px;
+ }
+</style>
+
+<?php require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/admin/footer.php"; ?> \ No newline at end of file