This commit is contained in:
Flatlogic Bot 2026-04-19 01:08:05 +00:00
parent 40f86c7597
commit 4c879b508b

663
index.php
View File

@ -62,6 +62,7 @@ $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);
$has_vanilla_db_access = $is_authenticated && in_array($session_cl_auth_right, ['member', 'moderator', 'admin'], true);
$scan_reference_rows = [];
$scan_reference_max_occurrence = 0;
@ -72,6 +73,18 @@ $ship_preset_error = null;
$item_custom_public_rows = [];
$item_custom_public_types = [];
$item_custom_public_error = null;
$vanilla_db_rows = [];
$vanilla_db_error = null;
$vanilla_db_search = '';
$vanilla_db_per_page = 10;
$vanilla_db_total_rows = 0;
$vanilla_db_total_pages = 1;
$vanilla_db_current_page = 1;
$vanilla_db_result_start = 0;
$vanilla_db_result_end = 0;
$vanilla_db_base_query = ['open_modal' => 'vanilla-db'];
$vanilla_db_reset_url = 'index.php?open_modal=vanilla-db';
$should_open_vanilla_db_modal = false;
try {
$db = db();
@ -261,6 +274,99 @@ if ($has_member_access) {
$item_custom_public_error = 'Impossible de charger les objets Item Custom pour le moment.';
}
}
if ($has_vanilla_db_access) {
$vanilla_db_search = trim((string) ($_GET['vanilla_search'] ?? ''));
$vanilla_db_current_page = max(1, (int) ($_GET['vanilla_page'] ?? 1));
$should_open_vanilla_db_modal = (
(isset($_GET['open_modal']) && (string) $_GET['open_modal'] === 'vanilla-db')
|| $vanilla_db_search !== ''
|| isset($_GET['vanilla_page'])
);
$vanilla_db_base_query = ['open_modal' => 'vanilla-db'];
if ($vanilla_db_search !== '') {
$vanilla_db_base_query['vanilla_search'] = $vanilla_db_search;
}
$vanilla_db_reset_url = 'index.php?' . http_build_query(['open_modal' => 'vanilla-db']);
try {
if (!isset($db) || !($db instanceof PDO)) {
$db = db();
}
$vanilla_db_where_sql = '';
$vanilla_db_bindings = [];
if ($vanilla_db_search !== '') {
$vanilla_db_where_sql = "
WHERE (
cl_scobjs_name LIKE :vanilla_search
OR cl_scobjs_type LIKE :vanilla_search
OR cl_scobjs_subtype LIKE :vanilla_search
OR cl_scobjs_uuid LIKE :vanilla_search
OR cl_scobjs_rarity LIKE :vanilla_search
)";
$vanilla_db_bindings[':vanilla_search'] = '%' . $vanilla_db_search . '%';
}
$stmt_vanilla_db_count = $db->prepare(
"SELECT COUNT(*)
FROM tbl_scobjs" . $vanilla_db_where_sql
);
foreach ($vanilla_db_bindings as $bindingName => $bindingValue) {
$stmt_vanilla_db_count->bindValue($bindingName, $bindingValue, PDO::PARAM_STR);
}
$stmt_vanilla_db_count->execute();
$vanilla_db_total_rows = (int) $stmt_vanilla_db_count->fetchColumn();
$vanilla_db_total_pages = max(1, (int) ceil($vanilla_db_total_rows / $vanilla_db_per_page));
$vanilla_db_current_page = min($vanilla_db_current_page, $vanilla_db_total_pages);
$vanilla_db_offset = ($vanilla_db_current_page - 1) * $vanilla_db_per_page;
$stmt_vanilla_db = $db->prepare(
"SELECT cl_scobjs_id, cl_scobjs_name, cl_scobjs_type, cl_scobjs_subtype, cl_scobjs_uuid, cl_scobjs_rarity
FROM tbl_scobjs" . $vanilla_db_where_sql . "
ORDER BY cl_scobjs_name ASC, cl_scobjs_type ASC, cl_scobjs_subtype ASC, cl_scobjs_id ASC
LIMIT :vanilla_limit OFFSET :vanilla_offset"
);
foreach ($vanilla_db_bindings as $bindingName => $bindingValue) {
$stmt_vanilla_db->bindValue($bindingName, $bindingValue, PDO::PARAM_STR);
}
$stmt_vanilla_db->bindValue(':vanilla_limit', $vanilla_db_per_page, PDO::PARAM_INT);
$stmt_vanilla_db->bindValue(':vanilla_offset', $vanilla_db_offset, PDO::PARAM_INT);
$stmt_vanilla_db->execute();
foreach ($stmt_vanilla_db->fetchAll() as $row) {
$name = trim((string) ($row['cl_scobjs_name'] ?? '')) ?: 'Objet inconnu';
$type = trim((string) ($row['cl_scobjs_type'] ?? '')) ?: '—';
$subtype = trim((string) ($row['cl_scobjs_subtype'] ?? '')) ?: '—';
$uuid = trim((string) ($row['cl_scobjs_uuid'] ?? '')) ?: '—';
$rarity = index_scan_normalize_rarity($row['cl_scobjs_rarity'] ?? '');
$vanilla_db_rows[] = [
'id' => (int) ($row['cl_scobjs_id'] ?? 0),
'name' => $name,
'type' => $type,
'subtype' => $subtype,
'uuid' => $uuid,
'image_url' => $uuid !== '—' ? 'https://cstone.space/uifimages/' . rawurlencode($uuid) . '.png' : null,
'rarity' => $rarity !== '' ? $rarity : '—',
'rarity_label' => $rarity !== '' ? index_scan_rarity_label($rarity) : 'Non définie',
'rarity_class' => index_scan_rarity_class($rarity),
];
}
if ($vanilla_db_total_rows > 0) {
$vanilla_db_result_start = $vanilla_db_offset + 1;
$vanilla_db_result_end = $vanilla_db_offset + count($vanilla_db_rows);
}
} catch (Throwable $e) {
$vanilla_db_error = 'Impossible de charger la base des objets pour le moment.';
}
}
?>
<!DOCTYPE html>
<html lang="fr">
@ -355,6 +461,12 @@ if ($has_member_access) {
letter-spacing: 0.06em;
text-transform: uppercase;
cursor: pointer;
text-decoration: none;
text-align: center;
}
.vanilla-db-search-btn {
background: rgba(162, 155, 120, 0.2);
}
.scan-reference-filter-btn:hover,
@ -502,6 +614,12 @@ if ($has_member_access) {
min-width: 1040px;
}
.modal-vanilla-db {
width: 92%;
max-width: 1440px;
min-width: 980px;
}
.item-custom-dialog {
display: flex;
flex-direction: column;
@ -1112,18 +1230,296 @@ if ($has_member_access) {
display: none;
}
.vanilla-db-dialog {
display: flex;
flex-direction: column;
background: linear-gradient(180deg, rgba(18, 22, 31, 0.98), rgba(8, 11, 18, 0.98));
border: 1px solid rgba(162, 155, 120, 0.35);
box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
max-height: min(88vh, 980px);
}
.vanilla-db-dialog h3 {
font-size: 1.75em;
letter-spacing: 0.08em;
}
.vanilla-db-dialog > div {
display: flex;
flex-direction: column;
flex: 1 1 auto;
min-height: 0;
overflow: hidden;
padding: 22px 26px 26px;
}
.vanilla-db-empty,
.vanilla-db-error {
margin: 0 0 18px;
padding: 12px 14px !important;
border-radius: 10px;
font-size: 0.95em;
text-align: left !important;
}
.vanilla-db-empty {
background: rgba(255, 255, 255, 0.06);
border: 1px solid rgba(255, 255, 255, 0.12);
}
.vanilla-db-error {
background: rgba(140, 32, 32, 0.18);
border: 1px solid rgba(255, 88, 88, 0.25);
color: #ffbdbd;
}
.vanilla-db-filter-bar {
display: flex;
align-items: center;
gap: 14px;
margin: 0 0 18px;
padding: 14px 16px;
border-radius: 14px;
background: rgba(255, 255, 255, 0.04);
border: 1px solid rgba(162, 155, 120, 0.18);
flex-wrap: wrap;
}
.vanilla-db-search-wrap {
display: flex;
align-items: center;
gap: 12px;
flex: 1 1 420px;
min-width: 260px;
}
.vanilla-db-search-input {
width: 100%;
padding: 10px 14px;
border-radius: 10px;
border: 1px solid rgba(162, 155, 120, 0.3);
background: rgba(10, 14, 21, 0.95);
color: #ffffff;
font-size: 0.92em;
}
.vanilla-db-search-input:focus-visible {
outline: 2px solid rgba(162, 155, 120, 0.45);
outline-offset: 2px;
}
.vanilla-db-search-btn,
.vanilla-db-reset-btn {
padding: 10px 14px;
border-radius: 999px;
border: 1px solid rgba(162, 155, 120, 0.34);
background: rgba(162, 155, 120, 0.1);
color: #f6f1dc;
font-size: 0.76em;
font-weight: 700;
letter-spacing: 0.08em;
text-transform: uppercase;
cursor: pointer;
text-decoration: none;
text-align: center;
}
.vanilla-db-search-btn {
background: rgba(162, 155, 120, 0.2);
}
.vanilla-db-status {
margin: 0 0 0 auto;
font-size: 0.85em;
color: rgba(255, 255, 255, 0.7);
text-align: right;
flex: 1 1 220px;
}
.vanilla-db-grid {
display: flex;
flex-direction: column;
flex: 1 1 auto;
gap: 8px;
min-height: clamp(320px, 54vh, 700px);
overflow-y: auto;
padding-right: 4px;
}
.vanilla-db-card {
grid-template-columns: 56px minmax(0, 1fr);
}
.vanilla-db-card-main {
display: flex;
flex-direction: column;
justify-content: center;
gap: 4px;
min-width: 0;
}
.vanilla-db-card-topline {
margin: 0;
color: rgba(255, 255, 255, 0.72);
font-size: 0.82em;
font-weight: 600;
letter-spacing: 0.05em;
text-transform: uppercase;
}
.vanilla-db-card-meta {
margin: 0;
color: rgba(255, 255, 255, 0.68);
font-size: 0.82em;
line-height: 1.35;
}
.vanilla-db-card-meta strong {
font-weight: 700;
color: rgba(255, 255, 255, 0.84);
}
.vanilla-db-card-meta span {
word-break: break-all;
}
.vanilla-db-card-details {
display: flex;
align-items: center;
justify-content: flex-end;
min-width: 0;
}
.vanilla-db-muted {
color: rgba(255, 255, 255, 0.45);
}
.item-custom-card-name.vanilla-db-item-name {
text-shadow: 0 0 10px rgba(255, 255, 255, 0.08);
}
.item-custom-card-name.vanilla-db-item-name.scan-rarity-L { color: #ff8000; }
.item-custom-card-name.vanilla-db-item-name.scan-rarity-E { color: #a335ee; }
.item-custom-card-name.vanilla-db-item-name.scan-rarity-R { color: #4db2ff; }
.item-custom-card-name.vanilla-db-item-name.scan-rarity-U { color: #1eff00; }
.item-custom-card-name.vanilla-db-item-name.scan-rarity-C { color: #ffffff; }
.item-custom-card-name.vanilla-db-item-name.scan-rarity-none { color: #b5bcc8; }
.vanilla-db-hover-preview {
position: fixed;
top: 0;
left: 0;
z-index: 10000;
display: none;
width: min(360px, calc(100vw - 32px));
padding: 6px;
border-radius: 12px;
border: 1px solid rgba(162, 155, 120, 0.42);
background: rgba(9, 13, 19, 0.98);
box-shadow: 0 18px 44px rgba(0, 0, 0, 0.58), 0 0 18px rgba(162, 155, 120, 0.18);
backdrop-filter: blur(14px);
pointer-events: none;
}
.vanilla-db-hover-preview.is-visible {
display: block;
}
.vanilla-db-hover-preview img {
display: block;
width: 100%;
height: auto;
max-height: min(360px, calc(100vh - 32px));
object-fit: contain;
border-radius: 8px;
background: rgba(255, 255, 255, 0.02);
}
.vanilla-db-pagination {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
margin-top: 16px;
padding: 14px 16px;
border-radius: 14px;
background: rgba(255, 255, 255, 0.04);
border: 1px solid rgba(162, 155, 120, 0.18);
flex-wrap: wrap;
}
.vanilla-db-pagination-pages {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: wrap;
}
.vanilla-db-pagination-summary {
margin: 0;
font-size: 0.84em;
color: rgba(255, 255, 255, 0.68);
}
.vanilla-db-page-link,
.vanilla-db-page-current,
.vanilla-db-page-ellipsis {
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 40px;
height: 40px;
padding: 0 12px;
border-radius: 999px;
font-size: 0.82em;
font-weight: 700;
letter-spacing: 0.04em;
}
.vanilla-db-page-link {
border: 1px solid rgba(162, 155, 120, 0.24);
background: rgba(162, 155, 120, 0.08);
color: #f6f1dc;
text-decoration: none;
}
.vanilla-db-page-link:hover,
.vanilla-db-page-link:focus-visible {
background: rgba(162, 155, 120, 0.18);
outline: none;
}
.vanilla-db-page-current {
border: 1px solid rgba(255, 255, 255, 0.18);
background: rgba(255, 255, 255, 0.12);
color: #ffffff;
}
.vanilla-db-page-ellipsis {
min-width: auto;
height: auto;
padding: 0 2px;
color: rgba(255, 255, 255, 0.45);
}
.vanilla-db-card.is-hidden-by-search {
display: none;
}
@media (max-width: 1100px) {
.modal-scan-reference,
.modal-ship-presets,
.modal-item-custom {
.modal-item-custom,
.modal-vanilla-db {
width: 96%;
min-width: 0;
}
.scan-reference-dialog h3,
.ship-presets-dialog h3,
.item-custom-dialog h3 {
.item-custom-dialog h3,
.vanilla-db-dialog h3 {
font-size: 1.2em;
}
@ -1140,6 +1536,15 @@ if ($has_member_access) {
align-items: stretch;
}
.vanilla-db-filter-bar {
align-items: stretch;
}
.vanilla-db-status {
margin-left: 0;
text-align: left;
}
.ship-presets-filter-status {
margin-left: 0;
text-align: left;
@ -1164,6 +1569,10 @@ if ($has_member_access) {
padding: 7px 10px;
}
.vanilla-db-card {
grid-template-columns: 52px minmax(220px, 1fr) minmax(140px, auto);
}
.item-custom-card-preview {
left: 62px;
}
@ -1188,7 +1597,8 @@ if ($has_member_access) {
.item-custom-filter-top,
.item-custom-search-wrap,
.item-custom-type-filters {
.item-custom-type-filters,
.vanilla-db-search-wrap {
flex-direction: column;
align-items: stretch;
}
@ -1203,6 +1613,11 @@ if ($has_member_access) {
gap: 8px;
}
.vanilla-db-card-main,
.vanilla-db-card-details {
grid-column: 1 / -1;
}
.item-custom-card-media {
width: 48px !important;
height: 48px !important;
@ -1238,11 +1653,18 @@ if ($has_member_access) {
</head>
<body>
<?php if ($has_member_access): ?>
<?php if ($has_member_access || $has_vanilla_db_access): ?>
<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">Objet(s) personnalisé(s)</a>
<?php if ($has_member_access): ?>
<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>
<?php endif; ?>
<?php if ($has_vanilla_db_access): ?>
<a href="#" class="md-trigger" data-modal="modal-VanillaDb">Objets Vanilla DB</a>
<?php endif; ?>
<?php if ($has_member_access): ?>
<a href="#" class="md-trigger" data-modal="modal-ItemCustom">Objet(s) personnalisé(s)</a>
<?php endif; ?>
</div>
<?php endif; ?>
@ -1464,6 +1886,120 @@ if ($has_member_access) {
<?php endif; ?>
<?php if ($has_vanilla_db_access): ?>
<div class="md-modal md-effect-1 modal-vanilla-db" id="modal-VanillaDb">
<div class="md-content vanilla-db-dialog">
<h3>
<img class="float-left" src="img/icon_bops.png" width="48" height="48" alt="" />
BASE DE DONNEES VANILLA
<a class="frame-icon-close md-close float-right" href="#"><img src="img/icon_close.png" width="48" height="48" alt="" /></a>
</h3>
<div>
<?php if ($vanilla_db_error !== null): ?>
<p class="vanilla-db-error"><?php echo htmlspecialchars($vanilla_db_error, ENT_QUOTES, 'UTF-8'); ?></p>
<?php else: ?>
<form class="vanilla-db-filter-bar" method="get" action="index.php">
<input type="hidden" name="open_modal" value="vanilla-db" />
<input type="hidden" name="vanilla_page" value="1" />
<div class="vanilla-db-search-wrap">
<input type="search" id="vanillaDbSearch" name="vanilla_search" class="vanilla-db-search-input" placeholder="Rechercher un objet, un type, un sous-type, une rareté ou un UUID..." autocomplete="off" value="<?php echo htmlspecialchars($vanilla_db_search, ENT_QUOTES, 'UTF-8'); ?>" />
<button type="submit" class="vanilla-db-search-btn">Rechercher</button>
<a href="<?php echo htmlspecialchars($vanilla_db_reset_url, ENT_QUOTES, 'UTF-8'); ?>" class="vanilla-db-reset-btn">Réinitialiser</a>
</div>
<p class="vanilla-db-status">
<?php if ($vanilla_db_total_rows > 0): ?>
Affichage de <strong><?php echo $vanilla_db_result_start; ?></strong> à <strong><?php echo $vanilla_db_result_end; ?></strong> sur <strong><?php echo $vanilla_db_total_rows; ?></strong> objet(s)<?php echo $vanilla_db_search !== '' ? ' pour « ' . htmlspecialchars($vanilla_db_search, ENT_QUOTES, 'UTF-8') . ' »' : ''; ?>.
<?php else: ?>
Aucun objet trouvé<?php echo $vanilla_db_search !== '' ? ' pour « ' . htmlspecialchars($vanilla_db_search, ENT_QUOTES, 'UTF-8') . ' »' : ''; ?>.
<?php endif; ?>
</p>
</form>
<?php if ($vanilla_db_rows === []): ?>
<p class="vanilla-db-empty">Aucun objet n'est actuellement enregistré dans la BASE D'OBJETS.</p>
<?php else: ?>
<div class="vanilla-db-grid" id="vanillaDbGrid">
<?php foreach ($vanilla_db_rows as $vanilla_db_row): ?>
<article class="item-custom-card vanilla-db-card">
<div class="item-custom-card-media<?php echo $vanilla_db_row['image_url'] === null ? ' is-image-missing' : ''; ?>"<?php if ($vanilla_db_row['image_url'] !== null): ?> data-preview-src="<?php echo htmlspecialchars($vanilla_db_row['image_url'], ENT_QUOTES, 'UTF-8'); ?>" data-preview-label="<?php echo htmlspecialchars($vanilla_db_row['name'], ENT_QUOTES, 'UTF-8'); ?>"<?php endif; ?>>
<?php if ($vanilla_db_row['image_url'] !== null): ?>
<img src="<?php echo htmlspecialchars($vanilla_db_row['image_url'], ENT_QUOTES, 'UTF-8'); ?>" class="item-custom-card-thumb" alt="Aperçu de <?php echo htmlspecialchars($vanilla_db_row['name'], ENT_QUOTES, 'UTF-8'); ?>" loading="lazy" onerror="this.closest('.item-custom-card-media').classList.add('is-image-missing'); this.remove();">
<?php endif; ?>
</div>
<div class="item-custom-card-main vanilla-db-card-main">
<p class="vanilla-db-card-topline"><?php echo htmlspecialchars($vanilla_db_row['type'], ENT_QUOTES, 'UTF-8'); ?><?php if ($vanilla_db_row['subtype'] !== '—'): ?> / <?php echo htmlspecialchars($vanilla_db_row['subtype'], ENT_QUOTES, 'UTF-8'); ?><?php endif; ?></p>
<h4 class="item-custom-card-name vanilla-db-item-name <?php echo htmlspecialchars($vanilla_db_row['rarity_class'], ENT_QUOTES, 'UTF-8'); ?>" title="<?php echo htmlspecialchars($vanilla_db_row['rarity_label'], ENT_QUOTES, 'UTF-8'); ?>"><?php echo htmlspecialchars($vanilla_db_row['name'], ENT_QUOTES, 'UTF-8'); ?></h4>
<p class="vanilla-db-card-meta"><?php if ($vanilla_db_row['uuid'] !== '—'): ?><strong>UUID :</strong> <span><?php echo htmlspecialchars($vanilla_db_row['uuid'], ENT_QUOTES, 'UTF-8'); ?></span><?php else: ?><span class="vanilla-db-muted">UUID : —</span><?php endif; ?></p>
</div>
</article>
<?php endforeach; ?>
</div>
<?php if ($vanilla_db_total_pages > 1): ?>
<?php
$vanilla_db_page_window_start = max(1, $vanilla_db_current_page - 2);
$vanilla_db_page_window_end = min($vanilla_db_total_pages, $vanilla_db_current_page + 2);
if (($vanilla_db_page_window_end - $vanilla_db_page_window_start) < 4) {
if ($vanilla_db_page_window_start === 1) {
$vanilla_db_page_window_end = min($vanilla_db_total_pages, 5);
} elseif ($vanilla_db_page_window_end === $vanilla_db_total_pages) {
$vanilla_db_page_window_start = max(1, $vanilla_db_total_pages - 4);
}
}
?>
<nav class="vanilla-db-pagination" aria-label="Pagination des objets vanilla">
<p class="vanilla-db-pagination-summary">Page <strong><?php echo $vanilla_db_current_page; ?></strong> sur <strong><?php echo $vanilla_db_total_pages; ?></strong>.</p>
<div class="vanilla-db-pagination-pages">
<?php if ($vanilla_db_current_page > 1): ?>
<?php $vanilla_db_page_query = $vanilla_db_base_query; $vanilla_db_page_query['vanilla_page'] = 1; ?>
<a class="vanilla-db-page-link" href="index.php?<?php echo htmlspecialchars(http_build_query($vanilla_db_page_query), ENT_QUOTES, 'UTF-8'); ?>">«</a>
<?php $vanilla_db_page_query = $vanilla_db_base_query; $vanilla_db_page_query['vanilla_page'] = $vanilla_db_current_page - 1; ?>
<a class="vanilla-db-page-link" href="index.php?<?php echo htmlspecialchars(http_build_query($vanilla_db_page_query), ENT_QUOTES, 'UTF-8'); ?>"></a>
<?php endif; ?>
<?php if ($vanilla_db_page_window_start > 1): ?>
<?php $vanilla_db_page_query = $vanilla_db_base_query; $vanilla_db_page_query['vanilla_page'] = 1; ?>
<a class="vanilla-db-page-link" href="index.php?<?php echo htmlspecialchars(http_build_query($vanilla_db_page_query), ENT_QUOTES, 'UTF-8'); ?>">1</a>
<?php if ($vanilla_db_page_window_start > 2): ?>
<span class="vanilla-db-page-ellipsis"></span>
<?php endif; ?>
<?php endif; ?>
<?php for ($vanilla_db_page_number = $vanilla_db_page_window_start; $vanilla_db_page_number <= $vanilla_db_page_window_end; $vanilla_db_page_number++): ?>
<?php if ($vanilla_db_page_number === $vanilla_db_current_page): ?>
<span class="vanilla-db-page-current"><?php echo $vanilla_db_page_number; ?></span>
<?php else: ?>
<?php $vanilla_db_page_query = $vanilla_db_base_query; $vanilla_db_page_query['vanilla_page'] = $vanilla_db_page_number; ?>
<a class="vanilla-db-page-link" href="index.php?<?php echo htmlspecialchars(http_build_query($vanilla_db_page_query), ENT_QUOTES, 'UTF-8'); ?>"><?php echo $vanilla_db_page_number; ?></a>
<?php endif; ?>
<?php endfor; ?>
<?php if ($vanilla_db_page_window_end < $vanilla_db_total_pages): ?>
<?php if ($vanilla_db_page_window_end < ($vanilla_db_total_pages - 1)): ?>
<span class="vanilla-db-page-ellipsis"></span>
<?php endif; ?>
<?php $vanilla_db_page_query = $vanilla_db_base_query; $vanilla_db_page_query['vanilla_page'] = $vanilla_db_total_pages; ?>
<a class="vanilla-db-page-link" href="index.php?<?php echo htmlspecialchars(http_build_query($vanilla_db_page_query), ENT_QUOTES, 'UTF-8'); ?>"><?php echo $vanilla_db_total_pages; ?></a>
<?php endif; ?>
<?php if ($vanilla_db_current_page < $vanilla_db_total_pages): ?>
<?php $vanilla_db_page_query = $vanilla_db_base_query; $vanilla_db_page_query['vanilla_page'] = $vanilla_db_current_page + 1; ?>
<a class="vanilla-db-page-link" href="index.php?<?php echo htmlspecialchars(http_build_query($vanilla_db_page_query), ENT_QUOTES, 'UTF-8'); ?>"></a>
<?php $vanilla_db_page_query = $vanilla_db_base_query; $vanilla_db_page_query['vanilla_page'] = $vanilla_db_total_pages; ?>
<a class="vanilla-db-page-link" href="index.php?<?php echo htmlspecialchars(http_build_query($vanilla_db_page_query), ENT_QUOTES, 'UTF-8'); ?>">»</a>
<?php endif; ?>
</div>
</nav>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>
</div>
</div>
</div>
<?php endif; ?>
<?php if ($has_member_access): ?>
<div class="md-modal md-effect-1 modal-scan-reference" id="modal-ScanReference">
<div class="md-content scan-reference-dialog">
@ -1705,6 +2241,119 @@ if ($has_member_access) {
</script>
<script>
(function initVanillaDbModalState() {
const shouldOpen = <?php echo $should_open_vanilla_db_modal ? 'true' : 'false'; ?>;
const modal = document.getElementById('modal-VanillaDb');
const searchInput = document.getElementById('vanillaDbSearch');
if (!shouldOpen || !modal || typeof classie === 'undefined') {
return;
}
classie.add(modal, 'md-show');
if (searchInput) {
window.requestAnimationFrame(function () {
searchInput.focus();
searchInput.setSelectionRange(searchInput.value.length, searchInput.value.length);
});
}
})();
</script>
<script>
(function initVanillaDbImagePreview() {
const modal = document.getElementById('modal-VanillaDb');
if (!modal) {
return;
}
const mediaNodes = Array.from(modal.querySelectorAll('.item-custom-card-media[data-preview-src]'));
if (mediaNodes.length === 0) {
return;
}
let preview = document.getElementById('vanillaDbImagePreview');
if (!preview) {
preview = document.createElement('div');
preview.id = 'vanillaDbImagePreview';
preview.className = 'vanilla-db-hover-preview';
preview.setAttribute('aria-hidden', 'true');
preview.innerHTML = '<img alt="">';
document.body.appendChild(preview);
}
const previewImage = preview.querySelector('img');
let activeNode = null;
function movePreview(event) {
if (!activeNode || !preview.classList.contains('is-visible')) {
return;
}
const offset = 22;
const bounds = preview.getBoundingClientRect();
let left = event.clientX + offset;
let top = event.clientY + offset;
if ((left + bounds.width) > (window.innerWidth - 16)) {
left = event.clientX - bounds.width - offset;
}
if ((top + bounds.height) > (window.innerHeight - 16)) {
top = event.clientY - bounds.height - offset;
}
left = Math.max(8, left);
top = Math.max(8, top);
preview.style.transform = 'translate(' + left + 'px, ' + top + 'px)';
}
function hidePreview() {
activeNode = null;
preview.classList.remove('is-visible');
preview.style.transform = 'translate(-9999px, -9999px)';
previewImage.removeAttribute('src');
previewImage.alt = '';
}
function showPreview(node, event) {
const src = node.dataset.previewSrc || '';
if (src === '') {
return;
}
activeNode = node;
previewImage.src = src;
previewImage.alt = node.dataset.previewLabel || '';
preview.classList.add('is-visible');
movePreview(event);
}
previewImage.addEventListener('error', hidePreview);
window.addEventListener('scroll', hidePreview, { passive: true });
window.addEventListener('resize', hidePreview);
mediaNodes.forEach(function (node) {
node.addEventListener('mouseenter', function (event) {
showPreview(node, event);
});
node.addEventListener('mousemove', movePreview);
node.addEventListener('mouseleave', hidePreview);
node.addEventListener('focusin', function () {
const rect = node.getBoundingClientRect();
showPreview(node, {
clientX: rect.right,
clientY: rect.top
});
});
node.addEventListener('focusout', hidePreview);
});
})();
</script>
<script>
(function initItemCustomSearch() {
const searchInput = document.getElementById('itemCustomSearch');