function mailboxes($start = ""){ global $imap, $do_not_show; static $tree,$name,$array; $dont_show = array("Slettet", "Sendt post"); if(!empty($do_not_show)){ $dont_show = array_merge($do_not_show,$dont_show); } $list = imap_getmailboxes($imap, "{localhost:143/novalidate-cert}$start", "%"); if (is_array($list)) { $info = array(); $space = "    "; foreach ($list as $key => $val) { $spaces = substr_count($start, "."); $spaces = str_repeat($space, $spaces); $name = str_replace("{localhost:143/novalidate-cert}".$start, "", $val->name); $name = str_replace(".", "", $name); //$tree .= $spaces.$name."
"; $info['name'] = $name; $info['name_wspaces'] = $spaces.$name; $info['full_path'] = $val->name; if(!in_array($name, $dont_show)){ $array[] = $info; } if (!($val->attributes & LATT_HASNOCHILDREN)) { if(empty($start)){ $next = $start; } else{ $next = $start . "."; } $go = $next . $name; mailboxes($go, 0); } } } $the_return = $array; return $the_return; }