diff --git a/calendar/inc/class.calendar_ical.inc.php b/calendar/inc/class.calendar_ical.inc.php index 08ecee35ec..e0dfec10cb 100644 --- a/calendar/inc/class.calendar_ical.inc.php +++ b/calendar/inc/class.calendar_ical.inc.php @@ -871,6 +871,24 @@ class calendar_ical extends calendar_boupdate { $attr_name = 'X-EGROUPWARE-'.$attr_name; } + // fix certain stock fields like GEO, which are not in EGroupware schema, but Horde Icalendar requires a certain format + switch($name) + { + case '##GEO': + if (!is_array($value)) + { + if (strpos($value, ';')) + { + list($lat, $long) = explode(';', $value); + } + else + { + list($long, $lat) = explode(',', $value); + } + $value = ['latitude' => $lat, 'logitude' => $long]; + } + break; + } if ($value[0] === '{' && ($attr = json_decode($value, true)) && is_array($attr)) { // check if attribute was stored compressed --> uncompress it diff --git a/infolog/inc/class.infolog_ical.inc.php b/infolog/inc/class.infolog_ical.inc.php index 8b50ab690f..382baedea2 100644 --- a/infolog/inc/class.infolog_ical.inc.php +++ b/infolog/inc/class.infolog_ical.inc.php @@ -412,9 +412,30 @@ class infolog_ical extends infolog_bo { if (substr($name, 0, 2) == '##') { + if (($v = json_php_unserialize($value)) && is_array($v)) + { + $value = $v; + } + // fix certain stock fields like GEO, which are not in EGroupware schema, but Horde Icalendar requires a certain format + switch($name) + { + case '##GEO': + if (!is_array($value)) + { + if (strpos($value, ';') !== false) + { + list($lat, $long) = explode(';', $value); + } + else + { + list($long, $lat) = explode(',', $value); + } + $value = ['latitude' => $lat, 'logitude' => $long]; + } + break; + } if ($name[2] == ':') { - if (($v = json_php_unserialize($value)) && is_array($v)) $value = $v; foreach((array)$value as $compvData) { $comp = Horde_Icalendar::newComponent(substr($name,3), $vevent); @@ -422,9 +443,9 @@ class infolog_ical extends infolog_bo $vevent->addComponent($comp); } } - elseif (($attr = json_php_unserialize($value)) && is_array($attr)) + elseif (is_array($value)) { - $vevent->setAttribute(substr($name, 2), $attr['value'], $attr['params'], true, $attr['values']); + $vevent->setAttribute(substr($name, 2), $value['value'], $value['params'], true, $value['values']); } else {