aboutsummaryrefslogtreecommitdiffstats
path: root/apps/contacts/export.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/contacts/export.php')
-rw-r--r--apps/contacts/export.php30
1 files changed, 19 insertions, 11 deletions
diff --git a/apps/contacts/export.php b/apps/contacts/export.php
index 4e4ade2f2ba..161ca8047ac 100644
--- a/apps/contacts/export.php
+++ b/apps/contacts/export.php
@@ -9,22 +9,30 @@
OCP\User::checkLoggedIn();
OCP\App::checkAppEnabled('contacts');
-$bookid = isset($_GET['bookid']) ? $_GET['bookid'] : NULL;
-$contactid = isset($_GET['contactid']) ? $_GET['contactid'] : NULL;
+$bookid = isset($_GET['bookid']) ? $_GET['bookid'] : null;
+$contactid = isset($_GET['contactid']) ? $_GET['contactid'] : null;
$nl = "\n";
-if(isset($bookid)){
+if(isset($bookid)) {
$addressbook = OC_Contacts_App::getAddressbook($bookid);
- $cardobjects = OC_Contacts_VCard::all($bookid);
+ //$cardobjects = OC_Contacts_VCard::all($bookid);
header('Content-Type: text/directory');
- header('Content-Disposition: inline; filename=' . str_replace(' ', '_', $addressbook['displayname']) . '.vcf');
+ header('Content-Disposition: inline; filename='
+ . str_replace(' ', '_', $addressbook['displayname']) . '.vcf');
- foreach($cardobjects as $card) {
- echo $card['carddata'] . $nl;
+ $start = 0;
+ $batchsize = OCP\Config::getUserValue(OCP\User::getUser(),
+ 'contacts',
+ 'export_batch_size', 20);
+ while($cardobjects = OC_Contacts_VCard::all($bookid, $start, $batchsize)){
+ foreach($cardobjects as $card) {
+ echo $card['carddata'] . $nl;
+ }
+ $start += $batchsize;
}
-}elseif(isset($contactid)){
+}elseif(isset($contactid)) {
$data = OC_Contacts_App::getContactObject($contactid);
- header('Content-Type: text/directory');
- header('Content-Disposition: inline; filename=' . str_replace(' ', '_', $data['fullname']) . '.vcf');
+ header('Content-Type: text/vcard');
+ header('Content-Disposition: inline; filename='
+ . str_replace(' ', '_', $data['fullname']) . '.vcf');
echo $data['carddata'];
}
-?>