]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/blame - settings/general.php
General Settings: Make debug mode work, also make page pluggable
[irc/unrealircd/unrealircd-webpanel.git] / settings / general.php
CommitLineData
ee8927ad
VP
1<?php
2require_once "../inc/common.php";
3require_once "../inc/header.php";
4
5$canEdit = current_user_can(PERMISSION_MANAGE_USERS);
6function _ce($can){
7 echo ($can) ? "" : "disabled";
8}
f2e07243
VP
9if (isset($_POST['submit']) && $canEdit)
10{
11 $dbug = (isset($config['debug']) && $config['debug']) ? true : false;
12 $config['debug'] = (isset($_POST['debug_mode'])) ? true : false;
13 if ($config['debug'] != $dbug) // we just toggled
14 Message::Info("Debug Mode is now ".(($config['debug']) ? "enabled" : "disabled"));
15 write_config();
16 unset($_POST['debug'], $_POST['submit']);
17 Hook::run(HOOKTYPE_GENERAL_SETTINGS_POST, $_POST);
18}
ee8927ad 19
f2e07243 20do_log("\$_POST", $_POST);
ee8927ad
VP
21?>
22<h4>General Settings</h4>
23<br>
f2e07243
VP
24<form method="post">
25<div class="card" style="padding-left:20px;padding-right:20px;padding-top:5px;padding-bottom:10px;max-width:fit-content">
26 <h6>Debug Mode</h6>
27 <div class="custom-control custom-switch">
28 <input name="debug_mode" type="checkbox" class="custom-control-input" id="debug_mode" <?php _ce($canEdit); echo ($config['debug'] == true) ? " checked" : ""; ?>>
29 <label class="custom-control-label" for="debug_mode">Enable Debug Mode (Developers Only)</label>
30 </div>
31 <i>Enabling this will likely make your webpanel more difficult to use</i>
ee8927ad
VP
32</div>
33
ee8927ad
VP
34<?php $a = []; Hook::run(HOOKTYPE_GENERAL_SETTINGS, $a); ?>
35<br><br>
f2e07243
VP
36<button type="post" name="submit" class="btn btn-primary">Save</div>
37</form>
ee8927ad
VP
38<?php
39require_once "../inc/footer.php";