From 338c962e7118f6f85e86527f1134053a3def730a Mon Sep 17 00:00:00 2001 From: mgalgoci Date: Thu, 19 Aug 2004 15:32:49 +0000 Subject: [PATCH] account for importing meetings that end up having no participants. --- calendar/inc/class.bocalendar.inc.php | 22 ++++++++++++++-------- calendar/inc/class.uicalendar.inc.php | 11 +++++++---- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/calendar/inc/class.bocalendar.inc.php b/calendar/inc/class.bocalendar.inc.php index b43e03eeec..41d3d93fb7 100755 --- a/calendar/inc/class.bocalendar.inc.php +++ b/calendar/inc/class.bocalendar.inc.php @@ -1512,12 +1512,15 @@ { // Check if the $user is one of the participants or has a read-grant from one of them // - foreach($event['participants'] as $uid => $accept) + if (isset($event['participants']) && is_array($event['participants'])) { - if ($this->grants[$uid] & PHPGW_ACL_READ || $uid == $user) + foreach($event['participants'] as $uid => $accept) { - $grants |= PHPGW_ACL_READ; - break; + if ($this->grants[$uid] & PHPGW_ACL_READ || $uid == $user) + { + $grants |= PHPGW_ACL_READ; + break; + } } } } @@ -3118,12 +3121,15 @@ ); } - $participants = array(); - foreach($event['participants'] as $user => $short_status) + if (isset($event['participants']) && is_array($event['participants'])) { - if($GLOBALS['phpgw']->accounts->exists($user)) + $participants = array(); + foreach($event['participants'] as $user => $short_status) { - $participants[$user] = $GLOBALS['phpgw']->common->grab_owner_name($user).' ('.$this->get_long_status($short_status).')'; + if($GLOBALS['phpgw']->accounts->exists($user)) + { + $participants[$user] = $GLOBALS['phpgw']->common->grab_owner_name($user).' ('.$this->get_long_status($short_status).')'; + } } } $var['participants'] = Array( diff --git a/calendar/inc/class.uicalendar.inc.php b/calendar/inc/class.uicalendar.inc.php index 8da597baa9..0d862b2663 100755 --- a/calendar/inc/class.uicalendar.inc.php +++ b/calendar/inc/class.uicalendar.inc.php @@ -3452,14 +3452,17 @@ $vars['title']['tr_color'] = $this->theme['th_bg']; - foreach($vars['participants']['data'] as $user => $str) + if (isset($vars['participants']['data']) && is_array($vars['participants']['data'])) { - if ($this->bo->check_perms(PHPGW_ACL_EDIT,0,$user) && ereg('^(.*) \((.*)\)$',$str,$parts)) + foreach($vars['participants']['data'] as $user => $str) { - $vars['participants']['data'][$user] = $parts[1].' ('.$parts[2].')'; + if ($this->bo->check_perms(PHPGW_ACL_EDIT,0,$user) && ereg('^(.*) \((.*)\)$',$str,$parts)) + { + $vars['participants']['data'][$user] = $parts[1].' ('.$parts[2].')'; + } } + $vars['participants']['data'] = implode("
\n",$vars['participants']['data']); } - $vars['participants']['data'] = implode("
\n",$vars['participants']['data']); foreach($vars as $var) {