diff --git a/app/config/cms.php b/app/config/cms.php index 4c63bcdb0..12277e725 100644 --- a/app/config/cms.php +++ b/app/config/cms.php @@ -169,4 +169,17 @@ return array( 'defaultMask' => ['file' => null, 'folder' => null], -); \ No newline at end of file + /* + |-------------------------------------------------------------------------- + | Convert Line Endings + |-------------------------------------------------------------------------- + | + | Determines if October should convert line endings from the windows style + | \r\n to the unix style \n. + | + */ + + 'convertLineEndings' => false, + + +); diff --git a/modules/cms/controllers/Index.php b/modules/cms/controllers/Index.php index 4130b3e8c..f3712f609 100644 --- a/modules/cms/controllers/Index.php +++ b/modules/cms/controllers/Index.php @@ -1,5 +1,6 @@ convertLineEndings($templateData['markup']); + } + + if (!Request::input('templateForceSave') && $template->mtime) { if (Request::input('templateMtime') != $template->mtime) throw new ApplicationException('mtime-mismatch'); @@ -361,4 +367,20 @@ class Index extends Controller return $settings; } -} \ No newline at end of file + + /** + * convertLineEndings Replaces Windows style (/r/n) line endings with unix style (/n) + * line endings. + * + * @param string $markup The markup to convert to unix style endings + * + * @return string $markup + */ + private function convertLineEndings($markup) + { + $markup = str_replace("\r\n", "\n", $markup); + $markup = str_replace("\r", "\n", $markup); + return $markup; + } + +}