Files
reflector-dashboard/auth/admin_config.php
T

51 lines
2.1 KiB
PHP

<?php
/*
* Reflector Dashboard — web front-end for SvxReflector
* Copyright (C) 2026 SA7AUX (Björn)
* SPDX-License-Identifier: AGPL-3.0-or-later
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version. See the LICENSE file for details.
*/
declare(strict_types=1);
require __DIR__ . '/lib.php';
start_session();
$uuid = $_SESSION['uid'] ?? null;
if (!is_string($uuid) || $uuid === '') { header('Location: /'); exit; }
$me = acct_get($uuid);
$lvl = acct_admin_level($uuid);
if ($lvl < 2) { header('Location: /'); exit; }
$page_title = 'Admin · Config — Reflector Dashboard';
require __DIR__ . '/header.php';
?>
<div class="container py-4" style="max-width:800px;">
<div class="panel">
<div class="d-flex justify-content-between align-items-center mb-3">
<h5 class="mb-0">Configuration</h5>
<div class="d-flex gap-2">
<button type="button" class="btn btn-outline-secondary btn-sm" id="btnView">View</button>
<button type="button" class="btn btn-warning btn-sm" id="btnEdit">Edit</button>
</div>
</div>
<div id="viewMode">
<pre id="cfgView" class="mono" style="font-size:.8rem; white-space:pre-wrap; margin:0; color:var(--fg);"></pre>
</div>
<div id="editMode" style="display:none;">
<textarea class="form-control mono" id="cfgEditor" rows="25" style="font-size:.8rem; resize:vertical;"></textarea>
<div class="d-flex gap-2 mt-3">
<button type="button" class="btn btn-primary btn-sm" id="btnSave">Save</button>
<button type="button" class="btn btn-warning btn-sm" id="btnSaveReload">Save &amp; Reload</button>
<button type="button" class="btn btn-outline-secondary btn-sm" id="btnDiscard">Discard</button>
</div>
</div>
<div id="cfgMsg" class="small mt-2" style="display:none;"></div>
</div>
</div>
<?php
$extra_scripts = '<script>var ADMIN_LEVEL = ' . $lvl . ';</script><script src="/auth/admin_config.js"></script>';
require __DIR__ . '/footer.php';
?>