Files

35 lines
1.2 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 === '') {
json_out(['ok'=>false,'logged_in'=>false]);
}
$acct = acct_get($uuid);
if (!$acct) {
json_out(['ok'=>false,'logged_in'=>false]);
}
unset($acct['password_hash']);
$acct['ok'] = true;
$acct['logged_in'] = true;
$acct['uuid'] = $uuid;
$acct['flags'] = acct_flags_from($acct);
$acct['admin_level'] = acct_level_from_flags($acct['flags']);
// Fine-grained rank so the UI can tell LVL1 (read-only) from LVL2 — admin_level
// collapses both to 2. lvl1=1, lvl2=2, lvl3=3, none=0.
$acct['admin_rank'] = acct_admin_rank_from($acct['flags']);
$acct['csrf_token'] = csrf_token();
json_out($acct);