src/core/framework/core/3rdparty/ezcomponents/Mail/src/parser/parts/file_parser.php
public function finish()
    {
        fclose( $this->fp );
        $this->fp = null;


        // FIXME: DIRTY PGP HACK
        // When we have PGP support these lines should be removed. They are here now to hide
        // PGP parts since they will show up as file attachments if not.
        if ( $this->mainType == "application" &&
            ( $this->subType == 'pgp-signature'
              || $this->subType == 'pgp-keys'
              || $this->subType == 'pgp-encrypted' ) )
        {
            return null;
        }
        // END DIRTY PGP HACK

        $filePart = new self::$fileClass( $this->fileName );

        // set content type
        $filePart->setHeaders( $this->headers->getCaseSensitiveArray() );
        ezcMailPartParser::parsePartHeaders( $this->headers, $filePart );
        switch ( strtolower( $this->mainType ) )
        {
            case 'image':
                $filePart->contentType = ezcMailFile::CONTENT_TYPE_IMAGE;
                break;
            case 'audio':
                $filePart->contentType = ezcMailFile::CONTENT_TYPE_AUDIO;
                break;
            case 'video':
                $filePart->contentType = ezcMailFile::CONTENT_TYPE_VIDEO;
                break;
            case 'application':
                $filePart->contentType = ezcMailFile::CONTENT_TYPE_APPLICATION;
                break;
        }

        // set mime type
        $filePart->mimeType = $this->subType;

        // set inline disposition mode if set.
        $matches = array();
        if ( preg_match( '/^\s*inline;?/i',
                        $this->headers['Content-Disposition'], $matches ) )
        {
            $filePart->dispositionType = ezcMailFile::DISPLAY_INLINE;
        }
        if ( preg_match( '/^\s*attachment;?/i',
                        $this->headers['Content-Disposition'], $matches ) )
        {
            $filePart->dispositionType = ezcMailFile::DISPLAY_ATTACHMENT;
        }
        $filePart->size = filesize( $this->fileName );
        return $filePart;
    }
public function finish()
    {
        fclose( $this->fp );
        $this->fp = null;


        // FIXME: DIRTY PGP HACK
        // When we have PGP support these lines should be removed. They are here now to hide
        // PGP parts since they will show up as file attachments if not.
        if ( $this->mainType == "application" &&
            ( $this->subType == 'pgp-signature'
              || $this->subType == 'pgp-keys'
              || $this->subType == 'pgp-encrypted' ) )
        {
            return null;
        }
        // END DIRTY PGP HACK

        $filePart = new self::$fileClass( $this->fileName );

        // set content type
        $filePart->setHeaders( $this->headers->getCaseSensitiveArray() );
        ezcMailPartParser::parsePartHeaders( $this->headers, $filePart );
        switch ( strtolower( $this->mainType ) )
        {
            case 'image':
                $filePart->contentType = ezcMailFile::CONTENT_TYPE_IMAGE;
                break;
            case 'audio':
                $filePart->contentType = ezcMailFile::CONTENT_TYPE_AUDIO;
                break;
            case 'video':
                $filePart->contentType = ezcMailFile::CONTENT_TYPE_VIDEO;
                break;
            case 'application':
                $filePart->contentType = ezcMailFile::CONTENT_TYPE_APPLICATION;
                break;
        }

        // set mime type
        $filePart->mimeType = $this->subType;

        // set inline disposition mode if set.
        $matches = array();
        if ( preg_match( '/^\s*inline;?/i',
                        $this->headers['Content-Disposition'], $matches ) )
        {
            $filePart->dispositionType = ezcMailFile::DISPLAY_INLINE;
        }
        if ( preg_match( '/^\s*attachment;?/i',
                        $this->headers['Content-Disposition'], $matches ) )
        {
            $filePart->dispositionType = ezcMailFile::DISPLAY_ATTACHMENT;
        }
        $filePart->size = filesize( $this->fileName );
        return $filePart;
    }
public function finish ( ) { fclose ( $ this -> fp ) ; $ this -> fp = null ; // FIXME: DIRTY PGP HACK // When we have PGP support these lines should be removed. They are here now to hide // PGP parts since they will show up as file attachments if not. if ( $ this -> mainType == "application" && ( $ this -> subType == 'pgp-signature' || $ this -> subType == 'pgp-keys' || $ this -> subType == 'pgp-encrypted' ) ) { return null ; } // END DIRTY PGP HACK $ filePart = new self :: $ fileClass ( $ this -> fileName ) ; // set content type $ filePart -> setHeaders ( $ this -> headers -> getCaseSensitiveArray ( ) ) ; ezcMailPartParser :: parsePartHeaders ( $ this -> headers , $ filePart ) ; switch ( strtolower ( $ this -> mainType ) ) { case 'image' : $ filePart -> contentType = ezcMailFile :: CONTENT_TYPE_IMAGE ; break ; case 'audio' : $ filePart -> contentType = ezcMailFile :: CONTENT_TYPE_AUDIO ; break ; case 'video' : $ filePart -> contentType = ezcMailFile :: CONTENT_TYPE_VIDEO ; break ; case 'application' : $ filePart -> contentType = ezcMailFile :: CONTENT_TYPE_APPLICATION ; break ; } // set mime type $ filePart -> mimeType = $ this -> subType ; // set inline disposition mode if set. $ matches = array ( ) ; if ( preg_match ( '/^\s*inline;?/i' , $ this -> headers [ 'Content-Disposition' ] , $ matches ) ) { $ filePart -> dispositionType = ezcMailFile :: DISPLAY_INLINE ; } if ( preg_match ( '/^\s*attachment;?/i' , $ this -> headers [ 'Content-Disposition' ] , $ matches ) ) { $ filePart -> dispositionType = ezcMailFile :: DISPLAY_ATTACHMENT ; } $ filePart -> size = filesize ( $ this -> fileName ) ; return $ filePart ; }
Return the result of the parsed file part.

This method is called automatically by the parent part.

@return ezcMailFile
Return the result of the parsed file part .