- $_SESSION['sort_order'] = $CONFIG['message_sort_order'];
-
-// set message set for search result
-if (!empty($_REQUEST['_search']) && isset($_SESSION['search'][$_REQUEST['_search']]))
- $IMAP->set_search_set($_SESSION['search'][$_REQUEST['_search']]);
-
-
-// define url for getting message parts
-if (strlen($_GET['_uid']))
- $GET_URL = rcmail_url('get', array('_mbox'=>$IMAP->get_mailbox_name(), '_uid'=>get_input_value('_uid', RCUBE_INPUT_GET)));
-
-
-// set current mailbox in client environment
-$OUTPUT->set_env('mailbox', $IMAP->get_mailbox_name());
-$OUTPUT->set_env('quota', $IMAP->get_capability('quota'));
-
-if ($CONFIG['trash_mbox'])
- $OUTPUT->set_env('trash_mailbox', $CONFIG['trash_mbox']);
-if ($CONFIG['drafts_mbox'])
- $OUTPUT->set_env('drafts_mailbox', $CONFIG['drafts_mbox']);
-if ($CONFIG['junk_mbox'])
- $OUTPUT->set_env('junk_mailbox', $CONFIG['junk_mbox']);
-
-if (!$OUTPUT->ajax_call)
- rcube_add_label('checkingmail');
-
-
-// return the mailboxlist in HTML
-function rcmail_mailbox_list($attrib)
- {
- global $IMAP, $CONFIG, $OUTPUT, $COMM_PATH;
- static $s_added_script = FALSE;
- static $a_mailboxes;
-
- // add some labels to client
- rcube_add_label('purgefolderconfirm');
- rcube_add_label('deletemessagesconfirm');
-
-// $mboxlist_start = rcube_timer();
-
- $type = $attrib['type'] ? $attrib['type'] : 'ul';
- $add_attrib = $type=='select' ? array('style', 'class', 'id', 'name', 'onchange') :
- array('style', 'class', 'id');
-
- if ($type=='ul' && !$attrib['id'])
- $attrib['id'] = 'rcmboxlist';
-
- // allow the following attributes to be added to the <ul> tag
- $attrib_str = create_attrib_string($attrib, $add_attrib);
-
- $out = '<' . $type . $attrib_str . ">\n";
-
- // add no-selection option
- if ($type=='select' && $attrib['noselection'])
- $out .= sprintf('<option value="0">%s</option>'."\n",
- rcube_label($attrib['noselection']));
-
- // get mailbox list
- $mbox_name = $IMAP->get_mailbox_name();
-
- // for these mailboxes we have localized labels
- $special_mailboxes = array('inbox', 'sent', 'drafts', 'trash', 'junk');
-
-
- // build the folders tree
- if (empty($a_mailboxes))
- {
- // get mailbox list
- $a_folders = $IMAP->list_mailboxes();
- $delimiter = $IMAP->get_hierarchy_delimiter();
- $a_mailboxes = array();
-
-// rcube_print_time($mboxlist_start, 'list_mailboxes()');
-
- foreach ($a_folders as $folder)
- rcmail_build_folder_tree($a_mailboxes, $folder, $delimiter);
- }
-
-// var_dump($a_mailboxes);
-
- if ($type=='select')
- $out .= rcmail_render_folder_tree_select($a_mailboxes, $special_mailboxes, $mbox_name, $attrib['maxlength']);
- else
- $out .= rcmail_render_folder_tree_html($a_mailboxes, $special_mailboxes, $mbox_name, $attrib['maxlength']);
-
-// rcube_print_time($mboxlist_start, 'render_folder_tree()');
-
-
- if ($type=='ul')
- $OUTPUT->add_gui_object('mailboxlist', $attrib['id']);
-
- return $out . "</$type>";
- }
-