From 08dbf52b66f57a629a652df5bbeee4c0e8a04d1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Lehrke?= Date: Mon, 22 Feb 2010 10:02:33 +0000 Subject: [PATCH] Fix typos and code cleanup --- calendar/inc/class.calendar_bo.inc.php | 19 +++++++++---------- calendar/inc/class.calendar_boupdate.inc.php | 15 +++++---------- calendar/inc/class.calendar_ical.inc.php | 2 +- 3 files changed, 15 insertions(+), 21 deletions(-) diff --git a/calendar/inc/class.calendar_bo.inc.php b/calendar/inc/class.calendar_bo.inc.php index c229773809..dfb3111216 100644 --- a/calendar/inc/class.calendar_bo.inc.php +++ b/calendar/inc/class.calendar_bo.inc.php @@ -639,7 +639,7 @@ class calendar_bo $old_horizont = $this->config['horizont']; $this->config['horizont'] = $new_horizont; - // create further recurrences for all recuring and not yet (at the old horizont) ended events + // create further recurrences for all recurring and not yet (at the old horizont) ended events if (($recuring = $this->so->unfinished_recuring($old_horizont))) { foreach($this->read(array_keys($recuring)) as $cal_id => $event) @@ -660,7 +660,7 @@ class calendar_bo } /** - * set all recurrences for an event until defined horizont $this->config['horizont'] + * set all recurrences for an event until the defined horizont $this->config['horizont'] * * This methods operates in usertime, while $this->config['horizont'] is in servertime! * @@ -715,7 +715,7 @@ class calendar_bo function db2data(&$events,$date_format='ts') { if (!is_array($events)) echo "

bocal::db2data(\$events,$date_format) \$events is no array
\n".function_backtrace()."

\n"; - foreach($events as $id => &$event) + foreach($events as &$event) { // convert timezone id of event to tzid (iCal id like 'Europe/Berlin') if (!$event['tz_id'] || !($event['tzid'] = calendar_timezones::id2tz($event['tz_id']))) @@ -732,7 +732,7 @@ class calendar_bo // same with the recur exceptions if (isset($event['recur_exception']) && is_array($event['recur_exception'])) { - foreach($event['recur_exception'] as $n => &$date) + foreach($event['recur_exception'] as &$date) { $date = $this->date2usertime($date,$date_format); } @@ -740,7 +740,7 @@ class calendar_bo // same with the alarms if (isset($event['alarm']) && is_array($event['alarm'])) { - foreach($event['alarm'] as $n => &$alarm) + foreach($event['alarm'] as &$alarm) { $alarm['time'] = $this->date2usertime($alarm['time'],$date_format); } @@ -769,7 +769,7 @@ class calendar_bo * @param mixed $date=null date to specify a single event of a series * @param boolean $ignore_acl should we ignore the acl, default False for a single id, true for multiple id's * @param string $date_format='ts' date-formats: 'ts'=timestamp, 'server'=timestamp in servertime, 'array'=array, or string with date-format - * @return boolean/array event or array of id => event pairs, false if the acl-check went wrong, null if $ids not found + * @return boolean|array event or array of id => event pairs, false if the acl-check went wrong, null if $ids not found */ function read($ids,$date=null,$ignore_acl=False,$date_format='ts') { @@ -985,7 +985,6 @@ class calendar_bo $owner = $event['owner']; $private = !$event['public']; } - $user = $GLOBALS['egw_info']['user']['account_id']; $grants = $this->grants[$owner]; if (is_array($event) && $needed == EGW_ACL_READ) { @@ -996,11 +995,11 @@ class calendar_bo { foreach($event['participants'] as $uid => $accept) { - if ($uid == $user || $uid < 0 && in_array($user,$GLOBALS['egw']->accounts->members($uid,true))) + if ($uid == $this->user || $uid < 0 && in_array($this->user,$GLOBALS['egw']->accounts->members($uid,true))) { // if we are a participant, we have an implicite READ and PRIVAT grant // exept the group gives its members only EGW_ACL_FREEBUSY and the participant is not the current user - if ($this->grants[$uid] == EGW_ACL_FREEBUSY && $uid != $user) continue; + if ($this->grants[$uid] == EGW_ACL_FREEBUSY && $uid != $this->user) continue; $grants |= EGW_ACL_READ | EGW_ACL_PRIVATE; break; @@ -1028,7 +1027,7 @@ class calendar_bo } else { - $access = $user == $owner || $grants & $needed && (!$private || $grants & EGW_ACL_PRIVATE); + $access = $this->user == $owner || $grants & $needed && (!$private || $grants & EGW_ACL_PRIVATE); } if ($this->debug && ($this->debug > 2 || $this->debug == 'check_perms')) { diff --git a/calendar/inc/class.calendar_boupdate.inc.php b/calendar/inc/class.calendar_boupdate.inc.php index e5e8822722..aa67f173b1 100644 --- a/calendar/inc/class.calendar_boupdate.inc.php +++ b/calendar/inc/class.calendar_boupdate.inc.php @@ -1607,7 +1607,7 @@ class calendar_boupdate extends calendar_bo $matchFields = array('priority', 'public', 'non_blocking', 'recurrence'); foreach ($matchFields as $key) { - if (!empty($event[$key])) $query['cal_'.$key] = $event[$key]; + if (isset($event[$key])) $query['cal_'.$key] = $event[$key]; } } if (!empty($event['uid'])) @@ -1803,14 +1803,9 @@ class calendar_boupdate extends calendar_bo // check exceptions // $exceptions[$remote_ts] = $egw_ts $exceptions = $this->so->get_recurrence_exceptions($egwEvent, $event['$tzid'], 0, 0, 'map'); - // remove leading exceptions - foreach ($exceptions as $key => $day) + if (is_array($event['recur_exception'])) { - if ($day <= $event['start']) unset($exceptions['key']); - } - if (is_array($event['recur_excpetion'])) - { - foreach ($event['recur_excpetion'] as $key => $day) + foreach ($event['recur_exception'] as $key => $day) { if (isset($exceptions[$day])) { @@ -1832,14 +1827,14 @@ class calendar_boupdate extends calendar_bo { error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. '() missing event[recur_exception]: ' . - array2string($event['recur_excpetion'])); + array2string($event['recur_exception'])); } continue; } } // check recurrence information - foreach (array('recur_type', 'recur_interval') as $key) + foreach (array('recur_type', 'recur_interval', 'recur_enddate') as $key) { if (isset($event[$key]) && $event[$key] != $egwEvent[$key]) diff --git a/calendar/inc/class.calendar_ical.inc.php b/calendar/inc/class.calendar_ical.inc.php index 167731fe1e..04834cc128 100644 --- a/calendar/inc/class.calendar_ical.inc.php +++ b/calendar/inc/class.calendar_ical.inc.php @@ -2370,7 +2370,7 @@ class calendar_ical extends calendar_boupdate } break; case 'SUMMARY': - $vcardData['title'] = str_replace("\r\n", "\n", $attributes['value']); + $vcardData['title'] = str_replace("\r\n", "\n", $attributes['value']); break; case 'UID': if (strlen($attributes['value']) >= $minimum_uid_length)