From cb9fc852cf39d91dfa1dc915073914fd153e774a Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Wed, 23 Sep 2009 13:25:05 -0400
Subject: [PATCH] - Fix regular expression for e-mail address (#1486152)
---
program/include/rcube_vcard.php | 17 ++++++++---------
1 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/program/include/rcube_vcard.php b/program/include/rcube_vcard.php
index ce5087a..7dbbb3f 100644
--- a/program/include/rcube_vcard.php
+++ b/program/include/rcube_vcard.php
@@ -263,15 +263,15 @@
$line[1] .= ';' . (strpos($prop, '=') ? $prop : 'TYPE='.$prop);
}
- if (!preg_match('/^(BEGIN|END)$/', $line[1]) && preg_match_all('/([^\\;]+);?/', $line[1], $regs2)) {
- $entry = array('');
- $field = $regs2[1][0];
+ if (!preg_match('/^(BEGIN|END)$/i', $line[1]) && preg_match_all('/([^\\;]+);?/', $line[1], $regs2)) {
+ $entry = array();
+ $field = strtoupper($regs2[1][0]);
foreach($regs2[1] as $attrid => $attr) {
if ((list($key, $value) = explode('=', $attr)) && $value) {
if ($key == 'ENCODING') {
- # add next line(s) to value string if QP line end detected
- while ($value == 'QUOTED-PRINTABLE' && ereg('=$', $lines[$i]))
+ // add next line(s) to value string if QP line end detected
+ while ($value == 'QUOTED-PRINTABLE' && preg_match('/=$/', $lines[$i]))
$line[2] .= "\n" . $lines[++$i];
$line[2] = self::decode_value($line[2], $value);
@@ -280,17 +280,16 @@
$entry[strtolower($key)] = array_merge((array)$entry[strtolower($key)], (array)self::vcard_unquote($value, ','));
}
else if ($attrid > 0) {
- $entry[$key] = true; # true means attr without =value
+ $entry[$key] = true; // true means attr without =value
}
}
- $entry[0] = self::vcard_unquote($line[2]);
+ $entry = array_merge($entry, (array)self::vcard_unquote($line[2]));
$data[$field][] = count($entry) > 1 ? $entry : $entry[0];
}
}
unset($data['VERSION']);
-
return $data;
}
@@ -360,7 +359,7 @@
if (is_int($attrname))
$value[] = $attrvalues;
elseif ($attrvalues === true)
- $attr .= ";$attrname"; # true means just tag, not tag=value, as in PHOTO;BASE64:...
+ $attr .= ";$attrname"; // true means just tag, not tag=value, as in PHOTO;BASE64:...
else {
foreach((array)$attrvalues as $attrvalue)
$attr .= ";$attrname=" . self::vcard_quote($attrvalue, ',');
--
Gitblit v1.9.1