39038-vm/patch_lines.php
2026-03-08 05:41:10 +00:00

24 lines
650 B
PHP

<?php
$lines = file('includes/app.php');
$start = -1;
$end = -1;
foreach ($lines as $i => $line) {
if (strpos($line, '$translations = [') === 0) {
$start = $i;
}
if (strpos($line, 'function t(') === 0) {
$end = $i;
break;
}
}
if ($start !== -1 && $end !== -1) {
$new_content = array_slice($lines, 0, $start);
$new_content[] = file_get_contents('new_trans.txt');
$new_content = array_merge($new_content, array_slice($lines, $end));
file_put_contents('includes/app.php', implode("", $new_content));
echo "Replaced lines $start to $end\n";
} else {
echo "Could not find start/end\n";
}
?>