X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=plugins%2Fmessage_details%2Fmessage_details_bottom.php;h=3d9e2182bacdf9a0ea4247a6d7825f80022e81c3;hp=11d00eca84af8bd7d02d5d513f46948df7483a4c;hb=ce68b76bfdef63cbc85d7bc46f7f1d538db9b4a4;hpb=5c325683cbdd9f91a91ed24078b2ffd1a0bc90ce diff --git a/plugins/message_details/message_details_bottom.php b/plugins/message_details/message_details_bottom.php index 11d00eca..3d9e2182 100644 --- a/plugins/message_details/message_details_bottom.php +++ b/plugins/message_details/message_details_bottom.php @@ -1,27 +1,44 @@ '."\n \n".'
'."\n \n"; - } - $mimepart = -$header; - $bnd_end = false; - if ($messageheaderstart) { - $messageheaderstart=false; - } - } else if ($messageheaderstart) { - $messageheader= false; - } else { - if ($header) { - $pre = ''; - $end = "\n \n".'
'."\n \n".'
'."\n \n"; - } - $header = false; - $mimepart=true; - } - $contentset = false; - $nameset = false; + $header = true; + $mimepart = false; + } else if ($messageheader) { + if ($header) { + $header=false; + $end = "\n \n".'
'."\n \n".'
'."\n \n"; + } + $mimepart = -$header; + $bnd_end = false; + if ($messageheaderstart) { + $messageheaderstart=false; + } + } else if ($messageheaderstart) { + $messageheader= false; + } else { + if ($header) { + $pre = ''; + $end = "\n \n".'
'."\n \n".'
'."\n \n"; + } + $header = false; + $mimepart=true; + } + $contentset = false; + $nameset = false; } else { if (!$header && $messageheader) { - $messageheaderstart=true; - if ($pre != '') { - $pre = ''; - } - } - if (!$messageheader && !$header ) { - $mimepart=true; - } else { - $mimepart=false; - } - $pre = ''; - $end = ''; + $messageheaderstart=true; + if ($pre != '') { + $pre = ''; + $end = ''; + } + } + if (!$messageheader && !$header ) { + $mimepart=true; + } else { + $mimepart=false; + } + $pre = ''; + $end = ''; } if ( ( $header || $messageheader) && (preg_match("/^.*boundary=\"?(.+(?=\")|.+).*/i",$line,$reg)) ) { - $bnd = $reg[1]; - $bndreg = $bnd; - $bndreg = str_replace("\\","\\\\",$bndreg); - $bndreg = str_replace("?","\\?",$bndreg); - $bndreg = str_replace("+","\\+",$bndreg); - $bndreg = str_replace(".","\\.",$bndreg); - $bndreg = str_replace("/","\\/",$bndreg); - $bndreg = str_replace("-","\\-",$bndreg); - $bndreg = str_replace("(","\\(",$bndreg); - $bndreg = str_replace(")","\\)",$bndreg); + $bnd = $reg[1]; + $bndreg = $bnd; + $bndreg = str_replace("\\","\\\\",$bndreg); + $bndreg = str_replace("?","\\?",$bndreg); + $bndreg = str_replace("+","\\+",$bndreg); + $bndreg = str_replace(".","\\.",$bndreg); + $bndreg = str_replace("/","\\/",$bndreg); + $bndreg = str_replace("-","\\-",$bndreg); + $bndreg = str_replace("(","\\(",$bndreg); + $bndreg = str_replace(")","\\)",$bndreg); - $boundaries[] = array( 'bnd' => $bnd, 'bndreg' => $bndreg); - $messageheader = false; - $messageheaderstart=false; - $mimepart=false; - if ($entStr=='') { - $entStr='0'; - } else { - $entStr = CalcEntity("$entStr",1); - } + $boundaries[] = array( 'bnd' => $bnd, 'bndreg' => $bndreg); + $messageheader = false; + $messageheaderstart=false; + $mimepart=false; + if ($entStr=='') { + $entStr='0'; + } else { + $entStr = CalcEntity("$entStr",1); + } } if (($line != '' && $line{0} == '-' || $header) && isset($boundaries[0])) { $cnt=count($boundaries)-1; - $bnd = $boundaries[$cnt]['bnd']; - $bndreg = $boundaries[$cnt]['bndreg']; + $bnd = $boundaries[$cnt]['bnd']; + $bndreg = $boundaries[$cnt]['bndreg']; - $regstr = '/^--'."($bndreg)".".*".'/'; - if (preg_match($regstr,$line,$reg) ) { - $bndlen = strlen($reg[1]); - $bndend = false; + $regstr = '/^--'."($bndreg)".".*".'/'; + if (preg_match($regstr,$line,$reg) ) { + $bndlen = strlen($reg[1]); + $bndend = false; if (strlen($line) > ($bndlen + 3)) { - if ($line{$bndlen+2} == '-' && $line{$bndlen+3} == '-') - $bndend = true; - } - if ($bndend) { - $entStr = CalcEntity("$entStr",-1); - array_pop($boundaries); - $pre .= ''; - $header = true; - $mimepart = false; - $bnd_end = true; - $encoding = ''; - } else { - $header = true; - $bnd_end = false; - $entStr = CalcEntity("$entStr",0); - $content_indx++; - $content[$content_indx]=array(); - $content[$content_indx]['ent'] = '$entStr".''; - $pre .= "\n \n".'
'."\n \n".'
'."\n"; - $header = true; - $mimepart = false; - $encoding = ''; - } - } else { - if ($header) { - if (!$contentset && preg_match("/^.*(content-type:)\s*(\w+)\/(\w+).*/i",$line,$reg)) { - if (strtolower($reg[2]) == 'message' && strtolower($reg[3]) == 'rfc822') { - $messageheader = true; - } - $content[$content_indx]['type'] = "$reg[2]/$reg[3]"; - $contentset = true; - if ($reg[2] == 'image') { - $entities["$entStr"] = array(); - $entities["$entStr"]['entity'] = $entStr; - $entities["$entStr"]['contenttype']=$reg[2].'/'.$reg[3]; - } - } else if (!$nameset && preg_match("/^.*(name=\s*)\"(.*)\".*/i",$line,$reg)) { - $name = htmlspecialchars($reg[2]); - $content[$content_indx]['name'] = decodeHeader($name); - $nameset = true; - if (isset($entities["$entStr"])) { - $entities["$entStr"]['name'] = urlEncode($reg[2]); - } - } else if (preg_match("/^.*(content-transfer-encoding:)\s*(\w+-?(\w+)?).*/i",$line,$reg) ) { - $encoding = $reg[2]; - if (isset($entities["$entStr"])) { - $entities["$entStr"]['encoding']=$reg[2]; - } - $content[$content_indx]['encoding'] = $encoding; - $mimeentity = ''; - } + if ($line{$bndlen+2} == '-' && $line{$bndlen+3} == '-') + $bndend = true; + } + if ($bndend) { + $entStr = CalcEntity("$entStr",-1); + array_pop($boundaries); + $pre .= ''; + $end .= ''; + $header = true; + $mimepart = false; + $bnd_end = true; + $encoding = ''; + } else { + $header = true; + $bnd_end = false; + $entStr = CalcEntity("$entStr",0); + $content_indx++; + $content[$content_indx]=array(); + $content[$content_indx]['ent'] = '$entStr".''; + $pre .= "\n \n".'
'."\n \n".'
'; + $end .= ''."\n"; + $header = true; + $mimepart = false; + $encoding = ''; + } + } else { + if ($header) { + if (!$contentset && preg_match("/^.*(content-type:)\s*(\w+)\/(\w+).*/i",$line,$reg)) { + if (strtolower($reg[2]) == 'message' && strtolower($reg[3]) == 'rfc822') { + $messageheader = true; + } + $content[$content_indx]['type'] = "$reg[2]/$reg[3]"; + $contentset = true; + if ($reg[2] == 'image') { + $entities["$entStr"] = array(); + $entities["$entStr"]['entity'] = $entStr; + $entities["$entStr"]['contenttype']=$reg[2].'/'.$reg[3]; + } + } else if (!$nameset && preg_match("/^.*(name=\s*)\"(.*)\".*/i",$line,$reg)) { + $name = htmlspecialchars($reg[2]); + $content[$content_indx]['name'] = decodeHeader($name); + $nameset = true; + if (isset($entities["$entStr"])) { + $entities["$entStr"]['name'] = urlEncode($reg[2]); + } + } else if (preg_match("/^.*(content-transfer-encoding:)\s*(\w+-?(\w+)?).*/i",$line,$reg) ) { + $encoding = $reg[2]; + if (isset($entities["$entStr"])) { + $entities["$entStr"]['encoding']=$reg[2]; + } + $content[$content_indx]['encoding'] = $encoding; + $mimeentity = ''; + } - $pre .= ''; - //$mimepart=false; - } - } - } + $pre .= ''; + $end .= ''; + //$mimepart=false; + } + } + } /* if ($mimepart) { - if (isset($entities["$entStr"])) { - if (isset($encoding) && $encoding == 'base64') { - if (!isset( $entities["$entStr"]['content'])) $entities[$entStr]['content'] = ''; - $entities["$entStr"]['content'] .= $line; - } + if (isset($entities["$entStr"])) { + if (isset($encoding) && $encoding == 'base64') { + if (!isset( $entities["$entStr"]['content'])) $entities[$entStr]['content'] = ''; + $entities["$entStr"]['content'] .= $line; + } } - } + } */ $line = htmlspecialchars($line); - $message_body .= "$pre"."$line"."$end".'
'."\r\n"; + $message_body .= "$pre"."$line"."$end".'
'."\r\n"; } -//echo returnTime($start).'
'; +//echo returnTime($start).'
'; $xtra = << + + ECHO; displayHtmlHeader( _("Message Details"), $xtra, FALSE ); /* body */ -echo ''."\n"; -echo ''."\n"; -echo '
'."\n"; +echo "\n"; +echo ''."\n"; +echo ''."\n"; +echo '
'."\n"; + + //session_register("entities"); //$keys = array_keys($entities); //$start = gettimeofday(); //foreach ($keys as $key) { // if (isset($entities[$key])) { // if ($entities[$key]['encoding'] == 'base64') { -// echo '
'; +// echo '
'; // } // } //} //session_unregister("entities"); if (count($content) > 0) { - echo '

Bodystructure

'."\n\n"; - echo ''. - ''. - ''. - ''. - ''. - ''. - - ''. - ''; + echo '

'._("Bodystructure")."

\n\n"; + echo '
EntityContent-TypeNameEncoding
'. + ''. + ''. + ''. + ''. + ''. + ''. + ''; for ($i = 0; $i < count($content);$i++) { - echo ''."\n"; + echo ''."\n"; } - echo '
'._("Entity").''._("Content-Type").''._("Name").''._("Encoding").'
'; - echo $content[$i]['ent'].''; - if (isset($content[$i]['type'])) { - echo $content[$i]['type']; - } else echo 'TEXT/PLAIN'; - echo ''; - if (isset($content[$i]['name'])) { - echo $content[$i]['name']; - } else echo ' '; - echo ''; - if (isset($content[$i]['encoding'])) { - echo $content[$i]['encoding']; - } else echo ' '; - echo '
'; + echo $content[$i]['ent'].''; + if (isset($content[$i]['type'])) { + echo $content[$i]['type']; + } else echo 'TEXT/PLAIN'; + echo ''; + if (isset($content[$i]['name'])) { + echo $content[$i]['name']; + } else echo ' '; + echo ''; + if (isset($content[$i]['encoding'])) { + echo $content[$i]['encoding']; + } else echo ' '; + echo '

'."\n"; + echo '
'."\n"; } -echo '

RFC822 Message body

'."\n\n"; +echo '

'._("RFC822 Message body")."

\n\n"; echo '
'."\n\n"; echo $message_body; echo '
';