-
Notifications
You must be signed in to change notification settings - Fork 1
/
settings.php
100 lines (79 loc) · 3.03 KB
/
settings.php
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<?php
include("misc/header.php");
include("misc/utils.php");
$config = require_once("config.php");
if (isset($_REQUEST["request"])) {
$request = $_REQUEST["request"];
setcookie("request", $request, time() + 86400 * 30, "/");
} else {
$request = "post";
}
if (isset($_REQUEST["theme"])) {
$theme = $_REQUEST["theme"];
setcookie("theme", $theme, time() + 86400 * 30, "/");
}
if (!empty($_COOKIE["request"])) {
$request_cookie = $_COOKIE["request"];
}
if (!empty($_COOKIE["theme"])) {
$theme_cookie = $_COOKIE["theme"];
}
if (isset($_REQUEST["project_name"])) {
$project_name = $_REQUEST["project_name"];
//validating name and length
if (strlen($project_name) > 0 && strlen($project_name) <= 25) {
$project_name = valid_name($project_name);
setcookie("project_name", $project_name, time() + 86400 * 30, "/");
} else {
$project_name = $config->$project_name;
}
}
?>
<title> Settings</title>
<body>
<h1 class="margin-bottom-20 margin-top-50">Settings</h1>
<form autocomplete="off" method=<?php echo $request ?>>
<div class="flex-row-space-between setting-box gap-10">
<div>
<h3>Change name</h3>
<p>Name should be no longer than 25 chars.Include alphabets and numbers</p>
</div>
<input class="input-name" name="project_name" type="text" value=<?php echo (!empty($_COOKIE["project_name"])) ? $_COOKIE["project_name"] : $config->project_name ?>>
</div>
<div class="flex-row-space-between setting-box gap-10">
<div>
<h3>request method</h3>
<p>POST hides your query from the URL and browser tab. GET includes them.(set to 'get' if you intend to
bookmark or share url)</p>
</div>
<div>
<select class="margin-0" name="request" id="">
<option value="post" <?php echo ($request_cookie == "post") ? "selected" : "" ?>>post</option>
<option value="get" <?php echo ($request_cookie == "get") ? "selected" : "" ?>>get
</option>
</select>
</div>
</div>
<div class="flex-row-space-between setting-box gap-10">
<div>
<h3>theme</h3>
<p class="margin-top-10">change the look and feel</p>
</div>
<select class="margin-0" name="theme" id="">
<option value="dark" <?php echo ($theme_cookie == "dark") ? "selected" : "" ?>>dark </option>
<option value="light" <?php echo ($theme_cookie == "light") ? "selected" : "" ?>>light</option>
<option value="auto" <?php echo ($theme_cookie == "auto") ? "selected" : "" ?>>auto</option>
</select>
</div>
<div>
<button class="setting-btn" type="submit" name="save" value="1">Save</button>
</div>
</form>
</body>
<?php
if (isset($_REQUEST["save"])) {
header("Location: ./");
die();
}
include("misc/footer.php");
?>