* Mail: fix for messed up plain-text signature in some cases

This commit is contained in:
Klaus Leithoff 2014-10-14 10:50:23 +00:00
parent 106886756a
commit eb05de40b4
2 changed files with 19 additions and 6 deletions

View File

@ -1557,7 +1557,14 @@ egw_LAB.wait(function() {
*/
static function splithtmlByPRE($html)
{
if (($pos = stripos($html,'<pre ')) === false)
$searchFor = '<pre ';
$pos = stripos($html,$searchFor);
if ($pos===false)
{
$searchFor = '<pre>';
$pos = stripos($html,$searchFor);
}
if ($pos === false)
{
return $html;
}
@ -1567,7 +1574,13 @@ egw_LAB.wait(function() {
$endofpre = stripos($html,'</pre>',$pos);
$length = $endofpre-$pos+6;
$html2ret[] = substr($html,$pos,$length);
$pos = stripos($html,'<pre ', $endofpre+6);
$searchFor = '<pre ';
$pos = stripos($html,$searchFor, $endofpre+6);
if ($pos===false)
{
$searchFor = '<pre>';
$pos = stripos($html,$searchFor, $endofpre+6);
}
$html2ret[] = ($pos ? substr($html,$endofpre+6,$pos-($endofpre+6)): substr($html,$endofpre+6));
//$pos=false;
}

View File

@ -1264,12 +1264,12 @@ class translation
// removing carriage return linefeeds, preserve those enclosed in <pre> </pre> tags
if ($stripcrl === true )
{
if (stripos($_html,'<pre ')!==false)
if (stripos($_html,'<pre ')!==false || stripos($_html,'<pre>')!==false)
{
$contentArr = html::splithtmlByPRE($_html);
foreach ($contentArr as $k =>&$elem)
{
if (stripos($elem,'<pre ')===false)
if (stripos($elem,'<pre ')===false && stripos($elem,'<pre>')===false)
{
//$elem = str_replace('@(\r\n)@i',' ',$elem);
$elem = str_replace(array("\r\n","\n"),($isHTML?'':' '),$elem);
@ -1326,12 +1326,12 @@ class translation
// reducing double \r\n to single ones, dont mess with pre sections
if ($stripcrl === true && $isHTML)
{
if (stripos($_html,'<pre ')!==false)
if (stripos($_html,'<pre ')!==false || stripos($_html,'<pre>')!==false)
{
$contentArr = html::splithtmlByPRE($_html);
foreach ($contentArr as $k =>&$elem)
{
if (stripos($elem,'<pre ')===false)
if (stripos($elem,'<pre ')===false && stripos($elem,'<pre>')===false)
{
//this is supposed to strip out all remaining stuff in tags, this is sometimes taking out whole sections off content
if ( $stripalltags ) {