No need to set $origContent

This commit is contained in:
Matt Pass
2016-05-05 15:53:29 +01:00
parent 11fe0ad17a
commit c967325b7d
2 changed files with 5 additions and 4 deletions

View File

@@ -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);

View File

@@ -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;