X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Fempty_trash.php;h=a099d66782fca0c856efe635e59e7b823bdbb751;hb=51fa8319fff96a2272291ad58274898ba595b270;hp=42023fe056a185d23940ee8f9b8c8dbee63ada63;hpb=245a6892bf5c780904ef9677f24d624ea17e0749;p=squirrelmail.git diff --git a/src/empty_trash.php b/src/empty_trash.php index 42023fe0..a099d667 100644 --- a/src/empty_trash.php +++ b/src/empty_trash.php @@ -1,66 +1,77 @@ +/** First create the top node in the tree **/ +$numboxes = count($boxes); +for ($i = 0; $i < $numboxes; $i++) { + if (($boxes[$i]['unformatted'] == $mailbox) && (strlen($boxes[$i]['unformatted']) == strlen($mailbox))) { + $foldersTree[0]['value'] = $mailbox; + $foldersTree[0]['doIHaveChildren'] = false; + continue; + } +} +/* + * Now create the nodes for subfolders of the parent folder + * You can tell that it is a subfolder by tacking the mailbox delimiter + * on the end of the $mailbox string, and compare to that. + */ +$j = 0; +for ($i = 0; $i < $numboxes; $i++) { + if (substr($boxes[$i]['unformatted'], 0, strlen($mailbox . $delimiter)) == ($mailbox . $delimiter)) { + addChildNodeToTree($boxes[$i]['unformatted'], $boxes[$i]['unformatted-dm'], $foldersTree); + } +} + +// now lets go through the tree and delete the folders +walkTreeInPreOrderEmptyTrash(0, $imap_stream, $foldersTree); +// update mailbox cache +$mailboxes=sqimap_get_mailboxes($imap_stream,true,$show_only_subscribed_folders); +sqimap_logout($imap_stream); + +// close session properly before redirecting +session_write_close(); + +$location = get_location(); +header ("Location: $location/left_main.php"); + +?> \ No newline at end of file