summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2014-11-27 11:40:40 +0100
committerAleksander Machniak <alec@alec.pl>2014-11-27 11:40:40 +0100
commit32eb977b1268ce1e32ab652af6059f49ce59c2f5 (patch)
tree12be25c273913dfbf581397b36b20d5b05e51dfe
parent2f4678908170b8af04a0eae2195bb3c0f732ed58 (diff)
parent25fb9732a008d4fb35e4afdefea552f36835fa43 (diff)
Merge branch 'master' of github.com:roundcube/roundcubemail
-rw-r--r--INSTALL2
-rw-r--r--program/lib/Roundcube/rcube_csv2vcard.php25
-rw-r--r--program/lib/Roundcube/rcube_utils.php2
-rw-r--r--tests/src/Csv2vcard/gmail.csvbin3778 -> 3992 bytes
-rw-r--r--tests/src/Csv2vcard/gmail.vcf2
5 files changed, 26 insertions, 5 deletions
diff --git a/INSTALL b/INSTALL
index ef1c59b85..817d98c1e 100644
--- a/INSTALL
+++ b/INSTALL
@@ -12,7 +12,7 @@ REQUIREMENTS
* The Apache, Lighttpd, Cherokee or Hiawatha web server
* .htaccess support allowing overrides for DirectoryIndex
* PHP Version 5.3.7 or greater including
- - PCRE, DOM, JSON, XML, Session, Sockets (required)
+ - PCRE, DOM, JSON, Session, Sockets (required)
- PHP Data Objects (PDO) with driver for either MySQL, PostgreSQL or SQLite (required)
- Libiconv, Zip (recommended)
- OpenSSL, Fileinfo, Mcrypt, mbstring (optional)
diff --git a/program/lib/Roundcube/rcube_csv2vcard.php b/program/lib/Roundcube/rcube_csv2vcard.php
index 802ca730d..8eff4d56c 100644
--- a/program/lib/Roundcube/rcube_csv2vcard.php
+++ b/program/lib/Roundcube/rcube_csv2vcard.php
@@ -302,6 +302,7 @@ class rcube_csv2vcard
'Value' => array(
'home' => 'email:home',
'work' => 'email:work',
+ '*' => 'email:other',
),
),
'Phone' => array(
@@ -567,8 +568,19 @@ class rcube_csv2vcard
foreach ($item as $item_key => $item_idx) {
$value = $data[$item_idx];
- if ($value !== null && $value !== '' && ($data_idx = $this->gmail_label_map[$key][$item_key][$type])) {
- $contact[$data_idx] = $value;
+ if ($value !== null && $value !== '') {
+ foreach (array($type, '*') as $_type) {
+ if ($data_idx = $this->gmail_label_map[$key][$item_key][$_type]) {
+ if (!empty($contact[$data_idx])) {
+ $contact[$data_idx] = (array) $contact[$data_idx];
+ $contact[$data_idx][] = $value;
+ }
+ else {
+ $contact[$data_idx] = $value;
+ }
+ break;
+ }
+ }
}
}
}
@@ -624,7 +636,14 @@ class rcube_csv2vcard
$vcard = new rcube_vcard();
foreach ($contact as $name => $value) {
$name = explode(':', $name);
- $vcard->set($name[0], $value, $name[1]);
+ if (is_array($value) && $name[0] != 'address') {
+ foreach ((array) $value as $val) {
+ $vcard->set($name[0], $val, $name[1]);
+ }
+ }
+ else {
+ $vcard->set($name[0], $value, $name[1]);
+ }
}
// add to the list
diff --git a/program/lib/Roundcube/rcube_utils.php b/program/lib/Roundcube/rcube_utils.php
index a51247eae..add97ee07 100644
--- a/program/lib/Roundcube/rcube_utils.php
+++ b/program/lib/Roundcube/rcube_utils.php
@@ -797,7 +797,7 @@ class rcube_utils
// try to parse string with DateTime first
if (!empty($date)) {
try {
- $dt = new DateTime($date, $timezone);
+ $dt = $timezone ? new DateTime($date, $timezone) : new DateTime($date);
}
catch (Exception $e) {
// ignore
diff --git a/tests/src/Csv2vcard/gmail.csv b/tests/src/Csv2vcard/gmail.csv
index 1de3033e7..b95cb0144 100644
--- a/tests/src/Csv2vcard/gmail.csv
+++ b/tests/src/Csv2vcard/gmail.csv
Binary files differ
diff --git a/tests/src/Csv2vcard/gmail.vcf b/tests/src/Csv2vcard/gmail.vcf
index 2a56311d3..e9486b29b 100644
--- a/tests/src/Csv2vcard/gmail.vcf
+++ b/tests/src/Csv2vcard/gmail.vcf
@@ -8,6 +8,8 @@ NOTE:note"note
CATEGORIES:My Contacts,Test
EMAIL;TYPE=INTERNET;TYPE=HOME:home@aaa.pl
EMAIL;TYPE=INTERNET;TYPE=WORK:work@email.pl
+EMAIL;TYPE=INTERNET;TYPE=OTHER:unknown@email.com
+EMAIL;TYPE=INTERNET;TYPE=OTHER:other@email.com
TEL;TYPE=pager:pager
TEL;TYPE=pref:mainphone
TEL;TYPE=home:homephone