Files
reflector-dashboard/auth/admin_certs.php
T

73 lines
2.8 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 · Certificates — Reflector Dashboard';
require __DIR__ . '/header.php';
?>
<div class="container py-4" style="max-width:900px;">
<div class="panel">
<div class="d-flex justify-content-between align-items-center flex-wrap gap-2 mb-3">
<h5 class="mb-0">Certificate Admin</h5>
<select id="certView" class="form-select form-select-sm" style="width:auto;">
<option value="certs">Issued certificates</option>
<option value="pending">Pending CSRs</option>
</select>
</div>
<div id="certMsg" class="small mb-2" style="display:none;"></div>
<!-- Issued certs -->
<div id="viewCerts">
<div class="table-responsive">
<table class="data-table">
<thead><tr><th>Callsign</th><th>Issued</th><th style="text-align:right;">Actions</th></tr></thead>
<tbody id="certsBody"><tr><td colspan="3" class="text-secondary">Loading…</td></tr></tbody>
</table>
</div>
</div>
<!-- Pending CSRs -->
<div id="viewPending" style="display:none;">
<div class="table-responsive">
<table class="data-table">
<thead><tr><th>Callsign</th><th>Received</th><th>Subject</th><th style="text-align:right;">Actions</th></tr></thead>
<tbody id="pendingBody"><tr><td colspan="4" class="text-secondary">Loading…</td></tr></tbody>
</table>
</div>
</div>
</div>
</div>
<!-- Cert info modal -->
<div class="modal fade" id="certInfoModal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content" style="background:#111; border:1px solid var(--line);">
<div class="modal-header" style="border-color:var(--line);">
<h5 class="modal-title" id="certInfoTitle">Certificate</h5>
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body mono small" id="certInfoBody" style="word-break:break-all;"></div>
</div>
</div>
</div>
<?php
$extra_scripts = '<script>var ADMIN_LEVEL = ' . $lvl . ';</script><script src="/auth/admin_certs.js"></script>';
require __DIR__ . '/footer.php';
?>