Autosave: 20260306-023935

This commit is contained in:
Flatlogic Bot 2026-03-06 02:39:36 +00:00
parent 3567b3666d
commit 75d2011a63

View File

@ -304,7 +304,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['
$stmt = $db->prepare("UPDATE factions SET name = ?, slug = ?, image_url = ?, fa_icon = ?, color = ? WHERE id = ?");
$stmt->execute([$name, $slug, $image_url, $fa_icon, $color, $id]);
} else {
$stmt = $db->prepare("INSERT INTO factions (name, slug, image_url, fa_icon, color) VALUES (?, ?, ?, ?, ?)");
$stmt = $db->prepare("INSERT INTO factions (name, slug, image_url, fa_icon, color) VALUES (?, ?, ?, ?, ?, ?)");
$stmt->execute([$name, $slug, $image_url, $fa_icon, $color]);
$id = $db->lastInsertId();
}
@ -454,11 +454,18 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['
try {
if ($id > 0) {
$stmt = db()->prepare("UPDATE grades SET name = ?, slug = ?, user_type = ?, min_level = ?, max_level = ? WHERE id = ?");
$stmt->execute([$name, $slug, $user_type, $min_level, $max_level, $id]);
$stmt = db()->prepare("UPDATE grades SET name = ?, slug = ?, user_type = ?, min_level = ?, max_level = ?, image_url = COALESCE(?, image_url) WHERE id = ?");
$image_url = null;
if (!empty($_FILES["image"]["name"])) {
$ext = pathinfo($_FILES["image"]["name"], PATHINFO_EXTENSION);
$filename = "grade_" . time() . "_" . uniqid() . "." . $ext;
move_uploaded_file($_FILES["image"]["tmp_name"], "assets/images/grades/" . $filename);
$image_url = "assets/images/grades/" . $filename;
}
$stmt->execute([$name, $slug, $user_type, $min_level, $max_level, $image_url, $id]);
} else {
$stmt = db()->prepare("INSERT INTO grades (name, slug, user_type, min_level, max_level) VALUES (?, ?, ?, ?, ?)");
$stmt->execute([$name, $slug, $user_type, $min_level, $max_level]);
$stmt = db()->prepare("INSERT INTO grades (name, slug, user_type, min_level, max_level) VALUES (?, ?, ?, ?, ?, ?)");
$stmt->execute([$name, $slug, $user_type, $min_level, $max_level, $image_url]);
}
header('Location: ?tab=ranks&success=1');
exit;
@ -828,7 +835,7 @@ if ($tab === 'users') {
<table>
<thead>
<tr>
<th>Nom</th>
<th>Image</th><th>Nom</th>
<th>Slug</th>
<th>Ressource requise</th>
<th>Quantité requise</th>
@ -837,7 +844,7 @@ if ($tab === 'users') {
</thead>
<tbody>
<?php if (empty($levels_list)): ?>
<tr><td colspan="5" style="text-align: center; color: #8c92a3;">Aucun niveau configuré.</td></tr>
<tr><td colspan="6" style="text-align: center; color: #8c92a3;">Aucun niveau configuré.</td></tr>
<?php else: ?>
<?php foreach ($levels_list as $lvl): ?>
<tr>
@ -869,7 +876,11 @@ if ($tab === 'users') {
<div class="form-card">
<h4>Ajouter / Modifier un Grade</h4>
<form method="POST" id="rankForm">
<div class="form-group" style="flex: 1;">
<label>Image (PNG) - Optionnel</label>
<input type="file" name="image" accept="image/png">
</div>
<form method="POST" id="rankForm" enctype="multipart/form-data">
<input type="hidden" name="action" value="upsert_grade">
<input type="hidden" name="id" id="rank_id" value="0">
<div style="display: flex; gap: 20px; margin-bottom: 15px;">
@ -910,7 +921,7 @@ if ($tab === 'users') {
<table>
<thead>
<tr>
<th>Nom</th>
<th>Image</th><th>Nom</th>
<th>Slug</th>
<th>Type</th>
<th>Intervalle Niveau</th>
@ -919,11 +930,11 @@ if ($tab === 'users') {
</thead>
<tbody>
<?php if (empty($ranks_list)): ?>
<tr><td colspan="5" style="text-align: center;">Aucun grade configuré.</td></tr>
<tr><td colspan="6" style="text-align: center;">Aucun grade configuré.</td></tr>
<?php else: ?>
<?php foreach ($ranks_list as $r): ?>
<tr>
<td><strong><?php echo htmlspecialchars($r['name']); ?></strong></td>
<td><img src="<?php echo htmlspecialchars($r[.image_url.]); ?>" style="width:40px;"></td><td><strong><?php echo htmlspecialchars($r[.name.]); ?></strong></td>
<td><code><?php echo htmlspecialchars($r['slug']); ?></code></td>
<td>
<span class="badge <?php echo $r['user_type'] === 'admin' ? 'tag-malus' : ($r['user_type'] === 'GM' ? 'tag-bonus' : ''); ?>"
@ -1059,7 +1070,7 @@ if ($tab === 'users') {
</div>
<table>
<thead><tr><th>Visuel</th><th>Nom</th><th>Contrôles</th><th>Règles</th><th>Bonus/Malus</th><th>Actions</th></tr></thead>
<thead><tr><th>Visuel</th><th>Image</th><th>Nom</th><th>Contrôles</th><th>Règles</th><th>Bonus/Malus</th><th>Actions</th></tr></thead>
<tbody>
<?php foreach ($objects_list as $o): ?>
<tr>
@ -1142,7 +1153,7 @@ if ($tab === 'users') {
</div>
<table>
<thead><tr><th>Type</th><th>Nom</th><th>Description</th><th>Slug</th><th>Actions</th></tr></thead>
<thead><tr><th>Type</th><th>Image</th><th>Nom</th><th>Description</th><th>Slug</th><th>Actions</th></tr></thead>
<tbody>
<?php foreach ($modifiers_list as $m): ?>
<tr>
@ -1207,7 +1218,7 @@ if ($tab === 'users') {
</div>
<table>
<thead><tr><th>Couleur</th><th>Nom</th><th>Slug</th><th>Actions</th></tr></thead>
<thead><tr><th>Couleur</th><th>Image</th><th>Nom</th><th>Slug</th><th>Actions</th></tr></thead>
<tbody>
<?php foreach ($statuses_list as $s): ?>
<tr>
@ -1461,7 +1472,7 @@ if ($tab === 'users') {
</div>
<table>
<thead><tr><th>Nom</th><th>Slug</th><th>Description</th><th>Actions</th></tr></thead>
<thead><tr><th>Image</th><th>Nom</th><th>Slug</th><th>Description</th><th>Actions</th></tr></thead>
<tbody>
<?php foreach ($settlement_types_list as $st): ?>
<tr>
@ -1530,7 +1541,7 @@ if ($tab === 'users') {
</div>
<table>
<thead><tr><th>Couleur</th><th>Visuel</th><th>Nom</th><th>Slug</th><th>Alliances</th><th>Actions</th></tr></thead>
<thead><tr><th>Couleur</th><th>Visuel</th><th>Image</th><th>Nom</th><th>Slug</th><th>Alliances</th><th>Actions</th></tr></thead>
<tbody>
<?php foreach ($factions_list as $f): ?>
<tr>
@ -1616,7 +1627,7 @@ if ($tab === 'users') {
</div>
<table>
<thead><tr><th>Visuel</th><th>Nom</th><th>Slug</th><th>Header?</th><th>Actions</th></tr></thead>
<thead><tr><th>Visuel</th><th>Image</th><th>Nom</th><th>Slug</th><th>Header?</th><th>Actions</th></tr></thead>
<tbody>
<?php foreach ($resources_list as $r): ?>
<tr>
@ -1629,7 +1640,7 @@ if ($tab === 'users') {
<i class="fa-solid fa-gem fa-lg" style="color: #4c566a;"></i>
<?php endif; ?>
</td>
<td><strong><?php echo htmlspecialchars($r['name']); ?></strong></td>
<td><img src="<?php echo htmlspecialchars($r[.image_url.]); ?>" style="width:40px;"></td><td><strong><?php echo htmlspecialchars($r[.name.]); ?></strong></td>
<td><code><?php echo htmlspecialchars($r['slug']); ?></code></td>
<td style="text-align: center;">
<?php if ($r['show_in_header']): ?>
@ -1861,7 +1872,7 @@ document.addEventListener('DOMContentLoaded', function() {
</div>
<table>
<thead><tr><th>Nom</th><th>Slug</th><th>Objets Directs (100%)</th><th>Nb Total (%)</th><th>Pool Aléatoire (%)</th><th>Actions</th></tr></thead>
<thead><tr><th>Image</th><th>Nom</th><th>Slug</th><th>Objets Directs (100%)</th><th>Nb Total (%)</th><th>Pool Aléatoire (%)</th><th>Actions</th></tr></thead>
<tbody>
<?php foreach ($lootboxes_list as $lb): ?>
<tr>