From 3e9ca1d030d1236a6620213b136ac633271059c6 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Sat, 10 Jan 2009 17:36:31 +0000 Subject: [PATCH] fixed error messages --- lam/lib/types/dhcp.inc | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/lam/lib/types/dhcp.inc b/lam/lib/types/dhcp.inc index 6b72e6b7..5f2fd231 100644 --- a/lam/lib/types/dhcp.inc +++ b/lam/lib/types/dhcp.inc @@ -129,22 +129,24 @@ class lamDHCPList extends lamList { $ldap = $_SESSION['ldap']; $suffix = $_SESSION['config']->get_Suffix('dhcp'); - $sr = ldap_search($ldap->server(),"cn=".$entry['cn'][0].",".$suffix,"objectClass=dhcpHost"); - $get = ldap_get_entries($ldap->server(),$sr); - - // Now list all fixed_ips: - echo ""; - $this->fixed_ips = array(); - foreach($get AS $id=>$arr) { - if (is_numeric($id)) { - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - } + $sr = @ldap_search($ldap->server(),"cn=".$entry['cn'][0].",".$suffix,"objectClass=dhcpHost"); + if ($sr) { + $get = ldap_get_entries($ldap->server(),$sr); + + // Now list all fixed_ips: + echo "
".array_pop(explode(" ",$get[$id]['dhcpstatements'][0]))."".array_pop(explode(" ",$get[$id]['dhcphwaddress'][0]))."".$get[$id]['cn'][0]."
"; + $this->fixed_ips = array(); + foreach($get AS $id=>$arr) { + if (is_numeric($id)) { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + } + } + echo "
".array_pop(explode(" ",$get[$id]['dhcpstatements'][0]))."".array_pop(explode(" ",$get[$id]['dhcphwaddress'][0]))."".$get[$id]['cn'][0]."
"; } - echo ""; } // fixed ip address elseif ($attribute=="dhcpstatements") {