LuminaWebsite/includes/settings.php
Maaxxs 5f25e20900 Kina in the warehouse, Lumipunkte, new logo, versioned assets
Warehouse: Kina (the game currency) can be paid in and out, shown in its own
box with the in-game coin icon (Icon_Currency_Coin_GoldNonbinding from the
game client via aion2.app, since the wiki has none). It is a catalog item in
the new "Währung" category, kept out of the item cards and totals, and
allows up to a trillion per entry; warehouse_movements.quantity becomes
BIGINT for that. A leftover "Kinah" entry is merged into "Kina".

Beitragspunkte are renamed to Lumipunkte in every visible text, the coin is
now lumipunkt.svg, and the schema sync also updates the descriptions of
existing core permissions so the new name reaches the role editor.

The sidebar, login page and mobile top bar show the new Lumina Ascendens
logo, cropped and with its dark background made transparent.

Scripts and the stylesheet are included with a ?v=<mtime> query
(asset_url()), so browsers pick up new versions after an upload instead of
running stale JavaScript - the cause of raid points not being saved.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-21 10:25:28 +02:00

54 lines
1.7 KiB
PHP

<?php
declare(strict_types=1);
/**
* Einstellungen der Website, die die Leitung in der Oberflaeche aendert (Tabelle settings).
* Fehlt ein Eintrag, gilt der Standardwert aus dem Code.
*/
// Einstellungen, die ueber admin/settings_action.php geaendert werden duerfen: Schluessel => Standardwert.
const SETTINGS_DEFAULTS = [
'discord_unlink_allowed' => '1',
'contributions_history_public' => '1',
];
// Wer eine Einstellung aendern darf und wohin es danach zurueckgeht.
const SETTINGS_ACCESS = [
'discord_unlink_allowed' => ['users.edit', '/admin/users.php'],
'contributions_history_public' => ['contributions.manage', '/contributions.php#verlauf'],
];
function setting_get(string $key): string
{
static $cache = null;
if ($cache === null) {
$cache = [];
try {
foreach (db()->query('SELECT `key`, value FROM settings')->fetchAll() as $row) {
$cache[$row['key']] = (string) $row['value'];
}
} catch (PDOException $e) {
// Tabelle (noch) nicht vorhanden - Standardwerte verwenden.
}
}
return $cache[$key] ?? (SETTINGS_DEFAULTS[$key] ?? '');
}
function setting_set(string $key, string $value): void
{
db()->prepare('INSERT INTO settings (`key`, value) VALUES (?, ?) ON DUPLICATE KEY UPDATE value = VALUES(value)')
->execute([$key, $value]);
}
/** Ist der Verlauf der Lumipunkte fuer alle sichtbar oder nur fuer contributions.manage? */
function contributions_history_public(): bool
{
return setting_get('contributions_history_public') === '1';
}
/** Duerfen Mitglieder ihre Discord-Verknuepfung selbst loesen? */
function discord_unlink_allowed(): bool
{
return setting_get('discord_unlink_allowed') === '1';
}