";
$files=scandir(".");
// Скрипт проверяет файлы в папке где лежит сам, но можно раскомментировать и указать свой список файлов !!!
// $files=[ 'info.php', '/home/chat/chat/script.php' ];
$thisfile=basename(__FILE__);
foreach($files as $file) if(preg_match("/\.php$/",$file) && $file!=$thisfile) {
echo "
$file
";
$linechanged=0;
$lines=file($file);
foreach($lines as $i=>$line) {
$newline=$line;
$colored=htmlspecialchars($line);
$changed=0;
while(preg_match('/\$[a-z_]{1}[a-z0-9_]*\[[a-z_]{1}[a-z0-9_]*\]/i',$newline,$m)) {
$fix=str_replace(["[","]"], ["['","']"], $m[0]);
$newline=str_replace($m[0], $fix, $newline);
$colored=str_replace($m[0], "$fix", $colored);
$changed++;
}
if($changed) {
echo ($i+1).". $colored
";
$lines[$i]=$newline;
$linechanged++;
}
}
$data=implode("",$lines);
if($linechanged && strlen($data)) {
if($_POST['dofix']) {file_put_contents($file, $data); echo "FILE $file FIXED
Reload page";}
else echo "
";
die();
}
}