forked from extern/egroupware
Fix various issues introduced with Funambol adjustments; code cleanup
This commit is contained in:
parent
70aee0a67d
commit
548f5f8c98
@ -219,6 +219,12 @@ class addressbook_vcal extends addressbook_bo
|
|||||||
{
|
{
|
||||||
$size = $this->clientProperties[$vcardField]['Size'];
|
$size = $this->clientProperties[$vcardField]['Size'];
|
||||||
$noTruncate = $this->clientProperties[$vcardField]['NoTruncate'];
|
$noTruncate = $this->clientProperties[$vcardField]['NoTruncate'];
|
||||||
|
if ($this->log && $size > 0)
|
||||||
|
{
|
||||||
|
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ .
|
||||||
|
"() $vcardField Size: $size, NoTruncate: " .
|
||||||
|
($noTruncate ? 'TRUE' : 'FALSE') . "\n",3,$this->logfile);
|
||||||
|
}
|
||||||
//Horde::logMessage("vCalAddressbook $vcardField Size: $size, NoTruncate: " .
|
//Horde::logMessage("vCalAddressbook $vcardField Size: $size, NoTruncate: " .
|
||||||
// ($noTruncate ? 'TRUE' : 'FALSE'), __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
// ($noTruncate ? 'TRUE' : 'FALSE'), __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||||
}
|
}
|
||||||
@ -292,7 +298,11 @@ class addressbook_vcal extends addressbook_bo
|
|||||||
$value = $values[0];
|
$value = $values[0];
|
||||||
if (strlen($value) > $size)
|
if (strlen($value) > $size)
|
||||||
{
|
{
|
||||||
error_log(__FILE__ . __LINE__ . __METHOD__ . " vCalAddressbook $vcardField omitted due to maximum size $size");
|
if ($this->log)
|
||||||
|
{
|
||||||
|
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ .
|
||||||
|
"() $vcardField omitted due to maximum size $size\n",3,$this->logfile);
|
||||||
|
}
|
||||||
// Horde::logMessage("vCalAddressbook $vcardField omitted due to maximum size $size",
|
// Horde::logMessage("vCalAddressbook $vcardField omitted due to maximum size $size",
|
||||||
// __FILE__, __LINE__, PEAR_LOG_WARNING);
|
// __FILE__, __LINE__, PEAR_LOG_WARNING);
|
||||||
continue;
|
continue;
|
||||||
@ -332,7 +342,11 @@ class addressbook_vcal extends addressbook_bo
|
|||||||
{
|
{
|
||||||
if ($noTruncate)
|
if ($noTruncate)
|
||||||
{
|
{
|
||||||
error_log(__FILE__ . __LINE__ . __METHOD__ . " vCalAddressbook $vcardField omitted due to maximum size $size");
|
if ($this->log)
|
||||||
|
{
|
||||||
|
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ .
|
||||||
|
"() $vcardField omitted due to maximum size $size\n",3,$this->logfile);
|
||||||
|
}
|
||||||
// Horde::logMessage("vCalAddressbook $vcardField omitted due to maximum size $size",
|
// Horde::logMessage("vCalAddressbook $vcardField omitted due to maximum size $size",
|
||||||
// __FILE__, __LINE__, PEAR_LOG_WARNING);
|
// __FILE__, __LINE__, PEAR_LOG_WARNING);
|
||||||
continue;
|
continue;
|
||||||
@ -348,7 +362,11 @@ class addressbook_vcal extends addressbook_bo
|
|||||||
{
|
{
|
||||||
$value = '';
|
$value = '';
|
||||||
}
|
}
|
||||||
error_log(__FILE__ . __LINE__ . __METHOD__ . " vCalAddressbook $vcardField truncated to maximum size $size");
|
if ($this->log)
|
||||||
|
{
|
||||||
|
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ .
|
||||||
|
"() $vcardField truncated to maximum size $size\n",3,$this->logfile);
|
||||||
|
}
|
||||||
//Horde::logMessage("vCalAddressbook $vcardField truncated to maximum size $size",
|
//Horde::logMessage("vCalAddressbook $vcardField truncated to maximum size $size",
|
||||||
// __FILE__, __LINE__, PEAR_LOG_INFO);
|
// __FILE__, __LINE__, PEAR_LOG_INFO);
|
||||||
}
|
}
|
||||||
@ -371,10 +389,6 @@ class addressbook_vcal extends addressbook_bo
|
|||||||
}
|
}
|
||||||
elseif ($this->productManufacturer == 'funambol')
|
elseif ($this->productManufacturer == 'funambol')
|
||||||
{
|
{
|
||||||
if ($this->productName == 'mozilla sync client')
|
|
||||||
{
|
|
||||||
$valueData = str_replace( "\n", '\\n', $valueData);
|
|
||||||
}
|
|
||||||
$options['ENCODING'] = 'FUNAMBOL-QP';
|
$options['ENCODING'] = 'FUNAMBOL-QP';
|
||||||
}
|
}
|
||||||
elseif (preg_match('/([\000-\012\015\016\020-\037\075])/', $value))
|
elseif (preg_match('/([\000-\012\015\016\020-\037\075])/', $value))
|
||||||
@ -683,8 +697,6 @@ class addressbook_vcal extends addressbook_bo
|
|||||||
// E.g. ADR will be either ADR;WORK, if no ADR;WORK is given,
|
// E.g. ADR will be either ADR;WORK, if no ADR;WORK is given,
|
||||||
// or else ADR;HOME, if not available elsewhere.
|
// or else ADR;HOME, if not available elsewhere.
|
||||||
|
|
||||||
//error_log(print_r($rowNames, true));
|
|
||||||
|
|
||||||
$finalRowNames = array();
|
$finalRowNames = array();
|
||||||
|
|
||||||
foreach ($rowNames as $vcardKey => $rowName)
|
foreach ($rowNames as $vcardKey => $rowName)
|
||||||
@ -836,9 +848,6 @@ class addressbook_vcal extends addressbook_bo
|
|||||||
array2string($finalRowNames)."\n",3,$this->logfile);
|
array2string($finalRowNames)."\n",3,$this->logfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
//error_log(print_r($finalRowNames, true));
|
|
||||||
|
|
||||||
|
|
||||||
$contact = array();
|
$contact = array();
|
||||||
|
|
||||||
foreach ($finalRowNames as $key => $vcardKey)
|
foreach ($finalRowNames as $key => $vcardKey)
|
||||||
|
@ -583,8 +583,14 @@ class calendar_ical extends calendar_boupdate
|
|||||||
{
|
{
|
||||||
$size = $this->clientProperties[$icalFieldName]['Size'];
|
$size = $this->clientProperties[$icalFieldName]['Size'];
|
||||||
$noTruncate = $this->clientProperties[$icalFieldName]['NoTruncate'];
|
$noTruncate = $this->clientProperties[$icalFieldName]['NoTruncate'];
|
||||||
#Horde::logMessage("vCalendar $icalFieldName Size: $size, NoTruncate: " .
|
if ($this->log && $size > 0)
|
||||||
# ($noTruncate ? 'TRUE' : 'FALSE'), __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
{
|
||||||
|
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ .
|
||||||
|
"() $icalFieldName Size: $size, NoTruncate: " .
|
||||||
|
($noTruncate ? 'TRUE' : 'FALSE') . "\n",3,$this->logfile);
|
||||||
|
}
|
||||||
|
//Horde::logMessage("vCalendar $icalFieldName Size: $size, NoTruncate: " .
|
||||||
|
// ($noTruncate ? 'TRUE' : 'FALSE'), __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -597,14 +603,24 @@ class calendar_ical extends calendar_boupdate
|
|||||||
{
|
{
|
||||||
if ($noTruncate)
|
if ($noTruncate)
|
||||||
{
|
{
|
||||||
Horde::logMessage("vCalendar $icalFieldName omitted due to maximum size $size",
|
if ($this->log)
|
||||||
__FILE__, __LINE__, PEAR_LOG_WARNING);
|
{
|
||||||
|
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ .
|
||||||
|
"() $icalFieldName omitted due to maximum size $size\n",3,$this->logfile);
|
||||||
|
}
|
||||||
|
//Horde::logMessage("vCalendar $icalFieldName omitted due to maximum size $size",
|
||||||
|
// __FILE__, __LINE__, PEAR_LOG_WARNING);
|
||||||
continue; // skip field
|
continue; // skip field
|
||||||
}
|
}
|
||||||
// truncate the value to size
|
// truncate the value to size
|
||||||
$value = substr($value, 0, $size - 1);
|
$value = substr($value, 0, $size - 1);
|
||||||
Horde::logMessage("vCalendar $icalFieldName truncated to maximum size $size",
|
if ($this->log)
|
||||||
__FILE__, __LINE__, PEAR_LOG_INFO);
|
{
|
||||||
|
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ .
|
||||||
|
"() $icalFieldName truncated to maximum size $size\n",3,$this->logfile);
|
||||||
|
}
|
||||||
|
//Horde::logMessage("vCalendar $icalFieldName truncated to maximum size $size",
|
||||||
|
// __FILE__, __LINE__, PEAR_LOG_INFO);
|
||||||
}
|
}
|
||||||
if (!empty($value) || ($size >= 0 && !$noTruncate))
|
if (!empty($value) || ($size >= 0 && !$noTruncate))
|
||||||
{
|
{
|
||||||
@ -706,12 +722,11 @@ class calendar_ical extends calendar_boupdate
|
|||||||
$GLOBALS['egw']->translation->charset(),'UTF-8');
|
$GLOBALS['egw']->translation->charset(),'UTF-8');
|
||||||
$valuesData = (array) $GLOBALS['egw']->translation->convert($values[$key],
|
$valuesData = (array) $GLOBALS['egw']->translation->convert($values[$key],
|
||||||
$GLOBALS['egw']->translation->charset(),'UTF-8');
|
$GLOBALS['egw']->translation->charset(),'UTF-8');
|
||||||
//echo "$key:$valueID: value=$valueData, param=".print_r($paramDate,true)."\n";
|
|
||||||
// attendees or organizer CN can contain utf-8 content
|
|
||||||
$paramData['CHARSET'] = 'UTF-8';
|
|
||||||
if (preg_match('/[^\x20-\x7F]/', $valueData) ||
|
if (preg_match('/[^\x20-\x7F]/', $valueData) ||
|
||||||
($paramData['CN'] && preg_match('/[^\x20-\x7F]/', $paramData['CN'])))
|
($paramData['CN'] && preg_match('/[^\x20-\x7F]/', $paramData['CN'])))
|
||||||
{
|
{
|
||||||
|
$paramData['CHARSET'] = 'UTF-8';
|
||||||
switch ($this->productManufacturer)
|
switch ($this->productManufacturer)
|
||||||
{
|
{
|
||||||
case 'groupdav':
|
case 'groupdav':
|
||||||
@ -733,13 +748,10 @@ class calendar_ical extends calendar_boupdate
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'funambol':
|
case 'funambol':
|
||||||
if ($this->productName == 'mozilla sync client')
|
|
||||||
{
|
|
||||||
$valueData = str_replace( "\n", '\\n', $valueData);
|
|
||||||
}
|
|
||||||
$paramData['ENCODING'] = 'FUNAMBOL-QP';
|
$paramData['ENCODING'] = 'FUNAMBOL-QP';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
if (preg_match('/([\000-\012])/', $valueData))
|
if (preg_match('/([\000-\012])/', $valueData))
|
||||||
{
|
{
|
||||||
if ($this->log)
|
if ($this->log)
|
||||||
@ -748,6 +760,7 @@ class calendar_ical extends calendar_boupdate
|
|||||||
"() Has invalid XML data: $valueData",3,$this->logfile);
|
"() Has invalid XML data: $valueData",3,$this->logfile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
$vevent->setAttribute($key, $valueData, $paramData, true, $valuesData);
|
$vevent->setAttribute($key, $valueData, $paramData, true, $valuesData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1334,7 +1347,6 @@ class calendar_ical extends calendar_boupdate
|
|||||||
'owner' => 'owner',
|
'owner' => 'owner',
|
||||||
'category' => 'category',
|
'category' => 'category',
|
||||||
'non_blocking' => 'non_blocking',
|
'non_blocking' => 'non_blocking',
|
||||||
'recurrence' => 'recurrence',
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$defaultFields['evolution'] = $defaultFields['basic'] + array(
|
$defaultFields['evolution'] = $defaultFields['basic'] + array(
|
||||||
|
@ -170,8 +170,14 @@ class infolog_ical extends infolog_bo
|
|||||||
{
|
{
|
||||||
$size = $this->clientProperties[$field]['Size'];
|
$size = $this->clientProperties[$field]['Size'];
|
||||||
$noTruncate = $this->clientProperties[$field]['NoTruncate'];
|
$noTruncate = $this->clientProperties[$field]['NoTruncate'];
|
||||||
#Horde::logMessage("VTODO $field Size: $size, NoTruncate: " .
|
if ($this->log && $size > 0)
|
||||||
# ($noTruncate ? 'TRUE' : 'FALSE'), __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
{
|
||||||
|
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ .
|
||||||
|
"() $field Size: $size, NoTruncate: " .
|
||||||
|
($noTruncate ? 'TRUE' : 'FALSE') . "\n",3,$this->logfile);
|
||||||
|
}
|
||||||
|
//Horde::logMessage("VTODO $field Size: $size, NoTruncate: " .
|
||||||
|
// ($noTruncate ? 'TRUE' : 'FALSE'), __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -183,30 +189,40 @@ class infolog_ical extends infolog_bo
|
|||||||
{
|
{
|
||||||
if ($noTruncate)
|
if ($noTruncate)
|
||||||
{
|
{
|
||||||
Horde::logMessage("VTODO $field omitted due to maximum size $size",
|
if ($this->log)
|
||||||
__FILE__, __LINE__, PEAR_LOG_WARNING);
|
{
|
||||||
|
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ .
|
||||||
|
"() $field omitted due to maximum size $size\n",3,$this->logfile);
|
||||||
|
}
|
||||||
|
//Horde::logMessage("VTODO $field omitted due to maximum size $size",
|
||||||
|
// __FILE__, __LINE__, PEAR_LOG_WARNING);
|
||||||
continue; // skip field
|
continue; // skip field
|
||||||
}
|
}
|
||||||
// truncate the value to size
|
// truncate the value to size
|
||||||
$value = substr($value, 0, $size -1);
|
$value = substr($value, 0, $size -1);
|
||||||
#Horde::logMessage("VTODO $field truncated to maximum size $size",
|
if ($this->log)
|
||||||
# __FILE__, __LINE__, PEAR_LOG_INFO);
|
{
|
||||||
|
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ .
|
||||||
|
"() $field truncated to maximum size $size\n",3,$this->logfile);
|
||||||
|
}
|
||||||
|
//Horde::logMessage("VTODO $field truncated to maximum size $size",
|
||||||
|
// __FILE__, __LINE__, PEAR_LOG_INFO);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($value) && ($size < 0 || $noTruncate)) continue;
|
if (empty($value) && ($size < 0 || $noTruncate)) continue;
|
||||||
|
|
||||||
if ($field == 'RELATED-TO')
|
if ($field == 'RELATED-TO')
|
||||||
{
|
{
|
||||||
$options = array('RELTYPE' => 'PARENT',
|
$options = array('RELTYPE' => 'PARENT');
|
||||||
'CHARSET' => 'UTF-8');
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$options = array('CHARSET' => 'UTF-8');
|
$options = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preg_match('/[^\x20-\x7F]/', $value))
|
if (preg_match('/[^\x20-\x7F]/', $value))
|
||||||
{
|
{
|
||||||
|
$options['CHARSET'] = 'UTF-8';
|
||||||
switch ($this->productManufacturer)
|
switch ($this->productManufacturer)
|
||||||
{
|
{
|
||||||
case 'groupdav':
|
case 'groupdav':
|
||||||
@ -229,10 +245,6 @@ class infolog_ical extends infolog_bo
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'funambol':
|
case 'funambol':
|
||||||
if ($this->productName == 'mozilla sync client')
|
|
||||||
{
|
|
||||||
$value = str_replace( "\n", '\\n', $value);
|
|
||||||
}
|
|
||||||
$options['ENCODING'] = 'FUNAMBOL-QP';
|
$options['ENCODING'] = 'FUNAMBOL-QP';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -268,7 +280,7 @@ class infolog_ical extends infolog_bo
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$priority = (int) $this->priority_egw2ical2[$taskData['info_priority']];
|
$priority = (int) $this->priority_egw2ical[$taskData['info_priority']];
|
||||||
}
|
}
|
||||||
$vevent->setAttribute('PRIORITY', $priority);
|
$vevent->setAttribute('PRIORITY', $priority);
|
||||||
|
|
||||||
@ -584,9 +596,10 @@ class infolog_ical extends infolog_bo
|
|||||||
'CATEGORIES' => $note['info_cat'],
|
'CATEGORIES' => $note['info_cat'],
|
||||||
) as $field => $value)
|
) as $field => $value)
|
||||||
{
|
{
|
||||||
$options = array('CHARSET' => 'UTF-8');
|
$options = array();
|
||||||
if (preg_match('/[^\x20-\x7F]/', $value))
|
if (preg_match('/[^\x20-\x7F]/', $value))
|
||||||
{
|
{
|
||||||
|
$options['CHARSET'] = 'UTF-8';
|
||||||
switch ($this->productManufacturer)
|
switch ($this->productManufacturer)
|
||||||
{
|
{
|
||||||
case 'groupdav':
|
case 'groupdav':
|
||||||
@ -609,10 +622,6 @@ class infolog_ical extends infolog_bo
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'funambol':
|
case 'funambol':
|
||||||
if ($this->productName == 'mozilla sync client')
|
|
||||||
{
|
|
||||||
$value = str_replace( "\n", '\\n', $value);
|
|
||||||
}
|
|
||||||
$options['ENCODING'] = 'FUNAMBOL-QP';
|
$options['ENCODING'] = 'FUNAMBOL-QP';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1128,10 +1128,17 @@ class Horde_iCalendar {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($params['ENCODING']) && strlen(trim($value))) {
|
$encoding = (!empty($params['ENCODING']) && strlen(trim($value)) > 0);
|
||||||
|
|
||||||
|
if ($encoding) {
|
||||||
switch($params['ENCODING']) {
|
switch($params['ENCODING']) {
|
||||||
case 'Q':
|
case 'Q':
|
||||||
case 'QUOTED-PRINTABLE':
|
case 'QUOTED-PRINTABLE':
|
||||||
|
if (!$this->isOldFormat())
|
||||||
|
{
|
||||||
|
$enconding = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
$params_str .= ';ENCODING=' . $params['ENCODING'];
|
$params_str .= ';ENCODING=' . $params['ENCODING'];
|
||||||
$value = str_replace("\r", '', $value);
|
$value = str_replace("\r", '', $value);
|
||||||
$result .= $name . $params_str . ':'
|
$result .= $name . $params_str . ':'
|
||||||
@ -1140,9 +1147,14 @@ class Horde_iCalendar {
|
|||||||
. $this->_newline;
|
. $this->_newline;
|
||||||
break;
|
break;
|
||||||
case 'FUNAMBOL-QP':
|
case 'FUNAMBOL-QP':
|
||||||
// Funambol does not support wrapping and needs some special quoting
|
// Funambol needs some special quoting
|
||||||
$params_str .= ';ENCODING=QUOTED-PRINTABLE';
|
|
||||||
$value = str_replace(array('<', "\r"), array('<', ''), $value);
|
$value = str_replace(array('<', "\r"), array('<', ''), $value);
|
||||||
|
if (!$this->isOldFormat())
|
||||||
|
{
|
||||||
|
$encoding = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$params_str .= ';ENCODING=QUOTED-PRINTABLE';
|
||||||
$result .= $name . $params_str . ':'
|
$result .= $name . $params_str . ':'
|
||||||
. str_replace('=0A', '=0D=0A',
|
. str_replace('=0A', '=0D=0A',
|
||||||
$this->_quotedPrintableEncode($value, false))
|
$this->_quotedPrintableEncode($value, false))
|
||||||
@ -1159,7 +1171,9 @@ class Horde_iCalendar {
|
|||||||
$result .= $this->_newline; // Append an empty line
|
$result .= $this->_newline; // Append an empty line
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
if (!$encoding) {
|
||||||
$value = str_replace(array("\r", "\n"), array('', '\\n'), $value);
|
$value = str_replace(array("\r", "\n"), array('', '\\n'), $value);
|
||||||
$attr_string = $name . $params_str;
|
$attr_string = $name . $params_str;
|
||||||
if (strlen($value) > 0) {
|
if (strlen($value) > 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user