Deleting of folders works
authorlkehresman <lkehresman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 29 Nov 1999 02:45:31 +0000 (02:45 +0000)
committerlkehresman <lkehresman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 29 Nov 1999 02:45:31 +0000 (02:45 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@36 7612ce4b-ef26-0410-bec9-ea0150e637f0

src/empty_trash.php

index f6baf0db982eef4f0200b96b63cfdd7cfc24add2..caed2019673792fcd03caa5ce4f1b7746fc2d39e 100644 (file)
       exit;
    }
 
+
+   /** GET FOLDER ARRAY OF TRASH SUBFOLDERS **/
+   fputs($imapConnection, "1 list \"\" *\n");
+   $str = imapReadData($imapConnection);
+
+   for ($i = 0;$i < count($str); $i++) {
+      $box = Chop($str[$i]);
+      $mailbox = findMailboxName($box);
+
+      if (strpos($box, $trash_folder) > 0) {
+         $folders[$i] = $mailbox;
+      } else {
+         $folders[$i] = "NOPE";
+      }
+   }
+
+   $trash = getFolderNameMinusINBOX($trash_folder);
+   $trash = "user.$username.$trash";
    // mark them as deleted
    setMessageFlag($imapConnection, 1, $numMessages, "Deleted");
    expungeBox($imapConnection, $mailbox);
 
+   // remove subfolders
+   for ($i = 0; $i < count($folders); $i++) {
+      if ($folders[$i] != "NONE") {
+         $trash = getFolderNameMinusINBOX($folders[$i]);
+         $trash = "user.$username.$trash";
+         echo "$trash<BR>";
+         removeFolder($imapConnection, $trash);
+      }
+   }
+
+   createFolder($imapConnection, "user.$username.$trash_folder");
+
    // Log out this session
    fputs($imapConnection, "1 logout");