aboutsummaryrefslogtreecommitdiff
path: root/admin/general/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'admin/general/index.php')
-rwxr-xr-xadmin/general/index.php69
1 files changed, 69 insertions, 0 deletions
diff --git a/admin/general/index.php b/admin/general/index.php
new file mode 100755
index 0000000..95de883
--- /dev/null
+++ b/admin/general/index.php
@@ -0,0 +1,69 @@
+<?php require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/admin/session.php"; global $_USER; ?>
+<?php
+
+if (isset($_GET['submit'])) {
+ if (isset($_GET["description"])) {
+ $config = json_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/data/general.json"), true);
+ if (trim($_GET['description']) === "") {
+ file_put_contents($_SERVER["DOCUMENT_ROOT"] . "/data/general.json", json_encode([
+ "description" => "Lorem ipsum dolor sit amet",
+ "name" => $config["name"]
+ ], JSON_PRETTY_PRINT));
+ } else {
+ file_put_contents($_SERVER["DOCUMENT_ROOT"] . "/data/general.json", json_encode([
+ "description" => $_GET['description'],
+ "name" => $config["name"]
+ ], JSON_PRETTY_PRINT));
+ }
+ header("Location: /admin/general");
+ die();
+ }
+ if (isset($_GET["name"])) {
+ $config = json_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/data/general.json"), true);
+ if (trim($_GET['name']) === "") {
+ file_put_contents($_SERVER["DOCUMENT_ROOT"] . "/data/general.json", json_encode([
+ "description" => $config["description"],
+ "name" => "Cloudburst System"
+ ], JSON_PRETTY_PRINT));
+ } else {
+ file_put_contents($_SERVER["DOCUMENT_ROOT"] . "/data/general.json", json_encode([
+ "description" => $config['description'],
+ "name" => $_GET["name"]
+ ], JSON_PRETTY_PRINT));
+ }
+ header("Location: /admin/general");
+ die();
+ }
+}
+
+?>
+<?php require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/admin/header.php"; $config = json_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/data/general.json"), true); ?>
+
+<br>
+<div class="container">
+ <h1>General Preferences</h1>
+
+ <form class="input-group mb-3" style="max-width: 500px;">
+ <input name="description" value="<?= $config['description'] === 'Lorem ipsum dolor sit amet' ? '' : $config['description'] ?>" type="text" class="form-control" placeholder="Website Description">
+ <input type="hidden" name="submit">
+ <button class="btn btn-primary" type="submit">Save and apply</button>
+ </form>
+
+ <form class="input-group mb-3" style="max-width: 500px;">
+ <input name="name" value="<?= $config['name'] ?>" type="text" class="form-control" placeholder="Website Name">
+ <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