* Mail: fix for messed up signature in some cases; fix for not beeing able to delete/remave an attachment to a new mail that was attached using PRESET methods

This commit is contained in:
Klaus Leithoff 2014-04-29 09:53:47 +00:00
parent e3fd528994
commit 7434cd7144
3 changed files with 223 additions and 221 deletions

View File

@ -645,7 +645,8 @@ class mail_compose
// do not double insert a signature on a server roundtrip // do not double insert a signature on a server roundtrip
if ($buttonClicked) $suppressSigOnTop = true; if ($buttonClicked) $suppressSigOnTop = true;
if ($isFirstLoad)
{
$alwaysAttachVCardAtCompose = false; // we use this to eliminate double attachments, if users VCard is already present/attached $alwaysAttachVCardAtCompose = false; // we use this to eliminate double attachments, if users VCard is already present/attached
if ( isset($GLOBALS['egw_info']['apps']['stylite']) && (isset($this->preferencesArray['attachVCardAtCompose']) && if ( isset($GLOBALS['egw_info']['apps']['stylite']) && (isset($this->preferencesArray['attachVCardAtCompose']) &&
$this->preferencesArray['attachVCardAtCompose'])) $this->preferencesArray['attachVCardAtCompose']))
@ -902,9 +903,9 @@ class mail_compose
} }
if (!empty($_REQUEST['subject'])) $content['subject'] = html::purify(trim(html_entity_decode($_REQUEST['subject']))); if (!empty($_REQUEST['subject'])) $content['subject'] = html::purify(trim(html_entity_decode($_REQUEST['subject'])));
} }
}
//is the MimeType set/requested //is the MimeType set/requested
if (!empty($_REQUEST['mimeType'])) if ($isFirstLoad && !empty($_REQUEST['mimeType']))
{ {
if (($_REQUEST['mimeType']=="text" ||$_REQUEST['mimeType']=="plain") && $content['mimeType'] == 'html') if (($_REQUEST['mimeType']=="text" ||$_REQUEST['mimeType']=="plain") && $content['mimeType'] == 'html')
{ {

View File

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

View File

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