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]); } '; $new_handler = '$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]); } '; if (strpos($content, $old_handler) !== false) { $content = str_replace($old_handler, $new_handler, $content); echo "Handler patched.\n"; } else { echo "Handler NOT found.\n"; } // 2. Update UI (Configuration des règles) $start_marker = '
'; $end_marker = 'ENREGISTRER LA RÈGLE'; $pos_start = strpos($content, $start_marker); $pos_end = strpos($content, $end_marker, $pos_start); if ($pos_start !== false && $pos_end !== false) { // We want to replace everything from $start_marker up to just before "ENREGISTRER LA RÈGLE" button // Actually the UI I prepared includes the background div. $new_ui = <<<'HTML'
EN ORBITE
Toutes / Peu importe
(Orbital) [?] (Sol)
AU SOL
Toutes / Peu importe
HTML; // Find where the background div ends (it should be before the button) // We can find the button and look backwards for the last
before it. $pos_button = strpos($content, '