previous cleanup broke the find_ent_id function
authorstekkel <stekkel@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 5 Sep 2002 17:34:27 +0000 (17:34 +0000)
committerstekkel <stekkel@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 5 Sep 2002 17:34:27 +0000 (17:34 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@3568 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/mime.php

index 4450529900b7abad21143a938f0db1a29a92931c..d2e88463ce6da95afb4fcdd2fa908fca19838fd4 100644 (file)
@@ -622,17 +622,15 @@ function encodeHeader ($string) {
 }
 
 /* This function trys to locate the entity_id of a specific mime element */
 }
 
 /* This function trys to locate the entity_id of a specific mime element */
-
 function find_ent_id($id, $message) {
 function find_ent_id($id, $message) {
-    $ret = '';
-    for ($i = 0; $ret == '' && $i < count($message->entities); $i++) {
-        if ($message->entities[$i]->header->type0 != 'multipart')  {
+    for ($i = 0, $ret = ''; $ret == '' && $i < count($message->entities); $i++) {
+        if ($message->entities[$i]->header->type0 == 'multipart')  {
             $ret = find_ent_id($id, $message->entities[$i]);
         } else {
             if (strcasecmp($message->entities[$i]->header->id, $id) == 0) {
                 if (sq_check_save_extension($message->entities[$i])) {
             $ret = find_ent_id($id, $message->entities[$i]);
         } else {
             if (strcasecmp($message->entities[$i]->header->id, $id) == 0) {
                 if (sq_check_save_extension($message->entities[$i])) {
-                    $ret = $message->entities[$i]->entity_id;
-                }
+                    return $message->entities[$i]->entity_id;
+                } 
             }
         }
     }
             }
         }
     }