forked from extern/egroupware
fixed iCal parser to unescape escaped separators AFTER spliting by them, causing eg. semicolons in vcard N property (name) to fail
This commit is contained in:
parent
a9b4bfdaba
commit
8cce6075bd
@ -822,17 +822,15 @@ class Horde_iCalendar {
|
|||||||
case 'ORG':
|
case 'ORG':
|
||||||
$value = trim($value);
|
$value = trim($value);
|
||||||
// As of rfc 2426 2.4.2 semicolon, comma, and colon must
|
// As of rfc 2426 2.4.2 semicolon, comma, and colon must
|
||||||
// be escaped (comma is unescaped after splitting below).
|
// be escaped (semicolon is unescaped after splitting below).
|
||||||
$value = str_replace(array('\\n', '\\N', '\\;', '\\:'),
|
$value = str_replace(array('\\n', '\\N', '\\,', '\\:'),
|
||||||
array("\n", "\n", ';', ':'),
|
array("\n", "\n", ',', ':'),
|
||||||
$value);
|
$value);
|
||||||
|
|
||||||
// Split by unescaped semicolons:
|
// Split by unescaped semicolons:
|
||||||
$values = preg_split('/(?<!\\\\);/', $value);
|
$values = preg_split('/(?<!\\\\);/', $value);
|
||||||
$value = str_replace('\\;', ';', $value);
|
$value = str_replace('\\;', ';', $value);
|
||||||
$values = str_replace('\\;', ';', $values);
|
$values = str_replace('\\;', ';', $values);
|
||||||
$value = str_replace('\\,', ',', $value);
|
|
||||||
$values = str_replace('\\,', ',', $values);
|
|
||||||
$this->setAttribute($tag, trim($value), $params, true, $values);
|
$this->setAttribute($tag, trim($value), $params, true, $values);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -841,15 +839,13 @@ class Horde_iCalendar {
|
|||||||
case 'CATEGORIES':
|
case 'CATEGORIES':
|
||||||
$value = trim($value);
|
$value = trim($value);
|
||||||
// As of rfc 2426 2.4.2 semicolon, comma, and colon must
|
// As of rfc 2426 2.4.2 semicolon, comma, and colon must
|
||||||
// be escaped (semicolon is unescaped after splitting below).
|
// be escaped (comma is unescaped after splitting below).
|
||||||
$value = str_replace(array('\\n', '\\N', '\\,', '\\:'),
|
$value = str_replace(array('\\n', '\\N', '\\;', '\\:'),
|
||||||
array("\n", "\n", ',', ':'),
|
array("\n", "\n", ';', ':'),
|
||||||
$value);
|
$value);
|
||||||
|
|
||||||
// Split by unescaped commas:
|
// Split by unescaped commas:
|
||||||
$values = preg_split('/(?<!\\\\),/', $value);
|
$values = preg_split('/(?<!\\\\),/', $value);
|
||||||
$value = str_replace('\\;', ';', $value);
|
|
||||||
$values = str_replace('\\;', ';', $values);
|
|
||||||
$value = str_replace('\\,', ',', $value);
|
$value = str_replace('\\,', ',', $value);
|
||||||
$values = str_replace('\\,', ',', $values);
|
$values = str_replace('\\,', ',', $values);
|
||||||
$this->setAttribute($tag, trim($value), $params, true, $values);
|
$this->setAttribute($tag, trim($value), $params, true, $values);
|
||||||
@ -861,16 +857,14 @@ class Horde_iCalendar {
|
|||||||
$value = trim($value);
|
$value = trim($value);
|
||||||
// vCalendar 1.0 and vCard 2.1 only escape semicolons
|
// vCalendar 1.0 and vCard 2.1 only escape semicolons
|
||||||
// and use unescaped semicolons to create lists.
|
// and use unescaped semicolons to create lists.
|
||||||
$value = str_replace(array('\\n', '\\N', '\\;', '\\:'),
|
$value = str_replace(array('\\n', '\\N', '\\,', '\\:'),
|
||||||
array("\n", "\n", ';', ':'),
|
array("\n", "\n", ',', ':'),
|
||||||
$value);
|
$value);
|
||||||
|
|
||||||
// Split by unescaped semicolons:
|
// Split by unescaped semicolons:
|
||||||
$values = preg_split('/(?<!\\\\);/', $value);
|
$values = preg_split('/(?<!\\\\);/', $value);
|
||||||
$value = str_replace('\\;', ';', $value);
|
$value = str_replace('\\;', ';', $value);
|
||||||
$values = str_replace('\\;', ';', $values);
|
$values = str_replace('\\;', ';', $values);
|
||||||
$value = str_replace('\\,', ',', $value);
|
|
||||||
$values = str_replace('\\,', ',', $values);
|
|
||||||
$this->setAttribute($tag, trim($value), $params, true, $values);
|
$this->setAttribute($tag, trim($value), $params, true, $values);
|
||||||
} else {
|
} else {
|
||||||
$value = trim($value);
|
$value = trim($value);
|
||||||
|
Loading…
Reference in New Issue
Block a user