commit | author | age
|
0dbac3
|
1 |
<?php |
T |
2 |
|
|
3 |
/* |
|
4 |
+-----------------------------------------------------------------------+ |
|
5 |
| program/steps/addressbook/export.inc | |
|
6 |
| | |
|
7 |
| This file is part of the RoundCube Webmail client | |
|
8 |
| Copyright (C) 2008, RoundCube Dev. - Switzerland | |
|
9 |
| Licensed under the GNU GPL | |
|
10 |
| | |
|
11 |
| PURPOSE: | |
|
12 |
| Export the selected address book as vCard file | |
|
13 |
| | |
|
14 |
+-----------------------------------------------------------------------+ |
|
15 |
| Author: Thomas Bruederli <roundcube@gmail.com> | |
|
16 |
+-----------------------------------------------------------------------+ |
|
17 |
|
|
18 |
$Id: $ |
|
19 |
|
|
20 |
*/ |
|
21 |
|
|
22 |
// get contacts for this user |
48c0d4
|
23 |
$CONTACTS->set_page(1); |
0dbac3
|
24 |
$CONTACTS->set_pagesize(999); |
T |
25 |
$result = $CONTACTS->list_records(); |
|
26 |
|
|
27 |
// send downlaod headers |
|
28 |
send_nocacheing_headers(); |
|
29 |
header('Content-Type: text/x-vcard; charset=UTF-8'); |
|
30 |
header('Content-Disposition: attachment; filename="rcube_contacts.vcf"'); |
|
31 |
|
|
32 |
while ($result && ($row = $result->next())) { |
|
33 |
$vcard = new rcube_vcard($row['vcard']); |
|
34 |
$vcard->set('displayname', $row['name']); |
|
35 |
$vcard->set('firstname', $row['firstname']); |
|
36 |
$vcard->set('surname', $row['surname']); |
|
37 |
$vcard->set('email', $row['email']); |
|
38 |
|
|
39 |
echo $vcard->export(); |
|
40 |
} |
|
41 |
|
|
42 |
exit; |
|
43 |
|
|
44 |
?> |