diff options
author | alecpl <alec@alec.pl> | 2012-04-13 08:52:02 +0000 |
---|---|---|
committer | alecpl <alec@alec.pl> | 2012-04-13 08:52:02 +0000 |
commit | 0c259682f65eaaf23ea4ccb56a706d6baf3007e4 (patch) | |
tree | f1491f39189c8a970e7612b9dcc20f9409d7361e /program/steps | |
parent | ce64332e7a9bf2468eabdb4b789270aebb3e7dc7 (diff) |
- Merge devel-framework branch, resolved conflicts
Diffstat (limited to 'program/steps')
-rw-r--r-- | program/steps/addressbook/func.inc | 2 | ||||
-rw-r--r-- | program/steps/mail/compose.inc | 16 | ||||
-rw-r--r-- | program/steps/mail/func.inc | 25 | ||||
-rw-r--r-- | program/steps/mail/get.inc | 25 | ||||
-rw-r--r-- | program/steps/mail/show.inc | 26 | ||||
-rw-r--r-- | program/steps/utils/error.inc | 15 |
6 files changed, 79 insertions, 30 deletions
diff --git a/program/steps/addressbook/func.inc b/program/steps/addressbook/func.inc index a31370b16..e52da3936 100644 --- a/program/steps/addressbook/func.inc +++ b/program/steps/addressbook/func.inc @@ -203,7 +203,7 @@ function rcmail_directory_list($attrib) 'rel' => '%s', 'onclick' => "return ".JS_OBJECT_NAME.".command('list','%s',this)"), '%s')); - $sources = (array) $OUTPUT->env['address_sources']; + $sources = (array) $OUTPUT->get_env('address_sources'); reset($sources); // currently selected source diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc index ebf79be4e..c0a5bf7bc 100644 --- a/program/steps/mail/compose.inc +++ b/program/steps/mail/compose.inc @@ -1162,10 +1162,22 @@ function rcmail_save_attachment(&$message, $pid) $data = $message->get_part_content($pid); } + $mimetype = $part->ctype_primary . '/' . $part->ctype_secondary; + $filename = $part->filename; + if (!strlen($filename)) { + if ($mimetype == 'text/html') { + $filename = rcube_label('htmlmessage'); + } + else { + $filename = 'Part_'.$pid; + } + $filename .= '.' . $part->ctype_secondary; + } + $attachment = array( 'group' => $COMPOSE['id'], - 'name' => $part->filename ? $part->filename : 'Part_'.$pid.'.'.$part->ctype_secondary, - 'mimetype' => $part->ctype_primary . '/' . $part->ctype_secondary, + 'name' => $filename, + 'mimetype' => $mimetype, 'content_id' => $part->content_id, 'data' => $data, 'path' => $path, diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index 8dcd37b20..319166c2d 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -230,7 +230,7 @@ function rcmail_js_message_list($a_headers, $insert_top=FALSE, $a_show_cols=null // Make sure there are no duplicated columns (#1486999) $a_show_cols = array_unique($a_show_cols); - // Plugins may set header's list_cols/list_flags and other rcube_mail_header variables + // Plugins may set header's list_cols/list_flags and other rcube_message_header variables // and list columns $plugin = $RCMAIL->plugins->exec_hook('messages_list', array('messages' => $a_headers, 'cols' => $a_show_cols)); @@ -1024,10 +1024,20 @@ function rcmail_message_body($attrib) foreach ($MESSAGE->parts as $i => $part) { if ($part->type == 'headers') $out .= rcmail_message_headers(sizeof($header_attrib) ? $header_attrib : NULL, $part->headers); - else if ($part->type == 'content' && $part->size) { + else if ($part->type == 'content') { + // unsapported + if ($part->realtype) { + if ($part->realtype == 'multipart/encrypted') { + $out .= html::span('part-notice', rcube_label('encryptedmessage')); + } + continue; + } + else if (!$part->size) { + continue; + } // Check if we have enough memory to handle the message in it // #1487424: we need up to 10x more memory than the body - if (!rcmail_mem_check($part->size * 10)) { + else 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($RCMAIL->storage->get_folder()), rcube_label('download'))); @@ -1438,9 +1448,14 @@ function rcmail_message_part_controls($attrib) $part = $MESSAGE->mime_parts[$part]; $table = new html_table(array('cols' => 3)); - if (!empty($part->filename)) { + $filename = $part->filename; + if (empty($filename) && $attach_prop->mimetype == 'text/html') { + $filename = rcube_label('htmlmessage'); + } + + if (!empty($filename)) { $table->add('title', Q(rcube_label('filename'))); - $table->add('header', Q($part->filename)); + $table->add('header', Q($filename)); $table->add('download-link', html::a(array('href' => './?'.str_replace('_frame=', '_download=', $_SERVER['QUERY_STRING'])), Q(rcube_label('download')))); } diff --git a/program/steps/mail/get.inc b/program/steps/mail/get.inc index 924433df3..19be4bd07 100644 --- a/program/steps/mail/get.inc +++ b/program/steps/mail/get.inc @@ -69,8 +69,15 @@ if (!empty($_GET['_uid'])) { // show part page if (!empty($_GET['_frame'])) { - if (($part_id = get_input_value('_part', RCUBE_INPUT_GPC)) && ($part = $MESSAGE->mime_parts[$part_id]) && $part->filename) - $OUTPUT->set_pagetitle($part->filename); + if (($part_id = get_input_value('_part', RCUBE_INPUT_GPC)) && ($part = $MESSAGE->mime_parts[$part_id])) { + $filename = $part->filename; + if (empty($filename) && $part->mimetype == 'text/html') { + $filename = rcube_label('htmlmessage'); + } + if (!empty($filename)) { + $OUTPUT->set_pagetitle($filename); + } + } $OUTPUT->send('messagepart'); exit; @@ -130,15 +137,25 @@ else if (strlen($pid = get_input_value('_part', RCUBE_INPUT_GET))) { $out = rcmail_print_body($part, array('safe' => $MESSAGE->is_safe, 'inline_html' => false)); } - $OUTPUT = new rcube_html_page(); + $OUTPUT = new rcube_output_html(); $OUTPUT->write($out); } else { // don't kill the connection if download takes more than 30 sec. @set_time_limit(0); + if ($part->filename) { + $filename = $part->filename; + } + else if ($part->mimetype == 'text/html') { + $filename = rcube_label('htmlmessage'); + } + else { + $filename = ($MESSAGE->subject ? $MESSAGE->subject : 'roundcube'); + } + $ext = '.' . ($mimetype == 'text/plain' ? 'txt' : $ctype_secondary); - $filename = $part->filename ? $part->filename : ($MESSAGE->subject ? $MESSAGE->subject : 'roundcube') . $ext; + $filename .= $ext; $filename = preg_replace('[\r\n]', '', $filename); if ($browser->ie && $browser->ver < 7) diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc index c6c6d9636..076098a56 100644 --- a/program/steps/mail/show.inc +++ b/program/steps/mail/show.inc @@ -126,20 +126,24 @@ function rcmail_message_attachments($attrib) if (sizeof($MESSAGE->attachments)) { foreach ($MESSAGE->attachments as $attach_prop) { - if ($PRINT_MODE) { - $ol .= html::tag('li', null, sprintf("%s (%s)", Q($attach_prop->filename), Q(show_bytes($attach_prop->size)))); + $filename = $attach_prop->filename; + if (empty($filename) && $attach_prop->mimetype == 'text/html') { + $filename = rcube_label('htmlmessage'); } - else { - if (mb_strlen($attach_prop->filename) > 50) { - $filename = abbreviate_string($attach_prop->filename, 50); - $title = $attach_prop->filename; + + if ($PRINT_MODE) { + $ol .= html::tag('li', null, sprintf("%s (%s)", Q($filename), Q(show_bytes($attach_prop->size)))); } else { - $filename = $attach_prop->filename; - $title = ''; - } - - $ol .= html::tag('li', rcmail_filetype2classname($attach_prop->mimetype, $attach_prop->filename), + if (mb_strlen($filename) > 50) { + $filename = abbreviate_string($filename, 50); + $title = $filename; + } + else { + $title = ''; + } + + $ol .= html::tag('li', rcmail_filetype2classname($attach_prop->mimetype, $filename), html::a(array( 'href' => $MESSAGE->get_part_url($attach_prop->mime_id, false), 'onclick' => sprintf( diff --git a/program/steps/utils/error.inc b/program/steps/utils/error.inc index 050c1f7cd..000674417 100644 --- a/program/steps/utils/error.inc +++ b/program/steps/utils/error.inc @@ -22,6 +22,7 @@ */ +$rcmail = rcmail::get_instance(); // browser is not compatible with this application if ($ERROR_CODE==409) { @@ -88,7 +89,7 @@ else { $__error_title = "SERVICE CURRENTLY NOT AVAILABLE!"; $__error_text = "Please contact your server-administrator."; - if (($CONFIG['debug_level'] & 4) && $ERROR_MESSAGE) + if (($rcmail->config->get('debug_level') & 4) && $ERROR_MESSAGE) $__error_text = $ERROR_MESSAGE; else $__error_text = sprintf('Error No. [%s]', $ERROR_CODE); @@ -97,7 +98,7 @@ else { $HTTP_ERR_CODE = $ERROR_CODE && $ERROR_CODE < 600 ? $ERROR_CODE : 500; // Ajax request -if ($OUTPUT && ($OUTPUT instanceof rcube_json_output)) { +if ($rcmail->output && $rcmail->output->type == 'js') { header("HTTP/1.0 $HTTP_ERR_CODE $__error_title"); die; } @@ -110,13 +111,13 @@ $__page_content = <<<EOF </div> EOF; -if ($OUTPUT && $OUTPUT->template_exists('error')) { - $OUTPUT->reset(); - $OUTPUT->send('error'); +if ($rcmail->output && $rcmail->output->template_exists('error')) { + $rcmail->output->reset(); + $rcmail->output->send('error'); } -$__skin = $CONFIG->skin ? $CONFIG->skin : 'default'; -$__productname = $CONFIG['product_name'] ? $CONFIG['product_name'] : 'Roundcube Webmail'; +$__skin = $rcmail->config->get('skin', 'default'); +$__productname = $rcmail->config->get('product_name', 'Roundcube Webmail'); // print system error page print <<<EOF |