* eMail: handle excess linebreaks in signatures when compose as plainText (when using div for linebreak mode for ck-editor)

This commit is contained in:
Klaus Leithoff 2013-07-11 12:49:06 +00:00
parent e26f5216a6
commit fdd5ee3da3
3 changed files with 13 additions and 13 deletions

View File

@ -1493,8 +1493,8 @@ class ajaxfelamimail
//error_log(__METHOD__.'New:'.$sigText.'#'); //error_log(__METHOD__.'New:'.$sigText.'#');
if ($_currentMode == 'plain') if ($_currentMode == 'plain')
{ {
$oldSigText = utf8_decode($bocompose->convertHTMLToText($oldSigText)); $oldSigText = utf8_decode($bocompose->convertHTMLToText($oldSigText,true,true));
$sigText = utf8_decode($bocompose->convertHTMLToText($sigText)); $sigText = utf8_decode($bocompose->convertHTMLToText($sigText,true,true));
$_content = utf8_decode($_content); $_content = utf8_decode($_content);
if($this->_debug) error_log(__METHOD__." Old signature:".$oldSigText); if($this->_debug) error_log(__METHOD__." Old signature:".$oldSigText);
} }
@ -1537,7 +1537,7 @@ class ajaxfelamimail
$found = strpos($_content,trim($oldSigText)); $found = strpos($_content,trim($oldSigText));
} }
if ($found !== false && $_oldSig != -2 && !(empty($oldSigText) || trim($bocompose->convertHTMLToText($oldSigText)) =='')) if ($found !== false && $_oldSig != -2 && !(empty($oldSigText) || trim($bocompose->convertHTMLToText($oldSigText,true,true)) ==''))
{ {
//error_log(__METHOD__.'Old Content:'.$_content.'#'); //error_log(__METHOD__.'Old Content:'.$_content.'#');
$_oldSigText = preg_quote($oldSigText,'~'); $_oldSigText = preg_quote($oldSigText,'~');
@ -1546,7 +1546,7 @@ class ajaxfelamimail
//error_log(__METHOD__.'new Content:'.$_content.'#'); //error_log(__METHOD__.'new Content:'.$_content.'#');
} }
if ($_oldSig == -2 && (empty($oldSigText) || trim($bocompose->convertHTMLToText($oldSigText)) =='')) if ($_oldSig == -2 && (empty($oldSigText) || trim($bocompose->convertHTMLToText($oldSigText,true,true)) ==''))
{ {
// if there is no sig selected, there is no way to replace a signature // if there is no sig selected, there is no way to replace a signature
} }

View File

@ -141,12 +141,12 @@
return 1; return 1;
} }
function convertHTMLToText(&$_html,$sourceishtml = true) function convertHTMLToText(&$_html,$sourceishtml = true, $stripcrl=false)
{ {
$stripalltags = true; $stripalltags = true;
// third param is stripalltags, we may not need that, if the source is already in ascii // third param is stripalltags, we may not need that, if the source is already in ascii
if (!$sourceishtml) $stripalltags=false; if (!$sourceishtml) $stripalltags=false;
return felamimail_bo::convertHTMLToText($_html,false,$stripalltags); return felamimail_bo::convertHTMLToText($_html,$stripcrl,$stripalltags);
} }
function convertHTMLToTextTiny($_html) function convertHTMLToTextTiny($_html)
@ -828,9 +828,9 @@
($disableRuler ?'<br>':'<hr style="border:1px dotted silver; width:90%;">'). ($disableRuler ?'<br>':'<hr style="border:1px dotted silver; width:90%;">').
$signature; $signature;
} }
$_mailObject->AltBody = $this->convertHTMLToText($_formData['body']). $_mailObject->AltBody = $this->convertHTMLToText($_formData['body'],true,true).
($disableRuler ?"\r\n":"\r\n-- \r\n"). ($disableRuler ?"\r\n":"\r\n-- \r\n").
$this->convertHTMLToText($signature); $this->convertHTMLToText($signature,true,true);
#print "<pre>$_mailObject->AltBody</pre>"; #print "<pre>$_mailObject->AltBody</pre>";
#print htmlentities($_signature['signature']); #print htmlentities($_signature['signature']);
} else { } else {
@ -840,7 +840,7 @@
} else { } else {
$_mailObject->Body = $_formData['body']; $_mailObject->Body = $_formData['body'];
} }
$_mailObject->AltBody = $this->convertHTMLToText($_formData['body']); $_mailObject->AltBody = $this->convertHTMLToText($_formData['body'],true,true);
} }
// convert URL Images to inline images - if possible // convert URL Images to inline images - if possible
if ($_convertLinks) felamimail_bo::processURL2InlineImages($_mailObject, $_mailObject->Body); if ($_convertLinks) felamimail_bo::processURL2InlineImages($_mailObject, $_mailObject->Body);
@ -854,7 +854,7 @@
#$_mailObject->Body = $_formData['body']; #$_mailObject->Body = $_formData['body'];
if(!empty($signature)) { if(!empty($signature)) {
$_mailObject->Body .= ($disableRuler ?"\r\n":"\r\n-- \r\n"). $_mailObject->Body .= ($disableRuler ?"\r\n":"\r\n-- \r\n").
$this->convertHTMLToText($signature); $this->convertHTMLToText($signature,true,true);
} }
} }

View File

@ -782,7 +782,7 @@
$signature = $boSignatures->getSignature(($presetSig ? $presetSig : $sessionData['signatureID'])); $signature = $boSignatures->getSignature(($presetSig ? $presetSig : $sessionData['signatureID']));
if ((isset($this->bocompose->preferencesArray['disableRulerForSignatureSeparation']) && if ((isset($this->bocompose->preferencesArray['disableRulerForSignatureSeparation']) &&
$this->bocompose->preferencesArray['disableRulerForSignatureSeparation']) || $this->bocompose->preferencesArray['disableRulerForSignatureSeparation']) ||
empty($signature->fm_signature) || trim($this->bocompose->convertHTMLToText($signature->fm_signature)) =='') empty($signature->fm_signature) || trim($this->bocompose->convertHTMLToText($signature->fm_signature,true,true)) =='')
{ {
$disableRuler = true; $disableRuler = true;
} }
@ -828,11 +828,11 @@
if ($insertSigOnTop === 'below') if ($insertSigOnTop === 'below')
{ {
$sessionData['body'] = $font_span.$sessionData['body'].$before.($sessionData['mimeType'] == 'html'?$sigText:$this->bocompose->convertHTMLToText($sigText)); $sessionData['body'] = $font_span.$sessionData['body'].$before.($sessionData['mimeType'] == 'html'?$sigText:$this->bocompose->convertHTMLToText($sigText,true,true));
} }
else else
{ {
$sessionData['body'] = $before.($sessionData['mimeType'] == 'html'?$sigText:$this->bocompose->convertHTMLToText($sigText)).$inbetween.$sessionData['body']; $sessionData['body'] = $before.($sessionData['mimeType'] == 'html'?$sigText:$this->bocompose->convertHTMLToText($sigText,true,true)).$inbetween.$sessionData['body'];
} }
} }
else else