From abddc974c228ad2762c276ad68778dde7cdfeabf Mon Sep 17 00:00:00 2001 From: lkehresman Date: Sun, 5 Mar 2000 03:53:38 +0000 Subject: [PATCH] Fixed some bugs in folder deleting git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@267 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/imap_mailbox.php | 3 ++- functions/tree.php | 23 ++++++++++++++++++----- src/folders.php | 4 ++-- src/folders_delete.php | 12 +++++++++--- 4 files changed, 31 insertions(+), 11 deletions(-) diff --git a/functions/imap_mailbox.php b/functions/imap_mailbox.php index 1c562dd7..c5c8aced 100755 --- a/functions/imap_mailbox.php +++ b/functions/imap_mailbox.php @@ -82,9 +82,9 @@ ** This function simply deletes the given folder ******************************************************************************/ function sqimap_mailbox_delete ($imap_stream, $mailbox) { - sqimap_unsubscribe ($imap_stream, $mailbox); fputs ($imap_stream, "a001 DELETE \"$mailbox\"\n"); $read_ary = sqimap_read_data($imap_stream, "a001", true, $response, $message); + sqimap_unsubscribe ($imap_stream, $mailbox); } @@ -118,6 +118,7 @@ $boxes[$g]["formatted"] = $boxes[$g]["formatted"] . " "; $boxes[$g]["formatted"] .= readShortMailboxName($mailbox, $dm); + $boxes[$g]["unformatted-dm"] = $mailbox; if (substr($mailbox, -1) == $dm) $mailbox = substr($mailbox, 0, strlen($mailbox) - 1); $boxes[$g]["unformatted"] = $mailbox; diff --git a/functions/tree.php b/functions/tree.php index 680b0d04..5ee0a775 100644 --- a/functions/tree.php +++ b/functions/tree.php @@ -8,9 +8,11 @@ if ((isset($tree[$treeIndexToStart])) && (strstr($value, $tree[$treeIndexToStart]["value"]))) { if ($tree[$treeIndexToStart]["doIHaveChildren"]) { for ($i=0;$i< count($tree[$treeIndexToStart]["subNodes"]);$i++) { - $result = findParentForChild($value, $tree[$treeIndexToStart]["subNodes"][$i]); - if ($result > -1) + $result = findParentForChild($value, $tree[$treeIndexToStart]["subNodes"][$i], $tree); + if ($result > -1) { + echo "parent for $value is : " . $tree[$treeIndexToStart]["subNodes"][$i] . "
"; return $result; + } } return $treeIndexToStart; } else @@ -20,11 +22,11 @@ } } - function addChildNodeToTree($value, &$tree) { - $parentNode = findParentForChild($value, 0, $tree); + function addChildNodeToTree($comparisonValue, $value, &$tree) { + $parentNode = findParentForChild($comparisonValue, 0, $tree); // create a new subNode - $newNodeIndex = count($tree) + 1; + $newNodeIndex = count($tree); $tree[$newNodeIndex]["value"] = $value; $tree[$newNodeIndex]["doIHaveChildren"] = false; @@ -75,4 +77,15 @@ sqimap_messages_copy($imap_stream, 1, $messageCount, $trash_folder . $dm . $subFolderName); } } + + function simpleWalkTreePre($index, $tree) { + if ($tree[$index]["doIHaveChildren"]) { + for ($j = 0; $j < count($tree[$index]["subNodes"]); $j++) { + simpleWalkTreePre($tree[$index]["subNodes"][$j], $tree); + } + echo $tree[$index]["value"] . "
"; + } else { + echo $tree[$index]["value"] . "
"; + } + } ?> diff --git a/src/folders.php b/src/folders.php index f35b84d8..7b9c99bb 100644 --- a/src/folders.php +++ b/src/folders.php @@ -45,7 +45,7 @@ } } if ($use_folder == true) { - $box = $boxes[$i]["unformatted"]; + $box = $boxes[$i]["unformatted-dm"]; $box2 = replace_spaces($boxes[$i]["formatted"]); echo "