Asked for: "das consilium elyseum wurde umbenannt zu DACH Elyos. pass das bitte an auf der website". - CONSILIUM_NAME is 'DACH Elyos', and every visible text follows it: sidebar, the alliance page, member tab, raid area, calendar audience and badge, iCal note, map live sessions and share buttons, admin pages (Verwaltung -> DACH Elyos, Discord-Bot, Berechtigungsgruppen), flash messages, log entries, permission descriptions (synced to the database by schema_sync_core_permissions()) and the privacy page. - The name takes no article, so the sentences around it changed too: "von DACH Elyos", "in DACH Elyos", "für DACH Elyos" instead of "des Consiliums", "im Consilium", "für das Consilium". The bot channel label is now "Raid-Kanal DACH Elyos". - Internal names stay "consilium": permission keys, tables, settings, files and URLs (?bereich=consilium, ?tab=consilium), so nothing in the database or in existing links changes. includes/consilium.php says so. - README: section renamed to "DACH Elyos" (anchor #dach-elyos). - No patch note (alliance topics stay out of them). The bot's two "Consilium" error texts in live_tactics.py never reach the page - the map only reads the status code - so the bot needs no update. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
90 lines
4 KiB
PHP
90 lines
4 KiB
PHP
<?php
|
|
/** Formulare von Verwaltung -> Consilium Elyseum (admin/consilium.php). */
|
|
require_once __DIR__ . '/../includes/bootstrap.php';
|
|
require_once __DIR__ . '/../includes/consilium.php';
|
|
require_permission('consilium.manage');
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
|
|
redirect('/admin/consilium.php');
|
|
}
|
|
verify_csrf();
|
|
|
|
$pdo = db();
|
|
$action = (string) ($_POST['action'] ?? '');
|
|
$id = (int) ($_POST['id'] ?? 0);
|
|
$name = trim((string) ($_POST['name'] ?? ''));
|
|
$back = '/admin/consilium.php';
|
|
|
|
switch ($action) {
|
|
case 'legion_add':
|
|
case 'legion_rename':
|
|
if ($name === '' || mb_strlen($name) > CONSILIUM_LEGION_NAME_MAX) {
|
|
set_flash('error', 'Bitte einen Namen mit höchstens ' . CONSILIUM_LEGION_NAME_MAX . ' Zeichen angeben.');
|
|
redirect($back);
|
|
}
|
|
if ($action === 'legion_add') {
|
|
$order = (int) $pdo->query('SELECT COALESCE(MAX(sort_order), 0) + 10 FROM consilium_legions')->fetchColumn();
|
|
$pdo->prepare('INSERT INTO consilium_legions (name, sort_order) VALUES (?, ?)')->execute([$name, $order]);
|
|
admin_log('🤝 ' . CONSILIUM_NAME . ': Legion hinzugefügt', ['Legion' => $name], 'success');
|
|
set_flash('success', '„' . $name . '“ gehört jetzt zu ' . CONSILIUM_NAME . '.');
|
|
redirect($back);
|
|
}
|
|
$old = consilium_legion_name($id);
|
|
if ($old === null) {
|
|
set_flash('error', 'Diese Legion gibt es nicht (mehr).');
|
|
redirect($back);
|
|
}
|
|
if ($old !== $name) {
|
|
$pdo->prepare('UPDATE consilium_legions SET name = ? WHERE id = ?')->execute([$name, $id]);
|
|
admin_log('🤝 ' . CONSILIUM_NAME . ': Legion umbenannt', ['Vorher' => $old, 'Neu' => $name]);
|
|
}
|
|
set_flash('success', 'Gespeichert.');
|
|
redirect($back);
|
|
|
|
case 'legion_delete':
|
|
$old = consilium_legion_name($id);
|
|
if ($old !== null) {
|
|
$pdo->beginTransaction();
|
|
$pdo->prepare('UPDATE users SET consilium_legion_id = NULL WHERE consilium_legion_id = ?')->execute([$id]);
|
|
$pdo->prepare('DELETE FROM consilium_legions WHERE id = ?')->execute([$id]);
|
|
$pdo->commit();
|
|
admin_log('🤝 ' . CONSILIUM_NAME . ': Legion gelöscht', ['Legion' => $old, 'Hinweis' => 'Ihre Mitglieder bleiben in ' . CONSILIUM_NAME . ', nur ohne Legion.'], 'danger');
|
|
set_flash('success', '„' . $old . '“ ist gelöscht.');
|
|
}
|
|
redirect($back);
|
|
|
|
case 'legion_move':
|
|
$rows = $pdo->query('SELECT id FROM consilium_legions ORDER BY sort_order, name')->fetchAll(PDO::FETCH_COLUMN);
|
|
$ids = array_map('intval', $rows);
|
|
$index = array_search($id, $ids, true);
|
|
$target = $index === false ? false : $index + (($_POST['direction'] ?? '') === 'up' ? -1 : 1);
|
|
if ($index !== false && isset($ids[$target])) {
|
|
[$ids[$index], $ids[$target]] = [$ids[$target], $ids[$index]];
|
|
$update = $pdo->prepare('UPDATE consilium_legions SET sort_order = ? WHERE id = ?');
|
|
foreach ($ids as $position => $legionId) {
|
|
$update->execute([($position + 1) * 10, $legionId]);
|
|
}
|
|
}
|
|
redirect($back);
|
|
|
|
case 'member_legion':
|
|
$userId = (int) ($_POST['user_id'] ?? 0);
|
|
$legionId = (int) ($_POST['legion_id'] ?? 0);
|
|
if (!consilium_is_member_account($userId)) {
|
|
set_flash('error', 'Dieses Konto gehört nicht zu ' . CONSILIUM_NAME . '.');
|
|
redirect($back);
|
|
}
|
|
if ($legionId > 0 && !consilium_legion_exists($legionId)) {
|
|
set_flash('error', 'Diese Legion gibt es nicht (mehr).');
|
|
redirect($back);
|
|
}
|
|
consilium_set_member_legion($userId, $legionId > 0 ? $legionId : null);
|
|
admin_log('🤝 ' . CONSILIUM_NAME . ': Mitglied zugeordnet', [
|
|
'Mitglied' => admin_log_user($userId),
|
|
'Legion' => $legionId > 0 ? (string) consilium_legion_name($legionId) : 'keine',
|
|
]);
|
|
set_flash('success', 'Zugeordnet.');
|
|
redirect($back);
|
|
}
|
|
|
|
redirect($back);
|