Fix old format vCard/vCalendar quoting issue

This commit is contained in:
Jörg Lehrke 2010-08-06 20:50:56 +00:00
parent 68cf0235e2
commit ed79fca436

View File

@ -848,13 +848,19 @@ class Horde_iCalendar {
// String fields.
default:
if ($this->isOldFormat()) {
$value = trim($value);
// vCalendar 1.0 and vCard 2.1 only escape semicolons
// and use unescaped semicolons to create lists.
$value = trim($value);
$value = str_replace(array('\\n', '\\N', '\\;', '\\:'),
array("\n", "\n", ';', ':'),
$value);
// Split by unescaped semicolons:
$values = preg_split('/(?<!\\\\);/', $value);
$value = str_replace('\\;', ';', $value);
$values = str_replace('\\;', ';', $values);
$value = str_replace('\\,', ',', $value);
$values = str_replace('\\,', ',', $values);
$this->setAttribute($tag, trim($value), $params, true, $values);
} else {
$value = trim($value);
@ -869,7 +875,6 @@ class Horde_iCalendar {
$values = preg_split('/(?<!\\\\),/', $value);
$value = str_replace('\\,', ',', $value);
$values = str_replace('\\,', ',', $values);
$this->setAttribute($tag, trim($value), $params, true, $values);
}
break;