R34016 - in /branches/1.8: addressbook/inc/ calendar/inc/ infolog/inc/ phpgwapi/inc/

Author: ralfbecker
New Revision: 34016

URL: http://www.egroupware.org/viewvc/egroupware?rev=34016&view=rev
Log:

  • CalDAV/Lightning: fixed under some conditions infinit poping up alarms and user not able to add alarms
  • Lightning pops up alarm, until Sequence/etag get updated: if user has no edit rights on an other users calendar, etag never got updated, now we update it
  • fixed user was not able to add alarms via CalDAV, if he had no edit rights for event (was always possible in web UI)
  • alarms from other users calendars are not included any more, as they make no sense but a lot of trouble
  • fixed wrong condition on adding alarms, causing some alarms no being saved

Modified:
branches/1.8/addressbook/inc/class.addressbook_groupdav.inc.php
branches/1.8/calendar/inc/class.calendar_groupdav.inc.php
branches/1.8/calendar/inc/class.calendar_ical.inc.php
branches/1.8/calendar/inc/class.calendar_so.inc.php
branches/1.8/infolog/inc/class.infolog_groupdav.inc.php
branches/1.8/phpgwapi/inc/class.groupdav.inc.php
branches/1.8/phpgwapi/inc/class.groupdav_handler.inc.php
branches/1.8/phpgwapi/inc/class.groupdav_principals.inc.php

Modified: branches/1.8/addressbook/inc/class.addressbook_groupdav.inc.php
URL: http://www.egroupware.org/viewvc/egroupware/branches/1.8/addressbook/inc/class.addressbook_groupdav.inc.php?rev=34016&r1=34015&r2=34016&view=diff

— branches/1.8/addressbook/inc/class.addressbook_groupdav.inc.php (original)
+++ branches/1.8/addressbook/inc/class.addressbook_groupdav.inc.php Sat Mar 5 11:34:21 2011
@@ -276,9 +276,10 @@
*
* @param array &$options
* @param int $id

    • @param int $user=null account_id
    • @return mixed boolean true on success, false on failure or string with http status (eg. ‘404 Not Found’)
      */
  • function get(&$options,$id)
  • function get(&$options,$id,$user=null)
    {
    if (!is_array($contact = $this->_common_get_put_delete(‘GET’,$options,$id)))
    {

Modified: branches/1.8/calendar/inc/class.calendar_groupdav.inc.php
URL: http://www.egroupware.org/viewvc/egroupware/branches/1.8/calendar/inc/class.calendar_groupdav.inc.php?rev=34016&r1=34015&r2=34016&view=diff

— branches/1.8/calendar/inc/class.calendar_groupdav.inc.php (original)
+++ branches/1.8/calendar/inc/class.calendar_groupdav.inc.php Sat Mar 5 11:34:21 2011
@@ -220,7 +220,7 @@
//error_log(FILE . METHOD . “Calendar Data : $calendar_data”);
if ($calendar_data)
{

  •   			$content = $this->iCal($event);
    
  •   			$content = $this->iCal($event,$filter['users']);
      			$props[] = HTTP_WebDAV_Server::mkprop('getcontentlength',bytes($content));
      			$props[] = HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'calendar-data',$content);
      		}
    

@@ -382,15 +382,16 @@
*
* @param array &$options
* @param int $id

    • @param int $user=null account_id
    • @return mixed boolean true on success, false on failure or string with http status (eg. ‘404 Not Found’)
      */
  • function get(&$options,$id)
  • function get(&$options,$id,$user=null)
    {
    if (!is_array($event = $this->_common_get_put_delete(‘GET’,$options,$id)))
    {
    return $event;
    }
  •   $options['data'] = $this->iCal($event);
    
  •   $options['data'] = $this->iCal($event,$user);
      $options['mimetype'] = 'text/calendar; charset=utf-8';
      header('Content-Encoding: identity');
      header('ETag: '.$this->get_etag($event));
    

@@ -403,12 +404,22 @@
* Taking into account virtual an real exceptions for recuring events
*
* @param array $event

    • @param int $user=null account_id of calendar to display
    • @return string
      */
  • private function iCal(array $event)
  • private function iCal(array $event,$user=null)
    {
    static $handler = null;
    if (is_null($handler)) $handler = $this->_get_handler();
  •   if (!$user) $user = $GLOBALS['egw_info']['user']['account_id'];
    
  •   // only return alarms in own calendar, not other users calendars
    
  •   if ($user != $GLOBALS['egw_info']['user']['account_id'])
    
  •   {
    
  •   	//error_log(__METHOD__.'('.array2string($event).", $user) clearing alarms");
    
  •   	$event['alarm'] = array();
    
  •   }
    
      $events = array($event);
    

@@ -547,8 +558,18 @@
}
else
{

  •   		// let lightning think the event is added
    
  •   		$retval = '201 Created';
    
  •   		$retval = '204 No Content';
    
  •   		// lightning will pop up the alarm, as long as the Sequence (etag) does NOT change
    
  •   		// --> update the etag alone, if user has no edit rights
    
  •   		if ($this->agent == 'lightning' && !$this->check_access(EGW_ACL_EDIT, $oldEvent) &&
    
  •   			isset($oldEvent['participants'][$GLOBALS['egw_info']['user']['account_id']]))
    
  •   		{
    
  •   			// just update etag in database
    
  •   			$GLOBALS['egw']->db->update($this->bo->so->cal_table,'cal_etag=cal_etag+1',array(
    
  •   				'cal_id' => $eventId,
    
  •   			),__LINE__,__FILE__,'calendar');
    
  •   		}
      	}
      }
      else
    

Modified: branches/1.8/calendar/inc/class.calendar_ical.inc.php
URL: http://www.egroupware.org/viewvc/egroupware/branches/1.8/calendar/inc/class.calendar_ical.inc.php?rev=34016&r1=34015&r2=34016&view=diff

— branches/1.8/calendar/inc/class.calendar_ical.inc.php (original)
+++ branches/1.8/calendar/inc/class.calendar_ical.inc.php Sat Mar 5 11:34:21 2011
@@ -276,7 +276,7 @@
}
continue;
}

  •   	if ($this->log)
      	{
      		error_log(__FILE__.'['.__LINE__.'] '.__METHOD__.
    

@@ -568,7 +568,7 @@
‘CUTYPE’ => ‘INDIVIDUAL’,
//‘RSVP’ => ‘FALSE’,
);

  •   						if (!empty($organizerCN)) $options['CN'] = $organizerCN;	
    
  •   						if (!empty($organizerCN)) $options['CN'] = $organizerCN;
      						if (!empty($organizerEMail)) $options['EMAIL'] = $organizerEMail;
      						if (!empty($event['owner'])) $options['X-EGROUPWARE-UID'] = $event['owner'];
      						$attributes['ATTENDEE'][] = $organizerURL;
    

@@ -631,7 +631,7 @@
$length = ($event[‘end’] - $event[‘start’]) / 2;
$rrule[‘UNTIL’]->modify($length . ’ second’);
}

  •   					if (!$tzid || $version != '1.0')
      					{
      						if (!isset(self::$tz_cache['UTC']))
    

@@ -645,7 +645,7 @@
if ($version == ‘1.0’)
{
if ($event[‘recur_enddate’] && $tzid)

  •   					{	
    
  •   					{
      						$rrule['UNTIL'] = self::getDateTime($rrule['UNTIL'],$tzid);
      					}
      					$attributes['RRULE'] = $rrule['FREQ'].' '.$rrule['UNTIL'];
    

@@ -690,7 +690,7 @@
$event[‘recur_exception’] = $days;
if ($version != ‘1.0’) $parameters[‘EXDATE’][‘VALUE’] = ‘DATE’;
}

  •   					if ($this->productManufacturer == 'groupdav' && 
    
  •   					if ($this->productManufacturer == 'groupdav' &&
      						($this->productName == 'iphone' || $this->productName == 'davkit'))
      					{
      						foreach ($event['recur_exception'] as $exdate)
    

@@ -917,14 +917,14 @@

				// RFC requires DESCRIPTION for DISPLAY
				if (!$event['title'] && !$description) continue;
  •   			if ($this->productName == 'lightning')
      			{
      				// return only future alarms to lightning
      				if (($nextOccurence = $this->read($event['id'], $this->now_su + $alarmData['offset'], false, 'server')))
      				{
      					$alarmData['time'] = $nextOccurence['start'] - $alarmData['offset'];
    
  •   					$alarmData['offset'] = false;	
    
  •   					$alarmData['offset'] = false;
      				}
      				else
      				{
    

@@ -932,12 +932,12 @@
}
}

  •   			if (!empty($event['whole_day']) && $alarmData['offset'])		
    
  •   			if (!empty($event['whole_day']) && $alarmData['offset'])
      			{
      				$alarmData['time'] = $event['start'] - $alarmData['offset'];
      				$alarmData['offset'] = false;
    
  •   			} 
    
  •   			}
    
  •   			$valarm = Horde_iCalendar::newComponent('VALARM',$vevent);
      			if ($alarmData['offset'])
      			{
    

@@ -1118,7 +1118,7 @@
{
calendar_groupdav::fix_series($events);
}

  •   if ($this->tzid)
      {
      	$tzid = $this->tzid;
    

@@ -1127,9 +1127,9 @@
{
$tzid = egw_time::$user_timezone->getName();
}

  •   date_default_timezone_set($tzid);
    
  •   foreach ($events as $event)
      {
      	if (!is_array($event)) continue; // the iterator may return false
    

@@ -1149,7 +1149,7 @@
}

		$updated_id = false;
  •   	if ($replace)
      	{
      		$event_info['type'] = $event['recur_type'] == MCAL_RECUR_NONE ?
    

@@ -1422,6 +1422,12 @@
}
$alarm[‘owner’] = $this->user;
$alarm[‘all’] = false;
+

  •   						// if no edit rights, allow participants to set alarms directly (like status)
    
  •   						if ($event_info['stored_event'] && !$event_info['acl_edit'])
    
  •   						{
    
  •   							$this->save_alarm($event_info['stored_event']['id'], $alarm);
    
  •   						}
    
      						if (is_array($event_info['stored_event'])
      								&& count($event_info['stored_event']['alarm']) > 0)
    

@@ -1458,7 +1464,7 @@
}
}
}

  •   	if ($this->log)
      	{
      		error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ . '('
    

@@ -1508,7 +1514,7 @@
if (is_array($days))
{
$recur_exceptions = array();

  •   					foreach ($event['recur_exception'] as $recur_exception)
      					{
      						if (isset($days[$recur_exception]))
    

@@ -1581,7 +1587,7 @@
array_unique(array_merge($event_info[‘master_event’][‘recur_exception’],
array($event[‘recurrence’])));
}

  •   					$event['reference'] = $event_info['master_event']['id'];
      					$event['category'] = $event_info['master_event']['category'];
      					$event['owner'] = $event_info['master_event']['owner'];
    

@@ -2128,7 +2134,7 @@
{
return new egw_ical_iterator($_vcalData,‘VCALENDAR’,$charset,array($this,’_ical2egw_callback’),array($this->tzid,$principalURL));
}

  •   if ($this->tzid)
      {
      	$tzid = $this->tzid;
    

@@ -2137,9 +2143,9 @@
{
$tzid = egw_time::$user_timezone->getName();
}

  •   date_default_timezone_set($tzid);
    
  •   $events = array();
      $vcal = new Horde_iCalendar;
      if (!$vcal->parsevCalendar($_vcalData, 'VCALENDAR', $charset))
    

@@ -2177,7 +2183,7 @@
function _ical2egw_callback(Horde_iCalendar $component, $tzid, $principalURL=’’)
{
//unset($component->_container); _debug_array($component);

  •   if ($this->log)
      {
      	error_log(__FILE__.'['.__LINE__.'] '.__METHOD__.'() '.get_class($component)." found\n",3,$this->logfile);
    

@@ -2238,7 +2244,7 @@
}
return false;
}

  •   /*
      $mozillaACK = $component->getAttribute('X-MOZ-LASTACK');
      if ($this->productName == 'lightning' && !is_a($mozillaACK, 'PEAR_Error'))
    

Modified: branches/1.8/calendar/inc/class.calendar_so.inc.php
URL: http://www.egroupware.org/viewvc/egroupware/branches/1.8/calendar/inc/class.calendar_so.inc.php?rev=34016&r1=34015&r2=34016&view=diff

— branches/1.8/calendar/inc/class.calendar_so.inc.php (original)
+++ branches/1.8/calendar/inc/class.calendar_so.inc.php Sat Mar 5 11:34:21 2011
@@ -931,12 +931,23 @@
$alarm[‘time’] = $event[‘cal_start’] - $alarm[‘offset’];
}

  •   		//pgoerzen: don't add an alarm if it is before the current date.
    
  •   		/*if ($event['recur_type'] && ($tmp_event = $this->read($eventID, time() + $alarm['offset'])))
    
  •   		{
    
  •   			$alarm['time'] = $tmp_event['cal_start'] - $alarm['offset'];
    
  •   		} */
    
  •   		if ($alarm['time'] < time())
    
  •   		{
    
  •   			//pgoerzen: don't add an alarm in the past
    
  •   			if ($event['recur_type'] == MCAL_RECUR_NONE) continue;
    
  •   			$start = (int)time() + $alarm['offset'];
    
  •   			$event['start'] = $event['cal_start'];
    
  •   			$event['end'] = $event['cal_end'];
    
  •   			$event['tzid'] = $event['cal_tzid'];
    
  •   			$rrule = calendar_rrule::event2rrule($event, false);
    
  •   			foreach ($rrule as $time)
    
  •   			{
    
  •   				if ($start < ($ts = egw_time::to($time,'server'))) break;
    
  •   				$ts = 0;
    
  •   			}
    
  •   			if (!$ts) continue;
    
  •   			$alarm['time'] = $ts - $alarm['offset'];
    
  •   		}
      		$this->save_alarm($cal_id,$alarm);
      	}
      }
    

Modified: branches/1.8/infolog/inc/class.infolog_groupdav.inc.php
URL: http://www.egroupware.org/viewvc/egroupware/branches/1.8/infolog/inc/class.infolog_groupdav.inc.php?rev=34016&r1=34015&r2=34016&view=diff

— branches/1.8/infolog/inc/class.infolog_groupdav.inc.php (original)
+++ branches/1.8/infolog/inc/class.infolog_groupdav.inc.php Sat Mar 5 11:34:21 2011
@@ -331,9 +331,10 @@
*
* @param array &$options
* @param int $id

    • @param int $user=null account_id
    • @return mixed boolean true on success, false on failure or string with http status (eg. ‘404 Not Found’)
      */
  • function get(&$options,$id)
  • function get(&$options,$id,$user=null)
    {
    if (!is_array($task = $this->_common_get_put_delete(‘GET’,$options,$id)))
    {

Modified: branches/1.8/phpgwapi/inc/class.groupdav.inc.php
URL: http://www.egroupware.org/viewvc/egroupware/branches/1.8/phpgwapi/inc/class.groupdav.inc.php?rev=34016&r1=34015&r2=34016&view=diff

— branches/1.8/phpgwapi/inc/class.groupdav.inc.php (original)
+++ branches/1.8/phpgwapi/inc/class.groupdav.inc.php Sat Mar 5 11:34:21 2011
@@ -529,7 +529,7 @@
}
if (($handler = self::app_handler($app)))
{

  •   	return $handler->get($options,$id);
    
  •   	return $handler->get($options,$id,$user);
      }
      error_log(__METHOD__."(".array2string($options).") 501 Not Implemented");
      return '501 Not Implemented';
    

Modified: branches/1.8/phpgwapi/inc/class.groupdav_handler.inc.php
URL: http://www.egroupware.org/viewvc/egroupware/branches/1.8/phpgwapi/inc/class.groupdav_handler.inc.php?rev=34016&r1=34015&r2=34016&view=diff

— branches/1.8/phpgwapi/inc/class.groupdav_handler.inc.php (original)
+++ branches/1.8/phpgwapi/inc/class.groupdav_handler.inc.php Sat Mar 5 11:34:21 2011
@@ -135,9 +135,10 @@
*
* @param array &$options
* @param int $id

    • @param int $user=null account_id
    • @return mixed boolean true on success, false on failure or string with http status (eg. ‘404 Not Found’)
      */
  • abstract function get(&$options,$id);
  • abstract function get(&$options,$id,$user=null);

    /**

    • Handle get request for an applications entry

Modified: branches/1.8/phpgwapi/inc/class.groupdav_principals.inc.php
URL: http://www.egroupware.org/viewvc/egroupware/branches/1.8/phpgwapi/inc/class.groupdav_principals.inc.php?rev=34016&r1=34015&r2=34016&view=diff

— branches/1.8/phpgwapi/inc/class.groupdav_principals.inc.php (original)
+++ branches/1.8/phpgwapi/inc/class.groupdav_principals.inc.php Sat Mar 5 11:34:21 2011
@@ -13,7 +13,7 @@

/**

  • EGroupware: GroupDAV access: groupdav/caldav/carddav principals handlers
    • @todo All principal urls should either contain no account_lid (eg. base64 of it) or use urlencode($account_lid)
      */
      class groupdav_principals extends groupdav_handler
      @@ -92,7 +92,7 @@
      {
      $displayname = translation::convert($account[‘account_fullname’],
      translation::charset(),‘utf-8’);
  •   	$props = array(
      		HTTP_WebDAV_Server::mkprop('displayname',$displayname),
      		HTTP_WebDAV_Server::mkprop('getetag',$this->get_etag($account)),
    

@@ -105,7 +105,7 @@
HTTP_WebDAV_Server::mkprop(groupdav::CARDDAV,‘addressbook-home-set’,array(
HTTP_WebDAV_Server::mkprop(‘href’,$this->base_uri.’/’.$account[‘account_lid’].’/’))),
);

  •   	foreach($this->accounts->memberships($account['account_id']) as $gid => $group)
      	{
      		$props[] = HTTP_WebDAV_Server::mkprop('group-membership',$this->base_uri.'/groups/'.$group);
    

@@ -440,9 +440,10 @@
*
* @param array &$options
* @param int $id

    • @param int $user=null account_id
    • @return mixed boolean true on success, false on failure or string with http status (eg. ‘404 Not Found’)
      */
  • function get(&$options,$id)
  • function get(&$options,$id,$user=null)
    {
    if (!is_array($account = $this->_common_get_put_delete(‘GET’,$options,$id)))
    {
    @@ -533,7 +534,7 @@
    }
    return ‘EGw-’.$account[‘account_id’].’:’.md5(serialize($account)).
    // as the pricipal of current user is influenced by GroupDAV prefs, we have to include them in the etag
  •   	($account['account_id'] == $GLOBALS['egw_info']['user']['account_id'] ? 
    
  •   	($account['account_id'] == $GLOBALS['egw_info']['user']['account_id'] ?
      		':'.md5(serialize($GLOBALS['egw_info']['user']['preferences']['groupdav'])) : '').'-wGE';
    
    }
    }

What You Don’t Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d


eGroupWare-cvs mailing list
eGroupWare-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/egroupware-cvs