From 812843b788e63481bae81178aec4d9934672937b Mon Sep 17 00:00:00 2001 From: stekkel Date: Thu, 22 Aug 2002 08:43:29 +0000 Subject: [PATCH] added function to extract filename from an entity with error correction in case the disposition isn't defined git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@3397 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- class/mime.class.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/class/mime.class.php b/class/mime.class.php index 8d1def3d..ebd75bd1 100644 --- a/class/mime.class.php +++ b/class/mime.class.php @@ -667,6 +667,25 @@ class message $this->entities[] = $msg; } + function getFilename() + { + $filename = ''; + if (is_object($this->header->disposition)) + { + $filename = $this->header->disposition->getproperty('filename'); + if (!$filename) + { + $filename = $this->header->disposition->getproperty('name'); + } + } + if (!$filename) + { + $filename = 'untitled-'.$this->entity_id; + } + return $filename; + } + + function addRFC822Header($read) { $header = new rfc822_header(); -- 2.25.1