summaryrefslogtreecommitdiffstats
path: root/ldap-site-mngmt/webinterface/dhcp/dhcpservice_change.php
diff options
context:
space:
mode:
authorTarik Gasmi2007-05-14 10:03:48 +0200
committerTarik Gasmi2007-05-14 10:03:48 +0200
commit59cf91925ca8da43d2427331b23e4673b0e53095 (patch)
tree871f39414143192cb3e8bd6f4bd2b7462e7076b9 /ldap-site-mngmt/webinterface/dhcp/dhcpservice_change.php
parentSome webinterface data. (diff)
downloadcore-59cf91925ca8da43d2427331b23e4673b0e53095.tar.gz
core-59cf91925ca8da43d2427331b23e4673b0e53095.tar.xz
core-59cf91925ca8da43d2427331b23e4673b0e53095.zip
Other webinterface data.
git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1077 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'ldap-site-mngmt/webinterface/dhcp/dhcpservice_change.php')
-rw-r--r--ldap-site-mngmt/webinterface/dhcp/dhcpservice_change.php202
1 files changed, 202 insertions, 0 deletions
diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcpservice_change.php b/ldap-site-mngmt/webinterface/dhcp/dhcpservice_change.php
new file mode 100644
index 00000000..5096d355
--- /dev/null
+++ b/ldap-site-mngmt/webinterface/dhcp/dhcpservice_change.php
@@ -0,0 +1,202 @@
+<?php
+include('../standard_header.inc.php');
+
+$cn = "DHCP_".$_POST['cn'];
+$oldcn = "DHCP_".$_POST['oldcn'];
+$dhcpoffer = $_POST['dhcpoffer'];
+$olddhcpoffer = $_POST['olddhcpoffer'];
+
+$dhcpDN = $_POST['dhcpdn'];
+
+# sonstige Attribute
+$attribs = $_POST['attribs'];
+if (count($attribs) != 0){
+ foreach (array_keys($attribs) as $key){
+ $atts[$key] = htmlentities($attribs[$key]);
+ }
+}
+#print_r($atts); echo "<br><br>";
+$oldattribs = $_POST['oldattribs'];
+if (count($oldattribs) != 0){
+ foreach (array_keys($oldattribs) as $key){
+ $oldatts[$key] = htmlentities($oldattribs[$key]);
+ }
+}
+#print_r($oldatts); echo "<br><br>";
+
+
+$nodeDN = "cn=dhcp,".$auDN;
+$mnr = $_POST['mnr'];
+$sbmnr = $_POST['sbmnr'];
+$mcnr = $_POST['mcnr'];
+
+#$deltr = $_POST['deltr'];
+
+$seconds = 200;
+$url = "dhcpservice.php?dn=".$dhcpdn."&mnr=1";
+
+echo "
+<html>
+<head>
+ <title>Computers Management</title>
+ <link rel='stylesheet' href='../styles.css' type='text/css'>
+</head>
+<body>
+<table border='0' cellpadding='30' cellspacing='0'>
+<tr><td>";
+
+##############################################
+# DHCP Service CN (DN)
+
+if ( $oldcn == $cn ){
+ # $mesg = "keine Aenderung<br>";
+}
+
+if ( $oldcn != "" && $cn != "" && $oldcn != $cn ){
+ echo "DHCP Service Name aendern<br>";
+ # hier noch Syntaxcheck
+ # Formulareingaben anpassen
+ $exp = explode(" ",$cn);
+ foreach ($exp as $word){$expuc[] = ucfirst($word);}
+ $cn = implode(" ",$expuc);
+ $cn = preg_replace ( '/\s+([0-9A-Z])/', '$1', $cn);
+
+ $newdhcpDN = "cn=".$cn.",".$nodeDN;
+ print_r($newdhcpDN); echo "<br><br>";
+
+ if(move_subtree($dhcpDN, $newdhcpDN)){
+ adjust_dhcpservice_dn($newdhcpDN, $dhcpDN);
+ $dhcpDN = $newdhcpDN;
+ $mesg = "DHCP Service Name erfolgreich ge&auml;ndert<br><br>";
+ }else{
+ $mesg = "Fehler beim &auml;ndern des DHCP Service Namen!<br><br>";
+ }
+}
+
+if ( $oldcn != "" && $cn == "" ){
+ echo "DHCP Service Name loeschen!<br>
+ Dieser ist Teil des DN, Sie werden den DHCP Service komplett l&ouml;schen<br><br>";
+ echo "Wollen Sie den DHCP Service <b>".$oldcn."</b> wirklich l&ouml;schen?<br><br>
+ <form action='dhcpservice_delete.php' method='post'>
+ Falls ja:<br><br>
+ <input type='hidden' name='dn' value='".$dhcpDN."'>
+ <input type='hidden' name='name' value='".$oldcn."'>
+ <input type='Submit' name='apply' value='l&ouml;schen' class='small_loginform_button'><br><br>
+ </form>
+ <form action='".$url."' method='post'>
+ Falls, nein:<br><br>
+ <input type='Submit' name='apply' value='zur&uuml;ck' class='small_loginform_button'>
+ </form>";
+ $seconds = 600;
+}
+
+#####################################
+# Offer ändern
+
+if ( $dhcpoffer != "none" ){
+
+ if ( $dhcpoffer != "off" && $dhcpoffer == $olddhcpoffer ){
+ $mesg = "Sie haben die gleiche Abteilung ausgew&auml;hlt<br>
+ Keine &Auml;nderung!";
+ }
+
+ if ( $dhcpoffer != "off" && $dhcpoffer != $olddhcpoffer ){
+ $entryoffer ['dhcpofferdn'] = $dhcpoffer;
+ if(ldap_mod_replace($ds,$dhcpDN,$entryoffer)){
+ $mesg = "DHCP Service Offer erfolgreich ge&auml;ndert<br><br>";
+ }
+ else{
+ $mesg = "Fehler beim &auml;ndern des DHCP Service Offers!<br><br>";
+ }
+ }
+
+ /*if ( $dhcpoffer == "off" && $olddhcpoffer != "" ){
+ $entryoffer ['dhcpofferdn'] = array();
+ if(ldap_mod_del($ds,$dhcpDN,$entryoffer)){
+ $mesg = "DHCP Service Offer erfolgreich ge&auml;ndert<br><br>";
+ }
+ else{
+ $mesg = "Fehler beim &auml;ndern des DHCP Service Offers!<br><br>";
+ }
+ }*/
+
+}
+
+#####################################
+# Restliche Attribute
+
+$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 "<br>";
+#print_r($entrymod); echo "<br>";
+#print_r($entrydel); echo "<br>";
+
+
+if (count($entryadd) != 0 ){
+ #print_r($entryadd); echo "<br>";
+ #echo "neu anlegen<br>";
+ foreach (array_keys($entryadd) as $key){
+ $addatts .= "<b>".$key."</b>,";
+ }
+ if(ldap_mod_add($ds,$dhcpDN,$entryadd)){
+ $mesg = "Attribute ".$addatts." erfolgreich eingetragen<br><br>";
+ }else{
+ $mesg = "Fehler beim eintragen der Attribute ".$addatts."<br><br>";
+ }
+}
+
+if (count($entrymod) != 0 ){
+ #print_r($entrymod); echo "<br>";
+ #echo "&auml;ndern<br>";
+ foreach (array_keys($entrymod) as $key){
+ $modatts .= "<b>".$key."</b>,";
+ }
+ if(ldap_mod_replace($ds,$dhcpDN,$entrymod)){
+ $mesg = "Attribute ".$modatts." erfolgreich geaendert<br><br>";
+ }else{
+ $mesg = "Fehler beim aendern der Attribute ".$modatts."<br><br>";
+ }
+}
+
+if (count($entrydel) != 0 ){
+ #print_r($entrydel); echo "<br>";
+ #echo "l&ouml;schen<br>";
+ foreach (array_keys($entrydel) as $key){
+ $delatts .= "<b>".$key."</b>,";
+ }
+ if(ldap_mod_del($ds,$dhcpDN,$entrydel)){
+ $mesg = "Attribute ".$delatts." erfolgreich geloescht<br><br>";
+ }else{
+ $mesg = "Fehler beim loeschen der Attribute ".$delatts."<br><br>";
+ }
+}
+
+
+$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zur&uuml;ckgeleitet. <br>
+ Falls nicht, klicken Sie hier <a href=".$url." style='publink'>back</a>";
+redirect($seconds, $url, $mesg, $addSessionId = TRUE);
+
+echo "</td></tr></table></body>
+</html>";
+?> \ No newline at end of file