| | |
| | | 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($header->$col, 3, false, $attrib['addicon']), 'show'); |
| | | else if ($col=='subject') |
| | | { |
| | | $action = $mbox==$CONFIG['drafts_mbox'] ? 'compose' : 'show'; |
| | |
| | | */ |
| | | function rcmail_quota_content($quota=NULL) |
| | | { |
| | | global $IMAP, $COMM_PATH; |
| | | global $IMAP, $COMM_PATH, $RCMAIL; |
| | | |
| | | $display = isset($_SESSION['quota_display']) ? $_SESSION['quota_display'] : ''; |
| | | |
| | |
| | | else |
| | | $quota = $IMAP->get_quota(); |
| | | |
| | | if ($quota) |
| | | if ($quota && !($quota['total']==0 && $RCMAIL->config->get('quota_zero_as_unlimited'))) |
| | | { |
| | | $quota_text = sprintf('%s / %s (%.0f%%)', |
| | | show_bytes($quota['used'] * 1024), |
| | |
| | | return Q($out); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | function rcmail_mailbox_name_display($attrib) |
| | | { |
| | | global $RCMAIL; |
| | | |
| | | if (!$attrib['id']) |
| | | $attrib['id'] = 'rcmmailboxname'; |
| | | |
| | | $RCMAIL->output->add_gui_object('mailboxname', $attrib['id']); |
| | | |
| | | return html::span($attrib, rcmail_get_mailbox_name_text()); |
| | | } |
| | | |
| | | function rcmail_get_mailbox_name_text() |
| | | { |
| | | global $RCMAIL; |
| | | return rcmail_localize_foldername($RCMAIL->imap->get_mailbox_name()); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Convert the given message part to proper HTML |
| | |
| | | else if ($part->ctype_secondary == 'html') { |
| | | // charset was converted to UTF-8 in rcube_imap::get_message_part() -> change charset specification in HTML accordingly |
| | | $html = $part->body; |
| | | if (preg_match('/(\s+content=[\'"]\w+\/\w+;\s*charset)=([a-z0-9-]+)/i', $html)) |
| | | $html = preg_replace('/(\s+content=[\'"]\w+\/\w+;\s*charset)=([a-z0-9-]+)/i', '\\1='.RCMAIL_CHARSET, $html); |
| | | if (preg_match('/(\s+content=[\'"]\w+\/\w+;\s*charset)=([a-z0-9-_]+)/i', $html)) |
| | | $html = preg_replace('/(\s+content=[\'"]\w+\/\w+;\s*charset)=([a-z0-9-_]+)/i', '\\1='.RCMAIL_CHARSET, $html); |
| | | else { |
| | | // add <head> for malformed messages, washtml cannot work without that |
| | | if (!preg_match('/<head>(.*)<\\/head>/Uims', $html)) |
| | | $html = '<head></head>' . $html; |
| | | $html = substr_replace($html, '<meta http-equiv="Content-Type" content="text/html; charset='.RCMAIL_CHARSET.'" />', intval(stripos($html, '</head>')), 0); |
| | | } |
| | | |
| | | |
| | | // PHP bug #32547 workaround: remove title tag |
| | | $html = preg_replace('/<title>.*<\/title>/', '', $html); |
| | | |
| | | // clean HTML with washhtml by Frederic Motte |
| | | $wash_opts = array( |
| | | 'show_washed' => false, |
| | |
| | | $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'); |
| | | $header_value = Q(rcmail_address_string($headers[$hkey], null, true, $attrib['addicon']), 'show'); |
| | | else |
| | | $header_value = Q($IMAP->decode_header($headers[$hkey])); |
| | | |
| | |
| | | /** |
| | | * decode address string and re-format it as HTML links |
| | | */ |
| | | function rcmail_address_string($input, $max=NULL, $addicon=NULL) |
| | | { |
| | | function rcmail_address_string($input, $max=null, $linked=false, $addicon=null) |
| | | { |
| | | global $IMAP, $PRINT_MODE, $CONFIG, $OUTPUT, $EMAIL_ADDRESS_PATTERN; |
| | | |
| | | $a_parts = $IMAP->decode_address_list($input); |
| | |
| | | $j = 0; |
| | | $out = ''; |
| | | |
| | | foreach ($a_parts as $part) |
| | | { |
| | | foreach ($a_parts as $part) { |
| | | $j++; |
| | | if ($PRINT_MODE) |
| | | if ($PRINT_MODE) { |
| | | $out .= sprintf('%s <%s>', Q($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>', |
| | | Q($part['mailto']), |
| | | JS_OBJECT_NAME, |
| | | JQ($part['mailto']), |
| | | Q($part['mailto']), |
| | | Q($part['name'])); |
| | | |
| | | if ($addicon) |
| | | $out .= sprintf(' <a href="#add" onclick="return %s.command(\'add-contact\',\'%s\',this)" title="%s"><img src="%s%s" alt="add" border="0" /></a>', |
| | | JS_OBJECT_NAME, |
| | | urlencode($part['string']), |
| | | rcube_label('addtoaddressbook'), |
| | | $CONFIG['skin_path'], |
| | | $addicon); |
| | | } |
| | | else if (preg_match($EMAIL_ADDRESS_PATTERN, $part['mailto'])) { |
| | | if ($linked) { |
| | | $out .= html::a(array( |
| | | 'href' => 'mailto:'.$part['mailto'], |
| | | 'onclick' => sprintf("return %s.command('compose','%s',this)", JS_OBJECT_NAME, JQ($part['mailto'])), |
| | | 'title' => $part['mailto'], |
| | | 'class' => "rcmContactAddress", |
| | | ), |
| | | Q($part['name'])); |
| | | } |
| | | else |
| | | { |
| | | else { |
| | | $out .= html::span(array('title' => $part['mailto'], 'class' => "rcmContactAddress"), Q($part['name'])); |
| | | } |
| | | |
| | | if ($addicon) { |
| | | $out .= ' ' . html::a(array( |
| | | 'href' => "#add", |
| | | 'onclick' => sprintf("return %s.command('add-contact','%s',this)", JS_OBJECT_NAME, urlencode($part['string'])), |
| | | 'title' => rcube_label('addtoaddressbook'), |
| | | ), |
| | | html::img(array( |
| | | 'src' => $CONFIG['skin_path'] . $addicon, |
| | | 'alt' => "Add contact", |
| | | 'border' => 0, |
| | | ))); |
| | | } |
| | | } |
| | | else { |
| | | if ($part['name']) |
| | | $out .= Q($part['name']); |
| | | if ($part['mailto']) |
| | | $out .= (strlen($out) ? ' ' : '') . sprintf('<%s>', Q($part['mailto'])); |
| | | } |
| | | } |
| | | |
| | | if ($c>$j) |
| | | $out .= ','.($max ? ' ' : ' '); |
| | | |
| | | if ($max && $j==$max && $c>$j) |
| | | { |
| | | if ($max && $j==$max && $c>$j) { |
| | | $out .= '...'; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | return $out; |
| | | } |
| | | } |
| | | |
| | | |
| | | function rcmail_message_part_controls() |
| | |
| | | |
| | | $msg_body = $message->get(); |
| | | $headers = $message->headers(); |
| | | |
| | | |
| | | // send thru SMTP server using custom SMTP library |
| | | if ($CONFIG['smtp_server']) |
| | | { |
| | |
| | | $sent = mail($headers_enc['To'], $headers_enc['Subject'], $msg_body, $header_str, "-f$from"); |
| | | } |
| | | |
| | | if ($sent) // remove MDN headers after sending |
| | | if ($sent) |
| | | { |
| | | // remove MDN headers after sending |
| | | unset($headers['Return-Receipt-To'], $headers['Disposition-Notification-To']); |
| | | |
| | | if ($CONFIG['smtp_log']) |
| | | write_log('sendmail', sprintf("[%s] User: %d on %s; Message for %s; %s", |
| | | date("d-M-Y H:i:s O", mktime()), |
| | | $_SESSION['user_id'], |
| | | $_SERVER['REMOTE_ADDR'], |
| | | $mailto, |
| | | !empty($smtp_response) ? join('; ', $smtp_response) : '')); |
| | | } |
| | | |
| | | $message->_headers = array(); |
| | | $message->headers($headers); |
| | |
| | | 'messages' => 'rcmail_message_list', |
| | | 'messagecountdisplay' => 'rcmail_messagecount_display', |
| | | 'quotadisplay' => 'rcmail_quota_display', |
| | | 'mailboxname' => 'rcmail_mailbox_name_display', |
| | | 'messageheaders' => 'rcmail_message_headers', |
| | | 'messagebody' => 'rcmail_message_body', |
| | | 'messagecontentframe' => 'rcmail_messagecontent_frame', |