added function to extract filename from an entity with error correction in
authorstekkel <stekkel@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 22 Aug 2002 08:43:29 +0000 (08:43 +0000)
committerstekkel <stekkel@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 22 Aug 2002 08:43:29 +0000 (08:43 +0000)
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

index 8d1def3..ebd75bd 100644 (file)
@@ -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();