Code Duplication    Length = 5-6 lines in 4 locations

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

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