cast accounts->members(hips) to array, to cope without PHP warnings for not (longer) existing accounts

This commit is contained in:
Ralf Becker 2012-08-09 08:56:52 +00:00
parent ac88a44f82
commit ff99215955

View File

@ -271,9 +271,9 @@ class accounts
elseif(in_array($param['type'],array('groupmembers','groupmembers+memberships'))) elseif(in_array($param['type'],array('groupmembers','groupmembers+memberships')))
{ {
$members = array(); $members = array();
foreach($this->memberships($GLOBALS['egw_info']['user']['account_id'],true) as $grp) foreach((array)$this->memberships($GLOBALS['egw_info']['user']['account_id'],true) as $grp)
{ {
$members = array_unique(array_merge($members,$this->members($grp,true))); $members = array_unique(array_merge($members, (array)$this->members($grp,true)));
if ($param['type'] == 'groupmembers+memberships') $members[] = $grp; if ($param['type'] == 'groupmembers+memberships') $members[] = $grp;
} }
$param['type'] = $param['type'] == 'groupmembers+memberships' ? 'both' : 'accounts'; $param['type'] = $param['type'] == 'groupmembers+memberships' ? 'both' : 'accounts';
@ -632,8 +632,8 @@ class accounts
$account_lid != $GLOBALS['egw_info']['user']['account_lid'] || $account_lid != $GLOBALS['egw_info']['user']['account_lid'] ||
// only allow group-members for account-selection is groupmembers // only allow group-members for account-selection is groupmembers
$GLOBALS['egw_info']['user']['preferences']['common']['account_selection'] == 'groupmembers' && $GLOBALS['egw_info']['user']['preferences']['common']['account_selection'] == 'groupmembers' &&
!array_intersect($this->memberships($account_id,true), !array_intersect((array)$this->memberships($account_id,true),
$this->memberships($GLOBALS['egw_info']['user']['account_id'],true)))) (array)$this->memberships($GLOBALS['egw_info']['user']['account_id'],true))))
{ {
//error_log(__METHOD__."($account_id='$account_lid') returning FALSE"); //error_log(__METHOD__."($account_id='$account_lid') returning FALSE");
return false; // user is not allowed to see given account return false; // user is not allowed to see given account
@ -762,7 +762,7 @@ class accounts
$accounts['groups'][$id] = $id; $accounts['groups'][$id] = $id;
if ($use != 'groups') if ($use != 'groups')
{ {
foreach($this->members($id,true) as $id) foreach((array)$this->members($id,true) as $id)
{ {
$accounts['accounts'][$id] = $id; $accounts['accounts'][$id] = $id;
} }