From 70bbabb6994e67f812d9f7d1f85df1098870cfaa Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Sun, 23 Sep 2012 22:46:09 +0200 Subject: Add zipdwonload plugin by Phil Weir at tehinterweb.co.uk to core repository --- plugins/zipdownload/CHANGELOG | 34 +++ plugins/zipdownload/README | 35 +++ plugins/zipdownload/config.inc.php | 21 ++ plugins/zipdownload/config.inc.php.dist | 21 ++ plugins/zipdownload/localization/ca_ES.inc | 10 + plugins/zipdownload/localization/cs_CZ.inc | 10 + plugins/zipdownload/localization/da_DK.inc | 10 + plugins/zipdownload/localization/de_CH.inc | 10 + plugins/zipdownload/localization/de_DE.inc | 10 + plugins/zipdownload/localization/en_GB.inc | 10 + plugins/zipdownload/localization/en_US.inc | 10 + plugins/zipdownload/localization/es_AR.inc | 9 + plugins/zipdownload/localization/es_ES.inc | 10 + plugins/zipdownload/localization/et_EE.inc | 9 + plugins/zipdownload/localization/fr_FR.inc | 10 + plugins/zipdownload/localization/gl_ES.inc | 10 + plugins/zipdownload/localization/hu_HU.inc | 10 + plugins/zipdownload/localization/it_IT.inc | 10 + plugins/zipdownload/localization/nl_NL.inc | 10 + plugins/zipdownload/localization/pl_PL.inc | 10 + plugins/zipdownload/localization/pt_BR.inc | 9 + plugins/zipdownload/localization/ro_RO.inc | 9 + plugins/zipdownload/localization/ru_RU.inc | 10 + plugins/zipdownload/localization/tr_TR.inc | 10 + plugins/zipdownload/package.xml | 89 ++++++++ plugins/zipdownload/skins/classic/zip.png | Bin 0 -> 546 bytes plugins/zipdownload/skins/classic/zipdownload.css | 8 + plugins/zipdownload/skins/larry/zipdownload.css | 7 + plugins/zipdownload/zipdownload.js | 33 +++ plugins/zipdownload/zipdownload.php | 267 ++++++++++++++++++++++ 30 files changed, 711 insertions(+) create mode 100644 plugins/zipdownload/CHANGELOG create mode 100644 plugins/zipdownload/README create mode 100644 plugins/zipdownload/config.inc.php create mode 100644 plugins/zipdownload/config.inc.php.dist create mode 100644 plugins/zipdownload/localization/ca_ES.inc create mode 100644 plugins/zipdownload/localization/cs_CZ.inc create mode 100644 plugins/zipdownload/localization/da_DK.inc create mode 100644 plugins/zipdownload/localization/de_CH.inc create mode 100644 plugins/zipdownload/localization/de_DE.inc create mode 100644 plugins/zipdownload/localization/en_GB.inc create mode 100644 plugins/zipdownload/localization/en_US.inc create mode 100644 plugins/zipdownload/localization/es_AR.inc create mode 100644 plugins/zipdownload/localization/es_ES.inc create mode 100644 plugins/zipdownload/localization/et_EE.inc create mode 100644 plugins/zipdownload/localization/fr_FR.inc create mode 100644 plugins/zipdownload/localization/gl_ES.inc create mode 100644 plugins/zipdownload/localization/hu_HU.inc create mode 100644 plugins/zipdownload/localization/it_IT.inc create mode 100644 plugins/zipdownload/localization/nl_NL.inc create mode 100644 plugins/zipdownload/localization/pl_PL.inc create mode 100644 plugins/zipdownload/localization/pt_BR.inc create mode 100644 plugins/zipdownload/localization/ro_RO.inc create mode 100644 plugins/zipdownload/localization/ru_RU.inc create mode 100644 plugins/zipdownload/localization/tr_TR.inc create mode 100644 plugins/zipdownload/package.xml create mode 100644 plugins/zipdownload/skins/classic/zip.png create mode 100644 plugins/zipdownload/skins/classic/zipdownload.css create mode 100644 plugins/zipdownload/skins/larry/zipdownload.css create mode 100644 plugins/zipdownload/zipdownload.js create mode 100644 plugins/zipdownload/zipdownload.php (limited to 'plugins/zipdownload') diff --git a/plugins/zipdownload/CHANGELOG b/plugins/zipdownload/CHANGELOG new file mode 100644 index 000000000..32b878e76 --- /dev/null +++ b/plugins/zipdownload/CHANGELOG @@ -0,0 +1,34 @@ +Roundcube Webmail ZipDownload +============================= + +2012-09-20 +========== + * Added style for new Larry skin + * Made plugin work with 0.8 version of Roundcube + * Save attachments to temp files before adding to zip archive (memory!) + +2011 03 12 +========== + * Convert charset for filenames inside zip + +2010 08 30 +========== + * Get all messages in folder, not just the first page + +2010 08 12 +========== + * Use $.inArray() instead of Array.indexOf() + +2010 08 07 +========== + * Add the ability to download a folder as zip + * Add the ability to download selection of messages as zip + * Add config file to control download options + +2010 05 29 +========== + * Remove tnef_decode, now done by message class (r3680) + +2010 02 21 +========== + * First version \ No newline at end of file diff --git a/plugins/zipdownload/README b/plugins/zipdownload/README new file mode 100644 index 000000000..4fa3c17b6 --- /dev/null +++ b/plugins/zipdownload/README @@ -0,0 +1,35 @@ +Roundcube Webmail ZipDownload +============================= +This plugin adds an option to download all attachments to a message in one zip +file, when a message has multiple attachments. The plugin also allows the +download of a selection of messages in 1 zip file and the download of entire +folders. + +Requirements +============ +* php_zip extension (including ZipArchive class) + Either install it via PECL or for PHP >= 5.2 compile with --enable-zip option + +License +======= +This plugin is released under the GNU General Public License Version 3 +or later (http://www.gnu.org/licenses/gpl.html). + +Even if skins might contain some programming work, they are not considered +as a linked part of the plugin and therefore skins DO NOT fall under the +provisions of the GPL license. See the README file located in the core skins +folder for details on the skin license. + +Install +======= +* Place this plugin folder into plugins directory of Roundcube +* Add zipdownload to $rcmail_config['plugins'] in your Roundcube config + +NB: When downloading the plugin from GitHub you will need to create a +directory called zipdownload and place the files in there, ignoring the +root directory in the downloaded archive + +Config +====== +The default config file is plugins/zipdownload/config.inc.php.dist +Rename this to plugins/zipdownload/config.inc.php \ No newline at end of file diff --git a/plugins/zipdownload/config.inc.php b/plugins/zipdownload/config.inc.php new file mode 100644 index 000000000..1eb6f06cb --- /dev/null +++ b/plugins/zipdownload/config.inc.php @@ -0,0 +1,21 @@ + \ No newline at end of file diff --git a/plugins/zipdownload/config.inc.php.dist b/plugins/zipdownload/config.inc.php.dist new file mode 100644 index 000000000..5c7489a15 --- /dev/null +++ b/plugins/zipdownload/config.inc.php.dist @@ -0,0 +1,21 @@ + \ No newline at end of file diff --git a/plugins/zipdownload/localization/ca_ES.inc b/plugins/zipdownload/localization/ca_ES.inc new file mode 100644 index 000000000..8ccf0543c --- /dev/null +++ b/plugins/zipdownload/localization/ca_ES.inc @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/plugins/zipdownload/localization/cs_CZ.inc b/plugins/zipdownload/localization/cs_CZ.inc new file mode 100644 index 000000000..4a1f75177 --- /dev/null +++ b/plugins/zipdownload/localization/cs_CZ.inc @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/plugins/zipdownload/localization/da_DK.inc b/plugins/zipdownload/localization/da_DK.inc new file mode 100644 index 000000000..17c7c0d82 --- /dev/null +++ b/plugins/zipdownload/localization/da_DK.inc @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/plugins/zipdownload/localization/de_CH.inc b/plugins/zipdownload/localization/de_CH.inc new file mode 100644 index 000000000..68725605b --- /dev/null +++ b/plugins/zipdownload/localization/de_CH.inc @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/plugins/zipdownload/localization/de_DE.inc b/plugins/zipdownload/localization/de_DE.inc new file mode 100644 index 000000000..68725605b --- /dev/null +++ b/plugins/zipdownload/localization/de_DE.inc @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/plugins/zipdownload/localization/en_GB.inc b/plugins/zipdownload/localization/en_GB.inc new file mode 100644 index 000000000..0db6f8f8c --- /dev/null +++ b/plugins/zipdownload/localization/en_GB.inc @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/plugins/zipdownload/localization/en_US.inc b/plugins/zipdownload/localization/en_US.inc new file mode 100644 index 000000000..0db6f8f8c --- /dev/null +++ b/plugins/zipdownload/localization/en_US.inc @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/plugins/zipdownload/localization/es_AR.inc b/plugins/zipdownload/localization/es_AR.inc new file mode 100644 index 000000000..f3a798c85 --- /dev/null +++ b/plugins/zipdownload/localization/es_AR.inc @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/plugins/zipdownload/localization/es_ES.inc b/plugins/zipdownload/localization/es_ES.inc new file mode 100644 index 000000000..193f7b450 --- /dev/null +++ b/plugins/zipdownload/localization/es_ES.inc @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/plugins/zipdownload/localization/et_EE.inc b/plugins/zipdownload/localization/et_EE.inc new file mode 100644 index 000000000..60a886b0a --- /dev/null +++ b/plugins/zipdownload/localization/et_EE.inc @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/plugins/zipdownload/localization/fr_FR.inc b/plugins/zipdownload/localization/fr_FR.inc new file mode 100644 index 000000000..b8fc4cdaa --- /dev/null +++ b/plugins/zipdownload/localization/fr_FR.inc @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/plugins/zipdownload/localization/gl_ES.inc b/plugins/zipdownload/localization/gl_ES.inc new file mode 100644 index 000000000..2c9107949 --- /dev/null +++ b/plugins/zipdownload/localization/gl_ES.inc @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/plugins/zipdownload/localization/hu_HU.inc b/plugins/zipdownload/localization/hu_HU.inc new file mode 100644 index 000000000..1931cb0f2 --- /dev/null +++ b/plugins/zipdownload/localization/hu_HU.inc @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/plugins/zipdownload/localization/it_IT.inc b/plugins/zipdownload/localization/it_IT.inc new file mode 100644 index 000000000..63b7b072e --- /dev/null +++ b/plugins/zipdownload/localization/it_IT.inc @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/plugins/zipdownload/localization/nl_NL.inc b/plugins/zipdownload/localization/nl_NL.inc new file mode 100644 index 000000000..1cf32ce12 --- /dev/null +++ b/plugins/zipdownload/localization/nl_NL.inc @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/plugins/zipdownload/localization/pl_PL.inc b/plugins/zipdownload/localization/pl_PL.inc new file mode 100644 index 000000000..c86d87558 --- /dev/null +++ b/plugins/zipdownload/localization/pl_PL.inc @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/plugins/zipdownload/localization/pt_BR.inc b/plugins/zipdownload/localization/pt_BR.inc new file mode 100644 index 000000000..c082e541c --- /dev/null +++ b/plugins/zipdownload/localization/pt_BR.inc @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/plugins/zipdownload/localization/ro_RO.inc b/plugins/zipdownload/localization/ro_RO.inc new file mode 100644 index 000000000..3a2a1ac19 --- /dev/null +++ b/plugins/zipdownload/localization/ro_RO.inc @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/plugins/zipdownload/localization/ru_RU.inc b/plugins/zipdownload/localization/ru_RU.inc new file mode 100644 index 000000000..ac11327a0 --- /dev/null +++ b/plugins/zipdownload/localization/ru_RU.inc @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/plugins/zipdownload/localization/tr_TR.inc b/plugins/zipdownload/localization/tr_TR.inc new file mode 100644 index 000000000..dc7489da1 --- /dev/null +++ b/plugins/zipdownload/localization/tr_TR.inc @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/plugins/zipdownload/package.xml b/plugins/zipdownload/package.xml new file mode 100644 index 000000000..bf5511563 --- /dev/null +++ b/plugins/zipdownload/package.xml @@ -0,0 +1,89 @@ + + + zipdownload + pear.roundcube.net + Download multiple attachments or messages in one zip file + Adds an option to download all attachments to a message in one zip file, when a message has multiple attachments. Also allows the download of a selection of messages in one zip file and the download of entire folders. + + Philip Weir + JohnDoh + roundcube@tehinterweb.co.uk + no + + + Thomas Bruederli + bruederli + roundcube@gmail.com + yes + + 2012-09-20 + + + 2.0 + 2.0 + + + stable + stable + + GNU GPLv3+ + Repo only + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5.2.1 + + + 1.7.0 + + + zip + pecl.php.net + zip + + + + + diff --git a/plugins/zipdownload/skins/classic/zip.png b/plugins/zipdownload/skins/classic/zip.png new file mode 100644 index 000000000..c64fde89b Binary files /dev/null and b/plugins/zipdownload/skins/classic/zip.png differ diff --git a/plugins/zipdownload/skins/classic/zipdownload.css b/plugins/zipdownload/skins/classic/zipdownload.css new file mode 100644 index 000000000..2608fdfd0 --- /dev/null +++ b/plugins/zipdownload/skins/classic/zipdownload.css @@ -0,0 +1,8 @@ +/* Roundcube Zipdownload plugin styles for classic skin */ + +a.zipdownload { + display: inline-block; + padding: 0 0 2px 20px; + background: url(zip.png) 0 1px no-repeat; + font-style: italic; +} diff --git a/plugins/zipdownload/skins/larry/zipdownload.css b/plugins/zipdownload/skins/larry/zipdownload.css new file mode 100644 index 000000000..d719ac677 --- /dev/null +++ b/plugins/zipdownload/skins/larry/zipdownload.css @@ -0,0 +1,7 @@ +/* Roundcube Zipdownload plugin styles for skin "Larry" */ + +a.zipdownload { + display: inline-block; + margin-top: 1.5em; + padding: 3px 5px 4px 5px; +} \ No newline at end of file diff --git a/plugins/zipdownload/zipdownload.js b/plugins/zipdownload/zipdownload.js new file mode 100644 index 000000000..080dcd9e3 --- /dev/null +++ b/plugins/zipdownload/zipdownload.js @@ -0,0 +1,33 @@ +/** + * ZipDownload plugin script + */ + +function rcmail_zipmessages() { + if (rcmail.message_list && rcmail.message_list.get_selection().length > 1) { + rcmail.goto_url('plugin.zipdownload.zip_messages', '_mbox=' + urlencode(rcmail.env.mailbox) + '&_uid=' + rcmail.message_list.get_selection().join(',')); + } +} + +$(document).ready(function() { + if (window.rcmail) { + rcmail.addEventListener('init', function(evt) { + // register command (directly enable in message view mode) + rcmail.register_command('plugin.zipdownload.zip_folder', function() { + rcmail.goto_url('plugin.zipdownload.zip_folder', '_mbox=' + urlencode(rcmail.env.mailbox)); + }, rcmail.env.messagecount > 0); + + if (rcmail.message_list && rcmail.env.zipdownload_selection) { + rcmail.message_list.addEventListener('select', function(list) { + rcmail.enable_command('download', list.get_selection().length > 0); + }); + + // check in contextmenu plugin exists and if so allow multiple message download + if (rcmail.contextmenu_disable_multi) + rcmail.contextmenu_disable_multi.splice($.inArray('#download', rcmail.contextmenu_disable_multi), 1); + } + }); + + rcmail.addEventListener('listupdate', function(props) { rcmail.enable_command('plugin.zipdownload.zip_folder', rcmail.env.messagecount > 0); } ); + rcmail.addEventListener('beforedownload', function(props) { rcmail_zipmessages(); } ); + } +}); \ No newline at end of file diff --git a/plugins/zipdownload/zipdownload.php b/plugins/zipdownload/zipdownload.php new file mode 100644 index 000000000..be4ece476 --- /dev/null +++ b/plugins/zipdownload/zipdownload.php @@ -0,0 +1,267 @@ + 520, 'type' => 'php', + 'file' => __FILE__, 'line' => __LINE__, + 'message' => "php_zip extension is required for the zipdownload plugin"), true, false); + return; + } + + $rcmail = rcmail::get_instance(); + $this->charset = $rcmail->config->get('zipdownload_charset', RCMAIL_CHARSET); + + $this->load_config(); + $this->add_texts('localization'); + + if ($rcmail->config->get('zipdownload_attachments', 1) > -1 && ($rcmail->action == 'show' || $rcmail->action == 'preview')) + $this->add_hook('template_object_messageattachments', array($this, 'attachment_ziplink')); + + $this->register_action('plugin.zipdownload.zip_attachments', array($this, 'download_attachments')); + $this->register_action('plugin.zipdownload.zip_messages', array($this, 'download_selection')); + $this->register_action('plugin.zipdownload.zip_folder', array($this, 'download_folder')); + + if ($rcmail->config->get('zipdownload_folder', false) || $rcmail->config->get('zipdownload_selection', false)) { + $this->include_script('zipdownload.js'); + $this->api->output->set_env('zipdownload_selection', $rcmail->config->get('zipdownload_selection', false)); + + if ($rcmail->config->get('zipdownload_folder', false) && ($rcmail->action == '' || $rcmail->action == 'show')) { + $zipdownload = $this->api->output->button(array('command' => 'plugin.zipdownload.zip_folder', 'type' => 'link', 'classact' => 'active', 'content' => $this->gettext('downloadfolder'))); + $this->api->add_content(html::tag('li', array('class' => 'separator_above'), $zipdownload), 'mailboxoptions'); + } + } + } + + /** + * Place a link/button after attachments listing to trigger download + */ + public function attachment_ziplink($p) + { + $rcmail = rcmail::get_instance(); + + // only show the link if there is more than the configured number of attachments + if (substr_count($p['content'], ' $rcmail->config->get('zipdownload_attachments', 1)) { + $link = html::a(array( + 'href' => rcmail_url('plugin.zipdownload.zip_attachments', array('_mbox' => $rcmail->output->env['mailbox'], '_uid' => $rcmail->output->env['uid'])), + 'class' => 'button zipdownload', + ), + Q($this->gettext('downloadall')) + ); + + // append link to attachments list, slightly different in some skins + switch (rcube::get_instance()->config->get('skin')) { + case 'classic': + $p['content'] = str_replace('', html::tag('li', array('class' => 'zipdownload'), $link) . '', $p['content']); + break; + + default: + $p['content'] .= $link; + break; + } + + $this->include_stylesheet($this->local_skin_path() . '/zipdownload.css'); + } + + return $p; + } + + /** + * Handler for attachment download action + */ + public function download_attachments() + { + $rcmail = rcmail::get_instance(); + $imap = $rcmail->storage; + $temp_dir = $rcmail->config->get('temp_dir'); + $tmpfname = tempnam($temp_dir, 'zipdownload'); + $tempfiles = array($tmpfname); + $message = new rcube_message(get_input_value('_uid', RCUBE_INPUT_GET)); + + // open zip file + $zip = new ZipArchive(); + $zip->open($tmpfname, ZIPARCHIVE::OVERWRITE); + + foreach ($message->attachments as $part) { + $pid = $part->mime_id; + $part = $message->mime_parts[$pid]; + $disp_name = $this->_convert_filename($part->filename, $part->charset); + + if ($part->body) { + $orig_message_raw = $part->body; + $zip->addFromString($disp_name, $orig_message_raw); + } + else { + $tmpfn = tempnam($temp_dir, 'zipattach'); + $tmpfp = fopen($tmpfn, 'w'); + $imap->get_message_part($message->uid, $part->mime_id, $part, null, $tmpfp, true); + $tempfiles[] = $tmpfn; + fclose($tmpfp); + $zip->addFile($tmpfn, $disp_name); + } + + } + + $zip->close(); + + $filename = ($message->subject ? $message->subject : 'roundcube') . '.zip'; + $this->_deliver_zipfile($tmpfname, $filename); + + // delete temporary files from disk + foreach ($tempfiles as $tmpfn) + unlink($tmpfn); + + exit; + } + + /** + * Handler for message download action + */ + public function download_selection() + { + if (isset($_REQUEST['_uid'])) { + $uids = explode(",", get_input_value('_uid', RCUBE_INPUT_GPC)); + + if (sizeof($uids) > 0) + $this->_download_messages($uids); + } + } + + /** + * Handler for folder download action + */ + public function download_folder() + { + $imap = rcmail::get_instance()->storage; + $mbox_name = $imap->get_folder(); + + // initialize searching result if search_filter is used + if ($_SESSION['search_filter'] && $_SESSION['search_filter'] != 'ALL') { + $imap->search($mbox_name, $_SESSION['search_filter'], RCMAIL_CHARSET); + } + + // fetch message headers for all pages + $uids = array(); + if ($count = $imap->count($mbox_name, $imap->get_threading() ? 'THREADS' : 'ALL', FALSE)) { + for ($i = 0; ($i * $imap->get_pagesize()) <= $count; $i++) { + $a_headers = $imap->list_messages($mbox_name, ($i + 1)); + + foreach ($a_headers as $n => $header) { + if (empty($header)) + continue; + + array_push($uids, $header->uid); + } + } + } + + if (sizeof($uids) > 0) + $this->_download_messages($uids); + } + + /** + * Helper method to packs all the given messages into a zip archive + * + * @param array List of message UIDs to download + */ + private function _download_messages($uids) + { + $rcmail = rcmail::get_instance(); + $imap = $rcmail->storage; + $temp_dir = $rcmail->config->get('temp_dir'); + $tmpfname = tempnam($temp_dir, 'zipdownload'); + $tempfiles = array($tmpfname); + + // open zip file + $zip = new ZipArchive(); + $zip->open($tmpfname, ZIPARCHIVE::OVERWRITE); + + foreach ($uids as $key => $uid){ + $headers = $imap->get_message_headers($uid); + $subject = rcube_mime::decode_mime_string((string)$headers->subject); + $subject = $this->_convert_filename($subject); + $subject = substr($subject, 0, 16); + + if (isset($subject) && $subject !="") + $disp_name = $subject . ".eml"; + else + $disp_name = "message_rfc822.eml"; + + $disp_name = $uid . "_" . $disp_name; + + $tmpfn = tempnam($temp_dir, 'zipmessage'); + $tmpfp = fopen($tmpfn, 'w'); + $imap->get_raw_body($uid, $tmpfp); + $tempfiles[] = $tmpfn; + fclose($tmpfp); + $zip->addFile($tmpfn, $disp_name); + } + + $zip->close(); + + $this->_deliver_zipfile($tmpfname, $imap->get_folder() . '.zip'); + + // delete temporary files from disk + foreach ($tempfiles as $tmpfn) + unlink($tmpfn); + + exit; + } + + /** + * Helper method to send the zip archive to the browser + */ + private function _deliver_zipfile($tmpfname, $filename) + { + $browser = new rcube_browser; + send_nocacheing_headers(); + + if ($browser->ie && $browser->ver < 7) + $filename = rawurlencode(abbreviate_string($filename, 55)); + else if ($browser->ie) + $filename = rawurlencode($filename); + else + $filename = addcslashes($filename, '"'); + + // send download headers + header("Content-Type: application/octet-stream"); + if ($browser->ie) + header("Content-Type: application/force-download"); + + // don't kill the connection if download takes more than 30 sec. + @set_time_limit(0); + header("Content-Disposition: attachment; filename=\"". $filename ."\""); + header("Content-length: " . filesize($tmpfname)); + readfile($tmpfname); + } + + /** + * Helper function to convert filenames to the configured charset + */ + private function _convert_filename($str, $from = RCMAIL_CHARSET) + { + return strtr(rcube_charset_convert($str, $from, $this->charset), array(':'=>'', '/'=>'-')); + } +} + +?> \ No newline at end of file -- cgit v1.2.3