+ /******************************************************************************
+ ** Formats a mailbox into 4 parts for the $boxes array
+ ******************************************************************************/
+ function sqimap_mailbox_parse ($line, $line_lsub, $dm) {
+ global $folder_prefix;
+ for ($g=0; $g < count($line); $g++) {
+ $boxes[$g]["raw"] = $line[$g];
+
+ $mailbox = $line_lsub[$g];
+ $dm_count = countCharInString($mailbox, $dm);
+ if (substr($mailbox, -1) == $dm)
+ $dm_count--;
+
+ for ($j = 0; $j < $dm_count - (countCharInString($folder_prefix, $dm)); $j++)
+ $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;
+ $boxes[$g]["id"] = $g;
+
+ $flags = substr($line[$g], strpos($line[$g], "(")+1);
+ $flags = substr($flags, 0, strpos($flags, ")"));
+ $flags = str_replace("\\", "", $flags);
+ $flags = trim(strtolower($flags));
+ if ($flags) {
+ $boxes[$g]["flags"] = explode(" ", $flags);
+ }
+ }
+ return $boxes;
+ }
+