read debugdir from egw config

This commit is contained in:
Lars Kneschke 2005-12-25 16:41:35 +00:00
parent afaa6f2815
commit 6f05e93e26
4 changed files with 95 additions and 70 deletions

View File

@ -160,87 +160,97 @@
); );
} }
break; break;
case 'CLASS':
$attributes['CLASS'] = $event['public'] ? 'PUBLIC' : 'PRIVATE'; case 'CLASS':
break; $attributes['CLASS'] = $event['public'] ? 'PUBLIC' : 'PRIVATE';
case 'ORGANIZER': // according to iCalendar standard, ORGANIZER not used for events in the own calendar break;
if (!isset($event['participants'][$event['owner']]) || count($event['participants']) > 1)
{ case 'ORGANIZER': // according to iCalendar standard, ORGANIZER not used for events in the own calendar
if (!isset($event['participants'][$event['owner']]) || count($event['participants']) > 1)
{
$mailtoOrganizer = $GLOBALS['egw']->accounts->id2name($event['owner'],'account_email'); $mailtoOrganizer = $GLOBALS['egw']->accounts->id2name($event['owner'],'account_email');
$attributes['ORGANIZER'] = $mailtoOrganizer ? 'MAILTO:'.$mailtoOrganizer : ''; $attributes['ORGANIZER'] = $mailtoOrganizer ? 'MAILTO:'.$mailtoOrganizer : '';
$parameters['ORGANIZER']['CN'] = trim($GLOBALS['egw']->accounts->id2name($event['owner'],'account_firstname').' '. $parameters['ORGANIZER']['CN'] = trim($GLOBALS['egw']->accounts->id2name($event['owner'],'account_firstname').' '.
$GLOBALS['egw']->accounts->id2name($event['owner'],'account_lastname')); $GLOBALS['egw']->accounts->id2name($event['owner'],'account_lastname'));
} }
break; break;
case 'DTEND': case 'DTEND':
if(date('H:i:s',$event['end']) == '23:59:59') $event['end']++; if(date('H:i:s',$event['end']) == '23:59:59') $event['end']++;
$attributes[$icalFieldName] = $event['end']; $attributes[$icalFieldName] = $event['end'];
break; break;
case 'RRULE':
if ($event['recur_type'] == MCAL_RECUR_NONE) break; // no recuring event case 'RRULE':
$rrule = array('FREQ' => $this->recur_egw2ical[$event['recur_type']]); if ($event['recur_type'] == MCAL_RECUR_NONE) break; // no recuring event
switch ($event['recur_type']) $rrule = array('FREQ' => $this->recur_egw2ical[$event['recur_type']]);
{ switch ($event['recur_type'])
case MCAL_RECUR_WEEKLY: {
$days = array(); case MCAL_RECUR_WEEKLY:
foreach($this->recur_days as $id => $day) $days = array();
{ foreach($this->recur_days as $id => $day)
if ($event['recur_data'] & $id) $days[] = strtoupper(substr($day,0,2)); {
} if ($event['recur_data'] & $id) $days[] = strtoupper(substr($day,0,2));
$rrule['BYDAY'] = implode(',',$days); }
break; $rrule['BYDAY'] = implode(',',$days);
case MCAL_RECUR_MONTHLY_MDAY: // date of the month: BYMONTDAY={1..31} break;
$rrule['BYMONTHDAY'] = (int) date('d',$event['start']);
break; case MCAL_RECUR_MONTHLY_MDAY: // date of the month: BYMONTDAY={1..31}
case MCAL_RECUR_MONTHLY_WDAY: // weekday of the month: BDAY={1..5}{MO..SO} $rrule['BYMONTHDAY'] = (int) date('d',$event['start']);
$rrule['BYDAY'] = (1 + (int) ((date('d',$event['start'])-1) / 7)). break;
strtoupper(substr(date('l',$event['start']),0,2));
break; case MCAL_RECUR_MONTHLY_WDAY: // weekday of the month: BDAY={1..5}{MO..SO}
} $rrule['BYDAY'] = (1 + (int) ((date('d',$event['start'])-1) / 7)).
if ($event['recur_interval'] > 1) $rrule['INTERVAL'] = $event['recur_interval']; strtoupper(substr(date('l',$event['start']),0,2));
if ($event['recur_enddate']) $rrule['UNTIL'] = date('Ymd',$event['recur_enddate']); // only day is set in eGW break;
// no idea how to get the Horde parser to produce a standard conformant }
// RRULE:FREQ=... (note the double colon after RRULE, we cant use the $parameter array) if ($event['recur_interval'] > 1) $rrule['INTERVAL'] = $event['recur_interval'];
// so we create one value manual ;-) if ($event['recur_enddate']) $rrule['UNTIL'] = date('Ymd',$event['recur_enddate']); // only day is set in eGW
foreach($rrule as $name => $value) // no idea how to get the Horde parser to produce a standard conformant
{ // RRULE:FREQ=... (note the double colon after RRULE, we cant use the $parameter array)
$attributes['RRULE'][] = $name . '=' . $value; // so we create one value manual ;-)
} foreach($rrule as $name => $value)
$attributes['RRULE'] = implode(';',$attributes['RRULE']); {
break; $attributes['RRULE'][] = $name . '=' . $value;
case 'EXDATE': }
if ($event['recur_exception']) $attributes['RRULE'] = implode(';',$attributes['RRULE']);
{ break;
$days = array();
foreach($event['recur_exception'] as $day) case 'EXDATE':
{ if ($event['recur_exception'])
$days[] = date('Ymd',$day); {
} $days = array();
$attributes['EXDATE'] = implode(',',$days); foreach($event['recur_exception'] as $day)
$parameters['EXDATE']['VALUE'] = 'DATE'; {
} $days[] = date('Ymd',$day);
break; }
case 'PRIORITY': $attributes['EXDATE'] = implode(',',$days);
$parameters['EXDATE']['VALUE'] = 'DATE';
}
break;
case 'PRIORITY':
$attributes['PRIORITY'] = (int) $this->priority_egw2ical[$event['priority']]; $attributes['PRIORITY'] = (int) $this->priority_egw2ical[$event['priority']];
break; break;
case 'TRANSP': case 'TRANSP':
$attributes['TRANSP'] = $event['non_blocking'] ? 'TRANSPARENT' : 'OPAQUE'; $attributes['TRANSP'] = $event['non_blocking'] ? 'TRANSPARENT' : 'OPAQUE';
break; break;
case 'CATEGORIES': case 'CATEGORIES':
if ($event['category']) if ($event['category'])
{ {
$attributes['CATEGORIES'] = implode(',',$this->categories($event['category'],$nul)); $attributes['CATEGORIES'] = implode(',',$this->categories($event['category'],$nul));
} }
break; break;
default: default:
if ($event[$egwFieldInfo['dbName']]) // dont write empty fields if ($event[$egwFieldInfo['dbName']]) // dont write empty fields
{ {
$attributes[$icalFieldName] = $event[$egwFieldInfo['dbName']]; $attributes[$icalFieldName] = $event[$egwFieldInfo['dbName']];
} }
break; break;
} }
} }
} }
$modified = $GLOBALS['egw']->contenthistory->getTSforAction($eventGUID,'modify'); $modified = $GLOBALS['egw']->contenthistory->getTSforAction($eventGUID,'modify');
$created = $GLOBALS['egw']->contenthistory->getTSforAction($eventGUID,'add'); $created = $GLOBALS['egw']->contenthistory->getTSforAction($eventGUID,'add');
if (!$created && !$modified) $created = $event['modified']; if (!$created && !$modified) $created = $event['modified'];
@ -280,6 +290,7 @@
function importVCal($_vcalData, $cal_id=-1) function importVCal($_vcalData, $cal_id=-1)
{ {
error_log('CALENDAR('.__LINE__.") $cal_id");
// our (patched) horde classes, do NOT unfold folded lines, which causes a lot trouble in the import // our (patched) horde classes, do NOT unfold folded lines, which causes a lot trouble in the import
$_vcalData = preg_replace("/[\r\n]+ /",'',$_vcalData); $_vcalData = preg_replace("/[\r\n]+ /",'',$_vcalData);
@ -341,7 +352,7 @@
{ {
$vcardData['recur_interval'] = (int) $matches[1]; $vcardData['recur_interval'] = (int) $matches[1];
} }
$vcardData['recur_data'] = 0; $vcardData['recur_data'] = 0;
switch($type) switch($type)
{ {
case 'W': case 'W':
@ -404,9 +415,9 @@
break; break;
} }
break; break;
case 'EXDATE': case 'EXDATE':
// ToDo: $vcardData['recur_exception'] = ... // ToDo: $vcardData['recur_exception'] = ...
break; break;
case 'SUMMARY': case 'SUMMARY':
$vcardData['title'] = $attributes['value']; $vcardData['title'] = $attributes['value'];
break; break;
@ -421,7 +432,7 @@
case 'TRANSP': case 'TRANSP':
$vcardData['non_blocking'] = $attributes['value'] == 'TRANSPARENT'; $vcardData['non_blocking'] = $attributes['value'] == 'TRANSPARENT';
break; break;
case 'PRIORITY': case 'PRIORITY':
$vcardData['priority'] = (int) $this->priority_ical2egw[$attributes['value']]; $vcardData['priority'] = (int) $this->priority_ical2egw[$attributes['value']];
break; break;
case 'CATEGORIES': case 'CATEGORIES':
@ -541,7 +552,9 @@
switch(strtolower($_productName)) switch(strtolower($_productName))
{ {
default: default:
$this->supportedFields = $defaultFields + array('participants' => 'participants'); # participants disabled until working correctly
#$this->supportedFields = $defaultFields + array('participants' => 'participants');
$this->supportedFields = $defaultFields;
break; break;
} }
break; break;

View File

@ -69,6 +69,10 @@ class Horde_RPC_syncml extends Horde_RPC {
// that's not part of the valid response. // that's not part of the valid response.
ob_start(); ob_start();
if(isset($GLOBALS['config_syncml']['syncml_debug_dir']))
{
$this->_debugDir = $GLOBALS['config_syncml']['syncml_debug_dir'];
}
// Very useful for debugging. Logs XML packets to // Very useful for debugging. Logs XML packets to
// $this->_debugDir. // $this->_debugDir.
if (!empty($this->_debugDir) && is_dir($this->_debugDir)) { if (!empty($this->_debugDir) && is_dir($this->_debugDir)) {

View File

@ -37,6 +37,10 @@ class Horde_RPC_syncml_wbxml extends Horde_RPC_syncml {
// that's not part of the valid response. // that's not part of the valid response.
ob_start(); ob_start();
if(isset($GLOBALS['config_syncml']['syncml_debug_dir']))
{
$this->_debugDir = $GLOBALS['config_syncml']['syncml_debug_dir'];
}
// Very useful for debugging. Logs WBXML packets to // Very useful for debugging. Logs WBXML packets to
// $this->_debugDir. // $this->_debugDir.
if (!empty($this->_debugDir) && is_dir($this->_debugDir)) { if (!empty($this->_debugDir) && is_dir($this->_debugDir)) {

View File

@ -26,10 +26,14 @@ include('./header.inc.php');
// SyncML works currently only with PHP sessions // SyncML works currently only with PHP sessions
if($GLOBALS['egw_info']['server']['sessions_type'] == 'db') if($GLOBALS['egw_info']['server']['sessions_type'] == 'db')
{ {
error_log('SyncML support is not available with DB sessions. Please switch to PHP4 sessions in header.inc.php.'); error_log('SyncML support is currently not available with DB sessions. Please switch to PHP4 sessions in header.inc.php.');
exit; exit;
} }
$config =& CreateObject('phpgwapi.config','syncml');
$config->read_repository();
$GLOBALS['config_syncml'] =& $config->config_data;
unset($config);
/* Look at the Content-type of the request, if it is available, to try /* Look at the Content-type of the request, if it is available, to try
* and determine what kind of request this is. */ * and determine what kind of request this is. */