From b1c111db8538255bd0e58a432c5c0850adbe8933 Mon Sep 17 00:00:00 2001 From: Lars Kneschke Date: Fri, 5 Oct 2007 03:47:49 +0000 Subject: [PATCH] fixed breaking of signatures when sending emails --- felamimail/inc/class.bocompose.inc.php | 44 +++++++++++++++----------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/felamimail/inc/class.bocompose.inc.php b/felamimail/inc/class.bocompose.inc.php index cebe3ed641..36deced54f 100644 --- a/felamimail/inc/class.bocompose.inc.php +++ b/felamimail/inc/class.bocompose.inc.php @@ -157,30 +157,36 @@ $text = html_entity_decode($text, ENT_COMPAT, $this->displayCharset); - $indent = 0; - $indentString = ''; - $asciiText = ''; + $pos = strpos($text, 'blockquote'); - $quoteParts = preg_split('/
/', $text, -1, PREG_SPLIT_OFFSET_CAPTURE); - - foreach($quoteParts as $quotePart) { - if($quotePart[1] > 0) { - $indent++; - $indentString .= '>'; - } - $quoteParts2 = preg_split('/<\/blockquote>/', $quotePart[0], -1, PREG_SPLIT_OFFSET_CAPTURE); + if($pos === false) { + $asciiText = $text; + } else { + $indent = 0; + $indentString = ''; + $asciiText = ''; - foreach($quoteParts2 as $quotePart2) { - if($quotePart2[1] > 0) { - $indent--; - $indentString = substr($indentString, 0, $indent); + $quoteParts = preg_split('/
/', $text, -1, PREG_SPLIT_OFFSET_CAPTURE); + + foreach($quoteParts as $quotePart) { + if($quotePart[1] > 0) { + $indent++; + $indentString .= '>'; } + $quoteParts2 = preg_split('/<\/blockquote>/', $quotePart[0], -1, PREG_SPLIT_OFFSET_CAPTURE); + + foreach($quoteParts2 as $quotePart2) { + if($quotePart2[1] > 0) { + $indent--; + $indentString = substr($indentString, 0, $indent); + } - $quoteParts3 = preg_split('/\r\n/', $quotePart2[0]); + $quoteParts3 = preg_split('/\r\n/', $quotePart2[0]); - foreach($quoteParts3 as $quotePart3) { - $quotePart3 = wordwrap($quotePart3, 75, "\r\n$indentString"); - $asciiText .= $indentString . $quotePart3 . "\r\n"; + foreach($quoteParts3 as $quotePart3) { + $quotePart3 = wordwrap($quotePart3, 75, "\r\n$indentString"); + $asciiText .= $indentString . $quotePart3 . "\r\n"; + } } } }