- Remove deprecated global $IMAP variable usage (#1488148)

pull/1/head
alecpl 13 years ago
parent 7e263ea204
commit b6da0b76af

@ -129,7 +129,7 @@ if ($RCMAIL->task == 'login' && $RCMAIL->action == 'login') {
$OUTPUT->redirect($redir); $OUTPUT->redirect($redir);
} }
else { 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'); $OUTPUT->show_message($error_code < -1 ? 'imaperror' : (!$auth['valid'] ? 'invalidrequest' : 'loginfailed'), 'warning');
$RCMAIL->plugins->exec_hook('login_failed', array( $RCMAIL->plugins->exec_hook('login_failed', array(

@ -584,7 +584,6 @@ class rcmail
* Create global IMAP object and connect to server * Create global IMAP object and connect to server
* *
* @param boolean True if connection should be established * @param boolean True if connection should be established
* @todo Remove global $IMAP
*/ */
public function imap_init($connect = false) public function imap_init($connect = false)
{ {

@ -37,7 +37,7 @@ if ($abook == null || !is_object($CONTACTS)) {
if (!empty($_POST['_address']) && 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'])) { if (!empty($contact_arr[1]['mailto'])) {
$contact = array( $contact = array(

@ -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'); $check_all = !empty($_GET['_refresh']) || (bool)$RCMAIL->config->get('check_all_folders');
// list of folders to check // list of folders to check
if ($check_all) { if ($check_all) {
$a_mailboxes = $IMAP->list_mailboxes('', '*', 'mail'); $a_mailboxes = $RCMAIL->imap->list_mailboxes('', '*', 'mail');
} }
else { else {
$a_mailboxes = (array) $current; $a_mailboxes = (array) $current;
@ -37,11 +37,11 @@ foreach ($a_mailboxes as $mbox_name) {
$is_current = $mbox_name == $current; $is_current = $mbox_name == $current;
if ($is_current) { if ($is_current) {
// Synchronize mailbox cache, handle flag changes // Synchronize mailbox cache, handle flag changes
$IMAP->mailbox_sync($mbox_name); $RCMAIL->imap->mailbox_sync($mbox_name);
} }
// Get mailbox status // Get mailbox status
$status = $IMAP->mailbox_status($mbox_name); $status = $RCMAIL->imap->mailbox_status($mbox_name);
if ($status & 1) { if ($status & 1) {
// trigger plugin hook // trigger plugin hook
@ -58,7 +58,7 @@ foreach ($a_mailboxes as $mbox_name) {
if ($search_request && isset($_SESSION['search']) if ($search_request && isset($_SESSION['search'])
&& $_SESSION['search_request'] == $search_request && $_SESSION['search_request'] == $search_request
) { ) {
$_SESSION['search'] = $IMAP->refresh_search(); $_SESSION['search'] = $RCMAIL->imap->refresh_search();
} }
if (!empty($_GET['_quota'])) if (!empty($_GET['_quota']))
@ -69,27 +69,27 @@ foreach ($a_mailboxes as $mbox_name) {
continue; continue;
// get overall message count; allow caching because rcube_imap::mailbox_status() did a refresh // 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 // check current page if we're not on the first page
if ($all_count && $IMAP->list_page > 1) { if ($all_count && $RCMAIL->imap->list_page > 1) {
$remaining = $all_count - $IMAP->page_size * ($IMAP->list_page - 1); $remaining = $all_count - $RCMAIL->imap->page_size * ($RCMAIL->imap->list_page - 1);
if ($remaining <= 0) { if ($remaining <= 0) {
$IMAP->set_page($IMAP->list_page-1); $RCMAIL->imap->set_page($RCMAIL->imap->list_page-1);
$_SESSION['page'] = $IMAP->list_page; $_SESSION['page'] = $RCMAIL->imap->list_page;
} }
} }
$OUTPUT->set_env('messagecount', $all_count); $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->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) // remove old rows (and clear selection if new list is empty)
$OUTPUT->command('message_list.clear', $all_count ? false : true); $OUTPUT->command('message_list.clear', $all_count ? false : true);
if ($all_count) { 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 // add message rows
rcmail_js_message_list($a_headers, false); rcmail_js_message_list($a_headers, false);
// remove messages that don't exists from list selection array // remove messages that don't exists from list selection array

@ -56,7 +56,7 @@ if (!is_array($COMPOSE))
$_SESSION['compose_data_'.$COMPOSE_ID] = array( $_SESSION['compose_data_'.$COMPOSE_ID] = array(
'id' => $COMPOSE_ID, 'id' => $COMPOSE_ID,
'param' => request2param(RCUBE_INPUT_GET), 'param' => request2param(RCUBE_INPUT_GET),
'mailbox' => $IMAP->get_mailbox_name(), 'mailbox' => $RCMAIL->imap->get_mailbox_name(),
); );
$COMPOSE =& $_SESSION['compose_data_'.$COMPOSE_ID]; $COMPOSE =& $_SESSION['compose_data_'.$COMPOSE_ID];
@ -134,7 +134,7 @@ if (!empty($CONFIG['drafts_mbox'])) {
$OUTPUT->set_env('draft_autosave', $CONFIG['draft_autosave']); $OUTPUT->set_env('draft_autosave', $CONFIG['draft_autosave']);
} }
// set current mailbox in client environment // 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('sig_above', $RCMAIL->config->get('sig_above', false));
$OUTPUT->set_env('top_posting', $RCMAIL->config->get('top_posting', false)); $OUTPUT->set_env('top_posting', $RCMAIL->config->get('top_posting', false));
$OUTPUT->set_env('recipients_separator', trim($RCMAIL->config->get('recipients_separator', ','))); $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 // make sure message is marked as read
if ($MESSAGE && $MESSAGE->headers && empty($MESSAGE->headers->flags['SEEN'])) 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)) if (!empty($MESSAGE->headers->charset))
$IMAP->set_charset($MESSAGE->headers->charset); $RCMAIL->imap->set_charset($MESSAGE->headers->charset);
if ($compose_mode == RCUBE_COMPOSE_REPLY) if ($compose_mode == RCUBE_COMPOSE_REPLY)
{ {
@ -271,7 +271,7 @@ else if (count($MESSAGE->identities)) {
// extract all recipients of the reply-message // extract all recipients of the reply-message
if (is_object($MESSAGE->headers) && in_array($compose_mode, array(RCUBE_COMPOSE_REPLY, RCUBE_COMPOSE_FORWARD))) 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) { foreach ($a_to as $addr) {
if (!empty($addr['mailto'])) { if (!empty($addr['mailto'])) {
$a_recipients[] = strtolower($addr['mailto']); $a_recipients[] = strtolower($addr['mailto']);
@ -280,7 +280,7 @@ else if (count($MESSAGE->identities)) {
} }
if (!empty($MESSAGE->headers->cc)) { 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) { foreach ($a_cc as $addr) {
if (!empty($addr['mailto'])) { if (!empty($addr['mailto'])) {
$a_recipients[] = strtolower($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 // split recipients and put them back together in a unique way
if (!empty($fvalue) && in_array($header, array('to', 'cc', 'bcc'))) { 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(); $fvalue = array();
foreach ($to_addresses as $addr_part) { foreach ($to_addresses as $addr_part) {
@ -1432,18 +1432,18 @@ function rcmail_store_target_selection($attrib)
function rcmail_check_sent_folder($folder, $create=false) 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; return true;
} }
// folder may exist but isn't subscribed (#1485241) // folder may exist but isn't subscribed (#1485241)
if ($create) { if ($create) {
if (!$IMAP->mailbox_exists($folder)) if (!$RCMAIL->imap->mailbox_exists($folder))
return $IMAP->create_mailbox($folder, true); return $RCMAIL->imap->create_mailbox($folder, true);
else else
return $IMAP->subscribe($folder); return $RCMAIL->imap->subscribe($folder);
} }
return false; return false;

@ -29,7 +29,7 @@ if (!empty($_POST['_uid']) && !empty($_POST['_target_mbox'])) {
$target = get_input_value('_target_mbox', RCUBE_INPUT_POST, true); $target = get_input_value('_target_mbox', RCUBE_INPUT_POST, true);
$mbox = get_input_value('_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) { if (!$copied) {
// send error message // send error message

@ -27,7 +27,7 @@ $mbox = get_input_value('_mbox', RCUBE_INPUT_POST, true);
// send EXPUNGE command // send EXPUNGE command
if ($RCMAIL->action == 'expunge') { if ($RCMAIL->action == 'expunge') {
$success = $IMAP->expunge($mbox); $success = $RCMAIL->imap->expunge($mbox);
// reload message list if current mailbox // reload message list if current mailbox
if ($success) { if ($success) {
@ -48,7 +48,7 @@ if ($RCMAIL->action == 'expunge') {
// clear mailbox // clear mailbox
else if ($RCMAIL->action == 'purge') else if ($RCMAIL->action == 'purge')
{ {
$delimiter = $IMAP->get_hierarchy_delimiter(); $delimiter = $RCMAIL->imap->get_hierarchy_delimiter();
$trash_regexp = '/^' . preg_quote($CONFIG['trash_mbox'] . $delimiter, '/') . '/'; $trash_regexp = '/^' . preg_quote($CONFIG['trash_mbox'] . $delimiter, '/') . '/';
$junk_regexp = '/^' . preg_quote($CONFIG['junk_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'] if ($mbox == $CONFIG['trash_mbox'] || $mbox == $CONFIG['junk_mbox']
|| preg_match($trash_regexp, $mbox) || preg_match($junk_regexp, $mbox) || preg_match($trash_regexp, $mbox) || preg_match($junk_regexp, $mbox)
) { ) {
$success = $IMAP->clear_mailbox($mbox); $success = $RCMAIL->imap->clear_mailbox($mbox);
if ($success) { if ($success) {
$OUTPUT->show_message('folderpurged', 'confirmation'); $OUTPUT->show_message('folderpurged', 'confirmation');

@ -47,12 +47,12 @@ if (!in_array($RCMAIL->action, $NOIMAP_ACTIONS) && !$RCMAIL->imap_connect()) {
// set imap properties and session vars // set imap properties and session vars
if (strlen(trim($mbox = get_input_value('_mbox', RCUBE_INPUT_GPC, true)))) if (strlen(trim($mbox = get_input_value('_mbox', RCUBE_INPUT_GPC, true))))
$IMAP->set_mailbox(($_SESSION['mbox'] = $mbox)); $RCMAIL->imap->set_mailbox(($_SESSION['mbox'] = $mbox));
else if ($IMAP) else if ($RCMAIL->imap)
$_SESSION['mbox'] = $IMAP->get_mailbox_name(); $_SESSION['mbox'] = $RCMAIL->imap->get_mailbox_name();
if (!empty($_GET['_page'])) 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 // set default sort col/order to session
if (!isset($_SESSION['sort_col'])) if (!isset($_SESSION['sort_col']))
@ -69,28 +69,28 @@ if (isset($_GET['_threads'])) {
unset($a_threading[$_SESSION['mbox']]); unset($a_threading[$_SESSION['mbox']]);
$RCMAIL->user->save_prefs(array('message_threading' => $a_threading)); $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 // set message set for search result
if (!empty($_REQUEST['_search']) && isset($_SESSION['search']) if (!empty($_REQUEST['_search']) && isset($_SESSION['search'])
&& $_SESSION['search_request'] == $_REQUEST['_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_request', $_REQUEST['_search']);
$OUTPUT->set_env('search_text', $_SESSION['last_text_search']); $OUTPUT->set_env('search_text', $_SESSION['last_text_search']);
} }
// set main env variables, labels and page title // set main env variables, labels and page title
if (empty($RCMAIL->action) || $RCMAIL->action == 'list') { if (empty($RCMAIL->action) || $RCMAIL->action == 'list') {
$mbox_name = $IMAP->get_mailbox_name(); $mbox_name = $RCMAIL->imap->get_mailbox_name();
if (empty($RCMAIL->action)) { if (empty($RCMAIL->action)) {
// initialize searching result if search_filter is used // initialize searching result if search_filter is used
if ($_SESSION['search_filter'] && $_SESSION['search_filter'] != 'ALL') { if ($_SESSION['search_filter'] && $_SESSION['search_filter'] != 'ALL') {
$search_request = md5($mbox_name.$_SESSION['search_filter']); $search_request = md5($mbox_name.$_SESSION['search_filter']);
$IMAP->search($mbox_name, $_SESSION['search_filter'], RCMAIL_CHARSET, $_SESSION['sort_col']); $RCMAIL->imap->search($mbox_name, $_SESSION['search_filter'], RCMAIL_CHARSET, $_SESSION['sort_col']);
$_SESSION['search'] = $IMAP->get_search_set(); $_SESSION['search'] = $RCMAIL->imap->get_search_set();
$_SESSION['search_request'] = $search_request; $_SESSION['search_request'] = $search_request;
$OUTPUT->set_env('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 // set current mailbox and some other vars in client environment
$OUTPUT->set_env('mailbox', $mbox_name); $OUTPUT->set_env('mailbox', $mbox_name);
$OUTPUT->set_env('pagesize', $IMAP->page_size); $OUTPUT->set_env('pagesize', $RCMAIL->imap->page_size);
$OUTPUT->set_env('quota', $IMAP->get_capability('QUOTA')); $OUTPUT->set_env('quota', $RCMAIL->imap->get_capability('QUOTA'));
$OUTPUT->set_env('delimiter', $IMAP->get_hierarchy_delimiter()); $OUTPUT->set_env('delimiter', $RCMAIL->imap->get_hierarchy_delimiter());
$OUTPUT->set_env('threading', (bool) $IMAP->threading); $OUTPUT->set_env('threading', (bool) $RCMAIL->imap->threading);
$OUTPUT->set_env('threads', $IMAP->threading || $IMAP->get_capability('THREAD')); $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)); $OUTPUT->set_env('preview_pane_mark_read', $RCMAIL->config->get('preview_pane_mark_read', 0));
if ($CONFIG['flag_for_deletion']) if ($CONFIG['flag_for_deletion'])
@ -130,7 +130,7 @@ if (empty($RCMAIL->action) || $RCMAIL->action == 'list') {
'movingmessage', 'copyingmessage', 'deletingmessage', 'markingmessage', 'movingmessage', 'copyingmessage', 'deletingmessage', 'markingmessage',
'copy', 'move', 'quota'); '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) function rcmail_message_list($attrib)
{ {
global $IMAP, $CONFIG, $OUTPUT; global $RCMAIL, $CONFIG, $OUTPUT;
// add some labels to client // add some labels to client
$OUTPUT->add_label('from', 'to'); $OUTPUT->add_label('from', 'to');
@ -161,8 +161,8 @@ function rcmail_message_list($attrib)
// save some variables for use in ajax list // save some variables for use in ajax list
$_SESSION['list_attrib'] = $attrib; $_SESSION['list_attrib'] = $attrib;
$mbox = $IMAP->get_mailbox_name(); $mbox = $RCMAIL->imap->get_mailbox_name();
$delim = $IMAP->get_hierarchy_delimiter(); $delim = $RCMAIL->imap->get_hierarchy_delimiter();
// show 'to' instead of 'from' in sent/draft messages // 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) 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) 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($a_show_cols)) {
if (!empty($_SESSION['list_attrib']['columns'])) 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; $head_replace = true;
} }
$mbox = $IMAP->get_mailbox_name(); $mbox = $RCMAIL->imap->get_mailbox_name();
$delim = $IMAP->get_hierarchy_delimiter(); $delim = $RCMAIL->imap->get_hierarchy_delimiter();
// make sure 'threads' and 'subject' columns are present // make sure 'threads' and 'subject' columns are present
if (!in_array('subject', $a_show_cols)) 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_cols = array();
$a_msg_flags = 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() // format each col; similar as in rcmail_message_list()
foreach ($a_show_cols as $col) { foreach ($a_show_cols as $col) {
if (in_array($col, array('from', 'to', 'cc', 'replyto'))) if (in_array($col, array('from', 'to', 'cc', 'replyto')))
$cont = Q(rcmail_address_string($header->$col, 3), 'show'); $cont = Q(rcmail_address_string($header->$col, 3), 'show');
else if ($col=='subject') { 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'); if (!$cont) $cont = rcube_label('nosubject');
$cont = Q($cont); $cont = Q($cont);
} }
@ -319,7 +319,7 @@ function rcmail_js_message_list($a_headers, $insert_top=FALSE, $a_show_cols=null
$insert_top); $insert_top);
} }
if ($IMAP->threading) { if ($RCMAIL->imap->threading) {
$OUTPUT->command('init_threads', (array) $roots, $mbox); $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 * return an HTML iframe for loading mail content
*/ */
function rcmail_messagecontent_frame($attrib) function rcmail_messagecontent_frame($attrib)
{ {
global $OUTPUT, $RCMAIL; global $OUTPUT, $RCMAIL;
if (empty($attrib['id'])) 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'); $OUTPUT->set_env('blankpage', $attrib['src'] ? $OUTPUT->abs_url($attrib['src']) : 'program/blank.gif');
return html::iframe($attrib); return html::iframe($attrib);
} }
function rcmail_messagecount_display($attrib) function rcmail_messagecount_display($attrib)
{ {
global $RCMAIL; global $RCMAIL;
if (!$attrib['id']) if (!$attrib['id'])
@ -423,33 +423,33 @@ function rcmail_messagecount_display($attrib)
$content = $RCMAIL->action != 'show' ? rcmail_get_messagecount_text() : rcube_label('loading'); $content = $RCMAIL->action != 'show' ? rcmail_get_messagecount_text() : rcube_label('loading');
return html::span($attrib, $content); return html::span($attrib, $content);
} }
function rcmail_get_messagecount_text($count=NULL, $page=NULL) function rcmail_get_messagecount_text($count=NULL, $page=NULL)
{ {
global $RCMAIL, $IMAP; global $RCMAIL;
if ($page===NULL) 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) if ($count!==NULL)
$max = $count; $max = $count;
else if ($RCMAIL->action) 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) if ($max==0)
$out = rcube_label('mailboxempty'); $out = rcube_label('mailboxempty');
else 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, '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))); 'count' => $max)));
return Q($out); return Q($out);
} }
function rcmail_mailbox_name_display($attrib) function rcmail_mailbox_name_display($attrib)
@ -868,7 +868,7 @@ function rcmail_html_tag_callback($matches)
*/ */
function rcmail_message_headers($attrib, $headers=NULL) function rcmail_message_headers($attrib, $headers=NULL)
{ {
global $IMAP, $OUTPUT, $MESSAGE, $PRINT_MODE, $RCMAIL; global $OUTPUT, $MESSAGE, $PRINT_MODE, $RCMAIL;
static $sa_attrib; static $sa_attrib;
// keep header table attrib // keep header table attrib
@ -925,7 +925,7 @@ function rcmail_message_headers($attrib, $headers=NULL)
else if ($hkey == 'subject' && empty($value)) else if ($hkey == 'subject' && empty($value))
$header_value = rcube_label('nosubject'); $header_value = rcube_label('nosubject');
else else
$header_value = trim($IMAP->decode_header($value)); $header_value = trim($RCMAIL->imap->decode_header($value));
$output_headers[$hkey] = array( $output_headers[$hkey] = array(
'title' => rcube_label(preg_replace('/(^mail-|-)/', '', $hkey)), 'title' => rcube_label(preg_replace('/(^mail-|-)/', '', $hkey)),
@ -973,7 +973,7 @@ function rcmail_message_full_headers($attrib, $headers=NULL)
*/ */
function rcmail_message_body($attrib) 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)) if (!is_array($MESSAGE->parts) && empty($MESSAGE->body))
return ''; return '';
@ -999,7 +999,7 @@ function rcmail_message_body($attrib)
if (!rcmail_mem_check($part->size * 10)) { if (!rcmail_mem_check($part->size * 10)) {
$out .= html::span('part-notice', rcube_label('messagetoobig'). ' ' $out .= html::span('part-notice', rcube_label('messagetoobig'). ' '
. html::a('?_task=mail&_action=get&_download=1&_uid='.$MESSAGE->uid.'&_part='.$part->mime_id . 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; continue;
} }
@ -1045,7 +1045,7 @@ function rcmail_message_body($attrib)
if (!rcmail_mem_check(strlen($MESSAGE->body) * 10)) { if (!rcmail_mem_check(strlen($MESSAGE->body) * 10)) {
$out .= html::span('part-notice', rcube_label('messagetoobig'). ' ' $out .= html::span('part-notice', rcube_label('messagetoobig'). ' '
. html::a('?_task=mail&_action=get&_download=1&_uid='.$MESSAGE->uid.'&_part=0' . 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 { else {
$plugin = $RCMAIL->plugins->exec_hook('message_body_prefix', array( $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) 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)) if (!sizeof($a_parts))
return $input; return $input;
@ -1451,17 +1451,17 @@ function rcmail_compose_cleanup($id)
*/ */
function rcmail_send_mdn($message, &$smtp_error) function rcmail_send_mdn($message, &$smtp_error)
{ {
global $RCMAIL, $IMAP; global $RCMAIL;
if (!is_object($message) || !is_a($message, 'rcube_message')) if (!is_object($message) || !is_a($message, 'rcube_message'))
$message = new rcube_message($message); $message = new rcube_message($message);
if ($message->headers->mdn_to && empty($message->headers->flags['MDNSENT']) && 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(); $identity = $RCMAIL->user->get_identity();
$sender = format_email_recipient($identity['email'], $identity['name']); $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']; $mailto = $recipient['mailto'];
$compose = new Mail_mime("\r\n"); $compose = new Mail_mime("\r\n");
@ -1512,7 +1512,7 @@ function rcmail_send_mdn($message, &$smtp_error)
if ($sent) if ($sent)
{ {
$IMAP->set_flag($message->uid, 'MDNSENT'); $RCMAIL->imap->set_flag($message->uid, 'MDNSENT');
return true; return true;
} }
} }

@ -117,7 +117,7 @@ else if (strlen($pid = get_input_value('_part', RCUBE_INPUT_GET))) {
if (!rcmail_mem_check($part->size * 10)) { if (!rcmail_mem_check($part->size * 10)) {
$out = '<body>' . rcube_label('messagetoobig'). ' ' $out = '<body>' . rcube_label('messagetoobig'). ' '
. html::a('?_task=mail&_action=get&_download=1&_uid='.$MESSAGE->uid.'&_part='.$part->mime_id . 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 { else {
// get part body if not available // 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'); $stdout = fopen('php://output', 'w');
stream_filter_register('rcube_content', 'rcube_content_filter') or die('Failed to register content filter'); stream_filter_register('rcube_content', 'rcube_content_filter') or die('Failed to register content filter');
stream_filter_append($stdout, 'rcube_content'); 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 { else {
@ -165,7 +165,7 @@ else if (strlen($pid = get_input_value('_part', RCUBE_INPUT_GET))) {
if ($part->body) if ($part->body)
echo $part->body; echo $part->body;
else if ($part->size) 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);
} }
} }

@ -19,11 +19,11 @@
*/ */
$a_folders = $IMAP->list_mailboxes('', '*', 'mail'); $a_folders = $RCMAIL->imap->list_mailboxes('', '*', 'mail');
if (!empty($a_folders)) if (!empty($a_folders))
{ {
$current = $IMAP->get_mailbox_name(); $current = $RCMAIL->imap->get_mailbox_name();
$inbox = ($current == 'INBOX'); $inbox = ($current == 'INBOX');
$check_all = (bool)$RCMAIL->config->get('check_all_folders'); $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) if (!$check_all && $unseen_old !== null && $mbox_row != $current)
$unseen = $unseen_old; $unseen = $unseen_old;
else 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) { if ($unseen || $unseen_old === null) {
$OUTPUT->command('set_unread_count', $mbox_row, $unseen, $inbox && $mbox_row == 'INBOX'); $OUTPUT->command('set_unread_count', $mbox_row, $unseen, $inbox && $mbox_row == 'INBOX');

@ -20,7 +20,7 @@
if ($uid = get_input_value('_uid', RCUBE_INPUT_POST)) 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) { if ($source !== false) {
$source = htmlspecialchars(trim($source)); $source = htmlspecialchars(trim($source));

@ -51,30 +51,30 @@ if ($cols = get_input_value('_cols', RCUBE_INPUT_GET))
if ($save_arr) if ($save_arr)
$RCMAIL->user->save_prefs($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 // 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 // initialize searching result if search_filter is used
if ($_SESSION['search_filter'] && $_SESSION['search_filter'] != 'ALL') if ($_SESSION['search_filter'] && $_SESSION['search_filter'] != 'ALL')
{ {
$search_request = md5($mbox_name.$_SESSION['search_filter']); $search_request = md5($mbox_name.$_SESSION['search_filter']);
$IMAP->search($mbox_name, $_SESSION['search_filter'], RCMAIL_CHARSET, $sort_col); $RCMAIL->imap->search($mbox_name, $_SESSION['search_filter'], RCMAIL_CHARSET, $sort_col);
$_SESSION['search'] = $IMAP->get_search_set(); $_SESSION['search'] = $RCMAIL->imap->get_search_set();
$_SESSION['search_request'] = $search_request; $_SESSION['search_request'] = $search_request;
$OUTPUT->set_env('search_request', $search_request); $OUTPUT->set_env('search_request', $search_request);
} }
// fetch message headers // fetch message headers
if ($count = $IMAP->messagecount($mbox_name, $IMAP->threading ? 'THREADS' : 'ALL', !empty($_REQUEST['_refresh']))) if ($count = $RCMAIL->imap->messagecount($mbox_name, $RCMAIL->imap->threading ? 'THREADS' : 'ALL', !empty($_REQUEST['_refresh'])))
$a_headers = $IMAP->list_headers($mbox_name, NULL, $sort_col, $sort_order); $a_headers = $RCMAIL->imap->list_headers($mbox_name, NULL, $sort_col, $sort_order);
// update search set (possible change of threading mode) // update search set (possible change of threading mode)
if (!empty($_REQUEST['_search']) && isset($_SESSION['search']) if (!empty($_REQUEST['_search']) && isset($_SESSION['search'])
&& $_SESSION['search_request'] == $_REQUEST['_search'] && $_SESSION['search_request'] == $_REQUEST['_search']
) { ) {
$_SESSION['search'] = $IMAP->get_search_set(); $_SESSION['search'] = $RCMAIL->imap->get_search_set();
} }
// remove old search data // remove old search data
else if (empty($_REQUEST['_search']) && isset($_SESSION['search'])) { 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); rcmail_send_unread_count($mbox_name, !empty($_REQUEST['_refresh']), $unseen);
// update message count display // 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('messagecount', $count);
$OUTPUT->set_env('pagecount', $pages); $OUTPUT->set_env('pagecount', $pages);
$OUTPUT->set_env('threading', (bool) $IMAP->threading); $OUTPUT->set_env('threading', (bool) $RCMAIL->imap->threading);
$OUTPUT->set_env('current_page', $count ? $IMAP->list_page : 1); $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_rowcount', rcmail_get_messagecount_text($count), $mbox_name);
$OUTPUT->command('set_mailboxname', rcmail_get_mailbox_name_text()); $OUTPUT->command('set_mailboxname', rcmail_get_mailbox_name_text());
@ -108,7 +108,7 @@ if (isset($a_headers) && count($a_headers))
} }
else { else {
// handle IMAP errors (e.g. #1486905) // 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(); rcmail_display_server_error();
} }
else if ($search_request) else if ($search_request)

@ -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') { if ($flag == 'DELETED' && $CONFIG['skip_deleted'] && $_POST['_from'] != 'show') {
// count messages before changing anything // count messages before changing anything
$old_count = $IMAP->messagecount(NULL, $IMAP->threading ? 'THREADS' : 'ALL'); $old_count = $RCMAIL->imap->messagecount(NULL, $RCMAIL->imap->threading ? 'THREADS' : 'ALL');
$old_pages = ceil($old_count / $IMAP->page_size); $old_pages = ceil($old_count / $RCMAIL->imap->page_size);
$count = sizeof(explode(',', $uids)); $count = sizeof(explode(',', $uids));
} }
$marked = $IMAP->set_flag($uids, $flag); $marked = $RCMAIL->imap->set_flag($uids, $flag);
if (!$marked) { if (!$marked) {
// send error message // 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'])) { if ($flag == 'DELETED' && $CONFIG['read_when_deleted'] && !empty($_POST['_ruid'])) {
$ruids = get_input_value('_ruid', RCUBE_INPUT_POST); $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']) if ($read && !$CONFIG['skip_deleted'])
$OUTPUT->command('flag_deleted_as_read', $ruids); $OUTPUT->command('flag_deleted_as_read', $ruids);
} }
if ($flag == 'SEEN' || $flag == 'UNSEEN' || ($flag == 'DELETED' && !$CONFIG['skip_deleted'])) { 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']) { else if ($flag == 'DELETED' && $CONFIG['skip_deleted']) {
if ($_POST['_from'] == 'show') { 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'); $OUTPUT->command('command', 'list');
} else { } else {
// refresh saved search set after moving some messages // refresh saved search set after moving some messages
if (($search_request = get_input_value('_search', RCUBE_INPUT_GPC)) && $IMAP->search_set) { if (($search_request = get_input_value('_search', RCUBE_INPUT_GPC)) && $RCMAIL->imap->search_set) {
$_SESSION['search'] = $IMAP->refresh_search(); $_SESSION['search'] = $RCMAIL->imap->refresh_search();
} }
$msg_count = $IMAP->messagecount(NULL, $IMAP->threading ? 'THREADS' : 'ALL'); $msg_count = $RCMAIL->imap->messagecount(NULL, $RCMAIL->imap->threading ? 'THREADS' : 'ALL');
$pages = ceil($msg_count / $IMAP->page_size); $pages = ceil($msg_count / $RCMAIL->imap->page_size);
$nextpage_count = $old_count - $IMAP->page_size * $IMAP->list_page; $nextpage_count = $old_count - $RCMAIL->imap->page_size * $RCMAIL->imap->list_page;
$remaining = $msg_count - $IMAP->page_size * ($IMAP->list_page - 1); $remaining = $msg_count - $RCMAIL->imap->page_size * ($RCMAIL->imap->list_page - 1);
// jump back one page (user removed the whole last page) // jump back one page (user removed the whole last page)
if ($IMAP->list_page > 1 && $remaining == 0) { if ($RCMAIL->imap->list_page > 1 && $remaining == 0) {
$IMAP->set_page($IMAP->list_page-1); $RCMAIL->imap->set_page($RCMAIL->imap->list_page-1);
$_SESSION['page'] = $IMAP->list_page; $_SESSION['page'] = $RCMAIL->imap->list_page;
$jump_back = true; $jump_back = true;
} }
// update message count display // update message count display
$OUTPUT->set_env('messagecount', $msg_count); $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); $OUTPUT->set_env('pagecount', $pages);
// update mailboxlist // update mailboxlist
$mbox = $IMAP->get_mailbox_name(); $mbox = $RCMAIL->imap->get_mailbox_name();
$unseen_count = $msg_count ? $IMAP->messagecount($mbox, 'UNSEEN') : 0; $unseen_count = $msg_count ? $RCMAIL->imap->messagecount($mbox, 'UNSEEN') : 0;
$old_unseen = rcmail_get_unseen_count($mbox); $old_unseen = rcmail_get_unseen_count($mbox);
if ($old_unseen != $unseen_count) { 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); $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); $count = get_input_value('_count', RCUBE_INPUT_POST);
// add new rows from next page (if any) // 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_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']; $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); $jump_back ? NULL : $count);
rcmail_js_message_list($a_headers, false); rcmail_js_message_list($a_headers, false);

@ -24,8 +24,8 @@ if (!$OUTPUT->ajax_call)
return; return;
// count messages before changing anything // count messages before changing anything
$old_count = $IMAP->messagecount(NULL, $IMAP->threading ? 'THREADS' : 'ALL'); $old_count = $RCMAIL->imap->messagecount(NULL, $RCMAIL->imap->threading ? 'THREADS' : 'ALL');
$old_pages = ceil($old_count / $IMAP->page_size); $old_pages = ceil($old_count / $RCMAIL->imap->page_size);
// move messages // move messages
if ($RCMAIL->action=='moveto' && !empty($_POST['_uid']) && strlen($_POST['_target_mbox'])) { 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); $target = get_input_value('_target_mbox', RCUBE_INPUT_POST, true);
$mbox = get_input_value('_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) { if (!$moved) {
// send error message // 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)))); $count = sizeof(explode(',', ($uids = get_input_value('_uid', RCUBE_INPUT_POST))));
$mbox = get_input_value('_mbox', RCUBE_INPUT_POST, true); $mbox = get_input_value('_mbox', RCUBE_INPUT_POST, true);
$del = $IMAP->delete_message($uids, $mbox); $del = $RCMAIL->imap->delete_message($uids, $mbox);
if (!$del) { if (!$del) {
// send error message // send error message
@ -76,8 +76,8 @@ else {
} }
// refresh saved search set after moving some messages // refresh saved search set after moving some messages
if (($search_request = get_input_value('_search', RCUBE_INPUT_GPC)) && $IMAP->search_set) { if (($search_request = get_input_value('_search', RCUBE_INPUT_GPC)) && $RCMAIL->imap->search_set) {
$_SESSION['search'] = $IMAP->refresh_search(); $_SESSION['search'] = $RCMAIL->imap->refresh_search();
} }
if ($_POST['_from'] == 'show') if ($_POST['_from'] == 'show')
@ -89,26 +89,26 @@ if ($_POST['_from'] == 'show')
} }
else else
{ {
$msg_count = $IMAP->messagecount(NULL, $IMAP->threading ? 'THREADS' : 'ALL'); $msg_count = $RCMAIL->imap->messagecount(NULL, $RCMAIL->imap->threading ? 'THREADS' : 'ALL');
$pages = ceil($msg_count / $IMAP->page_size); $pages = ceil($msg_count / $RCMAIL->imap->page_size);
$nextpage_count = $old_count - $IMAP->page_size * $IMAP->list_page; $nextpage_count = $old_count - $RCMAIL->imap->page_size * $RCMAIL->imap->list_page;
$remaining = $msg_count - $IMAP->page_size * ($IMAP->list_page - 1); $remaining = $msg_count - $RCMAIL->imap->page_size * ($RCMAIL->imap->list_page - 1);
// jump back one page (user removed the whole last page) // jump back one page (user removed the whole last page)
if ($IMAP->list_page > 1 && $remaining == 0) { if ($RCMAIL->imap->list_page > 1 && $remaining == 0) {
$IMAP->set_page($IMAP->list_page-1); $RCMAIL->imap->set_page($RCMAIL->imap->list_page-1);
$_SESSION['page'] = $IMAP->list_page; $_SESSION['page'] = $RCMAIL->imap->list_page;
$jump_back = true; $jump_back = true;
} }
// update message count display // update message count display
$OUTPUT->set_env('messagecount', $msg_count); $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); $OUTPUT->set_env('pagecount', $pages);
// update mailboxlist // update mailboxlist
$mbox = $IMAP->get_mailbox_name(); $mbox = $RCMAIL->imap->get_mailbox_name();
$unseen_count = $msg_count ? $IMAP->messagecount($mbox, 'UNSEEN') : 0; $unseen_count = $msg_count ? $RCMAIL->imap->messagecount($mbox, 'UNSEEN') : 0;
$old_unseen = rcmail_get_unseen_count($mbox); $old_unseen = rcmail_get_unseen_count($mbox);
if ($old_unseen != $unseen_count) { if ($old_unseen != $unseen_count) {
@ -123,7 +123,7 @@ else
$OUTPUT->command('set_quota', rcmail_quota_content()); $OUTPUT->command('set_quota', rcmail_quota_content());
$OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($msg_count), $mbox); $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); $count = get_input_value('_count', RCUBE_INPUT_POST);
// add new rows from next page (if any) // 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_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']; $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); $jump_back ? NULL : $count);
rcmail_js_message_list($a_headers, false); rcmail_js_message_list($a_headers, false);

@ -20,7 +20,7 @@
*/ */
$uid = get_input_value('_uid', RCUBE_INPUT_GET); $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(); $cnt = $index->countMessages();
if ($cnt && ($pos = $index->exists($uid, true)) !== false) { if ($cnt && ($pos = $index->exists($uid, true)) !== false) {

@ -18,8 +18,8 @@
$REMOTE_REQUEST = TRUE; $REMOTE_REQUEST = TRUE;
// reset list_page and old search results // reset list_page and old search results
$IMAP->set_page(1); $RCMAIL->imap->set_page(1);
$IMAP->set_search_set(NULL); $RCMAIL->imap->set_search_set(NULL);
$_SESSION['page'] = 1; $_SESSION['page'] = 1;
// using encodeURI with javascript "should" give us // using encodeURI with javascript "should" give us
@ -107,32 +107,32 @@ $search_str = trim($search_str);
// execute IMAP search // execute IMAP search
if ($search_str) 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 // save search results in session
if (!is_array($_SESSION['search'])) if (!is_array($_SESSION['search']))
$_SESSION['search'] = array(); $_SESSION['search'] = array();
if ($search_str) { if ($search_str) {
$_SESSION['search'] = $IMAP->get_search_set(); $_SESSION['search'] = $RCMAIL->imap->get_search_set();
$_SESSION['last_text_search'] = $str; $_SESSION['last_text_search'] = $str;
} }
$_SESSION['search_request'] = $search_request; $_SESSION['search_request'] = $search_request;
// Get the headers // Get the headers
$result_h = $IMAP->list_headers($mbox, 1, $_SESSION['sort_col'], $_SESSION['sort_order']); $result_h = $RCMAIL->imap->list_headers($mbox, 1, $_SESSION['sort_col'], $_SESSION['sort_order']);
$count = $IMAP->messagecount($mbox, $IMAP->threading ? 'THREADS' : 'ALL'); $count = $RCMAIL->imap->messagecount($mbox, $RCMAIL->imap->threading ? 'THREADS' : 'ALL');
// Make sure we got the headers // Make sure we got the headers
if (!empty($result_h)) { if (!empty($result_h)) {
rcmail_js_message_list($result_h); rcmail_js_message_list($result_h);
if ($search_str) 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) // 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(); rcmail_display_server_error();
} }
else { else {
@ -142,7 +142,7 @@ else {
// update message count display // update message count display
$OUTPUT->set_env('search_request', $search_str ? $search_request : ''); $OUTPUT->set_env('search_request', $search_str ? $search_request : '');
$OUTPUT->set_env('messagecount', $count); $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->command('set_rowcount', rcmail_get_messagecount_text($count, 1), $mbox);
$OUTPUT->send(); $OUTPUT->send();

@ -634,9 +634,9 @@ if (!$savedraft)
// set replied/forwarded flag // set replied/forwarded flag
if ($COMPOSE['reply_uid']) 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']) 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 } // End of SMTP Delivery Block
@ -649,12 +649,12 @@ else
if ($store_target) { if ($store_target) {
// check if folder is subscribed // check if folder is subscribed
if ($IMAP->mailbox_exists($store_target, true)) if ($RCMAIL->imap->mailbox_exists($store_target, true))
$store_folder = true; $store_folder = true;
// folder may be existing but not subscribed (#1485241) // folder may be existing but not subscribed (#1485241)
else if (!$IMAP->mailbox_exists($store_target)) else if (!$RCMAIL->imap->mailbox_exists($store_target))
$store_folder = $IMAP->create_mailbox($store_target, true); $store_folder = $RCMAIL->imap->create_mailbox($store_target, true);
else if ($IMAP->subscribe($store_target)) else if ($RCMAIL->imap->subscribe($store_target))
$store_folder = true; $store_folder = true;
// append message to sent box // append message to sent box
@ -684,7 +684,7 @@ if ($store_target) {
'message' => "Could not create message: ".$msg->getMessage()), 'message' => "Could not create message: ".$msg->getMessage()),
TRUE, FALSE); TRUE, FALSE);
else { 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) { if ($mailbody_file) {
@ -708,11 +708,11 @@ if ($store_target) {
if ($olddraftmessageid) { if ($olddraftmessageid) {
// delete previous saved draft // delete previous saved draft
// @TODO: use message UID (remember to check UIDVALIDITY) to skip this SEARCH // @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); 'HEADER Message-ID '.$olddraftmessageid);
if ($del_uid = $delete_idx->getElement('FIRST')) { 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 // raise error if deletion of old draft failed
if (!$deleted) if (!$deleted)
@ -733,7 +733,7 @@ if ($savedraft) {
// remember new draft-uid ($saved could be an UID or TRUE here) // remember new draft-uid ($saved could be an UID or TRUE here)
if (is_bool($saved)) { 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'); $saved = $draft_idx->getElement('FIRST');
} }
$COMPOSE['param']['draft_uid'] = $saved; $COMPOSE['param']['draft_uid'] = $saved;

@ -30,14 +30,14 @@ if ($uid = get_input_value('_uid', RCUBE_INPUT_GET)) {
rcmail_message_error($uid); rcmail_message_error($uid);
} }
$mbox_name = $IMAP->get_mailbox_name(); $mbox_name = $RCMAIL->imap->get_mailbox_name();
// show images? // show images?
rcmail_check_safe($MESSAGE); rcmail_check_safe($MESSAGE);
// set message charset as default // set message charset as default
if (!empty($MESSAGE->headers->charset)) 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)); $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('safemode', $MESSAGE->is_safe);
$OUTPUT->set_env('sender', $MESSAGE->sender['string']); $OUTPUT->set_env('sender', $MESSAGE->sender['string']);
$OUTPUT->set_env('permaurl', rcmail_url('show', array('_uid' => $MESSAGE->uid, '_mbox' => $mbox_name))); $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); $OUTPUT->set_env('mailbox', $mbox_name);
// mimetypes supported by the browser (default settings) // 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 if ($MESSAGE->headers->mdn_to
&& empty($MESSAGE->headers->flags['MDNSENT']) && empty($MESSAGE->headers->flags['MDNSENT'])
&& empty($MESSAGE->headers->flags['SEEN']) && 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['drafts_mbox']
&& $mbox_name != $CONFIG['sent_mbox'] && $mbox_name != $CONFIG['sent_mbox']
) { ) {
@ -248,7 +248,7 @@ else
if ($MESSAGE && $MESSAGE->headers && empty($MESSAGE->headers->flags['SEEN']) && if ($MESSAGE && $MESSAGE->headers && empty($MESSAGE->headers->flags['SEEN']) &&
($RCMAIL->action == 'show' || ($RCMAIL->action == 'preview' && intval($CONFIG['preview_pane_mark_read']) == 0))) ($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)) { if ($count = rcmail_get_unseen_count($mbox_name)) {
rcmail_set_unseen_count($mbox_name, $count - 1); rcmail_set_unseen_count($mbox_name, $count - 1);
} }

@ -24,12 +24,12 @@ ob_end_clean();
// similar code as in program/steps/mail/get.inc // similar code as in program/steps/mail/get.inc
if ($uid = get_input_value('_uid', RCUBE_INPUT_GET)) 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']; $charset = $headers->charset ? $headers->charset : $CONFIG['default_charset'];
header("Content-Type: text/plain; charset={$charset}"); header("Content-Type: text/plain; charset={$charset}");
if (!empty($_GET['_save'])) { 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; $browser = $RCMAIL->output->browser;
if ($browser->ie && $browser->ver < 7) 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\""); header("Content-Disposition: attachment; filename=\"$filename\"");
} }
$IMAP->print_raw_body($uid); $RCMAIL->imap->print_raw_body($uid);
} }
else else
{ {

@ -30,13 +30,13 @@ if ($RCMAIL->action == 'subscribe')
{ {
$mbox = get_input_value('_mbox', RCUBE_INPUT_POST, true, 'UTF7-IMAP'); $mbox = get_input_value('_mbox', RCUBE_INPUT_POST, true, 'UTF7-IMAP');
if (strlen($mbox)) { if (strlen($mbox)) {
$result = $IMAP->subscribe(array($mbox)); $result = $RCMAIL->imap->subscribe(array($mbox));
// Handle virtual (non-existing) folders // Handle virtual (non-existing) folders
if (!$result && $IMAP->get_error_code() == -1 && if (!$result && $RCMAIL->imap->get_error_code() == -1 &&
$IMAP->get_response_code() == rcube_imap::TRYCREATE $RCMAIL->imap->get_response_code() == rcube_imap::TRYCREATE
) { ) {
$result = $IMAP->create_mailbox($mbox, true); $result = $RCMAIL->imap->create_mailbox($mbox, true);
if ($result) { if ($result) {
// @TODO: remove 'virtual' class of folder's row // @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'); $mbox = get_input_value('_mbox', RCUBE_INPUT_POST, true, 'UTF7-IMAP');
if (strlen($mbox)) { if (strlen($mbox)) {
$result = $IMAP->unsubscribe(array($mbox)); $result = $RCMAIL->imap->unsubscribe(array($mbox));
if ($result) if ($result)
$OUTPUT->show_message('folderunsubscribed', 'confirmation'); $OUTPUT->show_message('folderunsubscribed', 'confirmation');
else else
@ -80,7 +80,7 @@ else if ($RCMAIL->action == 'delete-folder')
$plugin = $RCMAIL->plugins->exec_hook('folder_delete', array('name' => $mbox)); $plugin = $RCMAIL->plugins->exec_hook('folder_delete', array('name' => $mbox));
if (!$plugin['abort']) { if (!$plugin['abort']) {
$deleted = $IMAP->delete_mailbox($plugin['name']); $deleted = $RCMAIL->imap->delete_mailbox($plugin['name']);
} }
else { else {
$deleted = $plugin['result']; $deleted = $plugin['result'];
@ -126,19 +126,19 @@ else if ($RCMAIL->action == 'purge')
{ {
$mbox_utf8 = get_input_value('_mbox', RCUBE_INPUT_POST, true); $mbox_utf8 = get_input_value('_mbox', RCUBE_INPUT_POST, true);
$mbox = rcube_charset_convert($mbox_utf8, RCMAIL_CHARSET, 'UTF7-IMAP'); $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, '/') . '/'; $trash_regexp = '/^' . preg_quote($CONFIG['trash_mbox'] . $delimiter, '/') . '/';
// we should only be purging trash (or their subfolders) // we should only be purging trash (or their subfolders)
if (!strlen($CONFIG['trash_mbox']) || $mbox == $CONFIG['trash_mbox'] if (!strlen($CONFIG['trash_mbox']) || $mbox == $CONFIG['trash_mbox']
|| preg_match($trash_regexp, $mbox) || preg_match($trash_regexp, $mbox)
) { ) {
$success = $IMAP->clear_mailbox($mbox); $success = $RCMAIL->imap->clear_mailbox($mbox);
$delete = true; $delete = true;
} }
// copy to Trash // copy to Trash
else { else {
$success = $IMAP->move_message('1:*', $CONFIG['trash_mbox'], $mbox); $success = $RCMAIL->imap->move_message('1:*', $CONFIG['trash_mbox'], $mbox);
$delete = false; $delete = false;
} }
@ -164,7 +164,7 @@ else if ($RCMAIL->action == 'folder-size')
{ {
$name = trim(get_input_value('_mbox', RCUBE_INPUT_POST, true)); $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? // @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 // build table with all folders listed by server
function rcube_subscription_form($attrib) function rcube_subscription_form($attrib)
{ {
global $RCMAIL, $IMAP, $CONFIG, $OUTPUT; global $RCMAIL, $CONFIG, $OUTPUT;
list($form_start, $form_end) = get_form_tags($attrib, 'folders'); list($form_start, $form_end) = get_form_tags($attrib, 'folders');
unset($attrib['form']); unset($attrib['form']);
@ -200,12 +200,12 @@ function rcube_subscription_form($attrib)
} }
// get folders from server // get folders from server
$IMAP->clear_cache('mailboxes', true); $RCMAIL->imap->clear_cache('mailboxes', true);
$a_unsubscribed = $IMAP->list_unsubscribed(); $a_unsubscribed = $RCMAIL->imap->list_unsubscribed();
$a_subscribed = $IMAP->list_mailboxes('', '*', null, null, true); // unsorted $a_subscribed = $RCMAIL->imap->list_mailboxes('', '*', null, null, true); // unsorted
$delimiter = $IMAP->get_hierarchy_delimiter(); $delimiter = $RCMAIL->imap->get_hierarchy_delimiter();
$namespace = $IMAP->get_namespace(); $namespace = $RCMAIL->imap->get_namespace();
$a_js_folders = array(); $a_js_folders = array();
$seen = array(); $seen = array();
$list_folders = array(); $list_folders = array();
@ -213,7 +213,7 @@ function rcube_subscription_form($attrib)
// pre-process folders list // pre-process folders list
foreach ($a_unsubscribed as $i => $folder) { foreach ($a_unsubscribed as $i => $folder) {
$folder_id = $folder; $folder_id = $folder;
$folder = $IMAP->mod_mailbox($folder); $folder = $RCMAIL->imap->mod_mailbox($folder);
$foldersplit = explode($delimiter, $folder); $foldersplit = explode($delimiter, $folder);
$name = rcube_charset_convert(array_pop($foldersplit), 'UTF7-IMAP'); $name = rcube_charset_convert(array_pop($foldersplit), 'UTF7-IMAP');
$parent_folder = join($delimiter, $foldersplit); $parent_folder = join($delimiter, $foldersplit);
@ -283,7 +283,7 @@ function rcube_subscription_form($attrib)
} }
if (!$protected) { if (!$protected) {
$attrs = $IMAP->mailbox_attributes($folder['id']); $attrs = $RCMAIL->imap->mailbox_attributes($folder['id']);
$noselect = in_array('\\Noselect', $attrs); $noselect = in_array('\\Noselect', $attrs);
} }
@ -403,7 +403,7 @@ function rcmail_rename_folder($oldname, $newname)
$OUTPUT->set_pagetitle(rcube_label('folders')); $OUTPUT->set_pagetitle(rcube_label('folders'));
$OUTPUT->include_script('list.js'); $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 // add some labels to client
$OUTPUT->add_label('deletefolderconfirm', 'purgefolderconfirm', 'folderdeleting', $OUTPUT->add_label('deletefolderconfirm', 'purgefolderconfirm', 'folderdeleting',

@ -875,13 +875,13 @@ function rcmail_folder_options($mailbox)
*/ */
function rcmail_update_folder_row($name, $oldname=null, $subscribe=false, $class_name=null) 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'); $name_utf8 = rcube_charset_convert($name, 'UTF7-IMAP');
$protected = ($CONFIG['protect_default_folders'] == true && in_array($name, $CONFIG['default_imap_folders'])); $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; $level = count($foldersplit) - 1;
$display_name = str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;', $level) $display_name = str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;', $level)
. Q($protected ? rcmail_localize_foldername($name) : rcube_charset_convert($foldersplit[$level], 'UTF7-IMAP')); . Q($protected ? rcmail_localize_foldername($name) : rcube_charset_convert($foldersplit[$level], 'UTF7-IMAP'));

@ -33,7 +33,7 @@ $name_imap = rcube_charset_convert($name, RCMAIL_CHARSET, 'UTF7-IMAP');
$old_imap = rcube_charset_convert($old, RCMAIL_CHARSET, 'UTF7-IMAP'); $old_imap = rcube_charset_convert($old, RCMAIL_CHARSET, 'UTF7-IMAP');
// $path is in UTF7-IMAP already // $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(); $options = strlen($old_imap) ? rcmail_folder_options($old_imap) : array();
// Folder name checks // Folder name checks
@ -103,7 +103,7 @@ if (!$error && !strlen($old)) {
$folder = $plugin['record']; $folder = $plugin['record'];
if (!$plugin['abort']) { if (!$plugin['abort']) {
$created = $IMAP->create_mailbox($folder['name'], $folder['subscribe']); $created = $RCMAIL->imap->create_mailbox($folder['name'], $folder['subscribe']);
} }
else { else {
$created = $plugin['result']; $created = $plugin['result'];

Loading…
Cancel
Save