Josh Connerty
This reply contains the original code in respect to the author who developed it, that I was studying.
<?
// define some constants
// message types
$type = array("text", "multipart", "message", "application", "audio",
"image", "video", "other");
// message encodings
$encoding = array("7bit", "8bit", "binary", "base64", "quoted-printable",
"other");
// parse message body
function parse($structure)
{
global $type;
global $encoding;
// create an array to hold message sections
$ret = array();
// split structure into parts
$parts = $structure->parts;
for($x=0; $x<sizeof($parts); $x++)
{
$ret[$x]["pid"] = ($x+1);
$this = $parts[$x];
// default to text
if ($this->type == "") { $this->type = 0; }
$ret[$x]["type"] = $type[$this->type] . "/" . strtolower($this->subtype);
// default to 7bit
if ($this->encoding == "") { $this->encoding = 0; }
$ret[$x]["encoding"] = $encoding[$this->encoding];
$ret[$x]["size"] = strtolower($this->bytes);
$ret[$x]["disposition"] = strtolower($this->disposition);
if (strtolower($this->disposition) == "attachment")
{
$params = $this->dparameters;
foreach ($params as $p)
{
if($p->attribute == "FILENAME")
{
$ret[$x]["name"] = $p->value;
break;
}
}
}
}
return $ret;
}
?>
Changing all $this to $result, made the application work, but with unexpected results. I have debugged most of the conditional statements above and my major problem lied with this if statement:
if (strtolower($this->disposition) == "attachment")
It was suppose to read the conditional statement, but instead it doesn't find any value inside of the
$this->disposition containing an "attachment" string value.
Any comments would still be appreciated.
Thanks