mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-24 17:04:14 +01:00
fix PHP 8.0 TypeError: Cannot access offset of type string on string, when iCal exporting a GEO attributes
This commit is contained in:
parent
519114ea1a
commit
2944a00e02
@ -871,6 +871,24 @@ class calendar_ical extends calendar_boupdate
|
|||||||
{
|
{
|
||||||
$attr_name = 'X-EGROUPWARE-'.$attr_name;
|
$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))
|
if ($value[0] === '{' && ($attr = json_decode($value, true)) && is_array($attr))
|
||||||
{
|
{
|
||||||
// check if attribute was stored compressed --> uncompress it
|
// check if attribute was stored compressed --> uncompress it
|
||||||
|
@ -412,9 +412,30 @@ class infolog_ical extends infolog_bo
|
|||||||
{
|
{
|
||||||
if (substr($name, 0, 2) == '##')
|
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 ($name[2] == ':')
|
||||||
{
|
{
|
||||||
if (($v = json_php_unserialize($value)) && is_array($v)) $value = $v;
|
|
||||||
foreach((array)$value as $compvData)
|
foreach((array)$value as $compvData)
|
||||||
{
|
{
|
||||||
$comp = Horde_Icalendar::newComponent(substr($name,3), $vevent);
|
$comp = Horde_Icalendar::newComponent(substr($name,3), $vevent);
|
||||||
@ -422,9 +443,9 @@ class infolog_ical extends infolog_bo
|
|||||||
$vevent->addComponent($comp);
|
$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
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user