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') {

CONSOLE ADMIN

@@ -458,6 +492,7 @@ if ($tab === 'users') { Types d'Établissements Factions Ressources + "> Journal de Bord Lootboxes @@ -520,6 +555,17 @@ if ($tab === 'users') { +
+
+ + +
+
+ + +
+
+
@@ -546,7 +592,7 @@ if ($tab === 'users') {
- + @@ -558,6 +604,16 @@ if ($tab === 'users') { +
VisuelNomBonus/MalusSlugActions
VisuelNomContrôlesBonus/MalusSlugActions
+
+ + 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') {
- + + +

Journal de Bord (Versions)

+
+

Ajouter / Modifier une Version

+
+ + +
+
+ + +
+
+ + +
+
+
+ + +
+ + +
+
+ + + + + + + + + + + + +
VersionTitreDateActions
v + + SUPPR +
+ +

Système de Lootboxes

Créer / Modifier une Lootbox

@@ -1030,6 +1151,8 @@ if ($tab === 'users') { document.getElementById('obj_slug').value = data.slug; document.getElementById('obj_icon').value = data.icon; document.getElementById('obj_desc').value = data.description; + document.getElementById('obj_orbital_enabled').checked = data.orbital_control_enabled == 1; + document.getElementById('obj_terrestrial_enabled').checked = data.terrestrial_control_enabled == 1; document.querySelectorAll('.modifier-checkbox').forEach(cb => cb.checked = false); if (data.modifier_ids) { data.modifier_ids.forEach(mid => { diff --git a/assets/pasted-20260225-191424-09452e8a.png b/assets/pasted-20260225-191424-09452e8a.png new file mode 100644 index 0000000..b85b96f Binary files /dev/null and b/assets/pasted-20260225-191424-09452e8a.png differ diff --git a/db/migrate_project_logs.php b/db/migrate_project_logs.php new file mode 100644 index 0000000..ae3f6de --- /dev/null +++ b/db/migrate_project_logs.php @@ -0,0 +1,27 @@ +exec($sql); + echo "Table 'project_logs' created successfully.\n"; + + // Insert initial version + $stmt = $db->prepare("INSERT INTO project_logs (version, title, content) VALUES (?, ?, ?)"); + $stmt->execute(['1.0.0', 'Initial Release', 'Welcome to the project log. This is the first version of the galaxy management system.']); + echo "Initial log entry inserted.\n"; + +} catch (PDOException $e) { + echo "Error creating table: " . $e->getMessage() . "\n"; +} + diff --git a/gm_console.php b/gm_console.php index 3cacda8..ef19e62 100644 --- a/gm_console.php +++ b/gm_console.php @@ -22,6 +22,7 @@ $is_admin = ($current_user['role'] === 'admin'); // Fetch Dynamic Types, Statuses, Settlement Types, and Factions $object_types_db = $db->query("SELECT * FROM celestial_object_types ORDER BY name ASC")->fetchAll(PDO::FETCH_ASSOC); +$object_types_map = []; foreach($object_types_db as $ot) { $object_types_map[$ot["slug"]] = $ot; } $statuses_db = $db->query("SELECT * FROM celestial_object_statuses ORDER BY id ASC")->fetchAll(PDO::FETCH_ASSOC); $settlement_types_db = $db->query("SELECT * FROM settlement_types ORDER BY name ASC")->fetchAll(PDO::FETCH_ASSOC); $factions_db = $db->query("SELECT * FROM factions ORDER BY name ASC")->fetchAll(PDO::FETCH_ASSOC); @@ -416,7 +417,7 @@ function getStatusColor($status, $type, $statuses_map, $object_types_map) {

CONSOLE MJ

- @@ -544,14 +545,14 @@ function getStatusColor($status, $type, $statuses_map, $object_types_map) {
-
+
-
+
@@ -598,6 +599,7 @@ function getStatusColor($status, $type, $statuses_map, $object_types_map) {