Re: PHP 4.0 Bug #7496 Updated: imap_fetchbody handling of part numbers in forwarded messages

From: Date: Mon, 30 Oct 2000 10:55:03 +0000
Subject: Re: PHP 4.0 Bug #7496 Updated: imap_fetchbody handling of part numbers in forwarded messages
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-36389@lists.php.net to get a copy of this message
Here is the code. It is called with a URL of the form: showpart.php?folder=inbox&msg=13&part_no=2.1.1 <?php include("include/common.php"); $mbox = imap_open("{".$server.":143}".$folder, $username, $password); $text = imap_fetchbody($mbox, $msg, $part_no); $structure = imap_fetchstructure($mbox, $msg); # Break MIME part number x.x.x into an array of separate x pieces $parts = explode(".", $part_no); # Follow chain of parts using the array elements as indicies into # the $structure->parts array $part = $structure; for($x=0; $x<count($parts); $x++) $part=$part->parts[$parts[$x]-1]; # Get MIME type of part switch($part->type) { case TYPETEXT: $type = "text"; break; case TYPEMULTIPART: $type = "multipart"; break; case TYPEMESSAGE: $type = "message"; break; case TYPEAPPLICATION: $type = "application"; break; case TYPEAUDIO: $type = "audio"; break; case TYPEIMAGE: $type = "image"; break; case TYPEVIDEO: $type = "video"; break; case TYPEMODEL: $type = "model"; break; } $type = strtolower($type."/".$part->subtype); header("Content-Type: $type"); header("Content-Length: ".$structure->bytes-1); switch ($part->encoding) { case ENCBASE64: echo imap_base64($text); break; case ENCQUOTEDPRINTABLE: echo imap_qprint($text); break; default: echo $text; break; } imap_close($mbox); ?> And here is the test message that seems to throw it: From owain@vaughan.com Thu Oct 26 12:29:35 2000 Received: from vaughan.com ([194.154.172.68]) by elmsdale.dedic.web.xara.net (8.9.3+Sun/8.9.3) with ESMTP id MAA14611 for <ovaughan@elmsdale.dedic.web.xara.net>; Thu, 26 Oct 2000 12:29:34 +0100 (BST) Message-ID: <39F81578.CDD0E10E@vaughan.com> Date: Thu, 26 Oct 2000 12:28:57 +0100 From: Owain Vaughan <owain@vaughan.com> Reply-To: owain@vaughan.com MIME-Version: 1.0 To: ovaughan@elmsdale.dedic.web.xara.net Subject: [Fwd: [ncafc] Argus - Wed] Content-Type: multipart/mixed; boundary="------------D22185BDCD32A70A64B0E38A" Content-Length: 5588 Status: RO X-Status: X-Keywords: X-UID: 13 This is a multi-part message in MIME format. --------------D22185BDCD32A70A64B0E38A Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit --------------D22185BDCD32A70A64B0E38A Content-Type: message/rfc822 Content-Transfer-Encoding: 7bit Content-Disposition: inline To: _Newport County AFC <newport-county@topica.com>, _Newport County One List <newport-county@onelist.com> From: rogerjones <rogerjones@ntlworld.com> Subject: [ncafc] Argus - Wed Date: Wed, 25 Oct 2000 12:39:14 -0700 Message-ID: <0.1700003364.310955011-212058698-972502754@topica.com> Reply-To: newport-county@topica.com MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0039_01C03EC3.C3B46C20" This is a multi-part message in MIME format. ------=_NextPart_000_0039_01C03EC3.C3B46C20 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable NEWPORT County's unbeaten youth team face the "biggest test" of the = season tonight with three of their star players doubtful starters. They young Exiles host Hereford United in the first round proper of the = FA Youth Cup at Newport Stadium and could without Andrew Thomas, Ryan = Dorrian and Raith Plant, exciting prospects who have all already played = for the senior team in the Dr Martens League Premier Division. All three are due to have fitness tests later today, with central = defender Thomas the least likely to play. Newport have accounted for Salisbury City (4-1 away), Cinderford (2-1 = home) and Worcester City (4-2 away) in the competition so far. If they carry on their winning form tonight they will find themselves = just one step away from taking on a major team. But they face a tough task: "It will be the biggest test we have faced, = they're a very good footballing side," said youth team manager Roger = Skyrme. "They have an academy system similar to ours, so it will be a case of = like playing like. "We try to play from the back and they are a very = good side so it should be a feast of football tonight." Newport squad: R Mackerness, A Williams, D Davies, D Lloyd, L Stanton, L = Andrews, A Thomas, A Stewart, L Hewer, R Jones, R Dorrian, J Hammonds, R = Edwards, M Curry, L Sommers, W Antoniazzi, R Plant, M Shearman, S = Pearce, A Bell. Newport slipped back into the bottom four of the Dr Martens League = Premier Division last night as a result of Folkestone's 1-1 draw away to = Welling.=20 ------------------------ TO UNSUBSCRIBE from the Newport County list send any message to newport-county-unsubscribe@topica.com TO change to the DIGEST version (one email per day) send a message to newport-county-request-digest@topica.com ___________________________________________________________ T O P I C A The Email You Want. http://www.topica.com/t/16 Newsletters, Tips and Discussions on Your Favorite Topics ------=_NextPart_000_0039_01C03EC3.C3B46C20 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META content=3D"text/html; charset=3Diso-8859-1" = http-equiv=3DContent-Type> <META content=3D"MSHTML 5.00.3105.105" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT color=3D#130029 = face=3DArial,Helvetica,Geneva,Swiss,SunSans-Regular=20 size=3D2> <P>NEWPORT County's unbeaten youth team face the "biggest test" of the = season=20 tonight with three of their star players doubtful starters.</P> <P>They young Exiles host Hereford United in the first round proper of = the FA=20 Youth Cup at Newport Stadium and could without Andrew Thomas, Ryan = Dorrian and=20 Raith Plant, exciting prospects who have all already played for the = senior team=20 in the Dr Martens League Premier Division.</P> <P>All three are due to have fitness tests later today, with central = defender=20 Thomas the least likely to play.</P> <P>Newport have accounted for Salisbury City (4-1 away), Cinderford (2-1 = home)=20 and Worcester City (4-2 away) in the competition so far.</P> <P>If they carry on their winning form tonight they will find themselves = just=20 one step away from taking on a major team.</P> <P>But they face a tough task: "It will be the biggest test we have = faced,=20 they're a very good footballing side," said youth team manager Roger = Skyrme.</P> <P>"They have an academy system similar to ours, so it will be a case of = like=20 playing like. "We try to play from the back and they are a very good = side so it=20 should be a feast of football tonight."</P> <P>Newport squad: R Mackerness, A Williams, D Davies, D Lloyd, L = Stanton, L=20 Andrews, A Thomas, A Stewart, L Hewer, R Jones, R Dorrian, J Hammonds, R = Edwards, M Curry, L Sommers, W Antoniazzi, R Plant, M Shearman, S = Pearce, A=20 Bell.</P> <P>Newport slipped back into the bottom four of the Dr Martens League = Premier=20 Division last night as a result of Folkestone's 1-1 draw away to = Welling.=20 </P></FONT></DIV> <PRE>------------------------ TO UNSUBSCRIBE from the Newport County list send any message to newport-county-unsubscribe@topica.com TO change to the DIGEST version (one email per day) send a message to newport-county-request-digest@topica.com </PRE> <PRE>___________________________________________________________ T O P I C A The Email You Want. <A HREF=3D"http://www.topica.com/t/16">http://www.topica.com/t/16</A> Newsletters, Tips and Discussions on Your Favorite Topics</PRE> </BODY></HTML> ------=_NextPart_000_0039_01C03EC3.C3B46C20-- --------------D22185BDCD32A70A64B0E38A--

« previous php.dev (#36389) next »