| | |
| | | |
| | | */ |
| | | |
| | | require_once('lib/html2text.inc'); |
| | | require_once('lib/enriched.inc'); |
| | | require_once('include/rcube_smtp.inc'); |
| | | |
| | |
| | | $OUTPUT->set_env('junk_mailbox', $CONFIG['junk_mbox']); |
| | | |
| | | if (!$OUTPUT->ajax_call) |
| | | rcube_add_label('checkingmail', 'deletemessage', 'movemessagetotrash'); |
| | | rcube_add_label('checkingmail', 'deletemessage', 'movemessagetotrash', 'movingmessage'); |
| | | |
| | | // set page title |
| | | if (empty($_action) || $_action == 'list') |
| | | $OUTPUT->set_pagetitle(rcube_charset_convert($IMAP->get_mailbox_name(), 'UTF-7')); |
| | | if (empty($RCMAIL->action) || $RCMAIL->action == 'list') |
| | | $OUTPUT->set_pagetitle(rcmail_localize_foldername($IMAP->get_mailbox_name())); |
| | | |
| | | |
| | | |
| | |
| | | $zebra_class); |
| | | |
| | | $out .= sprintf("<td class=\"icon\">%s</td>\n", $message_icon ? sprintf($image_tag, $skin_path, $message_icon, '') : ''); |
| | | |
| | | |
| | | // format each col |
| | | foreach ($a_show_cols as $col) |
| | | { |
| | | if ($col=='from' || $col=='to') |
| | | $cont = Q(rcmail_address_string($header->$col, 3, $attrib['addicon']), 'show'); |
| | | $cont = Q(rcmail_address_string(rcube_imap::decode_mime_string($header->$col, $header->charset), 3, $attrib['addicon']), 'show'); |
| | | else if ($col=='subject') |
| | | { |
| | | $action = $mbox==$CONFIG['drafts_mbox'] ? 'compose' : 'show'; |
| | |
| | | foreach ($a_show_cols as $col) |
| | | { |
| | | if ($col=='from' || $col=='to') |
| | | $cont = Q(rcmail_address_string($header->$col, 3), 'show'); |
| | | $cont = Q(rcmail_address_string(rcube_imap::decode_mime_string($header->$col, $header->charset), 3), 'show'); |
| | | else if ($col=='subject') |
| | | { |
| | | $action = $mbox==$CONFIG['drafts_mbox'] ? 'compose' : 'show'; |
| | |
| | | if (!$attrib['id']) |
| | | $attrib['id'] = 'rcmquotadisplay'; |
| | | |
| | | if(isset($attrib['display'])) |
| | | $_SESSION['quota_display'] = $attrib['display']; |
| | | |
| | | $OUTPUT->add_gui_object('quotadisplay', $attrib['id']); |
| | | |
| | | // allow the following attributes to be added to the <span> tag |
| | | $attrib_str = create_attrib_string($attrib, array('style', 'class', 'id')); |
| | | $attrib_str = create_attrib_string($attrib, array('style', 'class', 'id', 'display')); |
| | | |
| | | $out = '<span' . $attrib_str . '>'; |
| | | $out .= rcmail_quota_content($attrib['display']); |
| | | $out .= rcmail_quota_content(); |
| | | $out .= '</span>'; |
| | | return $out; |
| | | } |
| | | |
| | | |
| | | function rcmail_quota_content($display) |
| | | function rcmail_quota_content($quota=NULL) |
| | | { |
| | | global $IMAP, $COMM_PATH; |
| | | |
| | | if (!$IMAP->get_capability('QUOTA')) |
| | | $quota_text = rcube_label('unknown'); |
| | | else if ($quota = $IMAP->get_quota()) |
| | | $display = isset($_SESSION['quota_display']) ? $_SESSION['quota_display'] : ''; |
| | | |
| | | if (is_array($quota) && !empty($quota['used']) && !empty($quota['total'])) |
| | | { |
| | | $quota_text = sprintf("%s / %s (%.0f%%)", |
| | | show_bytes($quota["used"] * 1024), |
| | | show_bytes($quota["total"] * 1024), |
| | | $quota["percent"]); |
| | | if (!isset($quota['percent'])) |
| | | $quota['percent'] = $quota['used'] / $quota['total']; |
| | | } |
| | | elseif (!$IMAP->get_capability('QUOTA')) |
| | | return rcube_label('unknown'); |
| | | else |
| | | $quota = $IMAP->get_quota(); |
| | | |
| | | if ($quota) |
| | | { |
| | | $quota_text = sprintf('%s / %s (%.0f%%)', |
| | | show_bytes($quota['used'] * 1024), |
| | | show_bytes($quota['total'] * 1024), |
| | | $quota['percent']); |
| | | |
| | | // show quota as image (by Brett Patterson) |
| | | if ($display == 'image' && function_exists('imagegif')) |
| | |
| | | $convert_patterns[] = '/([a-z0-9][a-z0-9\-\.\+\_]*@[a-z0-9]([a-z0-9\-][.]?)*[a-z0-9]\\.[a-z]{2,5})/ie'; |
| | | $convert_replaces[] = "rcmail_str_replacement('<a href=\"mailto:\\1\" onclick=\"return ".JS_OBJECT_NAME.".command(\'compose\',\'\\1\',this)\">\\1</a>', \$replace_strings)"; |
| | | |
| | | if ($part->ctype_parameters['format'] != 'flowed') |
| | | $body = wordwrap(trim($body), 80); |
| | | // if ($part->ctype_parameters['format'] != 'flowed') |
| | | // $body = wordwrap(trim($body), 80); |
| | | |
| | | $body = preg_replace($convert_patterns, $convert_replaces, $body); |
| | | |
| | |
| | | $quotation = ''; |
| | | $q = 0; |
| | | |
| | | if (preg_match('/^(>+\s*)/', $line, $regs)) |
| | | if (preg_match('/^(>+\s*)+/', $line, $regs)) |
| | | { |
| | | $q = strlen(preg_replace('/\s/', '', $regs[1])); |
| | | $line = substr($line, strlen($regs[1])); |
| | | $q = strlen(preg_replace('/\s/', '', $regs[0])); |
| | | $line = substr($line, strlen($regs[0])); |
| | | |
| | | if ($q > $quote_level) |
| | | $quotation = str_repeat('<blockquote>', $q - $quote_level); |
| | |
| | | continue; |
| | | |
| | | if ($hkey=='date' && !empty($headers[$hkey])) |
| | | $header_value = format_date(strtotime($headers[$hkey])); |
| | | $header_value = format_date($headers[$hkey]); |
| | | else if (in_array($hkey, array('from', 'to', 'cc', 'bcc', 'reply-to'))) |
| | | $header_value = Q(rcmail_address_string($headers[$hkey], NULL, $attrib['addicon']), 'show'); |
| | | else |
| | |
| | | |
| | | // add comments arround html and other tags |
| | | $out = preg_replace(array( |
| | | '/(<!DOCTYPE.+)/i', |
| | | '/(<!DOCTYPE[^>]*>)/i', |
| | | '/(<\?xml[^>]*>)/i', |
| | | '/(<\/?html[^>]*>)/i', |
| | | '/(<\/?head[^>]*>)/i', |
| | | '/(<title[^>]*>.*<\/title>)/Ui', |
| | |
| | | function rcmail_address_string($input, $max=NULL, $addicon=NULL) |
| | | { |
| | | global $IMAP, $PRINT_MODE, $CONFIG, $OUTPUT, $EMAIL_ADDRESS_PATTERN; |
| | | |
| | | |
| | | $a_parts = $IMAP->decode_address_list($input); |
| | | |
| | | if (!sizeof($a_parts)) |
| | |
| | | { |
| | | $j++; |
| | | if ($PRINT_MODE) |
| | | $out .= sprintf('%s <%s>', Q($part['name']), $part['mailto']); |
| | | $out .= sprintf('%s <%s>', Q(rcube_charset_convert($part['name'])), $part['mailto']); |
| | | else if (preg_match($EMAIL_ADDRESS_PATTERN, $part['mailto'])) |
| | | { |
| | | $out .= sprintf('<a href="mailto:%s" onclick="return %s.command(\'compose\',\'%s\',this)" class="rcmContactAddress" title="%s">%s</a>', |
| | |
| | | // clean Bcc from header for recipients |
| | | $send_headers = $headers; |
| | | unset($send_headers['Bcc']); |
| | | // here too, it because txtHeaders() below use $message->_headers not only $send_headers |
| | | unset($message->_headers['Bcc']); |
| | | |
| | | // send message |
| | | $smtp_response = array(); |
| | | $sent = smtp_mail($from, $a_recipients, ($foo = $message->txtHeaders($send_headers)), $msg_body, $smtp_response); |
| | | $sent = smtp_mail($from, $a_recipients, ($foo = $message->txtHeaders($send_headers, true)), $msg_body, $smtp_response); |
| | | |
| | | // log error |
| | | if (!$sent) |
| | |
| | | $sent = mail($headers_enc['To'], $headers_enc['Subject'], $msg_body, $header_str, "-f$from"); |
| | | } |
| | | |
| | | if ($sent) // remove MDN headers after sending |
| | | unset($headers['Return-Receipt-To'], $headers['Disposition-Notification-To']); |
| | | |
| | | $message->_headers = array(); |
| | | $message->headers($headers); |
| | |
| | | $recipient = array_shift($IMAP->decode_address_list($message['headers']->mdn_to)); |
| | | $mailto = $recipient['mailto']; |
| | | |
| | | $compose = new rc_mail_mime(rcmail_header_delm()); |
| | | $compose = new rcube_mail_mime(rcmail_header_delm()); |
| | | $compose->setParam(array( |
| | | 'text_encoding' => 'quoted-printable', |
| | | 'html_encoding' => 'quoted-printable', |
| | |
| | | $body = rcube_label("yourmessage") . "\r\n\r\n" . |
| | | "\t" . rcube_label("to") . ': ' . rcube_imap::decode_mime_string($message['headers']->to, $message['headers']->charset) . "\r\n" . |
| | | "\t" . rcube_label("subject") . ': ' . $message['subject'] . "\r\n" . |
| | | "\t" . rcube_label("sent") . ': ' . format_date(strtotime($message['headers']->date), $CONFIG['date_long']) . "\r\n" . |
| | | "\t" . rcube_label("sent") . ': ' . format_date($message['headers']->date, $CONFIG['date_long']) . "\r\n" . |
| | | "\r\n" . rcube_label("receiptnote") . "\r\n"; |
| | | |
| | | $ua = !empty($CONFIG['useragent']) ? $CONFIG['useragent'] : "RoundCube Webmail (Version ".RCMAIL_VERSION.")"; |
| | |
| | | 'messagecontentframe' => 'rcmail_messagecontent_frame', |
| | | 'messagepartframe' => 'rcmail_message_part_frame', |
| | | 'messagepartcontrols' => 'rcmail_message_part_controls', |
| | | 'searchform' => 'rcmail_search_form' |
| | | 'searchform' => array($OUTPUT, 'search_form'), |
| | | )); |
| | | |
| | | ?> |