X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Fempty_trash.php;h=ceaac877173192dc35ffce5b8997bb5852e57dd9;hb=2c92ea9da4c11cac1ea3118a1e0fda6407e5d62b;hp=2cec2decf31cb58df8ec16a67b28021fff9ca206;hpb=8a777b6b845ac4c709c88cec28a3848102576b4a;p=squirrelmail.git diff --git a/src/empty_trash.php b/src/empty_trash.php index 2cec2dec..ceaac877 100644 --- a/src/empty_trash.php +++ b/src/empty_trash.php @@ -1,64 +1,80 @@ +/** 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