]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/commitdiff
Add General Settings page, make it hookable
authorValerie Pond <redacted>
Fri, 7 Jul 2023 10:29:00 +0000 (11:29 +0100)
committerValerie Pond <redacted>
Fri, 7 Jul 2023 10:29:00 +0000 (11:29 +0100)
Classes/class-hook.php
inc/common.php
settings/general.php [new file with mode: 0644]

index 385854173201d135a1ff10430b7d7d3e81ac28f6..8a97ad201705fbf01744c5b0dfbe39d032247d5c 100644 (file)
@@ -143,6 +143,8 @@ define('HOOKTYPE_RIGHTCLICK_MENU', 118);
 
 /* 119 = HOOKTYPE_HEADER (See under HOOKTYPE_PRE_HEADER) */
 
+define('HOOKTYPE_GENERAL_SETTINGS', 120);
+
 /** Send out a request to ask if there are any plugins which provide authentication */
 define('HOOKTYPE_AUTH_MOD', 200);
 
index ec237fc8b2b0e6d7f69ae5a385a47a9ec868cef5..52ff1e358d3fcec8adbb5ebcd74376d8f62c295b 100644 (file)
@@ -491,12 +491,14 @@ $pages = [
                "IP WHOIS" => ["script" => "tools/ip-whois.php","no_irc_server_required"=>true],
        ],
        "Settings" => [
+               "General Settings" => ["script" => "settings/general.php"],
                "RPC Servers" => ["script" => "settings/rpc-servers.php","no_irc_server_required"=>true],
        ],
        
        "News" => ["script" => "news.php","no_irc_server_required"=>true],
 ];
 
+
 if (!panel_start_session())
 {
        if (!page_requires_no_login())
diff --git a/settings/general.php b/settings/general.php
new file mode 100644 (file)
index 0000000..bf30105
--- /dev/null
@@ -0,0 +1,24 @@
+<?php
+require_once "../inc/common.php";
+require_once "../inc/header.php";
+
+$canEdit = current_user_can(PERMISSION_MANAGE_USERS);
+function _ce($can){
+    echo ($can) ? "" : "disabled";
+}
+
+?>
+<h4>General Settings</h4>
+<br>
+<h6>Debug Mode</h6>
+<div class="form-group form-check">
+    <input type="checkbox" class="form-check-input" id="debug_mode" <?php _ce($canEdit) ?>>
+    <label class="form-check-label" for="debug_mode">Enable Debug Mode (Developers Only)</label>
+</div>
+
+
+<?php $a = []; Hook::run(HOOKTYPE_GENERAL_SETTINGS, $a); ?>
+<br><br>
+<div class="btn btn-primary">Save</div>
+<?php
+require_once "../inc/footer.php";
\ No newline at end of file