This commit is contained in:
Flatlogic Bot 2026-04-09 17:17:49 +00:00
parent f935801556
commit d7ffc291ac
2 changed files with 38 additions and 21 deletions

View File

@ -61,6 +61,7 @@ auth_bootstrap();
$session_cl_auth_user = isset($_SESSION['user']) ? (string) $_SESSION['user'] : '';
$session_cl_auth_right = isset($_SESSION['role']) ? (string) $_SESSION['role'] : '';
$is_authenticated = $session_cl_auth_user !== '';
$has_member_access = $is_authenticated && in_array($session_cl_auth_right, ['member', 'admin'], true);
$scan_reference_rows = [];
$scan_reference_max_occurrence = 0;
@ -127,12 +128,13 @@ try {
$scan_reference_error = 'Impossible de charger le tableau des signatures de scan pour le moment.';
}
try {
if (!isset($db) || !($db instanceof PDO)) {
$db = db();
}
if ($has_member_access) {
try {
if (!isset($db) || !($db instanceof PDO)) {
$db = db();
}
$stmt_ship_presets = $db->query(
$stmt_ship_presets = $db->query(
"SELECT cl_scpreset_id, cl_scpreset_name, cl_scpreset_manufacturer, cl_scpreset_description, cl_scpreset_link, cl_scpreset_creator
FROM tbl_scpreset
ORDER BY cl_scpreset_manufacturer ASC, cl_scpreset_name ASC"
@ -157,13 +159,15 @@ try {
];
}
natcasesort($ship_preset_manufacturers);
$ship_preset_manufacturers = array_values($ship_preset_manufacturers);
} catch (Throwable $e) {
$ship_preset_error = 'Impossible de charger les presets de vaisseaux pour le moment.';
natcasesort($ship_preset_manufacturers);
$ship_preset_manufacturers = array_values($ship_preset_manufacturers);
} catch (Throwable $e) {
$ship_preset_error = 'Impossible de charger les presets de vaisseaux pour le moment.';
}
}
try {
if ($has_member_access) {
try {
if (!isset($db) || !($db instanceof PDO)) {
$db = db();
}
@ -234,15 +238,16 @@ try {
}
}
foreach ($grouped_item_custom_public as $item_custom_public_row) {
$item_custom_public_row['search'] = trim(implode(' ', array_filter($item_custom_public_row['search_parts'], static function ($value) {
return trim((string) $value) !== '';
})));
unset($item_custom_public_row['search_parts']);
$item_custom_public_rows[] = $item_custom_public_row;
foreach ($grouped_item_custom_public as $item_custom_public_row) {
$item_custom_public_row['search'] = trim(implode(' ', array_filter($item_custom_public_row['search_parts'], static function ($value) {
return trim((string) $value) !== '';
})));
unset($item_custom_public_row['search_parts']);
$item_custom_public_rows[] = $item_custom_public_row;
}
} catch (Throwable $e) {
$item_custom_public_error = 'Impossible de charger les objets Item Custom pour le moment.';
}
} catch (Throwable $e) {
$item_custom_public_error = 'Impossible de charger les objets Item Custom pour le moment.';
}
?>
<!DOCTYPE html>
@ -991,8 +996,10 @@ try {
<body>
<div class="assets-div-menu">
<a href="#" class="md-trigger" data-modal="modal-ScanReference">Signatures de minage</a>
<a href="#" class="md-trigger" data-modal="modal-ShipPresets">Presets de vaisseaux</a>
<a href="#" class="md-trigger" data-modal="modal-ItemCustom">Item Custom</a>
<?php if ($has_member_access): ?>
<a href="#" class="md-trigger" data-modal="modal-ShipPresets">Presets de vaisseaux</a>
<a href="#" class="md-trigger" data-modal="modal-ItemCustom">Item Custom</a>
<?php endif; ?>
</div>
<div class="connexion-div-menu <?php echo $is_authenticated ? 'is-authenticated' : 'md-trigger'; ?>" data-login-label="Connexion" <?php echo $is_authenticated ? '' : 'data-modal="modal-Login"'; ?> id="accountPanel">
@ -1057,6 +1064,7 @@ try {
</div>
</div>
<?php if ($has_member_access): ?>
<div class="md-modal md-effect-1 modal-ship-presets" id="modal-ShipPresets">
<div class="md-content ship-presets-dialog">
<h3>
@ -1106,7 +1114,10 @@ try {
</div>
</div>
<?php endif; ?>
<?php if ($has_member_access): ?>
<div class="md-modal md-effect-1 modal-item-custom" id="modal-ItemCustom">
<div class="md-content item-custom-dialog">
<h3>
@ -1174,6 +1185,8 @@ try {
</div>
</div>
<?php endif; ?>
<div class="md-modal md-effect-1 modal-scan-reference" id="modal-ScanReference">
<div class="md-content scan-reference-dialog">
<h3>

View File

@ -100,7 +100,10 @@
renderAuthenticated(result.payload.user, result.payload.role, result.payload.adminUrl, result.payload.logoutUrl);
setStatus(result.payload.message || 'Connexion réussie.', false);
loginForm.reset();
window.setTimeout(closeModal, 250);
window.setTimeout(function () {
closeModal();
window.location.reload();
}, 250);
})
.catch(function (error) {
setStatus(error.message || 'Connexion impossible.', true);
@ -122,6 +125,7 @@
.then(function () {
renderLoggedOut(accountPanel.dataset.loginLabel || 'Connexion');
setStatus('', false);
window.location.reload();
})
.catch(function () {
window.location.href = logoutLink.href;