summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG1
-rw-r--r--program/include/rcube_vcard.php7
-rw-r--r--program/steps/addressbook/export.inc5
3 files changed, 8 insertions, 5 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 45d93053e..28c5c286e 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
CHANGELOG Roundcube Webmail
===========================
+- Fix EOL character in vCard exports (#1487873)
- Added optional "multithreading" autocomplete feature
- Plugin API: Added 'config_get' hook
- Fixed new_user_identity plugin to work with updated rcube_ldap class (#1487994)
diff --git a/program/include/rcube_vcard.php b/program/include/rcube_vcard.php
index 90ee7da66..c7dfe537b 100644
--- a/program/include/rcube_vcard.php
+++ b/program/include/rcube_vcard.php
@@ -33,7 +33,7 @@ class rcube_vcard
'FN' => array(),
'N' => array(array('','','','','')),
);
- static private $fieldmap = array(
+ private static $fieldmap = array(
'phone' => 'TEL',
'birthday' => 'BDAY',
'website' => 'URL',
@@ -65,6 +65,7 @@ class rcube_vcard
public $notes;
public $email = array();
+ public static $eol = "\r\n";
/**
* Constructor
@@ -640,11 +641,11 @@ class rcube_vcard
if (self::is_empty($value))
continue;
- $vcard .= self::vcard_quote($type) . $attr . ':' . self::vcard_quote($value) . "\n";
+ $vcard .= self::vcard_quote($type) . $attr . ':' . self::vcard_quote($value) . self::$eol;
}
}
- return "BEGIN:VCARD\nVERSION:3.0\n{$vcard}END:VCARD";
+ return 'BEGIN:VCARD' . self::$eol . 'VERSION:3.0' . self::$eol . $vcard . 'END:VCARD';
}
diff --git a/program/steps/addressbook/export.inc b/program/steps/addressbook/export.inc
index f890aca69..a710aa204 100644
--- a/program/steps/addressbook/export.inc
+++ b/program/steps/addressbook/export.inc
@@ -73,7 +73,8 @@ header('Content-Disposition: attachment; filename="rcube_contacts.vcf"');
while ($result && ($row = $result->next())) {
// we already have a vcard record
if ($row['vcard'] && $row['name']) {
- echo rcube_vcard::rfc2425_fold($row['vcard']) . "\n";
+ $row['vcard'] = preg_replace('/\r?\n/', rcube_vcard::$eol, $row['vcard']);
+ echo rcube_vcard::rfc2425_fold($row['vcard']) . rcube_vcard::$eol;
}
// copy values into vcard object
else {
@@ -90,7 +91,7 @@ while ($result && ($row = $result->next())) {
}
}
- echo $vcard->export(true) . "\n";
+ echo $vcard->export(true) . rcube_vcard::$eol;
}
}