From e4fa7ba983dd7f4e0e56e34e8983aad652458ab3 Mon Sep 17 00:00:00 2001 From: Denis Flaven Date: Fri, 29 Apr 2011 13:57:46 +0000 Subject: [PATCH] Properly manage carriage returns/line feeds in CaseLog records. SVN:trunk[1256] --- core/attributedef.class.inc.php | 2 +- core/ormcaselog.class.inc.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/attributedef.class.inc.php b/core/attributedef.class.inc.php index 6e7c55d91..1a0093827 100644 --- a/core/attributedef.class.inc.php +++ b/core/attributedef.class.inc.php @@ -1643,7 +1643,7 @@ class AttributeCaseLog extends AttributeText { $sStyle = 'style="'.implode(';', $aStyles).'"'; } - return "
".str_replace("\n", "
\n", $sContent).'
'; } + return "
".$sContent.'
'; } public function GetAsCSV($value, $sSeparator = ',', $sTextQualifier = '"', $oHostObject = null) diff --git a/core/ormcaselog.class.inc.php b/core/ormcaselog.class.inc.php index 201a86441..39a907567 100644 --- a/core/ormcaselog.class.inc.php +++ b/core/ormcaselog.class.inc.php @@ -71,7 +71,7 @@ class ormCaseLog { } $iPos += $this->m_aIndex[$index]['separator_length']; $sTextEntry = substr($this->m_sLog, $iPos, $this->m_aIndex[$index]['text_length']); - $sTextEntry = str_replace("\n", "
", htmlentities($sTextEntry, ENT_QUOTES, 'UTF-8')); + $sTextEntry = str_replace(array("\r\n", "\n", "\r"), "
", htmlentities($sTextEntry, ENT_QUOTES, 'UTF-8')); if (!is_null($aTransfoHandler)) { $sTextEntry = call_user_func($aTransfoHandler, $sTextEntry); @@ -91,7 +91,7 @@ class ormCaseLog { if ($iPos < (strlen($this->m_sLog) - 1)) { $sTextEntry = substr($this->m_sLog, $iPos); - $sTextEntry = str_replace("\n", "
", htmlentities($sTextEntry, ENT_QUOTES, 'UTF-8')); + $sTextEntry = str_replace(array("\r\n", "\n", "\r"), "
", htmlentities($sTextEntry, ENT_QUOTES, 'UTF-8')); if (!is_null($aTransfoHandler)) { $sTextEntry = call_user_func($aTransfoHandler, $sTextEntry);