You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.6 KiB
PHP
45 lines
1.6 KiB
PHP
<?php
|
|
|
|
/*
|
|
+-----------------------------------------------------------------------+
|
|
| program/steps/addressbook/export.inc |
|
|
| |
|
|
| This file is part of the RoundCube Webmail client |
|
|
| Copyright (C) 2008-2009, 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_page(1);
|
|
$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;
|
|
|
|
?>
|