X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Fempty_trash.php;h=415e35ec8e6d8cae41509fec382ac6c61ab81743;hb=50d5212cd729d067bd9d4243fd66eed39d608207;hp=2cec2decf31cb58df8ec16a67b28021fff9ca206;hpb=8a777b6b845ac4c709c88cec28a3848102576b4a;p=squirrelmail.git diff --git a/src/empty_trash.php b/src/empty_trash.php index 2cec2dec..415e35ec 100644 --- a/src/empty_trash.php +++ b/src/empty_trash.php @@ -1,64 +1,76 @@ +/** 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); + +$location = get_location(); +header ("Location: $location/left_main.php"); + +sqimap_logout($imap_stream); +?> \ No newline at end of file