فهرست منبع

Properly manage carriage returns/line feeds in CaseLog records.

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@1256 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 14 سال پیش
والد
کامیت
e9f4087713
2فایلهای تغییر یافته به همراه3 افزوده شده و 3 حذف شده
  1. 1 1
      core/attributedef.class.inc.php
  2. 2 2
      core/ormcaselog.class.inc.php

+ 1 - 1
core/attributedef.class.inc.php

@@ -1643,7 +1643,7 @@ class AttributeCaseLog extends AttributeText
 		{
 			$sStyle = 'style="'.implode(';', $aStyles).'"';
 		}
-		return "<div class=\"caselog\" $sStyle>".str_replace("\n", "<br>\n", $sContent).'</div>';	}
+		return "<div class=\"caselog\" $sStyle>".$sContent.'</div>';	}
 
 
 	public function GetAsCSV($value, $sSeparator = ',', $sTextQualifier = '"', $oHostObject = null)

+ 2 - 2
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", "<br/>", htmlentities($sTextEntry, ENT_QUOTES, 'UTF-8'));
+			$sTextEntry = str_replace(array("\r\n", "\n", "\r"), "<br/>", 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", "<br/>", htmlentities($sTextEntry, ENT_QUOTES, 'UTF-8'));
+			$sTextEntry = str_replace(array("\r\n", "\n", "\r"), "<br/>", htmlentities($sTextEntry, ENT_QUOTES, 'UTF-8'));
 			if (!is_null($aTransfoHandler))
 			{
 				$sTextEntry = call_user_func($aTransfoHandler, $sTextEntry);