- Remove deprecated global $IMAP variable usage (#1488148)
| | |
| | | $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( |
| | |
| | | * 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) |
| | | { |
| | |
| | | |
| | | 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( |
| | |
| | | |
| | | */ |
| | | |
| | | $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; |
| | |
| | | $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 |
| | |
| | | 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'])) |
| | |
| | | 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 |
| | |
| | | $_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]; |
| | | |
| | |
| | | $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', ','))); |
| | |
| | | |
| | | // 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) |
| | | { |
| | |
| | | // 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']); |
| | |
| | | } |
| | | |
| | | 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']); |
| | |
| | | |
| | | // 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) { |
| | |
| | | |
| | | 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; |
| | |
| | | $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 |
| | |
| | | // send EXPUNGE command |
| | | if ($RCMAIL->action == 'expunge') { |
| | | |
| | | $success = $IMAP->expunge($mbox); |
| | | $success = $RCMAIL->imap->expunge($mbox); |
| | | |
| | | // reload message list if current mailbox |
| | | if ($success) { |
| | |
| | | // 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, '/') . '/'; |
| | | |
| | |
| | | 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'); |
| | |
| | | |
| | | // 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'])) |
| | |
| | | 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); |
| | | } |
| | |
| | | |
| | | // 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']) |
| | |
| | | '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))); |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | function rcmail_message_list($attrib) |
| | | { |
| | | global $IMAP, $CONFIG, $OUTPUT; |
| | | global $RCMAIL, $CONFIG, $OUTPUT; |
| | | |
| | | // add some labels to client |
| | | $OUTPUT->add_label('from', 'to'); |
| | |
| | | // 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) |
| | |
| | | */ |
| | | 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'])) |
| | |
| | | $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)) |
| | |
| | | $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); |
| | | } |
| | |
| | | $insert_top); |
| | | } |
| | | |
| | | if ($IMAP->threading) { |
| | | if ($RCMAIL->imap->threading) { |
| | | $OUTPUT->command('init_threads', (array) $roots, $mbox); |
| | | } |
| | | } |
| | |
| | | |
| | | 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_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 |
| | |
| | | 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)), |
| | |
| | | */ |
| | | 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 ''; |
| | |
| | | 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; |
| | | } |
| | | |
| | |
| | | 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( |
| | |
| | | */ |
| | | 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; |
| | |
| | | */ |
| | | 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"); |
| | |
| | | |
| | | if ($sent) |
| | | { |
| | | $IMAP->set_flag($message->uid, 'MDNSENT'); |
| | | $RCMAIL->imap->set_flag($message->uid, 'MDNSENT'); |
| | | return true; |
| | | } |
| | | } |
| | |
| | | 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 |
| | |
| | | $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 { |
| | |
| | | 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); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | */ |
| | | |
| | | $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'); |
| | | |
| | |
| | | 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'); |
| | |
| | | |
| | | 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)); |
| | |
| | | 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'])) { |
| | |
| | | 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()); |
| | | |
| | |
| | | } |
| | | 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) |
| | |
| | | |
| | | 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 |
| | |
| | | |
| | | 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') { |
| | |
| | | $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) { |
| | |
| | | } |
| | | $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) |
| | |
| | | $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); |
| | |
| | | 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'])) { |
| | |
| | | $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 |
| | |
| | | $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 |
| | |
| | | } |
| | | |
| | | // 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') |
| | |
| | | } |
| | | 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) { |
| | |
| | | $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) |
| | |
| | | $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); |
| | |
| | | */ |
| | | |
| | | $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) { |
| | |
| | | $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 |
| | |
| | | |
| | | // 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 { |
| | |
| | | // 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(); |
| | | |
| | |
| | | |
| | | // 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 |
| | | |
| | |
| | | |
| | | 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 |
| | |
| | | '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) { |
| | |
| | | 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) |
| | |
| | | |
| | | // 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; |
| | |
| | | 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)); |
| | | |
| | |
| | | $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) |
| | |
| | | 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'] |
| | | ) { |
| | |
| | | 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); |
| | | } |
| | |
| | | // 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) |
| | |
| | | header("Content-Disposition: attachment; filename=\"$filename\""); |
| | | } |
| | | |
| | | $IMAP->print_raw_body($uid); |
| | | $RCMAIL->imap->print_raw_body($uid); |
| | | } |
| | | else |
| | | { |
| | |
| | | { |
| | | $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 |
| | | } |
| | |
| | | { |
| | | $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 |
| | |
| | | $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']; |
| | |
| | | { |
| | | $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; |
| | | } |
| | | |
| | |
| | | { |
| | | $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? |
| | | |
| | |
| | | // 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']); |
| | |
| | | } |
| | | |
| | | // 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(); |
| | |
| | | // 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); |
| | |
| | | } |
| | | |
| | | if (!$protected) { |
| | | $attrs = $IMAP->mailbox_attributes($folder['id']); |
| | | $attrs = $RCMAIL->imap->mailbox_attributes($folder['id']); |
| | | $noselect = in_array('\\Noselect', $attrs); |
| | | } |
| | | |
| | |
| | | |
| | | $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', |
| | |
| | | */ |
| | | 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')); |
| | |
| | | $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 |
| | |
| | | $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']; |