X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;ds=inline;f=functions%2Ftree.php;h=5ee0a775dfcbe5fbd7bf543eef195b85b3d982b7;hb=abddc974c228ad2762c276ad68778dde7cdfeabf;hp=680b0d04478a3f8ee5461b8fe2610abb29789ce0;hpb=8382c2dcabc8685c5b344ddd8c6cc8d7d55a2a1b;p=squirrelmail.git
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"] . "
";
+ }
+ }
?>