Example #1
0
 public function &getMimeNumbers(&$structure, $no_refs = false, $mime_number = "", $prepend = "")
 {
     $return = array();
     if (!empty($structure->parts)) {
         if ($mime_number != "") {
             $structure->mime_id = $prepend . $mime_number;
             $return[$prepend . $mime_number] =& $structure;
         }
         for ($i = 0; $i < count($structure->parts); $i++) {
             if (!empty($structure->headers["content-type"]) && substr(strtolower($structure->headers["content-type"]), 0, 8) == "message/") {
                 $prepend = $prepend . $mime_number . ".";
                 $_mime_number = "";
             } else {
                 $_mime_number = $mime_number == "" ? $i + 1 : sprintf("%s.%s", $mime_number, $i + 1);
             }
             $arr =& Mail_mimeDecode::getmimenumbers($structure->parts[$i], $no_refs, $_mime_number, $prepend);
             foreach ($arr as $key => $val) {
                 $no_refs ? $return[$key] : ($return[$key] =& $arr[$key]);
             }
         }
     } else {
         if ($mime_number == "") {
             $mime_number = "1";
         }
         $structure->mime_id = $prepend . $mime_number;
         $no_refs ? $return[$prepend . $mime_number] : ($return[$prepend . $mime_number] =& $structure);
     }
     return $return;
 }