Hallo, ich hab ne neue maildecoder-klasse gefunden, da die von tbt nicht richtig funzt.
Ich bekomm folgenden Fehler :
Warning: Variable passed to each() is not an array or object in /srv/www/htdocs/web8/html/test/config/maildecoder.class.php on line 16
Zeile 16 ist :
while ( list(, $line) = each($body) ) {
was bedeutet der fehler??? und wie kann ich den beheben!
	
Danke im voraus für die hilfe!!!
							
						
					Ich bekomm folgenden Fehler :
Warning: Variable passed to each() is not an array or object in /srv/www/htdocs/web8/html/test/config/maildecoder.class.php on line 16
Zeile 16 ist :
while ( list(, $line) = each($body) ) {
was bedeutet der fehler??? und wie kann ich den beheben!
PHP Code:
	
	
class MimeDecoder {
    var $attachments;
    var $text_version;
    # This accepts the body of a message (in Array form, split on n) and the
    # MIME encoded boundary.
    # This returns a two dimensional array, with the \'ContentType\', \'filename\',
    # \'ContentTypeEncoding\' and the attachment \'data\' for each indexed
    # attachment.
    function MimeDecode($body, $boundary) {
    $attach_no = -1;
while ( list(, $line) = each($body) ) {
    $line = trim($line);
    if ( strstr($line, "--$boundary") ) {
        $this->attachments['number'] = ++$attach_no;
        continue;
    }
    if ( !$this->attachments[$attach_no]['ContentType'] &&
         preg_match("/^Content-Type: ([w-/]*);?(.*)?/", $line, $matches) ) {
        $this->attachments[$attach_no]['ContentType'] = trim($matches[1]);
        if ( $matches[2] &&
             preg_match("/name=\"(.*)\"/i", $matches[2],
                        $new_match)) {
            if (!$this->attachments[$attach_no]['filename'])
                $this->attachments[$attach_no]['filename']=trim($new_match[1]);
        }
        continue;
    }
    if ( !$this->attachments[$attach_no]['filename'] &&
         preg_match("/name=\"(.*)\"/i", $line, $matches) ) {
        $this->attachments[$attach_no]['filename'] = trim($matches[1]);
        continue;
    }
    if ( !$this->attachments[$attach_no]['ContentTransferEncoding'] &&
         preg_match("/^Content-Transfer-Encoding: (.*)/", $line, $matches) ) {
        $this->attachments[$attach_no]['ContentTransferEncoding'] = trim($matches[1]);
        continue;
    }
    if ( !$line && !$this->attachments[$attach_no]['data'] ) {
        $data[0] = "";
        while ( list (, $line) = each($body) ) {
            $line = trim($line);
            $line = preg_replace("/< */? *HTML *>/i", "", $line);
            if (strstr($line, $boundary)) {
                prev($body);
                break;
            }
            array_push($data, $line."n");
        }
        # Decode attachment data before leaving...
        # Base64 encoded messages...
        if ( !strcasecmp($this->attachments[$attach_no]['ContentTransferEncoding'], "base64") ) {
            $this->attachments[$attach_no]['data'][0] = "";
            foreach ($data as $line) array_push($this->attachments[$attach_no]['data'],  base64_decode($line));
        # Quoted-Printable encoded messages
        } else if ( !strcasecmp($this->attachments[$attach_no]['ContentTransferEncoding'],"quoted-printable") ) {
            $this->attachments[$attach_no]['data'][0] = "";
            foreach ($data as $line) array_push($this->attachments[$attach_no]['data'],  quoted_printable_decode($line));
        # 7 or 8 bit \"encoding\"
        } else if ( !strcasecmp($this->attachments[$attach_no]['ContentTransferEncoding'],"7bit") || 
!strcasecmp($this->attachments[$attach_no]['ContentTransferEncoding'], "8bit") ) {
            $this->attachments[$attach_no]['data'] = $data;
        # defualt to just dumping the data
        } else {
            $this->attachments[$attach_no]['data'] = $data;
        }
        $data = NULL;
        continue;
    }
} # end foreach
    } # end MimeDecode
} 
          
 Moderator
 
Comment