njv: phpgwapi/groupdav work to improve groupdav compatibility and various sync proplems connected

This commit is contained in:
Klaus Leithoff 2009-04-02 12:39:52 +00:00
parent 085961d7e1
commit b8601d92d7
5 changed files with 58 additions and 28 deletions

View File

@ -145,6 +145,8 @@ class groupdav extends HTTP_WebDAV_Server
{ {
if ($this->debug > 1) error_log(__CLASS__."::$method: user=$user, app=$app, id=$id: 404 not found!"); if ($this->debug > 1) error_log(__CLASS__."::$method: user=$user, app=$app, id=$id: 404 not found!");
return '404 Not Found'; return '404 Not Found';
} }
if ($this->debug > 1) error_log(__CLASS__."::$method: user=$user, app='$app', id=$id"); if ($this->debug > 1) error_log(__CLASS__."::$method: user=$user, app='$app', id=$id");
@ -476,8 +478,9 @@ class groupdav extends HTTP_WebDAV_Server
*/ */
function _parse_path($path,&$id,&$app,&$user) function _parse_path($path,&$id,&$app,&$user)
{ {
if ($this->debug) error_log(__METHOD__." called with ('$path') id=$id, app='$app', user=$user");
$parts = explode('/',$path); $parts = explode('/',$path);
if ($this->debug) error_log(__METHOD__." called parts: ".print_r($parts,true));
if (in_array($parts[1],array('principals','groups'))) if (in_array($parts[1],array('principals','groups')))
{ {
$user = $GLOBALS['egw_info']['user']['account_id']; $user = $GLOBALS['egw_info']['user']['account_id'];

View File

@ -81,11 +81,12 @@ abstract class groupdav_handler
*/ */
function __construct($app,$debug=null,$base_uri=null) function __construct($app,$debug=null,$base_uri=null)
{ {
//error_log(__METHOD__." called");
$this->app = $app; $this->app = $app;
if (!is_null($debug)) $this->debug = $debug; #if (!is_null($debug)) $this->debug = $debug = 3;
$this->base_uri = is_null($base_uri) ? $base_uri : $_SERVER['SCRIPT_NAME']; $this->base_uri = is_null($base_uri) ? $base_uri : $_SERVER['SCRIPT_NAME'];
$this->agent = self::get_agent(); $this->agent = self::get_agent();
$this->translation =& $GLOBALS['egw']->translation; $this->translation =& $GLOBALS['egw']->translation;
$this->egw_charset = $this->translation->charset(); $this->egw_charset = $this->translation->charset();
} }
@ -171,7 +172,7 @@ abstract class groupdav_handler
} }
if (!is_array($entry) || !isset($entry['id']) || !(isset($entry['modified']) || isset($entry['etag']))) if (!is_array($entry) || !isset($entry['id']) || !(isset($entry['modified']) || isset($entry['etag'])))
{ {
error_log(__METHOD__."(".array2string($entry).") Cant create etag!"); // error_log(__METHOD__."(".array2string($entry).") Cant create etag!");
return false; return false;
} }
return '"'.$entry['id'].':'.(isset($entry['etag']) ? $entry['etag'] : $entry['modified']).'"'; return '"'.$entry['id'].':'.(isset($entry['etag']) ? $entry['etag'] : $entry['modified']).'"';
@ -303,4 +304,5 @@ abstract class groupdav_handler
} }
return $agent; return $agent;
} }
} }

View File

@ -113,8 +113,8 @@ class Horde_RPC_syncml extends Horde_RPC {
* that came up for later debugging. */ * that came up for later debugging. */
$errorLogging = ob_get_clean(); $errorLogging = ob_get_clean();
if (!empty($errorLogging)) { if (!empty($errorLogging)) {
Horde::logMessage('SyncML: caught output=' . #Horde::logMessage('SyncML: caught output=' .
$errorLogging, __FILE__, __LINE__, PEAR_LOG_DEBUG); # $errorLogging, __FILE__, __LINE__, PEAR_LOG_DEBUG);
} }
return $response; return $response;

View File

@ -48,20 +48,22 @@ class Horde_iCalendar {
{ {
# require_once 'Horde/String.php'; # require_once 'Horde/String.php';
$type = strtolower($type); $type = strtolower($type);
$class = 'Horde_iCalendar_' . strtolower($type); #error_log("called horde ical new comp". print_r($type,true) );
if (!class_exists($class)) { $class = 'Horde_iCalendar_' . strtolower($type);
include_once dirname(__FILE__) . '/iCalendar/' . $type . '.php'; if (!class_exists($class,false)) {
include_once dirname(__FILE__) . '/iCalendar/' . $type . '.php';
} }
if (class_exists($class)) { if (class_exists($class)) {
$component = &new $class(); #include_once dirname(__FILE__) . '/iCalendar/' . $type . '.php';
if ($container !== false) { $component = &new $class();
$component->_container = &$container; if ($container !== false) {
} $component->_container = &$container;
return $component; }
} else { return $component;
// Should return an dummy x-unknown type class here. } else {
return false; // Should return an dummy x-unknown type class here.
} return false;
}
} }
/** /**
@ -353,6 +355,7 @@ class Horde_iCalendar {
*/ */
function exportvCalendar() function exportvCalendar()
{ {
#error_log(__METHOD__.": called");
// Default values. // Default values.
$requiredAttributes['VERSION'] = '2.0'; $requiredAttributes['VERSION'] = '2.0';
$requiredAttributes['PRODID'] = '-//The Horde Project//Horde_iCalendar Library, Horde 3.0-cvs //EN'; $requiredAttributes['PRODID'] = '-//The Horde Project//Horde_iCalendar Library, Horde 3.0-cvs //EN';
@ -363,7 +366,10 @@ class Horde_iCalendar {
$this->setAttribute($name, $default_value); $this->setAttribute($name, $default_value);
} }
} }
//error_log(__METHOD__.":requiredAttributes->".print_r($requiredAttributes,true));
//njv:$buffcontent = ob_get_clean();
#error_log(__METHOD__.":".print_r($buffcontent,true));
#ob_end_clean();
return $this->_exportvData('VCALENDAR') . $this->_newline; return $this->_exportvData('VCALENDAR') . $this->_newline;
} }
@ -411,7 +417,8 @@ class Horde_iCalendar {
if ($clear) { if ($clear) {
$this->clear(); $this->clear();
} }
if (preg_match('/(BEGIN:' . $base . '\r?\n)([\W\w]*)(END:' . $base . '\r?\n?)/i', $text, $matches)) { error_log(__FILE__ . __METHOD__ . ":\n".$text."\n xxxxxxxxx");
if (preg_match('/(BEGIN:' . $base . '\r?\n)([\W\w]*)(END:' . $base . '\r?\n?)/i', $text, $matches)) {
$vCal = $matches[2]; $vCal = $matches[2];
} else { } else {
// Text isn't enclosed in BEGIN:VCALENDAR // Text isn't enclosed in BEGIN:VCALENDAR
@ -488,7 +495,12 @@ class Horde_iCalendar {
} }
// Charset and encoding handling. // Charset and encoding handling.
if ((isset($params['ENCODING'])
// njv sanity todo: decode text fields containing qp but not tagged
if ((isset($params['ENCODING'])
&& $params['ENCODING'] == 'QUOTED-PRINTABLE') && $params['ENCODING'] == 'QUOTED-PRINTABLE')
|| isset($params['QUOTED-PRINTABLE'])) { || isset($params['QUOTED-PRINTABLE'])) {
@ -616,9 +628,10 @@ class Horde_iCalendar {
$value = trim($value); $value = trim($value);
// As of rfc 2426 2.4.2 semi-colon, comma, and // As of rfc 2426 2.4.2 semi-colon, comma, and
// colon must be escaped. // colon must be escaped.
$value = str_replace('\\n', $this->_newline, $value); // njv an "urban myth" a colon is tsafe and should not be escaped
$value = str_replace('\\n', $this->_newline, $value);
$value = str_replace('\\,', ',', $value); $value = str_replace('\\,', ',', $value);
$value = str_replace('\\:', ':', $value); //njv:$value = str_replace('\\:', ':', $value);
// Split by unescaped semi-colons: // Split by unescaped semi-colons:
$values = preg_split('/(?<!\\\\);/',$value); $values = preg_split('/(?<!\\\\);/',$value);
@ -630,12 +643,19 @@ class Horde_iCalendar {
// String fields. // String fields.
default: default:
$value = trim($value);
// As of rfc 2426 2.4.2 semi-colon, comma, and $value = trim($value);
//sanity $value should not contain qp
if(preg_match('/^=[24]/',$value)){
error_log(__FILE__ .__METHOD__ ."?qp decoded : ". print_r($value , true));
quoted_printable_decode($value);
}
// As of rfc 2426 2.4.2 semi-colon, comma, and
// colon must be escaped. // colon must be escaped.
$value = str_replace('\\n', $this->_newline, $value); $value = str_replace('\\n', $this->_newline, $value);
$value = str_replace('\\;', ';', $value); $value = str_replace('\\;', ';', $value);
$value = str_replace('\\:', ':', $value); //njv:$value = str_replace('\\:', ':', $value);
// Split by unescaped commas: // Split by unescaped commas:
$values = preg_split('/(?<!\\\\),/',$value); $values = preg_split('/(?<!\\\\),/',$value);
@ -784,7 +804,8 @@ class Horde_iCalendar {
#$value = str_replace($this->_newline, '\n', $value); #$value = str_replace($this->_newline, '\n', $value);
$value = str_replace(',', '\,', $value); $value = str_replace(',', '\,', $value);
$value = str_replace(';', '\;', $value); $value = str_replace(';', '\;', $value);
$value = str_replace(':', '\:', $value); //njv:RFC 2445 says very definately NO!
//$value = str_replace(':', '\:', $value);
break; break;
default: default:

View File

@ -64,6 +64,10 @@ class Horde_iCalendar_vcard extends Horde_iCalendar {
$this->setAttribute($name, $default_value); $this->setAttribute($name, $default_value);
} }
} }
//error_log(__METHOD__.":requiredAttributes->".print_r($requiredAttributes,true));
//njv:$buffcontent = ob_get_clean();
#error_log(__METHOD__.":".print_r($buffcontent,true));
#ob_end_clean();
return $this->_exportvData('VCARD') . $this->_newline; return $this->_exportvData('VCARD') . $this->_newline;
} }