From 03c99bbac0dd4bf1c59c15d8ae3eb2453faf3228 Mon Sep 17 00:00:00 2001 From: Jmeyering Date: Mon, 19 May 2014 12:58:35 -0500 Subject: [PATCH 1/4] Allow --- modules/cms/controllers/Index.php | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/modules/cms/controllers/Index.php b/modules/cms/controllers/Index.php index 4130b3e8c..2ba1d2f34 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) @@ -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; + } + +} From 9994f6238220f2c6e0cf916840c672551e87efed Mon Sep 17 00:00:00 2001 From: Jmeyering Date: Mon, 19 May 2014 13:02:25 -0500 Subject: [PATCH 2/4] Removing extraneous spaces from this code --- modules/cms/controllers/Index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cms/controllers/Index.php b/modules/cms/controllers/Index.php index 2ba1d2f34..5fcfd7f5d 100644 --- a/modules/cms/controllers/Index.php +++ b/modules/cms/controllers/Index.php @@ -367,7 +367,7 @@ class Index extends Controller return $settings; } - + /** * convertLineEndings Replaces Windows style (/r/n) line endings with unix style (/n) * line endings. From 56a6eb02839cd18a3cfe2be27ee38fea5c01e405 Mon Sep 17 00:00:00 2001 From: Jmeyering Date: Mon, 19 May 2014 13:03:16 -0500 Subject: [PATCH 3/4] More extraneous spaces plus nailed a syntax error --- modules/cms/controllers/Index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/cms/controllers/Index.php b/modules/cms/controllers/Index.php index 5fcfd7f5d..f3712f609 100644 --- a/modules/cms/controllers/Index.php +++ b/modules/cms/controllers/Index.php @@ -143,8 +143,8 @@ class Index extends Controller if (array_key_exists($field, $_POST)) $templateData[$field] = Request::input($field); } - - if (!empty($templateData['markup'] && Config::get('cms.convertLineEndings', false) === true) { + + if (!empty($templateData['markup']) && Config::get('cms.convertLineEndings', false) === true) { $templateData['markup'] = $this->convertLineEndings($templateData['markup']); } From b3f8bc0cca52112c9a4101dbcb2f6bf108c30d43 Mon Sep 17 00:00:00 2001 From: Jmeyering Date: Mon, 19 May 2014 13:06:37 -0500 Subject: [PATCH 4/4] Add the setting to allow line ending changes --- app/config/cms.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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, + + +);