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_h = ' $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_h) !== false) { $content = str_replace($old_h, $new_h, $content); echo "Handler updated.\n"; } else { echo "Handler NOT found (check whitespace/indentation).\n"; } // 2. Update UI $ui_block_start = '
'; $ui_block_end = ''; $pos_start = strpos($content, $ui_block_start); $pos_end = strpos($content, $ui_block_end, $pos_start); if ($pos_start !== false && $pos_end !== false) { $new_ui = <<<'HTML'
EN ORBITE
Toutes / Peu importe
(Orbital) [?] (Sol)
AU SOL
Toutes / Peu importe
HTML; $content = substr($content, 0, $pos_start) . $new_ui . substr($content, $pos_end); echo "UI updated.\n"; } else { echo "UI NOT found.\n"; } // 3. Update JS (resetRuleForm) if (strpos($content, "document.getElementById('rule_combine').value = 'OR';") === false) { $content = str_replace( "document.getElementById('rule_id').value = 0;", "document.getElementById('rule_id').value = 0; document.getElementById('rule_combine').value = 'OR';", $content ); echo "JS updated.\n"; } file_put_contents($file, $content); echo "Done.\n"; ?>