diff options
author | alecpl <alec@alec.pl> | 2011-12-07 10:41:15 +0000 |
---|---|---|
committer | alecpl <alec@alec.pl> | 2011-12-07 10:41:15 +0000 |
commit | b6da0b76afb5697685c35b8584631294cfc7b12f (patch) | |
tree | da81d13466eccdfe287075e5a77ee37ab485a1bc | |
parent | 7e263ea2048721482c00db65d4511f00c4c7b1d4 (diff) |
- Remove deprecated global $IMAP variable usage (#1488148)
-rw-r--r-- | index.php | 2 | ||||
-rw-r--r-- | program/include/rcmail.php | 1 | ||||
-rw-r--r-- | program/steps/mail/addcontact.inc | 2 | ||||
-rw-r--r-- | program/steps/mail/check_recent.inc | 26 | ||||
-rw-r--r-- | program/steps/mail/compose.inc | 24 | ||||
-rw-r--r-- | program/steps/mail/copy.inc | 2 | ||||
-rw-r--r-- | program/steps/mail/folders.inc | 6 | ||||
-rw-r--r-- | program/steps/mail/func.inc | 94 | ||||
-rw-r--r-- | program/steps/mail/get.inc | 8 | ||||
-rw-r--r-- | program/steps/mail/getunread.inc | 6 | ||||
-rw-r--r-- | program/steps/mail/headers.inc | 2 | ||||
-rw-r--r-- | program/steps/mail/list.inc | 22 | ||||
-rw-r--r-- | program/steps/mail/mark.inc | 38 | ||||
-rw-r--r-- | program/steps/mail/move_del.inc | 36 | ||||
-rw-r--r-- | program/steps/mail/pagenav.inc | 2 | ||||
-rw-r--r-- | program/steps/mail/search.inc | 18 | ||||
-rw-r--r-- | program/steps/mail/sendmail.inc | 20 | ||||
-rw-r--r-- | program/steps/mail/show.inc | 10 | ||||
-rw-r--r-- | program/steps/mail/viewsource.inc | 6 | ||||
-rw-r--r-- | program/steps/settings/folders.inc | 38 | ||||
-rw-r--r-- | program/steps/settings/func.inc | 6 | ||||
-rw-r--r-- | program/steps/settings/save_folder.inc | 4 |
22 files changed, 186 insertions, 187 deletions
@@ -129,7 +129,7 @@ if ($RCMAIL->task == 'login' && $RCMAIL->action == 'login') { $OUTPUT->redirect($redir); } else { - $error_code = is_object($IMAP) ? $IMAP->get_error_code() : -1; + $error_code = (isset($RCMAIL->imap) && is_object($RCMAIL->imap)) ? $RCMAIL->imap->get_error_code() : 1; $OUTPUT->show_message($error_code < -1 ? 'imaperror' : (!$auth['valid'] ? 'invalidrequest' : 'loginfailed'), 'warning'); $RCMAIL->plugins->exec_hook('login_failed', array( diff --git a/program/include/rcmail.php b/program/include/rcmail.php index 733573f1c..9f26450a1 100644 --- a/program/include/rcmail.php +++ b/program/include/rcmail.php @@ -584,7 +584,6 @@ class rcmail * Create global IMAP object and connect to server * * @param boolean True if connection should be established - * @todo Remove global $IMAP */ public function imap_init($connect = false) { diff --git a/program/steps/mail/addcontact.inc b/program/steps/mail/addcontact.inc index a4feb7b58..0120852a9 100644 --- a/program/steps/mail/addcontact.inc +++ b/program/steps/mail/addcontact.inc @@ -37,7 +37,7 @@ if ($abook == null || !is_object($CONTACTS)) { if (!empty($_POST['_address']) && is_object($CONTACTS)) { - $contact_arr = $IMAP->decode_address_list(get_input_value('_address', RCUBE_INPUT_POST, true), 1, false); + $contact_arr = $RCMAIL->imap->decode_address_list(get_input_value('_address', RCUBE_INPUT_POST, true), 1, false); if (!empty($contact_arr[1]['mailto'])) { $contact = array( diff --git a/program/steps/mail/check_recent.inc b/program/steps/mail/check_recent.inc index ab0d3c818..498bf0ce1 100644 --- a/program/steps/mail/check_recent.inc +++ b/program/steps/mail/check_recent.inc @@ -19,12 +19,12 @@ */ -$current = $IMAP->get_mailbox_name(); +$current = $RCMAIL->imap->get_mailbox_name(); $check_all = !empty($_GET['_refresh']) || (bool)$RCMAIL->config->get('check_all_folders'); // list of folders to check if ($check_all) { - $a_mailboxes = $IMAP->list_mailboxes('', '*', 'mail'); + $a_mailboxes = $RCMAIL->imap->list_mailboxes('', '*', 'mail'); } else { $a_mailboxes = (array) $current; @@ -37,11 +37,11 @@ foreach ($a_mailboxes as $mbox_name) { $is_current = $mbox_name == $current; if ($is_current) { // Synchronize mailbox cache, handle flag changes - $IMAP->mailbox_sync($mbox_name); + $RCMAIL->imap->mailbox_sync($mbox_name); } // Get mailbox status - $status = $IMAP->mailbox_status($mbox_name); + $status = $RCMAIL->imap->mailbox_status($mbox_name); if ($status & 1) { // trigger plugin hook @@ -58,7 +58,7 @@ foreach ($a_mailboxes as $mbox_name) { if ($search_request && isset($_SESSION['search']) && $_SESSION['search_request'] == $search_request ) { - $_SESSION['search'] = $IMAP->refresh_search(); + $_SESSION['search'] = $RCMAIL->imap->refresh_search(); } if (!empty($_GET['_quota'])) @@ -69,27 +69,27 @@ foreach ($a_mailboxes as $mbox_name) { continue; // get overall message count; allow caching because rcube_imap::mailbox_status() did a refresh - $all_count = $IMAP->messagecount(null, $IMAP->threading ? 'THREADS' : 'ALL'); + $all_count = $RCMAIL->imap->messagecount(null, $RCMAIL->imap->threading ? 'THREADS' : 'ALL'); // check current page if we're not on the first page - if ($all_count && $IMAP->list_page > 1) { - $remaining = $all_count - $IMAP->page_size * ($IMAP->list_page - 1); + if ($all_count && $RCMAIL->imap->list_page > 1) { + $remaining = $all_count - $RCMAIL->imap->page_size * ($RCMAIL->imap->list_page - 1); if ($remaining <= 0) { - $IMAP->set_page($IMAP->list_page-1); - $_SESSION['page'] = $IMAP->list_page; + $RCMAIL->imap->set_page($RCMAIL->imap->list_page-1); + $_SESSION['page'] = $RCMAIL->imap->list_page; } } $OUTPUT->set_env('messagecount', $all_count); - $OUTPUT->set_env('pagecount', ceil($all_count/$IMAP->page_size)); + $OUTPUT->set_env('pagecount', ceil($all_count/$RCMAIL->imap->page_size)); $OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($all_count), $mbox_name); - $OUTPUT->set_env('current_page', $all_count ? $IMAP->list_page : 1); + $OUTPUT->set_env('current_page', $all_count ? $RCMAIL->imap->list_page : 1); // remove old rows (and clear selection if new list is empty) $OUTPUT->command('message_list.clear', $all_count ? false : true); if ($all_count) { - $a_headers = $IMAP->list_headers($mbox_name, null, $_SESSION['sort_col'], $_SESSION['sort_order']); + $a_headers = $RCMAIL->imap->list_headers($mbox_name, null, $_SESSION['sort_col'], $_SESSION['sort_order']); // add message rows rcmail_js_message_list($a_headers, false); // remove messages that don't exists from list selection array diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc index 03619f1a2..c3863e448 100644 --- a/program/steps/mail/compose.inc +++ b/program/steps/mail/compose.inc @@ -56,7 +56,7 @@ if (!is_array($COMPOSE)) $_SESSION['compose_data_'.$COMPOSE_ID] = array( 'id' => $COMPOSE_ID, 'param' => request2param(RCUBE_INPUT_GET), - 'mailbox' => $IMAP->get_mailbox_name(), + 'mailbox' => $RCMAIL->imap->get_mailbox_name(), ); $COMPOSE =& $_SESSION['compose_data_'.$COMPOSE_ID]; @@ -134,7 +134,7 @@ if (!empty($CONFIG['drafts_mbox'])) { $OUTPUT->set_env('draft_autosave', $CONFIG['draft_autosave']); } // set current mailbox in client environment -$OUTPUT->set_env('mailbox', $IMAP->get_mailbox_name()); +$OUTPUT->set_env('mailbox', $RCMAIL->imap->get_mailbox_name()); $OUTPUT->set_env('sig_above', $RCMAIL->config->get('sig_above', false)); $OUTPUT->set_env('top_posting', $RCMAIL->config->get('top_posting', false)); $OUTPUT->set_env('recipients_separator', trim($RCMAIL->config->get('recipients_separator', ','))); @@ -182,10 +182,10 @@ if (!empty($msg_uid)) // make sure message is marked as read if ($MESSAGE && $MESSAGE->headers && empty($MESSAGE->headers->flags['SEEN'])) - $IMAP->set_flag($msg_uid, 'SEEN'); + $RCMAIL->imap->set_flag($msg_uid, 'SEEN'); if (!empty($MESSAGE->headers->charset)) - $IMAP->set_charset($MESSAGE->headers->charset); + $RCMAIL->imap->set_charset($MESSAGE->headers->charset); if ($compose_mode == RCUBE_COMPOSE_REPLY) { @@ -271,7 +271,7 @@ else if (count($MESSAGE->identities)) { // extract all recipients of the reply-message if (is_object($MESSAGE->headers) && in_array($compose_mode, array(RCUBE_COMPOSE_REPLY, RCUBE_COMPOSE_FORWARD))) { - $a_to = $IMAP->decode_address_list($MESSAGE->headers->to); + $a_to = $RCMAIL->imap->decode_address_list($MESSAGE->headers->to); foreach ($a_to as $addr) { if (!empty($addr['mailto'])) { $a_recipients[] = strtolower($addr['mailto']); @@ -280,7 +280,7 @@ else if (count($MESSAGE->identities)) { } if (!empty($MESSAGE->headers->cc)) { - $a_cc = $IMAP->decode_address_list($MESSAGE->headers->cc); + $a_cc = $RCMAIL->imap->decode_address_list($MESSAGE->headers->cc); foreach ($a_cc as $addr) { if (!empty($addr['mailto'])) { $a_recipients[] = strtolower($addr['mailto']); @@ -423,7 +423,7 @@ foreach ($parts as $header) { // split recipients and put them back together in a unique way if (!empty($fvalue) && in_array($header, array('to', 'cc', 'bcc'))) { - $to_addresses = $IMAP->decode_address_list($fvalue, null, $decode_header); + $to_addresses = $RCMAIL->imap->decode_address_list($fvalue, null, $decode_header); $fvalue = array(); foreach ($to_addresses as $addr_part) { @@ -1432,18 +1432,18 @@ function rcmail_store_target_selection($attrib) function rcmail_check_sent_folder($folder, $create=false) { - global $IMAP; + global $RCMAIL; - if ($IMAP->mailbox_exists($folder, true)) { + if ($RCMAIL->imap->mailbox_exists($folder, true)) { return true; } // folder may exist but isn't subscribed (#1485241) if ($create) { - if (!$IMAP->mailbox_exists($folder)) - return $IMAP->create_mailbox($folder, true); + if (!$RCMAIL->imap->mailbox_exists($folder)) + return $RCMAIL->imap->create_mailbox($folder, true); else - return $IMAP->subscribe($folder); + return $RCMAIL->imap->subscribe($folder); } return false; diff --git a/program/steps/mail/copy.inc b/program/steps/mail/copy.inc index a4d6a4778..edb6af3d5 100644 --- a/program/steps/mail/copy.inc +++ b/program/steps/mail/copy.inc @@ -29,7 +29,7 @@ if (!empty($_POST['_uid']) && !empty($_POST['_target_mbox'])) { $target = get_input_value('_target_mbox', RCUBE_INPUT_POST, true); $mbox = get_input_value('_mbox', RCUBE_INPUT_POST, true); - $copied = $IMAP->copy_message($uids, $target, $mbox); + $copied = $RCMAIL->imap->copy_message($uids, $target, $mbox); if (!$copied) { // send error message diff --git a/program/steps/mail/folders.inc b/program/steps/mail/folders.inc index fad2bf3e3..6e687b06a 100644 --- a/program/steps/mail/folders.inc +++ b/program/steps/mail/folders.inc @@ -27,7 +27,7 @@ $mbox = get_input_value('_mbox', RCUBE_INPUT_POST, true); // send EXPUNGE command if ($RCMAIL->action == 'expunge') { - $success = $IMAP->expunge($mbox); + $success = $RCMAIL->imap->expunge($mbox); // reload message list if current mailbox if ($success) { @@ -48,7 +48,7 @@ if ($RCMAIL->action == 'expunge') { // clear mailbox else if ($RCMAIL->action == 'purge') { - $delimiter = $IMAP->get_hierarchy_delimiter(); + $delimiter = $RCMAIL->imap->get_hierarchy_delimiter(); $trash_regexp = '/^' . preg_quote($CONFIG['trash_mbox'] . $delimiter, '/') . '/'; $junk_regexp = '/^' . preg_quote($CONFIG['junk_mbox'] . $delimiter, '/') . '/'; @@ -56,7 +56,7 @@ else if ($RCMAIL->action == 'purge') if ($mbox == $CONFIG['trash_mbox'] || $mbox == $CONFIG['junk_mbox'] || preg_match($trash_regexp, $mbox) || preg_match($junk_regexp, $mbox) ) { - $success = $IMAP->clear_mailbox($mbox); + $success = $RCMAIL->imap->clear_mailbox($mbox); if ($success) { $OUTPUT->show_message('folderpurged', 'confirmation'); diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index 7e3a86cb5..1063c8ddf 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -47,12 +47,12 @@ if (!in_array($RCMAIL->action, $NOIMAP_ACTIONS) && !$RCMAIL->imap_connect()) { // set imap properties and session vars if (strlen(trim($mbox = get_input_value('_mbox', RCUBE_INPUT_GPC, true)))) - $IMAP->set_mailbox(($_SESSION['mbox'] = $mbox)); -else if ($IMAP) - $_SESSION['mbox'] = $IMAP->get_mailbox_name(); + $RCMAIL->imap->set_mailbox(($_SESSION['mbox'] = $mbox)); +else if ($RCMAIL->imap) + $_SESSION['mbox'] = $RCMAIL->imap->get_mailbox_name(); if (!empty($_GET['_page'])) - $IMAP->set_page(($_SESSION['page'] = intval($_GET['_page']))); + $RCMAIL->imap->set_page(($_SESSION['page'] = intval($_GET['_page']))); // set default sort col/order to session if (!isset($_SESSION['sort_col'])) @@ -69,28 +69,28 @@ if (isset($_GET['_threads'])) { unset($a_threading[$_SESSION['mbox']]); $RCMAIL->user->save_prefs(array('message_threading' => $a_threading)); } -$IMAP->set_threading($a_threading[$_SESSION['mbox']]); +$RCMAIL->imap->set_threading($a_threading[$_SESSION['mbox']]); // set message set for search result if (!empty($_REQUEST['_search']) && isset($_SESSION['search']) && $_SESSION['search_request'] == $_REQUEST['_search'] ) { - $IMAP->set_search_set($_SESSION['search']); + $RCMAIL->imap->set_search_set($_SESSION['search']); $OUTPUT->set_env('search_request', $_REQUEST['_search']); $OUTPUT->set_env('search_text', $_SESSION['last_text_search']); } // set main env variables, labels and page title if (empty($RCMAIL->action) || $RCMAIL->action == 'list') { - $mbox_name = $IMAP->get_mailbox_name(); + $mbox_name = $RCMAIL->imap->get_mailbox_name(); if (empty($RCMAIL->action)) { // initialize searching result if search_filter is used if ($_SESSION['search_filter'] && $_SESSION['search_filter'] != 'ALL') { $search_request = md5($mbox_name.$_SESSION['search_filter']); - $IMAP->search($mbox_name, $_SESSION['search_filter'], RCMAIL_CHARSET, $_SESSION['sort_col']); - $_SESSION['search'] = $IMAP->get_search_set(); + $RCMAIL->imap->search($mbox_name, $_SESSION['search_filter'], RCMAIL_CHARSET, $_SESSION['sort_col']); + $_SESSION['search'] = $RCMAIL->imap->get_search_set(); $_SESSION['search_request'] = $search_request; $OUTPUT->set_env('search_request', $search_request); } @@ -101,11 +101,11 @@ if (empty($RCMAIL->action) || $RCMAIL->action == 'list') { // set current mailbox and some other vars in client environment $OUTPUT->set_env('mailbox', $mbox_name); - $OUTPUT->set_env('pagesize', $IMAP->page_size); - $OUTPUT->set_env('quota', $IMAP->get_capability('QUOTA')); - $OUTPUT->set_env('delimiter', $IMAP->get_hierarchy_delimiter()); - $OUTPUT->set_env('threading', (bool) $IMAP->threading); - $OUTPUT->set_env('threads', $IMAP->threading || $IMAP->get_capability('THREAD')); + $OUTPUT->set_env('pagesize', $RCMAIL->imap->page_size); + $OUTPUT->set_env('quota', $RCMAIL->imap->get_capability('QUOTA')); + $OUTPUT->set_env('delimiter', $RCMAIL->imap->get_hierarchy_delimiter()); + $OUTPUT->set_env('threading', (bool) $RCMAIL->imap->threading); + $OUTPUT->set_env('threads', $RCMAIL->imap->threading || $RCMAIL->imap->get_capability('THREAD')); $OUTPUT->set_env('preview_pane_mark_read', $RCMAIL->config->get('preview_pane_mark_read', 0)); if ($CONFIG['flag_for_deletion']) @@ -130,7 +130,7 @@ if (empty($RCMAIL->action) || $RCMAIL->action == 'list') { 'movingmessage', 'copyingmessage', 'deletingmessage', 'markingmessage', 'copy', 'move', 'quota'); - $OUTPUT->set_pagetitle(rcmail_localize_foldername($IMAP->mod_mailbox($mbox_name))); + $OUTPUT->set_pagetitle(rcmail_localize_foldername($RCMAIL->imap->mod_mailbox($mbox_name))); } @@ -139,7 +139,7 @@ if (empty($RCMAIL->action) || $RCMAIL->action == 'list') { */ function rcmail_message_list($attrib) { - global $IMAP, $CONFIG, $OUTPUT; + global $RCMAIL, $CONFIG, $OUTPUT; // add some labels to client $OUTPUT->add_label('from', 'to'); @@ -161,8 +161,8 @@ function rcmail_message_list($attrib) // save some variables for use in ajax list $_SESSION['list_attrib'] = $attrib; - $mbox = $IMAP->get_mailbox_name(); - $delim = $IMAP->get_hierarchy_delimiter(); + $mbox = $RCMAIL->imap->get_mailbox_name(); + $delim = $RCMAIL->imap->get_hierarchy_delimiter(); // show 'to' instead of 'from' in sent/draft messages if ((strpos($mbox.$delim, $CONFIG['sent_mbox'].$delim)===0 || strpos($mbox.$delim, $CONFIG['drafts_mbox'].$delim)===0) @@ -204,7 +204,7 @@ function rcmail_message_list($attrib) */ function rcmail_js_message_list($a_headers, $insert_top=FALSE, $a_show_cols=null) { - global $CONFIG, $IMAP, $RCMAIL, $OUTPUT; + global $CONFIG, $RCMAIL, $OUTPUT; if (empty($a_show_cols)) { if (!empty($_SESSION['list_attrib']['columns'])) @@ -218,8 +218,8 @@ function rcmail_js_message_list($a_headers, $insert_top=FALSE, $a_show_cols=null $head_replace = true; } - $mbox = $IMAP->get_mailbox_name(); - $delim = $IMAP->get_hierarchy_delimiter(); + $mbox = $RCMAIL->imap->get_mailbox_name(); + $delim = $RCMAIL->imap->get_hierarchy_delimiter(); // make sure 'threads' and 'subject' columns are present if (!in_array('subject', $a_show_cols)) @@ -266,14 +266,14 @@ function rcmail_js_message_list($a_headers, $insert_top=FALSE, $a_show_cols=null $a_msg_cols = array(); $a_msg_flags = array(); - $IMAP->set_charset(!empty($header->charset) ? $header->charset : $CONFIG['default_charset']); + $RCMAIL->imap->set_charset(!empty($header->charset) ? $header->charset : $CONFIG['default_charset']); // format each col; similar as in rcmail_message_list() foreach ($a_show_cols as $col) { if (in_array($col, array('from', 'to', 'cc', 'replyto'))) $cont = Q(rcmail_address_string($header->$col, 3), 'show'); else if ($col=='subject') { - $cont = trim($IMAP->decode_header($header->$col)); + $cont = trim($RCMAIL->imap->decode_header($header->$col)); if (!$cont) $cont = rcube_label('nosubject'); $cont = Q($cont); } @@ -319,7 +319,7 @@ function rcmail_js_message_list($a_headers, $insert_top=FALSE, $a_show_cols=null $insert_top); } - if ($IMAP->threading) { + if ($RCMAIL->imap->threading) { $OUTPUT->command('init_threads', (array) $roots, $mbox); } } @@ -395,7 +395,7 @@ function rcmail_message_list_head($attrib, $a_show_cols) * return an HTML iframe for loading mail content */ function rcmail_messagecontent_frame($attrib) - { +{ global $OUTPUT, $RCMAIL; if (empty($attrib['id'])) @@ -408,11 +408,11 @@ function rcmail_messagecontent_frame($attrib) $OUTPUT->set_env('blankpage', $attrib['src'] ? $OUTPUT->abs_url($attrib['src']) : 'program/blank.gif'); return html::iframe($attrib); - } +} function rcmail_messagecount_display($attrib) - { +{ global $RCMAIL; if (!$attrib['id']) @@ -423,33 +423,33 @@ function rcmail_messagecount_display($attrib) $content = $RCMAIL->action != 'show' ? rcmail_get_messagecount_text() : rcube_label('loading'); return html::span($attrib, $content); - } +} function rcmail_get_messagecount_text($count=NULL, $page=NULL) - { - global $RCMAIL, $IMAP; +{ + global $RCMAIL; if ($page===NULL) - $page = $IMAP->list_page; + $page = $RCMAIL->imap->list_page; - $start_msg = ($page-1) * $IMAP->page_size + 1; + $start_msg = ($page-1) * $RCMAIL->imap->page_size + 1; if ($count!==NULL) $max = $count; else if ($RCMAIL->action) - $max = $IMAP->messagecount(NULL, $IMAP->threading ? 'THREADS' : 'ALL'); + $max = $RCMAIL->imap->messagecount(NULL, $RCMAIL->imap->threading ? 'THREADS' : 'ALL'); if ($max==0) $out = rcube_label('mailboxempty'); else - $out = rcube_label(array('name' => $IMAP->threading ? 'threadsfromto' : 'messagesfromto', + $out = rcube_label(array('name' => $RCMAIL->imap->threading ? 'threadsfromto' : 'messagesfromto', 'vars' => array('from' => $start_msg, - 'to' => min($max, $start_msg + $IMAP->page_size - 1), + 'to' => min($max, $start_msg + $RCMAIL->imap->page_size - 1), 'count' => $max))); return Q($out); - } +} function rcmail_mailbox_name_display($attrib) @@ -868,7 +868,7 @@ function rcmail_html_tag_callback($matches) */ function rcmail_message_headers($attrib, $headers=NULL) { - global $IMAP, $OUTPUT, $MESSAGE, $PRINT_MODE, $RCMAIL; + global $OUTPUT, $MESSAGE, $PRINT_MODE, $RCMAIL; static $sa_attrib; // keep header table attrib @@ -925,7 +925,7 @@ function rcmail_message_headers($attrib, $headers=NULL) else if ($hkey == 'subject' && empty($value)) $header_value = rcube_label('nosubject'); else - $header_value = trim($IMAP->decode_header($value)); + $header_value = trim($RCMAIL->imap->decode_header($value)); $output_headers[$hkey] = array( 'title' => rcube_label(preg_replace('/(^mail-|-)/', '', $hkey)), @@ -973,7 +973,7 @@ function rcmail_message_full_headers($attrib, $headers=NULL) */ function rcmail_message_body($attrib) { - global $CONFIG, $OUTPUT, $MESSAGE, $IMAP, $RCMAIL, $REMOTE_OBJECTS; + global $CONFIG, $OUTPUT, $MESSAGE, $RCMAIL, $REMOTE_OBJECTS; if (!is_array($MESSAGE->parts) && empty($MESSAGE->body)) return ''; @@ -999,7 +999,7 @@ function rcmail_message_body($attrib) if (!rcmail_mem_check($part->size * 10)) { $out .= html::span('part-notice', rcube_label('messagetoobig'). ' ' . html::a('?_task=mail&_action=get&_download=1&_uid='.$MESSAGE->uid.'&_part='.$part->mime_id - .'&_mbox='. urlencode($IMAP->get_mailbox_name()), rcube_label('download'))); + .'&_mbox='. urlencode($RCMAIL->imap->get_mailbox_name()), rcube_label('download'))); continue; } @@ -1045,7 +1045,7 @@ function rcmail_message_body($attrib) if (!rcmail_mem_check(strlen($MESSAGE->body) * 10)) { $out .= html::span('part-notice', rcube_label('messagetoobig'). ' ' . html::a('?_task=mail&_action=get&_download=1&_uid='.$MESSAGE->uid.'&_part=0' - .'&_mbox='. urlencode($IMAP->get_mailbox_name()), rcube_label('download'))); + .'&_mbox='. urlencode($RCMAIL->imap->get_mailbox_name()), rcube_label('download'))); } else { $plugin = $RCMAIL->plugins->exec_hook('message_body_prefix', array( @@ -1241,9 +1241,9 @@ function rcmail_alter_html_link($matches) */ function rcmail_address_string($input, $max=null, $linked=false, $addicon=null) { - global $IMAP, $RCMAIL, $PRINT_MODE, $CONFIG; + global $RCMAIL, $PRINT_MODE, $CONFIG; - $a_parts = $IMAP->decode_address_list($input); + $a_parts = $RCMAIL->imap->decode_address_list($input); if (!sizeof($a_parts)) return $input; @@ -1451,17 +1451,17 @@ function rcmail_compose_cleanup($id) */ function rcmail_send_mdn($message, &$smtp_error) { - global $RCMAIL, $IMAP; + global $RCMAIL; if (!is_object($message) || !is_a($message, 'rcube_message')) $message = new rcube_message($message); if ($message->headers->mdn_to && empty($message->headers->flags['MDNSENT']) && - ($IMAP->check_permflag('MDNSENT') || $IMAP->check_permflag('*'))) + ($RCMAIL->imap->check_permflag('MDNSENT') || $RCMAIL->imap->check_permflag('*'))) { $identity = $RCMAIL->user->get_identity(); $sender = format_email_recipient($identity['email'], $identity['name']); - $recipient = array_shift($IMAP->decode_address_list($message->headers->mdn_to)); + $recipient = array_shift($RCMAIL->imap->decode_address_list($message->headers->mdn_to)); $mailto = $recipient['mailto']; $compose = new Mail_mime("\r\n"); @@ -1512,7 +1512,7 @@ function rcmail_send_mdn($message, &$smtp_error) if ($sent) { - $IMAP->set_flag($message->uid, 'MDNSENT'); + $RCMAIL->imap->set_flag($message->uid, 'MDNSENT'); return true; } } diff --git a/program/steps/mail/get.inc b/program/steps/mail/get.inc index 1e0583cf8..cbe59346f 100644 --- a/program/steps/mail/get.inc +++ b/program/steps/mail/get.inc @@ -68,7 +68,7 @@ if (!empty($_GET['_uid'])) { if (!empty($_GET['_frame'])) { if (($part_id = get_input_value('_part', RCUBE_INPUT_GPC)) && ($part = $MESSAGE->mime_parts[$part_id]) && $part->filename) $OUTPUT->set_pagetitle($part->filename); - + $OUTPUT->send('messagepart'); exit; } @@ -117,7 +117,7 @@ else if (strlen($pid = get_input_value('_part', RCUBE_INPUT_GET))) { if (!rcmail_mem_check($part->size * 10)) { $out = '<body>' . rcube_label('messagetoobig'). ' ' . html::a('?_task=mail&_action=get&_download=1&_uid='.$MESSAGE->uid.'&_part='.$part->mime_id - .'&_mbox='. urlencode($IMAP->get_mailbox_name()), rcube_label('download')) . '</body></html>'; + .'&_mbox='. urlencode($RCMAIL->imap->get_mailbox_name()), rcube_label('download')) . '</body></html>'; } else { // get part body if not available @@ -157,7 +157,7 @@ else if (strlen($pid = get_input_value('_part', RCUBE_INPUT_GET))) { $stdout = fopen('php://output', 'w'); stream_filter_register('rcube_content', 'rcube_content_filter') or die('Failed to register content filter'); stream_filter_append($stdout, 'rcube_content'); - $IMAP->get_message_part($MESSAGE->uid, $part->mime_id, $part, false, $stdout); + $RCMAIL->imap->get_message_part($MESSAGE->uid, $part->mime_id, $part, false, $stdout); } } else { @@ -165,7 +165,7 @@ else if (strlen($pid = get_input_value('_part', RCUBE_INPUT_GET))) { if ($part->body) echo $part->body; else if ($part->size) - $IMAP->get_message_part($MESSAGE->uid, $part->mime_id, $part, true); + $RCMAIL->imap->get_message_part($MESSAGE->uid, $part->mime_id, $part, true); } } diff --git a/program/steps/mail/getunread.inc b/program/steps/mail/getunread.inc index 27ae5f747..39880b99b 100644 --- a/program/steps/mail/getunread.inc +++ b/program/steps/mail/getunread.inc @@ -19,11 +19,11 @@ */ -$a_folders = $IMAP->list_mailboxes('', '*', 'mail'); +$a_folders = $RCMAIL->imap->list_mailboxes('', '*', 'mail'); if (!empty($a_folders)) { - $current = $IMAP->get_mailbox_name(); + $current = $RCMAIL->imap->get_mailbox_name(); $inbox = ($current == 'INBOX'); $check_all = (bool)$RCMAIL->config->get('check_all_folders'); @@ -33,7 +33,7 @@ if (!empty($a_folders)) if (!$check_all && $unseen_old !== null && $mbox_row != $current) $unseen = $unseen_old; else - $unseen = $IMAP->messagecount($mbox_row, 'UNSEEN', $unseen_old === null); + $unseen = $RCMAIL->imap->messagecount($mbox_row, 'UNSEEN', $unseen_old === null); if ($unseen || $unseen_old === null) { $OUTPUT->command('set_unread_count', $mbox_row, $unseen, $inbox && $mbox_row == 'INBOX'); diff --git a/program/steps/mail/headers.inc b/program/steps/mail/headers.inc index 7d166f915..5eee4bdef 100644 --- a/program/steps/mail/headers.inc +++ b/program/steps/mail/headers.inc @@ -20,7 +20,7 @@ if ($uid = get_input_value('_uid', RCUBE_INPUT_POST)) { - $source = $IMAP->get_raw_headers($uid); + $source = $RCMAIL->imap->get_raw_headers($uid); if ($source !== false) { $source = htmlspecialchars(trim($source)); diff --git a/program/steps/mail/list.inc b/program/steps/mail/list.inc index 9988a00b4..c2a47488f 100644 --- a/program/steps/mail/list.inc +++ b/program/steps/mail/list.inc @@ -51,30 +51,30 @@ if ($cols = get_input_value('_cols', RCUBE_INPUT_GET)) if ($save_arr) $RCMAIL->user->save_prefs($save_arr); -$mbox_name = $IMAP->get_mailbox_name(); +$mbox_name = $RCMAIL->imap->get_mailbox_name(); // Synchronize mailbox cache, handle flag changes -$IMAP->mailbox_sync($mbox_name); +$RCMAIL->imap->mailbox_sync($mbox_name); // initialize searching result if search_filter is used if ($_SESSION['search_filter'] && $_SESSION['search_filter'] != 'ALL') { $search_request = md5($mbox_name.$_SESSION['search_filter']); - $IMAP->search($mbox_name, $_SESSION['search_filter'], RCMAIL_CHARSET, $sort_col); - $_SESSION['search'] = $IMAP->get_search_set(); + $RCMAIL->imap->search($mbox_name, $_SESSION['search_filter'], RCMAIL_CHARSET, $sort_col); + $_SESSION['search'] = $RCMAIL->imap->get_search_set(); $_SESSION['search_request'] = $search_request; $OUTPUT->set_env('search_request', $search_request); } // fetch message headers -if ($count = $IMAP->messagecount($mbox_name, $IMAP->threading ? 'THREADS' : 'ALL', !empty($_REQUEST['_refresh']))) - $a_headers = $IMAP->list_headers($mbox_name, NULL, $sort_col, $sort_order); +if ($count = $RCMAIL->imap->messagecount($mbox_name, $RCMAIL->imap->threading ? 'THREADS' : 'ALL', !empty($_REQUEST['_refresh']))) + $a_headers = $RCMAIL->imap->list_headers($mbox_name, NULL, $sort_col, $sort_order); // update search set (possible change of threading mode) if (!empty($_REQUEST['_search']) && isset($_SESSION['search']) && $_SESSION['search_request'] == $_REQUEST['_search'] ) { - $_SESSION['search'] = $IMAP->get_search_set(); + $_SESSION['search'] = $RCMAIL->imap->get_search_set(); } // remove old search data else if (empty($_REQUEST['_search']) && isset($_SESSION['search'])) { @@ -91,11 +91,11 @@ if (empty($search_request) && empty($a_headers)) { rcmail_send_unread_count($mbox_name, !empty($_REQUEST['_refresh']), $unseen); // update message count display -$pages = ceil($count/$IMAP->page_size); +$pages = ceil($count/$RCMAIL->imap->page_size); $OUTPUT->set_env('messagecount', $count); $OUTPUT->set_env('pagecount', $pages); -$OUTPUT->set_env('threading', (bool) $IMAP->threading); -$OUTPUT->set_env('current_page', $count ? $IMAP->list_page : 1); +$OUTPUT->set_env('threading', (bool) $RCMAIL->imap->threading); +$OUTPUT->set_env('current_page', $count ? $RCMAIL->imap->list_page : 1); $OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($count), $mbox_name); $OUTPUT->command('set_mailboxname', rcmail_get_mailbox_name_text()); @@ -108,7 +108,7 @@ if (isset($a_headers) && count($a_headers)) } else { // handle IMAP errors (e.g. #1486905) - if ($err_code = $IMAP->get_error_code()) { + if ($err_code = $RCMAIL->imap->get_error_code()) { rcmail_display_server_error(); } else if ($search_request) diff --git a/program/steps/mail/mark.inc b/program/steps/mail/mark.inc index c232d8c48..3b52dfe4f 100644 --- a/program/steps/mail/mark.inc +++ b/program/steps/mail/mark.inc @@ -36,12 +36,12 @@ if (($uids = get_input_value('_uid', RCUBE_INPUT_POST)) && ($flag = get_input_va if ($flag == 'DELETED' && $CONFIG['skip_deleted'] && $_POST['_from'] != 'show') { // count messages before changing anything - $old_count = $IMAP->messagecount(NULL, $IMAP->threading ? 'THREADS' : 'ALL'); - $old_pages = ceil($old_count / $IMAP->page_size); + $old_count = $RCMAIL->imap->messagecount(NULL, $RCMAIL->imap->threading ? 'THREADS' : 'ALL'); + $old_pages = ceil($old_count / $RCMAIL->imap->page_size); $count = sizeof(explode(',', $uids)); } - $marked = $IMAP->set_flag($uids, $flag); + $marked = $RCMAIL->imap->set_flag($uids, $flag); if (!$marked) { // send error message @@ -57,14 +57,14 @@ if (($uids = get_input_value('_uid', RCUBE_INPUT_POST)) && ($flag = get_input_va if ($flag == 'DELETED' && $CONFIG['read_when_deleted'] && !empty($_POST['_ruid'])) { $ruids = get_input_value('_ruid', RCUBE_INPUT_POST); - $read = $IMAP->set_flag($ruids, 'SEEN'); + $read = $RCMAIL->imap->set_flag($ruids, 'SEEN'); if ($read && !$CONFIG['skip_deleted']) $OUTPUT->command('flag_deleted_as_read', $ruids); } if ($flag == 'SEEN' || $flag == 'UNSEEN' || ($flag == 'DELETED' && !$CONFIG['skip_deleted'])) { - rcmail_send_unread_count($IMAP->get_mailbox_name()); + rcmail_send_unread_count($RCMAIL->imap->get_mailbox_name()); } else if ($flag == 'DELETED' && $CONFIG['skip_deleted']) { if ($_POST['_from'] == 'show') { @@ -74,30 +74,30 @@ if (($uids = get_input_value('_uid', RCUBE_INPUT_POST)) && ($flag = get_input_va $OUTPUT->command('command', 'list'); } else { // refresh saved search set after moving some messages - if (($search_request = get_input_value('_search', RCUBE_INPUT_GPC)) && $IMAP->search_set) { - $_SESSION['search'] = $IMAP->refresh_search(); + if (($search_request = get_input_value('_search', RCUBE_INPUT_GPC)) && $RCMAIL->imap->search_set) { + $_SESSION['search'] = $RCMAIL->imap->refresh_search(); } - $msg_count = $IMAP->messagecount(NULL, $IMAP->threading ? 'THREADS' : 'ALL'); - $pages = ceil($msg_count / $IMAP->page_size); - $nextpage_count = $old_count - $IMAP->page_size * $IMAP->list_page; - $remaining = $msg_count - $IMAP->page_size * ($IMAP->list_page - 1); + $msg_count = $RCMAIL->imap->messagecount(NULL, $RCMAIL->imap->threading ? 'THREADS' : 'ALL'); + $pages = ceil($msg_count / $RCMAIL->imap->page_size); + $nextpage_count = $old_count - $RCMAIL->imap->page_size * $RCMAIL->imap->list_page; + $remaining = $msg_count - $RCMAIL->imap->page_size * ($RCMAIL->imap->list_page - 1); // jump back one page (user removed the whole last page) - if ($IMAP->list_page > 1 && $remaining == 0) { - $IMAP->set_page($IMAP->list_page-1); - $_SESSION['page'] = $IMAP->list_page; + if ($RCMAIL->imap->list_page > 1 && $remaining == 0) { + $RCMAIL->imap->set_page($RCMAIL->imap->list_page-1); + $_SESSION['page'] = $RCMAIL->imap->list_page; $jump_back = true; } // update message count display $OUTPUT->set_env('messagecount', $msg_count); - $OUTPUT->set_env('current_page', $IMAP->list_page); + $OUTPUT->set_env('current_page', $RCMAIL->imap->list_page); $OUTPUT->set_env('pagecount', $pages); // update mailboxlist - $mbox = $IMAP->get_mailbox_name(); - $unseen_count = $msg_count ? $IMAP->messagecount($mbox, 'UNSEEN') : 0; + $mbox = $RCMAIL->imap->get_mailbox_name(); + $unseen_count = $msg_count ? $RCMAIL->imap->messagecount($mbox, 'UNSEEN') : 0; $old_unseen = rcmail_get_unseen_count($mbox); if ($old_unseen != $unseen_count) { @@ -106,7 +106,7 @@ if (($uids = get_input_value('_uid', RCUBE_INPUT_POST)) && ($flag = get_input_va } $OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($msg_count), $mbox); - if ($IMAP->threading) + if ($RCMAIL->imap->threading) $count = get_input_value('_count', RCUBE_INPUT_POST); // add new rows from next page (if any) @@ -114,7 +114,7 @@ if (($uids = get_input_value('_uid', RCUBE_INPUT_POST)) && ($flag = get_input_va $sort_col = isset($_SESSION['sort_col']) ? $_SESSION['sort_col'] : $CONFIG['message_sort_col']; $sort_order = isset($_SESSION['sort_order']) ? $_SESSION['sort_order'] : $CONFIG['message_sort_order']; - $a_headers = $IMAP->list_headers($mbox, NULL, $sort_col, $sort_order, + $a_headers = $RCMAIL->imap->list_headers($mbox, NULL, $sort_col, $sort_order, $jump_back ? NULL : $count); rcmail_js_message_list($a_headers, false); diff --git a/program/steps/mail/move_del.inc b/program/steps/mail/move_del.inc index a42bc90cd..95a456ed5 100644 --- a/program/steps/mail/move_del.inc +++ b/program/steps/mail/move_del.inc @@ -24,8 +24,8 @@ if (!$OUTPUT->ajax_call) return; // count messages before changing anything -$old_count = $IMAP->messagecount(NULL, $IMAP->threading ? 'THREADS' : 'ALL'); -$old_pages = ceil($old_count / $IMAP->page_size); +$old_count = $RCMAIL->imap->messagecount(NULL, $RCMAIL->imap->threading ? 'THREADS' : 'ALL'); +$old_pages = ceil($old_count / $RCMAIL->imap->page_size); // move messages if ($RCMAIL->action=='moveto' && !empty($_POST['_uid']) && strlen($_POST['_target_mbox'])) { @@ -33,7 +33,7 @@ if ($RCMAIL->action=='moveto' && !empty($_POST['_uid']) && strlen($_POST['_targe $target = get_input_value('_target_mbox', RCUBE_INPUT_POST, true); $mbox = get_input_value('_mbox', RCUBE_INPUT_POST, true); - $moved = $IMAP->move_message($uids, $target, $mbox); + $moved = $RCMAIL->imap->move_message($uids, $target, $mbox); if (!$moved) { // send error message @@ -54,7 +54,7 @@ else if ($RCMAIL->action=='delete' && !empty($_POST['_uid'])) { $count = sizeof(explode(',', ($uids = get_input_value('_uid', RCUBE_INPUT_POST)))); $mbox = get_input_value('_mbox', RCUBE_INPUT_POST, true); - $del = $IMAP->delete_message($uids, $mbox); + $del = $RCMAIL->imap->delete_message($uids, $mbox); if (!$del) { // send error message @@ -76,8 +76,8 @@ else { } // refresh saved search set after moving some messages -if (($search_request = get_input_value('_search', RCUBE_INPUT_GPC)) && $IMAP->search_set) { - $_SESSION['search'] = $IMAP->refresh_search(); +if (($search_request = get_input_value('_search', RCUBE_INPUT_GPC)) && $RCMAIL->imap->search_set) { + $_SESSION['search'] = $RCMAIL->imap->refresh_search(); } if ($_POST['_from'] == 'show') @@ -89,26 +89,26 @@ if ($_POST['_from'] == 'show') } else { - $msg_count = $IMAP->messagecount(NULL, $IMAP->threading ? 'THREADS' : 'ALL'); - $pages = ceil($msg_count / $IMAP->page_size); - $nextpage_count = $old_count - $IMAP->page_size * $IMAP->list_page; - $remaining = $msg_count - $IMAP->page_size * ($IMAP->list_page - 1); + $msg_count = $RCMAIL->imap->messagecount(NULL, $RCMAIL->imap->threading ? 'THREADS' : 'ALL'); + $pages = ceil($msg_count / $RCMAIL->imap->page_size); + $nextpage_count = $old_count - $RCMAIL->imap->page_size * $RCMAIL->imap->list_page; + $remaining = $msg_count - $RCMAIL->imap->page_size * ($RCMAIL->imap->list_page - 1); // jump back one page (user removed the whole last page) - if ($IMAP->list_page > 1 && $remaining == 0) { - $IMAP->set_page($IMAP->list_page-1); - $_SESSION['page'] = $IMAP->list_page; + if ($RCMAIL->imap->list_page > 1 && $remaining == 0) { + $RCMAIL->imap->set_page($RCMAIL->imap->list_page-1); + $_SESSION['page'] = $RCMAIL->imap->list_page; $jump_back = true; } // update message count display $OUTPUT->set_env('messagecount', $msg_count); - $OUTPUT->set_env('current_page', $IMAP->list_page); + $OUTPUT->set_env('current_page', $RCMAIL->imap->list_page); $OUTPUT->set_env('pagecount', $pages); // update mailboxlist - $mbox = $IMAP->get_mailbox_name(); - $unseen_count = $msg_count ? $IMAP->messagecount($mbox, 'UNSEEN') : 0; + $mbox = $RCMAIL->imap->get_mailbox_name(); + $unseen_count = $msg_count ? $RCMAIL->imap->messagecount($mbox, 'UNSEEN') : 0; $old_unseen = rcmail_get_unseen_count($mbox); if ($old_unseen != $unseen_count) { @@ -123,7 +123,7 @@ else $OUTPUT->command('set_quota', rcmail_quota_content()); $OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($msg_count), $mbox); - if ($IMAP->threading) + if ($RCMAIL->imap->threading) $count = get_input_value('_count', RCUBE_INPUT_POST); // add new rows from next page (if any) @@ -131,7 +131,7 @@ else $sort_col = isset($_SESSION['sort_col']) ? $_SESSION['sort_col'] : $CONFIG['message_sort_col']; $sort_order = isset($_SESSION['sort_order']) ? $_SESSION['sort_order'] : $CONFIG['message_sort_order']; - $a_headers = $IMAP->list_headers($mbox, NULL, $sort_col, $sort_order, + $a_headers = $RCMAIL->imap->list_headers($mbox, NULL, $sort_col, $sort_order, $jump_back ? NULL : $count); rcmail_js_message_list($a_headers, false); diff --git a/program/steps/mail/pagenav.inc b/program/steps/mail/pagenav.inc index 16844f4e1..f15ac38de 100644 --- a/program/steps/mail/pagenav.inc +++ b/program/steps/mail/pagenav.inc @@ -20,7 +20,7 @@ */ $uid = get_input_value('_uid', RCUBE_INPUT_GET); -$index = $IMAP->message_index(null, $_SESSION['sort_col'], $_SESSION['sort_order']); +$index = $RCMAIL->imap->message_index(null, $_SESSION['sort_col'], $_SESSION['sort_order']); $cnt = $index->countMessages(); if ($cnt && ($pos = $index->exists($uid, true)) !== false) { diff --git a/program/steps/mail/search.inc b/program/steps/mail/search.inc index 05ba9d23e..42bdf9776 100644 --- a/program/steps/mail/search.inc +++ b/program/steps/mail/search.inc @@ -18,8 +18,8 @@ $REMOTE_REQUEST = TRUE; // reset list_page and old search results -$IMAP->set_page(1); -$IMAP->set_search_set(NULL); +$RCMAIL->imap->set_page(1); +$RCMAIL->imap->set_search_set(NULL); $_SESSION['page'] = 1; // using encodeURI with javascript "should" give us @@ -107,32 +107,32 @@ $search_str = trim($search_str); // execute IMAP search if ($search_str) - $IMAP->search($mbox, $search_str, $imap_charset, $_SESSION['sort_col']); + $RCMAIL->imap->search($mbox, $search_str, $imap_charset, $_SESSION['sort_col']); // save search results in session if (!is_array($_SESSION['search'])) $_SESSION['search'] = array(); if ($search_str) { - $_SESSION['search'] = $IMAP->get_search_set(); + $_SESSION['search'] = $RCMAIL->imap->get_search_set(); $_SESSION['last_text_search'] = $str; } $_SESSION['search_request'] = $search_request; // Get the headers -$result_h = $IMAP->list_headers($mbox, 1, $_SESSION['sort_col'], $_SESSION['sort_order']); -$count = $IMAP->messagecount($mbox, $IMAP->threading ? 'THREADS' : 'ALL'); +$result_h = $RCMAIL->imap->list_headers($mbox, 1, $_SESSION['sort_col'], $_SESSION['sort_order']); +$count = $RCMAIL->imap->messagecount($mbox, $RCMAIL->imap->threading ? 'THREADS' : 'ALL'); // Make sure we got the headers if (!empty($result_h)) { rcmail_js_message_list($result_h); if ($search_str) - $OUTPUT->show_message('searchsuccessful', 'confirmation', array('nr' => $IMAP->messagecount(NULL, 'ALL'))); + $OUTPUT->show_message('searchsuccessful', 'confirmation', array('nr' => $RCMAIL->imap->messagecount(NULL, 'ALL'))); } // handle IMAP errors (e.g. #1486905) -else if ($err_code = $IMAP->get_error_code()) { +else if ($err_code = $RCMAIL->imap->get_error_code()) { rcmail_display_server_error(); } else { @@ -142,7 +142,7 @@ else { // update message count display $OUTPUT->set_env('search_request', $search_str ? $search_request : ''); $OUTPUT->set_env('messagecount', $count); -$OUTPUT->set_env('pagecount', ceil($count/$IMAP->page_size)); +$OUTPUT->set_env('pagecount', ceil($count/$RCMAIL->imap->page_size)); $OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($count, 1), $mbox); $OUTPUT->send(); diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc index 6e124f98f..e4e5093b1 100644 --- a/program/steps/mail/sendmail.inc +++ b/program/steps/mail/sendmail.inc @@ -634,9 +634,9 @@ if (!$savedraft) // set replied/forwarded flag if ($COMPOSE['reply_uid']) - $IMAP->set_flag($COMPOSE['reply_uid'], 'ANSWERED', $COMPOSE['mailbox']); + $RCMAIL->imap->set_flag($COMPOSE['reply_uid'], 'ANSWERED', $COMPOSE['mailbox']); else if ($COMPOSE['forward_uid']) - $IMAP->set_flag($COMPOSE['forward_uid'], 'FORWARDED', $COMPOSE['mailbox']); + $RCMAIL->imap->set_flag($COMPOSE['forward_uid'], 'FORWARDED', $COMPOSE['mailbox']); } // End of SMTP Delivery Block @@ -649,12 +649,12 @@ else if ($store_target) { // check if folder is subscribed - if ($IMAP->mailbox_exists($store_target, true)) + if ($RCMAIL->imap->mailbox_exists($store_target, true)) $store_folder = true; // folder may be existing but not subscribed (#1485241) - else if (!$IMAP->mailbox_exists($store_target)) - $store_folder = $IMAP->create_mailbox($store_target, true); - else if ($IMAP->subscribe($store_target)) + else if (!$RCMAIL->imap->mailbox_exists($store_target)) + $store_folder = $RCMAIL->imap->create_mailbox($store_target, true); + else if ($RCMAIL->imap->subscribe($store_target)) $store_folder = true; // append message to sent box @@ -684,7 +684,7 @@ if ($store_target) { 'message' => "Could not create message: ".$msg->getMessage()), TRUE, FALSE); else { - $saved = $IMAP->save_message($store_target, $msg, $headers, $mailbody_file ? true : false); + $saved = $RCMAIL->imap->save_message($store_target, $msg, $headers, $mailbody_file ? true : false); } if ($mailbody_file) { @@ -708,11 +708,11 @@ if ($store_target) { if ($olddraftmessageid) { // delete previous saved draft // @TODO: use message UID (remember to check UIDVALIDITY) to skip this SEARCH - $delete_idx = $IMAP->search_once($CONFIG['drafts_mbox'], + $delete_idx = $RCMAIL->imap->search_once($CONFIG['drafts_mbox'], 'HEADER Message-ID '.$olddraftmessageid); if ($del_uid = $delete_idx->getElement('FIRST')) { - $deleted = $IMAP->delete_message($del_uid, $CONFIG['drafts_mbox']); + $deleted = $RCMAIL->imap->delete_message($del_uid, $CONFIG['drafts_mbox']); // raise error if deletion of old draft failed if (!$deleted) @@ -733,7 +733,7 @@ if ($savedraft) { // remember new draft-uid ($saved could be an UID or TRUE here) if (is_bool($saved)) { - $draft_idx = $IMAP->search_once($CONFIG['drafts_mbox'], 'HEADER Message-ID '.$msgid); + $draft_idx = $RCMAIL->imap->search_once($CONFIG['drafts_mbox'], 'HEADER Message-ID '.$msgid); $saved = $draft_idx->getElement('FIRST'); } $COMPOSE['param']['draft_uid'] = $saved; diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc index d928cfd68..d7b9d4f9e 100644 --- a/program/steps/mail/show.inc +++ b/program/steps/mail/show.inc @@ -30,14 +30,14 @@ if ($uid = get_input_value('_uid', RCUBE_INPUT_GET)) { rcmail_message_error($uid); } - $mbox_name = $IMAP->get_mailbox_name(); + $mbox_name = $RCMAIL->imap->get_mailbox_name(); // show images? rcmail_check_safe($MESSAGE); // set message charset as default if (!empty($MESSAGE->headers->charset)) - $IMAP->set_charset($MESSAGE->headers->charset); + $RCMAIL->imap->set_charset($MESSAGE->headers->charset); $OUTPUT->set_pagetitle(abbreviate_string($MESSAGE->subject, 128, '...', true)); @@ -47,7 +47,7 @@ if ($uid = get_input_value('_uid', RCUBE_INPUT_GET)) { $OUTPUT->set_env('safemode', $MESSAGE->is_safe); $OUTPUT->set_env('sender', $MESSAGE->sender['string']); $OUTPUT->set_env('permaurl', rcmail_url('show', array('_uid' => $MESSAGE->uid, '_mbox' => $mbox_name))); - $OUTPUT->set_env('delimiter', $IMAP->get_hierarchy_delimiter()); + $OUTPUT->set_env('delimiter', $RCMAIL->imap->get_hierarchy_delimiter()); $OUTPUT->set_env('mailbox', $mbox_name); // mimetypes supported by the browser (default settings) @@ -77,7 +77,7 @@ if ($uid = get_input_value('_uid', RCUBE_INPUT_GET)) { if ($MESSAGE->headers->mdn_to && empty($MESSAGE->headers->flags['MDNSENT']) && empty($MESSAGE->headers->flags['SEEN']) - && ($IMAP->check_permflag('MDNSENT') || $IMAP->check_permflag('*')) + && ($RCMAIL->imap->check_permflag('MDNSENT') || $RCMAIL->imap->check_permflag('*')) && $mbox_name != $CONFIG['drafts_mbox'] && $mbox_name != $CONFIG['sent_mbox'] ) { @@ -248,7 +248,7 @@ else if ($MESSAGE && $MESSAGE->headers && empty($MESSAGE->headers->flags['SEEN']) && ($RCMAIL->action == 'show' || ($RCMAIL->action == 'preview' && intval($CONFIG['preview_pane_mark_read']) == 0))) { - if ($IMAP->set_flag($MESSAGE->uid, 'SEEN')) { + if ($RCMAIL->imap->set_flag($MESSAGE->uid, 'SEEN')) { if ($count = rcmail_get_unseen_count($mbox_name)) { rcmail_set_unseen_count($mbox_name, $count - 1); } diff --git a/program/steps/mail/viewsource.inc b/program/steps/mail/viewsource.inc index e25fad132..d951fbead 100644 --- a/program/steps/mail/viewsource.inc +++ b/program/steps/mail/viewsource.inc @@ -24,12 +24,12 @@ ob_end_clean(); // similar code as in program/steps/mail/get.inc if ($uid = get_input_value('_uid', RCUBE_INPUT_GET)) { - $headers = $IMAP->get_headers($uid); + $headers = $RCMAIL->imap->get_headers($uid); $charset = $headers->charset ? $headers->charset : $CONFIG['default_charset']; header("Content-Type: text/plain; charset={$charset}"); if (!empty($_GET['_save'])) { - $filename = ($headers->subject ? $IMAP->decode_header($headers->subject) : 'roundcube') . '.eml'; + $filename = ($headers->subject ? $RCMAIL->imap->decode_header($headers->subject) : 'roundcube') . '.eml'; $browser = $RCMAIL->output->browser; if ($browser->ie && $browser->ver < 7) @@ -43,7 +43,7 @@ if ($uid = get_input_value('_uid', RCUBE_INPUT_GET)) header("Content-Disposition: attachment; filename=\"$filename\""); } - $IMAP->print_raw_body($uid); + $RCMAIL->imap->print_raw_body($uid); } else { diff --git a/program/steps/settings/folders.inc b/program/steps/settings/folders.inc index 77cbb5571..31f31a32a 100644 --- a/program/steps/settings/folders.inc +++ b/program/steps/settings/folders.inc @@ -30,13 +30,13 @@ if ($RCMAIL->action == 'subscribe') { $mbox = get_input_value('_mbox', RCUBE_INPUT_POST, true, 'UTF7-IMAP'); if (strlen($mbox)) { - $result = $IMAP->subscribe(array($mbox)); + $result = $RCMAIL->imap->subscribe(array($mbox)); // Handle virtual (non-existing) folders - if (!$result && $IMAP->get_error_code() == -1 && - $IMAP->get_response_code() == rcube_imap::TRYCREATE + if (!$result && $RCMAIL->imap->get_error_code() == -1 && + $RCMAIL->imap->get_response_code() == rcube_imap::TRYCREATE ) { - $result = $IMAP->create_mailbox($mbox, true); + $result = $RCMAIL->imap->create_mailbox($mbox, true); if ($result) { // @TODO: remove 'virtual' class of folder's row } @@ -62,7 +62,7 @@ else if ($RCMAIL->action == 'unsubscribe') { $mbox = get_input_value('_mbox', RCUBE_INPUT_POST, true, 'UTF7-IMAP'); if (strlen($mbox)) { - $result = $IMAP->unsubscribe(array($mbox)); + $result = $RCMAIL->imap->unsubscribe(array($mbox)); if ($result) $OUTPUT->show_message('folderunsubscribed', 'confirmation'); else @@ -80,7 +80,7 @@ else if ($RCMAIL->action == 'delete-folder') $plugin = $RCMAIL->plugins->exec_hook('folder_delete', array('name' => $mbox)); if (!$plugin['abort']) { - $deleted = $IMAP->delete_mailbox($plugin['name']); + $deleted = $RCMAIL->imap->delete_mailbox($plugin['name']); } else { $deleted = $plugin['result']; @@ -126,19 +126,19 @@ else if ($RCMAIL->action == 'purge') { $mbox_utf8 = get_input_value('_mbox', RCUBE_INPUT_POST, true); $mbox = rcube_charset_convert($mbox_utf8, RCMAIL_CHARSET, 'UTF7-IMAP'); - $delimiter = $IMAP->get_hierarchy_delimiter(); + $delimiter = $RCMAIL->imap->get_hierarchy_delimiter(); $trash_regexp = '/^' . preg_quote($CONFIG['trash_mbox'] . $delimiter, '/') . '/'; // we should only be purging trash (or their subfolders) if (!strlen($CONFIG['trash_mbox']) || $mbox == $CONFIG['trash_mbox'] || preg_match($trash_regexp, $mbox) ) { - $success = $IMAP->clear_mailbox($mbox); + $success = $RCMAIL->imap->clear_mailbox($mbox); $delete = true; } // copy to Trash else { - $success = $IMAP->move_message('1:*', $CONFIG['trash_mbox'], $mbox); + $success = $RCMAIL->imap->move_message('1:*', $CONFIG['trash_mbox'], $mbox); $delete = false; } @@ -164,7 +164,7 @@ else if ($RCMAIL->action == 'folder-size') { $name = trim(get_input_value('_mbox', RCUBE_INPUT_POST, true)); - $size = $IMAP->get_mailbox_size($name); + $size = $RCMAIL->imap->get_mailbox_size($name); // @TODO: check quota and show percentage usage of specified mailbox? @@ -183,7 +183,7 @@ if ($OUTPUT->ajax_call) // build table with all folders listed by server function rcube_subscription_form($attrib) { - global $RCMAIL, $IMAP, $CONFIG, $OUTPUT; + global $RCMAIL, $CONFIG, $OUTPUT; list($form_start, $form_end) = get_form_tags($attrib, 'folders'); unset($attrib['form']); @@ -200,12 +200,12 @@ function rcube_subscription_form($attrib) } // get folders from server - $IMAP->clear_cache('mailboxes', true); + $RCMAIL->imap->clear_cache('mailboxes', true); - $a_unsubscribed = $IMAP->list_unsubscribed(); - $a_subscribed = $IMAP->list_mailboxes('', '*', null, null, true); // unsorted - $delimiter = $IMAP->get_hierarchy_delimiter(); - $namespace = $IMAP->get_namespace(); + $a_unsubscribed = $RCMAIL->imap->list_unsubscribed(); + $a_subscribed = $RCMAIL->imap->list_mailboxes('', '*', null, null, true); // unsorted + $delimiter = $RCMAIL->imap->get_hierarchy_delimiter(); + $namespace = $RCMAIL->imap->get_namespace(); $a_js_folders = array(); $seen = array(); $list_folders = array(); @@ -213,7 +213,7 @@ function rcube_subscription_form($attrib) // pre-process folders list foreach ($a_unsubscribed as $i => $folder) { $folder_id = $folder; - $folder = $IMAP->mod_mailbox($folder); + $folder = $RCMAIL->imap->mod_mailbox($folder); $foldersplit = explode($delimiter, $folder); $name = rcube_charset_convert(array_pop($foldersplit), 'UTF7-IMAP'); $parent_folder = join($delimiter, $foldersplit); @@ -283,7 +283,7 @@ function rcube_subscription_form($attrib) } if (!$protected) { - $attrs = $IMAP->mailbox_attributes($folder['id']); + $attrs = $RCMAIL->imap->mailbox_attributes($folder['id']); $noselect = in_array('\\Noselect', $attrs); } @@ -403,7 +403,7 @@ function rcmail_rename_folder($oldname, $newname) $OUTPUT->set_pagetitle(rcube_label('folders')); $OUTPUT->include_script('list.js'); -$OUTPUT->set_env('quota', $IMAP->get_capability('QUOTA')); +$OUTPUT->set_env('quota', $RCMAIL->imap->get_capability('QUOTA')); // add some labels to client $OUTPUT->add_label('deletefolderconfirm', 'purgefolderconfirm', 'folderdeleting', diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc index b778afa13..65836a958 100644 --- a/program/steps/settings/func.inc +++ b/program/steps/settings/func.inc @@ -875,13 +875,13 @@ function rcmail_folder_options($mailbox) */ function rcmail_update_folder_row($name, $oldname=null, $subscribe=false, $class_name=null) { - global $IMAP, $CONFIG, $OUTPUT; + global $RCMAIL, $CONFIG, $OUTPUT; - $delimiter = $IMAP->get_hierarchy_delimiter(); + $delimiter = $RCMAIL->imap->get_hierarchy_delimiter(); $name_utf8 = rcube_charset_convert($name, 'UTF7-IMAP'); $protected = ($CONFIG['protect_default_folders'] == true && in_array($name, $CONFIG['default_imap_folders'])); - $foldersplit = explode($delimiter, $IMAP->mod_mailbox($name)); + $foldersplit = explode($delimiter, $RCMAIL->imap->mod_mailbox($name)); $level = count($foldersplit) - 1; $display_name = str_repeat(' ', $level) . Q($protected ? rcmail_localize_foldername($name) : rcube_charset_convert($foldersplit[$level], 'UTF7-IMAP')); diff --git a/program/steps/settings/save_folder.inc b/program/steps/settings/save_folder.inc index 48c957239..0fc090e12 100644 --- a/program/steps/settings/save_folder.inc +++ b/program/steps/settings/save_folder.inc @@ -33,7 +33,7 @@ $name_imap = rcube_charset_convert($name, RCMAIL_CHARSET, 'UTF7-IMAP'); $old_imap = rcube_charset_convert($old, RCMAIL_CHARSET, 'UTF7-IMAP'); // $path is in UTF7-IMAP already -$delimiter = $IMAP->get_hierarchy_delimiter(); +$delimiter = $RCMAIL->imap->get_hierarchy_delimiter(); $options = strlen($old_imap) ? rcmail_folder_options($old_imap) : array(); // Folder name checks @@ -103,7 +103,7 @@ if (!$error && !strlen($old)) { $folder = $plugin['record']; if (!$plugin['abort']) { - $created = $IMAP->create_mailbox($folder['name'], $folder['subscribe']); + $created = $RCMAIL->imap->create_mailbox($folder['name'], $folder['subscribe']); } else { $created = $plugin['result']; |