mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-09 15:38:27 +01:00
syncml fixes
This commit is contained in:
parent
760fe6d459
commit
f4003a2e55
@ -465,26 +465,52 @@
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'D': // 1.0
|
case 'D': // 1.0
|
||||||
if(!preg_match('/D(\d+) (.*)/',$recurence, $recurenceMatches)) break;
|
if(preg_match('/D(\d+) #(.\d)/', $recurence, $recurenceMatches)) {
|
||||||
$vcardData['recur_interval'] = $recurenceMatches[1];
|
$vcardData['recur_interval'] = $recurenceMatches[1];
|
||||||
if($recurenceMatches[2] != '#0')
|
if($recurenceMatches[2] > 0 && $vcardData['end']) {
|
||||||
|
$vcardData['recur_enddate'] = mktime(
|
||||||
|
date('H', $vcardData['end']),
|
||||||
|
date('i', $vcardData['end']),
|
||||||
|
date('s', $vcardData['end']),
|
||||||
|
date('m', $vcardData['end']),
|
||||||
|
date('d', $vcardData['end']) + ($recurenceMatches[2] * $vcardData['recur_interval']),
|
||||||
|
date('Y', $vcardData['end']),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} elseif(preg_match('/D(\d+) (.*)/', $recurence, $recurenceMatches)) {
|
||||||
|
$vcardData['recur_interval'] = $recurenceMatches[1];
|
||||||
|
if($recurenceMatches[2] != '#0') {
|
||||||
$vcardData['recur_enddate'] = $vcal->_parseDateTime($recurenceMatches[2]);
|
$vcardData['recur_enddate'] = $vcal->_parseDateTime($recurenceMatches[2]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
// fall-through
|
// fall-through
|
||||||
case 'DAILY': // 2.0
|
case 'DAILY': // 2.0
|
||||||
$vcardData['recur_type'] = MCAL_RECUR_DAILY;
|
$vcardData['recur_type'] = MCAL_RECUR_DAILY;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'M':
|
case 'M':
|
||||||
if(preg_match('/MD(\d+) (.*)/',$recurence, $recurenceMatches))
|
if(preg_match('/MD(\d+) #(.\d)/', $recurence, $recurenceMatches)) {
|
||||||
{
|
$vcardData['recur_type'] = MCAL_RECUR_MONTHLY_MDAY;
|
||||||
|
$vcardData['recur_interval'] = $recurenceMatches[1];
|
||||||
|
if($recurenceMatches[2] > 0 && $vcardData['end']) {
|
||||||
|
$vcardData['recur_enddate'] = mktime(
|
||||||
|
date('H', $vcardData['end']),
|
||||||
|
date('i', $vcardData['end']),
|
||||||
|
date('s', $vcardData['end']),
|
||||||
|
date('m', $vcardData['end']) + ($recurenceMatches[2] * $vcardData['recur_interval']),
|
||||||
|
date('d', $vcardData['end']),
|
||||||
|
date('Y', $vcardData['end']),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} elseif(preg_match('/MD(\d+) (.*)/',$recurence, $recurenceMatches)) {
|
||||||
$vcardData['recur_type'] = MCAL_RECUR_MONTHLY_MDAY;
|
$vcardData['recur_type'] = MCAL_RECUR_MONTHLY_MDAY;
|
||||||
if($recurenceMatches[1] > 1)
|
if($recurenceMatches[1] > 1)
|
||||||
$vcardData['recur_interval'] = $recurenceMatches[1];
|
$vcardData['recur_interval'] = $recurenceMatches[1];
|
||||||
if($recurenceMatches[2] != '#0')
|
if($recurenceMatches[2] != '#0')
|
||||||
$vcardData['recur_enddate'] = $vcal->_parseDateTime($recurenceMatches[2]);
|
$vcardData['recur_enddate'] = $vcal->_parseDateTime($recurenceMatches[2]);
|
||||||
}
|
} elseif(preg_match('/MP(\d+) (.*) (.*) (.*)/',$recurence, $recurenceMatches)) {
|
||||||
elseif(preg_match('/MP(\d+) (.*) (.*) (.*)/',$recurence, $recurenceMatches))
|
|
||||||
{
|
|
||||||
$vcardData['recur_type'] = MCAL_RECUR_MONTHLY_WDAY;
|
$vcardData['recur_type'] = MCAL_RECUR_MONTHLY_WDAY;
|
||||||
if($recurenceMatches[1] > 1)
|
if($recurenceMatches[1] > 1)
|
||||||
$vcardData['recur_interval'] = $recurenceMatches[1];
|
$vcardData['recur_interval'] = $recurenceMatches[1];
|
||||||
@ -498,10 +524,26 @@
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'Y': // 1.0
|
case 'Y': // 1.0
|
||||||
if(!preg_match('/YM(\d+) (.*)/',$recurence, $recurenceMatches)) break;
|
if(preg_match('/YM(\d+) #(.\d)/', $recurence, $recurenceMatches)) {
|
||||||
$vcardData['recur_interval'] = $recurenceMatches[1];
|
$vcardData['recur_interval'] = $recurenceMatches[1];
|
||||||
if($recurenceMatches[2] != '#0')
|
if($recurenceMatches[2] > 0 && $vcardData['end']) {
|
||||||
|
$vcardData['recur_enddate'] = mktime(
|
||||||
|
date('H', $vcardData['end']),
|
||||||
|
date('i', $vcardData['end']),
|
||||||
|
date('s', $vcardData['end']),
|
||||||
|
date('m', $vcardData['end']),
|
||||||
|
date('d', $vcardData['end']),
|
||||||
|
date('Y', $vcardData['end']) + ($recurenceMatches[2] * $vcardData['recur_interval']),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} elseif(preg_match('/YM(\d+) (.*)/',$recurence, $recurenceMatches)) {
|
||||||
|
$vcardData['recur_interval'] = $recurenceMatches[1];
|
||||||
|
if($recurenceMatches[2] != '#0') {
|
||||||
$vcardData['recur_enddate'] = $vcal->_parseDateTime($recurenceMatches[2]);
|
$vcardData['recur_enddate'] = $vcal->_parseDateTime($recurenceMatches[2]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
// fall-through
|
// fall-through
|
||||||
case 'YEARLY': // 2.0
|
case 'YEARLY': // 2.0
|
||||||
$vcardData['recur_type'] = MCAL_RECUR_YEARLY;
|
$vcardData['recur_type'] = MCAL_RECUR_YEARLY;
|
||||||
@ -1033,29 +1075,23 @@
|
|||||||
if(!$event = $this->icaltoegw($_vcalData)) {
|
if(!$event = $this->icaltoegw($_vcalData)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
$query = array(
|
||||||
$search['start'] = $event['start'];
|
'cal_start='.$this->date2ts($event['start'],true), // true = Server-time
|
||||||
$search['end'] = $event['end'];
|
'cal_end='.$this->date2ts($event['end'],true),
|
||||||
|
);
|
||||||
unset($event['description']);
|
foreach(array('title','location','priority','public','non_blocking') as $name) {
|
||||||
unset($event['start']);
|
if (isset($event[$name])) $query['cal_'.$name] = $event[$name];
|
||||||
unset($event['end']);
|
|
||||||
|
|
||||||
foreach($event as $key => $value) {
|
|
||||||
if (substr($key,0,6) != 'recur_' && substr($key,0,5) != 'alarm') {
|
|
||||||
$search['query']['cal_'.$key] = $value;
|
|
||||||
} else {
|
|
||||||
#$search['query'][$key] = $value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($foundEvents = parent::search($search)) {
|
if($foundEvents = parent::search(array(
|
||||||
|
'user' => $this->user,
|
||||||
|
'query' => $query,
|
||||||
|
))) {
|
||||||
if(is_array($foundEvents)) {
|
if(is_array($foundEvents)) {
|
||||||
$event = array_shift($foundEvents);
|
$event = array_shift($foundEvents);
|
||||||
return $event['id'];
|
return $event['id'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -449,7 +449,7 @@
|
|||||||
|
|
||||||
case 'Start':
|
case 'Start':
|
||||||
if($event['end'] - $event['start'] == 86399 && date('Y-m-d', $event['end']) == date('Y-m-d', $event['start'])) {
|
if($event['end'] - $event['start'] == 86399 && date('Y-m-d', $event['end']) == date('Y-m-d', $event['start'])) {
|
||||||
$value = date('Y-m-d');
|
$value = date('Y-m-d', $event['start']);
|
||||||
$sifEvent .= "<Start>$value</Start>";
|
$sifEvent .= "<Start>$value</Start>";
|
||||||
$sifEvent .= "<End>$value</End>";
|
$sifEvent .= "<End>$value</End>";
|
||||||
$sifEvent .= "<AllDayEvent>1</AllDayEvent>";
|
$sifEvent .= "<AllDayEvent>1</AllDayEvent>";
|
||||||
|
Loading…
Reference in New Issue
Block a user