From: stekkel Date: Thu, 22 Aug 2002 08:43:29 +0000 (+0000) Subject: added function to extract filename from an entity with error correction in X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=812843b788e63481bae81178aec4d9934672937b;p=squirrelmail.git 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 --- 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();