From: Jehan-Guillaume (ioguix) de Rorthais Date: Sun, 30 Sep 2012 20:14:04 +0000 (+0200) Subject: Fix PHP notice when server group is not set, reported by Karl O. Pinc X-Git-Tag: REL_5-1-0~26 X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=9d036a763286079487d11d42502bf3119d5349df;p=phppgadmin.git Fix PHP notice when server group is not set, reported by Karl O. Pinc --- diff --git a/classes/Misc.php b/classes/Misc.php index 2dc1b8a6..a9b7d685 100644 --- a/classes/Misc.php +++ b/classes/Misc.php @@ -2189,20 +2189,40 @@ global $conf, $lang; $grps = array(); - foreach ($conf['srv_groups'] as $i => $group) { - if ( - (($group_id === false) and (! isset($group['parents']))) /* root */ - or ( - ($group_id !== false) - and isset($group['parents']) - and in_array($group_id,explode(',', - preg_replace('/\s/', '', $group['parents']) - )) - ) /* nested group */ - ) - $grps[$i] = array( - 'id' => $i, - 'desc' => $group['desc'], + if (isset($conf['srv_groups'])) { + foreach ($conf['srv_groups'] as $i => $group) { + if ( + (($group_id === false) and (! isset($group['parents']))) /* root */ + or ( + ($group_id !== false) + and isset($group['parents']) + and in_array($group_id,explode(',', + preg_replace('/\s/', '', $group['parents']) + )) + ) /* nested group */ + ) + $grps[$i] = array( + 'id' => $i, + 'desc' => $group['desc'], + 'icon' => 'Servers', + 'action' => url('servers.php', + array( + 'group' => field('id') + ) + ), + 'branch' => url('servers.php', + array( + 'action' => 'tree', + 'group' => $i + ) + ) + ); + } + + if ($group_id === false) + $grps['all'] = array( + 'id' => 'all', + 'desc' => $lang['strallservers'], 'icon' => 'Servers', 'action' => url('servers.php', array( @@ -2210,32 +2230,14 @@ ) ), 'branch' => url('servers.php', - array( - 'action' => 'tree', - 'group' => $i + array( + 'action' => 'tree', + 'group' => 'all' + ) ) - ) ); } - if ($group_id === false) - $grps['all'] = array( - 'id' => 'all', - 'desc' => $lang['strallservers'], - 'icon' => 'Servers', - 'action' => url('servers.php', - array( - 'group' => field('id') - ) - ), - 'branch' => url('servers.php', - array( - 'action' => 'tree', - 'group' => 'all' - ) - ) - ); - if ($recordset) { include_once('./classes/ArrayRecordSet.php'); return new ArrayRecordSet($grps);