diff --git a/admin.php b/admin.php index 16faec9..bfbddf3 100644 --- a/admin.php +++ b/admin.php @@ -59,12 +59,15 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST[' } } + $orbital_enabled = isset($_POST["orbital_control_enabled"]) ? 1 : 0; + $terrestrial_enabled = isset($_POST["terrestrial_control_enabled"]) ? 1 : 0; + if ($id > 0) { - $stmt = $db->prepare("UPDATE celestial_object_types SET name = ?, slug = ?, icon = ?, description = ?, image_url = ? WHERE id = ?"); - $stmt->execute([$name, $slug, $icon, $description, $image_url, $id]); + $stmt = $db->prepare("UPDATE celestial_object_types SET name = ?, slug = ?, icon = ?, description = ?, image_url = ?, orbital_control_enabled = ?, terrestrial_control_enabled = ? WHERE id = ?"); + $stmt->execute([$name, $slug, $icon, $description, $image_url, $orbital_enabled, $terrestrial_enabled, $id]); } else { - $stmt = $db->prepare("INSERT INTO celestial_object_types (name, slug, icon, description, image_url) VALUES (?, ?, ?, ?, ?)"); - $stmt->execute([$name, $slug, $icon, $description, $image_url]); + $stmt = $db->prepare("INSERT INTO celestial_object_types (name, slug, icon, description, image_url, orbital_control_enabled, terrestrial_control_enabled) VALUES (?, ?, ?, ?, ?, ?, ?)"); + $stmt->execute([$name, $slug, $icon, $description, $image_url, $orbital_enabled, $terrestrial_enabled]); $id = $db->lastInsertId(); } @@ -319,6 +322,32 @@ if (isset($_GET['delete_lootbox'])) { exit; } + +// Handle Project Log CRUD +if ($_SERVER["REQUEST_METHOD"] === "POST" && isset($_POST["action"]) && $_POST["action"] === "upsert_project_log") { + $id = (int)$_POST["id"]; + $version = $_POST["version"]; + $title = $_POST["title"]; + $content_log = $_POST["content"]; + + if ($id > 0) { + $stmt = $db->prepare("UPDATE project_logs SET version = ?, title = ?, content = ? WHERE id = ?"); + $stmt->execute([$version, $title, $content_log, $id]); + } else { + $stmt = $db->prepare("INSERT INTO project_logs (version, title, content) VALUES (?, ?, ?)"); + $stmt->execute([$version, $title, $content_log]); + } + header("Location: admin.php?tab=project_logs&success=1"); + exit; +} + +if (isset($_GET["delete_project_log"])) { + $id = (int)$_GET["delete_project_log"]; + $db->prepare("DELETE FROM project_logs WHERE id = ?")->execute([$id]); + header("Location: admin.php?tab=project_logs&success=1"); + exit; +} + // --- DATA FETCHING --- $users_list = []; $objects_list = []; @@ -328,6 +357,7 @@ $modifiers_list = []; $factions_list = []; $resources_list = []; $lootboxes_list = []; +$project_logs_list = []; if ($tab === 'users') { $users_list = $db->query("SELECT id, username, email, role FROM users ORDER BY username ASC")->fetchAll(); @@ -356,6 +386,8 @@ if ($tab === 'users') { unset($f); } elseif ($tab === 'resources') { $resources_list = $db->query("SELECT * FROM game_resources ORDER BY name ASC")->fetchAll(); +} elseif ($tab === 'project_logs') { + $project_logs_list = $db->query("SELECT * FROM project_logs ORDER BY created_at DESC")->fetchAll(); } elseif ($tab === 'lootboxes') { $lootboxes_list = $db->query("SELECT * FROM lootboxes ORDER BY name ASC")->fetchAll(); $resources_list = $db->query("SELECT name, slug FROM game_resources ORDER BY name ASC")->fetchAll(); @@ -369,6 +401,8 @@ if ($tab === 'users') { $lb['items'] = $stmt_i->fetchAll(); } unset($lb); +} elseif ($tab === "project_logs") { + $project_logs_list = $db->query("SELECT * FROM project_logs ORDER BY created_at DESC")->fetchAll(); } ?> @@ -436,7 +470,7 @@ if ($tab === 'users') {
| Visuel | Nom | Bonus/Malus | Slug | Actions | |
|---|---|---|---|---|---|
| Visuel | Nom | Contrôles | Bonus/Malus | Slug | Actions |
| + |
+
+
+ ORBITAL
+
+
+ TERRESTRE
+
+
+ |
prepare("SELECT m.name, m.type FROM modifiers m JOIN celestial_object_type_modifiers cotm ON m.id = cotm.modifier_id WHERE cotm.celestial_object_type_id = ?");
@@ -850,6 +906,17 @@ if ($tab === 'users') {
+
+
+
+
+
+
+
+
+
+
+
@@ -897,7 +964,61 @@ if ($tab === 'users') {
|
| Version | Titre | Date | Actions |
|---|---|---|---|
| v | ++ | + | + + SUPPR + | +