X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Fempty_trash.php;h=d81facc7d02777f80feec6693cf202979089d724;hb=f7cd8eb4e788b45f94c494836eae2ac63522a672;hp=d46280142f853dbe3fbf1acea732e481517396de;hpb=b954b6faf740d280dc9067fad0b15966afa282fe;p=squirrelmail.git diff --git a/src/empty_trash.php b/src/empty_trash.php index d4628014..d81facc7 100644 --- a/src/empty_trash.php +++ b/src/empty_trash.php @@ -1,66 +1,78 @@ +/** 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); +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