Code Duplication    Length = 5-6 lines in 4 locations

mail/inc/class.mail_zpush.inc.php 4 locations

@@ 589-594 (lines=6) @@
586
			$bodyStruct = $this->mail->getMessageBody($uid, 'html_only');
587
			$bodyBUFFHtml = $this->mail->getdisplayableBody($this->mail,$bodyStruct,true,false);
588
			if ($this->debugLevel>3) ZLog::Write(LOGLEVEL_DEBUG,__METHOD__.__LINE__.' html_only:'.$bodyBUFFHtml);
589
		    if ($bodyBUFFHtml != "" && (is_array($bodyStruct) && $bodyStruct[0]['mimeType']=='text/html')) {
590
				// may be html
591
				if ($this->debugLevel>0) ZLog::Write(LOGLEVEL_DEBUG,__METHOD__."(".__LINE__.") MIME Body".' Type:html (fetched with html_only):'.$bodyBUFFHtml);
592
				$AltBody = $AltBody."</br>".$bodyBUFFHtml.$sigTextHtml;
593
				$isreply = true;
594
			}
595
			// plain text Message part
596
			ZLog::Write(LOGLEVEL_DEBUG,__METHOD__."(".__LINE__.") MIME Body".' Type:plain, fetch text:');
597
			// if the new part of the message is html, we must preserve it, and handle that the original mail is text/plain
@@ 600-604 (lines=5) @@
597
			// if the new part of the message is html, we must preserve it, and handle that the original mail is text/plain
598
			$bodyStruct = $this->mail->getMessageBody($uid,'never_display');//'never_display');
599
			$bodyBUFF = $this->mail->getdisplayableBody($this->mail,$bodyStruct,false,false);
600
			if ($bodyBUFF != "" && (is_array($bodyStruct) && $bodyStruct[0]['mimeType']=='text/plain')) {
601
				if ($this->debugLevel>0) ZLog::Write(LOGLEVEL_DEBUG,__METHOD__."(".__LINE__.") MIME Body".' Type:plain (fetched with never_display):'.$bodyBUFF);
602
				$Body = $Body."\r\n".$bodyBUFF.$sigTextPlain;
603
				$isreply = true;
604
			}
605
			if (!empty($bodyBUFF) && empty($bodyBUFFHtml) && !empty($AltBody))
606
			{
607
				$isreply = true;
@@ 660-665 (lines=6) @@
657
				$bodyStruct = $this->mail->getMessageBody($uid, 'html_only');
658
				$bodyBUFFHtml = $this->mail->getdisplayableBody($this->mail,$bodyStruct,true,false);
659
				if ($this->debugLevel>0) ZLog::Write(LOGLEVEL_DEBUG,__METHOD__.__LINE__.' html_only:'.$bodyBUFFHtml);
660
				if ($bodyBUFFHtml != "" && (is_array($bodyStruct) && $bodyStruct[0]['mimeType']=='text/html')) {
661
					// may be html
662
					if ($this->debugLevel>0) ZLog::Write(LOGLEVEL_DEBUG,__METHOD__."(".__LINE__.") MIME Body".' Type:html (fetched with html_only):'.$bodyBUFFHtml);
663
					$AltBody = $AltBody."</br>".$bodyBUFFHtml.$sigTextHtml;
664
					$isforward = true;
665
				}
666
				// plain text Message part
667
				if ($this->debugLevel>0) ZLog::Write(LOGLEVEL_DEBUG,__METHOD__."(".__LINE__.") MIME Body".' Type:plain, fetch text:');
668
				// if the new part of the message is html, we must preserve it, and handle that the original mail is text/plain
@@ 671-675 (lines=5) @@
668
				// if the new part of the message is html, we must preserve it, and handle that the original mail is text/plain
669
				$bodyStruct = $this->mail->getMessageBody($uid,'never_display');//'never_display');
670
				$bodyBUFF = $this->mail->getdisplayableBody($this->mail,$bodyStruct,false,false);
671
				if ($bodyBUFF != "" && (is_array($bodyStruct) && $bodyStruct[0]['mimeType']=='text/plain')) {
672
					if ($this->debugLevel>0) ZLog::Write(LOGLEVEL_DEBUG,__METHOD__."(".__LINE__.") MIME Body".' Type:plain (fetched with never_display):'.$bodyBUFF);
673
					$Body = $Body."\r\n".$bodyBUFF.$sigTextPlain;
674
					$isforward = true;
675
				}
676
				if (!empty($bodyBUFF) && empty($bodyBUFFHtml) && !empty($AltBody))
677
				{
678
					$AltBody = $AltBody."</br><pre>".nl2br($bodyBUFF).'</pre>'.$sigTextHtml;