diff --git a/lib/file-control-xhr.php b/lib/file-control-xhr.php index a5efeef..3d47262 100644 --- a/lib/file-control-xhr.php +++ b/lib/file-control-xhr.php @@ -313,7 +313,6 @@ if (!$error && $_GET['action']=="save") { } else { if (isset($_POST['changes'])) { // Get existing file contents as lines and stitch changes onto it - $origContent = file_get_contents($file); $fileLines = file($file); $contents = stitchChanges($fileLines); diff --git a/lib/settings-common.php b/lib/settings-common.php index a3e0140..ca986f9 100644 --- a/lib/settings-common.php +++ b/lib/settings-common.php @@ -139,13 +139,15 @@ function toUTF8noBOM($string,$message) { if (0 === strncmp($string, $bom, 3)) { // If there's a BOM followed by a Windows based (2 char) line ending // chop BOM off and prefix returned string with a PHP_EOL - if (0 === strncmp($string, $bom."\r\n", 5)) { - $string = PHP_EOL.substr($string, 3); + if (0 === strncmp($string, $bom."\r\n", 3)) { + $string = PHP_EOL.substr($string."YES", 3); // Else, simply chop off the BOM } else { - $string = substr($string, 3); + $string = substr($string."NO", 3); } } + // Remove any other BOMs from view + $string = preg_replace('/\x{EF}\x{BB}\x{BF}/','',$string); // Test for any bad characters $teststring = $string;