Code Duplication    Length = 5-6 lines in 4 locations

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

@@ 605-610 (lines=6) @@
602
			$bodyStruct = $this->mail->getMessageBody($uid, 'html_only');
603
			$bodyBUFFHtml = $this->mail->getdisplayableBody($this->mail,$bodyStruct,true,false);
604
			if ($this->debugLevel>3) ZLog::Write(LOGLEVEL_DEBUG,__METHOD__.__LINE__.' html_only:'.$bodyBUFFHtml);
605
		    if ($bodyBUFFHtml != "" && (is_array($bodyStruct) && $bodyStruct[0]['mimeType']=='text/html')) {
606
				// may be html
607
				if ($this->debugLevel>0) ZLog::Write(LOGLEVEL_DEBUG,__METHOD__."(".__LINE__.") MIME Body".' Type:html (fetched with html_only):'.$bodyBUFFHtml);
608
				$AltBody = $AltBody."</br>".$bodyBUFFHtml.$sigTextHtml;
609
				$isreply = true;
610
			}
611
			// plain text Message part
612
			ZLog::Write(LOGLEVEL_DEBUG,__METHOD__."(".__LINE__.") MIME Body".' Type:plain, fetch text:');
613
			// if the new part of the message is html, we must preserve it, and handle that the original mail is text/plain
@@ 616-620 (lines=5) @@
613
			// if the new part of the message is html, we must preserve it, and handle that the original mail is text/plain
614
			$bodyStruct = $this->mail->getMessageBody($uid,'never_display');//'never_display');
615
			$bodyBUFF = $this->mail->getdisplayableBody($this->mail,$bodyStruct,false,false);
616
			if ($bodyBUFF != "" && (is_array($bodyStruct) && $bodyStruct[0]['mimeType']=='text/plain')) {
617
				if ($this->debugLevel>0) ZLog::Write(LOGLEVEL_DEBUG,__METHOD__."(".__LINE__.") MIME Body".' Type:plain (fetched with never_display):'.$bodyBUFF);
618
				$Body = $Body."\r\n".$bodyBUFF.$sigTextPlain;
619
				$isreply = true;
620
			}
621
			if (!empty($bodyBUFF) && empty($bodyBUFFHtml) && !empty($AltBody))
622
			{
623
				$isreply = true;
@@ 676-681 (lines=6) @@
673
				$bodyStruct = $this->mail->getMessageBody($uid, 'html_only');
674
				$bodyBUFFHtml = $this->mail->getdisplayableBody($this->mail,$bodyStruct,true,false);
675
				if ($this->debugLevel>0) ZLog::Write(LOGLEVEL_DEBUG,__METHOD__.__LINE__.' html_only:'.$bodyBUFFHtml);
676
				if ($bodyBUFFHtml != "" && (is_array($bodyStruct) && $bodyStruct[0]['mimeType']=='text/html')) {
677
					// may be html
678
					if ($this->debugLevel>0) ZLog::Write(LOGLEVEL_DEBUG,__METHOD__."(".__LINE__.") MIME Body".' Type:html (fetched with html_only):'.$bodyBUFFHtml);
679
					$AltBody = $AltBody."</br>".$bodyBUFFHtml.$sigTextHtml;
680
					$isforward = true;
681
				}
682
				// plain text Message part
683
				if ($this->debugLevel>0) ZLog::Write(LOGLEVEL_DEBUG,__METHOD__."(".__LINE__.") MIME Body".' Type:plain, fetch text:');
684
				// if the new part of the message is html, we must preserve it, and handle that the original mail is text/plain
@@ 687-691 (lines=5) @@
684
				// if the new part of the message is html, we must preserve it, and handle that the original mail is text/plain
685
				$bodyStruct = $this->mail->getMessageBody($uid,'never_display');//'never_display');
686
				$bodyBUFF = $this->mail->getdisplayableBody($this->mail,$bodyStruct,false,false);
687
				if ($bodyBUFF != "" && (is_array($bodyStruct) && $bodyStruct[0]['mimeType']=='text/plain')) {
688
					if ($this->debugLevel>0) ZLog::Write(LOGLEVEL_DEBUG,__METHOD__."(".__LINE__.") MIME Body".' Type:plain (fetched with never_display):'.$bodyBUFF);
689
					$Body = $Body."\r\n".$bodyBUFF.$sigTextPlain;
690
					$isforward = true;
691
				}
692
				if (!empty($bodyBUFF) && empty($bodyBUFFHtml) && !empty($AltBody))
693
				{
694
					$AltBody = $AltBody."</br><pre>".nl2br($bodyBUFF).'</pre>'.$sigTextHtml;