From 59478e06c25303a790a0840ab2ac30662c4ef781 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Tue, 5 Aug 2014 16:46:22 +0200 Subject: c'est la merde.. --- program/lib/Roundcube/rcube_vcard.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'program/lib/Roundcube/rcube_vcard.php') diff --git a/program/lib/Roundcube/rcube_vcard.php b/program/lib/Roundcube/rcube_vcard.php index d54dc56ad..f76c4f08d 100644 --- a/program/lib/Roundcube/rcube_vcard.php +++ b/program/lib/Roundcube/rcube_vcard.php @@ -47,7 +47,6 @@ class rcube_vcard 'manager' => 'X-MANAGER', 'spouse' => 'X-SPOUSE', 'edit' => 'X-AB-EDIT', - 'groups' => 'CATEGORIES', ); private $typemap = array( 'IPHONE' => 'mobile', @@ -358,8 +357,8 @@ class rcube_vcard case 'birthday': case 'anniversary': - if (($val = rcube_utils::anytodatetime($value)) && ($fn = self::$fieldmap[$field])) { - $this->raw[$fn][] = array(0 => $val->format('Y-m-d'), 'value' => array('date')); + if (($val = rcube_utils::strtotime($value)) && ($fn = self::$fieldmap[$field])) { + $this->raw[$fn][] = array(0 => date('Y-m-d', $val), 'value' => array('date')); } break; @@ -482,7 +481,7 @@ class rcube_vcard $vcard_block = ''; $in_vcard_block = false; - foreach (preg_split("/[\r\n]+/", $data) as $line) { + foreach (preg_split("/[\r\n]+/", $data) as $i => $line) { if ($in_vcard_block && !empty($line)) { $vcard_block .= $line . "\n"; } @@ -612,8 +611,8 @@ class rcube_vcard $enc = null; foreach($regs2[1] as $attrid => $attr) { + $attr = preg_replace('/[\s\t\n\r\0\x0B]/', '', $attr); if ((list($key, $value) = explode('=', $attr)) && $value) { - $value = trim($value); if ($key == 'ENCODING') { $value = strtoupper($value); // add next line(s) to value string if QP line end detected @@ -757,7 +756,7 @@ class rcube_vcard * * @return string Joined and quoted string */ - public static function vcard_quote($s, $sep = ';') + private static function vcard_quote($s, $sep = ';') { if (is_array($s)) { foreach($s as $part) { @@ -766,7 +765,7 @@ class rcube_vcard return(implode($sep, (array)$r)); } - return strtr($s, array('\\' => '\\\\', "\r" => '', "\n" => '\n', $sep => '\\'.$sep)); + return strtr($s, array('\\' => '\\\\', "\r" => '', "\n" => '\n', ',' => '\,', ';' => '\;')); } /** @@ -792,7 +791,7 @@ class rcube_vcard return $result; } - $s = strtr($s, $rep2); + $s = trim(strtr($s, $rep2)); } // some implementations (GMail) use non-standard backslash before colon (#1489085) -- cgit v1.2.3