1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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"; ?>
|