| | |
| | | | program/steps/mail/func.inc | |
| | | | | |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2005-2010, Roundcube Dev. - Switzerland | |
| | | | Copyright (C) 2005-2010, The Roundcube Dev Team | |
| | | | Licensed under the GNU GPL | |
| | | | | |
| | | | PURPOSE: | |
| | |
| | | // 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('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=references') |
| | | || $IMAP->get_capability('thread=orderedsubject') |
| | | || $IMAP->get_capability('thread=refs') |
| | | ); |
| | | $OUTPUT->set_env('threads', $IMAP->threading || $IMAP->get_capability('THREAD')); |
| | | |
| | | if ($CONFIG['flag_for_deletion']) |
| | | $OUTPUT->set_env('flag_for_deletion', true); |
| | |
| | | if (in_array($col, array('from', 'to', 'cc', 'replyto'))) |
| | | $cont = Q(rcmail_address_string($header->$col, 3), 'show'); |
| | | else if ($col=='subject') { |
| | | $cont = abbreviate_string(trim($IMAP->decode_header($header->$col)), 160); |
| | | $cont = trim($IMAP->decode_header($header->$col)); |
| | | if (!$cont) $cont = rcube_label('nosubject'); |
| | | $cont = Q($cont); |
| | | } |
| | |
| | | |
| | | // trigger plugin hook |
| | | $data = $RCMAIL->plugins->exec_hook('message_part_before', |
| | | array('type' => $part->ctype_secondary, 'body' => $part->body) + $p + array('safe' => false, 'plain' => false, 'inline_html' => true)); |
| | | array('type' => $part->ctype_secondary, 'body' => $part->body, 'id' => $part->mime_id) |
| | | + $p + array('safe' => false, 'plain' => false, 'inline_html' => true)); |
| | | |
| | | // convert html to text/plain |
| | | if ($data['type'] == 'html' && $data['plain']) { |
| | |
| | | $body = rcmail_plain_body($body, $part->ctype_parameters['format'] == 'flowed'); |
| | | |
| | | // allow post-processing of the message body |
| | | $data = $RCMAIL->plugins->exec_hook('message_part_after', array('type' => $part->ctype_secondary, 'body' => $body) + $data); |
| | | $data = $RCMAIL->plugins->exec_hook('message_part_after', |
| | | array('type' => $part->ctype_secondary, 'body' => $body, 'id' => $part->mime_id) + $data); |
| | | |
| | | return $data['type'] == 'html' ? $data['body'] : html::tag('pre', array(), $data['body']); |
| | | } |
| | |
| | | $attributes = array(); |
| | | |
| | | // Handle body attributes that doesn't play nicely with div elements |
| | | if (preg_match('/<div class="' . preg_quote($body_id, '/') . '" ([^>]+)/', $body, $m)) { |
| | | $regexp = '/<div class="' . preg_quote($body_id, '/') . '"([^>]*)/'; |
| | | if (preg_match($regexp, $body, $m)) { |
| | | $attrs = $m[0]; |
| | | // Get bgcolor, we'll set it as background-color of the message container |
| | | if (preg_match('/bgcolor=["\']*([a-z0-9#]+)["\']*/', $attrs, $mb)) { |
| | | if ($m[1] && preg_match('/bgcolor=["\']*([a-z0-9#]+)["\']*/', $attrs, $mb)) { |
| | | $attributes['background-color'] = $mb[1]; |
| | | $attrs = preg_replace('/bgcolor=["\']*([a-z0-9#]+)["\']*/', '', $attrs); |
| | | } |
| | | // Get background, we'll set it as background-image of the message container |
| | | if (preg_match('/background=["\']*([^"\'>\s]+)["\']*/', $attrs, $mb)) { |
| | | if ($m[1] && preg_match('/background=["\']*([^"\'>\s]+)["\']*/', $attrs, $mb)) { |
| | | $attributes['background-image'] = 'url('.$mb[1].')'; |
| | | $attrs = preg_replace('/background=["\']*([^"\'>\s]+)["\']*/', '', $attrs); |
| | | } |
| | | if (!empty($attributes)) |
| | | $body = preg_replace('/<div class="' . preg_quote($body_id, '/') . '" [^>]+/', rtrim($attrs), $body, 1); |
| | | if (!empty($attributes)) { |
| | | $body = preg_replace($regexp, rtrim($attrs), $body, 1); |
| | | } |
| | | |
| | | // handle body styles related to background image |
| | | if ($attributes['background-image']) { |
| | |
| | | } |
| | | // make sure there's 'rcmBody' div, we need it for proper css modification |
| | | // its name is hardcoded in rcmail_message_body() also |
| | | else |
| | | else { |
| | | $body = '<div class="' . $body_id . '">' . $body . '</div>'; |
| | | } |
| | | |
| | | return $body; |
| | | } |
| | |
| | | 'searchform' => array($OUTPUT, 'search_form'), |
| | | )); |
| | | |
| | | |
| | | // register action aliases |
| | | $RCMAIL->register_action_map(array( |
| | | 'preview' => 'show.inc', |
| | | 'print' => 'show.inc', |
| | | 'moveto' => 'move_del.inc', |
| | | 'delete' => 'move_del.inc', |
| | | 'send' => 'sendmail.inc', |
| | | 'expunge' => 'folders.inc', |
| | | 'purge' => 'folders.inc', |
| | | 'remove-attachment' => 'attachments.inc', |
| | | 'display-attachment' => 'attachments.inc', |
| | | 'upload' => 'attachments.inc', |
| | | 'group-expand' => 'autocomplete.inc', |
| | | )); |