- var $mailboxname_full = '', $mailboxname_sub= '', $is_noselect = false,
- $is_special = false, $is_root = false, $is_inbox = false, $is_sent = false,
- $is_trash = false, $is_draft = false, $mbxs = array(),
- $unseen = false, $total = false;
-
- function addMbx($mbx, $delimiter, $start, $specialfirst) {
- $ary = explode($delimiter, $mbx->mailboxname_full);
- $mbx_parent = &$this;
- for ($i=$start; $i < (count($ary) -1); $i++) {
- $mbx_childs = &$mbx_parent->mbxs;
- $found = false;
- foreach ($mbx_childs as $key => $parent) {
- if ($parent->mailboxname_sub == $ary[$i]) {
- $mbx_parent = &$mbx_parent->mbxs[$key];
- $found = true;
- }
- }
- if (!$found) {
- $no_select_mbx = new mailboxes();
- if (isset($mbx_parent->mailboxname_full) && $mbx_parent->mailboxname_full != '') {
- $no_select_mbx->mailboxname_full = $mbx_parent->mailboxname_full.$delimiter.$ary[$i];
- } else {
- $no_select_mbx->mailboxname_full = $ary[$i];
- }
- $no_select_mbx->mailboxname_sub = $ary[$i];
- $no_select_mbx->is_noselect = true;
- $mbx_parent->mbxs[] = $no_select_mbx;
- $i--;
- }
-
- }
- $mbx_parent->mbxs[] = $mbx;
- if ($mbx->is_special && $specialfirst) {
- usort($mbx_parent->mbxs, 'sortSpecialMbx');
- }
-
- }
+ var $mailboxname_full = '', $mailboxname_sub= '', $is_noselect = false,
+ $is_special = false, $is_root = false, $is_inbox = false, $is_sent = false,
+ $is_trash = false, $is_draft = false, $mbxs = array(),
+ $unseen = false, $total = false;
+
+ function addMbx($mbx, $delimiter, $start, $specialfirst) {
+ $ary = explode($delimiter, $mbx->mailboxname_full);
+ $mbx_parent = &$this;
+ for ($i = $start, $c = count($ary)-1; $i < $c; $i++) {
+ $mbx_childs = &$mbx_parent->mbxs;
+ $found = false;
+ if ($mbx_childs) {
+ foreach ($mbx_childs as $key => $parent) {
+ if ($parent->mailboxname_sub == $ary[$i]) {
+ $mbx_parent = &$mbx_parent->mbxs[$key];
+ $found = true;
+ }
+ }
+ }
+ if (!$found) {
+ $no_select_mbx = new mailboxes();
+ if (isset($mbx_parent->mailboxname_full) && $mbx_parent->mailboxname_full != '') {
+ $no_select_mbx->mailboxname_full = $mbx_parent->mailboxname_full.$delimiter.$ary[$i];
+ } else {
+ $no_select_mbx->mailboxname_full = $ary[$i];
+ }
+ $no_select_mbx->mailboxname_sub = $ary[$i];
+ $no_select_mbx->is_noselect = true;
+ $mbx_parent->mbxs[] = $no_select_mbx;
+ $i--;
+ }
+ }
+ $mbx_parent->mbxs[] = $mbx;
+ if ($mbx->is_special && $specialfirst) {
+ usort($mbx_parent->mbxs, 'sortSpecialMbx');
+ }
+ }