forked from Xkeeper0/jul
-
Notifications
You must be signed in to change notification settings - Fork 1
/
admin-settings.php
54 lines (44 loc) · 1.47 KB
/
admin-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
<?php
require "lib/common.php";
require "lib/extension_mgmt.php";
admincheck();
// Prepare the extension name
$_GET['extfile'] = filter_string($_GET['extfile']);
if (!$_GET['extfile']) {
// An extension name is expected. Redirect out if missing.
die(header("Location: admin-extensions.php"));
}
if (!ext_valid($_GET['extfile']))
errorpage("The specified extension does not exist or is invalid.");
$info = ext_read_metadata($_GET['extfile']);
if (filter_bool($info['noconfig'])) {
errorpage("This feature has no configurable settings.", "admin-extensions.php", "the extensions manager");
}
if (isset($_POST['submit']) && isset($_POST['config'])) {
check_token($_POST['auth']);
ext_write_config($_GET['extfile']);
errorpage("Settings saved!", "admin-extensions.php", "the extensions manager");
}
$xname = htmlspecialchars($info['name']);
pageheader("{$xname}: Settings");
print adminlinkbar();
$links = array(
["Optional features", "admin-extensions.php"],
[$info['name'], null]
);
$barlinks = dobreadcrumbs($links);
?>
<form method="POST" action="?extfile=<?= $_GET['extfile'] ?>">
<?= $barlinks ?>
<?= ext_config_layout($_GET['extfile']) ?>
<table class="table">
<tr>
<td class="tdbg2 center">
<input type="submit" name="submit" value="Save settings"> — <a href="admin-extensions.php" class="button">Cancel</a>
<?= auth_tag() ?>
</td>
</tr>
</table>
</form>
<?php
pagefooter();