<?php
$content = file_get_contents('admin.php');

$oldOrb = 'if($r[\'orbital_dominance_mode\'] !== \'ANY\') $conds[] = "Orbital " . $r[\'orbital_dominance_mode\'] . " [...]"';
$newOrb = 'if(!empty($r[\'orbital_dominant_factions\'])) $conds[] = "Orbital IN (" . $r[\'orbital_dominant_factions\'] . ")"';
$content = str_replace($oldOrb, $newOrb, $content);

$oldTerr = 'if($r[\'terrestrial_dominance_mode\'] !== \'ANY\') $conds[] = "Ground " . $r[\'terrestrial_dominance_mode\'] . " [...]"';
$newTerr = 'if(!empty($r[\'ground_dominant_factions\'])) $conds[] = "Ground IN (" . $r[\'ground_dominant_factions\'] . ")"';
$content = str_replace($oldTerr, $newTerr, $content);

file_put_contents('admin.php', $content);
echo "admin.php table logic fixed via str_replace.\n";

