From 12183ece8e4cb1bb81072a72f696572c8b3a07ee Mon Sep 17 00:00:00 2001 From: Tarik Gasmi Date: Tue, 18 Sep 2007 15:18:38 +0000 Subject: ldap-site-mngmt: actualized WebIF and DHCPConfig Generationscript git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1340 95ad53e4-c205-0410-b2fa-d234c58c8868 --- .../webinterface/computers/dhcphost_change.php | 101 +++++++++++++++++++-- 1 file changed, 94 insertions(+), 7 deletions(-) (limited to 'ldap-site-mngmt/webinterface/computers/dhcphost_change.php') diff --git a/ldap-site-mngmt/webinterface/computers/dhcphost_change.php b/ldap-site-mngmt/webinterface/computers/dhcphost_change.php index a35a29cb..9cd71f41 100644 --- a/ldap-site-mngmt/webinterface/computers/dhcphost_change.php +++ b/ldap-site-mngmt/webinterface/computers/dhcphost_change.php @@ -17,7 +17,21 @@ $sbmnr = $_POST['sbmnr']; $dhcp = htmlentities($dhcp); $olddhcp = htmlentities($olddhcp); - +# sonstige Attribute +$attribs = $_POST['attribs']; +if (count($attribs) != 0){ + foreach (array_keys($attribs) as $key){ + $atts[$key] = htmlentities($attribs[$key]); + } +} +#print_r($atts); echo "

"; +$oldattribs = $_POST['oldattribs']; +if (count($oldattribs) != 0){ + foreach (array_keys($oldattribs) as $key){ + $oldatts[$key] = htmlentities($oldattribs[$key]); + } +} +#print_r($oldatts); echo "

"; /*echo "new dhcp:"; print_r($dhcp); echo "
"; echo "old dhcp:"; print_r($olddhcp); echo "
"; @@ -53,7 +67,7 @@ if ($dhcp != "none" && $dhcp != $olddhcp){ if ($olddhcp != ""){ echo "DHCP replace "; print_r($olddhcp); echo " with "; print_r($entrydhcp); echo "
"; if ($result = ldap_mod_replace($ds,$hostDN,$entrydhcp)){ - update_dhcpmtime(); + update_dhcpmtime(array()); $mesg = "Rechner erfolgreich in DHCP ".$dhcpcn." [Abt.: ".$dhcpau."] angemeldet

"; }else{ $mesg = "Fehler beim ändern des DHCP Dienstes zu ".$dhcpcn."!

"; @@ -64,7 +78,7 @@ if ($dhcp != "none" && $dhcp != $olddhcp){ } echo "DHCP add "; print_r($entrydhcp); echo "
"; if ($result = ldap_mod_add($ds,$hostDN,$entrydhcp)){ - update_dhcpmtime(); + update_dhcpmtime(array()); $mesg = "Rechner erfolgreich in DHCP ".$dhcpcn." [Abt.: ".$dhcpau."] angemeldet

"; }else{ $mesg = "Fehler beim ändern des DHCP Dienstes zu ".$dhcpcn."!

"; @@ -80,7 +94,7 @@ if ($dhcp != "none" && $dhcp != $olddhcp){ #} echo "DHCP delete "; echo "
"; if ($result = ldap_mod_del($ds,$hostDN,$entrydhcp)){ - update_dhcpmtime(); + update_dhcpmtime(array()); $mesg = "Rechner erfolgreich aus DHCP gelöscht

"; }else{ $mesg = "Fehler beim löschen aus DHCP Dienst!

"; @@ -99,7 +113,7 @@ if ($fixedaddress != "none" && $fixedaddress != $oldfixedaddress){ if ($oldfixedaddress != ""){ echo "Fixed Address ändern"; echo "
"; if ($result = ldap_mod_replace($ds,$hostDN,$entryfixadd)){ - update_dhcpmtime(); + update_dhcpmtime(array()); $mesg = "Option Fixed-Address erfolgreich auf ".$fixedaddress." geändert

"; }else{ $mesg = "Fehler beim ändern der Option Fixed-Address auf ".$fixedaddress."!

"; @@ -107,7 +121,7 @@ if ($fixedaddress != "none" && $fixedaddress != $oldfixedaddress){ }else{ echo "Fixed Address auf IP Adresse setzen"; echo "
"; if ($result = ldap_mod_add($ds,$hostDN,$entryfixadd)){ - update_dhcpmtime(); + update_dhcpmtime(array()); $mesg = "Option Fixed-Address erfolgreich auf ".$fixedaddress." gesetzt

"; }else{ $mesg = "Fehler beim setzen der Option Fixed-Address auf ".$fixedaddress."!

"; @@ -117,7 +131,7 @@ if ($fixedaddress != "none" && $fixedaddress != $oldfixedaddress){ $entryfixadd ['dhcpoptfixed-address'] = array(); echo "No Fixed Address"; echo "
"; if ($result = ldap_mod_del($ds,$hostDN,$entryfixadd)){ - update_dhcpmtime(); + update_dhcpmtime(array()); $mesg = "Option Fixed-Address erfolgreich gelöscht

"; }else{ $mesg = "Fehler beim löschen der Option Fixed-Address!

"; @@ -125,6 +139,79 @@ if ($fixedaddress != "none" && $fixedaddress != $oldfixedaddress){ } } +##################################### +# Restliche Attribute (u.a. Description) + +$entryadd = array(); +$entrymod = array(); +$entrydel = array(); + +foreach (array_keys($atts) as $key){ + + if ( $oldatts[$key] == $atts[$key] ){ + + } + if ( $oldatts[$key] == "" && $atts[$key] != "" ){ + # hier noch Syntaxcheck + $entryadd[$key] = $atts[$key]; + } + if ( $oldatts[$key] != "" && $atts[$key] != "" && $oldatts[$key] != $atts[$key] ){ + # hier noch Syntaxcheck + $entrymod[$key] = $atts[$key]; + } + if ( $oldatts[$key] != "" && $atts[$key] == "" ){ + # hier noch Syntaxcheck + $entrydel[$key] = $oldatts[$key]; + } +} + +#print_r($entryadd); echo "
"; +#print_r($entrymod); echo "
"; +#print_r($entrydel); echo "
"; + + +if (count($entryadd) != 0 ){ + #print_r($entryadd); echo "
"; + #echo "neu anlegen
"; + foreach (array_keys($entryadd) as $key){ + $addatts .= "".$key.","; + } + if(ldap_mod_add($ds,$hostDN,$entryadd)){ + $mesg = "Attribute ".$addatts." erfolgreich eingetragen

"; + update_dhcpmtime(array()); + }else{ + $mesg = "Fehler beim eintragen der Attribute ".$addatts."

"; + } +} + +if (count($entrymod) != 0 ){ + #print_r($entrymod); echo "
"; + #echo "ändern
"; + foreach (array_keys($entrymod) as $key){ + $modatts .= "".$key.","; + } + if(ldap_mod_replace($ds,$hostDN,$entrymod)){ + $mesg = "Attribute ".$modatts." erfolgreich geaendert

"; + update_dhcpmtime(array()); + }else{ + $mesg = "Fehler beim aendern der Attribute ".$modatts."

"; + } +} + +if (count($entrydel) != 0 ){ + #print_r($entrydel); echo "
"; + #echo "löschen
"; + foreach (array_keys($entrydel) as $key){ + $delatts .= "".$key.","; + } + if(ldap_mod_del($ds,$hostDN,$entrydel)){ + $mesg = "Attribute ".$delatts." erfolgreich geloescht

"; + update_dhcpmtime(array()); + }else{ + $mesg = "Fehler beim loeschen der Attribute ".$delatts."

"; + } +} + ##################### -- cgit v1.2.3-55-g7522