diff options
Diffstat (limited to 'program/steps')
-rw-r--r-- | program/steps/addressbook/export.inc | 43 | ||||
-rw-r--r-- | program/steps/mail/get.inc | 18 |
2 files changed, 49 insertions, 12 deletions
diff --git a/program/steps/addressbook/export.inc b/program/steps/addressbook/export.inc new file mode 100644 index 000000000..bfffac1f8 --- /dev/null +++ b/program/steps/addressbook/export.inc @@ -0,0 +1,43 @@ +<?php + +/* + +-----------------------------------------------------------------------+ + | program/steps/addressbook/export.inc | + | | + | This file is part of the RoundCube Webmail client | + | Copyright (C) 2008, RoundCube Dev. - Switzerland | + | Licensed under the GNU GPL | + | | + | PURPOSE: | + | Export the selected address book as vCard file | + | | + +-----------------------------------------------------------------------+ + | Author: Thomas Bruederli <roundcube@gmail.com> | + +-----------------------------------------------------------------------+ + + $Id: $ + +*/ + +// get contacts for this user +$CONTACTS->set_pagesize(999); +$result = $CONTACTS->list_records(); + +// send downlaod headers +send_nocacheing_headers(); +header('Content-Type: text/x-vcard; charset=UTF-8'); +header('Content-Disposition: attachment; filename="rcube_contacts.vcf"'); + +while ($result && ($row = $result->next())) { + $vcard = new rcube_vcard($row['vcard']); + $vcard->set('displayname', $row['name']); + $vcard->set('firstname', $row['firstname']); + $vcard->set('surname', $row['surname']); + $vcard->set('email', $row['email']); + + echo $vcard->export(); +} + +exit; + +?> diff --git a/program/steps/mail/get.inc b/program/steps/mail/get.inc index b95784f19..fc3ee83ea 100644 --- a/program/steps/mail/get.inc +++ b/program/steps/mail/get.inc @@ -57,26 +57,20 @@ else if ($pid = get_input_value('_part', RCUBE_INPUT_GET)) { $browser = new rcube_browser; - header("Expires: 0"); - header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); - header("Cache-Control: private", false); - header("Content-Transfer-Encoding: binary"); - + send_nocacheing_headers(); + // send download headers if ($_GET['_download']) { header("Content-Type: application/octet-stream"); if ($browser->ie) header("Content-Type: application/force-download"); } - else if ($ctype_primary == 'text') + else if ($ctype_primary == 'text') { header("Content-Type: text/$ctype_secondary; charset=" . ($part->charset ? $part->charset : RCMAIL_CHARSET)); - else + } + else { header("Content-Type: $mimetype"); - - // We need to set the following headers to make downloads work using IE in HTTPS mode. - if (isset($_SERVER['HTTPS'])) { - header('Pragma: '); - header('Cache-Control: '); + header("Content-Transfer-Encoding: binary"); } // deliver part content |