0) { $stmt = $db->prepare("UPDATE celestial_object_status_rules SET name = ?, status_id = ?, profile_id = ?, priority = ?, orbital_count_op = ?, orbital_count_val = ?, terrestrial_count_op = ?, terrestrial_count_val = ?, orbital_dominance = ?, terrestrial_dominance = ?, is_empty_case = ? WHERE id = ?"); $stmt->execute([$name, $status_id, $profile_id, $priority, $orbital_count_op, $orbital_count_val, $terrestrial_count_op, $terrestrial_count_val, $orbital_dominance, $terrestrial_dominance, $is_empty_case, $id]); } else { $stmt = $db->prepare("INSERT INTO celestial_object_status_rules (name, status_id, profile_id, priority, orbital_count_op, orbital_count_val, terrestrial_count_op, terrestrial_count_val, orbital_dominance, terrestrial_dominance, is_empty_case) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); $stmt->execute([$name, $status_id, $profile_id, $priority, $orbital_count_op, $orbital_count_val, $terrestrial_count_op, $terrestrial_count_val, $orbital_dominance, $terrestrial_dominance, $is_empty_case]); }'; $handlerNew = '$terrestrial_dominance = isset($_POST[\'terrestrial_dominance\']) ? implode(\'\',\',(array)$_POST[\'terrestrial_dominance\']) : null; $is_empty_case = isset($_POST[\'is_empty_case\']) ? 1 : 0; $combine_mode = $_POST[\'combine_mode\'] ?? \'OR\'; if ($id > 0) { $stmt = $db->prepare("UPDATE celestial_object_status_rules SET name = ?, status_id = ?, profile_id = ?, priority = ?, orbital_count_op = ?, orbital_count_val = ?, terrestrial_count_op = ?, terrestrial_count_val = ?, orbital_dominance = ?, terrestrial_dominance = ?, is_empty_case = ?, combine_mode = ? WHERE id = ?"); $stmt->execute([$name, $status_id, $profile_id, $priority, $orbital_count_op, $orbital_count_val, $terrestrial_count_op, $terrestrial_count_val, $orbital_dominance, $terrestrial_dominance, $is_empty_case, $combine_mode, $id]); } else { $stmt = $db->prepare("INSERT INTO celestial_object_status_rules (name, status_id, profile_id, priority, orbital_count_op, orbital_count_val, terrestrial_count_op, terrestrial_count_val, orbital_dominance, terrestrial_dominance, is_empty_case, combine_mode) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); $stmt->execute([$name, $status_id, $profile_id, $priority, $orbital_count_op, $orbital_count_val, $terrestrial_count_op, $terrestrial_count_val, $orbital_dominance, $terrestrial_dominance, $is_empty_case, $combine_mode]); }'; $content = str_replace($handlerOld, $handlerNew, $content); // 2. Update UI $uiOld = '
NOMBRE DE FACTIONS :
FILTRE DOMINANCE :
Toutes / Peu importe
Toutes / Peu importe
'; $uiNew = '
EN ORBITE
Toutes / Peu importe
AU SOL
Toutes / Peu importe
'; $content = str_replace($uiOld, $uiNew, $content); // 3. Update JS (editRule) $jsOld = ' document.getElementById(\'rule_empty\').checked = data.is_empty_case == 1; window.scrollTo(0,0); }'; $jsNew = ' document.getElementById(\'rule_empty\').checked = data.is_empty_case == 1; document.getElementById(\'rule_combine\').value = data.combine_mode || "OR"; window.scrollTo(0,0); }'; $content = str_replace($jsOld, $jsNew, $content); file_put_contents($file, $content); echo "admin.php updated successfully.\n";