diff options
-rw-r--r-- | program/steps/mail/check_recent.inc | 6 | ||||
-rw-r--r-- | program/steps/mail/folders.inc | 4 | ||||
-rw-r--r-- | program/steps/mail/func.inc | 23 | ||||
-rw-r--r-- | program/steps/mail/getunread.inc | 4 | ||||
-rw-r--r-- | program/steps/mail/list.inc | 10 | ||||
-rw-r--r-- | program/steps/mail/mark.inc | 5 | ||||
-rw-r--r-- | program/steps/mail/sendmail.inc | 6 |
7 files changed, 30 insertions, 28 deletions
diff --git a/program/steps/mail/check_recent.inc b/program/steps/mail/check_recent.inc index 0bde47ed8..8a563c4c4 100644 --- a/program/steps/mail/check_recent.inc +++ b/program/steps/mail/check_recent.inc @@ -20,14 +20,14 @@ */ $REMOTE_REQUEST = TRUE; -$mbox = $IMAP->get_mailbox_name(); +$mbox_name = $IMAP->get_mailbox_name(); if ($recent_count = $IMAP->messagecount(NULL, 'RECENT', TRUE)) { $count = $IMAP->messagecount(); $unread_count = $IMAP->messagecount(NULL, 'UNSEEN', TRUE); - $commands = sprintf("this.set_unread_count('%s', %d, true);\n", addslashes($mbox), $unread_count); + $commands = sprintf("this.set_unread_count('%s', %d, true);\n", addslashes($mbox_name), $unread_count); $commands .= sprintf("this.set_env('messagecount', %d);\n", $count); $commands .= sprintf("this.set_rowcount('%s');\n", rcmail_get_messagecount_text()); $commands .= sprintf("this.set_quota('%s');\n", $IMAP->get_quota()); @@ -40,7 +40,7 @@ if ($recent_count = $IMAP->messagecount(NULL, 'RECENT', TRUE)) $commands .= rcmail_js_message_list($a_headers, TRUE); } -if (strtoupper($mbox)!='INBOX' && $IMAP->messagecount('INBOX', 'RECENT')) +if (strtoupper($mbox_name)!='INBOX' && $IMAP->messagecount('INBOX', 'RECENT')) $commands = sprintf("this.set_unread_count('INBOX', %d);\n", $IMAP->messagecount('INBOX', 'UNSEEN')); diff --git a/program/steps/mail/folders.inc b/program/steps/mail/folders.inc index 5a22b7e72..d614ac841 100644 --- a/program/steps/mail/folders.inc +++ b/program/steps/mail/folders.inc @@ -19,7 +19,7 @@ */ $REMOTE_REQUEST = TRUE; -$mbox = $IMAP->get_mailbox_name(); +$mbox_name = $IMAP->get_mailbox_name(); // send EXPUNGE command @@ -49,7 +49,7 @@ else if ($_action=='purge') $commands .= "this.set_env('messagecount', 0);\n"; $commands .= "this.set_env('pagecount', 0);\n"; $commands .= sprintf("this.set_rowcount('%s');\n", rcmail_get_messagecount_text()); - $commands .= sprintf("this.set_unread_count('%s', 0);\n", addslashes($mbox)); + $commands .= sprintf("this.set_unread_count('%s', 0);\n", addslashes($mbox_name)); } else $commands = "// purged: $success"; diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index 83c8bd877..1be690a0b 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -25,6 +25,10 @@ require_once('lib/enriched.inc'); $EMAIL_ADDRESS_PATTERN = '/([a-z0-9][a-z0-9\-\.\+\_]*@[a-z0-9]([a-z0-9\-][.]?)*[a-z0-9]\\.[a-z]{2,5})/i'; +if (empty($_SESSION['mbox'])){ + $_SESSION['mbox'] = $IMAP->get_mailbox_name(); +} + // set imap properties and session vars if (strlen($_GET['_mbox'])) { @@ -57,7 +61,6 @@ if (strlen($_GET['_uid'])) // set current mailbox in client environment $OUTPUT->add_script(sprintf("%s.set_env('mailbox', '%s');", $JS_OBJECT_NAME, $IMAP->get_mailbox_name())); - if ($CONFIG['trash_mbox']) $OUTPUT->add_script(sprintf("%s.set_env('trash_mailbox', '%s');", $JS_OBJECT_NAME, $CONFIG['trash_mbox'])); @@ -93,7 +96,7 @@ function rcmail_mailbox_list($attrib) rcube_label($attrib['noselection'])); // get mailbox list - $mbox = $IMAP->get_mailbox_name(); + $mbox_name = $IMAP->get_mailbox_name(); // for these mailboxes we have localized labels $special_mailboxes = array('inbox', 'sent', 'drafts', 'trash', 'junk'); @@ -116,9 +119,9 @@ function rcmail_mailbox_list($attrib) // var_dump($a_mailboxes); if ($type=='select') - $out .= rcmail_render_folder_tree_select($a_mailboxes, $special_mailboxes, $mbox, $attrib['maxlength']); + $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, $attrib['maxlength']); + $out .= rcmail_render_folder_tree_html($a_mailboxes, $special_mailboxes, $mbox_name, $attrib['maxlength']); // rcube_print_time($mboxlist_start, 'render_folder_tree()'); @@ -162,7 +165,7 @@ function rcmail_build_folder_tree(&$arrFolders, $folder, $delm='/', $path='') // return html for a structured list <ul> for the mailbox tree -function rcmail_render_folder_tree_html(&$arrFolders, &$special, &$mbox, $maxlength, $nestLevel=0) +function rcmail_render_folder_tree_html(&$arrFolders, &$special, &$mbox_name, $maxlength, $nestLevel=0) { global $JS_OBJECT_NAME, $COMM_PATH, $IMAP, $CONFIG, $OUTPUT; @@ -191,7 +194,7 @@ function rcmail_render_folder_tree_html(&$arrFolders, &$special, &$mbox, $maxlen } // add unread message count display - if ($unread_count = $IMAP->messagecount($folder['id'], 'RECENT', ($folder['id']==$mbox))) + if ($unread_count = $IMAP->messagecount($folder['id'], 'RECENT', ($folder['id']==$mbox_name))) $foldername .= sprintf(' (%d)', $unread_count); // make folder name safe for ids and class names @@ -214,7 +217,7 @@ function rcmail_render_folder_tree_html(&$arrFolders, &$special, &$mbox, $maxlen $class_name, $zebra_class, $unread_count ? ' unread' : '', - $folder['id']==$mbox ? ' selected' : '', + $folder['id']==$mbox_name ? ' selected' : '', $COMM_PATH, urlencode($folder['id']), $JS_OBJECT_NAME, @@ -225,7 +228,7 @@ function rcmail_render_folder_tree_html(&$arrFolders, &$special, &$mbox, $maxlen rep_specialchars_output($foldername, 'html', 'all')); if (!empty($folder['folders'])) - $out .= "\n<ul>\n" . rcmail_render_folder_tree_html($folder['folders'], $special, $mbox, $maxlength, $nestLevel+1) . "</ul>\n"; + $out .= "\n<ul>\n" . rcmail_render_folder_tree_html($folder['folders'], $special, $mbox_name, $maxlength, $nestLevel+1) . "</ul>\n"; $out .= "</li>\n"; $idx++; @@ -236,7 +239,7 @@ function rcmail_render_folder_tree_html(&$arrFolders, &$special, &$mbox, $maxlen // return html for a flat list <select> for the mailbox tree -function rcmail_render_folder_tree_select(&$arrFolders, &$special, &$mbox, $maxlength, $nestLevel=0) +function rcmail_render_folder_tree_select(&$arrFolders, &$special, &$mbox_name, $maxlength, $nestLevel=0) { global $IMAP, $OUTPUT; @@ -262,7 +265,7 @@ function rcmail_render_folder_tree_select(&$arrFolders, &$special, &$mbox, $maxl rep_specialchars_output($foldername, 'html', 'all')); if (!empty($folder['folders'])) - $out .= rcmail_render_folder_tree_select($folder['folders'], $special, $mbox, $maxlength, $nestLevel+1); + $out .= rcmail_render_folder_tree_select($folder['folders'], $special, $mbox_name, $maxlength, $nestLevel+1); $idx++; } diff --git a/program/steps/mail/getunread.inc b/program/steps/mail/getunread.inc index d35dcf9f1..437e3aa00 100644 --- a/program/steps/mail/getunread.inc +++ b/program/steps/mail/getunread.inc @@ -25,9 +25,9 @@ $a_folders = $IMAP->list_mailboxes(); if (!empty($a_folders)) { - foreach ($a_folders as $mbox) + foreach ($a_folders as $mbox_row) { - $commands = sprintf("this.set_unread_count('%s', %d);\n", $mbox, $IMAP->messagecount($mbox, 'UNSEEN')); + $commands = sprintf("this.set_unread_count('%s', %d);\n", $mbox_row, $IMAP->messagecount($mbox_row, 'UNSEEN')); rcube_remote_response($commands, TRUE); } } diff --git a/program/steps/mail/list.inc b/program/steps/mail/list.inc index ba4169f7b..b3ea08b28 100644 --- a/program/steps/mail/list.inc +++ b/program/steps/mail/list.inc @@ -46,16 +46,16 @@ else if (!empty($_GET['_search']) && isset($_SESSION['search'][$_GET['_search']])) { $a_msgs = split(',', $_SESSION['search'][$_GET['_search']]); - $a_headers = $IMAP->list_header_set($mbox, $a_msgs, NULL, $sort_col, $sort_order); + $a_headers = $IMAP->list_header_set($mbox_name, $a_msgs, NULL, $sort_col, $sort_order); $count = count($a_msgs); } else { if ($count = $IMAP->messagecount()) - $a_headers = $IMAP->list_headers($mbox, NULL, $sort_col, $sort_order); + $a_headers = $IMAP->list_headers($mbox_name, NULL, $sort_col, $sort_order); } -$unseen = $IMAP->messagecount($mbox, 'UNSEEN', !empty($_GET['_refresh']) ? TRUE : FALSE); +$unseen = $IMAP->messagecount($mbox_name, 'UNSEEN', !empty($_GET['_refresh']) ? TRUE : FALSE); // update message count display $pages = ceil($count/$IMAP->page_size); @@ -64,8 +64,8 @@ $commands .= sprintf("this.set_env('pagecount', %d);\n", $pages); $commands .= sprintf("this.set_rowcount('%s');\n", rcmail_get_messagecount_text($count)); // update mailboxlist -$mbox = $IMAP->get_mailbox_name(); -$commands .= sprintf("this.set_unread_count('%s', %d);\n", addslashes($mbox), $unseen); +$mbox_name = $IMAP->get_mailbox_name(); +$commands .= sprintf("this.set_unread_count('%s', %d);\n", addslashes($mbox_name), $unseen); // add message rows diff --git a/program/steps/mail/mark.inc b/program/steps/mail/mark.inc index c12429d4a..e6e06f976 100644 --- a/program/steps/mail/mark.inc +++ b/program/steps/mail/mark.inc @@ -1,5 +1,4 @@ <?php - /* +-----------------------------------------------------------------------+ | program/steps/mail/mark.inc | @@ -32,8 +31,8 @@ if ($_GET['_uid'] && $_GET['_flag']) $marked = $IMAP->set_flag($_GET['_uid'], $flag); if ($marked != -1) { - $mbox = $IMAP->get_mailbox_name(); - $commands = sprintf("this.set_unread_count('%s', %d);\n", $mbox, $IMAP->messagecount($mbox, 'UNSEEN')); + $mbox_name = $IMAP->get_mailbox_name(); + $commands = sprintf("this.set_unread_count('%s', %d);\n", $mbox_name, $IMAP->messagecount($mbox_name, 'UNSEEN')); rcube_remote_response($commands); } } diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc index f8d3ada4f..65365ea7a 100644 --- a/program/steps/mail/sendmail.inc +++ b/program/steps/mail/sendmail.inc @@ -286,12 +286,12 @@ if ($CONFIG['sent_mbox']) // check if mailbox exists if (!in_array_nocase($CONFIG['sent_mbox'], $IMAP->list_mailboxes())) - $mbox = $IMAP->create_mailbox($CONFIG['sent_mbox'], TRUE); + $sent_folder = $IMAP->create_mailbox($CONFIG['sent_mbox'], TRUE); else - $mbox = TRUE; + $sent_folder = TRUE; // append message to sent box - if ($mbox) + if ($sent_folder) $saved = $IMAP->save_message($CONFIG['sent_mbox'], $header_str."\r\n".$msg_body); // raise error if saving failed |