diff options
author | Tarik Gasmi | 2007-05-14 10:03:48 +0200 |
---|---|---|
committer | Tarik Gasmi | 2007-05-14 10:03:48 +0200 |
commit | 59cf91925ca8da43d2427331b23e4673b0e53095 (patch) | |
tree | 871f39414143192cb3e8bd6f4bd2b7462e7076b9 /ldap-site-mngmt | |
parent | Some webinterface data. (diff) | |
download | core-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')
180 files changed, 26418 insertions, 0 deletions
diff --git a/ldap-site-mngmt/webinterface/computers/computers.dwt b/ldap-site-mngmt/webinterface/computers/computers.dwt new file mode 100644 index 00000000..ec6d0cbc --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/computers.dwt @@ -0,0 +1,79 @@ +<html> + +<head> + <title>{SEITENTITEL}</title> + <link rel='stylesheet' href='../styles.css' type='text/css'></head> +<body> + +<table cellpadding='0' cellspacing='0' border='0' width='95%' height='8%'> + <tr> + <td width='35%'> + <table cellpadding='5' cellspacing='0' border='0' width='100%'> + <tr valign='top'> + <td width='1'></td> + <td><h2>Rechner und IP Management</h2></td> + </tr> + </table> + </td> + + <td width='40%'> + <table cellpadding='5' cellspacing='0' border='0' width='100%'> + <tr valign='top' align='left'> + <td> + <h4><a href='../start.php' class='headerlink'>Startseite</a> + >> <a href='../au/au.php' class='headerlink'>{AU}</a> [ {DOMAIN} ]</h4> + </td> + </tr> + </table> + </td> + <td width='25%'> + <table cellpadding='5' cellspacing='0' border='0' width='100%' align='right'> + <tr valign='top' align='right'> + <td> + {LOGIN} + </td> + </tr> + </table> + </td> + </tr> +</table> + +<table cellpadding='5' cellspacing='0' border='0' width='95%' height='7%'> +<tr> + <td>{MAINMENU}</td> +</tr> +</table> + +<hr align='center' width='98%' noshade> + + + +<table cellpadding='5' cellspacing='0' border='0' width='100%' height='85%'> + + <tr valign='top' height='100%'> + <td width='28%'> + <table cellpadding='5' cellspacing='0' border='0' width='100%'> + <tr><td> + + {NAVIGATION} + + </td></tr> + </table> + </td> + + <td width='72%'> + <table cellpadding='5' cellspacing='0' border='0' width='100%'> + <tr><td> + + {HAUPTFENSTER} + + </td></tr> + </table> + </td> + + </tr> +</table> + +</body> + +</html> diff --git a/ldap-site-mngmt/webinterface/computers/computers.php b/ldap-site-mngmt/webinterface/computers/computers.php new file mode 100644 index 00000000..46b686df --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/computers.php @@ -0,0 +1,28 @@ +<?php +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "Computers Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 3; +$mnr = 0; +$sbmnr = -1; +$mcnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "computers_start.dwt"; + +include("../class.FastTemplate.php"); + +include('computers_header.inc.php'); + +################################################################################### + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createComputersMenu($rollen, $mnr, $auDN, $sbmnr, $mcnr); + +################################################################################### + +include("computers_footer.inc.php"); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/computers_footer.inc.php b/ldap-site-mngmt/webinterface/computers/computers_footer.inc.php new file mode 100644 index 00000000..311721c5 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/computers_footer.inc.php @@ -0,0 +1,18 @@ +<?php + +$template->assign(array("PFAD" => $START_PATH)); + +# Daten in die Vorlage parsen +$template->parse("LOGIN", "Login"); +$template->parse("MAINMENU", "Mmenu"); +$template->parse("NAVIGATION", "Menu"); +$template->parse("HAUPTFENSTER", "Webseite"); +$template->parse("PAGE", "Vorlage"); + +# Fertige Seite an den Browser senden +$template->FastPrint("PAGE"); + +# Abmelden vom LDAP +ldap_unbind($ds); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/computers_header.inc.php b/ldap-site-mngmt/webinterface/computers/computers_header.inc.php new file mode 100644 index 00000000..d51a42d1 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/computers_header.inc.php @@ -0,0 +1,21 @@ +<?php +include("computers_menu.php"); + +$template = new FastTemplate("."); + +# dem erstellten Template-Objekt eine Vorlage zuweisen +$definedTemplates = array("Vorlage" => "computers.dwt", + "Login" => "../logout_form.inc.dwt", + "Mmenu" => "../hauptmenue.dwt", + "Menu" => "menu.dwt", + "Webseite" => $webseite); +if (isset($additionalTemplates)) { + foreach ($additionalTemplates as $templateKey => $templateFile) { + $definedTemplates[$templateKey] = $templateFile; + } +} +$template->define($definedTemplates); + +$template->assign(array("SEITENTITEL" => $titel, "AU" => $au_ou, "DOMAIN" => $assocdom, "USERCN" => $usercn)); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/computers_menu.php b/ldap-site-mngmt/webinterface/computers/computers_menu.php new file mode 100644 index 00000000..9b681bee --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/computers_menu.php @@ -0,0 +1,382 @@ +<?php + +function createComputersMenu($rollen , $mnr, $auDN, $sbmnr, $mcnr) { + + global $template, $ds, $suffix, $START_PATH; + + # Struktur der Registerkartenleiste + # Hauptmenu + $hauptmenu = array(array("link" => "computers.php", + "text" => "Übersicht", + "zugriff" => array("MainAdmin","HostAdmin","DhcpAdmin")), + array("link" => "hostoverview.php", + "text" => "Rechner", + "zugriff" => array("MainAdmin","HostAdmin","DhcpAdmin")), + array("link" => "groupoverview.php", + "text" => "Rechnergruppen", + "zugriff" => array("MainAdmin","HostAdmin","DhcpAdmin")), + array("link" => "machineconfig_default.php", + "text" => "Default MachineConfigs", + "zugriff" => array("MainAdmin","HostAdmin")), + array("link" => "new_mcdef.php", + "text" => "Neue MachineConfig", + "zugriff" => array("MainAdmin","HostAdmin")), + array("link" => "new_pxe.php", + "text" => "Neues PXE Bootmenü", + "zugriff" => array("MainAdmin","HostAdmin","DhcpAdmin"))); + + # Submenu + #$comps = array(); + $computers_array = get_hosts($auDN,array("dn","hostname","ou")); + #if (count($computers_array) != 0){ + for($n=0;$n<count($computers_array);$n++){ + $machineconfigs = get_machineconfigs($computers_array[$n]['dn'],array("dn","cn")); + $pxeconfigs = get_pxeconfigs($computers_array[$n]['dn'], array("dn","cn")); + if (count($machineconfigs) != 0){ + $mcc = array(); + for ($m=0;$m<count($machineconfigs);$m++){ + $mcc[] = array("link" => "mcdef.php?dn=".$machineconfigs[$m]['dn']."&mnr=1&sbmnr=".$n."&mcnr=".$m, + "text" => $machineconfigs[$m]['cn'], + "zugriff" => array("MainAdmin","HostAdmin","DhcpAdmin")); + } + }else{$mcc = array();} + + if (count($pxeconfigs) != 0){ + $pxec = array(); + for ($p=0;$p<count($pxeconfigs);$p++){ + $z=$m+$p; + $pxec[] = array("link" => "pxe.php?dn=".$pxeconfigs[$p]['dn']."&mnr=1&sbmnr=".$n."&mcnr=".$z, + "text" => $pxeconfigs[$p]['cn'], + "zugriff" => array("MainAdmin","HostAdmin","DhcpAdmin")); + } + }else{$pxec = array();} + + + $comps[] = array("link" => "host.php?dn=".$computers_array[$n]['dn']."&sbmnr=".$n, + "text" => $computers_array[$n]['hostname'], + "zugriff" => array("MainAdmin","HostAdmin","DhcpAdmin")); + # print_r($comps); echo "<br>"; + $mccpxec = array_merge($mcc,$pxec); + $compmc[] = $mccpxec; + + } + #} + $comps[] = array("link" => "new_host.php?sbmnr=".$n, + "text" => "Neuer Rechner", + "zugriff" => array("MainAdmin","HostAdmin")); + + $groups_array = get_groups($auDN,array("dn","cn")); + for($n=0;$n<count($groups_array);$n++){ + $machineconfigs = get_machineconfigs($groups_array[$n]['dn'],array("dn","cn")); + $pxeconfigs = get_pxeconfigs($groups_array[$n]['dn'],array("dn","cn")); + if (count($machineconfigs) != 0){ + $mcg = array(); + for ($m=0;$m<count($machineconfigs);$m++){ + $mcg[] = array("link" => "mcdef.php?dn=".$machineconfigs[$m]['dn']."&mnr=2&sbmnr=".$n."&mcnr=".$m, + "text" => $machineconfigs[$m]['cn'], + "zugriff" => array("MainAdmin","HostAdmin","DhcpAdmin")); + } + }else{$mcg = array();} + + if (count($pxeconfigs) != 0){ + $pxeg = array(); + for ($p=0;$p<count($pxeconfigs);$p++){ + $z=$m+$p; + $pxeg[] = array("link" => "pxe.php?dn=".$pxeconfigs[$p]['dn']."&mnr=2&sbmnr=".$n."&mcnr=".$z, + "text" => $pxeconfigs[$p]['cn'], + "zugriff" => array("MainAdmin","HostAdmin","DhcpAdmin")); + } + }else{$pxeg = array();} + $groups = array(); + $groups[] = array("link" => "group.php?dn=".$groups_array[$n]['dn']."&sbmnr=".$n, + "text" => $groups_array[$n]['cn'], + "zugriff" => array("MainAdmin","HostAdmin","DhcpAdmin")); + + $mcgpxeg = array_merge($mcg,$pxeg); + $groupmc[] = $mcgpxeg; + } + $groups[] = array("link" => "new_group.php?sbmnr=".$n, + "text" => "Neue Gruppe", + "zugriff" => array("MainAdmin","HostAdmin")); + # print_r($compmc); echo "<br><br>"; + # print_r($groupmc); echo "<br><br>"; + + # default machine-configs + $mcdef_array = get_machineconfigs("cn=computers,".$auDN,array("dn","cn","timerange")); + for($n=0;$n<count($mcdef_array);$n++){ + $defmc [] = array("link" => "mcdef.php?dn=".$mcdef_array[$n]['dn']."&mnr=3&sbmnr=".$n, + "text" => $mcdef_array[$n]['cn'], + "zugriff" => array("MainAdmin","HostAdmin","DhcpAdmin")); + } + + $submenu = array(array(), + $comps, + $groups, + $defmc, + array()); + #echo "submenu: ";print_r($submenu);echo "<br><br>"; + + $subsubmenu = array(array(array(array())), + $compmc, + $groupmc, + array(array(array())), + array(array(array()))); + #echo "subsubmenu: ";print_r($subsubmenu);echo "<br><br>"; + + # Zusammenstellen der Menuleiste + $template->define_dynamic("Hauptmenu", "Menu"); + $template->define_dynamic("Submenu", "Menu"); + $template->define_dynamic("Subsubmenu", "Menu"); + $i=0; + + $maxmenu = count($hauptmenu); + foreach($hauptmenu as $item){ + $template->clear_parse("SUBMENU_LIST"); + + if($item['zugriff'] === "alle" || vergleicheArrays($rollen , $item['zugriff'])) { + + ######################################################################### + # SUBMENU + + $subempty = 0; + $j=0; + $maxsub = count($submenu[$mnr]); + #echo "_"; print_r($maxsub); echo "_"; + if($maxsub > 0){ + foreach($submenu[$mnr] as $item2) { + + $template->clear_parse("SUBSUBMENU_LIST"); + + + if($item2['zugriff'] === "alle" || vergleicheArrays($rollen, $item2['zugriff'])) { + + ######################################################################## + # SUBSUBMENU + $subsubempty = 0; + $k=0; + $maxsubsub = count($subsubmenu[$mnr][$sbmnr]); + #print_r($maxsubsub); + if ($maxsubsub > 0){ + if($sbmnr >= 0){ + + foreach($subsubmenu[$mnr][$sbmnr] as $item3) { + + if($item3['zugriff'] === "alle" || vergleicheArrays($rollen, $item3['zugriff'])) { + + if($j != $sbmnr || $i != $mnr){ + + $template->assign(array("SUBSUB" => "")); + # "LINK_S" => "", + # "TEXT_S" => "")); + $template->parse("SUBSUBMENU_LIST", ".Subsubmenu"); + $template->clear_dynamic("Subsubmenu"); + $template->clear_parse("SUBSUBMENU_LIST"); + } + else{ + if ($k==0) { + if ($mcnr==0) { + if($maxsubsub == 1){$zwisch="branchbottom2";} + else {$zwisch="branch2";} + $lastaktive=true; + $farb="#505050"; + } + else{ + if($maxsubsub == 1){$zwisch="branchbottom2";} + else {$zwisch="branch2";} + $farb="#A0A0A0"; + $lastaktive=false; + } + } + else { + if ($mcnr==$k) { + if($maxsubsub == $k+1){$zwisch="branchbottom2";} + else {$zwisch="branch2";} + $lastaktive=true; + $farb="#505050"; + } + else { + $farb="#A0A0A0"; + if($maxsubsub == $k+1){$zwisch="branchbottom2";} + else {$zwisch="branch2";} + # if ($lastaktive) {$zwisch="branch";} + # else {$zwisch="branch";} + $lastaktive=false; + } + } + $htmlcode= " + <tr height='4'> + <td></td><td></td><td align='right'><img src='../pics/line2.gif' height='4'></td><td></td><td></td> + </tr> + <tr> + <td width='8%'> </td> + <td width='8%'> </td> + <td width='5%' align='right'><img src='../pics/".$zwisch.".gif'></td>
+ <td width='69%' align='left' style='border-width:1 1 1 1;border-color:#000000;border-style:solid;padding:2;padding-left:30px;background-color:{FARBE_MC}'> + <a href='".$item3['link']."' style='text-decoration:none'><b class='standard_schrift'>".$item3['text']."</b></a></td> + <td width='10%'> </td> + </tr> + "; + $template->assign(array("SUBSUB" => $htmlcode)); + $template->assign(array("FARBE_MC" => $farb)); + $template->parse("SUBSUBMENU_LIST", ".Subsubmenu"); + $template->clear_dynamic("Subsubmenu"); + + } + } + else { + $subsubempty++; + } + $k=$k+1; + } + } + + if($subsubempty == count($subsubmenu[$mnr][$sbmnr])) { + $template->assign(array("SUBSUB" => "")); + # "LINK_S" => "", + # "TEXT_S" => "")); + $template->parse("SUBSUBMENU_LIST", ".Subsubmenu"); + $template->clear_dynamic("Subsubmenu"); + $template->clear_parse("SUBSUBMENU_LIST"); + } + + } + $template->assign(array("SUBSUB" => "")); + # SUBSUBMENU + ######################################################################## + if($i != $mnr){ + $template->assign(array("SUB" => "")); + # "LINK_S" => "", + # "TEXT_S" => "")); + $template->parse("SUBMENU_LIST", ".Submenu"); + $template->clear_dynamic("Submenu"); + } + else{ + if ($j==0) { + if ($sbmnr==0) { + if($maxsub == 1){$zwisch2="";} + else {$zwisch2="";} + $lastaktive=true; + $farb="#505050"; + } + else{ + if(count($subsubmenu[$i][$j][0]) != 0){ + if($maxsub == 1){$zwisch2="<a href='".$item2['link']."' style='border-style=none;text-decoration:none'> + <img style='border-width:0;border-style=none;' src='../pics/plus2.gif'></a>";} + else {$zwisch2="<a href='".$item2['link']."' style='border-style=none;text-decoration:none'> + <img style='border-width:0;border-style=none;' src='../pics/plus2.gif'></a>";} + }else{$zwisch2="";} + $farb="#A0A0A0"; + $lastaktive=false; + } + } + else { + if ($sbmnr==$j) { + if($maxsub == $j+1){$zwisch2="";} + else {$zwisch2="";} + $lastaktive=true; + $farb="#505050"; + } + else { + if(count($subsubmenu[$i][$j][0]) != 0){ + if($maxsub == $i+1){$zwisch2="<a href='".$item2['link']."' style='border-style=none;text-decoration:none'> + <img style='border-width:0;border-style=none;' src='../pics/plus2.gif'></a>";} + else {$zwisch2="<a href='".$item2['link']."' style='border-style=none;text-decoration:none'> + <img style='border-width:0;border-style=none;' src='../pics/plus2.gif'></a>";} + }else{$zwisch2="";} + $farb="#A0A0A0"; + $lastaktive=false; + } + } + $htmlcode= " + <tr height='4'> + <td></td><td></td><td></td><td></td> + </tr> + <tr> + <td width='8%'> </td> + <td width='8%' align='right'>".$zwisch2."</td> + <td width='5%' align='left' style='border-width:1 0 1 1;border-color:#000000;border-style:solid;padding:3;background-color:{FARBE_S}'> </td>
+ <td width='69%' align='left' style='border-width:1 1 1 0;border-color:#000000;border-style:solid;padding:3;padding-left:15px;background-color:{FARBE_S}'> + <a href='".$item2['link']."' style='text-decoration:none'><b class='standard_schrift'>".$item2['text']."</b></a></td> + <td width='10%'> </td> + </tr> + "; + $template->assign(array("SUB" => $htmlcode)); + $template->assign(array("FARBE_S" => $farb)); + $template->parse("SUBMENU_LIST", ".Submenu"); + $template->clear_dynamic("Submenu"); + } + } + else { + $subempty++; + } + $j=$j+1; + } + } + if($subempty == count($submenu[$mnr])) { + $template->assign(array("SUB" => "")); + # "LINK_S" => "", + # "TEXT_S" => "")); + $template->parse("SUBMENU_LIST", ".Submenu"); + $template->clear_dynamic("Submenu"); + + } + $template->assign(array("SUBSUB" => "")); + # SUBMENU + ##################################################################### + + if ($i==0) { + if ($mnr==0) { + if(count($submenu[$i][0]) != 0){ + if($maxmenu == 1){$zwisch="";} # {$zwisch="<img style='border-width:0;border-style=none;' src='../pics/minus2.gif'>";} + else {$zwisch="";} + }else{$zwisch="";} + $lastaktive=true; + $farb="#505050"; + } + else{ + if(count($submenu[$i][0]) != 0){ + if($maxmenu == 1){$zwisch="<a href='{LINK_M}' style='border-style=none;text-decoration:none'> + <img style='border-width:0;border-style=none;' src='../pics/plus2.gif'></a>";} + else {$zwisch="<a href='{LINK_M}' style='border-style=none;text-decoration:none'> + <img style='border-width:0;border-style=none;' src='../pics/plus2.gif'></a>";} + }else{$zwisch="";} + $farb="#A0A0A0"; + $lastaktive=false; + } + } + else { + if ($mnr==$i) { + if(count($submenu[$mnr][0]) != 0){ + if($maxmenu == $i+1){$zwisch="";} + else {$zwisch="";} + }else{$zwisch="";} + $lastaktive=true; + $farb="#505050"; + } + else { + + if(count($submenu[$i][0]) != 0){ + if($maxmenu == $i+1){$zwisch="<a href='{LINK_M}' style='border-style=none;text-decoration:none'> + <img style='border-width:0;border-style=none;' src='../pics/plus2.gif'></a>";} + else {$zwisch="<a href='{LINK_M}' style='border-style=none;text-decoration:none'> + <img style='border-width:0;border-style=none;' src='../pics/plus2.gif'></a>";} + }else{$zwisch="";} + $farb="#A0A0A0"; + $lastaktive=false; + } + } + $template->assign(array("ICON" => $zwisch, + "FARBE" => $farb, + "LINK_M" => $item["link"], + "TEXT_M" => $item["text"])); + $template->parse("HAUPTMENU_LIST", ".Hauptmenu"); + $template->clear_dynamic("Hauptmenu"); + } + $i=$i+1; + } + if ($lastaktive) {$template->assign(array("ENDE" => ""));} + else{ + $template->assign(array("ENDE" => "")); + } +} +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/computers_menu.save.php b/ldap-site-mngmt/webinterface/computers/computers_menu.save.php new file mode 100644 index 00000000..183d9309 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/computers_menu.save.php @@ -0,0 +1,188 @@ +<?php + +function createComputersMenu($roles , $mnr, $auDN, $sbmnr) { + + global $template, $ds, $suffix, $START_PATH; + + # Struktur der Registerkartenleiste + # Hauptmenu + $hauptmenu = array(array("link" => "computers.php", + "text" => "Übersicht", + "zugriff" => "alle"), + array("link" => "hostoverview.php", + "text" => "Rechner", + "zugriff" => array("MainAdmin")), + array("link" => "computers.php", + "text" => "Neuen Rechner anlegen", + "zugriff" => array("MainAdmin")), + array("link" => "groupoverview.php", + "text" => "Rechnergruppen", + "zugriff" => array("MainAdmin")), + array("link" => "computers.php", + "text" => "Neue Gruppe anlegen", + "zugriff" => array("MainAdmin"))); + + # Submenu + $computers_array = get_hosts($auDN,array("dn","hostname","ou")); + for($n=0;$n<count($computers_array);$n++){ + $comps[] = array("link" => "host.php?dn=".$computers_array[$n]['dn']."&sbmnr=".$n, + "text" => $computers_array[$n]['hostname'], + "zugriff" => array("MainAdmin")); + } + $groups_array = get_groups($auDN,array("dn","cn")); + for($n=0;$n<count($groups_array);$n++){ + $groups[] = array("link" => "group.php?dn=".$groups_array[$n]['dn']."&sbmnr=".$n, + "text" => $groups_array[$n]['cn'], + "zugriff" => array("MainAdmin")); + } + $submenu = array(array(array()), + $comps, + array(array()), + $groups, + array(array())); + + $rollen = array_keys($roles); + + # Zusammenstellen der Menuleiste + $template->define_dynamic("Hauptmenu", "Menu"); + $template->define_dynamic("Submenu", "Menu"); + $i=0; + + $maxmenu = count($hauptmenu); + foreach($hauptmenu as $item){ + $template->clear_parse("SUBMENU_LIST"); + + if($item['zugriff'] === "alle" || vergleicheArrays($rollen , $item['zugriff'])) { + $subempty = 0; + $j=0; + $maxsub = count($submenu[$mnr]); + foreach($submenu[$mnr] as $item2) { + + if($item2['zugriff'] === "alle" || vergleicheArrays($rollen, $item2['zugriff'])) { + if($i != $mnr){ + $template->assign(array("SUB" => "")); + # "LINK_S" => "", + # "TEXT_S" => "")); + $template->parse("SUBMENU_LIST", ".Submenu"); + $template->clear_dynamic("Submenu"); + } + else{ + if ($j==0) { + if ($sbmnr==0) { + if($maxsub == 1){$zwisch="branchbottom2";} + else {$zwisch="branch2";} + $lastaktive=true; + $farb="#505050"; + } + else{ + if($maxsub == 1){$zwisch="branchbottom2";} + else {$zwisch="branch2";} + $farb="#A0A0A0"; + $lastaktive=false; + } + } + else { + if ($sbmnr==$j) { + if($maxsub == $j+1){$zwisch="branchbottom2";} + else {$zwisch="branch2";} + $lastaktive=true; + $farb="#505050"; + } + else { + $farb="#A0A0A0"; + if($maxsub == $j+1){$zwisch="branchbottom2";} + else {$zwisch="branch2";} + # if ($lastaktive) {$zwisch="branch";} + # else {$zwisch="branch";} + $lastaktive=false; + } + } + $htmlcode= " + <tr height='4'> + <td></td><td align='right'><img src='../pics/line2.gif' height='4'></td><td></td><td></td> + </tr> + <tr> + <td width='10%'> </td> + <td width='15%' align='right'><img src='../pics/".$zwisch.".gif'></td>
+ <td width='65%' align='left' style='border-width:1 1 1 1;border-color:#000000;border-style:solid;padding:5;padding-left:30px;background-color:{FARBE_S}'> + <a href='".$item2['link']."' style='text-decoration:none'><b class='standard_schrift'>".$item2['text']."</b></a></td> + <td width='10%'> </td> + </tr> + "; + $template->assign(array("SUB" => $htmlcode)); + $template->assign(array("FARBE_S" => $farb)); + $template->parse("SUBMENU_LIST", ".Submenu"); + $template->clear_dynamic("Submenu"); + } + } + else { + $subempty++; + } + $j=$j+1; + + } + if($subempty == count($submenu[$mnr])) { + $template->assign(array("SUB" => "")); + # "LINK_S" => "", + # "TEXT_S" => "")); + $template->parse("SUBMENU_LIST", ".Submenu"); + $template->clear_dynamic("Submenu"); + } + + if ($i==0) { + if ($mnr==0) { + if(count($submenu[$i][0]) != 0){ + if($maxmenu == 1){$zwisch="";} # {$zwisch="<img style='border-width:0;border-style=none;' src='../pics/minus2.gif'>";} + else {$zwisch="";} + }else{$zwisch="";} + $lastaktive=true; + $farb="#505050"; + } + else{ + if(count($submenu[$i][0]) != 0){ + if($maxmenu == 1){$zwisch="<a href='{LINK_M}' style='border-style=none;text-decoration:none'> + <img style='border-width:0;border-style=none;' src='../pics/plus2.gif'></a>";} + else {$zwisch="<a href='{LINK_M}' style='border-style=none;text-decoration:none'> + <img style='border-width:0;border-style=none;' src='../pics/plus2.gif'></a>";} + }else{$zwisch="";} + $farb="#A0A0A0"; + $lastaktive=false; + } + } + else { + if ($mnr==$i) { + if(count($submenu[$mnr][0]) != 0){ + if($maxmenu == $i+1){$zwisch="";} + else {$zwisch="";} + }else{$zwisch="";} + $lastaktive=true; + $farb="#505050"; + } + else { + $farb="#A0A0A0"; + if(count($submenu[$i][0]) != 0){ + if($maxmenu == $i+1){$zwisch="<a href='{LINK_M}' style='border-style=none;text-decoration:none'> + <img style='border-width:0;border-style=none;' src='../pics/plus2.gif'></a>";} + else {$zwisch="<a href='{LINK_M}' style='border-style=none;text-decoration:none'> + <img style='border-width:0;border-style=none;' src='../pics/plus2.gif'></a>";} + }else{$zwisch="";} + #if ($lastaktive) {$zwisch="";} + #else {$zwisch="";} + $lastaktive=false; + } + } + $template->assign(array("ICON" => $zwisch, + "FARBE" => $farb, + "LINK_M" => $item["link"], + "TEXT_M" => $item["text"])); + $template->parse("HAUPTMENU_LIST", ".Hauptmenu"); + $template->clear_dynamic("Hauptmenu"); + } + $i=$i+1; + } + if ($lastaktive) {$template->assign(array("ENDE" => ""));} + else{ + $template->assign(array("ENDE" => "")); + } +} +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/computers_start.dwt b/ldap-site-mngmt/webinterface/computers/computers_start.dwt new file mode 100644 index 00000000..09cade01 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/computers_start.dwt @@ -0,0 +1,42 @@ +<table border='0' cellpadding='5' cellspacing='0' width='90%'> + <tr> + <td colspan='2'><h3>Modul - Rechner und Rechnergruppen Management: </h3></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr> + <td> + <p>Dieses Modul dient der Verwaltung der Rechner und Rechnergruppen in ihrer Abteilung + (AU), inklusive ihrer spezifischen Rechner- und PXE Boot Konfigurationen<br> + Benutzen Sie die Navigation links, um die einzelnen Verwaltungsbereiche anzusteuern:</p> + <ul> + <li><p><b>Rechner</b></p> + Hier verwalten Sie ihre Rechner (anlegen, bearbeiten, löschen), und können zu dem + einige Hardware-Parameter festlegen. Daneben verwalten Sie hier rechner-spezifische + Computer-Profile (MachineConfig) und PXE Boot Konfigurationen. + </li> + <li><p><b>Rechnergruppen</b></p> + Hier verwalten Sie die Rechnergruppen (anlegen, bearbeiten, löschen), sowie + ihre gemeinsamen Hardware-Parameter. Daneben verwalten Sie hier gruppen-spezifische + Computer-Profile (MachineConfig) und PXE Boot Konfigurationen. + </li> + <li><p><b>Default MachineConfig</b></p> + Hier verwalten Sie ihre Default Computer-Profile (bearbeiten, löschen, kopieren), + d.h. Computer-Profile, die beim booten von Rechnern verwendet werden, für die + keine rechner- oder gruppen-spezifischen MachineConfigs angelegt sind. + </li> + <li><p><b>Neue MachineConfig</b></p> + Hier köennen Sie neue Computer-Profile (MachineConfigs) als rechner-, gruppen- + spezifische, oder Default MachineConfigs anlegen. + </li> + <li><p><b>Neues PXE Bootmenü</b></p> + Hier können Sie neue PXE Bootmenüs (PXEConfigs) für ihre Rechner oder + Rechnergruppen anlegen. + </li> + </ul> + + </td> + </tr> + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/delete_confirm.php b/ldap-site-mngmt/webinterface/computers/delete_confirm.php new file mode 100644 index 00000000..c3f2bc8b --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/delete_confirm.php @@ -0,0 +1,39 @@ +<?php +include('../standard_header.inc.php'); + +$dn = $_POST['dn']; +$name = $_POST['name']; +$delurl = $_POST['delurl']; +$backurl = $_POST['backurl']; +$successurl = $_POST['successurl']; + +$pxedn = $_POST['pxedn']; +echo " +<html> +<head> + <title>AU Management</title> + <link rel='stylesheet' href='../styles.css' type='text/css'> +</head> +<body> +<table border='0' cellpadding='30' cellspacing='0'> + <tr> + <td> + Wollen Sie das Objekt <b>".$name."</b> wirklich löschen?<br><br> + <form action='".$delurl."' method='post'> + Falls ja:<br><br> + <input type='hidden' name='dn' value='".$dn."'> + <input type='hidden' name='name' value='".$name."'> + <input type='hidden' name='successurl' value='".$successurl."'> + <input type='hidden' name='pxedn' value='".$pxedn."'> + <input type='Submit' name='apply' value='löschen' class='small_loginform_button'><br><br> + </form> + <form action='".$backurl."' method='post'> + Falls, nein:<br><br> + <input type='Submit' name='apply' value='zurück' class='small_loginform_button'> + </form> + </td> + </tr> +</table> +</body> +</html>"; +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/dhcphost.dwt b/ldap-site-mngmt/webinterface/computers/dhcphost.dwt new file mode 100644 index 00000000..8ab5c7af --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/dhcphost.dwt @@ -0,0 +1,84 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='4'><h3>Rechner <code class='font_object'> {HOSTNAME} </code> </h3></td> + </tr> + <tr> + <td height='20'></td> + </tr> + <tr> + <td align='center' width='15%' style='border-color: black; border-style: solid; border-width: 0 1 0 1;'><h4>{HOSTLINK} Allgemein </a></h4></td> + <td align='center' width='15%' style='border-color: black; border-style: solid; border-width: 0 1 0 0;'><h4><code class='font_object'>DHCP/RBS</code></h4></td> + <td align='center' width='15%' style='border-color: black; border-style: solid; border-width: 0 1 0 0;'><h4>{HWLINK} Hardware </a></h4></td> + <td> </td> + </tr> + <tr> + <td height='20'></td> + </tr> + <tr><td colspan='4'> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <form action='dhcphost_change.php' method='post'> + + <tr> + <td width='25%' class='tab_h'><h4><b>DHCP Setup</b></h4></td> + <td width='25%' class='tab_h'><b> </b></td> + <td width='50%' class='tab_h'><b> </b></td> + </tr> + + <tr valign='top'> + <td class='tab_d_ohne' colspan='2'><b>Eingebunden in DHCP Dienst: </b> </td> + <td class='tab_d_ohne'> + {DHCPCONT} <br></td> + <td class='tab_d'> + <select name='dhcpcont' size='4' class='medium_form_selectbox'> + <option selected value='none'>----------</option> + + <!-- BEGIN DYNAMIC BLOCK: Altdhcp --> + <option value='{ALTDN}'>{ALTCN}{ALTAU}</option> + <!-- END DYNAMIC BLOCK: Altdhcp --> + + <option value=''>Kein DHCP</option> + + </select> + </td> + </tr> + + {HOST_DHCPOPT} + + </table></td> + </tr> + <tr> + <td height='20'></td> + </tr> + <tr><td colspan='4'> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <tr> + <td width='35%' class='tab_h'><h4><b>PXE/TFTP Setup</b></h4></td> + <td width='65%' class='tab_h'><b> </b></td> + </tr> + + <tr valign='top'> + + {RBS} + + </tr> + {RBS_DHCPOPT} + + </table></td> + </tr> + + <input type='hidden' name='olddhcp' value='{OLDDHCP}'> + <input type='hidden' name='oldfixadd' value='{OLDFIXADD}'> + <input type='hidden' name='oldrbs' value='{OLDRBS}'> + <input type='hidden' name='hostip' value='{IPADDRESS}'> + <input type='hidden' name='hostdn' value='{HOSTDN}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + + <tr> + <td colspan='4'><input type='Submit' name='apply' value='anwenden' class='small_loginform_button'> + </form></td> + </tr> + + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/dhcphost.php b/ldap-site-mngmt/webinterface/computers/dhcphost.php new file mode 100644 index 00000000..5267157c --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/dhcphost.php @@ -0,0 +1,278 @@ +<?php + +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "Computers Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 3; +$mnr = 1; +$sbmnr = -1; +$mcnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "dhcphost.dwt"; + +include("../class.FastTemplate.php"); + +include('computers_header.inc.php'); + +################################################################################### + +$sbmnr = $_GET['sbmnr']; + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createComputersMenu($rollen, $mnr, $auDN, $sbmnr, $mcnr); + +################################################################################### + +$hostDN = $_GET['dn']; + +# Rechner Daten +$attributes = array("hostname","domainname","ipaddress","hwaddress","description","hlprbservice", + "dhcphlpcont","dhcpoptfixed-address","dhcpopthardware","dhcpoptfilename", + "dhcpoptnext-server","hw-mouse","hw-graphic","hw-monitor"); +$host = get_node_data($hostDN,$attributes); +$hostip = explode('_',$host['ipaddress']); +# print_r($hostip); echo "<br><br>"; +$dhcphlpcont = $host['dhcphlpcont']; +$objectDN = $dhcphlpcont; +$rbsDN = $host['hlprbservice']; + +$rbs_dhcpopt = ""; +$host_dhcpopt = ""; + +# DHCP Daten +if ($dhcphlpcont == ""){ + $dhcp = "Rechner ist in keinem DHCP Dienst angemeldet<br></td></tr> + <tr valign='top'><td class='tab_d' colspan='2'> + DHCP Dienst auswählen: "; + $objecttype = "nodhcp"; + $rbs = "<td class='tab_d_ohne' colspan='2'> + Sie müssen den Rechner zuerst in einem DHCP Dienst anmelden, bevor Sie ihn + einem Remote Boot Dienst zuordnen können <br>(DHCP Optionen!!).<br></td> + </tr> + <input type='hidden' name='rbs' value='".$rbsDN."'>"; +}else{ + # Subnet? + $objecttype = "service"; + $dhcp = ""; + $ocarray = get_node_data($dhcphlpcont,array("objectclass","dhcphlpcont")); + #print_r($ocarray); echo "<br>"; + $sub = array_search('dhcpSubnet', $ocarray['objectclass']); + #print_r($sub); + if ($sub !== false ){ + $objecttype = "subnet"; + $exp0 = explode(',',$dhcphlpcont); + $expsub = explode('=',$exp0[0]); $dhcpsub = $expsub[1]; + $dhcp .= "Subnet <b>".$dhcpsub."</b> / "; + $dhcphlpcont = $ocarray['dhcphlpcont']; + } + $exp1 = explode(',',$dhcphlpcont); + $expdhcp = explode('=',$exp1[0]); $dhcpserv = $expdhcp[1]; + $expdhcpau = explode('=',$exp1[2]); $dhcpau = $expdhcpau[1]; + $dhcp .= "Service <b>".$dhcpserv."</b> / AU <b>".$dhcpau."</b><br></td></tr> + <tr valign='top'><td class='tab_d' colspan='2'> + DHCP Dienst ändern: "; + + + $fixedaddselopt = "<option selected value='none'>------------</option>"; + switch ( $host['dhcpoptfixed-address'] ){ + case "": + $fixedaddress = "<b> - </b> <br>(dynamische Vergabe)"; + if ( $hostip[0] != "" ){ + $fixedaddselopt .= "<option value='ip'>".$hostip[0]." (IP Adresse)</option>"; + } + $fixedaddselopt .= "<option value='hostname'>".$host['hostname']." (Hostname)</option>"; + break; + case "ip": + $fixedaddress = "<b>".$hostip[0]."</b><br>(Fixe IP Adresse)"; + $fixedaddselopt .= "<option value='hostname'>".$host['hostname']." (Hostname)</option> + <option value=''>kein Eintrag (dynamische IP Vergabe)</option>"; + break; + case "hostname": + $fixedaddress = "<b>".$host['hostname']."</b><br>(Fixe IP Adresse über Hostnamen aufgelöst)"; + if ( $hostip[0] != "" ){ + $fixedaddselopt .= "<option value='ip'>".$hostip[0]." (IP Adresse)</option>"; + } + $fixedaddselopt .= "<option value=''>kein Eintrag (dynamisch)</option>"; + break; + } + + + $host_dhcpopt = "<tr><td class='tab_d_ohne' colspan='2'><b>DHCP Optionen:</b></td></tr> + <tr valign='top'> + <td class='tab_d_ohne'><b>hardware ethernet: </b> </td> + <td class='tab_d_ohne'><b>".$host['hwaddress']."</b> </td> + <td class='tab_d_ohne'> </td> + </tr> + <tr valign='top'> + <td class='tab_d'><b>fixed-address:</b> </td> + <td class='tab_d'>".$fixedaddress." </td> + <td class='tab_d'> + <select name='fixadd' size='3' class='medium_form_selectbox'> + ".$fixedaddselopt." + </select> + </td> + </tr>"; + + ########################################################### + # RBS Setup + $rbs_selectbox = ""; + $rbs_dhcpopt = ""; + $altrbs = alternative_rbservices($rbsDN); + + if (count($altrbs) != 0){ + $rbs_selectbox .= "<td class='tab_d'> + <select name='rbs' size='4' class='medium_form_selectbox'> + <option selected value='none'>----------</option>"; + + foreach ($altrbs as $item){ + $rbs_selectbox .= " + <option value='".$item['dn']."'>".$item['cn']." ".$item['au']."</option>"; + } + $rbs_selectbox .= "<option value=''>Kein RBS</option> + </select></td>"; + } + + # RBS Daten + if ($rbsDN == ""){ + + $rbs = "<td class='tab_d_ohne'><b>Remote Boot Dienst: </b> </td> + <td class='tab_d_ohne'> + Rechner ist in keinem Remote Boot Dienst angemeldet<br></td></tr> + <tr valign='top'><td class='tab_d'> + RBS auswählen: <br></td>".$rbs_selectbox; + }else{ + + $rbs = ""; + $rbsdata = get_node_data($rbsDN,array("tftpserverip")); + #print_r($rbsdata); echo "<br>"; + $exp2 = explode(',',$host['hlprbservice']); + $exprbs = explode('=',$exp2[0]); $rbserv = $exprbs[1]; + $exprbsau = explode('=',$exp2[2]); $rbsau = $exprbsau[1]; + $rbs .= "<td class='tab_d_ohne'><b>Remote Boot Dienst: </b> </td> + <td class='tab_d_ohne'> + Remote Boot Service <b>".$rbserv."</b> / AU <b>".$rbsau."</b><br> + TFTP (Boot) Server: <b>".$rbsdata['tftpserverip']."</b><br></td></tr> + <tr valign='top'><td class='tab_d'> + RBS ändern: <br></td>".$rbs_selectbox; + + $rbs_dhcpopt = "<tr><td class='tab_d_ohne' colspan='2'><b>DHCP Optionen:</b></td></tr> + <tr> + <td class='tab_d_ohne'><b>next-server</b> (TFTP Server):</td> + <td class='tab_d_ohne'>".$host['dhcpoptnext-server']." </td> + </tr> + <tr> + <td class='tab_d'><b>filename</b> (initiale remote Bootdatei):</td> + <td class='tab_d'>".$host['dhcpoptfilename']." </td> + </tr>"; + } + +} + +$template->assign(array("HOSTDN" => $hostDN, + "HOSTNAME" => $host['hostname'], + "DOMAINNAME" => $host['domainname'], + "HWADDRESS" => $host['hwaddress'], + "IPADDRESS" => $hostip[0], + "DESCRIPTION" => $host['description'], + "OLDDHCP" => $objectDN, + "OLDFIXADD" => $host['dhcpoptfixed-address'], + "OLDRBS" => $rbsDN, + "DHCPCONT" => $dhcp, + "HOST_DHCPOPT" => $host_dhcpopt, + "RBS" => $rbs, + "RBS_DHCPOPT" => $rbs_dhcpopt, + "NEXTSERVER" => $host['dhcpoptnext-server'], + "FILENAME" => $host['dhcpoptfilename'], + "HOSTLINK" => "<a href='host.php?dn=".$hostDN."&sbmnr=".$sbmnr."' class='headerlink'>", + "HWLINK" => "<a href='hwhost.php?dn=".$hostDN."&sbmnr=".$sbmnr."' class='headerlink'>", + "AUDN" => $auDN, + "SBMNR" => $sbmnr)); + + +########################################################## +# DHCP Setup + +$altdhcp = alternative_dhcpobjects($objecttype,$objectDN,$hostip[0]); +#echo "<br><br>";print_r($altdhcp); + +$template->assign(array("ALTDN" => "", + "ALTCN" => "", + "ALTAU" => "")); +if (count($altdhcp) != 0){ +$template->define_dynamic("Altdhcp", "Webseite"); + foreach ($altdhcp as $item){ + + $template->assign(array("ALTDN" => $item['dn'], + "ALTCN" => $item['cn'], + "ALTAU" => $item['au'],)); + $template->parse("ALTDHCP_LIST", ".Altdhcp"); + } +} + + +########################################################### +# RBS Setup + +/*$altrbs = alternative_rbservices($rbsDN); +#print_r($altrbs); echo "<br><br>"; +$template->assign(array("ALTRBSDN" => "", + "ALTRBSCN" => "", + "ALTRBSAU" => "")); +if (count($altrbs) != 0){ +$template->define_dynamic("Altrbs", "Webseite"); + foreach ($altrbs as $item){ + $template->assign(array("ALTRBSDN" => $item['dn'], + "ALTRBSCN" => $item['cn'], + "ALTRBSAU" => $item['au'],)); + $template->parse("ALTRBS_LIST", ".Altrbs"); + } +}*/ + + +################################################################################### + +include("computers_footer.inc.php"); + + + +/* +<tr height='50'> + <td class='tab_d'><b>DHCP Option hardware ethernet: </b> </td> + <td class='tab_d'>{HWADDRESS} + </td> + </tr> + <tr height='50'> + <td class='tab_d'><b>DHCP Option fixed-address: </td> + <td class='tab_d'>{IPADDRESS} + </td> + </tr> + +<td class='tab_d'> + <select name='rbs' size='4' class='medium_form_selectbox'> + <option selected value='none'>----------</option> + + <!-- BEGIN DYNAMIC BLOCK: Altrbs --> + <option value='{ALTRBSDN}'>{ALTRBSCN} {ALTRBSAU}</option> + <!-- END DYNAMIC BLOCK: Altrbs --> + + <option value=''>Kein RBS</option> + + </select> + </td> + <tr height='50'> + <td class='tab_d'><b>TFTP Server <br>DHCP Option next-server: </b> </td> + <td class='tab_d'>{NEXTSERVER} + </td> + </tr> + <tr height='50'> + <td class='tab_d'><b>PXE initiale Bootdatei <br>DHCP Option filename: </b> </td> + <td class='tab_d'>{FILENAME} + </td> + </tr> + + + */ +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/dhcphost_change.php b/ldap-site-mngmt/webinterface/computers/dhcphost_change.php new file mode 100644 index 00000000..907fae8f --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/dhcphost_change.php @@ -0,0 +1,177 @@ +<?php +include('../standard_header.inc.php'); + +$syntax = new Syntaxcheck; + +$dhcp = $_POST['dhcpcont']; +$olddhcp = $_POST['olddhcp']; +$hostip = $_POST['hostip']; +$fixedaddress = $_POST['fixadd']; +$oldfixedaddress = $_POST['oldfixadd']; + +$rbs = $_POST['rbs']; +$oldrbs = $_POST['oldrbs']; + +$hostDN = $_POST['hostdn']; +$sbmnr = $_POST['sbmnr']; + +$dhcp = htmlentities($dhcp); +$olddhcp = htmlentities($olddhcp); +$rbs = htmlentities($rbs); +$oldrbs = htmlentities($oldrbs); + + +/*echo "new dhcp:"; print_r($dhcp); echo "<br>"; +echo "old dhcp:"; print_r($olddhcp); echo "<br>"; +echo "new rbs:"; print_r($rbs); echo "<br>"; +echo "old rbs:"; print_r($oldrbs); echo "<br>"; +echo "Host DN:"; print_r($hostDN); echo "<br>"; +echo "submenuNR:"; print_r($sbmnr); echo "<br><br>";*/ + + +$seconds = 40; +$url = 'dhcphost.php?dn='.$hostDN.'&sbmnr='.$sbmnr; + +echo " +<html> +<head> + <title>AU Management</title> + <link rel='stylesheet' href='../styles.css' type='text/css'> +</head> +<body> +<table border='0' cellpadding='30' cellspacing='0'> +<tr><td>"; + +########################################## +# DHCP + +if ($dhcp != "none" && $dhcp != $olddhcp){ + if ($dhcp != ""){ + $exp = ldap_explode_dn($dhcp, 1); + $dhcpcn = $exp[0]; + $dhcpau = $exp[2]; + + $entrydhcp ['dhcphlpcont'] = $dhcp; + if ($olddhcp != ""){ + echo "DHCP replace "; print_r($olddhcp); echo " with "; print_r($entrydhcp); echo "<br>"; + if ($result = ldap_mod_replace($ds,$hostDN,$entrydhcp)){ + $mesg = "Rechner erfolgreich in DHCP <b>".$dhcpcn." [Abt.: ".$dhcpau."]</b> angemeldet<br><br>"; + }else{ + $mesg = "Fehler beim ändern des DHCP Dienstes zu <b>".$dhcpcn."</b>!<br><br>"; + } + }else{ + if ( $hostip != "" ){ + $entrydhcp ['dhcpoptfixed-address'] = "ip"; + } + echo "DHCP add "; print_r($entrydhcp); echo "<br>"; + if ($result = ldap_mod_add($ds,$hostDN,$entrydhcp)){ + $mesg = "Rechner erfolgreich in DHCP <b>".$dhcpcn." [Abt.: ".$dhcpau."]</b> angemeldet<br><br>"; + }else{ + $mesg = "Fehler beim ändern des DHCP Dienstes zu <b>".$dhcpcn."</b>!<br><br>"; + } + } + }else{ + $entrydhcp ['dhcphlpcont'] = array(); + if ( $fixedaddress != "" ){ + $entrydhcp ['dhcpoptfixed-address'] = array(); + } + echo "DHCP delete "; echo "<br>"; + if ($result = ldap_mod_del($ds,$hostDN,$entrydhcp)){ + $mesg = "Rechner erfolgreich aus DHCP gelöscht<br><br>"; + }else{ + $mesg = "Fehler beim löschen aus DHCP Dienst!<br><br>"; + } + } + +} +if ($dhcp == "none"){ + echo " DHCP none <br>"; +} + +# DHCP Option fixed-address +if ($fixedaddress != "none" && $fixedaddress != $oldfixedaddress){ + if ($fixedaddress != ""){ + $entryfixadd ['dhcpoptfixed-address'] = $fixedaddress; + if ($oldfixedaddress != ""){ + echo "Fixed Address ändern"; echo "<br>"; + if ($result = ldap_mod_replace($ds,$hostDN,$entryfixadd)){ + $mesg = "Option Fixed-Address erfolgreich auf <b>".$fixedaddress."</b> geändert<br><br>"; + }else{ + $mesg = "Fehler beim ändern der Option Fixed-Address auf <b>".$fixedaddress."</b>!<br><br>"; + } + }else{ + echo "Fixed Address auf IP Adresse setzen"; echo "<br>"; + if ($result = ldap_mod_add($ds,$hostDN,$entryfixadd)){ + $mesg = "Option Fixed-Address erfolgreich auf <b>".$fixedaddress."</b> gesetzt<br><br>"; + }else{ + $mesg = "Fehler beim setzen der Option Fixed-Address auf <b>".$fixedaddress."</b>!<br><br>"; + } + } + }else{ + $entryfixadd ['dhcpoptfixed-address'] = array(); + echo "No Fixed Address"; echo "<br>"; + if ($result = ldap_mod_del($ds,$hostDN,$entryfixadd)){ + $mesg = "Option Fixed-Address erfolgreich gelöscht<br><br>"; + }else{ + $mesg = "Fehler beim löschen der Option Fixed-Address!<br><br>"; + } + } +} + + +########################################## +# RBS + +if ($rbs != "none" && $rbs != $oldrbs){ + if ($rbs != ""){ + $exp = ldap_explode_dn($rbs, 1); + $rbscn = $exp[0]; + $rbsau = $exp[2]; + + $dhcpdata = get_node_data($rbs,array("tftpserverip","initbootfile")); + $entryrbs ['hlprbservice'] = $rbs; + $entryrbs ['dhcpoptnext-server'] = $dhcpdata['tftpserverip']; + $entryrbs ['dhcpoptfilename'] = $dhcpdata['initbootfile']; + if ($oldrbs != ""){ + echo "RBS replace "; print_r($oldrbs); echo " with "; print_r($entryrbs); echo "<br>"; + if ($result = ldap_mod_replace($ds,$hostDN,$entryrbs)){ + rbs_adjust_host($hostDN, $rbs); + $mesg = "Remote Boot Service erfolgreich zu <b>".$rbscn." [Abt.: ".$rbsau."]</b> geändert<br><br>"; + }else{ + $mesg = "Fehler beim ändern des Remote Boot Services zu <b>".$rbscn."</b>!<br><br>"; + } + }else{ + echo "RBS add "; print_r($entryrbs); echo "<br>"; + if ($result = ldap_mod_add($ds,$hostDN,$entryrbs)){ + rbs_adjust_host($hostDN, $rbs); + $mesg = "Remote Boot Service erfolgreich zu <b>".$rbscn." [Abt.: ".$rbsau."]</b> geändert<br><br>"; + }else{ + $mesg = "Fehler beim ändern des Remote Boot Services zu <b>".$rbscn."</b>!<br><br>"; + } + } + }else{ + $entryrbs ['hlprbservice'] = array(); + $entryrbs ['dhcpoptnext-server'] = array(); + $entryrbs ['dhcpoptfilename'] = array(); + echo "RBS delete "; echo "<br>"; + if ($result = ldap_mod_del($ds,$hostDN,$entryrbs)){ + $mesg = "Rechner erfolgreich aus RBS gelöscht<br><br>"; + }else{ + $mesg = "Fehler beim löschen aus RBS!<br><br>"; + } + } +} +if ($rbs == "none"){ + echo "RBS none <br>"; +} + + +##################### + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurü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 diff --git a/ldap-site-mngmt/webinterface/computers/group.dwt b/ldap-site-mngmt/webinterface/computers/group.dwt new file mode 100644 index 00000000..cda53f18 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/group.dwt @@ -0,0 +1,397 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='2'><h3>Daten bearbeiten Gruppe <code class='font_object'>{GROUPCN}</code> </h3></td> + </tr> + <tr> + <td height='20'></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <form action='group_change.php' method='post'> + + <tr> + <td width='45%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='55%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Eindeutiger Gruppenname (cn):</b><br>(Teil des dn, ohne Leerzeichen eingeben) </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='groupcn' value='{GROUPCN}' size='40' class='medium_form_field'> + <input type='hidden' name='oldgroupcn' value='{GROUPCN}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Beschreibung: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='groupdesc' value='{GROUPDESC}' size='40' class='medium_form_field'> + <input type='hidden' name='oldgroupdesc' value='{GROUPDESC}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Gruppen-Rechner:</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + + <b>Aktuelle Mitglieder</b> (zum Löschen bitte Häkchen setzen):<br> + <!-- BEGIN DYNAMIC BLOCK: Members --> + <input type='checkbox' name='delmember[]' value='{MEMBERDN}' size='40' class='medium_form_field'> {MEMBER}<br> + <!-- END DYNAMIC BLOCK: Members --> + <br> + + <b>Als neues Mitglied aufnehmen</b> (Mehrfachauswahl möglich)<br> + <select name='addmember[]' size='{HOSTNUMBER}' multiple class='medium_form_selectbox'> + <option selected value='none'>----------</option> + + <!-- BEGIN DYNAMIC BLOCK: Hosts --> + <option value='{HDN}_{HN}'>{HN}</option> + <!-- END DYNAMIC BLOCK: Hosts --> + + </select> + </td> + </tr> + + + <input type='hidden' name='groupdn' value='{GROUPDN}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + + </table></td> + </tr> + <tr> + <td><input type='Submit' name='apply' value='anwenden' class='small_loginform_button'> + </form></td> + </tr> + + <tr> + <td height='40'></td> + </tr> + + <tr> + <td colspan='2'><h4>Gruppe - <code class='font_object'>{GROUPCN}</code> - löschen:</h4></td> + </tr> + <tr> + <td> + <table cellpadding='7' cellspacing='0' border='0' align='left' width='90%' style='border-width: 0 0 0 0;'> + <form action='delete_confirm.php' method='post'> + + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + Die Rechnergruppe wird komplett gelöscht, <br>d.h. inklusive aller spezifisch für sie angelegten + Hardware-Profile (MachineConfig) und PXE Bootmenüs. + </tr> + + <input type='hidden' name='dn' value='{GROUPDN}'> + <input type='hidden' name='name' value='{GROUPCN}'> + <input type='hidden' name='delurl' value='group_delete.php'> + <input type='hidden' name='backurl' value='group.php?dn={GROUPDN}&sbmnr={SBMNR}'> + + + </table></td> + </tr> + <tr> + <td> + <input type='Submit' name='apply' value='löschen' class='small_loginform_button'> + </form></td> + </tr> + + + <tr> + <td height='50'></td> + </tr> + + <tr> + <td colspan='2'><h4>Wochen Übersicht Machine Configs Gruppe <code class='font_object'>{GROUPCN}</code> :</h4></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr><td> + <table cellpadding='0' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + <tr align='center'> + <td width='9%' style='border-color: black; border-style: solid; border-width: 2 0 2 2;'><b>Uhrzeit</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 0 2 1;'><b>Montag</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 0 2 1;'><b>Dienstag</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 0 2 1;'><b>Mittwoch</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 0 2 1;'><b>Donnerstag</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 0 2 1;'><b>Freitag</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 0 2 1;'><b>Samstag</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 2 2 1;'><b>Sonntag</b></td> + </tr> + <tr heigth='2' align='center'> + <td width='9%' style='border-color: black; border-style: solid; border-width: 0 0 0 2;'>0</td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A0}'> </td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B0}'> </td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C0}'> </td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D0}'> </td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E0}'> </td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F0}'> </td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G0}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A1}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B1}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C1}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D1}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E1}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F1}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G1}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>2</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A2}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B2}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C2}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D2}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E2}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F2}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G2}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A3}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B3}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C3}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D3}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E3}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F3}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G3}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>4</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A4}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B4}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C4}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D4}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E4}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F4}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G4}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A5}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B5}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C5}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D5}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E5}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F5}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G5}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>6</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A6}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B6}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C6}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D6}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E6}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F6}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G6}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A7}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B7}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C7}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D7}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E7}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F7}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G7}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>8</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A8}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B8}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C8}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D8}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E8}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F8}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G8}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A9}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B9}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C9}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D9}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E9}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F9}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G9}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>10</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A10}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B10}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C10}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D10}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E10}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F10}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G10}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A11}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B11}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C11}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D11}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E11}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F11}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G11}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>12</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A12}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B12}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C12}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D12}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E12}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F12}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G12}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A13}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B13}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C13}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D13}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E13}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F13}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G13}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>14</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A14}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B14}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C14}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D14}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E14}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F14}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G14}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A15}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B15}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C15}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D15}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E15}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F15}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G15}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>16</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A16}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B16}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C16}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D16}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E16}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F16}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G16}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A17}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B17}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C17}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D17}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E17}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F17}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G17}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>18</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A18}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B18}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C18}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D18}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E18}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F18}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G18}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A19}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B19}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C19}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D19}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E19}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F19}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G19}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>20</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A20}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B20}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C20}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D20}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E20}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F20}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G20}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A21}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B21}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C21}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D21}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E21}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F21}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G21}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>22</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A22}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B22}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C22}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D22}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E22}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F22}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G22}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 1;{A23}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 1;{B23}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 1;{C23}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 1;{D23}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 1;{E23}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 1;{F23}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 2 1;{G23}'> </td> + </tr> + + </table></td> + </tr> + + <tr> + <td height='10'></td> + </tr> + <tr> + <td colspan='2'><h4>Legende:</h4></td> + </tr> + <tr><td> + <table cellpadding='3' cellspacing='3' border='1' align='left' width='50%' style='border-width: 0 0 0 0;'> + <tr> + <td width='65%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'><b>Machine Config</b></td> + <td width='5%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> </td> + <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'><b>Farbe</b></td> + </tr> + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'>Keine Konfiguration </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 1 1 1;'> </td> + </tr> + + <!-- BEGIN DYNAMIC BLOCK: Legende --> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'>{DESCRIPTION} </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 1 1 1;background-color:{COLOR};'> </td> + </tr> + <!-- END DYNAMIC BLOCK: Legende --> + + </table></td> + </tr> + + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/group.php b/ldap-site-mngmt/webinterface/computers/group.php new file mode 100644 index 00000000..13819e62 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/group.php @@ -0,0 +1,120 @@ +<?php + +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "Computers Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 3; +$mnr = 2; +$sbmnr = -1; +$mcnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "group.dwt"; + +include("../class.FastTemplate.php"); + +include('computers_header.inc.php'); + +################################################################################### + +$sbmnr = $_GET['sbmnr']; + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createComputersMenu($rollen, $mnr, $auDN, $sbmnr, $mcnr); + +################################################################################### + +$groupDN = $_GET['dn']; + +$group = get_node_data($groupDN,array("cn","description","member","dhcphlpcont")); + +$template->assign(array("GROUPDN" => $groupDN, + "GROUPCN" => $group['cn'], + "GROUPDESC" => $group['description'], + # "MEMBERS" => $anzahlmember, + "MEMBER" => $group['member'], + "DHCPCONT" => $group['dhcphlpcont'], + "AUDN" => $auDN, + "SBMNR" => $sbmnr)); + +$template->define_dynamic("Members", "Webseite"); + +if ( count($group['member']) == 1 ){ + $member = $group['member']; + $group = array(); + $group['member'][] = $member; +} + +if ( count($group['member']) != 0 ){ + sort($group['member']); + foreach ($group['member'] as $member){ + $exp = explode(',',$member); + $memberexp = explode('=',$exp[0]); + $membername = $memberexp[1]; + $template->assign(array("MEMBERDN" => $member, + "MEMBER" => $membername)); + $template->parse("MEMBERS_LIST", ".Members"); + } +} + +############################################## +# neues Member anlegen ... +$hosts_array = get_hosts($auDN,array("dn","hostname")); +# print_r($hosts_array); echo "<br><br>"; +$groups = get_groups($auDN, array("member")); +$template->assign(array("HN" => "")); + +foreach ($groups as $group){ + for ($i=0; $i < count($hosts_array); $i++){ + if (count($group['member']) > 1){ + foreach ($group['member'] as $item){ + if ($hosts_array[$i]['dn'] == $item){ + array_splice($hosts_array, $i, 1); + $i--; # da ja ein Member gelöscht wurde + } + } + } + if (count($group['member']) == 1){ + if ($hosts_array[$i]['dn'] == $group['member']){ + array_splice($hosts_array, $i, 1); + } + } + } +} +#print_r($hosts_array);echo"<br>"; + +$template->define_dynamic("Hosts", "Webseite"); +foreach ($hosts_array as $item){ + $template->assign(array("HDN" => $item['dn'], + "HN" => $item['hostname'], + "HOSTNUMBER" => 5)); + $template->parse("HOSTS_LIST", ".Hosts"); +} + + +########################################################## +# MC Wochenübersicht +$mc_array = get_machineconfigs($groupDN,array("dn","cn","timerange","description")); +# print_r($mc_array); +for ($i=0; $i<count($mc_array); $i++){ + # Timerange Komponenten + if (count($mc_array[$i]['timerange']) > 1 ){ + foreach ($mc_array[$i]['timerange'] as $tr){ + $exptime = array_merge(explode('_',$tr),$mc_array[$i]['description']); + $timeranges[$i][] = $exptime; # Für grafische Wo-Ansicht + } + }else{ + $exptime = array_merge(explode('_',$mc_array[$i]['timerange']), $mc_array[$i]['description']); + $timeranges[$i] = $exptime; # Für grafische Wo-Ansicht + } +} +include("mc_wochenplan.php"); + + +################################################################################### + +include("computers_footer.inc.php"); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/group_add.php b/ldap-site-mngmt/webinterface/computers/group_add.php new file mode 100644 index 00000000..dfc7fbe7 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/group_add.php @@ -0,0 +1,84 @@ +<?php +include('../standard_header.inc.php'); + +$groupcn = $_POST['groupcn']; +$groupdesc = $_POST['groupdesc']; +$addmember = $_POST['addmember']; + +$groupcn = htmlentities($groupcn); +$groupdesc = htmlentities($groupdesc); + +/* +echo "AU dn:"; print_r($auDN); echo "<br>"; +echo "groupcn:"; print_r($groupcn); echo "<br>"; +echo "groupdesc:"; print_r($groupdesc); echo "<br>"; +echo "members to add:"; print_r($addmember); echo "<br>"; +*/ + +$seconds = 2; + +echo " +<html> +<head> + <title>AU Management</title> + <link rel='stylesheet' href='../styles.css' type='text/css'> +</head> +<body> +<table border='0' cellpadding='30' cellspacing='0'> +<tr><td>"; + +if ( $groupcn != ""){ + + # Formulareingaben anpassen + $expgr = explode(" ",$groupcn); + foreach ($expgr as $word){$expuc[] = ucfirst($word);} + $groupcn = implode(" ",$expuc); + $groupcn = preg_replace ( '/\s+([0-9A-Z])/', '$1', $groupcn); + + # Host Objekt anlegen + $brothers = get_hosts($auDN,array("groupcn")); + $brother = 0; + foreach ($brothers as $item){ + if( $item['groupcn'] == $groupcn ){ + $mesg = "Es existiert bereits eine Gruppe mit dem eingegebenen Namen (CN)!<br> + Bitte geben Sie einen anderen Namen (CN) ein.<br><br>"; + $get_groupdesc = str_replace ( " ", "_", $groupdesc ); + $url = "new_group.php?groupcn=Hier_anderen_CN_eingeben&groupdesc=".$get_groupdesc; + $brother = 1; + break; + } + } + if ($brother == 0){ + $groupDN = "cn=".$groupcn.",cn=groups,".$auDN; + # print_r($groupDN); echo "<br>"; + + if (add_group($groupDN,$groupcn,$groupdesc,$addmember)){ + $mesg .= "<br>Neue Rechnergruppe erfolgreich angelegt<br>"; + } + else{ + $mesg .= "<br>Fehler beim anlegen der Rechnergruppe!<br>"; + } + + $url = 'groupoverview.php'; + } +} + + +elseif ( $groupcn == ""){ + + $get_groupdesc = str_replace ( " ", "_", $groupdesc ); + $mesg = "Sie haben den CN der neuen Gruppe nicht angegeben. Dieser ist aber ein notwendiges Attribut.<br> + Bitte geben Sie ihn an.<br><br>"; + $url = "new_group.php?ou=Hier_CN_eingeben&groupdesc=".$get_groupdesc; +} + + + + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurü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 diff --git a/ldap-site-mngmt/webinterface/computers/group_change.php b/ldap-site-mngmt/webinterface/computers/group_change.php new file mode 100644 index 00000000..cb26a429 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/group_change.php @@ -0,0 +1,252 @@ +<?php +include('../standard_header.inc.php'); + +$groupcn = $_POST['groupcn']; +$oldgroupcn = $_POST['oldgroupcn']; +$groupdesc = $_POST['groupdesc']; +$oldgroupdesc = $_POST['oldgroupdesc']; + +$delmember = $_POST['delmember']; + +$addmember = $_POST['addmember']; +$n = array_search('none',$addmember); +if ($n === 0 ){array_splice($addmember, $n, 1);} + +$groupDN = $_POST['groupdn']; +$sbmnr = $_POST['sbmnr']; + +$syntax = new Syntaxcheck; + +$groupcn = htmlentities($groupcn); +$oldgroupcn = htmlentities($oldgroupcn); +$groupdesc = htmlentities($groupdesc); +$oldgroupdesc = htmlentities($oldgroupdesc); + +/* +echo "new groupcn:"; print_r($groupcn); echo "<br>"; +echo "old groupcn:"; print_r($oldgroupcn); echo "<br>"; +echo "new groupdesc:"; print_r($groupdesc); echo "<br>"; +echo "old groupdesc:"; print_r($oldgroupdesc); echo "<br><br>"; + +echo "members to delete:"; print_r($delmember); echo "<br><br>"; +echo "members to add:"; print_r($addmember); echo "<br><br>"; + +echo "Group DN:"; print_r($groupDN); echo "<br>"; +echo "submenuNR:"; print_r($submenu); echo "<br><br>"; +*/ + +$seconds = 2; +$url = 'group.php?dn='.$groupDN.'&sbmnr='.$sbmnr; + +echo " +<html> +<head> + <title>AU Management</title> + <link rel='stylesheet' href='../styles.css' type='text/css'> +</head> +<body> +<table border='0' cellpadding='30' cellspacing='0'> +<tr><td>"; + +############################################## +# CN (DN) + +if ( $oldgroupcn == $groupcn ){ + # $mesg = "keine Aenderung<br>"; +} + +if ( $oldgroupcn != "" && $groupcn != "" && $oldgroupcn != $groupcn ){ + echo "Gruppenname aendern<br>"; + # hier noch Syntaxcheck + # Formulareingaben anpassen + $expgr = explode(" ",$groupcn); + foreach ($expgr as $word){$expuc[] = ucfirst($word);} + $groupcn = implode(" ",$expuc); + $groupcn = preg_replace ( '/\s+([0-9A-Z])/', '$1', $groupcn); + + + $newgroupDN = "cn=".$groupcn.",cn=groups,".$auDN; + print_r($newgroupDN); echo "<br><br>"; + + modify_group_dn($groupDN, $newgroupDN); + + # newsubmenu holen... + $url = 'group.php?dn='.$newgroupDN.'&sbmnr='.$sbmnr; +} + +if ( $oldgroupcn != "" && $groupcn == "" ){ + echo "Gruppenname loeschen!<br> + Dieses ist Teil des DN, Sie werden die Gruppe komplett löschen<br><br>"; + echo "Wollen Sie die Gruppe <b>".$oldgroupcn."</b>mit seinen Hardware-Profilen (MachineConfigs) + und PXE Bootmenüs wirklich löschen?<br><br> + <form action='group_delete.php' method='post'> + Falls ja:<br><br> + <input type='hidden' name='dn' value='".$groupDN."'> + <input type='hidden' name='name' value='".$oldgroupcn."'> + <input type='Submit' name='apply' value='löschen' class='small_loginform_button'><br><br> + </form> + <form action='".$url."' method='post'> + Falls, nein:<br><br> + <input type='Submit' name='apply' value='zurück' class='small_loginform_button'> + </form>"; + $seconds = 600; +} + + +######################################## +# Member löschen/aufnehmen + +if ( count($delmember) == 0 || count($addmember) == 0 ){ + # $mesg = "keine Aenderung<br>"; +} + +if ( count($delmember) != 0 ){ + echo "Gruppen-Mitglieder löschen<br>"; + # hier noch Syntaxcheck + # print_r($delmember); echo "<br><br>"; + + $i = 0; + foreach ($delmember as $member){ + $entry['member'][$i] = $member; + $i++; + } + #print_r($entry); echo "<br><br>"; + + if ($result = ldap_mod_del($ds,$groupDN,$entry)){ + # Fehler hier muessen die verbliebenen Members hin!!! + # Filenames in PXEs die an der Gruppe hängen anpassen + $pxes = get_pxeconfigs($groupDN,array("dn")); + foreach ($pxes as $pxe){ + if ( $entry['member'] > 1 ){ + $j = 0; + foreach ($entry['member'] as $host){ + $macdata = get_node_data($host, array("hwaddress")); + $entryfilename ['filename'][$j] = "01-".$macdata['hwaddress']; + $j++; + } + } + if ( $entry['member'] == 1 ){ + $macdata = get_node_data($entry['member'], array("hwaddress")); + $entryfilename ['filename'] = "01-".$macdata['hwaddress']; + } + ldap_mod_del($ds,$pxe['dn'],$entryfilename); + } + $mesg = "Gruppen-Mitglieder erfolgreich gelöscht<br><br>"; + }else{ + $mesg = "Fehler beim löschen der Gruppen-Mitglieder<br><br>"; + } +} + +if ( count($addmember) != 0 ){ + + echo "Gruppen-Mitglieder anlegen<br>"; + # hier noch Syntaxcheck + $members = get_node_data($groupDN,array("member")); + if ( count($members['member']) == 1 ){ + $member = $members['member']; + $members = array(); + $members['member'][] = $member; + } + if (count($members['member']) != 0){ + foreach ($members['member'] as $member){ + $entry2['member'][] = $member; + } + } + $i = 0; + foreach ($addmember as $member){ + $exp = explode('_',$member); + # Falls ein neues Mitglied keine MAC hat und an der Gruppe PXEs hängen + # dann wird diese nicht aufgenommen ... + $macdata = get_node_data($exp[0], array("hwaddress")); + $pxes = get_pxeconfigs($groupDN,array("dn","filename")); + if ( count($pxes) != 0 && $macdata['hwaddress'] == "" ){ + echo "Rechner ".$exp[1]." hat keine MAC Adresse eingetragen. <br> + Fü die Gruppe sind PXE Bootmenüs definiert. <br> + Da MACs für die PXE Datei notwendig ist wird der Rechner nicht aufgenommen!"; + } + else{ + $entry2['member'][] = $exp[0]; + } + $i++; + + } + + #print_r($entry2); echo "<br><br>"; + + if ($result = ldap_mod_replace($ds, $groupDN, $entry2)){ + + # PXEs die an der Gruppe hängen anpassen + $pxes = get_pxeconfigs($groupDN,array("dn")); + foreach ($pxes as $pxe){ + if ( $entry2['member'] > 1 ){ + $j = 0; + foreach ($entry2['member'] as $host){ + $macdata = get_node_data($host, array("hwaddress")); + $entryfilename ['filename'][$j] = "01-".$macdata['hwaddress']; + $j++; + } + } + if ( $entry2['member'] == 1 ){ + $macdata = get_node_data($entry2['member'], array("hwaddress")); + $entryfilename ['filename'] = "01-".$macdata['hwaddress']; + } + ldap_mod_replace($ds,$pxe['dn'],$entryfilename); + } + $mesg = "Gruppen-Mitglieder erfolgreich angelegt<br><br>"; + }else{ + $mesg = "Fehler beim anlegen der Gruppen-Mitglieder<br><br>"; + } +} + + +##################################### +# Description + +if ( $oldgroupdesc == $groupdesc ){ + # $mesg = "keine Aenderung<br>"; +} + +if ( $oldgroupdesc == "" && $groupdesc != "" ){ + echo "Gruppen-Beschreibung neu anlegen<br>"; + # hier noch Syntaxcheck + $entry['description'] = $groupdesc; + if($result = ldap_mod_add($ds,$groupDN,$entry)){ + $mesg = "Gruppen-Beschreibung erfolgreich eingetragen<br><br>"; + }else{ + $mesg = "Fehler beim eintragen der Gruppen-Beschreibung<br><br>"; + } +} + +if ( $oldgroupdesc != "" && $groupdesc != "" && $oldgroupdesc != $groupdesc ){ + echo "Gruppen-Beschreibung aendern<br>"; + # hier noch Syntaxcheck + $entry['description'] = $groupdesc; + if($result = ldap_mod_replace($ds,$groupDN,$entry)){ + $mesg = "Gruppen-Beschreibung erfolgreich geaendert<br><br>"; + }else{ + $mesg = "Fehler beim aendern der Gruppen-Beschreibung<br><br>"; + } +} + +if ( $oldgroupdesc != "" && $groupdesc == "" ){ + echo "Gruppen-Beschreibung loeschen<br>"; + # hier noch Syntaxcheck + $entry['description'] = $oldgroupdesc; + if($result = ldap_mod_del($ds,$groupDN,$entry)){ + $mesg = "Gruppen-Beschreibung erfolgreich geloescht<br><br>"; + }else{ + $mesg = "Fehler beim loeschen der Gruppen-Beschreibung<br><br>"; + } +} + + + + + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurü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 diff --git a/ldap-site-mngmt/webinterface/computers/group_delete.php b/ldap-site-mngmt/webinterface/computers/group_delete.php new file mode 100644 index 00000000..2a7e3d29 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/group_delete.php @@ -0,0 +1,47 @@ +<?php +include('../standard_header.inc.php'); + +$groupDN = $_POST['dn']; +$groupcn = $_POST['name']; +$groupDN = htmlentities($groupDN); +$groupcn = htmlentities($groupcn); + +/* +echo "AU dn:"; print_r($auDN); echo "<br>"; +echo "groupdn:"; print_r($groupDN); echo "<br>"; +echo "groupcn:"; print_r($groupcn); echo "<br>"; +*/ + +$seconds = 1; +$url = 'groupoverview.php'; + +echo " +<html> +<head> + <title>AU Management</title> + <link rel='stylesheet' href='../styles.css' type='text/css'> +</head> +<body> +<table border='0' cellpadding='30' cellspacing='0'> +<tr><td>"; + +if ( $groupDN != ""){ + + if ( delete_group($groupDN) ){ + $mesg = "Rechnergruppe <b>".$groupcn."</b> erfolgreich gelöscht!<br><br>"; + } + else{ + $mesg = "Fehler beim löschen der Rechnergruppe <b>".$groupcn."</b> !<br><br>"; + } + +} + + + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurü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 diff --git a/ldap-site-mngmt/webinterface/computers/groupoverview.dwt b/ldap-site-mngmt/webinterface/computers/groupoverview.dwt new file mode 100644 index 00000000..d875c3be --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/groupoverview.dwt @@ -0,0 +1,38 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='2'><h3>Rechnergruppen <code class='font_object'>{AU}</code> </h3></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + <tr> + <td width='20%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Rechnergruppe</b></td> + <td width='25%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Anzahl Rechner</b></td> + <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>DHCP</b></td> + </tr> + + + + <!-- BEGIN DYNAMIC BLOCK: Gruppen --> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>{GROUPCN} </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>{MEMBERS} </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>{DHCPCONT} </td> + </tr> + <!-- END DYNAMIC BLOCK: Gruppen --> + + </table></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr> + <td> + Zum Verwalten einer bestimmten Gruppe, wählen Sie links entsprechenden Submenü-Eintrag.<br> + + </td> + </tr> + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/groupoverview.php b/ldap-site-mngmt/webinterface/computers/groupoverview.php new file mode 100644 index 00000000..b9f9ce05 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/groupoverview.php @@ -0,0 +1,64 @@ +<?php + +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "Computers Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 3; +$mnr = 2; +$sbmnr = -1; +$mcnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "groupoverview.dwt"; + +include("../class.FastTemplate.php"); + +include('computers_header.inc.php'); + +################################################################################### + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createComputersMenu($rollen, $mnr, $auDN, $sbmnr, $mcnr); + +################################################################################### + +$template->assign(array("DN" => "", + "GROUPCN" => "Noch keine Rechnergruppen angelegt", + "GROUPDESC" => "", + "MEMBERS" => "", + "DHCPCONT" => "")); + +$attributes = array("dn","cn","member","description","dhcphlpcont"); +$group_array = get_groups($auDN,$attributes); + +$template->define_dynamic("Gruppen", "Webseite"); + +foreach ($group_array as $group){ + + $anzahlmember = count($group['member']); + + if ( count($group['dhcphlpcont']) != 0 ){ + $subnetCN = explode('cn=',$group['dhcphlpcont']); + $subnet = explode(',', $subnetCN[1]); + $dhcpcont = "Subnet $subnet[0]"; + }else{$dhcpcont = "";} + + $template->assign(array("DN" => $group['dn'], + "GROUPCN" => $group['cn'], + "GROUPDESC" => $group['description'], + "MEMBERS" => $anzahlmember, + # "MEMBER" => $group['member'], + "DHCPCONT" => $dhcpcont, + "AUDN" => $auDN )); + $template->parse("GRUPPEN_LIST", ".Gruppen"); +} + + + +################################################################################### + +include("computers_footer.inc.php"); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/host.dwt b/ldap-site-mngmt/webinterface/computers/host.dwt new file mode 100644 index 00000000..13d1da11 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/host.dwt @@ -0,0 +1,421 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='4'><h3>Rechner <code class='font_object'> {HOSTNAME} </code> </h3></td> + </tr> + <tr> + <td height='20'></td> + </tr> + <tr> + <td align='center' width='15%' style='border-color: black; border-style: solid; border-width: 0 1 0 1;'><h4><code class='font_object'>Allgemein</code></h4></td> + <td align='center' width='15%' style='border-color: black; border-style: solid; border-width: 0 1 0 0;'><h4>{DHCPLINK} DHCP/RBS </a></h4></td> + <td align='center' width='15%' style='border-color: black; border-style: solid; border-width: 0 1 0 0;'><h4>{HWLINK} Hardware </a></h4></td> + <td> </td> + </tr> + <tr> + <td height='20'></td> + </tr> + <tr><td colspan='4'> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <form action='host_change.php' method='post'> + + <tr> + <td width='45%' class='tab_h'><b>Attribut</b></td> + <td width='55%' class='tab_h'><b>Wert</b></td> + </tr> + + <tr height='50'> + <td class='tab_d'><b>Eindeutiger Rechnername (hostname):</b><br>(Teil des dn, ohne Leerzeichen eingeben) </td> + <td class='tab_d'> + <input type='Text' name='hostname' value='{HOSTNAME}' size='40' class='medium_form_field'> + <input type='hidden' name='oldhostname' value='{HOSTNAME}'> + </td> + </tr> + <tr height='50'> + <td class='tab_d'><b>Rechner Beschreibung: </td> + <td class='tab_d'> + <input type='Text' name='desc' value='{DESCRIPTION}' size='40' class='medium_form_field'> + <input type='hidden' name='olddesc' value='{DESCRIPTION}'> + + </td> + </tr> + <tr height='50'> + <td class='tab_d'><b>MAC Adresse:</b> </td> + <td class='tab_d'> + <input type='Text' name='mac' value='{HWADDRESS}' size='17' maxlength='17' class='medium_form_field'> + <input type='hidden' name='oldmac' value='{HWADDRESS}'> + (Format hex:hex:hex:hex:hex:hex) + </td> + </tr> + <tr height='50'> + <td class='tab_d'><b>IP Adresse:</b> </td> + <td class='tab_d'> + <input type='Text' name='ip' value='{IPADDRESS}' size='15' maxlength='15' class='medium_form_field'> + <input type='hidden' name='oldip' value='{IPADDRESS}'> + (Format xx.xx.xx.xx) + </td> + </tr> + + <input type='hidden' name='dhcphlpcont' value='{DHCPCONT}'> + <input type='hidden' name='dhcptype' value='{DHCPTYPE}'> + <input type='hidden' name='hostdn' value='{HOSTDN}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + + </table></td> + </tr> + <tr> + <td colspan='4'><input type='Submit' name='apply' value='anwenden' class='small_loginform_button'> + </form></td> + </tr> + + <!--<tr> + <td height='40'></td> + </tr> + + <tr> + <td colspan='4'><h4>Rechner <code class='font_object'>{HOSTNAME}</code> kopieren:</h4> + Geben Sie bitte den eindeutigen, noch nicht verwendeten Namen des neuen Rechnerobjekts an.</td> + </tr> + <tr> + <td> + <table cellpadding='7' cellspacing='0' border='0' align='left' width='90%' style='border-width: 0 0 0 0;'> + <form action='host_copy.php' method='post'> + + </table></td> + </tr><tr><td> + <input type='Submit' name='apply' value='kopieren' class='small_loginform_button'> + </form></td></tr> + + <tr>--> + + <tr> + <td height='40'></td> + </tr> + + <tr> + <td colspan='4'><h4>Rechner <code class='font_object'>{HOSTNAME}</code> löschen:</h4></td> + </tr> + <tr> + <td colspan='4'> + <table cellpadding='7' cellspacing='0' border='0' align='left' width='90%' style='border-width: 0 0 0 0;'> + <form action='delete_confirm.php' method='post'> + + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + Der Rechner wird komplett gelöscht, <br>d.h. inklusive aller spezifisch für ihn angelegten + Hardware-Profile (MachineConfig) und PXE Bootmenüs. + </tr> + + <input type='hidden' name='dn' value='{HOSTDN}'> + <input type='hidden' name='name' value='{HOSTNAME}'> + <input type='hidden' name='delurl' value='host_delete.php'> + <input type='hidden' name='backurl' value='host.php?dn={HOSTDN}&sbmnr={SBMNR}'> + + </table></td> + </tr> + <tr> + <td> + <input type='Submit' name='apply' value='löschen' class='small_loginform_button'> + </form></td> + </tr> + + + <tr> + <td height='50'></td> + </tr> + + <tr> + <td colspan='4'><h4>Wochen Übersicht Machine Configs Rechner <code class='font_object'>{HOSTNAME}</code> :</h4></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr><td colspan='4'> + <table cellpadding='0' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + <tr align='center'> + <td width='9%' style='border-color: black; border-style: solid; border-width: 2 0 2 2;'><b>Uhrzeit</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 0 2 1;'><b>Montag</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 0 2 1;'><b>Dienstag</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 0 2 1;'><b>Mittwoch</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 0 2 1;'><b>Donnerstag</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 0 2 1;'><b>Freitag</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 0 2 1;'><b>Samstag</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 2 2 1;'><b>Sonntag</b></td> + </tr> + <tr heigth='2' align='center'> + <td width='9%' style='border-color: black; border-style: solid; border-width: 0 0 0 2;'>0</td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A0}'> </td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B0}'> </td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C0}'> </td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D0}'> </td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E0}'> </td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F0}'> </td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G0}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A1}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B1}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C1}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D1}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E1}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F1}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G1}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>2</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A2}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B2}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C2}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D2}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E2}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F2}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G2}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A3}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B3}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C3}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D3}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E3}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F3}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G3}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>4</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A4}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B4}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C4}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D4}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E4}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F4}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G4}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A5}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B5}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C5}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D5}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E5}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F5}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G5}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>6</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A6}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B6}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C6}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D6}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E6}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F6}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G6}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A7}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B7}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C7}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D7}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E7}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F7}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G7}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>8</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A8}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B8}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C8}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D8}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E8}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F8}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G8}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A9}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B9}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C9}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D9}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E9}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F9}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G9}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>10</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A10}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B10}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C10}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D10}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E10}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F10}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G10}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A11}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B11}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C11}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D11}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E11}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F11}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G11}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>12</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A12}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B12}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C12}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D12}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E12}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F12}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G12}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A13}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B13}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C13}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D13}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E13}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F13}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G13}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>14</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A14}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B14}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C14}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D14}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E14}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F14}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G14}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A15}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B15}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C15}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D15}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E15}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F15}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G15}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>16</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A16}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B16}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C16}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D16}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E16}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F16}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G16}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A17}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B17}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C17}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D17}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E17}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F17}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G17}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>18</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A18}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B18}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C18}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D18}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E18}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F18}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G18}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A19}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B19}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C19}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D19}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E19}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F19}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G19}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>20</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A20}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B20}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C20}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D20}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E20}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F20}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G20}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A21}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B21}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C21}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D21}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E21}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F21}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G21}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>22</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A22}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B22}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C22}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D22}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E22}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F22}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G22}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 1;{A23}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 1;{B23}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 1;{C23}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 1;{D23}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 1;{E23}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 1;{F23}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 2 1;{G23}'> </td> + </tr> + + </table></td> + </tr> + + <tr> + <td height='10'></td> + </tr> + <tr> + <td colspan='4'><h4>Legende:</h4></td> + </tr> + <tr><td colspan='4'> + <table cellpadding='3' cellspacing='3' border='1' align='left' width='50%' style='border-width: 0 0 0 0;'> + <tr> + <td width='65%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'><b>Machine Config</b></td> + <td width='5%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> </td> + <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'><b>Farbe</b></td> + </tr> + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'>Keine Konfiguration </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 1 1 1;'> </td> + </tr> + + <!-- BEGIN DYNAMIC BLOCK: Legende --> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'>{MCDESC} </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 1 1 1;background-color:{COLOR};'> </td> + </tr> + <!-- END DYNAMIC BLOCK: Legende --> + + </table></td> + </tr> + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/host.php b/ldap-site-mngmt/webinterface/computers/host.php new file mode 100644 index 00000000..928df62c --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/host.php @@ -0,0 +1,95 @@ +<?php + +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "Computers Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 3; +$mnr = 1; +$sbmnr = -1; +$mcnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "host.dwt"; + +include("../class.FastTemplate.php"); + +include('computers_header.inc.php'); + +################################################################################### + +$sbmnr = $_GET['sbmnr']; + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createComputersMenu($rollen, $mnr, $auDN, $sbmnr, $mcnr); + +################################################################################### + +$hostDN = $_GET['dn']; + +$attributes = array("hostname","domainname","ipaddress","hwaddress","description","dhcphlpcont", + "hw-mouse","hw-graphic","hw-monitor"); +$host = get_node_data($hostDN,$attributes); +$hostip = explode('_',$host['ipaddress']); + +# dhcp Typ +if ($host['dhcphlpcont'] == ""){ + $dhcptype = "nodhcp"; +}else{ + $ocarray = get_node_data($host['dhcphlpcont'],array("objectclass")); + $subnet = array_search('dhcpSubnet', $ocarray['objectclass']); + if ($subnet !== false ){ + $dhcptype = "subnet"; + } + $service = array_search('dhcpService', $ocarray['objectclass']); + if ($service !== false ){ + $dhcptype = "service"; + } +} +#print_r($dhcptype); + +$template->assign(array("HOSTDN" => $hostDN, + "HOSTNAME" => $host['hostname'], + "DOMAINNAME" => $host['domainname'], + "HWADDRESS" => $host['hwaddress'], + "IPADDRESS" => $hostip[0], + "DESCRIPTION" => $host['description'], + "DHCPCONT" => $host['dhcphlpcont'], + "DHCPTYPE" => $dhcptype, + "MOUSE" => $host['hw-mouse'], + "GRAPHIC" => $host['hw-graphic'], + "MONITOR" => $host['hw-monitor'], + "DHCPLINK" => "<a href='dhcphost.php?dn=".$hostDN."&sbmnr=".$sbmnr."' class='headerlink'>", + "HWLINK" => "<a href='hwhost.php?dn=".$hostDN."&sbmnr=".$sbmnr."' class='headerlink'>", + "AUDN" => $auDN, + "SBMNR" => $sbmnr)); + + +########################################################## +# MC Wochenübersicht +$mc_array = get_machineconfigs($hostDN,array("dn","cn","timerange","description")); +# print_r($mc_array); +for ($i=0; $i<count($mc_array); $i++){ + # Timerange Komponenten + if (count($mc_array[$i]['timerange']) > 1 ){ + foreach ($mc_array[$i]['timerange'] as $tr){ + $exptime = array_merge(explode('_',$tr),$mc_array[$i]['description']); + $timeranges[$i][] = $exptime; # Für grafische Wo-Ansicht + } + }else{ + $exptime = array_merge(explode('_',$mc_array[$i]['timerange']), $mc_array[$i]['description']); + $timeranges[$i] = $exptime; # Für grafische Wo-Ansicht + } +} +include("mc_wochenplan.php"); + +########################################################### +# PXE Wochenübersicht + + +################################################################################### + +include("computers_footer.inc.php"); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/host_add.php b/ldap-site-mngmt/webinterface/computers/host_add.php new file mode 100644 index 00000000..bde6f26a --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/host_add.php @@ -0,0 +1,101 @@ +<?php +include('../standard_header.inc.php'); + +$hostname = $_POST['hostname']; +$hostdesc = $_POST['hostdesc']; +$mac = $_POST['mac']; +$ip = $_POST['ip']; + + +$hostname = htmlentities($hostname); +$hostdesc = htmlentities($hostdesc); +$mac = htmlentities($mac); +$mac = strtolower($mac); +$ip = htmlentities($ip); + +/* +echo "AU dn:"; print_r($auDN); echo "<br>"; +echo "hostname:"; print_r($hostname); echo "<br>"; +echo "hostdesc:"; print_r($hostdesc); echo "<br>"; +echo "mac:"; print_r($mac); echo "<br>"; +echo "ip:"; print_r($ip); echo "<br><br>"; +*/ + +$attribs = $_POST['attribs']; +if (count($attribs) != 0){ + foreach (array_keys($attribs) as $key){ + $atts[$key] = htmlentities($attribs[$key]); + } +} + +$seconds = 2; + +echo " +<html> +<head> + <title>AU Management</title> + <link rel='stylesheet' href='../styles.css' type='text/css'> +</head> +<body> +<table border='0' cellpadding='30' cellspacing='0'> +<tr><td>"; + +if ( $hostname != ""){ + + # Formulareingaben anpassen + $exphn = explode(" ",$hostname); + foreach ($exphn as $word){$expuc[] = ucfirst($word);} + $hostname = implode(" ",$expuc); + $hostname = preg_replace ( '/\s+([0-9A-Z])/', '$1', $hostname); + + # Host Objekt anlegen + $brothers = get_hosts($auDN,array("hostname")); + $brother = 0; + foreach ($brothers as $item){ + if( $item['hostname'] == $hostname ){ + $mesg = "Es existiert bereits ein Rechner mit dem eingegebenen HOSTNAME!<br> + Bitte geben Sie einen anderen HOSTNAME ein.<br><br>"; + $get_hostdesc = str_replace ( " ", "_", $hostdesc ); + $get_mac = str_replace ( " ", "_", $mac ); + $get_ip = str_replace ( " ", "_", $ip ); + $url = "new_host.php?hostname=Hier_anderen_HOSTNAME_eingeben&hostdesc=".$get_hostdesc."&mac=".$get_mac."&ip=".$ip; + $brother = 1; + break; + } + } + if ($brother == 0){ + $hostDN = "HostName=".$hostname.",cn=computers,".$auDN; + # print_r($hostDN); echo "<br>"; + + if (add_host($hostDN,$hostname,$hostdesc,$mac,$ip,$atts)){ + $mesg .= "<br>Neuer Rechner erfolgreich angelegt<br>"; + } + else{ + $mesg .= "<br>Fehler beim anlegen des Rechners!<br>"; + } + + $url = 'hostoverview.php'; + } +} + + +elseif ( $hostname == ""){ + + $get_hostdesc = str_replace ( " ", "_", $hostdesc ); + $get_mac = str_replace ( " ", "_", $mac ); + $get_ip = str_replace ( " ", "_", $ip ); + $mesg = "Sie haben den HOSTNAME des neuen Rechners nicht angegeben. Dieser ist aber ein notwendiges Attribut.<br> + Bitte geben Sie ihn an.<br><br>"; + $url = "new_host.php?ou=Hier_HOSTNAME_eingeben&hostdesc=".$get_hostdesc."&mac=".$get_mac."&ip=".$ip; +} + + + + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurü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 diff --git a/ldap-site-mngmt/webinterface/computers/host_change.php b/ldap-site-mngmt/webinterface/computers/host_change.php new file mode 100644 index 00000000..71c005fa --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/host_change.php @@ -0,0 +1,396 @@ +<?php +include('../standard_header.inc.php'); + +$hostname = $_POST['hostname']; +$oldhostname = $_POST['oldhostname']; +$mac = $_POST['mac']; +$oldmac = $_POST['oldmac']; +$ip = $_POST['ip']; +$oldip = $_POST['oldip']; +$desc = $_POST['desc']; +$olddesc = $_POST['olddesc']; + +$dhcphlpcont = $_POST['dhcphlpcont']; +$dhcptype = $_POST['dhcptype']; +$hostDN = $_POST['hostdn']; +$sbmnr = $_POST['sbmnr']; + +$syntax = new Syntaxcheck; + +$hostname = htmlentities($hostname); +$oldhostname = htmlentities($oldhostname); +$mac = htmlentities($mac); +$mac = strtolower($mac); +$oldmac = htmlentities($oldmac); +$ip = htmlentities($ip); +$oldip = htmlentities($oldip); +$desc = htmlentities($desc); +$olddesc = htmlentities($olddesc); + +/* +# 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>"; + +/* +echo "new hostname:"; print_r($hostname); echo "<br>"; +echo "old hostname:"; print_r($oldhostname); echo "<br>"; +echo "new mac:"; print_r($mac); echo "<br>"; +echo "old mac:"; print_r($oldmac); echo "<br>"; +echo "new ip:"; print_r($ip); echo "<br>"; +echo "old ip:"; print_r($oldip); echo "<br>"; +echo "new desc:"; print_r($desc); echo "<br>"; +echo "old desc:"; print_r($olddesc); echo "<br><br>"; +echo "Host DN:"; print_r($hostDN); echo "<br>"; +echo "submenuNR:"; print_r($submenu); echo "<br><br>"; +*/ + +$seconds = 2; +$url = 'host.php?dn='.$hostDN.'&sbmnr='.$sbmnr; + +echo " +<html> +<head> + <title>AU Management</title> + <link rel='stylesheet' href='../styles.css' type='text/css'> +</head> +<body> +<table border='0' cellpadding='30' cellspacing='0'> +<tr><td>"; + +############################################## +# Hostname + +if ( $oldhostname == $hostname ){ + $mesg = "keine Aenderung<br>"; +} + +if ( $oldhostname != "" && $hostname != "" && $oldhostname != $hostname ){ + echo "Hostname aendern<br>"; + # hier noch Syntaxcheck + # Formulareingaben anpassen + $exphn = explode(" ",$hostname); + foreach ($exphn as $word){$expuc[] = ucfirst($word);} + $hostname = implode(" ",$expuc); + $hostname = preg_replace ( '/\s+([0-9A-Z])/', '$1', $hostname); + + $newhostDN = "hostname=".$hostname.",cn=computers,".$auDN; + # print_r($newhostDN); echo "<br><br>"; + modify_host_dn($hostDN, $newhostDN); + + # newsubmenu holen...hosts neu holen, sortieren, ->position + #$newhosts = get_hosts($auDN,array("dn")); + #print_r($newhosts); echo "<br><br>"; + #foreach ($newhosts as $item){ + # $newdnarray [] = $item['dn']; + #} + #$key = array_search($newhostDN, $newdnarray); + #print_r($key); echo "<br>"; + + $url = 'host.php?dn='.$newhostDN.'&sbmnr='.$sbmnr; + +} + +if ( $oldhostname != "" && $hostname == "" ){ + echo "Hostname loeschen!<br> + Dies ist Teil des DN, Sie werden den Rechner komplett löschen<br><br>"; + echo "Wollen Sie den Rechner <b>".$oldhostname."</b> mit seinen Hardware-Profilen (MachineConfigs) + und PXE Bootmenüs wirklich löschen?<br><br> + <form action='host_delete.php' method='post'> + Falls ja:<br><br> + <input type='hidden' name='dn' value='".$hostDN."'> + <input type='hidden' name='name' value='".$oldhostname."'> + <input type='Submit' name='apply' value='löschen' class='small_loginform_button'><br><br> + </form> + <form action='".$url."' method='post'> + Falls, nein:<br><br> + <input type='Submit' name='apply' value='zurück' class='small_loginform_button'> + </form>"; + $seconds = 600; +} + + + +##################################### +# MAC + +if ( $oldmac == $mac ){ + #$mesg = "keine Aenderung<br>"; +} + +if ( $oldmac == "" && $mac != "" ){ + echo "MAC neu anlegen<br>"; + # hier noch Syntaxcheck + $entry['hwaddress'] = $mac; + $result = ldap_mod_add($ds,$hostDN,$entry); + if($result){ + $mesg = "MAC erfolgreich eingetragen<br><br>"; + }else{ + $mesg = "Fehler beim eintragen der MAC<br><br>"; + } +} + +if ( $oldmac != "" && $mac != "" && $oldmac != $mac ){ + echo "MAC aendern<br>"; + # hier noch Syntaxcheck + $entry['hwaddress'] = $mac; + $result = ldap_mod_replace($ds,$hostDN,$entry); + if($result){ + # in den PXEs auch ändern + $pxes = get_pxeconfigs($hostDN,array("dn","filename")); + if ( count($pxes) != 0 ){ + foreach ($pxes as $pxe){ + $entrynewmac ['filename'] = "01-".$mac; + ldap_mod_replace($ds,$pxe['dn'],$entrynewmac); + } + } + # und in Gruppen PXEs + $groups = get_groups_member($auDN,array("dn"),$hostDN); + if ( count($groups) != 0 ){ + $pxes = get_pxeconfigs($groups[0]['dn'],array("dn","filename")); + if ( count($pxes) != 0 ){ + foreach ($pxes as $pxe){ + if (count($pxe['filename']) > 1){ + for ($i=0; $i<count($pxe['filename']); $i++){ + if ($pxe['filename'][$i] == $oldmac){ + $entrynewmac ['filename'][$i] = "01-".$mac; + }else{ + $entrynewmac ['filename'][$i] = $pxe['filename'][$i]; + } + } + } + if (count($pxe['filename']) == 1 && $pxe['filename'][$i] == $oldmac){ + $entrynewmac ['filename'] = "01-".$mac; + } + ldap_mod_replace($ds,$pxe['dn'],$entrynewmac); + } + } + } + $mesg = "MAC erfolgreich geaendert<br><br> + Falls Rechner-Konfiguration via File, <b>Client-Conf</b> Dateiname in untergeordneten <br> + PXEs bitte auch ändern"; + }else{ + $mesg = "Fehler beim aendern der MAC<br><br>"; + } +} + +if ( $oldmac != "" && $mac == "" ){ + echo "MAC loeschen<br>"; + # check ob PXEs am Rechnerobjekt hängen + $pxes = get_pxeconfigs($hostDN,array("dn","filename")); + $groups = get_groups_member($auDN,array("dn"),$hostDN); + if ( count($groups) != 0 ){ + $pxes2 = get_pxeconfigs($groups[0]['dn'],array("dn","filename")); + } + if ( count($pxes) != 0 || count($pxes2) != 0){ + echo "Für den Rechner sind PXE Bootmenüs angelegt welche die MAC Adresse als <br> + Dateinamen verwenden. Sie köennen die MAC erst löschen, wenn Sie diese PXEs <br> + entfernt haben.<br><br> + MAC nicht gelöscht!"; + } + else{ + # hier noch Syntaxcheck + $entry['hwaddress'] = $oldmac; + $result = ldap_mod_del($ds,$hostDN,$entry); + if($result){ + $mesg = "MAC erfolgreich geloescht<br><br>"; + }else{ + $mesg = "Fehler beim loeschen der MAC<br><br>"; + } + } +} + + +######################################## +# IP + +if ( $oldip == $ip ){ + # $mesg = "keine Aenderung<br>"; +} + +if ( $oldip == "" && $ip != "" ){ + echo "IP neu anlegen<br>"; + # hier noch Syntaxcheck + if( $syntax->check_ip_syntax($ip) ){ + $newip_array = array($ip,$ip); + $newip = implode('_',$newip_array); + # print_r($newip); echo "<br><br>"; + if (new_ip_host($newip,$hostDN,$auDN)){ + $mesg = "IP erfolgreich eingetragen<br><br>"; + if ($dhcptype == "subnet"){ + adjust_hostip_dhcpsubnet($ip,$hostDN,$dhcphlpcont); + } + }else{ + $mesg = "Fehler beim eintragen der IP<br><br>"; + } + } + else{echo "Falsche IP Syntax<br><br>";} +} + +if ( $oldip != "" && $ip != "" && $oldip != $ip ){ + echo "IP aendern<br>"; + # hier noch Syntaxcheck + if( $syntax->check_ip_syntax($ip) ){ + $newip_array = array($ip,$ip); + $newip = implode('_',$newip_array); + # print_r($newip); echo "<br><br>"; + $oldip_array = array($oldip,$oldip); + $oldipp = implode('_',$oldip_array); + if (modify_ip_host($newip,$hostDN,$auDN)){ + $mesg = "IP erfolgreich geaendert<br><br>"; + if ($dhcptype == "subnet"){ + adjust_hostip_dhcpsubnet($ip,$hostDN,$dhcphlpcont); + } + }else{ + $mesg = "Fehler beim aendern der IP<br><br>"; + # oldip die schon gelöscht wurde wieder einfügen + new_ip_host($oldipp,$hostDN,$auDN); + } + } + else{echo "Falsche IP Syntax<br><br>";} +} + +if ( $oldip != "" && $ip == "" ){ + echo "IP loeschen<br>"; + + if(delete_ip_host($hostDN,$auDN)){ + $mesg = "IP erfolgreich geloescht<br><br>"; + }else{ + $mesg = "Fehler beim loeschen der IP<br><br>"; + } +} + + +##################################### +# Description + +if ( $olddesc == $desc ){ + # $mesg = "keine Aenderung<br>"; +} + +if ( $olddesc == "" && $desc != "" ){ + echo "Rechner-Beschreibung neu anlegen<br>"; + # hier noch Syntaxcheck + $entry['description'] = $desc; + $result = ldap_mod_add($ds,$hostDN,$entry); + if($result){ + $mesg = "Rechner-Beschreibung erfolgreich eingetragen<br><br>"; + }else{ + $mesg = "Fehler beim eintragen der Rechner-Beschreibung<br><br>"; + } +} + +if ( $olddesc != "" && $desc != "" && $olddesc != $desc ){ + echo "Rechner-Beschreibung aendern<br>"; + # hier noch Syntaxcheck + $entry['description'] = $desc; + $result = ldap_mod_replace($ds,$hostDN,$entry); + if($result){ + $mesg = "Rechner-Beschreibung erfolgreich geaendert<br><br>"; + }else{ + $mesg = "Fehler beim aendern der Rechner-Beschreibung<br><br>"; + } +} + +if ( $olddesc != "" && $desc == "" ){ + echo "Rechner-Beschreibung loeschen<br>"; + # hier noch Syntaxcheck + $entry['description'] = $olddesc; + $result = ldap_mod_del($ds,$hostDN,$entry); + if($result){ + $mesg = "Rechner-Beschreibung erfolgreich geloescht<br><br>"; + }else{ + $mesg = "Fehler beim loeschen der Rechner-Beschreibung<br><br>"; + } +} + +#################################### +# restliche Attribute +/* +$entryadd = array(); +$entrymod = array(); +$entrydel = array(); + +foreach (array_keys($atts) as $key){ + + if ( $oldatts[$key] == $atts[$key] ){ + #$mesg = "keine Aenderung<br>"; + } + 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,$hostDN,$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 "ändern<br>"; + foreach (array_keys($entrymod) as $key){ + $modatts .= "<b>".$key."</b>,"; + } + if(ldap_mod_replace($ds,$hostDN,$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öschen<br>"; + foreach (array_keys($entrydel) as $key){ + $delatts .= "<b>".$key."</b>,"; + } + if(ldap_mod_del($ds,$hostDN,$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ü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 diff --git a/ldap-site-mngmt/webinterface/computers/host_delete.php b/ldap-site-mngmt/webinterface/computers/host_delete.php new file mode 100644 index 00000000..bcfa0add --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/host_delete.php @@ -0,0 +1,47 @@ +<?php +include('../standard_header.inc.php'); + +$hostDN = $_POST['dn']; +$hostname = $_POST['name']; +$hostDN = htmlentities($hostDN); +$hostname = htmlentities($hostname); + +/* +echo "AU dn:"; print_r($auDN); echo "<br>"; +echo "hostdn:"; print_r($hostDN); echo "<br>"; +echo "hostname:"; print_r($hostname); echo "<br>"; +*/ + +$seconds = 1; +$url = 'hostoverview.php'; + +echo " +<html> +<head> + <title>AU Management</title> + <link rel='stylesheet' href='../styles.css' type='text/css'> +</head> +<body> +<table border='0' cellpadding='30' cellspacing='0'> +<tr><td>"; + +if ( $hostDN != ""){ + + if ( delete_host($hostDN) ){ + $mesg = "Rechner <b>".$hostname."</b> erfolgreich gelöscht!<br><br>"; + } + else{ + $mesg = "Fehler beim löschen von Rechner <b>".$hostname."</b> !<br><br>"; + } + +} + + + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurü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 diff --git a/ldap-site-mngmt/webinterface/computers/hostoverview.dwt b/ldap-site-mngmt/webinterface/computers/hostoverview.dwt new file mode 100644 index 00000000..87ed24a6 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/hostoverview.dwt @@ -0,0 +1,40 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='2'><h3>Rechner <code class='font_object'>{AU}</code> </h3></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + <tr> + <td width='24%' class='tab_h'><b>Rechnername</b></td> + <td width='19%' class='tab_h'><b>MAC Adresse</b></td> + <td width='19%' class='tab_h'><b>IP Adresse</b></td> + <td width='19%' class='tab_h'><b>DHCP</b></td> + <td width='19%' class='tab_h'><b>RBS</b></td> + </tr> + + <!-- BEGIN DYNAMIC BLOCK: Rechner --> + <tr valign='top' height='45'> + <td class='tab_d'>{HOSTNAME} </td> + <td class='tab_d'>{HWADDRESS} </td> + <td class='tab_d'>{IPADDRESS} </td> + <td class='tab_d'>{DHCPCONT} </td> + <td class='tab_d'>{RBSCONT} </td> + </tr> + <!-- END DYNAMIC BLOCK: Rechner --> + + </table></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr> + <td> + Zum Verwalten eines bestimmten Rechners, wählen Sie links entsprechenden Submenü-Eintrag.<br> + Um einen neuen Rechner anzulegen wählen Sie links "Neuer Rechner" + </td> + </tr> + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/hostoverview.php b/ldap-site-mngmt/webinterface/computers/hostoverview.php new file mode 100644 index 00000000..c2bec0a2 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/hostoverview.php @@ -0,0 +1,82 @@ +<?php + +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "Computers Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 3; +$mnr = 1; +$sbmnr = -1; +$mcnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "hostoverview.dwt"; + +include("../class.FastTemplate.php"); + +include('computers_header.inc.php'); + +################################################################################### + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createComputersMenu($rollen, $mnr, $auDN, $sbmnr, $mcnr); + +################################################################################### + +$template->assign(array("DN" => "", + "HOSTNAME" => "Noch keine Rechner angelegt", + "DOMAINNAME" => "", + "HWADDRESS" => "", + "IPADDRESS" => "", + "DHCPCONT" => "", + "RBSCONT" => "")); + +$attributes = array("dn","hostname","domainname","hwaddress","ipaddress","dhcphlpcont","hlprbservice"); +$host_array = get_hosts($auDN,$attributes); + +$template->define_dynamic("Rechner", "Webseite"); + +$i = 0; +foreach ($host_array as $host){ + + $hostname = "<a href='host.php?dn=".$host['dn']."&sbmnr=".$i."' class='headerlink'>".$host['hostname']."</a>"; + $hostip = explode('_',$host['ipaddress']); + + $dhcpcont = ""; + if ( count($host['dhcphlpcont']) != 0 ){ + $dhcpexpdn = ldap_explode_dn($host['dhcphlpcont'],1); + $dhcpcn = $dhcpexpdn[0]; + $ocarray = get_node_data($host['dhcphlpcont'],array("objectclass","dhcphlpcont")); + $sub = array_search('dhcpSubnet', $ocarray['objectclass']); + if ($sub !== false ){ + $dhcpcont = "Subnet ".$dhcpexpdn[0]." <br>[".$dhcpexpdn[2]."]"; + }else{ + $dhcpcont = "Service ".$dhcpexpdn[0]." <br>[".$dhcpexpdn[2]."]"; + } + } + + $rbscont = ""; + if ( count($host['hlprbservice']) != 0 ){ + $rbsexpdn = ldap_explode_dn($host['hlprbservice'],1); + $rbscont = $rbsexpdn[0]." <br>[".$rbsexpdn[2]."]"; + } + + $template->assign(array("DN" => $host['dn'], + "HOSTNAME" => $hostname, + "DOMAINNAME" => $host['domainname'], + "HWADDRESS" => $host['hwaddress'], + "IPADDRESS" => $hostip[0], + "DHCPCONT" => $dhcpcont, + "RBSCONT" => $rbscont, + "AUDN" => $auDN )); + $template->parse("RECHNER_LIST", ".Rechner"); + + $i++; +} + +################################################################################### + +include("computers_footer.inc.php"); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/hwhost.dwt b/ldap-site-mngmt/webinterface/computers/hwhost.dwt new file mode 100644 index 00000000..472b2f3e --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/hwhost.dwt @@ -0,0 +1,60 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='4'><h3>Rechner <code class='font_object'> {HOSTNAME} </code> </h3></td> + </tr> + <tr> + <td height='20'></td> + </tr> + <tr> + <td align='center' width='15%' style='border-color: black; border-style: solid; border-width: 0 1 0 1;'><h4>{HOSTLINK} Allgemein </a></h4></td> + <td align='center' width='15%' style='border-color: black; border-style: solid; border-width: 0 1 0 0;'><h4>{DHCPLINK} DHCP/RBS </a></h4></td> + <td align='center' width='15%' style='border-color: black; border-style: solid; border-width: 0 1 0 0;'><h4><code class='font_object'>Hardware</code></h4></td> + <td> </td> + </tr> + <tr> + <td height='20'></td> + </tr> + <tr><td colspan='4'> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <form action='hwhost_change.php' method='post'> + + <tr> + <td width='45%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='55%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>HW Mouse: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[hw-mouse]' value='{MOUSE}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[hw-mouse]' value='{MOUSE}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>HW Graphic: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[hw-graphic]' value='{GRAPHIC}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[hw-graphic]' value='{GRAPHIC}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>HW Monitor: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[hw-monitor]' value='{MONITOR}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[hw-monitor]' value='{MONITOR}'> + </td> + </tr> + + <input type='hidden' name='hostdn' value='{HOSTDN}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + + </table></td> + </tr> + <tr> + <td colspan='4'><input type='Submit' name='apply' value='anwenden' class='small_loginform_button'> + </form></td> + </tr> + + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/hwhost.php b/ldap-site-mngmt/webinterface/computers/hwhost.php new file mode 100644 index 00000000..e401d5ce --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/hwhost.php @@ -0,0 +1,78 @@ +<?php + +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "Computers Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 3; +$mnr = 1; +$sbmnr = -1; +$mcnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "hwhost.dwt"; + +include("../class.FastTemplate.php"); + +include('computers_header.inc.php'); + +################################################################################### + +$sbmnr = $_GET['sbmnr']; + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createComputersMenu($rollen, $mnr, $auDN, $sbmnr, $mcnr); + +################################################################################### + +$hostDN = $_GET['dn']; + +$attributes = array("hostname","domainname","ipaddress","hwaddress","description","dhcphlpcont", + "hw-mouse","hw-graphic","hw-monitor"); +$host = get_node_data($hostDN,$attributes); +$hostip = explode('_',$host['ipaddress']); + +$template->assign(array("HOSTDN" => $hostDN, + "HOSTNAME" => $host['hostname'], + "DOMAINNAME" => $host['domainname'], + "HWADDRESS" => $host['hwaddress'], + "IPADDRESS" => $hostip[0], + "DESCRIPTION" => $host['description'], + "DHCPCONT" => $host['dhcphlpcont'], + "MOUSE" => $host['hw-mouse'], + "GRAPHIC" => $host['hw-graphic'], + "MONITOR" => $host['hw-monitor'], + "DHCPLINK" => "<a href='dhcphost.php?dn=".$hostDN."&sbmnr=".$sbmnr."' class='headerlink'>", + "HOSTLINK" => "<a href='host.php?dn=".$hostDN."&sbmnr=".$sbmnr."' class='headerlink'>", + "AUDN" => $auDN, + "SBMNR" => $sbmnr)); + + +########################################################## +# MC Wochenübersicht +$mc_array = get_machineconfigs($hostDN,array("dn","cn","timerange","description")); +# print_r($mc_array); +for ($i=0; $i<count($mc_array); $i++){ + # Timerange Komponenten + if (count($mc_array[$i]['timerange']) > 1 ){ + foreach ($mc_array[$i]['timerange'] as $tr){ + $exptime = array_merge(explode('_',$tr),$mc_array[$i]['description']); + $timeranges[$i][] = $exptime; # Für grafische Wo-Ansicht + } + }else{ + $exptime = array_merge(explode('_',$mc_array[$i]['timerange']), $mc_array[$i]['description']); + $timeranges[$i] = $exptime; # Für grafische Wo-Ansicht + } +} +include("mc_wochenplan.php"); + +########################################################### +# PXE Wochenübersicht + + +################################################################################### + +include("computers_footer.inc.php"); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/hwhost_change.php b/ldap-site-mngmt/webinterface/computers/hwhost_change.php new file mode 100644 index 00000000..7b93f7c9 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/hwhost_change.php @@ -0,0 +1,127 @@ +<?php +include('../standard_header.inc.php'); + +$syntax = new Syntaxcheck; + +$hostDN = $_POST['hostdn']; +$sbmnr = $_POST['sbmnr']; + +# 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>"; + +/* +echo "new hostname:"; print_r($hostname); echo "<br>"; +echo "old hostname:"; print_r($oldhostname); echo "<br>"; +echo "new mac:"; print_r($mac); echo "<br>"; +echo "old mac:"; print_r($oldmac); echo "<br>"; +echo "new ip:"; print_r($ip); echo "<br>"; +echo "old ip:"; print_r($oldip); echo "<br>"; +echo "new desc:"; print_r($desc); echo "<br>"; +echo "old desc:"; print_r($olddesc); echo "<br><br>"; +echo "Host DN:"; print_r($hostDN); echo "<br>"; +echo "submenuNR:"; print_r($submenu); echo "<br><br>"; +*/ + +$seconds = 2; +$url = 'host.php?dn='.$hostDN.'&sbmnr='.$sbmnr; + +echo " +<html> +<head> + <title>AU Management</title> + <link rel='stylesheet' href='../styles.css' type='text/css'> +</head> +<body> +<table border='0' cellpadding='30' cellspacing='0'> +<tr><td>"; + +#################################### +# restliche Attribute + +$entryadd = array(); +$entrymod = array(); +$entrydel = array(); + +foreach (array_keys($atts) as $key){ + + if ( $oldatts[$key] == $atts[$key] ){ + #$mesg = "keine Aenderung<br>"; + } + 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,$hostDN,$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 "ändern<br>"; + foreach (array_keys($entrymod) as $key){ + $modatts .= "<b>".$key."</b>,"; + } + if(ldap_mod_replace($ds,$hostDN,$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öschen<br>"; + foreach (array_keys($entrydel) as $key){ + $delatts .= "<b>".$key."</b>,"; + } + if(ldap_mod_del($ds,$hostDN,$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ü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 diff --git a/ldap-site-mngmt/webinterface/computers/machineconfig_default.dwt b/ldap-site-mngmt/webinterface/computers/machineconfig_default.dwt new file mode 100644 index 00000000..3596a0ce --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/machineconfig_default.dwt @@ -0,0 +1,323 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='2'><h3>Default MachineConfigs (Konfigurationen) <code class='font_object'> {AU} </code> </h3></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + <tr> + <td width='40%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Machine Config</b></td> + <td width='60%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Gültigkeitsdauer (Time Range)</b></td> + </tr> + + + + <!-- BEGIN DYNAMIC BLOCK: Machineconf --> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>{MCDESC} </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>{TRANGES} </td> + </tr> + <!-- END DYNAMIC BLOCK: Machineconf --> + + </table></td> + </tr> + <tr> + <td height='50'></td> + </tr> + + <tr> + <td colspan='2'><h4>Wochen Übersicht:</h4></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr><td> + <table cellpadding='0' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + <tr align='center'> + <td width='9%' style='border-color: black; border-style: solid; border-width: 2 0 2 2;'><b>Uhrzeit</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 0 2 1;'><b>Montag</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 0 2 1;'><b>Dienstag</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 0 2 1;'><b>Mittwoch</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 0 2 1;'><b>Donnerstag</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 0 2 1;'><b>Freitag</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 0 2 1;'><b>Samstag</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 2 2 1;'><b>Sonntag</b></td> + </tr> + <tr heigth='2' align='center'> + <td width='9%' style='border-color: black; border-style: solid; border-width: 0 0 0 2;'>0</td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A0}'> </td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B0}'> </td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C0}'> </td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D0}'> </td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E0}'> </td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F0}'> </td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G0}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A1}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B1}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C1}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D1}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E1}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F1}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G1}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>2</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A2}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B2}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C2}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D2}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E2}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F2}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G2}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A3}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B3}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C3}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D3}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E3}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F3}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G3}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>4</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A4}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B4}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C4}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D4}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E4}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F4}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G4}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A5}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B5}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C5}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D5}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E5}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F5}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G5}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>6</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A6}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B6}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C6}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D6}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E6}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F6}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G6}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A7}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B7}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C7}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D7}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E7}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F7}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G7}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>8</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A8}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B8}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C8}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D8}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E8}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F8}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G8}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A9}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B9}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C9}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D9}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E9}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F9}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G9}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>10</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A10}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B10}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C10}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D10}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E10}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F10}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G10}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A11}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B11}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C11}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D11}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E11}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F11}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G11}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>12</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A12}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B12}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C12}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D12}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E12}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F12}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G12}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A13}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B13}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C13}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D13}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E13}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F13}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G13}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>14</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A14}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B14}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C14}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D14}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E14}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F14}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G14}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A15}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B15}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C15}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D15}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E15}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F15}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G15}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>16</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A16}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B16}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C16}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D16}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E16}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F16}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G16}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A17}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B17}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C17}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D17}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E17}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F17}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G17}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>18</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A18}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B18}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C18}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D18}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E18}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F18}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G18}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A19}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B19}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C19}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D19}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E19}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F19}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G19}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>20</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A20}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B20}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C20}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D20}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E20}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F20}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G20}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A21}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B21}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C21}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D21}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E21}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F21}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G21}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>22</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A22}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B22}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C22}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D22}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E22}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F22}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G22}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 1;{A23}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 1;{B23}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 1;{C23}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 1;{D23}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 1;{E23}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 1;{F23}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 2 1;{G23}'> </td> + </tr> + + </table></td> + </tr> + + <tr> + <td height='10'></td> + </tr> + <tr> + <td colspan='2'><h4>Legende:</h4></td> + </tr> + <tr><td> + <table cellpadding='3' cellspacing='3' border='1' align='left' width='50%' style='border-width: 0 0 0 0;'> + <tr> + <td width='65%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'><b>Machine Config</b></td> + <td width='5%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> </td> + <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'><b>Farbe</b></td> + </tr> + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'>Keine Konfiguration </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 1 1 1;'> </td> + </tr> + + <!-- BEGIN DYNAMIC BLOCK: Legende --> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'>{MCDESC} </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 1 1 1;background-color:{COLOR};'> </td> + </tr> + <!-- END DYNAMIC BLOCK: Legende --> + + </table></td> + </tr> + +</table> diff --git a/ldap-site-mngmt/webinterface/computers/machineconfig_default.php b/ldap-site-mngmt/webinterface/computers/machineconfig_default.php new file mode 100644 index 00000000..ac386a57 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/machineconfig_default.php @@ -0,0 +1,75 @@ +<?php + +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "Computers Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 3; +$mnr = 3; +$sbmnr = -1; +$mcnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "machineconfig_default.dwt"; + +include("../class.FastTemplate.php"); + +include('computers_header.inc.php'); + +################################################################################### + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createComputersMenu($rollen, $mnr, $auDN, $sbmnr, $mcnr); + +################################################################################### + +$template->assign(array("MCDN" => "", + "MCCN" => "Noch keine Default MachineConfig angelegt", + "TRANGES" => "", + "MCDESC" => "Noch keine Default MachineConfig angelegt")); + + +$mc_array = get_machineconfigs("cn=computers,".$auDN,array("dn","cn","timerange","description")); +# print_r($mc_array); + + +$template->define_dynamic("Machineconf", "Webseite"); + +for ($i=0; $i<count($mc_array); $i++){ + # Timerange Komponenten + $trange = ""; + if (count($mc_array[$i]['timerange']) > 1 ){ + foreach ($mc_array[$i]['timerange'] as $tr){ + $exptime = array_merge(explode('_',$tr),$mc_array[$i]['description']); + $timeranges[$i][] = $exptime; # Für grafische Wo-Ansicht + if ($exptime[0] == "X"){$exptime[0]="täglich";} + # if ($exptime[1] == "X" && $exptime[2] == "X"){$exptime[1] = ""; $exptime[2]= "";} + $trange .= $exptime[0].", von ".$exptime[1].":00 bis ".$exptime[2].":59 / "; + } + }else{ + $exptime = array_merge(explode('_',$mc_array[$i]['timerange']), $mc_array[$i]['description']); + $timeranges[$i] = $exptime; # Für grafische Wo-Ansicht + if ($exptime[0] == "X"){$exptime[0]="täglich";} + # if ($exptime[1] == "X" && $exptime[2] == "X"){$exptime[1] = ""; $exptime[2]= "";} + $trange .= $exptime[0].", von ".$exptime[1].":00 bis ".$exptime[2].":59"; + } + + $template->assign(array("MCDN" => $mc_array[$i]['dn'], + "MCCN" => $mc_array[$i]['cn'], + "TRANGES" => $trange, + "MCDESC" => $mc_array[$i]['description'], + "AUDN" => $auDN)); + $template->parse("MACHINECONF_LIST", ".Machineconf"); +} + +#get_entry_number($mc_array[3]['dn'],"machineconfig"); + +include("mc_wochenplan.php"); + + +################################################################################### + +include("computers_footer.inc.php"); + +?> diff --git a/ldap-site-mngmt/webinterface/computers/mc_wochenplan.php b/ldap-site-mngmt/webinterface/computers/mc_wochenplan.php new file mode 100644 index 00000000..3df7ab82 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/mc_wochenplan.php @@ -0,0 +1,154 @@ +<?php + +##################################### +# Wochenübersicht + +$template->assign(array("A0" => "","B0" => "","C0" => "","D0" => "","E0" => "","F0" => "","G0" => "", + "A1" => "","B1" => "","C1" => "","D1" => "","E1" => "","F1" => "","G1" => "", + "A2" => "","B2" => "","C2" => "","D2" => "","E2" => "","F2" => "","G2" => "", + "A3" => "","B3" => "","C3" => "","D3" => "","E3" => "","F3" => "","G3" => "", + "A4" => "","B4" => "","C4" => "","D4" => "","E4" => "","F4" => "","G4" => "", + "A5" => "","B5" => "","C5" => "","D5" => "","E5" => "","F5" => "","G5" => "", + "A6" => "","B6" => "","C6" => "","D6" => "","E6" => "","F6" => "","G6" => "", + "A7" => "","B7" => "","C7" => "","D7" => "","E7" => "","F7" => "","G7" => "", + "A8" => "","B8" => "","C8" => "","D8" => "","E8" => "","F8" => "","G8" => "", + "A9" => "","B9" => "","C9" => "","D9" => "","E9" => "","F9" => "","G9" => "", + "A10" => "","B10" => "","C10" => "","D10" => "","E10" => "","F10" => "","G10" => "", + "A11" => "","B11" => "","C11" => "","D11" => "","E11" => "","F11" => "","G11" => "", + "A12" => "","B12" => "","C12" => "","D12" => "","E12" => "","F12" => "","G12" => "", + "A13" => "","B13" => "","C13" => "","D13" => "","E13" => "","F13" => "","G13" => "", + "A14" => "","B14" => "","C14" => "","D14" => "","E14" => "","F14" => "","G14" => "", + "A15" => "","B15" => "","C15" => "","D15" => "","E15" => "","F15" => "","G15" => "", + "A16" => "","B16" => "","C16" => "","D16" => "","E16" => "","F16" => "","G16" => "", + "A17" => "","B17" => "","C17" => "","D17" => "","E17" => "","F17" => "","G17" => "", + "A18" => "","B18" => "","C18" => "","D18" => "","E18" => "","F18" => "","G18" => "", + "A19" => "","B19" => "","C19" => "","D19" => "","E19" => "","F19" => "","G19" => "", + "A20" => "","B20" => "","C20" => "","D20" => "","E20" => "","F20" => "","G20" => "", + "A21" => "","B21" => "","C21" => "","D21" => "","E21" => "","F21" => "","G21" => "", + "A22" => "","B22" => "","C22" => "","D22" => "","E22" => "","F22" => "","G22" => "", + "A23" => "","B23" => "","C23" => "","D23" => "","E23" => "","F23" => "","G23" => "")); + +#print_r($timeranges); echo "<br>"; + +# vom spezifischsten zum unspezifischsten : +# FR_0_7 -> FR_X_X -> X_0_7 -> X_X_X +$daytime = array(); +$timex = array(); +$dayx = array(); +$allx = array(); +$legend = array(); +if(count($timeranges) != 0){ +foreach ($timeranges as $tr){ + if (count($tr[0]) > 1){ + foreach ($tr as $item){ + if ($item[0] != "X" && $item[1] != "X" && $item[2] != "X" && ($item[0] == "MO" || $item[0] == "DI" || $item[0] == "MI" || $item[0] == "DO" || $item[0] == "FR" || $item[0] == "SA" || $item[0] == "SO")){ + $daytime[] = $item; + } + if ($item[0] != "X" && $item[1] == "X" && $item[2] == "X"){ + $timex[] = $item; + } + if ($item[0] == "X" && $item[1] != "X" && $item[2] != "X"){ + $dayx[] = $item; + } + if ($item[0] == "X" && $item[1] == "X" && $item[2] == "X"){ + $allx[] = $item; + } + } + }else{ + if ($tr[0] != "X" && $tr[1] != "X" && $tr[2] != "X" && ($tr[0] == "MO" || $tr[0] == "DI" || $tr[0] == "MI" || $tr[0] == "DO" || $tr[0] == "FR" || $tr[0] == "SA" || $tr[0] == "SO")){ + $daytime[] = $tr; + } + if ($tr[0] != "X" && $tr[1] == "X" && $tr[2] == "X"){ + $timex[] = $tr; + } + if ($tr[0] == "X" && $tr[1] != "X" && $tr[2] != "X"){ + $dayx[] = $tr; + } + if ($tr[0] == "X" && $tr[1] == "X" && $tr[2] == "X"){ + $allx[] = $tr; + } + } +} + +#print_r($daytime); echo "<br>"; +#print_r($timex); echo "<br>"; +#print_r($dayx); echo "<br>"; +#print_r($allx); echo "<br>"; + +$daycode = array("MO" => "A", "DI" => "B", "MI" => "C", "DO" => "D", "FR" => "E", "SA" => "F", "SO" => "G"); +$allxcolors = array("#BEBEBE","A0A0A0","#696969","#EEDFCC","#D8BFD8","#505050"); +$dayxcolors = array("#483D8B","#7B68EE","#191970","#8470FF","#708090","#6A5ACD"); +$timexcolors = array("#CDC673","#A2CD5A","#BDB76B","#8B864E","#6B8E23","#CDBE70"); +$daytimecolors = array("880000","#CD6839","#CC3300","#CC6600","#993300","#8B4C39"); + + +if (count($allx) != 0){ + $c = 0; + foreach ($allx as $range){ + foreach ($daycode as $dc){ + for ($i = 0; $i <= 23; $i++){ + $template->assign(array($dc.$i => "background-color:".$allxcolors[$c].";")); + } + } + $legend[] = array($range ,$allxcolors[$c]); + $c++; + } +} + +if (count($dayx) != 0){ + $c = 0; + foreach ($dayx as $range){ + foreach ($daycode as $dc){ + for ($i = $range[1]; $i<= $range[2]; $i++){ + $template->assign(array($dc.$i => "background-color:".$dayxcolors[$c].";")); + } + } + $legend[] = array($range ,$dayxcolors[$c]); + $c++; + } +} + +if (count($timex) != 0){ + $c = 0; + foreach ($timex as $range){ + $dc = $daycode[$range[0]]; + for ($i = 0; $i<= 23; $i++){ + $template->assign(array($dc.$i => "background-color:".$timexcolors[$c].";")); + } + $legend[] = array($range ,$timexcolors[$c]); + $c++; + } +} + +if (count($daytime) != 0){ + $c = 0; + foreach ($daytime as $range){ + $dc = $daycode[$range[0]]; + for ($i = $range[1]; $i<= $range[2]; $i++){ + $template->assign(array($dc.$i => "background-color:".$daytimecolors[$c].";")); + } + $legend[] = array($range ,$daytimecolors[$c]); + $c++; + } +} + +} + +$template->assign(array("MCDESC" => "")); +#print_r($legend); +if (count($legend) != 0){ + $template->define_dynamic("Legende", "Webseite"); + foreach ($legend as $item){ + # Timerange Komponente + $color = $item[1]; + $template->assign(array("TR1" => $item[0][0], + "TR2" => $item[0][1], + "TR3" => $item[0][2], + "MCDESC" => $item[0][3], + "COLOR" => $color)); + $template->parse("LEGENDE_LIST", ".Legende"); + } +} + + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/mcdef.dwt b/ldap-site-mngmt/webinterface/computers/mcdef.dwt new file mode 100644 index 00000000..15f48548 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/mcdef.dwt @@ -0,0 +1,293 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='2'><h3>MachineConfig <code class='font_object'> {MCCN} </code> </h3></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr> + <td colspan='2'><h4>Allgemein:</h4></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <form action='mcdef_change.php' method='post'> + + <tr> + <td width='25%' style='border-color: black; border-style: solid; border-width: 3 0 1 0;'><b>Eindeutiger Name (cn):</b><br>(Bitte ohne Leerzeichen eingeben) </td> + <td width='5%' style='border-color: black; border-style: solid; border-width: 3 0 1 0;'> </td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 3 0 1 0;'> + <font size='+2'><b>MC_</b></font><input type='Text' name='mccn' value='{MCCN}' size='50' class='medium_form_field'> + <input type='hidden' name='oldmccn' value='{MCCN}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Machine Config <br>Beschreibung: </td> + <td width='5%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> </td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='mcdesc' value='{MCDESC}' size='60' class='medium_form_field'> + <input type='hidden' name='oldmcdesc' value='{MCDESC}'> + + </td> + </tr> + + + <tr valign='top'> + <td width='25%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'><b>Gültigkeitsdauer <br>(Time Range(s)): </b> </td> + <td width='5%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> </td> + <td width='35%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + Eines der folgenden:<br> + + - <b>Datum</b> (dd.mm, z.B. 21.03/01.11) <br> + - <b>Monatstag</b> (dd, z.B. 01 oder 25) <br> + - <b>Wochentag</b> (MO, DI, ... , SO) <br> + - <b>X</b> für <b>täglich</b> + + <td width='35%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + - <b>Uhrzeit</b> (Format: hh, z.B. 07-19)<br> + - <b>X</b> für rund um die Uhr + + </td> + </tr> + + <!-- BEGIN DYNAMIC BLOCK: TRanges --> + <tr valign='top'> + <td width='25%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'>Zum Löschen einer Time Range<br>Häkchen setzen </td> + <td width='5%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + <input type='checkbox' name='deltr[]' value='{MCDAY}_{MCBEG}_{MCEND}'> + </td> + <td width='35%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + <input type='Text' name='mcday[]' value='{MCDAY}' size='5' maxlength='5' class='medium_form_field'> + <input type='hidden' name='oldmcday[]' value='{MCDAY}'> <br> + + + <td width='35%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + <input type='Text' name='mcbeg[]' value='{MCBEG}' size='2' maxlength='2' class='medium_form_field'> + <input type='hidden' name='oldmcbeg[]' value='{MCBEG}'> <b><font size='+1'>:00</b> - </font> + <input type='Text' name='mcend[]' value='{MCEND}' size='2' maxlength='2' class='medium_form_field'> + <input type='hidden' name='oldmcend[]' value='{MCEND}'> <b><font size='+1'>:59</b> Uhr</font><br> + </td> + </tr> + <!-- END DYNAMIC BLOCK: TRanges --> + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>Neue Time Range hinzufügen </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='newmcday' value='' size='5' maxlength='5' class='medium_form_field'> + + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='newmcbeg' value='' size='2' maxlength='2' class='medium_form_field'> + <b><font size='+1'>:00</b> - </font> + <input type='Text' name='newmcend' value='' size='2' maxlength='2' class='medium_form_field'> + <b><font size='+1'>:59</b> Uhr</font><br> + + </td> + </tr> + + </table></td> + </tr> + + <tr> + <td height='40'></td> + </tr> + <tr> + <td colspan='2'><h4>Dienste:</h4></td> + </tr> + + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <tr> + <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='70%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Start X: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[start-x]' value='{X}' size='10' maxlength='3' class='medium_form_field'> + <input type='hidden' name='oldattribs[start-x]' value='{X}'> ( yes | no ) + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Start SNMP: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[start-snmp]' value='{SNMP}' size='10' maxlength='3' class='medium_form_field'> + <input type='hidden' name='oldattribs[start-snmp]' value='{SNMP}'> ( yes | no ) + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Start SSHD: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[start-sshd]' value='{SSHD}' size='10' maxlength='3' class='medium_form_field'> + <input type='hidden' name='oldattribs[start-sshd]' value='{SSHD}'> ( yes | no ) + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Start XDMCP: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[start-xdmcp]' value='{XDMCP}' size='10' maxlength='3' class='medium_form_field'> + <input type='hidden' name='oldattribs[start-xdmcp]' value='{XDMCP}'> ( yes | no ) + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Start RWHOD: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[start-rwhod]' value='{RWHOD}' size='10' maxlength='3' class='medium_form_field'> + <input type='hidden' name='oldattribs[start-rwhod]' value='{RWHOD}'> ( yes | no ) + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Start PRINT DAEMON: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[start-printdaemon]' value='{PRINTD}' size='10' maxlength='3' class='medium_form_field'> + <input type='hidden' name='oldattribs[start-printdaemon]' value='{PRINTD}'> ( yes | no ) + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>TEX Enable: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[tex-enable]' value='{TEX}' size='10' maxlength='3' class='medium_form_field'> + <input type='hidden' name='oldattribs[tex-enable]' value='{TEX}'> ( yes | no ) + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Start CRON: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[start-cron]' value='{CRON}' size='10' maxlength='3' class='medium_form_field'> + <input type='hidden' name='oldattribs[start-cron]' value='{CRON}'> ( yes | no ) + </td> + </tr> + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Crontab Entries:</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <!-- BEGIN DYNAMIC BLOCK: Crontab --> + <input type='Text' name='crontab[]' value='{CRONTAB}' size='60' class='medium_form_field'> + <input type='hidden' name='oldcrontab[]' value='{CRONTAB}'> <br> + <!-- END DYNAMIC BLOCK: Crontab --> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Language: </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[language]' value='{LANG}' size='10' maxlength='2' class='medium_form_field'> + <input type='hidden' name='oldattribs[language]' value='{LANG}'> + + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>NETBIOS Workgroup: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[netbios-workgroup]' value='{NETBIOS}' size='40' class='medium_form_field'> + <input type='hidden' name='oldattribs[netbios-workgroup]' value='{NETBIOS}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>VMWARE: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[vmware]' value='{VMWARE}' size='40' class='medium_form_field'> + <input type='hidden' name='oldattribs[vmware]' value='{VMWARE}'> + </td> + </tr> + + <input type='hidden' name='nodedn' value='{NODEDN}'> + <input type='hidden' name='mcdn' value='{MCDN}'> + <input type='hidden' name='oldmccn' value='{MCCN}'> + <input type='hidden' name='mnr' value='{MNR}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + <input type='hidden' name='mcnr' value='{MCNR}'> + + </table></td> + </tr> + <tr> + <td><input type='Submit' name='apply' value='anwenden' class='small_loginform_button'> + </form></td> + </tr> + + <tr> + <td height='40'></td> + </tr> + + <tr> + <td colspan='2'><h4>MachineConfig <code class='font_object'>{MCCN}</code> kopieren:</h4> + Beachten Sie, dass die Time Ranges der Machine Config nicht mit kopiert werden.<br> + Sie müssen diese anschließend neu setzen. <br> + Geben Sie bitte den eindeutigen Namen des neuen MachineConfig-Objektes an. + </tr> + <tr> + <td> + <table cellpadding='7' cellspacing='0' border='0' align='left' width='90%' style='border-width: 0 0 0 0;'> + <form action='mcdef_copy.php' method='post'> + + <tr valign='top'> + <td style='border-color: black; border-style: solid; border-width: 3 0 1 0;'><b>Ziel Objekt:</b><br> + (Mehrfachauswahl möglich) </td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 3 0 1 0;'> + + <select name='copytargets[]' size='10' multiple class='medium_form_selectbox'> + <option selected value='none'>----------------------------</option> + <option value='{DEFDN}'>DEFAULT</option> + + <option value='none'>---- RECHNER -----</option> + <!-- BEGIN DYNAMIC BLOCK: Hosts --> + <option value='{HDN}'>{HN}</option> + <!-- END DYNAMIC BLOCK: Hosts --> + + <option value='none'>---- GRUPPEN -----</option> + <!-- BEGIN DYNAMIC BLOCK: Groups --> + <option value='{GDN}'>{GN}</option> + <!-- END DYNAMIC BLOCK: Groups --> + </select> + </td> + </tr> + <tr> + <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Eindeutiger Name (cn):</b><br>(Bitte ohne Leerzeichen eingeben) </td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <font size='+2'><b>MC_</b></font><input type='Text' name='mccncp' value='{MCCN}' size='50' class='medium_form_field'> + <input type='hidden' name='oldmccncp' value='{MCCN}'> + </td> + </tr> + + <input type='hidden' name='mcdn' value='{MCDN}'> + <input type='hidden' name='oldmccn' value='{MCCN}'> + <input type='hidden' name='mnr' value='{MNR}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + <input type='hidden' name='mcnr' value='{MCNR}'> + <input type='hidden' name='deltr' value='{DELTR}'> + + </table></td> + </tr><tr><td> + <input type='Submit' name='apply' value='kopieren' class='small_loginform_button'> + </form></td></tr> + + <tr> + <td height='40'></td> + </tr> + + <tr> + <td colspan='2'><h4>Default MachineConfig <code class='font_object'>{MCCN}</code> löschen:</h4></td> + </tr> + <tr> + <td> + <table cellpadding='7' cellspacing='0' border='0' align='left' width='90%' style='border-width: 0 0 0 0;'> + <form action='delete_confirm.php' method='post'> + + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + Die MachineConfig wird komplett gelöscht. + </tr> + + <input type='hidden' name='dn' value='{MCDN}'> + <input type='hidden' name='name' value='{MCCN}'> + <input type='hidden' name='delurl' value='mcdef_delete.php'> + <input type='hidden' name='backurl' value='mcdef.php?dn={MCDN}&mnr={MNR}&sbmnr={SBMNR}&mcnr={MCNR}'> + + + </table></td> + </tr><tr><td> + <input type='Submit' name='apply' value='löschen' class='small_loginform_button'> + </form></td></tr> + +</table> diff --git a/ldap-site-mngmt/webinterface/computers/mcdef.php b/ldap-site-mngmt/webinterface/computers/mcdef.php new file mode 100644 index 00000000..18e7a0aa --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/mcdef.php @@ -0,0 +1,137 @@ +<?php + +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "Computers Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 3; +$mnr = -1; +$sbmnr = -1; +$mcnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "mcdef.dwt"; + +include("../class.FastTemplate.php"); + +include('computers_header.inc.php'); + +################################################################################### + +$mnr = $_GET['mnr']; +$sbmnr = $_GET['sbmnr']; +$mcnr = $_GET['mcnr']; + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createComputersMenu($rollen, $mnr, $auDN, $sbmnr, $mcnr); + +################################################################################### + +$mcDN = $_GET['dn']; + +$attributes = array("dn","cn","description","timerange","language","start-x","start-snmp","start-sshd", + "start-xdmcp","start-rwhod","start-cron","start-printdaemon","crontab-entries", + "tex-enable","netbios-workgroup","vmware"); +$mc = get_node_data($mcDN,$attributes); +#print_r($mc); + +$exp = explode(',',$mcDN); +$node = array_slice($exp,1); +$nodeDN = implode(',',$node); + +# Timerange Komponenten +$template->define_dynamic("TRanges", "Webseite"); +if (count($mc['timerange']) > 1){ + foreach($mc['timerange'] as $tr){ + $exptime = explode('_',$tr); + $template->assign(array("MCDAY" => $exptime[0], + "MCBEG" => $exptime[1], + "MCEND" => $exptime[2])); + $template->parse("TRANGES_LIST", ".TRanges"); + } +}else{ + $exptime = explode('_',$mc['timerange']); + $template->assign(array("MCDAY" => $exptime[0], + "MCBEG" => $exptime[1], + "MCEND" => $exptime[2])); + $template->parse("TRANGES_LIST", ".TRanges"); +} + +$expcn = explode('_',$mc['cn']); +$name = array_slice($expcn,1); +$mccn = implode('_',$name); + +$template->assign(array("MCDN" => $mcDN, + "MCCN" => $mccn, + "MCDESC" => $mc['description'], + "LANG" => $mc['language'], + "X" => $mc['start-x'], + "SNMP" => $mc['start-snmp'], + "SSHD" => $mc['start-sshd'], + "XDMCP" => $mc['start-xdmcp'], + "RWHOD" => $mc['start-rwhod'], + "CRON" => $mc['start-cron'], + "CRONTAB" => "", + "PRINTD" => $mc['start-printdaemon'], + "TEX" => $mc['tex-enable'], + "NETBIOS" => $mc['netbios-workgroup'], + "VMWARE" => $mc['vmware'], + "NODEDN" => $nodeDN, + "DEFDN" => "cn=computers,".$auDN, + "MNR" => $mnr, + "SBMNR" => $sbmnr, + "MCNR" => $mcnr)); + +$template->define_dynamic("Crontab", "Webseite"); +if ( count($mc['crontab-entries']) != 0 ){ + if ( count($mc['crontab-entries']) > 1 ){ + foreach ($mc['crontab-entries'] as $crontab){ + $template->assign(array("CRONTAB" => $crontab)); + $template->parse("CRONTAB_LIST", ".Crontab"); + } + } + if ( count($mc['crontab-entries']) == 1 ){ + $template->assign(array("CRONTAB" => $mc['crontab-entries'])); + $template->parse("CRONTAB_LIST", ".Crontab"); + } +} +$template->assign(array("CRONTAB" => "")); +$template->parse("CRONTAB_LIST", ".Crontab"); + +################################################ +# MC kopieren + +$hostorgroup = $exp[0]; +$hgexp = explode('=',$exp[0]); + +$hosts_array = get_hosts($auDN,array("dn","hostname")); +$groups_array = get_groups($auDN,array("dn","cn")); + +$template->define_dynamic("Hosts", "Webseite"); +foreach ($hosts_array as $item){ + $template->assign(array("HDN" => $item['dn'], + "HN" => $item['hostname'])); + $template->parse("HOSTS_LIST", ".Hosts"); +} +$template->define_dynamic("Groups", "Webseite"); +foreach ($groups_array as $item){ + $template->assign(array("GDN" => $item['dn'], + "GN" => $item['cn'])); + $template->parse("GROUPS_LIST", ".Groups"); +} + + +# falls TR vorhanden dann soll sie gelöscht werden (flag deltr setzen) +if (count($mc['timerange']) != 0){ + $template->assign(array("DELTR" => "1")); +} +else{ + $template->assign(array("DELTR" => "0")); +} + +################################################################################### + +include("computers_footer.inc.php"); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/mcdef_add.php b/ldap-site-mngmt/webinterface/computers/mcdef_add.php new file mode 100644 index 00000000..efb86e87 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/mcdef_add.php @@ -0,0 +1,160 @@ +<?php +include('../standard_header.inc.php'); + +$mccn = $_POST['mccn']; $mccn = htmlentities($mccn); +$mcdesc = $_POST['mcdesc']; $mcdesc = htmlentities($mcdesc); +$mcday = $_POST['mcday']; $mcday = htmlentities($mcday); +$mcbeg = $_POST['mcbeg']; $mcbeg = htmlentities($mcbeg); +$mcend = $_POST['mcend']; $mcend = htmlentities($mcend); + +$nodeDN = $_POST['nodedn']; +$mnr = $_POST['mnr']; +$sbmnr = $_POST['sbmnr']; +$mcnr = $_POST['mcnr']; + +$targets = $_POST['targets']; +#print_r($targets); echo "<br>"; +$n = array_keys($targets,'none'); +#print_r($n); echo "<br>"; +for ($i=0; $i<count($n); $i++){ + $match = array_search('none',$targets); + array_splice($targets, $match, 1); +} +#echo "Zielobjekte: ";print_r($targets); echo "<br>"; + +$mcattribs = $_POST['mcattribs']; +if (count($mcattribs) != 0){ + foreach (array_keys($mcattribs) as $key){ + $mcatts[$key] = htmlentities($mcattribs[$key]); + } +} +# print_r($mcatts); echo "<br><br>"; + +$seconds = 2; +$get_mccn = str_replace ( " ", "_", $mccn ); +$get_mcdesc = str_replace ( " ", "_", $mcdesc ); +$get_mcday = str_replace ( " ", "_", $mcday ); +$get_mcbeg = str_replace ( " ", "_", $mcbeg ); +$get_mcend = str_replace ( " ", "_", $mcend ); +$url = "new_mcdef.php?mccn=".$get_mccn."&mcdesc=".$get_mcdesc."&mcday=".$get_mcday."&mcbeg=".$get_mcbeg."&mcend=".$get_mcend."&mnr=".$mnr."&sbmnr=".$sbmnr; + +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>"; + +if ( $mccn != "" && $mccn != "Hier_MC_NAME_eintragen"){ + + $mccn = "MC_".$mccn; + # Formulareingaben anpassen + $expmc = explode(" ",$mccn); + foreach ($expmc as $word){$expuc[] = ucfirst($word);} + $mccn = implode(" ",$expuc); + $mccn = preg_replace ( '/\s+([0-9A-Z])/', '$1', $mccn); + + $mctimerange = ""; + + if (count($targets) != 0){ + foreach ($targets as $targetDN){ + + $exptargetdn = ldap_explode_dn($targetDN, 1); + $targetcn = $exptargetdn[0]; + $targettype = $exptargetdn[1]; + + # Check auf eindeutigen MC-Namen am Zielobjekt + $brothers = get_machineconfigs($targetDN,array("cn")); + $brother = 0; + foreach ($brothers as $item){ + if( $item['cn'] == $mccn ){ + $mesg = "Es existiert bereits ein PXE Boot Menü mit dem eingegebenen Namen!<br> + Bitte geben Sie einen anderen Namen ein.<br><br>"; + $url = "new_mcdef.php?mccn=".$get_mccn."&mcday=".$get_mcday."&mcbeg=".$get_mcbeg."&mcend=".$get_mcend."&mnr=".$mnr."&sbmnr=".$sbmnr; + $brother = 1; + break; + } + } + if ($brother == 0){ + + if ( $mcday != "" && $mcbeg != "" && $mcend != "" && $mcbeg <= $mcend ){ + + # TimeRange Syntax checken + $syntax = new Syntaxcheck; + if ($syntax->check_timerange_syntax($mcday,$mcbeg,$mcend)){ + + # in Grossbuchstaben + if (preg_match("/([a-z]+)/",$mcday)){$mcday = strtoupper($mcday);} + if (preg_match("/([a-z]+)/",$mcbeg)){$mcbeg = strtoupper($mcbeg);} + if (preg_match("/([a-z]+)/",$mcend)){$mcend = strtoupper($mcend);} + + # führende Nullen weg + $mcbeg = preg_replace ( '/0([0-9])/', '$1', $mcbeg); + $mcend = preg_replace ( '/0([0-9])/', '$1', $mcend); + + # TimeRange auf Ãœberschneidung mit vorhandenen checken + if(check_timerange($mcday,$mcbeg,$mcend,$targetDN,"")){ + $mctimerange = $mcday."_".$mcbeg."_".$mcend; + } + else{ + $mesg = "Es existiert bereits eine MachineConfig, die sich mit der eingegebenen Time Range + überschneidet!<br> + Die neue MachineConfig wird ohne Time Range angelegt.<br> + Bitte geben Sie diese anschließend ein.<br><br>"; + } + } + else{ + $mesg = "Falsche Syntax in der Time-Range-Eingabe! Die neue MachineConfig wird ohne Time Range angelegt.<br> + Bitte geben Sie diese anschließend ein.<br><br>"; + } + } + else{ + $mesg = "Keine vollständige Time-Range-Eingabe! Die neue MachineConfig wird ohne Time Range angelegt.<br> + Bitte geben Sie diese anschließend ein.<br><br>"; + } + + $mcDN = "cn=".$mccn.",".$targetDN; + print_r($mcDN); echo "<br>"; + + if (add_mc($mcDN,$mccn,$mctimerange,$mcdesc,$mcattribs)){ + $mesg .= "<br>Neue MachineConfig erfolgreich angelegt<br>"; + if ($targettype == "computers"){ + $url = "mcdef.php?dn=".$mcDN."&mnr=1"; + } + if ($targettype == "groups"){ + $url = "mcdef.php?dn=".$mcDN."&mnr=2"; + } + if ($targettype == $au_ou){ + $url = "machineconfig_default.php"; + } + } + else{ + $mesg .= "<br>Fehler beim anlegen der MachineConfig!<br>"; + } + } + } + } + else{ + $mesg .= "<br>Sie haben kein Ziel angegeben!<br>"; + } +} + +elseif ( $mccn == "" || $mccn == "Hier_MC_NAME_eintragen"){ + + $mesg = "Sie haben den Namen der neuen Machine Config nicht angegeben. Dieser ist aber ein notwendiges Attribut.<br> + Bitte geben Sie ihn an.<br><br>"; + $url = "new_mcdef.php?mccn=Hier_MC_NAME_eintragen&mcdesc=".$get_mcdesc."&mcday=".$get_mcday."&mcbeg=".$get_mcbeg."&mcend=".$get_mcend."&mnr=".$mnr."&sbmnr=".$sbmnr; +} + + + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurü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 diff --git a/ldap-site-mngmt/webinterface/computers/mcdef_change.php b/ldap-site-mngmt/webinterface/computers/mcdef_change.php new file mode 100644 index 00000000..4aaa29fe --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/mcdef_change.php @@ -0,0 +1,402 @@ +<?php +include('../standard_header.inc.php'); + +$mccn = "MC_".$_POST['mccn']; +$mcdesc = $_POST['mcdesc']; $mcdesc = htmlentities($mcdesc); + +$mcday = $_POST['mcday']; +$mcbeg = $_POST['mcbeg']; +$mcend = $_POST['mcend']; +foreach (array_keys($mcday) as $key){ + $mcday[$key] = htmlentities($mcday[$key]); +} +foreach (array_keys($mcbeg) as $key){ + $mcbeg[$key] = htmlentities($mcbeg[$key]); +} +foreach (array_keys($mcend) as $key){ + $mcend[$key] = htmlentities($mcend[$key]); +} + +$deltr = $_POST['deltr']; + +$newmcday = $_POST['newmcday']; $newmcday = htmlentities($newmcday); +$newmcbeg = $_POST['newmcbeg']; $newmcbeg = htmlentities($newmcbeg); +$newmcend = $_POST['newmcend']; $newmcend = htmlentities($newmcend); + +$oldmcdesc = $_POST['oldmcdesc']; $oldmcdesc = htmlentities($oldmcdesc); +$oldmcday = $_POST['oldmcday']; +$oldmcbeg = $_POST['oldmcbeg']; +$oldmcend = $_POST['oldmcend']; + +$crontab = $_POST['crontab']; +$oldcrontab = $_POST['oldcrontab']; +foreach (array_keys($crontab) as $key){ + $crontab[$key] = htmlentities($crontab[$key]); +} + +$mcDN = $_POST['mcdn']; +$oldmccn = "MC_".$_POST['oldmccn']; + +$nodeDN = $_POST['nodedn']; +$mnr = $_POST['mnr']; +$sbmnr = $_POST['sbmnr']; +$mcnr = $_POST['mcnr']; + +# sosntige 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>"; + + +$seconds = 2; +$url = "mcdef.php?dn=".$mcDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr; + +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>"; + +############################################## +# MC CN (DN) + +if ( $oldmccn == $mccn ){ + # $mesg = "keine Aenderung<br>"; +} + +if ( $oldmccn != "" && $mccn != "" && $oldmccn != $mccn ){ + echo "Machine Config Name aendern<br>"; + # hier noch Syntaxcheck + # Formulareingaben anpassen + $expmc = explode(" ",$mccn); + foreach ($expmc as $word){$expuc[] = ucfirst($word);} + $mccn = implode(" ",$expuc); + $mccn = preg_replace ( '/\s+([0-9A-Z])/', '$1', $mccn); + + + $newmcDN = "cn=".$mccn.",".$nodeDN; + print_r($newmcDN); echo "<br><br>"; + + if(modify_mc_dn($mcDN, $newmcDN)){ + $mesg = "MC Name erfolgreich geändert<br><br>"; + $mcDN = $newmcDN; + }else{ + $mesg = "Fehler beim ändern des MC Name!<br><br>"; + } + + + # newsubmenu holen... + $url = "mcdef.php?dn=".$newmcDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr; +} + +if ( $oldmccn != "" && $mccn == "" ){ + echo "Gruppenname loeschen!<br> + Dieses ist Teil des DN, Sie werden die MachineConfig komplett löschen<br><br>"; + echo "Wollen Sie die MachineConfig <b>".$oldmccn."</b> wirklich löschen?<br><br> + <form action='mcdef_delete.php' method='post'> + Falls ja:<br><br> + <input type='hidden' name='dn' value='".$mcDN."'> + <input type='hidden' name='name' value='".$oldmccn."'> + <input type='Submit' name='apply' value='löschen' class='small_loginform_button'><br><br> + </form> + <form action='".$url."' method='post'> + Falls, nein:<br><br> + <input type='Submit' name='apply' value='zurück' class='small_loginform_button'> + </form>"; + $seconds = 600; +} + + +########################################## +# bereits vorhandene TimeRange(s) bearbeiten + +$entrymodtr = array(); +$modtr = 0; +# TimeRanges zusammensetzen +# $t = 0; # Laufvariable für $entrymodtr, da nicht jede Timerange ok sein muss +for ($i=0; $i<count($mcday); $i++){ + +$oldmctimerange = $oldmcday[$i]."_".$oldmcbeg[$i]."_".$oldmcend[$i]; + +if ( ($mcbeg[$i] <= $mcend[$i]) && ( ($mcday[$i] != $oldmcday[$i] && $mcday[$i] != "") || ($mcbeg[$i] != $oldmcbeg[$i] && $mcbeg[$i] != "") || ($mcend[$i] != $oldmcend[$i] && $mcend[$i] != "")) ){ + + + # TimeRange Syntax checken + $syntax = new Syntaxcheck; + if ($syntax->check_timerange_syntax($mcday[$i],$mcbeg[$i],$mcend[$i])){ + + # in Grossbuchstaben + if (preg_match("/([a-z]+)/",$mcday[$i])){$mcday[$i] = strtoupper($mcday[$i]);} + if (preg_match("/([a-z]+)/",$mcbeg[$i])){$mcbeg[$i] = strtoupper($mcbeg[$i]);} + if (preg_match("/([a-z]+)/",$mcend[$i])){$mcend[$i] = strtoupper($mcend[$i]);} + + # führende Nullen weg + $mcbeg[$i] = preg_replace ( '/0([0-9])/', '$1', $mcbeg[$i]); + $mcend[$i] = preg_replace ( '/0([0-9])/', '$1', $mcend[$i]); + + # TimeRange auf Ãœberschneidung mit vorhandenen checken außer mit eigener alter TR da diese + # ja geändert werden soll + if(check_timerange($mcday[$i],$mcbeg[$i],$mcend[$i],$nodeDN,$oldmctimerange)){ + + $mctimerange = $mcday[$i]."_".$mcbeg[$i]."_".$mcend[$i]; + $entrymodtr ['timerange'][$i] = $mctimerange; + $modtr = 1; + + } + else{ + $mesg = "Es existiert bereits eine MachineConfig, die sich mit der eingegebenen Time Range + überschneidet!<br> + Bitte geben Sie eine andere Time Range ein.<br><br>"; + $entrymodtr ['timerange'][$i] = $oldmctimerange; + } + } + else{ + $mesg = "Falsche Syntax in der Timerange-Eingabe!<br> + Bitte geben Sie die erneut Time Range ein.<br><br>"; + $entrymodtr ['timerange'][$i] = $oldmctimerange; + } + +} + + +elseif ( $mcday[$i] == "" || $mcbeg[$i] == "" || $mcend[$i] == "" || $mcbeg[$i] > $mcend[$i]){ + + $mesg = "Sie haben die Time Range <b>Nr.".$i."</b> nicht vollständig angegeben. Diese ist aber ein notwendiges Attribut.<br> + Diese Time Range wird nicht bearbeitet.<br><br>"; + $entrymodtr ['timerange'][$i] = $oldmctimerange; +} + +else{$entrymodtr ['timerange'][$i] = $oldmctimerange;} +} # Ende for-Schleife für jede Timerange +# jetzt noch alle gesammelten Änderungen Durchführen ... +if ($modtr == 1){ + # erst ändern + echo "Ändern: "; print_r($entrymodtr); echo "<br>"; + if($result = ldap_mod_replace($ds,$mcDN,$entrymodtr)){ + $mesg = "TimeRanges erfolgreich geändert<br><br>"; + }else{ + $mesg = "Fehler beim ändern der TimeRanges!<br><br>"; + } +} + + +if ( count($deltr) != 0 && $modtr == 0 ){ + # Time Range löschen + $j = 0; + foreach ($deltr as $delrange){ + $entrydeltr ['timerange'][$j] = $delrange; + $j++; + } + # dann löschen + echo "Löschen: "; print_r($entrydeltr); echo "<br>"; + if($result = ldap_mod_del($ds,$mcDN,$entrydeltr)){ + $mesg = "TimeRanges erfolgreich gelöscht<br><br>"; + }else{ + $mesg = "Fehler beim löschen der TimeRanges!<br><br>"; + } +}elseif(count($deltr) != 0 && $modtr == 1){ + echo "Nur Ändern (gleichzeitig Löschen und Ändern geht nicht)"; +} + +##################################### +# TimeRange hinzufügen + +if ( $newmcday != "" && $newmcbeg != "" && $newmcend != "" && $newmcbeg <= $newmcend ){ + + # TimeRange Syntax checken + $syntax = new Syntaxcheck; + if ($syntax->check_timerange_syntax($newmcday,$newmcbeg,$newmcend)){ + + # in Grossbuchstaben + if (preg_match("/([a-z]+)/",$newmcday)){$newmcday = strtoupper($newmcday);} + if (preg_match("/([a-z]+)/",$newmcbeg)){$newmcbeg = strtoupper($newmcbeg);} + if (preg_match("/([a-z]+)/",$newmcend)){$newmcend = strtoupper($newmcend);} + + # führende Nullen weg + $newmcbeg = preg_replace ( '/0([0-9])/', '$1', $newmcbeg); + $newmcend = preg_replace ( '/0([0-9])/', '$1', $newmcend); + + # TimeRange auf Ãœberschneidung mit vorhandenen checken + if(check_timerange($newmcday,$newmcbeg,$newmcend,$nodeDN,"")){ + + $newmctimerange = $newmcday."_".$newmcbeg."_".$newmcend; + $entrytr ['timerange'] = $newmctimerange; + if($result = ldap_mod_add($ds,$mcDN,$entrytr)){ + $mesg = "Zusätzliche TimeRange erfolgreich eingetragen<br><br>"; + }else{ + $mesg = "Fehler beim eintragen der zusätzlichen TimeRange!<br><br>"; + } + }else{ + $mesg = "Es existiert bereits eine MachineConfig, die sich mit der eingegebenen Time Range + überschneidet!<br> + Bitte geben Sie eine andere Time Range ein.<br><br>"; + } + }else{ + $mesg = "Falsche Syntax in der Timerange-Eingabe!<br> + Bitte geben Sie die erneut Time Range ein.<br><br>"; + } +} + +##################################### +# MC Description + +if ( $oldmcdesc == $mcdesc ){ + # $mesg = "keine Aenderung<br>"; +} + +if ( $oldmcdesc == "" && $mcdesc != "" ){ + echo "MC-Beschreibung neu anlegen<br>"; + # hier noch Syntaxcheck + $entrymc['description'] = $mcdesc; + if(ldap_mod_add($ds,$mcDN,$entrymc)){ + $mesg = "MC-Beschreibung erfolgreich eingetragen<br><br>"; + }else{ + $mesg = "Fehler beim eintragen der MC-Beschreibung<br><br>"; + } +} + +if ( $oldmcdesc != "" && $mcdesc != "" && $oldmcdesc != $mcdesc ){ + echo "MC-Beschreibung aendern<br>"; + # hier noch Syntaxcheck + $entrymc['description'] = $mcdesc; + if(ldap_mod_replace($ds,$mcDN,$entrymc)){ + $mesg = "MC-Beschreibung erfolgreich geaendert<br><br>"; + }else{ + $mesg = "Fehler beim aendern der MC-Beschreibung<br><br>"; + } +} + +if ( $oldmcdesc != "" && $mcdesc == "" ){ + echo "Rechner-Beschreibung loeschen<br>"; + # hier noch Syntaxcheck + $entrymc['description'] = $oldmcdesc; + if(ldap_mod_del($ds,$mcDN,$entrymc)){ + $mesg = "MC-Beschreibung erfolgreich geloescht<br><br>"; + }else{ + $mesg = "Fehler beim loeschen der MC-Beschreibung<br><br>"; + } +} + +##################################### +# Crontab Entries + +if (count($crontab) != 0 && (count(array_diff_assoc($crontab,$oldcrontab)) != 0 || count(array_diff_assoc($oldcrontab,$crontab)) != 0) ){ + + $crontabentry = array(); + foreach ($crontab as $ct){ + if ($ct != ""){ + $crontabentry ['crontab-entries'][] = $ct; + } + } + $oldcrontabentry = array(); + foreach ($oldcrontab as $oldct){ + if ($oldct != ""){ + $oldcrontabentry ['crontab-entries'][] = $oldct; + } + } + + if (count($crontabentry) == 0){ + echo "Crontab Eintrag löschen<br>"; + ldap_mod_del($ds,$mcDN,$oldcrontabentry); + }else{ + echo "Crontab Eintrag ändern<br>"; + print_r($crontabentry); + ldap_mod_replace($ds,$mcDN,$crontabentry); + } +} + +##################################### +# 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,$mcDN,$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 "ändern<br>"; + foreach (array_keys($entrymod) as $key){ + $modatts .= "<b>".$key."</b>,"; + } + if(ldap_mod_replace($ds,$mcDN,$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öschen<br>"; + foreach (array_keys($entrydel) as $key){ + $delatts .= "<b>".$key."</b>,"; + } + if(ldap_mod_del($ds,$mcDN,$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ü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 diff --git a/ldap-site-mngmt/webinterface/computers/mcdef_copy.php b/ldap-site-mngmt/webinterface/computers/mcdef_copy.php new file mode 100644 index 00000000..313b22fc --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/mcdef_copy.php @@ -0,0 +1,111 @@ +<?php +include('../standard_header.inc.php'); + +$mcDN = $_POST['mcdn']; +$mccn = "MC_".$_POST['mccncp']; +$oldmccn = "MC_".$_POST['oldmccncp']; + +$deltr = $_POST['deltr']; + +$nodeDN = $_POST['nodedn']; +$mnr = $_POST['mnr']; +$sbmnr = $_POST['sbmnr']; +$mcnr = $_POST['mcnr']; + +$copytargets = $_POST['copytargets']; +#print_r($copytargets); echo "<br>"; +$n = array_keys($copytargets,'none'); +#print_r($n); echo "<br>"; +for ($i=0; $i<count($n); $i++){ + $match = array_search('none',$copytargets); + array_splice($copytargets, $match, 1); +} +print_r($copytargets); echo "<br>"; + + +$seconds = 2; +$url = "mcdef.php?dn=".$mcDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr; + +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>"; + +if ( $mccn != ""){ + + # Formulareingaben anpassen + $expmc = explode(" ",$mccn); + foreach ($expmc as $word){$expuc[] = ucfirst($word);} + $mccn = implode(" ",$expuc); + $mccn = preg_replace ( '/\s+([0-9A-Z])/', '$1', $mccn); + + + if (count($copytargets) != 0){ + foreach ($copytargets as $targetDN){ + + $brothers = get_machineconfigs($targetDN,array("cn")); + $brother = 0; + foreach ($brothers as $item){ + if( $item['cn'] == $mccn ){ + $mesg = "Es existiert bereits eine Machine Config mit dem eingegebenen Namen!<br> + Bitte geben Sie einen anderen Namen ein.<br><br>"; + $url = "mcdef.php?dn=".$mcDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr; + $brother = 1; + break; + } + } + if ($brother == 0){ + + print_r($targetDN); echo "<br>"; + $exptarget = explode(',',$targetDN); + $target = explode('=',$exptarget[0]); + + $newmcDN = "cn=".$mccn.",".$targetDN; + print_r($newmcDN); echo "<br>"; + + + if (dive_into_tree_cp($mcDN,$newmcDN)){ + if($deltr == 1){ + $entrydel ['timerange'] = array(); + # Timeranges im neuen Objekt löschen + if (ldap_mod_del($ds,$newmcDN,$entrydel)){ + $mesg .= "<br>MachineConfig erfolgreich nach ".$target[1]." kopiert<br>"; + } + else{ + ldap_delete($ds,$newmcDN); + $mesg .= "<br>Fehler beim kopieren der MachineConfig nach <b>".$target[1]."</b><br>"; + } + } + } + else{ + $mesg .= "<br>Fehler beim kopieren der MachineConfig nach <b>".$target[1]."</b><br>"; + } + } + } + } + else{ + $mesg .= "<br>Sie haben kein Ziel angegeben!<br>"; + } +} + +elseif ( $mccn == ""){ + + $mesg = "Sie haben den Namen der neuen Machine Config nicht angegeben. Dieser ist aber ein notwendiges Attribut.<br> + Bitte geben Sie ihn an.<br><br>"; + $url = "mcdef.php?dn=".$mcDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr; +} + + + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurü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 diff --git a/ldap-site-mngmt/webinterface/computers/mcdef_delete.php b/ldap-site-mngmt/webinterface/computers/mcdef_delete.php new file mode 100644 index 00000000..e191f703 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/mcdef_delete.php @@ -0,0 +1,40 @@ +<?php +include('../standard_header.inc.php'); + +$mcDN = $_POST['dn']; +$mccn = $_POST['name']; + +$seconds = 1; +$url = 'machineconfig_default.php'; + +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>"; + +if ( $mcDN != ""){ + + if ( dive_into_tree_del($mcDN,"") ){ + $mesg = "Machine Config <b>".$mccn."</b> erfolgreich gelöscht!<br><br>"; + } + else{ + $mesg = "Fehler beim löschen der Machine Config <b>".$mccn."</b> !<br><br>"; + } + +} + + + + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurü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 diff --git a/ldap-site-mngmt/webinterface/computers/menu.dwt b/ldap-site-mngmt/webinterface/computers/menu.dwt new file mode 100644 index 00000000..34e02572 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/menu.dwt @@ -0,0 +1,40 @@ + +<table cellpadding='0' cellspacing='0' border='0' width='100%'> + + + <!-- BEGIN DYNAMIC BLOCK: Hauptmenu --> + + <tr valign='middle' align='left'> +
+ <td width='8%' align='right' style="border-style=none;">{ICON}</td> + <td width="8%" align="left" style="border-width:1 0 1 1;border-color:#000000;border-style:solid;padding:5;background-color:{FARBE}"> </td> + <td width="5%" align="left" style="border-width:1 0 1 0;border-color:#000000;border-style:solid;padding:5;background-color:{FARBE}"> </td>
+ <td width="69%" align="left" style="border-width:1 1 1 0;border-color:#000000;border-style:solid;padding:5;background-color:{FARBE}"> + <a href="{LINK_M}" style="text-decoration:none"><b class="standard_schrift">{TEXT_M}</b></a></td>
+ <td width='10%'> </td> + + </tr> + + + + + <!-- BEGIN DYNAMIC BLOCK: Submenu --> + + {SUB} + + <!-- BEGIN DYNAMIC BLOCK: Subsubmenu --> + + {SUBSUB} + + + <!-- END DYNAMIC BLOCK: Subsubmenu --> + + + <!-- END DYNAMIC BLOCK: Submenu --> + + <tr height='5'> + </tr> + +<!-- END DYNAMIC BLOCK: Hauptmenu --> + +</table> diff --git a/ldap-site-mngmt/webinterface/computers/menuentry.dwt b/ldap-site-mngmt/webinterface/computers/menuentry.dwt new file mode 100644 index 00000000..2ad75b93 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/menuentry.dwt @@ -0,0 +1,249 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td height='20'><h4>Zurück zu <a href='pxe.php?dn={PXEDN}&mnr={MNR}&sbmnr={SBMNR}&mcnr={MCNR}' class='headerlink'>{PXECN}</a></h4></td> + </tr> + <tr> + <td height='20'> </td> + </tr> + <tr> + <td colspan='2'><h3>Boot Menü Eintrag <code class='font_object'> {MECN} </code> </h3></td> + </tr> + <tr> + <td height='20'> </td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <form action='menuentry_change.php' method='post'> + + <tr> + <td width='40%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='60%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Eindeutiger Name (cn):</b><br>(Teil des dn, ohne Leerzeichen eingeben) </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='mecn' value='{MECN}' size='50' class='medium_form_field'> + <input type='hidden' name='oldmecn' value='{MECN}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Label:</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[label]' value='{LABEL}' size='50' class='medium_form_field'> + <input type='hidden' name='oldattribs[label]' value='{LABEL}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Generisches Boot Image: </b><br><br>(Angeboten von) </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <h4>{GMECN}</h4> Abteilung: {GMEOU} [Remote Boot Dienst: {GMERBS}] + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Menu Label:</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[menulabel]' value='{MELABEL}' size='50' class='medium_form_field'> + <input type='hidden' name='oldattribs[menulabel]' value='{MELABEL}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Menu Default:</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[menudefault]' value='{MEDEF}' size='50' class='medium_form_field'> + <input type='hidden' name='oldattribs[menudefault]' value='{MEDEF}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Menu Passwd:</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[menupasswd]' value='{MEPASSWD}' size='50' class='medium_form_field'> + <input type='hidden' name='oldattribs[menupasswd]' value='{MEPASSWD}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Menu Hide:</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[menuhide]' value='{MEHIDE}' size='50' class='medium_form_field'> + <input type='hidden' name='oldattribs[menuhide]' value='{MEHIDE}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Localboot:</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[localboot]' value='{LOCALBOOT}' size='50' class='medium_form_field'> + <input type='hidden' name='oldattribs[localboot]' value='{LOCALBOOT}'> + </td> + </tr> + + </table></td> + </tr> + <tr> + <td height='40'></td> + </tr> + <tr> + <td colspan='2'><h4>APPEND Parameter:</h4></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <tr> + <td width='20%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='80%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Client Konfiguration via: </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[clientconfvia]' value='{CCV}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[clientconfvia]' value='{CCV}'> ( dhcp | file | ldap ) + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>vga: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[vga]' value='{VGA}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[vga]' value='{VGA}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>splash: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[splash]' value='{SPLASH}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[splash]' value='{SPLASH}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>vci: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[vci]' value='{VCI}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[vci]' value='{VCI}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>no ldsc: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[noldsc]' value='{NOLDSC}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[noldsc]' value='{NOLDSC}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>elevator: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[elevator]' value='{ELEVATOR}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[elevator]' value='{ELEVATOR}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>apic: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[apic]' value='{APIC}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[apic]' value='{APIC}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Union FS: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[unionfs]' value='{UNIONFS}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[unionfs]' value='{UNIONFS}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>cowloop: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[cowloop]' value='{COWLOOP}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[cowloop]' value='{COWLOOP}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Debug Level: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[debug]' value='{DEBUG}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[debug]' value='{DEBUG}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Menü Position: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='menpos' value='{MENPOS}' size='2' class='medium_form_field'> + <input type='hidden' name='oldmenpos' value='{MENPOS}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Submenü Verweis: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[submenulink]' value='{SUBMENULINK}' size='50' class='medium_form_field'> + <br> + Dieses Feld sollte nur bei Verweisen auf Submenüs den vollständigen Link zu diesen enthalten + <br>(d.h. <TFTP-Server-IP>::/<TFTP-PXE-Pfad>/<Timerange>/<PXE-Dateiname>). <br> + Bei Textzeilen und Leerzeilen muss hier <b>"self"</b> stehen. <br> + Bei normalen Menüeinträgen (inklusive Localboot) muss diese Feld <b>leer</b> sein. + <input type='hidden' name='oldattribs[submenulink]' value='{SUBMENULINK}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Kernel: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[kernel]' value='{KERNEL}' size='50' class='medium_form_field'> + <br> + Angabe hier nur sinnvoll bei Leer-, Textzeilen oder Submenüverweisen, <br> + denn Eingabe wird, wenn der Menüeintrag auf ein generisches Boot Image verweist (siehe oben) <br> + bei der PXE Datei Generierung überschrieben. + <input type='hidden' name='oldattribs[kernel]' value='{KERNEL}'> + </td> + </tr> + + <input type='hidden' name='medn' value='{MEDN}'> + <input type='hidden' name='pxedn' value='{PXEDN}'> + <input type='hidden' name='timespan' value='{TIMERANGE}'> + <input type='hidden' name='mnr' value='{MNR}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + <input type='hidden' name='mcnr' value='{MCNR}'> + + </table></td> + </tr> + <tr> + <td><input type='Submit' name='apply' value='anwenden' class='small_loginform_button'> + </form></td> + </tr> + + + <tr> + <td height='40'></td> + </tr> + + <tr> + <td colspan='2'><h4>Boot Menü Eintrag <code class='font_object'>{MECN}</code> löschen:</h4></td> + </tr> + <tr> + <td> + <table cellpadding='7' cellspacing='0' border='0' align='left' width='90%' style='border-width: 0 0 0 0;'> + <form action='delete_confirm.php' method='post'> + + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + Das generische Boot Image wird komplett gelöscht. + </tr> + + <input type='hidden' name='dn' value='{MEDN}'> + <input type='hidden' name='name' value='{MECN}'> + <input type='hidden' name='pxedn' value='{PXEDN}'> + <input type='hidden' name='delurl' value='menuentry_delete.php'> + <input type='hidden' name='successurl' value='pxe.php?dn={PXEDN}&mnr={MNR}&sbmnr={SBMNR}&mcnr={MCNR}'> + <input type='hidden' name='backurl' value='menuentry.php?dn={MEDN}&mnr={MNR}&sbmnr={SBMNR}&mcnr={MCNR}'> + + + </table></td> + </tr> + <tr> + <td> + <input type='Submit' name='apply' value='löschen' class='small_loginform_button'> + </form></td> + </tr> + + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/menuentry.php b/ldap-site-mngmt/webinterface/computers/menuentry.php new file mode 100644 index 00000000..81e1dc63 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/menuentry.php @@ -0,0 +1,170 @@ +<?php + +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "Computers Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 3; +$mnr = -1; +$sbmnr = -1; +$mcnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "menuentry.dwt"; + +include("../class.FastTemplate.php"); + +include('computers_header.inc.php'); + +################################################################################### + +$mnr = $_GET['mnr']; +$sbmnr = $_GET['sbmnr']; +$mcnr = $_GET['mcnr']; + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createComputersMenu($rollen, $mnr, $auDN, $sbmnr, $mcnr); + +################################################################################### + +$meDN = $_GET['dn']; + +$attributes = array("cn","genericmenuentrydn","label","menulabel","menudefault","menupasswd","vga","splash", + "noldsc","elevator","clientconfvia","apic", + "cowloop","unionfs","debug","vci","menuhide","menuposition","localboot","kernel","submenulink"); +$me = get_node_data($meDN,$attributes); +#print_r($me); + +# PXE DN +$exp = explode(',',$meDN); +$node = array_slice($exp,1); +$exppxecn = explode('=',$node[0]); +$pxecn = $exppxecn[1]; +$pxeDN = implode(',',$node); + +# Generic Menu Entry +$expgbm = ldap_explode_dn ($me['genericmenuentrydn'],1); +$gmecn = $expgbm[0]; +$gmerbs = $expgbm[1]; +$gmeou = $expgbm[3]; + +# PXE/RBS Daten +$pxe = get_node_data($pxeDN,array("rbservicedn","timerange")); +$timerange = $pxe['timerange']; +$rbsDN = $pxe['rbservicedn']; +$exp = explode(',',$rbsDN); +$exprbsau = explode('=',$exp[2]); $rbsau = $exprbsau[1]; +$rbsdata = get_node_data($rbsDN,array("cn","nfsserverip","exportpath","tftpserverip","tftppath")); + +# Bootmenu Daten +$template->assign(array("MEDN" => $meDN, + "MECN" => $me['cn'], + "GMECN" => $gmecn, + "GMEOU" => $gmeou, + "GMERBS" => $gmerbs, + "LABEL" => $me['label'], + "MELABEL" => $me['menulabel'], + "MEDEF" => $me['menudefault'], + "MEPASSWD" => $me['menupasswd'], + "MEHIDE" => $me['menuhide'], + "VGA" => $me['vga'], + "SPLASH" => $me['splash'], + "NOLDSC" => $me['noldsc'], + "ELEVATOR" => $me['elevator'], + "VCI" => $me['vci'], + "CCV" => $me['clientconfvia'], + "APIC" => $me['apic'], + "COWLOOP" => $me['cowloop'], + "UNIONFS" => $me['unionfs'], + "DEBUG" => $me['debug'], + "MENPOS" => $me['menuposition'], + "LOCALBOOT" => $me['localboot'], + "KERNEL" => $me['kernel'], + "SUBMENULINK" => $me['submenulink'], + "PXEDN" => $pxeDN, + "PXECN" => $pxecn, + "TIMERANGE" => $timerange, + "MNR" => $mnr, + "SBMNR" => $sbmnr, + "MCNR" => $mcnr)); + +#$template->define_dynamic("Submenulink", "Webseite"); +#if (count($me['submenulink']) != 0){ +# foreach ($me['submenulink'] as $sbml){ +# $template->assign(array("SUBMENULINK" => $sbml)); +# $template->parse("SUBMENULINK_LIST", ".Submenulink"); +# } +#} + +# Alternative RB Dienste holen +$altrbs = get_rbservices($auDN,array("dn","cn")); +if (count($altrbs) != 0){ + for ($i=0; $i < count($altrbs); $i++){ + if ($rbsDN == $altrbs[$i]['dn']){ + array_splice($altrbs, $i, 1); + } + } +} + + +if (count($altrbs) != 0){ +$template->define_dynamic("Altrbs", "Webseite"); + foreach ($altrbs as $item){ + $altrbsexp = explode(',',$item['dn']); + $altrbsau = explode('=',$altrebsexp[2]); + $template->assign(array("ALTRBSDN" => $item['dn'], + "ALTRBSCN" => $item['cn'], + "ALTRBSAU" => "[ ".$altrbsau[1]." ]")); + $template->parse("ALTRBS_LIST", ".Altrbs"); + } +}else{ + $template->assign(array("ALTRBSDN" => "", + "ALTRBSCN" => "", + "ALTRBSAU" => "")); +} + +################################################ +# Bootmenü Einträge + +$menuentries = get_menuentries($pxeDN,array("dn","menuposition","label","menulabel")); +#print_r($menuentries); echo "<br>"; + +$template->define_dynamic("Bootmenu", "Webseite"); + +foreach ($menuentries as $me){ + $template->assign(array("MENDN" => $me['dn'], + "MENULABEL" => $me['menulabel'], + "POSITION" => $me['menuposition'], + "AUDN" => $auDN)); + $template->parse("BOOTMENU_LIST", ".Bootmenu"); +} + + +################################################ +# PXE kopieren + +$hostorgroup = $exp[0]; +$hgexp = explode('=',$exp[0]); + +$hosts_array = get_hosts($auDN,array("dn","hostname")); +$groups_array = get_groups($auDN,array("dn","cn")); + +$template->define_dynamic("Hosts", "Webseite"); +foreach ($hosts_array as $item){ + $template->assign(array("HDN" => $item['dn'], + "HN" => $item['hostname'])); + $template->parse("HOSTS_LIST", ".Hosts"); +} +$template->define_dynamic("Groups", "Webseite"); +foreach ($groups_array as $item){ + $template->assign(array("GDN" => $item['dn'], + "GN" => $item['cn'])); + $template->parse("GROUPS_LIST", ".Groups"); +} + +################################################################################### + +include("computers_footer.inc.php"); + +?> diff --git a/ldap-site-mngmt/webinterface/computers/menuentry_add.php b/ldap-site-mngmt/webinterface/computers/menuentry_add.php new file mode 100644 index 00000000..dd10e7c2 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/menuentry_add.php @@ -0,0 +1,263 @@ +<?php +include('../standard_header.inc.php'); + +$mecn = $_POST['mecn']; $mecn = htmlentities($mecn); +$gbmDN = $_POST['gbm']; +$menpos = $_POST['menpos']; +$maxpos = $_POST['maxpos']; + +$typ = $_POST['typ']; +$pxeDN = $_POST['pxedn']; +$timespan = $_POST['timerange']; +$mnr = $_POST['mnr']; +$sbmnr = $_POST['sbmnr']; +$mcnr = $_POST['mcnr']; + +$meattribs = $_POST['attribs']; +if (count($meattribs) != 0){ + foreach (array_keys($meattribs) as $key){ + $meatts[$key] = htmlentities($meattribs[$key]); + } +} +# print_r($meatts); echo "<br><br>"; + +# PXE Typ (computers/groups) für Submenulinks +$pxearray = ldap_explode_dn($pxeDN, 1); +$pxetype = $pxearray[2]; + +$seconds = 2; +$get_mecn = str_replace ( " ", "_", $mecn ); +$url = "pxe.php?dn=".$pxeDN."&mecn=".$get_mecn."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr; + +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>"; +# switch wäre besser ... +if ($typ == "newme" && $typ != "local" && $typ != "text" && $typ != "leer" && $typ != "submenu" ){ + + if ( $mecn != "" && $mecn != "Hier_NAME_eintragen" && $gbmDN != "none" ){ + + # Formulareingaben anpassen + $expme = explode(" ",$mecn); + foreach ($expme as $word){$expuc[] = ucfirst($word);} + $mecn = implode(" ",$expuc); + $mecn = preg_replace ( '/\s+([0-9A-Z])/', '$1', $mecn); + + if ($menpos != ""){ + # Syntaxcheck Menüposition + #$syntax = new Syntaxcheck; + #if (!($syntax->check_menuposition($menpos))){ + # $menpos = $maxpos; + #} + }else{ + $menpos = $maxpos; + } + if (strlen($menpos) == 1){ + $menpos = "0".$menpos; + } + # nun doch führende Nullen erzwingen + # also obsolet: $menpos = preg_replace ( '/0([0-9])/', '$1', $menpos); + + $meDN = "cn=".$mecn.",".$pxeDN; + + if (add_me($meDN,$mecn,$gbmDN,$menpos,$meatts,$pxeDN)){ + $mesg .= "<br>Neuen Menü Eintrag erfolgreich angelegt<br>"; + $url = "pxe.php?dn=".$pxeDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr;; + } + else{ + $mesg .= "<br>Fehler beim anlegen des Menü Eintrags!<br>"; + } + } + + elseif ( $mecn == "" || $mecn == "Hier_NAME_eintragen" || $gbmDN == "none" ){ + + $mesg = "Sie haben den Namen des neuen Menü Eintrags nicht angegeben oder kein + Generisches Boot Image ausgewählt. Beide sind aber ein notwendige Attribute.<br> + Bitte geben Sie sie an.<br><br>"; + $url = "new_menuentry.php?mecn=Hier_NAME_eintragen&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr; + } +} + +# Localboot Zeile hinzufügen +elseif ($typ == "local" && $typ != "newme" && $typ != "text" && $typ != "leer" && $typ != "submenu" ){ + + # Menu Position + $menpos = $_POST['localpos']; + if ($menpos != ""){ + # Syntaxcheck Menüposition + #$syntax = new Syntaxcheck; + #if (!($syntax->check_menuposition($menpos))){ + # $menpos = $maxpos; + #} + }else{ + $menpos = $maxpos; + } + if (strlen($menpos) == 1){ + $menpos = "0".$menpos; + } + # nun doch führende Nullen erzwingen + # also obsolet: $menpos = preg_replace ( '/0([0-9])/', '$1', $menpos); + + # CN bilden + $brothers = get_menuentries($pxeDN,array("dn","cn")); + $i=1; + $localcn = "localboot".$i; + if(count($brothers) != 0){ + for ($c=0; $c<count($brothers); $c++){ + foreach ($brothers as $item){ + if ($localcn == strtolower($item['cn'])){ + $i++; + $localcn = "localboot".$i; + } + } + } + } + $meDN = "cn=".$localcn.",".$pxeDN; + $entry ['objectclass'][0] = "MenuEntry"; + $entry ['objectclass'][1] = "top"; + $entry ['cn'] = $localcn; + $entry ['menuposition'] = $menpos; + $entry ['label'] = $localcn; + $entry ['menulabel'] = $_POST['locallabel']; + $entry ['menupasswd'] = $_POST['localpasswd']; + $entry ['localboot'] = "level 0"; + $pos = preg_replace ( '/0([0-9])/', '$1', $menpos); + increment_menupositions($pxeDN,$pos); # andere jeweils um 1 erhöhen + if (ldap_add($ds,$meDN,$entry)){ + $mesg .= "Localboot Zeile erfolgeich an Position ".$menpos." eingetragen"; + }else{ + $mesg .= "Fehler beim eintragen der Localboot Zeile!"; + } + $url = "pxe.php?dn=".$pxeDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr; +} + + +# Text Zeile hinzufügen +elseif ($typ == "text" && $typ != "newme" && $typ != "local" && $typ != "leer" && $typ != "submenu" ){ + + # Menu Position + $menpos = $_POST['textpos']; + if ($menpos != ""){ + # Syntaxcheck Menüposition + #$syntax = new Syntaxcheck; + #if (!($syntax->check_menuposition($menpos))){ + # $menpos = $maxpos; + #} + }else{ + $menpos = $maxpos; + } + if (strlen($menpos) == 1){ + $menpos = "0".$menpos; + } + # nun doch führende Nullen erzwingen + # also obsolet: $menpos = preg_replace ( '/0([0-9])/', '$1', $menpos); + + $text = $_POST['text']; + if($text != "" && $text != "TEXT"){ + $brothers = get_menuentries($pxeDN,array("dn","cn")); + $i=1; + $textcn = "textzeile".$i; + if(count($brothers) != 0){ + for ($c=0; $c<count($brothers); $c++){ + foreach ($brothers as $item){ + if ($textcn == strtolower($item['cn'])){ + $i++; + $textcn = "textzeile".$i; + } + } + } + } + $meDN = "cn=".$textcn.",".$pxeDN; + $entry ['objectclass'][0] = "MenuEntry"; + $entry ['objectclass'][1] = "top"; + $entry ['cn'] = $textcn; + $entry ['menuposition'] = $menpos; + $entry ['label'] = $text; + $entry ['kernel'] = "menu.c32"; + # Submenulink auf sich selbst + $pxedata = get_node_data($pxeDN,array("filename")); + $entry ['submenulink'] = "self"; + + $pos = preg_replace ( '/0([0-9])/', '$1', $menpos); + increment_menupositions($pxeDN,$pos); # andere jeweils um 1 erhöhen + if (ldap_add($ds,$meDN,$entry)){ + $mesg .= "Textzeile erfolgeich an Position ".$menpos." eingetragen"; + }else{ + $mesg .= "Fehler beim eintragen der Textzeile!"; + } + $url = "pxe.php?dn=".$pxeDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr; + } +} + + +elseif ($typ == "leer" && $typ != "newme" && $typ != "local" && $typ != "text" && $typ != "submenu" ){ + + # Menu Position + $menpos = $_POST['leerpos']; + if ($menpos != ""){ + # Syntaxcheck Menüposition + #$syntax = new Syntaxcheck; + #if (!($syntax->check_menuposition($menpos))){ + # $menpos = $maxpos; + #} + }else{ + $menpos = $maxpos; + } + if (strlen($menpos) == 1){ + $menpos = "0".$menpos; + } + # nun doch führende Nullen erzwingen + # also obsolet: $menpos = preg_replace ( '/0([0-9])/', '$1', $menpos); + + # CN bilden + $brothers = get_menuentries($pxeDN,array("dn","cn")); + $i=1; + $leercn = "leerzeile".$i; + if(count($brothers) != 0){ + for ($c=0; $c<count($brothers); $c++){ + foreach ($brothers as $item){ + if ($leercn == strtolower($item['cn'])){ + $i++; + $leercn = "leerzeile".$i; + } + } + } + } + $meDN = "cn=".$leercn.",".$pxeDN; + $entry ['objectclass'][0] = "MenuEntry"; + $entry ['objectclass'][1] = "top"; + $entry ['cn'] = $leercn; + $entry ['menuposition'] = $menpos; + $entry ['kernel'] = "menu.c32"; + # Submenulink auf sich selbst + $pxedata = get_node_data($pxeDN,array("filename")); + $entry ['submenulink'] = "self"; + + # wieder führende Nullen weg für increment_menpos + $pos = preg_replace ( '/0([0-9])/', '$1', $menpos); + increment_menupositions($pxeDN,$pos); # andere jeweils um 1 erhöhen + if (ldap_add($ds,$meDN,$entry)){ + $mesg .= "Leerzeile erfolgeich an Position ".$menpos." eingetragen"; + }else{ + $mesg .= "Fehler beim eintragen der Leerzeile!"; + } + $url = "pxe.php?dn=".$pxeDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr; +} + + +elseif ($typ == "submenu" && $typ != "newme" && $typ != "local" && $typ != "text" && $typ != "leer" ){ +} + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurü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 diff --git a/ldap-site-mngmt/webinterface/computers/menuentry_change.php b/ldap-site-mngmt/webinterface/computers/menuentry_change.php new file mode 100644 index 00000000..bf461f1f --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/menuentry_change.php @@ -0,0 +1,208 @@ +<?php +include('../standard_header.inc.php'); + +$mecn = $_POST['mecn']; $mecn = htmlentities($mecn); +$oldmecn = $_POST['oldmecn']; + +$menpos = $_POST['menpos']; +if (strlen($menpos) == 1){ + $menpos = "0".$menpos; +} +$oldmenpos = $_POST['oldmenpos']; +if (strlen($oldmenpos) == 1){ + $oldmenpos = "0".$oldmenpos; +} + +$meDN = $_POST['medn']; +$pxeDN = $_POST['pxedn']; +$mnr = $_POST['mnr']; +$sbmnr = $_POST['sbmnr']; +$mcnr = $_POST['mcnr']; + +$attribs = $_POST['attribs']; +if (count($attribs) != 0){ + foreach (array_keys($attribs) as $key){ + $atts[$key] = htmlentities($attribs[$key]); + } +} +# print_r($meatts); 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>"; + + + +$seconds = 2; +$get_mecn = str_replace ( " ", "_", $mecn ); +$url = "menuentry.php?dn=".$meDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr; + +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>"; + +############################################## +# ME CN (DN) + +if ( $oldmecn == $mecn ){ + # $mesg = "keine Aenderung<br>"; +} + +if ( $oldmecn != "" && $mecn != "" && $oldmecn != $mecn ){ + echo "Menü Eintrag Name aendern<br>"; + # hier noch Syntaxcheck + # Formulareingaben anpassen + $expme = explode(" ",$mecn); + foreach ($expme as $word){$expuc[] = ucfirst($word);} + $mecn = implode(" ",$expuc); + $mecn = preg_replace ( '/\s+([0-9A-Z])/', '$1', $mecn); + + + $newmeDN = "cn=".$mecn.",".$pxeDN; + print_r($newmeDN); echo "<br><br>"; + + if(modify_me_dn($meDN, $newmeDN)){ + $mesg = "Menü Eintrag Name erfolgreich geändert<br><br>"; + $meDN = $newmeDN; + }else{ + $mesg = "Fehler beim ändern des PMenü Eintrag Namen!<br><br>"; + } + + + # newsubmenu holen... + $url = "menuentry.php?dn=".$newmeDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr; +} + +if ( $oldmecn != "" && $mecn == "" ){ + echo "Menü Eintrag Name loeschen!<br> + Dieses ist Teil des DN, Sie werden den Menü Eintrag komplett löschen<br><br>"; + echo "Wollen Sie den Menü Eintrag <b>".$oldmecn."</b> wirklich löschen?<br><br> + <form action='menuentry_delete.php' method='post'> + Falls ja:<br><br> + <input type='hidden' name='dn' value='".$meDN."'> + <input type='hidden' name='name' value='".$oldmecn."'> + <input type='Submit' name='apply' value='löschen' class='small_loginform_button'><br><br> + </form> + <form action='".$url."' method='post'> + Falls, nein:<br><br> + <input type='Submit' name='apply' value='zurück' class='small_loginform_button'> + </form>"; + $seconds = 600; +} + + +################################### +# Menu Position + +if ( $menpos == $oldmenpos || $menpos == "" ){ + # keine Änderung +} + +if ( $menpos != "" && $oldmenpos != $menpos ){ + echo "Menü Position ändern<br><br>"; + # Syntax Check fehlt noch + + # switch partner finden + $secmeDN = get_dn_menuposition($pxeDN,$menpos); + $entrysec ['menuposition'] = $oldmenpos; + if (ldap_mod_replace($ds,$secmeDN,$entrysec)){ + $entry ['menuposition'] = $menpos; + if (ldap_mod_replace($ds,$meDN,$entry)){ + #cleanup_menupositions($pxeDN); + $mesg .= "Menü Position erfolgeich nach <b>".$menpos."</b> geändert"; + }else{ + $mesg .= "Fehler beim ändern der Menü Position!"; + } + }else{ + $mesg .= "Fehler beim ändern der Menü Position!"; + } +} + +################################### +# restliche Attribute + +$entryadd = array(); +$entrymod = array(); +$entrydel = array(); + +foreach (array_keys($atts) as $key){ + + if ( $oldatts[$key] == $atts[$key] ){ + # nix + } + 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,$meDN,$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 "ändern<br>"; + foreach (array_keys($entrymod) as $key){ + $modatts .= "<b>".$key."</b>,"; + } + if(ldap_mod_replace($ds,$meDN,$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öschen<br>"; + foreach (array_keys($entrydel) as $key){ + $delatts .= "<b>".$key."</b>,"; + } + if(ldap_mod_del($ds,$meDN,$entrydel)){ + $mesg = "Attribute ".$delatts." erfolgreich geloescht<br><br>"; + }else{ + $mesg = "Fehler beim loeschen der Attribute ".$delatts."<br><br>"; + } +} + +################################### +# Ende, noch Redirect + + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurü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 diff --git a/ldap-site-mngmt/webinterface/computers/menuentry_delete.php b/ldap-site-mngmt/webinterface/computers/menuentry_delete.php new file mode 100644 index 00000000..ba06eb55 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/menuentry_delete.php @@ -0,0 +1,41 @@ +<?php +include('../standard_header.inc.php'); + +$meDN = $_POST['dn']; +$mecn = $_POST['name']; + +$pxeDN = $_POST['pxedn']; + +$seconds = 1; +$url = $_POST['successurl']; + +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>"; + +if ( $meDN != ""){ + + if ( dive_into_tree_del($meDN,"") ){ + cleanup_menupositions($pxeDN); + $mesg = "Bootmenü Eintrag <b>".$mecn."</b> erfolgreich gelöscht!<br><br>"; + } + else{ + $mesg = "Fehler beim löschen des Bootmenü Eintrags <b>".$mecn."</b> !<br><br>"; + } + +} + + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurü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 diff --git a/ldap-site-mngmt/webinterface/computers/menuposition_down.php b/ldap-site-mngmt/webinterface/computers/menuposition_down.php new file mode 100644 index 00000000..53e82a21 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/menuposition_down.php @@ -0,0 +1,42 @@ +<?php +include('../standard_header.inc.php'); + +$meDN = $_GET['dn']; +$oldpos = $_GET['pos']; + +$pxeDN = $_GET['pxedn']; +$mnr = $_GET['mnr']; +$sbmnr = $_GET['sbmnr']; +$mcnr = $_GET['mcnr']; + +$me = get_menuentries($pxeDN,array("cn")); +$maxpos = count($me); + +$oldpos = preg_replace ( '/0([0-9])/', '$1', $oldpos); +if ($oldpos < $maxpos){ + + $newpos = $oldpos +1; + if (strlen($newpos) == 1){ + $newpos = "0".$newpos; + } + if (strlen($oldpos) == 1){ + $oldpos = "0".$oldpos; + } + + if ($secmeDN = get_dn_menuposition($pxeDN,$newpos)){ + #echo "other meDN:"; print_r($secmeDN); echo "<br>"; + $entrysec ['menuposition'] = $oldpos; + if ($result = ldap_mod_replace($ds,$secmeDN,$entrysec)){ + $entrymenu ['menuposition'] = $newpos; + $result = ldap_mod_replace($ds,$meDN,$entrymenu); + } + } +} +$seconds = 0; +$url = "pxe.php?dn=".$pxeDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr."&#menu"; +$mesg = ""; +#$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> +# Falls nicht, klicken Sie hier <a href=".$url." style='publink'>back</a>"; +redirect($seconds, $url, $mesg, $addSessionId = TRUE); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/menuposition_up.php b/ldap-site-mngmt/webinterface/computers/menuposition_up.php new file mode 100644 index 00000000..4a314aca --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/menuposition_up.php @@ -0,0 +1,40 @@ +<?php +include('../standard_header.inc.php'); + +$meDN = $_GET['dn']; +$oldpos = $_GET['pos']; + +$pxeDN = $_GET['pxedn']; +$mnr = $_GET['mnr']; +$sbmnr = $_GET['sbmnr']; +$mcnr = $_GET['mcnr']; + +$oldpos = preg_replace ( '/0([0-9])/', '$1', $oldpos); +if ($oldpos != 1){ + + $newpos = $oldpos-1; + if (strlen($newpos) == 1){ + $newpos = "0".$newpos; + } + if (strlen($oldpos) == 1){ + $oldpos = "0".$oldpos; + } + + if ($secmeDN = get_dn_menuposition($pxeDN,$newpos)){ + #echo "other meDN:"; print_r($secmeDN); echo "<br>"; + $entrysec ['menuposition'] = $oldpos; + if ($result = ldap_mod_replace($ds,$secmeDN,$entrysec)){ + $entrymenu ['menuposition'] = $newpos; + $result = ldap_mod_replace($ds,$meDN,$entrymenu); + } + + } +} +$seconds = 0; +$url = "pxe.php?dn=".$pxeDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr."&#menu"; +$mesg = ""; +#$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> +# Falls nicht, klicken Sie hier <a href=".$url." style='publink'>back</a>"; +redirect($seconds, $url, $mesg, $addSessionId = TRUE); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/new_group.dwt b/ldap-site-mngmt/webinterface/computers/new_group.dwt new file mode 100644 index 00000000..ea9accf0 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/new_group.dwt @@ -0,0 +1,101 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='2'><h3>Neue Rechnergruppe anlegen:</h3></td> + </tr> + <tr> + <td height='20'></td> + </tr> + <tr> + <td colspan='2'><h4>Notwendige Attribute (müssen angegeben werden):</h3></td> + </tr> + + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <form action='group_add.php' method='post'> + + <tr> + <td width='45%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='55%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Gruppen Name (cn):</b><br>(Teil des dn, ohne Leerzeichen eingeben) </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='groupcn' value='{GROUPCN}' size='40' class='medium_form_field'> + </td> + </tr> + + </table></td> + </tr> + <tr> + <td height='40'></td> + </tr> + <tr> + <td><h4>Optionale Attribute:</h3></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <tr> + <td width='45%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='55%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Gruppen-Rechner:</b><br>(Mehrfachauswahl möglich) </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <!-- BEGIN DYNAMIC BLOCK: Members --> + + <!-- END DYNAMIC BLOCK: Members --> + + <select name='addmember[]' size='{HOSTNUMBER}' multiple class='medium_form_selectbox'> + <option selected value='none'>----------</option> + + <!-- BEGIN DYNAMIC BLOCK: Hosts --> + <option value='{HDN}_{HOSTNAME}'>{HOSTNAME}</option> + <!-- END DYNAMIC BLOCK: Hosts --> + + </select> + </td> + </tr> + + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Gruppen Beschreibung: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='groupdesc' value='{GROUPDESC}' size='40' class='medium_form_field'> + </td> + </tr> + + + </tr> + </table></td> + </tr> + + <tr> + <td height='25'></td> + </tr> + <tr> + <td><h4>Gruppe als Group-Objekt in den DHCP Dienst aufnehmen (optional):</h3></td> + </tr> + + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <tr> + <td width='45%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>DHCP Objekt</b></td> + <td width='55%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Auswahl</b></td> + </tr> + + </table></td> + </tr> + + <tr> + <td height='5'></td> + </tr> + <tr> + <td style='border-width: 0 0 0 0;'><input type='Submit' name='apply' value='anlegen' class='small_loginform_button'> + </form></td> + </tr> + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/new_group.php b/ldap-site-mngmt/webinterface/computers/new_group.php new file mode 100644 index 00000000..0fcd8bcc --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/new_group.php @@ -0,0 +1,76 @@ +<?php + +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "Computers Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 3; +$mnr = 2; +$sbmnr = -1; +$mcnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "new_group.dwt"; + +include("../class.FastTemplate.php"); + +include('computers_header.inc.php'); + +################################################################################### + +$sbmnr = $_GET['sbmnr']; + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createComputersMenu($rollen, $mnr, $auDN, $sbmnr, $mcnr); + +################################################################################### + + +$groupcn = str_replace ( "_", " ", $_GET['groupcn']); +$groupdesc = str_replace ( "_", " ", $_GET['groupdesc']); + + + +$template->assign(array("GROUPCN" => $groupcn, + "GROUPDESC" => $groupdesc, + "AUDN" => $auDN)); + +# DHCP Stuff ... + + +############################################## +# neues Member anlegen ... +$hosts_array = get_hosts($auDN,array("dn","hostname")); +# print_r($users_array); echo "<br><br>"; +$groups = get_groups($auDN, array("member")); +# print_r($groups); +$template->assign(array("HOSTNAME" => "")); + +if (count($groups) != 0){ + foreach ($groups as $group){ + for ($i=0; $i < count($hosts_array); $i++){ + foreach ($group['member'] as $item){ # ist hier sicher dass member ein array ist auch bei 1 member? + if ($hosts_array[$i]['dn'] == $item){ + array_splice($hosts_array, $i, 1); + $i--; + } + } + } + } +} +# if (count($users_array) != 0){ + $template->define_dynamic("Hosts", "Webseite"); + foreach ($hosts_array as $item){ + $template->assign(array("HDN" => $item['dn'], + "HOSTNAME" => $item['hostname'], + "HOSTNUMBER" => 5)); + $template->parse("HOSTS_LIST", ".Hosts"); + } + + +################################################################################### + +include("computers_footer.inc.php"); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/new_host.dwt b/ldap-site-mngmt/webinterface/computers/new_host.dwt new file mode 100644 index 00000000..32366a42 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/new_host.dwt @@ -0,0 +1,112 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='2'><h3>Neuen Rechner anlegen:</h3></td> + </tr> + <tr> + <td height='20'></td> + </tr> + <tr> + <td colspan='2'><h4>Notwendige Attribute (müssen angegeben werden):</h3></td> + </tr> + + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <form action='host_add.php' method='post'> + + <tr> + <td width='45%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='55%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Rechner Name (hostname):</b><br>(Teil des dn, ohne Leerzeichen eingeben) </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='hostname' value='{HOSTNAME}' size='40' class='medium_form_field'> + </td> + </tr> + + </table></td> + </tr> + <tr> + <td height='25'></td> + </tr> + <tr> + <td><h4>Optionale Attribute:</h3></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <tr> + <td width='45%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='55%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Rechner Beschreibung: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='hostdesc' value='{HOSTDESC}' size='40' class='medium_form_field'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>MAC Adresse (HWAddress) :</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='mac' value='{MAC}' size='17' maxlength='17' class='medium_form_field'> + Bsp.: 00-12-03-aa-54-e6 + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>IP Adresse:</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='ip' value='{IP}' size='15' maxlength='15' class='medium_form_field'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>HW Mouse: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[hw-mouse]' value='{MOUSE}' size='30' class='medium_form_field'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>HW Graphic: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[hw-graphic]' value='{GRAPHIC}' size='30' class='medium_form_field'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>HW Monitor: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[hw-monitor]' value='{MONITOR}' size='30' class='medium_form_field'> + </td> + </tr> + + </table></td> + </tr> + + <tr> + <td height='25'></td> + </tr> + <tr> + <td><h4>Rechner als Host-Objekt in den DHCP Dienst aufnehmen (optional):</h3></td> + </tr> + + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <tr> + <td width='45%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>DHCP Objekt</b></td> + <td width='55%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Auswahl</b></td> + </tr> + + </table></td> + </tr> + + <tr> + <td height='5'></td> + </tr> + <tr> + <td style='border-width: 0 0 0 0;'><input type='Submit' name='apply' value='anlegen' class='small_loginform_button'> + </form></td> + </tr> + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/new_host.php b/ldap-site-mngmt/webinterface/computers/new_host.php new file mode 100644 index 00000000..9be7b46e --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/new_host.php @@ -0,0 +1,53 @@ +<?php + +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "Computers Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 3; +$mnr = 1; +$sbmnr = -1; +$mcnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "new_host.dwt"; + +include("../class.FastTemplate.php"); + +include('computers_header.inc.php'); + +################################################################################### + +$sbmnr = $_GET['sbmnr']; + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createComputersMenu($rollen, $mnr, $auDN, $sbmnr, $mcnr); + +################################################################################### + + +$hostname = str_replace ( "_", " ", $_GET['hostname']); +$hostdesc = str_replace ( "_", " ", $_GET['hostdesc']); +$mac = str_replace ( "_", " ", $_GET['mac']); +$ip = str_replace ( "_", " ", $_GET['ip']); + + +$template->assign(array("HOSTNAME" => $hostname, + "HOSTDESC" => $hostdesc, + "MAC" => $mac, + "IP" => $ip, + "MOUSE" => "", + "GRAPHIC" => "", + "MONITOR" => "", + "AUDN" => $auDN)); + + +# DHCP Stuff + + +################################################################################### + +include("computers_footer.inc.php"); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/new_mcdef.dwt b/ldap-site-mngmt/webinterface/computers/new_mcdef.dwt new file mode 100644 index 00000000..72ebf72d --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/new_mcdef.dwt @@ -0,0 +1,184 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='2'><h3>Neue Default MachineConfig anlegen:</h3></td> + </tr> + <tr> + <td height='10'> </td> + </tr> + <tr> + <td colspan='2'><h4>Allgemein:</h4></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <form action='mcdef_add.php' method='post'> + <tr> + <td width='30%' style='border-color: black; border-style: solid; border-width: 3 0 1 0;'><b>Eindeutiger Name (cn):</b><br>(Bitte ohne Leerzeichen eingeben) </td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 3 0 1 0;'> + <font size='+2'><b>MC_</b></font><input type='Text' name='mccn' value='{MCCN}' size='50' class='medium_form_field'> + </td> + </tr> + <tr> + <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Machine Config <br>Beschreibung: </td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='mcdesc' value='{MCDESC}' size='60' class='medium_form_field'> + + </td> + </tr> + <tr valign='top'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Ziel Objekt:</b><br> + (Mehrfachauswahl möglich) </td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <select name='targets[]' size='8' multiple class='medium_form_selectbox'> + <option selected value='none'>----------------------------</option> + <option value='{NODEDN}'>DEFAULT</option> + + <option value='none'>----- RECHNER spezif. MC -----</option> + <!-- BEGIN DYNAMIC BLOCK: Hosts --> + <option value='{HDN}'>{HN}</option> + <!-- END DYNAMIC BLOCK: Hosts --> + + <option value='none'>----- GRUPPEN MC -----</option> + <!-- BEGIN DYNAMIC BLOCK: Groups --> + <option value='{GDN}'>{GN}</option> + <!-- END DYNAMIC BLOCK: Groups --> + </select> + </td> + </tr> + + <tr valign='top'> + <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Gültigkeitsdauer <br>(Time Range): </b> </td> + <td width='40%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='mcday' value='{MCDAY}' size='5' maxlength='5' class='medium_form_field'> + <br> + Eines der folgenden:<br> + + - <b>Datum</b> (Format: dd.mm, z.B. 21.03/01.11) <br> + - <b>Monatstag</b> (Format: dd, z.B. 01 oder 25) <br> + - <b>Wochentag</b> (Format: MO, DI, ... , SO) <br> + - <b>X</b> für <b>täglich</b> + + <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='mcbeg' value='{MCBEG}' size='2' maxlength='2' class='medium_form_field'> + <b><font size='+1'>:00</b> - </font> + <input type='Text' name='mcend' value='{MCEND}' size='2' maxlength='2' class='medium_form_field'> + <b><font size='+1'>:59</b> Uhr</font><br> + - <b>Uhrzeit</b> (Format: hh, z.B. 07-19)<br> + - <b>X</b> für rund um die Uhr + </td> + </tr> + + </table></td> + </tr> + + <tr> + <td height='40'></td> + </tr> + <tr> + <td colspan='2'><h4>Dienste:</h4></td> + </tr> + + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <tr> + <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='70%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Start X: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='mcattribs[start-x]' value='' size='10' maxlength='3' class='medium_form_field'> + ( yes | no ) + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Start SNMP: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='mcattribs[start-snmp]' value='' size='10' maxlength='3' class='medium_form_field'> + ( yes | no ) + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Start SSHD: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='mcattribs[start-sshd]' value='' size='10' maxlength='3' class='medium_form_field'> + ( yes | no ) + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Start XDMCP: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='mcattribs[start-xdmcp]' value='' size='10' maxlength='3' class='medium_form_field'> + ( yes | no ) + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Start RWHOD: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='mcattribs[start-rwhod]' value='' size='10' maxlength='3' class='medium_form_field'> + ( yes | no ) + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Start PRINT DAEMON: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='mcattribs[start-printdaemon]' value='' size='10' maxlength='3' class='medium_form_field'> + ( yes | no ) + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>TEX Enable: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='mcattribs[tex-enable]' value='' size='10' maxlength='3' class='medium_form_field'> + ( yes | no ) + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Start CRON: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='mcattribs[start-cron]' value='' size='10' maxlength='3' class='medium_form_field'> + ( yes | no ) + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>CRONTAB Entries: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='mcattribs[crontab-entries]' value='' size='50' class='medium_form_field'> + </td> + </tr> + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Language: </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='mcattribs[language]' value='' size='10' class='medium_form_field'> + + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>NETBIOS Workgroup: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='mcattribs[netbios-workgroup]' value='' size='40' class='medium_form_field'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>VMWARE: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='mcattribs[vmware]' value='' size='40' class='medium_form_field'> + </td> + </tr> + + <input type='hidden' name='nodedn' value='{NODEDN}'> + <input type='hidden' name='mnr' value='{MNR}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + <input type='hidden' name='mcnr' value='{MCNR}'> + + </table></td> + </tr> + <tr> + <td><input type='Submit' name='apply' value='anlegen' class='small_loginform_button'> + </form></td> + </tr> + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/new_mcdef.php b/ldap-site-mngmt/webinterface/computers/new_mcdef.php new file mode 100644 index 00000000..eec7a3dd --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/new_mcdef.php @@ -0,0 +1,74 @@ +<?php + +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "Computers Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 3; +$mnr = 4; +$sbmnr = -1; +$mcnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "new_mcdef.dwt"; + +include("../class.FastTemplate.php"); + +include('computers_header.inc.php'); + +################################################################################### + +$sbmnr = $_GET['sbmnr']; +$mcnr = $_GET['mcnr']; + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createComputersMenu($rollen, $mnr, $auDN, $sbmnr, $mcnr); + +################################################################################### + +$mccn = str_replace ( "_", " ", $_GET['mccn']); +$mcdesc = str_replace ( "_", " ", $_GET['mcdesc']); +$mcday = str_replace ( "_", " ", $_GET['mcday']); +$mcbeg = str_replace ( "_", " ", $_GET['mcbeg']); +$mcend = str_replace ( "_", " ", $_GET['mcend']); + + +$template->assign(array("MCCN" => $mccn, + "MCDAY" => $mcday, + "MCBEG" => $mcbeg, + "MCEND" => $mcend, + "MCDESC" => $mcdesc, + "NODEDN" => "cn=computers,".$auDN, + "MNR" => $mnr, + "SBMNR" => $sbmnr, + "MCNR" => $mcnr)); + +################################################# +# Ziel Objekt (nur Rechner und Gruppen, Default) + +$hostorgroup = $exp[0]; +$hgexp = explode('=',$exp[0]); + +$hosts_array = get_hosts($auDN,array("dn","hostname")); +$groups_array = get_groups($auDN,array("dn","cn")); + +$template->define_dynamic("Hosts", "Webseite"); +foreach ($hosts_array as $item){ + $template->assign(array("HDN" => $item['dn'], + "HN" => $item['hostname'])); + $template->parse("HOSTS_LIST", ".Hosts"); +} +$template->define_dynamic("Groups", "Webseite"); +foreach ($groups_array as $item){ + $template->assign(array("GDN" => $item['dn'], + "GN" => $item['cn'])); + $template->parse("GROUPS_LIST", ".Groups"); +} + + +################################################################################### + +include("computers_footer.inc.php"); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/new_menuentry.dwt b/ldap-site-mngmt/webinterface/computers/new_menuentry.dwt new file mode 100644 index 00000000..9ccaa5ff --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/new_menuentry.dwt @@ -0,0 +1,191 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td height='20'><h4>Zurück zu <a href='pxe.php?dn={PXEDN}&mnr={MNR}&sbmnr={SBMNR}&mcnr={MCNR}' class='headerlink'>{PXECN}</a></h4></td> + </tr> + <tr> + <td height='20'> </td> + </tr> + <tr> + <td colspan='2'><h3>Neuen Boot Menü Eintrag anlegen:</h3></td> + </tr> + <tr> + <td height='20'> </td> + </tr> + <tr> + <td colspan='2'><h4>Notwendige Attribute:</h4></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <form action='menuentry_add.php' method='post'> + + <tr> + <td width='35%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='65%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Eindeutiger Name (cn):</b><br>(Teil des dn, ohne Leerzeichen eingeben) </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='mecn' value='{MECN}' size='60' class='medium_form_field'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Label:</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[label]' value='{LABEL}' size='60' class='medium_form_field'> + </td> + </tr> + <tr height='50' valign='top'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Generische Boot Images: </b><br>(Wählen Sie eines aus) </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <select name='gbm' size='10' class='large_form_selectbox'> + <option selected value='none'>-----------------------</option> + <!-- BEGIN DYNAMIC BLOCK: Rbs --> + <option value='none'>----- Abteilung {RBSAU} [{RBSCN}] -----</option> + <!-- BEGIN DYNAMIC BLOCK: Gbms --> + <option value='{GBMDN}'>{GBMCN} </option> + <!-- END DYNAMIC BLOCK: Gbms --> + <!-- END DYNAMIC BLOCK: Rbs --> + </select> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Menü Position: </b><br> + (Bitte ohne führende Null) </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='menpos' value='{MAXPOS}' size='2' class='medium_form_field'> + </td> + </tr> + + </table></td> + </tr> + <tr> + <td height='40'> </td> + </tr> + <tr> + <td colspan='2'><h4>Optionale Attribute:</h4></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <tr> + <td width='35%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='65%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Menu Label:</b> <br>(Wird im Bootmenü statt Label angezeigt) </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[menulabel]' value='{MELABEL}' size='50' class='medium_form_field'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Menu Passwd:</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[menupasswd]' value='{MEPASSWD}' size='50' class='medium_form_field'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Menu Hide:</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[menuhide]' value='{MEHIDE}' size='50' class='medium_form_field'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Localboot:</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[localboot]' value='{LOCALBOOT}' size='50' class='medium_form_field'> + </td> + </tr> + + </table></td> + </tr> + <tr> + <td height='40'></td> + </tr> + <tr> + <td colspan='2'><h4>APPEND Parameter:</h4></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <tr> + <td width='20%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='80%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Client Konfiguration via: </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[clientconfvia]' value='{CCV}' size='30' class='medium_form_field'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>vga: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[vga]' value='{VGA}' size='30' class='medium_form_field'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>splash: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[splash]' value='{SPLASH}' size='30' class='medium_form_field'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>vci: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[vci]' value='{VCI}' size='30' class='medium_form_field'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>no ldsc: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[noldsc]' value='{NOLDSC}' size='30' class='medium_form_field'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>elevator: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[elevator]' value='{ELEVATOR}' size='30' class='medium_form_field'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>apic: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[apic]' value='{APIC}' size='30' class='medium_form_field'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Union FS: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[unionfs]' value='{UNIONFS}' size='30' class='medium_form_field'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>cowloop: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[cowloop]' value='{COWLOOP}' size='30' class='medium_form_field'> + </td> + </tr> + + <input type='hidden' name='typ' value='newme'> + <input type='hidden' name='maxpos' value='{MAXPOS}'> + <input type='hidden' name='pxedn' value='{PXEDN}'> + <input type='hidden' name='mnr' value='{MNR}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + <input type='hidden' name='mcnr' value='{MCNR}'> + + </table></td> + </tr> + <tr> + <td><input type='Submit' name='apply' value='anlegen' class='small_loginform_button'> + </form></td> + </tr> + + + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/new_menuentry.php b/ldap-site-mngmt/webinterface/computers/new_menuentry.php new file mode 100644 index 00000000..155ed245 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/new_menuentry.php @@ -0,0 +1,150 @@ +<?php + +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "Computers Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 3; +$mnr = -1; +$sbmnr = -1; +$mcnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "new_menuentry.dwt"; + +include("../class.FastTemplate.php"); + +include('computers_header.inc.php'); + +################################################################################### + +$mnr = $_GET['mnr']; +$sbmnr = $_GET['sbmnr']; +$mcnr = $_GET['mcnr']; + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createComputersMenu($rollen, $mnr, $auDN, $sbmnr, $mcnr); + +################################################################################### + +$mecn = str_replace ( "_", " ", $_GET['mecn']); + +$pxeDN = $_GET['dn']; +$dnexp = ldap_explode_dn($pxeDN, 1); +$pxecn = $dnexp[0]; + +# RBS Daten +$pxe = get_node_data($pxeDN,array("rbservicedn")); +$rbsDN = $pxe['rbservicedn']; +$exp = explode(',',$rbsDN); +$exprbsau = explode('=',$exp[2]); $rbsau = $exprbsau[1]; +$rbsdata = get_node_data($rbsDN,array("cn","nfsserverip","exportpath","tftpserverip","tftppath")); + +# Anzahl Menüeinträge +$menens = get_menuentries($pxeDN,array("dn")); +$maxpos = count($menens)+1; + + +# Bootmenu Daten +$template->assign(array("MECN" => $mecn, + "LABEL" => "", + "MELABEL" => "", + "MEDEF" => "", + "MEPASSWD" => "", + "MEHIDE" => "", + "VGA" => "", + "SPLASH" => "", + "NOLDSC" => "", + "ELEVATOR" => "", + "VCI" => "", + "CCV" => "", + "APIC" => "", + "COWLOOP" => "", + "UNIONFS" => "", + "DEBUG" => "", + "LOCALBOOT" => "", + "SUBMENULINK" => "", + "MENPOS" => "", + "MAXPOS" => $maxpos, + "PXEDN" => $pxeDN, + "PXECN" => $pxecn, + "MNR" => $mnr, + "SBMNR" => $sbmnr, + "MCNR" => $mcnr)); + + +# verwendbare GBMs holen +# eigene AU (andere noch über "offer" Attribut in RBS suchen) +$rbsoffers = get_rbsoffers($auDN); +# eigene AU +if (count($rbsoffers) != 0){ + $rbservices = get_rbservices($auDN,array("dn")); + # wenn eigene RBS anbietet dann diese GBMs als erstes (oben in der Liste) + if (count($rbservices) != 0){ + foreach ($rbservices as $rbs){ + for ($i=0; $i < count($rbsoffers); $i++){ + if ($rbs['dn'] == $rbsoffers[$i]){ + array_splice($rbsoffers, $i, 1); + } + } + } + # momentan maximal ein RBS in der AU + $rbsaudn[] = $rbservices[0]['dn']; + $rbsoffsorted = array_merge($rbsaudn,$rbsoffers); + } + # sonst die GBMs des für diese PXE genutzen RBS + else{ + for ($i=0; $i < count($rbsoffers); $i++){ + if ($rbsDN == $rbsoffers[$i]){ + array_splice($rbsoffers, $i, 1); + } + } + $rbsaudn[] = $rbsDN; + $rbsoffsorted = array_merge($rbsaudn,$rbsoffers); + } +} +#print_r($rbsoffsorted);echo "<br><br>"; +# RBS Offers nun in der Reihenfolge erst eigene AU dann Rest ... +$attributes = array("dn","cn","label","kernel","initrd","nfsroot","nbdroot","ipappend"); +$template->assign(array("GBMDN" => "", + "GBMCN" => "Keine generischen Boot Images verfügbar", + "RBSCN" => "", + "RBSAU" => "")); +if (count($rbsoffsorted) != 0){ + $template->define_dynamic("Rbs", "Webseite"); + $template->define_dynamic("Gbms", "Webseite"); + + foreach ($rbsoffsorted as $rbsoff){ + $template->clear_parse("GBMS_LIST"); + #print_r($rbsoff);echo "<br><br>"; + $rbsdnexp = ldap_explode_dn($rbsoff,1); + $rbsoffcn = $rbsdnexp[0]; + $rbsoffau = $rbsdnexp[2]; + + $gbm_array = get_menuentries($rbsoff,$attributes); + if (count($gbm_array) != 0){ + + foreach ($gbm_array as $item){ + $template->assign(array("GBMDN" => $item['dn'], + "GBMCN" => $item['cn'])); + $template->parse("GBMS_LIST", ".Gbms"); + $template->clear_dynamic("Gbms"); + } + + } + $template->assign(array("RBSCN" => $rbsoffcn, + "RBSAU" => $rbsoffau)); + $template->parse("RBS_LIST", ".Rbs"); + $template->clear_dynamic("Rbs"); + + } +} + + + +################################################################################### + +include("computers_footer.inc.php"); + +?> diff --git a/ldap-site-mngmt/webinterface/computers/new_pxe.dwt b/ldap-site-mngmt/webinterface/computers/new_pxe.dwt new file mode 100644 index 00000000..2a50e977 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/new_pxe.dwt @@ -0,0 +1,175 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='2'><h3>Neues PXE Boot Menü anlegen:</h3></td> + </tr> + <tr> + <td height='10'> </td> + </tr> + <tr> + <td colspan='2'><h4>Allgemein:</h4></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <form action='pxe_add.php' method='post'> + <tr> + <td width='30%' style='border-color: black; border-style: solid; border-width: 3 0 1 0;'><b>Eindeutiger Name (cn):</b><br>(Bitte ohne Leerzeichen eingeben) </td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 3 0 1 0;'> + <font size='+2'><b>PXE_</b></font><input type='Text' name='pxecn' value='{PXECN}' size='50' class='medium_form_field'> + </td> + </tr> + <!--<tr valign='top'> + <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Remote Boot Dienst <br> + auswählen: </b> </td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <select name='rbs' size='5' class='medium_form_selectbox'> + <option selected value='none'>----------</option> + + <!-- BEGIN DYNAMIC BLOCK: Altrbs --> + <option value='{ALTRBSDN}'>{ALTRBSCN} {ALTRBSAU}</option> + <!-- END DYNAMIC BLOCK: Altrbs --> + + </select> + </td> + </tr>--> + <tr valign='top'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Ziel Objekt:</b><br> + (Mehrfachauswahl möglich) </td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <select name='targets[]' size='8' multiple class='medium_form_selectbox'> + <option selected value='none'>----- RECHNER spezif. PXE -----</option> + <!-- BEGIN DYNAMIC BLOCK: Hosts --> + <option value='{HDN}'>{HN}</option> + <!-- END DYNAMIC BLOCK: Hosts --> + + <option value='none'>----- GRUPPEN spezif. PXE -----</option> + <!-- BEGIN DYNAMIC BLOCK: Groups --> + <option value='{GDN}'>{GN}</option> + <!-- END DYNAMIC BLOCK: Groups --> + </select> + </td> + </tr> + <tr valign='top'> + <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Gültigkeitsdauer <br>(Time Range): </b> </td> + <td width='40%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='pxeday' value='{PXEDAY}' size='5' maxlength='5' class='medium_form_field'> + <br> + Eines der folgenden:<br> + + - <b>Datum</b> (Format: dd.mm, z.B. 21.03/01.11) <br> + - <b>Monatstag</b> (Format: dd, z.B. 01 oder 25) <br> + - <b>Wochentag</b> (Format: MO, DI, ... , SO) <br> + - <b>X</b> für <b>täglich</b> + + <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='pxebeg' value='{PXEBEG}' size='2' maxlength='2' class='medium_form_field'> + <b><font size='+1'>:00</b> - </font> + <input type='Text' name='pxeend' value='{PXEEND}' size='2' maxlength='2' class='medium_form_field'> + <b><font size='+1'>:59</b> Uhr</font><br> + - <b>Uhrzeit</b> (Format: hh, z.B. 07-19)<br> + - <b>X</b> für rund um die Uhr + </td> + </tr> + + </table></td> + </tr> + + <tr> + <td height='40'></td> + </tr> + <tr> + <td colspan='2'><h4>Globale PXE Parameter:</h4></td> + </tr> + + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <tr> + <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='70%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Default: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[default]' value='{DEFAULT}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[default]' value='{DEFAULT}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Menu Title: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[menutitle]' value='{MENTIT}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[menutitle]' value='{MENTIT}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Menu Master Passwd: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[menumasterpasswd]' value='{MENMPW}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[menumasterpasswd]' value='{MENMPW}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Timeout: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[timeout]' value='{TIMEOUT}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[timeout]' value='{TIMEOUT}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>No Escape: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[noescape]' value='{NOESC}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[noescape]' value='{NOESC}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Prompt: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[prompt]' value='{PROMPT}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[prompt]' value='{PROMPT}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Allow Options: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[allowoptions]' value='{ALLOW}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[allowoptions]' value='{ALLOW}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>On Error: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[onerror]' value='{ONERR}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[onerror]' value='{ONERR}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>ON Timeout: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[ontimeout]' value='{ONTIME}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[ontimeout]' value='{ONTIME}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Client-Conf Dateiname <br>(File URI): </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='conffile' value='{FILEURI}' size='50' class='medium_form_field'> + + </td> + </tr> + + <input type='hidden' name='nodedn' value='{NODEDN}'> + <input type='hidden' name='oldpxecn' value='{PXECN}'> + <input type='hidden' name='mnr' value='{MNR}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + <input type='hidden' name='mcnr' value='{MCNR}'> + </table></td> + </tr> + <tr> + <td><input type='Submit' name='apply' value='anlegen' class='small_loginform_button'> + </form></td> + </tr> + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/new_pxe.php b/ldap-site-mngmt/webinterface/computers/new_pxe.php new file mode 100644 index 00000000..07890505 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/new_pxe.php @@ -0,0 +1,130 @@ +<?php + +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "Computers Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 3; +$mnr = 5; +$sbmnr = -1; +$mcnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "new_pxe.dwt"; + +include("../class.FastTemplate.php"); + +include('computers_header.inc.php'); + +################################################################################### + +$sbmnr = $_GET['sbmnr']; +$mcnr = $_GET['mcnr']; + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createComputersMenu($rollen, $mnr, $auDN, $sbmnr, $mcnr); + +################################################################################### + +$pxecn = str_replace ( "_", " ", $_GET['pxecn']); +$pxeday = str_replace ( "_", " ", $_GET['pxeday']); +$pxebeg = str_replace ( "_", " ", $_GET['pxebeg']); +$pxeend = str_replace ( "_", " ", $_GET['pxeend']); + +$template->assign(array("PXECN" => $pxecn, + "PXEDAY" => $pxeday, + "PXEBEG" => $pxebeg, + "PXEEND" => $pxeend, + # "LDAPURI" => "", + "FILEURI" => "", + "RBS" => "", + "RBSAU" => "", + "NFS" => "", + "NFSROOT" => "", + "TFTP" => "", + "TFTPROOT" => "", + "FILE" => "", + "ALLOW" => "", + "CONSOLE" => "", + "DEFAULT" => "menu.c32", + "DISPLAY" => "", + "FONT" => "", + "IMPLICIT" => "", + "KBDMAP" => "", + "MENMPW" => "", + "MENTIT" => "", + "NOESC" => "1", + "ONERR" => "", + "ONTIME" => "", + "PROMPT" => "0", + "SAY" => "", + "SERIAL" => "", + "TIMEOUT" => "600", + "NODEDN" => "cn=rbs,".$auDN, + "HDN" => "none", + "HN" => "", + "GDN" => "none", + "GN" => "", + "MNR" => $mnr, + "SBMNR" => $sbmnr)); + +############################################# +# RB Dienste holen +$rbsoffers = get_rbsoffers($auDN); + +$template->assign(array("ALTRBSDN" => "", + "ALTRBSCN" => "", + "ALTRBSAU" => "")); + +if (count($rbsoffers) != 0){ +$template->define_dynamic("Altrbs", "Webseite"); + foreach ($rbsoffers as $item){ + $rbsdnexp = ldap_explode_dn($item,1); + $rbsoffcn = $rbsdnexp[0]; + $rbsoffau = $rbsdnexp[2]; + #$auexp = explode(',',$item['auDN']); + #$altrbsau = explode('=',$auexp[0]); + $template->assign(array("ALTRBSDN" => $item, + "ALTRBSCN" => $rbsoffcn, + "ALTRBSAU" => " [ Abt.: ".$rbsoffau." ]")); + $template->parse("ALTRBS_LIST", ".Altrbs"); + } +} + +################################################# +# Ziel Objekt (nur Rechner und Gruppen, nicht Default) + +$hostorgroup = $exp[0]; +$hgexp = explode('=',$exp[0]); + +$hosts_array = get_hosts($auDN,array("dn","hostname","hlprbservice","hwaddress")); +if ( count($hosts_array) != 0 ){ + $template->define_dynamic("Hosts", "Webseite"); + foreach ($hosts_array as $item){ + # Nur Hosts die in DHCP/TFTP angemeldet und deren MAC eingetragen ist (für PXE-Filename) + if ( $item['hlprbservice'] != "" && $item['hwaddress'] != "" ){ + $template->assign(array("HDN" => $item['dn'], + "HN" => $item['hostname'])); + $template->parse("HOSTS_LIST", ".Hosts"); + } + } +} + +$groups_array = get_groups($auDN,array("dn","cn","hlprbservice")); +if ( count($groups_array) != 0 ){ + $template->define_dynamic("Groups", "Webseite"); + foreach ($groups_array as $item){ + if ( $item['hlprbservice'] != "" ){ + $template->assign(array("GDN" => $item['dn'], + "GN" => $item['cn'])); + $template->parse("GROUPS_LIST", ".Groups"); + } + } +} + +################################################################################### + +include("computers_footer.inc.php"); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/pxe.dwt b/ldap-site-mngmt/webinterface/computers/pxe.dwt new file mode 100644 index 00000000..0dff23eb --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/pxe.dwt @@ -0,0 +1,476 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='2'><h3>PXE Boot Menü <code class='font_object'> {PXECN} </code> </h3></td> + </tr> + <tr> + <td height='10'></td> + </tr> + + <tr> + <td colspan='2'>Klicken Sie auf einen Menüeintrag um zur Detailansicht zu gelangen und den Eintrag bearbeiten zu können</td> + </tr> + <tr> + <td> + <table cellpadding='7' cellspacing='0' border='0' align='left' width='80%' style='border-color: black; border-style: solid; border-width: 2 2 2 2;'> + + <tr> + <td width='8%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'>#</td> + <td width='8%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'>Flags</td> + <td width='64%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'>Menu Label </td> + <td width='5%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'> </td> + <td width='15%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'> </td> + </tr> + + <!-- BEGIN DYNAMIC BLOCK: Bootmenu --> + <form action='delete_confirm.php' method='post'> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;{BGCDEF}'>{POSITION} </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;{BGCDEF}'>{MEDEF} {MEPWD} {MEHIDE} </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;{BGCDEF}'><font size='+1'>{ANZEIGE} </font></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;{BGCDEF}'> + <a href='menuposition_up.php?dn={MENDN}&pos={POSITION}&pxedn={PXEDN}&mnr={MNR}&sbmnr={SBMNR}&mcnr={MCNR}'><img style='border-width:0;border-style=none;' src='../pics/up2.gif' height='15'></a> <br> + <a href='menuposition_down.php?dn={MENDN}&pos={POSITION}&pxedn={PXEDN}&mnr={MNR}&sbmnr={SBMNR}&mcnr={MCNR}'><img style='border-width:0;border-style=none;' src='../pics/down2.gif' height='15'></a></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;{BGCDEF}'> + <input type='hidden' name='dn' value='{MENDN}'> + <input type='hidden' name='name' value='{ANZEIGENAME}'> + <input type='hidden' name='pxedn' value='{PXEDN}'> + <input type='hidden' name='delurl' value='menuentry_delete.php'> + <input type='hidden' name='successurl' value='pxe.php?dn={PXEDN}&mnr={MNR}&sbmnr={SBMNR}&mcnr={MCNR}'> + <input type='hidden' name='backurl' value='pxe.php?dn={PXEDN}&mnr={MNR}&sbmnr={SBMNR}&mcnr={MCNR}'> + + <input type='Submit' name='apply' value='löschen' class='small_loginform_button'> + </tr> + </form> + <!-- END DYNAMIC BLOCK: Bootmenu --> + + </table></td> + </tr> + <tr> + <td><h4>Flags:</h4></font> + <ul> + <li><b>D</b> -> Default Menüeintrag</li> + <li><b>P</b> -> Passwort geschützt</li> + <li><b>H</b> -> Hidden</li> + </ul> + </td> + </tr> + <tr> + <td height='20'></td> + </tr> + <tr> + <td colspan='2'><h4>Neuen Menüeintrag anlegen: </h4> + <a href='new_menuentry.php?dn={PXEDN}&mnr={MNR}&sbmnr={SBMNR}&mcnr={MCNR}' style='color:#FFFFFF;' class='small_loginform_button'> zur Eingabemaske </a> </td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr> + <td colspan='2'><h4>Standard Menüeinträge anlegen:</h4></td> + </tr> + <tr> + <td> + <table cellpadding='7' cellspacing='0' border='0' align='left' width='90%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + + <tr> + <td width='20%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'>Typ </td> + <td width='25%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'> </td> + <td width='25%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'> </td> + <td width='10%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'>Position</td> + <td width='10%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'> </td> + </tr> + <tr valign='top'> + <form action='menuentry_add.php' method='post'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Localboot</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + Menu Label<br><input type='Text' name='locallabel' value='' size='20' class='medium_form_field'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + Passwort (optional)<br><input type='Text' name='localpasswd' value='' size='20' class='medium_form_field'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><input type='Text' name='localpos' value='{MAXPOS}' size='2' class='medium_form_field'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><input type='Submit' name='apply' value='anlegen' class='small_loginform_button'></td> + <input type='hidden' name='typ' value='local'> + <input type='hidden' name='maxpos' value='{MAXPOS}'> + <input type='hidden' name='pxedn' value='{PXEDN}'> + <input type='hidden' name='timerange' value='{TIMERANGE}'> + <input type='hidden' name='mnr' value='{MNR}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + <input type='hidden' name='mcnr' value='{MCNR}'> + </form> + </tr> + <tr valign='top'> + <form action='menuentry_add.php' method='post'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Textzeile</b> </td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><input type='Text' name='text' value='TEXT' size='50' class='medium_form_field'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><input type='Text' name='textpos' value='{MAXPOS}' size='2' class='medium_form_field'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><input type='Submit' name='apply' value='anlegen' class='small_loginform_button'></td> + <input type='hidden' name='typ' value='text'> + <input type='hidden' name='maxpos' value='{MAXPOS}'> + <input type='hidden' name='pxedn' value='{PXEDN}'> + <input type='hidden' name='timerange' value='{TIMERANGE}'> + <input type='hidden' name='mnr' value='{MNR}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + <input type='hidden' name='mcnr' value='{MCNR}'> + </form> + </tr> + <tr valign='top'> + <form action='menuentry_add.php' method='post'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Leerzeile</b> </td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><input type='Text' name='leerpos' value='{MAXPOS}' size='2' class='medium_form_field'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><input type='Submit' name='apply' value='anlegen' class='small_loginform_button'></td> + <input type='hidden' name='typ' value='leer'> + <input type='hidden' name='maxpos' value='{MAXPOS}'> + <input type='hidden' name='pxedn' value='{PXEDN}'> + <input type='hidden' name='timerange' value='{TIMERANGE}'> + <input type='hidden' name='mnr' value='{MNR}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + <input type='hidden' name='mcnr' value='{MCNR}'> + </form> + </tr> + <tr valign='top'> + <form action='menuentry_add.php' method='post'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Verweis zu Submenü</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>Submenü Name<br> + <input type='Text' name='submenu' value='' size='20' class='medium_form_field'></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>Remote Boot Service + <select name='subrbs' size='3' class='small_form_selectbox'> + <option selected value='none'>----------</option> + <!-- BEGIN DYNAMIC BLOCK: Subrbs --> + <option value='{SUBRBSDN}'>{SUBRBSCN} {SUBRBSAU}</option> + <!-- END DYNAMIC BLOCK: Subrbs --> + </select> + </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><input type='Text' name='submenupos' value='{MAXPOS}' size='2' class='medium_form_field'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><input type='Submit' name='apply' value='anlegen' class='small_loginform_button'></td> + <input type='hidden' name='typ' value='submenu'> + <input type='hidden' name='maxpos' value='{MAXPOS}'> + <input type='hidden' name='pxedn' value='{PXEDN}'> + <input type='hidden' name='timerange' value='{TIMERANGE}'> + <input type='hidden' name='mnr' value='{MNR}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + <input type='hidden' name='mcnr' value='{MCNR}'> + </form> + </tr> + + </table></td> + </tr> + + <tr> + <td height='40'></td> + </tr> + <tr> + <td colspan='2'><h4>Allgemeine Parameter:</h4></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <form action='pxe_change.php' method='post'> + <tr> + <td width='25%' style='border-color: black; border-style: solid; border-width: 3 0 1 0;'><b>Eindeutiger Name (cn):</b><br>(Bitte ohne Leerzeichen eingeben) </td> + <td width='5%' style='border-color: black; border-style: solid; border-width: 3 0 1 0;'> </td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 3 0 1 0;'> + <font size='+2'><b>PXE_</b></font><input type='Text' name='pxecn' value='{PXECN}' size='50' class='medium_form_field'> + <input type='hidden' name='oldpxecn' value='{PXECN}'> + </td> + </tr> + + <tr valign='top'> + <td width='25%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Remote Boot Dienst: </b> </td> + <td width='5%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> </td> + <td width='35%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <b>{RBS}</b> [Abteilung: <b>{RBSAU}</b>] </h4><br> + Von diesem Dienst verwendete Bootserver: <br> + <b>-</b> NFS Server {NFS}{NFSROOT}<br> + <b>-</b> TFTP Server {TFTP}{TFTPROOT}</td> + <td width='35%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <b>Alternativen Dienst verwenden:</b><br> + <select name='rbs' size='3' class='small_form_selectbox'> + <option selected value='none'>----------</option> + + <!-- BEGIN DYNAMIC BLOCK: Altrbs --> + <option value='{ALTRBSDN}'>{ALTRBSCN} {ALTRBSAU}</option> + <!-- END DYNAMIC BLOCK: Altrbs --> + + </select> + </td> + </tr> + <tr valign='top'> + <td width='25%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'><b>Gültigkeitsdauer <br>(Time Range(s)): </b><br> + Zum Löschen einer Time Range<br>Häkchen setzen </td> + <td width='5%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> </td> + <td width='35%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + Eines der folgenden:<br> + + - <b>Datum</b> (dd.mm, z.B. 21.03/01.11) <br> + - <b>Monatstag</b> (dd, z.B. 01 oder 25) <br> + - <b>Wochentag</b> (MO, DI, ... , SO) <br> + - <b>X</b> für <b>täglich</b> + + <td width='35%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + - <b>Uhrzeit</b> (Format: hh, z.B. 07-19)<br> + - <b>X</b> für rund um die Uhr + + </td> + </tr> + + <!-- BEGIN DYNAMIC BLOCK: TRanges --> + <tr valign='top'> + <td width='25%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> </td> + <td width='5%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + <input type='checkbox' name='deltr[]' value='{PXEDAY}_{PXEBEG}_{PXEEND}'> + </td> + <td width='35%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + <input type='Text' name='pxeday[]' value='{PXEDAY}' size='5' maxlength='5' class='medium_form_field'> + <input type='hidden' name='oldpxeday[]' value='{PXEDAY}'> <br> + + + <td width='35%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + <input type='Text' name='pxebeg[]' value='{PXEBEG}' size='2' maxlength='2' class='medium_form_field'> + <input type='hidden' name='oldpxebeg[]' value='{PXEBEG}'> <b><font size='+1'>:00</b> - </font> + <input type='Text' name='pxeend[]' value='{PXEEND}' size='2' maxlength='2' class='medium_form_field'> + <input type='hidden' name='oldpxeend[]' value='{PXEEND}'> <b><font size='+1'>:59</b> Uhr</font><br> + </td> + </tr> + <!-- END DYNAMIC BLOCK: TRanges --> + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>Neue Time Range hinzufügen </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='newpxeday' value='' size='5' maxlength='5' class='medium_form_field'> + + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='newpxebeg' value='' size='2' maxlength='2' class='medium_form_field'> + <b><font size='+1'>:00</b> - </font> + <input type='Text' name='newpxeend' value='' size='2' maxlength='2' class='medium_form_field'> + <b><font size='+1'>:59</b> Uhr</font><br> + + </td> + </tr> + + </table></td> + </tr> + + + + <tr> + <td height='40'></td> + </tr> + <tr> + <td colspan='2'><h4>Globale PXE Parameter:</h4></td> + </tr> + + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <tr> + <td width='20%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='80%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Default: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[default]' value='{DEFAULT}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[default]' value='{DEFAULT}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Menu Title: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[menutitle]' value='{MENTIT}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[menutitle]' value='{MENTIT}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Menu Master Passwd: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[menumasterpasswd]' value='{MENMPW}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[menumasterpasswd]' value='{MENMPW}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Timeout: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[timeout]' value='{TIMEOUT}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[timeout]' value='{TIMEOUT}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>No Escape: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[noescape]' value='{NOESC}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[noescape]' value='{NOESC}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Prompt: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[prompt]' value='{PROMPT}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[prompt]' value='{PROMPT}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Allow Options: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[allowoptions]' value='{ALLOW}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[allowoptions]' value='{ALLOW}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>On Error: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[onerror]' value='{ONERR}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[onerror]' value='{ONERR}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>ON Timeout: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[ontimeout]' value='{ONTIME}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[ontimeout]' value='{ONTIME}'> + </td> + </tr> + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>File URI: </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <font size='+1'>tftp://{TFTP}/{TFTPFILE}</font><input type='Text' name='attribs[fileuri]' value='{FILEURI}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[fileuri]' value='{FILEURI}'> + + </td> + </tr> + + </table></td> + </tr> + + <tr> + <td height='20'></td> + </tr> + <tr> + <td colspan='2'><h4>PXE Dateiname:</h4> + Achtung: Änderungen hier können zu nicht verwendeten PXE Dateien führen!<br> + Sie sollten hier nur Änderungen vornehmen, wenn der PXE Datei offensichtlich ein falscher Name zugewiesen ist.<br> + Wird z.B. vom betroffenen Rechner die MAC Adresse geändert, so wird dies vom System automatisch an dieser Stelle nachvollzogen. + Diese Feld dient daher primär der Kontrolle.</td> + </tr> + <tr> + <td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <tr valign='top'> + <td width='40%' style='border-color: black; border-style: solid; border-width: 3 0 1 0;'> + <b>PXE Dateiname(n): </b><br> + Bei PXE von Gruppen ist für jeden Mitgliedsrechner<br> + der PXE Dateiname aufgelistet. + </td> + <td style='border-color: black; border-style: solid; border-width: 3 0 1 0;'> + <!-- BEGIN DYNAMIC BLOCK: Filenames --> + <input type='Text' name='filename[]' value='{FILE}' size='40' class='medium_form_field'> + <input type='hidden' name='oldfilename[]' value='{FILE}'> + <!-- END DYNAMIC BLOCK: Filenames --> + <input type='Text' name='newfilename' value='' size='40' class='medium_form_field'> + </td> + </tr> + + </table></td> + </tr> + <tr> + <td> + <input type='hidden' name='nodedn' value='{NODEDN}'> + <input type='hidden' name='pxedn' value='{PXEDN}'> + <input type='hidden' name='oldpxecn' value='{PXECN}'> + <input type='hidden' name='mnr' value='{MNR}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + <input type='hidden' name='mcnr' value='{MCNR}'> + <input type='Submit' name='apply' value='anwenden' class='small_loginform_button'> + </form></td> + </tr> + + + + <tr> + <td height='50'></td> + </tr> + + <tr> + <td colspan='2'><h4>PXE Boot Menü <code class='font_object'>{PXECN}</code> kopieren:</h4> + Beachten Sie, dass die Time Ranges des PXE Boot Menüs nicht kopiert werden. Sie müssen diese anschließend + neu setzen. <br> + Geben Sie bitte den eindeutigen Namen des neuen PXE Boot Menüs an.</td> + </tr> + <tr> + <td> + <table cellpadding='7' cellspacing='0' border='0' align='left' width='90%' style='border-width: 0 0 0 0;'> + <form action='pxe_copy.php' method='post'> + + <tr valign='top'> + <td style='border-color: black; border-style: solid; border-width: 3 0 1 0;'><b>Ziel Objekt:</b><br> + (Mehrfachauswahl möglich) </td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 3 0 1 0;'> + + <select name='copytargets[]' size='10' multiple class='medium_form_selectbox'> + <option selected value='none'>----------------------------</option> + <option value='{DEFDN}'>DEFAULT</option> + + <option value='none'>---- RECHNER -----</option> + <!-- BEGIN DYNAMIC BLOCK: Hosts --> + <option value='{HDN}'>{HN}</option> + <!-- END DYNAMIC BLOCK: Hosts --> + + <option value='none'>---- GRUPPEN -----</option> + <!-- BEGIN DYNAMIC BLOCK: Groups --> + <option value='{GDN}'>{GN}</option> + <!-- END DYNAMIC BLOCK: Groups --> + </select> + </td> + </tr> + <tr> + <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Eindeutiger Name (cn):</b><br>(Bitte ohne Leerzeichen eingeben) </td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <font size='+2'><b>PXE_</b></font><input type='Text' name='pxecncp' value='{PXECN}' size='50' class='medium_form_field'> + <input type='hidden' name='oldpxecncp' value='{PXECN}'> + </td> + </tr> + + <input type='hidden' name='pxedn' value='{PXEDN}'> + <input type='hidden' name='oldpxecn' value='{PXECN}'> + <input type='hidden' name='mnr' value='{MNR}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + <input type='hidden' name='mcnr' value='{MCNR}'> + <input type='hidden' name='deltr' value='{DELTR}'> + + </table></td> + </tr><tr><td> + <input type='Submit' name='apply' value='kopieren' class='small_loginform_button'> + </form></td></tr> + + <tr> + <td height='50'></td> + </tr> + + <tr> + <td colspan='2'><h4>PXE Boot Menü <code class='font_object'>{PXECN}</code> löschen:</h4></td> + </tr> + <tr> + <td> + <table cellpadding='7' cellspacing='0' border='0' align='left' width='90%' style='border-width: 0 0 0 0;'> + <form action='delete_confirm.php' method='post'> + + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + Die MachineConfig wird komplett gelöscht. + </tr> + + <input type='hidden' name='dn' value='{PXEDN}'> + <input type='hidden' name='name' value='{PXECN}'> + <input type='hidden' name='delurl' value='pxe_delete.php'> + <input type='hidden' name='successurl' value='{NODETYP}.php?dn={NODEDN}&mnr={MNR}&sbmnr={SBMNR}'> + <input type='hidden' name='backurl' value='pxe.php?dn={PXEDN}&mnr={MNR}&sbmnr={SBMNR}&mcnr={MCNR}'> + + </table></td> + </tr><tr><td> + <input type='Submit' name='apply' value='löschen' class='small_loginform_button'> + </form></td></tr> + +</table> diff --git a/ldap-site-mngmt/webinterface/computers/pxe.php b/ldap-site-mngmt/webinterface/computers/pxe.php new file mode 100644 index 00000000..bbc2e5e1 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/pxe.php @@ -0,0 +1,252 @@ +<?php + +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "Computers Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 3; +$mnr = -1; +$sbmnr = -1; +$mcnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "pxe.dwt"; + +include("../class.FastTemplate.php"); + +include('computers_header.inc.php'); + +################################################################################### + +$mnr = $_GET['mnr']; +$sbmnr = $_GET['sbmnr']; +$mcnr = $_GET['mcnr']; + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createComputersMenu($rollen, $mnr, $auDN, $sbmnr, $mcnr); + +################################################################################### + +$pxeDN = $_GET['dn']; + +$attributes = array("dn","cn","rbservicedn","filename","timerange","allowoptions","console","default", + "display","font","implicit","kbdmap","menumasterpasswd","menutitle", + "noescape","onerror","ontimeout","prompt","say","serial","timeout","ldapuri","fileuri"); +$pxe = get_node_data($pxeDN,$attributes); +#print_r($pxe); + +$exp = explode(',',$pxeDN); +$node = array_slice($exp,1); +$nodeDN = implode(',',$node); + +# RBS Daten +$rbsDN = $pxe['rbservicedn']; +$exp = explode(',',$rbsDN); +$exprbsau = explode('=',$exp[2]); $rbsau = $exprbsau[1]; +$rbsdata = get_node_data($rbsDN,array("cn","nfsserverip","exportpath","tftpserverip","tftppath","tftpclientconfpath")); + +# Timerange Komponenten +$template->define_dynamic("TRanges", "Webseite"); +if (count($pxe['timerange']) > 1){ + foreach($pxe['timerange'] as $tr){ + $exptime = explode('_',$tr); + $template->assign(array("PXEDAY" => $exptime[0], + "PXEBEG" => $exptime[1], + "PXEEND" => $exptime[2])); + $template->parse("TRANGES_LIST", ".TRanges"); + } +}else{ + $exptime = explode('_',$pxe['timerange']); + $template->assign(array("PXEDAY" => $exptime[0], + "PXEBEG" => $exptime[1], + "PXEEND" => $exptime[2])); + $template->parse("TRANGES_LIST", ".TRanges"); +} + +# Filenames +$template->define_dynamic("Filenames", "Webseite"); +if (count($pxe['filename']) > 1){ + foreach($pxe['filename'] as $fi){ + $template->assign(array("FILE" => $fi)); + $template->parse("FILENAMES_LIST", ".Filenames"); + } +}else{ + $exptime = explode('_',$pxe['filename']); + $template->assign(array("FILE" => $pxe['filename'])); + $template->parse("FILENAMES_LIST", ".Filenames"); +} + +$expcn = explode('_',$pxe['cn']); +$name = array_slice($expcn,1); +$pxecn = implode('_',$name); + +# Bootmenü Einträge +$menuentries = get_menuentries($pxeDN,array("dn","menuposition","label","menulabel","menudefault","menupasswd","menuhide")); +# print_r($menuentries); echo "<br>"; +$maxpos = count($menuentries)+1; + +# Globale Parameter +$template->assign(array("PXEDN" => $pxeDN, + "PXECN" => $pxecn, + "TIMERANGE" => $pxe['timerange'], + "RBS" => $rbsdata['cn'], + "RBSAU" => $rbsau, + "NFS" => $rbsdata['nfsserverip'], + "NFSROOT" => $rbsdata['exportpath'], + "TFTP" => $rbsdata['tftpserverip'], + "TFTPROOT" => $rbsdata['tftppath'], + "TFTPFILE" => $rbsdata['tftpclientconfpath'], + #"LDAPURI" => $pxe['ldapuri'], + "FILEURI" => $pxe['fileuri'], + "ALLOW" => $pxe['allowoptions'], + "CONSOLE" => $pxe['console'], + "DEFAULT" => $pxe['default'], + "DISPLAY" => $pxe['display'], + "FONT" => $pxe['font'], + "IMPLICIT" => $pxe['implicit'], + "KBDMAP" => $pxe['kbdmap'], + "MENMPW" => $pxe['menumasterpasswd'], + "MENTIT" => $pxe['menutitle'], + "NOESC" => $pxe['noescape'], + "ONERR" => $pxe['onerror'], + "ONTIME" => $pxe['ontimeout'], + "PROMPT" => $pxe['prompt'], + "SAY" => $pxe['say'], + "SERIAL" => $pxe['serial'], + "TIMEOUT" => $pxe['timeout'], + "MAXPOS" => $maxpos, + "NODEDN" => $nodeDN, + "DEFDN" => "cn=rbs,".$auDN, + "MNR" => $mnr, + "SBMNR" => $sbmnr, + "MCNR" => $mcnr)); + +# Alternative RB Dienste holen +$altrbs = get_rbsoffers($auDN); + +# $altrbs = get_rbservices($auDN,array("dn","cn")); +$subrbs = $altrbs; +if (count($altrbs) != 0){ + for ($i=0; $i < count($altrbs); $i++){ + if ($rbsDN == $altrbs[$i]){ + array_splice($altrbs, $i, 1); + } + } +} +$template->assign(array("ALTRBSDN" => "", + "ALTRBSCN" => "", + "ALTRBSAU" => "")); +if (count($altrbs) != 0){ +$template->define_dynamic("Altrbs", "Webseite"); + foreach ($altrbs as $item){ + $rbsdnexp = ldap_explode_dn($item,1); + $rbsoffcn = $rbsdnexp[0]; + $rbsoffau = $rbsdnexp[2]; + #$altrbsexp = explode(',',$item['dn']); + #$altrbsau = explode('=',$altrbsexp[2]); + $template->assign(array("ALTRBSDN" => $item, + "ALTRBSCN" => $rbsoffcn, + "ALTRBSAU" => " [ Abt.: ".$rbsoffau." ]")); + $template->parse("ALTRBS_LIST", ".Altrbs"); + } +} + +# Für Submenü Einträge +$template->assign(array("SUBRBSDN" => "", + "SUBRBSCN" => "", + "SUBRBSAU" => "")); +if (count($subrbs) != 0){ +$template->define_dynamic("Subrbs", "Webseite"); + foreach ($subrbs as $item){ + $rbsdnexp = ldap_explode_dn($item,1); + $subrbscn = $rbsdnexp[0]; + $subrbsau = $rbsdnexp[2]; + #$subrbsexp = explode(',',$item['dn']); + #$subrbsau = explode('=',$subrbsexp[2]); + $template->assign(array("SUBRBSDN" => $item, + "SUBRBSCN" => $subrbscn, + "SUBRBSAU" => "[ ".$subrbsau." ]")); + $template->parse("SUBRBS_LIST", ".Subrbs"); + } +} + +################################################ +# Bootmenü Einträge + +$template->define_dynamic("Bootmenu", "Webseite"); +$template->assign(array("MENDN" => "", + "MENULABEL" => "", + "ANZEIGE" => "Noch kein Bootmenü Eintrag angelegt", + "MEDEF" => "", + "MEPWD" => "", + "MEHIDE" => "", + "BGCDEF" => "", + "POSITION" => "")); +foreach ($menuentries as $me){ + $anzeige = ""; + if ($me['label'] != "" && $me['menulabel'] == ""){$anzeige .= $me['label'];} + if ($me['menulabel'] != ""){$anzeige .= $me['menulabel'];} + if ($me['menudefault'] == 1){$medef = "<b>D</b>"; $bgcdef = "background-color:#EEDD82;";} + if ($me['menupasswd'] != ""){$mepwd = "<b>P</b>";} + if ($me['menuhide'] == 1){$mehide = "<b>H</b>"; $bgcdef = "background-color:#A0A0A0;";} + $template->assign(array("MENDN" => $me['dn'], + "ANZEIGE" => "<a href='menuentry.php?dn=".$me['dn']."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr."' class='headerlink'>".$anzeige."</a>", + "ANZEIGENAME" => $anzeige, + "POSITION" => $me['menuposition'], + "MEDEF" => $medef, + "MEPWD" => $mepwd, + "MEHIDE" => $mehide, + "BGCDEF" => $bgcdef, + "AUDN" => $auDN)); + $template->parse("BOOTMENU_LIST", ".Bootmenu"); + $medef = ""; + $bgcdef = ""; +} + + +################################################ +# PXE kopieren + +$hostorgroup = $exp[0]; +$hgexp = explode('=',$exp[0]); + + +$hosts_array = get_hosts($auDN,array("dn","hostname")); +$groups_array = get_groups($auDN,array("dn","cn")); + +$template->define_dynamic("Hosts", "Webseite"); +foreach ($hosts_array as $item){ + $template->assign(array("HDN" => $item['dn'], + "HN" => $item['hostname'])); + $template->parse("HOSTS_LIST", ".Hosts"); +} +$template->define_dynamic("Groups", "Webseite"); +foreach ($groups_array as $item){ + $template->assign(array("GDN" => $item['dn'], + "GN" => $item['cn'])); + $template->parse("GROUPS_LIST", ".Groups"); +} + +$dnexp = ldap_explode_dn($pxeDN, 1); +if ($dnexp[2] == "computers"){ + $nodetyp = "host"; +} +if ($dnexp[2] == "groups"){ + $nodetyp = "group"; +} +# falls TR vorhanden dann soll sie gelöscht werden (flag deltr setzen) +if (count($pxe['timerange']) != 0){ + $template->assign(array("DELTR" => "1", + "NODETYP" => $nodetyp)); +} +else{ + $template->assign(array("DELTR" => "0", + "NODETYP" => $nodetyp)); +} + +################################################################################### + +include("computers_footer.inc.php"); + +?> diff --git a/ldap-site-mngmt/webinterface/computers/pxe_add.php b/ldap-site-mngmt/webinterface/computers/pxe_add.php new file mode 100644 index 00000000..8aa54c31 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/pxe_add.php @@ -0,0 +1,228 @@ +<?php +include('../standard_header.inc.php'); + +$pxecn = $_POST['pxecn']; $pxecn = htmlentities($pxecn); +#$rbsDN = $_POST['rbs']; + +$pxeday = $_POST['pxeday']; $pxeday = htmlentities($pxeday); +$pxebeg = $_POST['pxebeg']; $pxebeg = htmlentities($pxebeg); +$pxeend = $_POST['pxeend']; $pxeend = htmlentities($pxeend); + +$conffile = $_POST['conffile']; $conffile = htmlentities($conffile); + +$mnr = $_POST['mnr']; +$sbmnr = $_POST['sbmnr']; +$mcnr = $_POST['mcnr']; + +$targets = $_POST['targets']; +#print_r($targets); echo "<br>"; +$n = array_keys($targets,'none'); +#print_r($n); echo "<br>"; +for ($i=0; $i<count($n); $i++){ + $match = array_search('none',$targets); + array_splice($targets, $match, 1); +} +#echo "Zielobjekte: ";print_r($targets); echo "<br>"; + +$pxeattribs = $_POST['pxeattribs']; +if (count($pxeattribs) != 0){ + foreach (array_keys($pxeattribs) as $key){ + $pxeatts[$key] = htmlentities($pxeattribs[$key]); + } +} +# print_r($mcatts); echo "<br><br>"; + +$seconds = 20; +$get_pxecn = str_replace ( " ", "_", $pxecn ); +$get_pxeday = str_replace ( " ", "_", $pxeday ); +$get_pxebeg = str_replace ( " ", "_", $pxebeg ); +$get_pxeend = str_replace ( " ", "_", $pxeend ); +$url = "new_pxe.php?pxecn=".$get_pxecn."&pxeday=".$get_pxeday."&pxebeg=".$get_pxebeg."&pxeend=".$get_pxeend."&mnr=".$mnr."&sbmnr=".$sbmnr; + +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>"; + +if ( $pxecn != "" && $pxecn != "Hier_PXE_NAME_eintragen" && $rbsDN != "none" ){ + + $pxecn = "PXE_".$pxecn; + # Formulareingaben anpassen + $exppxe = explode(" ",$pxecn); + foreach ($exppxe as $word){$expuc[] = ucfirst($word);} + $pxecn = implode(" ",$expuc); + $pxecn = preg_replace ( '/\s+([0-9A-Z])/', '$1', $pxecn); + + $pxetimerange = ""; + $nomac = 0; + + if (count($targets) != 0){ + foreach ($targets as $targetDN){ + + $exptargetdn = ldap_explode_dn($targetDN, 1); + $targetcn = $exptargetdn[0]; + $targettype = $exptargetdn[1]; + + # falls Target keine MAC hat dann kann keine PXE angelegt werden + # jetzt schon vorher bei der Zielobjektauswahl abgefangen + if ($targettype == "computers"){ + $macdata = get_node_data($targetDN, array("hwaddress")); + if ($macdata['hwaddress'] == ""){ + $nomac = 1; + echo "Für den Ziel-Rechner ist keine MAC Adresse eingetragen <br> + Das PXE Bootmenü wird nicht angelegt. <br> + <br> + Tragen Sie zuerst eine MAC ein!<br><br>"; + } + } + if ($targettype == "groups"){ + $members = get_node_data($targetDN, array("member")); + if (count($members) > 1){ + foreach ($members['member'] as $hostDN){ + $macdata = get_node_data($hostDN, array("hwaddress","hostname")); + if ($macdata['hwaddress'] == ""){ + $nomac = 1; + echo "Für den Gruppen-Rechner <b>".$macdata['hostname']."</b> ist keine MAC Adresse eingetragen <br> + Das PXE Bootmenü für die Gruppe wird nicht angelegt. <br> + <br> + Tragen Sie zuerst bei Rechner <b>".$macdata['hostname']."</b> eine MAC ein!<br><br>"; + } + } + } + if (count($members) == 1){ + $macdata = get_node_data($members['member'], array("hwaddress")); + if ($macdata['hwaddress'] == ""){ + $nomac = 1; + echo "Für den Gruppen-Rechner <b>".$macdata['hostname']."</b> ist keine MAC Adresse eingetragen <br> + Das PXE Bootmenü für die Gruppe wird nicht angelegt. <br> + <br> + Tragen Sie zuerst bei Rechner <b>".$macdata['hostname']."</b> eine MAC ein!<br><br>"; + } + } + } + + # Check auf eindeutigen PXE-Namen (könnte man erweitern auf kompletten RBS) + $brothers = get_pxeconfigs($targetDN,array("cn")); + $brother = 0; + foreach ($brothers as $item){ + if( $item['cn'] == $pxecn ){ + $mesg = "Es existiert bereits ein PXE Boot Menü mit dem eingegebenen Namen!<br> + Bitte geben Sie einen anderen Namen ein.<br><br>"; + $url = "new_pxe.php?pxecn=".$get_pxecn."&pxeday=".$get_pxeday."&pxebeg=".$get_pxebeg."&pxeend=".$get_pxeend."&mnr=".$mnr."&sbmnr=".$sbmnr; + $brother = 1; + break; + } + } + if ($brother == 0 && $nomac == 0){ + + if ( $pxeday != "" && $pxebeg != "" && $pxeend != "" && $pxebeg <= $pxeend ){ + + # TimeRange Syntax checken + $syntax = new Syntaxcheck; + if ($syntax->check_timerange_syntax($pxeday,$pxebeg,$pxeend)){ + + # in Grossbuchstaben + if (preg_match("/([a-z]+)/",$pxeday)){$pxeday = strtoupper($pxeday);} + if (preg_match("/([a-z]+)/",$pxebeg)){$pxebeg = strtoupper($pxebeg);} + if (preg_match("/([a-z]+)/",$pxeend)){$pxeend = strtoupper($pxeend);} + + # führende Nullen weg + $pxebeg = preg_replace ( '/0([0-9])/', '$1', $pxebeg); + $pxeend = preg_replace ( '/0([0-9])/', '$1', $pxeend); + + print_r($nodeDN); + # TimeRange auf Ãœberschneidung mit vorhandenen checken + if(check_timerange_pxe($pxeday,$pxebeg,$pxeend,$targetDN,"")){ + $pxetimerange = $pxeday."_".$pxebeg."_".$pxeend; + } + else{ + $mesg = "Es existiert bereits ein PXE Boot Menü, das sich mit der eingegebenen Time Range + überschneidet!<br> + Das neue PXE Boot Menü wird ohne Time Range angelegt.<br> + Bitte geben Sie diese anschließend ein.<br><br>"; + } + } + else{ + $mesg = "Falsche Syntax in der Time-Range-Eingabe! Das neue PXE Boot Menü wird ohne Time Range angelegt.<br> + Bitte geben Sie diese anschließend ein.<br><br>"; + } + } + else{ + $mesg = "Keine vollständige Time-Range-Eingabe! Das neue PXE Boot Menü wird ohne Time Range angelegt.<br> + Bitte geben Sie diese anschließend ein.<br><br>"; + } + + $pxeDN = "cn=".$pxecn.",".$targetDN; + + + # PXE Dateinamen bestimmen, MAC(s) + $filenames = array(); + if ($targettype == "computers"){ + $macdata = get_node_data($targetDN, array("hwaddress")); + $filenames[] = "01-".$macdata['hwaddress']; + } + if ($targettype == "groups"){ + $members = get_node_data($targetDN, array("member")); + if (count($members) > 1){ + foreach ($members['member'] as $hostDN){ + $macdata = get_node_data($hostDN, array("hwaddress")); + $filenames[] = "01-".$macdata['hwaddress']; + } + } + if (count($members) == 1){ + $macdata = get_node_data($members['member'], array("hwaddress")); + $filenames[] = "01-".$macdata['hwaddress']; + } + } + echo "filenames: ";print_r($filenames); echo "<br>"; + #$ldapuri = LDAP_HOST."/dn=cn=computers,".$auDN; + + # rbsDN bestimmen + $rbs = get_node_data($targetDN,array("hlprbservice")); + $rbsDN = $rbs['hlprbservice']; + print_r($rbsDN); + + /*if (add_pxe($pxeDN,$pxecn,$rbsDN,$pxetimerange,$pxeattribs,$filenames,$conffile)){ + $mesg .= "<br>Neues PXE Boot Menü erfolgreich angelegt<br>"; + if ($targettype == "computers"){ + $mnr=1; + } + if ($targettype == "groups"){ + $mnr=2; + } + $url = "pxe.php?dn=".$pxeDN."&mnr=".$mnr; + } + else{ + $mesg .= "<br>Fehler beim anlegen des PXE Boot Menüs!<br>"; + }*/ + } + } + } + else{ + $mesg .= "<br>Sie haben kein Ziel angegeben!<br>"; + } +} + + +elseif ( $pxecn == "" || $pxecn == "Hier_PXE_NAME_eintragen" || $rbsDN == "none" ){ + + $mesg = "Sie haben den Namen des neuen PXE Boot Menüs nicht angegeben oder den + Remote Boot Dienst nicht ausgewählt. Beide sind aber ein notwendige Attribute.<br> + Bitte geben Sie sie an.<br><br>"; + $url = "new_pxe.php?pxecn=Hier_PXE_NAME_eintragen&pxeday=".$get_pxeday."&pxebeg=".$get_pxebeg."&pxeend=".$get_pxeend."&mnr=".$mnr."&sbmnr=".$sbmnr; +} + + + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurü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 diff --git a/ldap-site-mngmt/webinterface/computers/pxe_change.php b/ldap-site-mngmt/webinterface/computers/pxe_change.php new file mode 100644 index 00000000..b3fcd4fa --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/pxe_change.php @@ -0,0 +1,437 @@ +<?php +include('../standard_header.inc.php'); + +$pxecn = "PXE_".$_POST['pxecn']; + +$pxeday = $_POST['pxeday']; +$pxebeg = $_POST['pxebeg']; +$pxeend = $_POST['pxeend']; +foreach (array_keys($pxeday) as $key){ + $pxeday[$key] = htmlentities($pxeday[$key]); +} +foreach (array_keys($pxebeg) as $key){ + $pxebeg[$key] = htmlentities($pxebeg[$key]); +} +foreach (array_keys($pxeend) as $key){ + $pxeend[$key] = htmlentities($pxeend[$key]); +} + +$deltr = $_POST['deltr']; + +$newpxeday = $_POST['newpxeday']; $newpxeday = htmlentities($newpxeday); +$newpxebeg = $_POST['newpxebeg']; $newpxebeg = htmlentities($newpxebeg); +$newpxeend = $_POST['newpxeend']; $newpxeend = htmlentities($newpxeend); + +$oldpxeday = $_POST['oldpxeday']; +$oldpxebeg = $_POST['oldpxebeg']; +$oldpxeend = $_POST['oldpxeend']; + +$pxeDN = $_POST['pxedn']; +$oldpxecn = "PXE_".$_POST['oldpxecn']; + +$rbs = $_POST['rbs']; +$filename = $_POST['filename']; +if (count($filename) != 0){ + foreach (array_keys($filename) as $key){ + $file[$key] = htmlentities($filename[$key]); + } +} +$oldfilename = $_POST['oldfilename']; +if (count($oldfilename) != 0){ + foreach (array_keys($oldfilename) as $key){ + $oldfile[$key] = htmlentities($oldfilename[$key]); + } +} +$newfilename = $_POST['newfilename']; $newfilename = htmlentities($newfilename); + + +$nodeDN = $_POST['nodedn']; +$mnr = $_POST['mnr']; +$sbmnr = $_POST['sbmnr']; +$mcnr = $_POST['mcnr']; + +# 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>"; + + +$seconds = 2; +$url = "pxe.php?dn=".$pxeDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr; + +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>"; + +############################################## +# PXE CN (DN) + +if ( $oldpxecn == $pxecn ){ + # $mesg = "keine Aenderung<br>"; +} + +if ( $oldpxecn != "" && $pxecn != "" && $oldpxecn != $pxecn ){ + echo "PXE Name aendern<br>"; + # hier noch Syntaxcheck + # Formulareingaben anpassen + $exppxe = explode(" ",$pxecn); + foreach ($exppxe as $word){$expuc[] = ucfirst($word);} + $pxecn = implode(" ",$expuc); + $pxecn = preg_replace ( '/\s+([0-9A-Z])/', '$1', $pxecn); + + + $newpxeDN = "cn=".$pxecn.",".$nodeDN; + print_r($newpxeDN); echo "<br><br>"; + + if(modify_pxe_dn($pxeDN, $newpxeDN)){ + $mesg = "PXE Name erfolgreich geändert<br><br>"; + $pxeDN = $newpxeDN; + }else{ + $mesg = "Fehler beim ändern des PXE Namen!<br><br>"; + } + + + # newsubmenu holen... + $url = "pxe.php?dn=".$newpxeDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr; +} + +if ( $oldpxecn != "" && $pxecn == "" ){ + echo "PXE Name loeschen!<br> + Dieses ist Teil des DN, Sie werden das PXE Boot Menü komplett löschen<br><br>"; + echo "Wollen Sie das PXE Boot Menü <b>".$oldpxecn."</b> wirklich löschen?<br><br> + <form action='pxe_delete.php' method='post'> + Falls ja:<br><br> + <input type='hidden' name='dn' value='".$pxeDN."'> + <input type='hidden' name='name' value='".$oldpxecn."'> + <input type='Submit' name='apply' value='löschen' class='small_loginform_button'><br><br> + </form> + <form action='".$url."' method='post'> + Falls, nein:<br><br> + <input type='Submit' name='apply' value='zurück' class='small_loginform_button'> + </form>"; + $seconds = 600; +} + +########################################## +# Remote Boot Dienst + +if ($rbs != "none"){ + $exp = explode(',',$rbs); + $exprbscn = explode('=',$exp[0]); + $rbscn = $exprbscn[1]; + $exprbsau = explode('=',$exp[2]); + $rbsau = $exprbsau[1]; + + $entryrbs ['rbservicedn'] = $rbs; + if ($result = ldap_mod_replace($ds,$pxeDN,$entryrbs)){ + $mesg = "Remote Boot Service erfolgreich zu <b>".$rbscn."[Abt.: ".$rbsau."]</b> geändert<br><br>"; + }else{ + $mesg = "Fehler beim ändern des Remote Boot Services zu <b>".$rbscn."</b>!<br><br>"; + } +} + + +########################################## +# bereits vorhandene TimeRange(s) bearbeiten + +$entrymodtr = array(); +$modtr = 0; +# TimeRanges zusammensetzen +# $t = 0; # Laufvariable für $entrymodtr, da nicht jede Timerange ok sein muss +for ($i=0; $i<count($pxeday); $i++){ + +$oldpxetimerange = $oldpxeday[$i]."_".$oldpxebeg[$i]."_".$oldpxeend[$i]; + +if ( ($pxebeg[$i] <= $pxeend[$i]) && ( ($pxeday[$i] != $oldpxeday[$i] && $pxeday[$i] != "") || ($pxebeg[$i] != $oldpxebeg[$i] && $pxebeg[$i] != "") || ($pxeend[$i] != $oldpxeend[$i] && $pxeend[$i] != "")) ){ + + + # TimeRange Syntax checken + $syntax = new Syntaxcheck; + if ($syntax->check_timerange_syntax($pxeday[$i],$pxebeg[$i],$pxeend[$i])){ + + # in Grossbuchstaben + if (preg_match("/([a-z]+)/",$pxeday[$i])){$pxeday[$i] = strtoupper($pxeday[$i]);} + if (preg_match("/([a-z]+)/",$pxebeg[$i])){$pxebeg[$i] = strtoupper($pxebeg[$i]);} + if (preg_match("/([a-z]+)/",$pxeend[$i])){$pxeend[$i] = strtoupper($pxeend[$i]);} + + # führende Nullen weg + $pxebeg[$i] = preg_replace ( '/0([0-9])/', '$1', $pxebeg[$i]); + $pxeend[$i] = preg_replace ( '/0([0-9])/', '$1', $pxeend[$i]); + + # TimeRange auf Ãœberschneidung mit vorhandenen checken außer mit eigener alter TR da diese + # ja geändert werden soll + if(check_timerange_pxe($pxeday[$i],$pxebeg[$i],$pxeend[$i],$nodeDN,$oldpxetimerange)){ + + $pxetimerange = $pxeday[$i]."_".$pxebeg[$i]."_".$pxeend[$i]; + $entrymodtr ['timerange'][$i] = $pxetimerange; + $modtr = 1; + + } + else{ + $mesg = "Es existiert bereits ein PXE Boot Menü, das sich mit der eingegebenen Time Range + überschneidet!<br> + Bitte geben Sie eine andere Time Range ein.<br><br>"; + $entrymodtr ['timerange'][$i] = $oldpxetimerange; + } + } + else{ + $mesg = "Falsche Syntax in der Timerange-Eingabe!<br> + Bitte geben Sie die erneut Time Range ein.<br><br>"; + $entrymodtr ['timerange'][$i] = $oldpxetimerange; + } + +} + + +elseif ( $pxeday[$i] == "" || $pxebeg[$i] == "" || $pxeend[$i] == "" || $pxebeg[$i] > $pxeend[$i]){ + + $mesg = "Sie haben die Time Range <b>Nr.".$i."</b> nicht vollständig angegeben. Diese ist aber ein notwendiges Attribut.<br> + Diese Time Range wird nicht bearbeitet.<br><br>"; + $entrymodtr ['timerange'][$i] = $oldpxetimerange; +} + +else{$entrymodtr ['timerange'][$i] = $oldpxetimerange;} +} # Ende for-Schleife für jede Timerange +# jetzt noch alle gesammelten Änderungen Durchführen ... +if ($modtr == 1){ + # erst ändern + echo "Ändern: "; print_r($entrymodtr); echo "<br>"; + if($result = ldap_mod_replace($ds,$pxeDN,$entrymodtr)){ + $mesg = "TimeRanges erfolgreich geändert<br><br>"; + }else{ + $mesg = "Fehler beim ändern der TimeRanges!<br><br>"; + } +} + + +if ( count($deltr) != 0 && $modtr == 0 ){ + # Time Range löschen + $j = 0; + foreach ($deltr as $delrange){ + $entrydeltr ['timerange'][$j] = $delrange; + $j++; + } + # dann löschen + echo "Löschen: "; print_r($entrydeltr); echo "<br>"; + if($result = ldap_mod_del($ds,$pxeDN,$entrydeltr)){ + $mesg = "TimeRanges erfolgreich gelöscht<br><br>"; + }else{ + $mesg = "Fehler beim löschen der TimeRanges!<br><br>"; + } +}elseif(count($deltr) != 0 && $modtr == 1){ + echo "Nur Ändern (gleichzeitig Löschen und Ändern geht nicht)"; +} + +##################################### +# TimeRange hinzufügen + +if ( $newpxeday != "" && $newpxebeg != "" && $newpxeend != "" && $newpxebeg <= $newpxeend ){ + + # TimeRange Syntax checken + $syntax = new Syntaxcheck; + if ($syntax->check_timerange_syntax($newpxeday,$newpxebeg,$newpxeend)){ + + # in Grossbuchstaben + if (preg_match("/([a-z]+)/",$newpxeday)){$newpxeday = strtoupper($newpxeday);} + if (preg_match("/([a-z]+)/",$newpxebeg)){$newpxebeg = strtoupper($newpxebeg);} + if (preg_match("/([a-z]+)/",$newpxeend)){$newpxeend = strtoupper($newpxeend);} + + # führende Nullen weg + $newpxebeg = preg_replace ( '/0([0-9])/', '$1', $newpxebeg); + $newpxeend = preg_replace ( '/0([0-9])/', '$1', $newpxeend); + + # TimeRange auf Ãœberschneidung mit vorhandenen checken + if(check_timerange_pxe($newpxeday,$newpxebeg,$newpxeend,$nodeDN,"")){ + + $newpxetimerange = $newpxeday."_".$newpxebeg."_".$newpxeend; + $entrytr ['timerange'] = $newpxetimerange; + if($result = ldap_mod_add($ds,$pxeDN,$entrytr)){ + $mesg = "Zusätzliche TimeRange erfolgreich eingetragen<br><br>"; + }else{ + $mesg = "Fehler beim eintragen der zusätzlichen TimeRange!<br><br>"; + } + }else{ + $mesg = "Es existiert bereits ein PXE Boot Menü, das sich mit der eingegebenen Time Range + überschneidet!<br> + Bitte geben Sie eine andere Time Range ein.<br><br>"; + } + }else{ + $mesg = "Falsche Syntax in der Timerange-Eingabe!<br> + Bitte geben Sie die erneut Time Range ein.<br><br>"; + } +} + + + +##################################### +# PXE Filename(s) + +$filemod = array(); +$modfi = 0; +$filedel = array(); +$delfi = 0; +$j = 0; + +if (count($file) != 0){ + +for ($i=0; $i<count($file); $i++){ + + if ( $oldfile[$i] == $file[$i] ){ + $filemod ['filename'][$i] = $oldfile[$i]; + # $mesg = "keine Aenderung<br>"; + } + + if ( $oldfile[$i] != "" && $file[$i] != "" && $oldfile[$i] != $file[$i] ){ + echo "PXE Dateinamen aendern<br> + Vorsicht dies kann eine nicht verwendbare PXE Datei zur Folge haben!<br><br>"; + # hier noch Syntaxcheck + $filemod ['filename'][$i] = $file[$i]; + $modfi = 1; + } + + if ( $oldfile[$i] != "" && $file[$i] == "" ){ + echo "PXE Dateinamen loeschen!<br> + Achtung: aus ihren PXE Daten wird keine PXE Datei mehr generiert.<br> + Sie sind solange nicht mehr für den PXE Bootvorgang verwendbar bis Sie einen neuen Dateinamen anlegen!<br><br>"; + $filemod ['filename'][$i] = $oldfile[$i]; + $filedel ['filename'][$j] = $oldfile[$i]; + $j++; + $delfi = 1; + $seconds = 4; + } +} +#erst ändern +if ($modfi == 1){ + echo "Ändern: "; print_r($filemod); echo "<br>"; + if(ldap_mod_replace($ds,$pxeDN,$filemod)){ + $mesg = "PXE Dateiname(n) erfolgreich geändert<br><br>"; + }else{ + $mesg = "Fehler beim ändern des(r) PXE Dateinamens!<br><br>"; + } + $modfi = 0; +} +# dann löschen +if ($delfi == 1){ + echo "Löschen: "; print_r($filedel); echo "<br>"; + if(ldap_mod_del($ds,$pxeDN,$filedel)){ + $mesg = "PXE Dateiname(n) erfolgreich gelöscht<br><br>"; + }else{ + $mesg = "Fehler beim löschen des PXE Dateinamens !<br><br>"; + } + $delfi = 0; +} + +} + +# PXE Dateiname neu anlegen +if ($newfilename == ""){ +} +if ($newfilename != ""){ + echo "PXE Dateiname hinzufügen"; + $fileadd ['filename'] = $newfilename; + if(ldap_mod_add($ds,$pxeDN,$fileadd)){ + $mesg = "PXE Dateiname <b>".$newfilename."</b> erfolgreich angelegt<br><br>"; + }else{ + $mesg = "Fehler beim anlegen des PXE Dateinamens ".$newfilename." !<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,$pxeDN,$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 "ändern<br>"; + foreach (array_keys($entrymod) as $key){ + $modatts .= "<b>".$key."</b>,"; + } + if(ldap_mod_replace($ds,$pxeDN,$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öschen<br>"; + foreach (array_keys($entrydel) as $key){ + $delatts .= "<b>".$key."</b>,"; + } + if(ldap_mod_del($ds,$pxeDN,$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ü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 diff --git a/ldap-site-mngmt/webinterface/computers/pxe_copy.php b/ldap-site-mngmt/webinterface/computers/pxe_copy.php new file mode 100644 index 00000000..eb75ea44 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/pxe_copy.php @@ -0,0 +1,180 @@ +<?php +include('../standard_header.inc.php'); + +$pxeDN = $_POST['pxedn']; +$pxecn = "PXE_".$_POST['pxecncp']; +$oldpxecn = "PXE_".$_POST['oldpxecncp']; + +$deltr = $_POST['deltr']; + +$oldpxeday = $_POST['oldpxedaycp']; $oldpxeday = htmlentities($oldpxeday); +$oldpxebeg = $_POST['oldpxebegcp']; $oldpxebeg = htmlentities($oldpxebeg); +$oldpxeend = $_POST['oldpxeendcp']; $oldpxeend = htmlentities($oldpxeend); + +$nodeDN = $_POST['nodedn']; +$mnr = $_POST['mnr']; +$sbmnr = $_POST['sbmnr']; +$mcnr = $_POST['mcnr']; + +$copytargets = $_POST['copytargets']; +#print_r($copytargets); echo "<br>"; +$n = array_keys($copytargets,'none'); +#print_r($n); echo "<br>"; +for ($i=0; $i<count($n); $i++){ + $match = array_search('none',$copytargets); + array_splice($copytargets, $match, 1); +} +#print_r($copytargets); echo "<br>"; + + +$seconds = 2; +$url = "pxe.php?dn=".$pxeDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr; + +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>"; + +if ( $pxecn != ""){ + + # Formulareingaben anpassen + $exppxe = explode(" ",$pxecn); + foreach ($exppxe as $word){$expuc[] = ucfirst($word);} + $pxecn = implode(" ",$expuc); + $pxecn = preg_replace ( '/\s+([0-9A-Z])/', '$1', $pxecn); + + $nomac = 0; + + if (count($copytargets) != 0){ + foreach ($copytargets as $targetDN){ + + $exptargetdn = ldap_explode_dn($targetDN, 1); + $targetcn = $exptargetdn[0]; + $targettype = $exptargetdn[1]; + + # falls Target keine MAC hat dann kann keine PXE angelegt werden + if ($targettype == "computers"){ + $macdata = get_node_data($targetDN, array("hwaddress")); + if ($macdata['hwaddress'] == ""){ + $nomac = 1; + echo "Für den Ziel-Rechner ist keine MAC Adresse eingetragen <br> + Das PXE Bootmenü wird nicht angelegt. <br> + <br> + Tragen Sie zuerst eine MAC ein!<br><br>"; + } + } + if ($targettype == "groups"){ + $members = get_node_data($targetDN, array("member")); + if (count($members) > 1){ + foreach ($members['member'] as $hostDN){ + $macdata = get_node_data($hostDN, array("hwaddress","hostname")); + if ($macdata['hwaddress'] == ""){ + $nomac = 1; + echo "Für den Gruppen-Rechner <b>".$macdata['hostname']."</b> ist keine MAC Adresse eingetragen <br> + Das PXE Bootmenü für die Gruppe wird nicht angelegt. <br> + <br> + Tragen Sie zuerst bei Rechner <b>".$macdata['hostname']."</b> eine MAC ein!<br><br>"; + } + } + } + if (count($members) == 1){ + $macdata = get_node_data($members['member'], array("hwaddress")); + if ($macdata['hwaddress'] == ""){ + $nomac = 1; + echo "Für den Gruppen-Rechner <b>".$macdata['hostname']."</b> ist keine MAC Adresse eingetragen <br> + Das PXE Bootmenü für die Gruppe wird nicht angelegt. <br> + <br> + Tragen Sie zuerst bei Rechner <b>".$macdata['hostname']."</b> eine MAC ein!<br><br>"; + } + } + } + + $brothers = get_pxeconfigs($targetDN,array("cn")); + $brother = 0; + foreach ($brothers as $item){ + if( $item['cn'] == $pxecn ){ + $mesg = "Es existiert bereits ein PXE Boot Menü mit dem eingegebenen Namen!<br> + Bitte geben Sie einen anderen Namen ein.<br><br>"; + $url = "pxe.php?dn=".$pxeDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr; + $brother = 1; + break; + } + } + if ($brother == 0 && $nomac == 0){ + + $exptargetdn = ldap_explode_dn($targetDN, 1); + $target = $exptargetdn[0]; + $targettype = $exptargetdn[1]; + + $newpxeDN = "cn=".$pxecn.",".$targetDN; + print_r($newpxeDN); echo "<br>"; + + if (dive_into_tree_cp($pxeDN,$newpxeDN)){ + + # Filename anpassen + if ($targettype == "computers"){ + $macdata = get_node_data($targetDN, array("hwaddress")); + $entrymod ['filename'] = "01-".$macdata['hwaddress']; + #$entrymod ['fileuri'] = "01-".$macdata['hwaddress'].".tgz"; + } + if ($targettype == "groups"){ + $members = get_node_data($targetDN, array("member")); + if (count($members) != 0){ + foreach ($members['member'] as $hostDN){ + $macdata = get_node_data($hostDN, array("hwaddress")); + $entrymod ['filename'][] = "01-".$macdata['hwaddress']; + #$entrymod ['fileuri'] = $target.".tgz"; + } + } + } + if(ldap_mod_replace($ds,$newpxeDN,$entrymod)){ + if($deltr == 1){ + # Timeranges und FileURI im neuen Objekt löschen (todo: anpassen statt löschen) + $entrydel ['timerange'] = array(); + $entrydel ['fileuri'] = array(); + if ( ldap_mod_del($ds,$newpxeDN,$entrydel) ){ + $mesg .= "<br>PXE Boot Menü erfolgreich nach ".$target[1]." kopiert<br>"; + } + else{ + ldap_delete($ds,$newpxeDN); + $mesg .= "<br>Fehler beim kopieren des PXE Boot Menüs nach <b>".$target[1]."</b><br>"; + } + } + } + else{ + ldap_delete($ds,$newpxeDN); + $mesg .= "<br>Fehler beim kopieren des PXE Boot Menüs nach <b>".$target[1]."</b><br>"; + } + } + else{ + $mesg .= "<br>Fehler beim kopieren des PXE Boot Menüs nach <b>".$target[1]."</b><br>"; + } + } + } + } + else{ + $mesg .= "<br>Sie haben kein Ziel angegeben!<br>"; + } +} + +elseif ( $pxecn == ""){ + + $mesg = "Sie haben den Namen des neuen PXE Boot Menüs nicht angegeben. Dieser ist aber ein notwendiges Attribut.<br> + Bitte geben Sie ihn an.<br><br>"; + $url = "pxe.php?dn=".$pxeDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr; +} + + + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurü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 diff --git a/ldap-site-mngmt/webinterface/computers/pxe_delete.php b/ldap-site-mngmt/webinterface/computers/pxe_delete.php new file mode 100644 index 00000000..a1b7a060 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/pxe_delete.php @@ -0,0 +1,42 @@ +<?php +include('../standard_header.inc.php'); + +$pxeDN = $_POST['dn']; +$oldpxecn = $_POST['name']; + +$mnr = $_POST['mnr']; +$sbmnr = $_POST['sbmnr']; +$mcnr = $_POST['mcnr']; + +$seconds = 1; +$url = $_POST['successurl']; + +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>"; + +if ( $pxeDN != ""){ + + if ( dive_into_tree_del($pxeDN,"") ){ + $mesg = "PXE Boot Menü <b>".$pxecn."</b> erfolgreich gelöscht!<br><br>"; + } + else{ + $mesg = "Fehler beim löschen des PXE Boot Menüs <b>".$pxecn."</b> !<br><br>"; + } + +} + + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurü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 diff --git a/ldap-site-mngmt/webinterface/dhcp/delete_confirm.php b/ldap-site-mngmt/webinterface/dhcp/delete_confirm.php new file mode 100644 index 00000000..62225afc --- /dev/null +++ b/ldap-site-mngmt/webinterface/dhcp/delete_confirm.php @@ -0,0 +1,37 @@ +<?php +include('../standard_header.inc.php'); + +$dn = $_POST['dn']; +$name = $_POST['name']; +$delurl = $_POST['delurl']; +$backurl = $_POST['backurl']; +$successurl = $_POST['successurl']; + +echo " +<html> +<head> + <title>AU Management</title> + <link rel='stylesheet' href='../styles.css' type='text/css'> +</head> +<body> +<table border='0' cellpadding='30' cellspacing='0'> + <tr> + <td> + Wollen Sie das Objekt <b>".$name."</b> wirklich löschen?<br><br> + <form action='".$delurl."' method='post'> + Falls ja:<br><br> + <input type='hidden' name='dn' value='".$dn."'> + <input type='hidden' name='name' value='".$name."'> + <input type='hidden' name='successurl' value='".$successurl."'> + <input type='Submit' name='apply' value='löschen' class='small_loginform_button'><br><br> + </form> + <form action='".$backurl."' method='post'> + Falls, nein:<br><br> + <input type='Submit' name='apply' value='zurück' class='small_loginform_button'> + </form> + </td> + </tr> +</table> +</body> +</html>"; +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcp.dwt b/ldap-site-mngmt/webinterface/dhcp/dhcp.dwt new file mode 100644 index 00000000..4aadeba5 --- /dev/null +++ b/ldap-site-mngmt/webinterface/dhcp/dhcp.dwt @@ -0,0 +1,78 @@ +<html> + +<head> + <title>{SEITENTITEL}</title> + <link rel='stylesheet' href='../styles.css' type='text/css'></head> +<body> + +<table cellpadding='0' cellspacing='0' border='0' width='95%' height='8%'> + <tr> + <td width='35%'> + <table cellpadding='5' cellspacing='0' border='0' width='100%'> + <tr valign='top'> + <td width='1'></td> + <td><h2>Rechner und IP Management</h2></td> + </tr> + </table> + </td> + + <td width='40%'> + <table cellpadding='5' cellspacing='0' border='0' width='100%'> + <tr valign='top' align='left'> + <td> + <h4><a href='../start.php' class='headerlink'>Startseite</a> + >> <a href='../au/au.php' class='headerlink'>{AU}</a> [ {DOMAIN} ]</h4> + </td> + </tr> + </table> + </td> + <td width='25%'> + <table cellpadding='5' cellspacing='0' border='0' width='100%' align='right'> + <tr valign='top' align='right'> + <td> + {LOGIN} + </td> + </tr> + </table> + </td> + </tr> +</table> +<table cellpadding='5' cellspacing='0' border='0' width='95%' height='7%'> +<tr> + <td>{MAINMENU}</td> +</tr> +</table> + +<hr align='center' width='98%' noshade> + + + +<table cellpadding='5' cellspacing='0' border='0' width='100%' height='85%'> + + <tr valign='top' height='100%'> + <td width='28%'> + <table cellpadding='5' cellspacing='0' border='0' width='100%'> + <tr><td> + + {NAVIGATION} + + </td></tr> + </table> + </td> + + <td width='72%'> + <table cellpadding='5' cellspacing='0' border='0' width='100%'> + <tr><td> + + {HAUPTFENSTER} + + </td></tr> + </table> + </td> + + </tr> +</table> + +</body> + +</html> diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcp.php b/ldap-site-mngmt/webinterface/dhcp/dhcp.php new file mode 100644 index 00000000..d757ba3b --- /dev/null +++ b/ldap-site-mngmt/webinterface/dhcp/dhcp.php @@ -0,0 +1,27 @@ +<?php +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "DHCP Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 5; +$mnr = 0; +$sbmnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "dhcp_start.dwt"; + +include("../class.FastTemplate.php"); + +include('dhcp_header.inc.php'); + +################################################################################### + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createDhcpMenu($rollen, $mnr, $auDN, $sbmnr); + +################################################################################### + +include("dhcp_footer.inc.php"); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcp_footer.inc.php b/ldap-site-mngmt/webinterface/dhcp/dhcp_footer.inc.php new file mode 100644 index 00000000..311721c5 --- /dev/null +++ b/ldap-site-mngmt/webinterface/dhcp/dhcp_footer.inc.php @@ -0,0 +1,18 @@ +<?php + +$template->assign(array("PFAD" => $START_PATH)); + +# Daten in die Vorlage parsen +$template->parse("LOGIN", "Login"); +$template->parse("MAINMENU", "Mmenu"); +$template->parse("NAVIGATION", "Menu"); +$template->parse("HAUPTFENSTER", "Webseite"); +$template->parse("PAGE", "Vorlage"); + +# Fertige Seite an den Browser senden +$template->FastPrint("PAGE"); + +# Abmelden vom LDAP +ldap_unbind($ds); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcp_header.inc.php b/ldap-site-mngmt/webinterface/dhcp/dhcp_header.inc.php new file mode 100644 index 00000000..9eaac019 --- /dev/null +++ b/ldap-site-mngmt/webinterface/dhcp/dhcp_header.inc.php @@ -0,0 +1,21 @@ +<?php +include("dhcp_menu.php"); + +$template = new FastTemplate("."); + +# dem erstellten Template-Objekt eine Vorlage zuweisen +$definedTemplates = array("Vorlage" => "dhcp.dwt", + "Login" => "../logout_form.inc.dwt", + "Mmenu" => "../hauptmenue.dwt", + "Menu" => "menu.dwt", + "Webseite" => $webseite); +if (isset($additionalTemplates)) { + foreach ($additionalTemplates as $templateKey => $templateFile) { + $definedTemplates[$templateKey] = $templateFile; + } +} +$template->define($definedTemplates); + +$template->assign(array("SEITENTITEL" => $titel, "ROLLE" => "mainadmin", "AU" => $au_ou, "DOMAIN" => $assocdom, "USERCN" => $usercn)); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcp_menu.php b/ldap-site-mngmt/webinterface/dhcp/dhcp_menu.php new file mode 100644 index 00000000..423c53c8 --- /dev/null +++ b/ldap-site-mngmt/webinterface/dhcp/dhcp_menu.php @@ -0,0 +1,199 @@ +<?php + +function createDhcpMenu($rollen , $mnr, $auDN, $sbmnr) { + global $template; + global $START_PATH; + + # falls keine kompletten Netze delegiert, dann keine DHCP Service und Subnet Links + if (!( check_if_max_networks() )){ + $hauptmenu = array(array("link" => "no_dhcp.php", + "text" => "Übersicht", + "zugriff" => "alle")); + $submenu = array(array(array())); + }else{ + # DHCP Services (momentan nur für einen DHCP konzipiert) + $dhcpservice_array = get_dhcpservices($auDN,array("dn","cn")); + if (count($dhcpservice_array) == 0){ + $dhcpsvlink = "new_dhcpservice.php?mnr=1"; + } + else { + $dhcpsvlink = "dhcpservice.php?mnr=1"; + } + $dhcpsubnet_array = get_dhcpsubnets($auDN,array("dn","cn")); + + # Struktur der Registerkartenleiste + $hauptmenu = array(array("link" => "dhcp.php", + "text" => "Übersicht", + "zugriff" => "alle"), + array("link" => $dhcpsvlink, + "text" => "DHCP Service", + "zugriff" => array("MainAdmin","DhcpAdmin")), + array("link" => "dhcpsubnets.php?mnr=2", + "text" => "DHCP Subnets", + "zugriff" => array("MainAdmin","DhcpAdmin"))); + + # DHCP Subnets + $subnets = array(); + for ($i=0;$i<count($dhcpsubnet_array);$i++){ + $subnets[] = array("link" => "dhcpsubnet.php?dn=".$dhcpsubnet_array[$i]['dn']."&mnr=2&sbmnr=".$i, + "text" => $dhcpsubnet_array[$i]['cn'], + "zugriff" => array("MainAdmin","DhcpAdmin")); + } + + # falls komplette Netze verfügbar, link zum Neuanlegen + if ( check_if_free_networks() ){ + $subnets[] = array("link" => "new_dhcpsubnet.php?mnr=2&sbmnr=".$i, + "text" => "Neues DHCP Subnet", + "zugriff" => array("MainAdmin","DhcpAdmin")); + } + $submenu = array(array(), + array(), + $subnets); + + } + # $rollen = array_keys($roles); + + # Zusammenstellen der Menuleiste + $template->define_dynamic("Hauptmenu", "Menu"); + $template->define_dynamic("Submenu", "Menu"); + $i=0; + $maxmenu = count($hauptmenu); + + foreach($hauptmenu as $item) { + $template->clear_parse("SUBMENU_LIST"); + if($item['zugriff'] === "alle" || vergleicheArrays($rollen , $item['zugriff'])) { + + $subempty = 0; + $j=0; + $maxsub = count($submenu[$mnr]); + if($maxsub > 0){ + foreach($submenu[$mnr] as $item2) { + + if($item2['zugriff'] === "alle" || vergleicheArrays($rollen, $item2['zugriff'])) { + if($i != $mnr){ + $template->assign(array("SUB" => "")); + # "LINK_S" => "", + # "TEXT_S" => "")); + $template->parse("SUBMENU_LIST", ".Submenu"); + $template->clear_dynamic("Submenu"); + } + else{ + if ($j==0) { + if ($sbmnr==0) { + if($maxsub == 1){$zwisch="branchbottom2";} + else {$zwisch="branch2";} + $lastaktive=true; + $farb="#505050"; + } + else{ + if($maxsub == 1){$zwisch="branchbottom2";} + else {$zwisch="branch2";} + $farb="#A0A0A0"; + $lastaktive=false; + } + } + else { + if ($sbmnr==$j) { + if($maxsub == $j+1){$zwisch="branchbottom2";} + else {$zwisch="branch2";} + $lastaktive=true; + $farb="#505050"; + } + else { + $farb="#A0A0A0"; + if($maxsub == $j+1){$zwisch="branchbottom2";} + else {$zwisch="branch2";} + # if ($lastaktive) {$zwisch="branch";} + # else {$zwisch="branch";} + $lastaktive=false; + } + } + $htmlcode= " + <tr height='4'> + <td></td><td align='right'><img src='../pics/line2.gif' height='4'></td><td></td><td></td> + </tr> + <tr> + <td width='8%'> </td> + <td width='8%' align='right'><img src='../pics/".$zwisch.".gif'></td>
+ <td width='74%' align='left' style='border-width:1 1 1 1;border-color:#000000;border-style:solid;padding:2;padding-left:30px;background-color:{FARBE_S}'> + <a href='".$item2['link']."' style='text-decoration:none'><b class='standard_schrift'>".$item2['text']."</b></a></td> + <td width='10%'> </td> + </tr> + "; + $template->assign(array("SUB" => $htmlcode)); + $template->assign(array("FARBE_S" => $farb)); + $template->parse("SUBMENU_LIST", ".Submenu"); + $template->clear_dynamic("Submenu"); + } + } + else { + $subempty++; + } + $j=$j+1; + } + } + if($subempty == count($submenu[$mnr])) { + $template->assign(array("SUB" => "")); + # "LINK_S" => "", + # "TEXT_S" => "")); + $template->parse("SUBMENU_LIST", ".Submenu"); + $template->clear_dynamic("Submenu"); + } + + # weiter im Hauptmenü + if ($i==0) { + if ($mnr==0) { + if(count($submenu[$i][0]) != 0){ + if($maxmenu == 1){$zwisch="";} # {$zwisch="<img style='border-width:0;border-style=none;' src='../pics/minus2.gif'>";} + else {$zwisch="";} + }else{$zwisch="";} + $lastaktive=true; + $farb="#505050"; + } + else{ + if(count($submenu[$i][0]) != 0){ + if($maxmenu == 1){$zwisch="<a href='{LINK_M}' style='border-style=none;text-decoration:none'> + <img style='border-width:0;border-style=none;' src='../pics/plus2.gif'></a>";} + else {$zwisch="<a href='{LINK_M}' style='border-style=none;text-decoration:none'> + <img style='border-width:0;border-style=none;' src='../pics/plus2.gif'></a>";} + }else{$zwisch="";} + $farb="#A0A0A0"; + $lastaktive=false; + } + } + else { + if ($mnr==$i) { + if(count($submenu[$mnr][0]) != 0){ + if($maxmenu == $i+1){$zwisch="";} + else {$zwisch="";} + }else{$zwisch="";} + $lastaktive=true; + $farb="#505050"; + } + else { + $farb="#A0A0A0"; + if(count($submenu[$i][0]) != 0){ + if($maxmenu == $i+1){$zwisch="<a href='{LINK_M}' style='border-style=none;text-decoration:none'> + <img style='border-width:0;border-style=none;' src='../pics/plus2.gif'></a>";} + else {$zwisch="<a href='{LINK_M}' style='border-style=none;text-decoration:none'> + <img style='border-width:0;border-style=none;' src='../pics/plus2.gif'></a>";} + }else{$zwisch="";} + #if ($lastaktive) {$zwisch="";} + #else {$zwisch="";} + $lastaktive=false; + } + } + $template->assign(array("ICON" => $zwisch, + "FARBE" => $farb, + "LINK_M" => $item["link"], + "TEXT_M" => $item["text"])); + $template->parse("HAUPTMENU_LIST", ".Hauptmenu"); + $template->clear_dynamic("Hauptmenu"); + } + $i=$i+1; + } + if ($lastaktive) {$template->assign(array("ENDE" => ""));} + else {$template->assign(array("ENDE" => ""));} +} + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcp_start.dwt b/ldap-site-mngmt/webinterface/dhcp/dhcp_start.dwt new file mode 100644 index 00000000..2e1c0f02 --- /dev/null +++ b/ldap-site-mngmt/webinterface/dhcp/dhcp_start.dwt @@ -0,0 +1,27 @@ +<table border='0' cellpadding='5' cellspacing='0' width='90%'> + <tr> + <td colspan='2'><h3>Modul - DHCP Management: </h3></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr> + <td> + <p>Dieses Modul dient der Verwaltung eines DHCP Dienstes und DHCP Subnets, Classes <br> + Benutzen Sie die Navigation links, um die einzelnen Verwaltungsbereiche anzusteuern:</p> + <ul> + <li><p><b>DHCP Service</b></p> + ... + </li> + <li><p><b>DHCP Subnets</b></p> + ... + </li> + <li><p><b>DHCP Classes</b></p> + ... + </li> + </ul> + + </td> + </tr> + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcpservice.dwt b/ldap-site-mngmt/webinterface/dhcp/dhcpservice.dwt new file mode 100644 index 00000000..2bfd0631 --- /dev/null +++ b/ldap-site-mngmt/webinterface/dhcp/dhcpservice.dwt @@ -0,0 +1,257 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='2'><h3>DHCP Service <code class='font_object'> {CN} </code> </h3></td> + </tr> + <tr> + <td height='20'></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <form action='dhcpservice_change.php' method='post'> + + <tr> + <td width='40%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='60%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Eindeutiger DHCP Service Name (cn):</b><br>(Teil des dn, ohne Leerzeichen eingeben) </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <font size='+2'><b>DHCP_</b></font><input type='Text' name='cn' value='{CN}' size='40' class='medium_form_field'> + <input type='hidden' name='oldcn' value='{CN}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Beschreibung:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[description]' value='{DESCRIPTION}' size='50' class='medium_form_field'> + <input type='hidden' name='oldattribs[description]' value='{DESCRIPTION}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'><b>Dienst kann momentan genutzt werden von:</b><br></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'>Abteilung<b> {DHCPOFFERNOW}</b> (und allen Unterabteilungen) + </td> + </tr> + <tr height='50' valign='top'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Ändern:</b><br>(Wählen Sie eine andere Abteilung)</td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <select name='dhcpoffer' size='5' class='medium_form_selectbox'> + <option selected value='none'>----------</option> + + <!-- BEGIN DYNAMIC BLOCK: Dhcpoffers --> + <option value='{DHCPOFFER}'>{DHCPOFFEROU}</option> + <!-- END DYNAMIC BLOCK: Dhcpoffers --> + + <option value='off'>------ NIEMAND ------</option> + + </select> + <input type='hidden' name='olddhcpoffer' value='{DHCPOFFERNOWDN}'> + </td> + </tr> + <!-- <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>PRIMARY DN:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[primary]' value='{PRIMARY}' size='50' class='medium_form_field'> + <input type='hidden' name='oldattribs[primary]' value='{PRIMARY}'> + </td> + </tr> --> + + </table></td> + </tr> + + <tr> + <td height='40'></td> + </tr> + <tr> + <td colspan='2'><h4>DHCP Optionen des Dienstes (Globaler Scope):</h4></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <tr valign='top'> + <td width='40%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Option</b></td> + <td width='60%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert(e)</b></td> + </tr> + + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Server Identifier:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[dhcpoptserver-identifier]' value='{SRVIDENT}' size='40' class='medium_form_field'> + <input type='hidden' name='oldattribs[dhcpoptserver-identifier]' value='{SRVIDENT}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Default Lease Time:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[dhcpoptdefault-lease-time]' value='{DEFAULTLEASE}' size='40' class='medium_form_field'> + <input type='hidden' name='oldattribs[dhcpoptdefault-lease-time]' value='{DEFAULTLEASE}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Max Lease Time:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[dhcpoptmax-lease-time]' value='{MAXLEASE}' size='40' class='medium_form_field'> + <input type='hidden' name='oldattribs[dhcpoptmax-lease-time]' value='{MAXLEASE}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Use Host DCL Names:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[dhcpoptuse-host-decl-names]' value='{USEHOSTDCL}' size='40' class='medium_form_field'> + <input type='hidden' name='oldattribs[dhcpoptuse-host-decl-names]' value='{USEHOSTDCL}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>DHCP Max Message Size:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[dhcpoptdhcp-max-message-size]' value='{MAXMESSIZE}' size='40' class='medium_form_field'> + <input type='hidden' name='oldattribs[dhcpoptdhcp-max-message-size]' value='{MAXMESSIZE}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>DDNS Update Style:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[dhcpoptddns-update-style]' value='{DDNSUPDATE}' size='40' class='medium_form_field'> + <input type='hidden' name='oldattribs[dhcpoptddns-update-style]' value='{DDNSUPDATE}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Domain Name:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[dhcpoptdomain-name]' value='{DOMAINNAME}' size='40' class='medium_form_field'> + <input type='hidden' name='oldattribs[dhcpoptdomain-name]' value='{DOMAINNAME}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Domain Name Servers:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[dhcpoptdomain-name-servers]' value='{DOMAINNAMESERVERS}' size='40' class='medium_form_field'> + <input type='hidden' name='oldattribs[dhcpoptdomain-name-servers]' value='{DOMAINNAMESERVERS}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>NTP Servers:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[dhcpoptntp-servers]' value='{NTPSERVERS}' size='40' class='medium_form_field'> + <input type='hidden' name='oldattribs[dhcpoptntp-servers]' value='{NTPSERVERS}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Allow:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[dhcpoptallow]' value='{ALLOW}' size='40' class='medium_form_field'> + <input type='hidden' name='oldattribs[dhcpoptallow]' value='{ALLOW}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Deny:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[dhcpoptdeny]' value='{DENY}' size='40' class='medium_form_field'> + <input type='hidden' name='oldattribs[dhcpoptdeny]' value='{DENY}'> + </td> + </tr> + + <input type='hidden' name='dhcpdn' value='{DHCPDN}'> + <input type='hidden' name='mnr' value='{MNR}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + + </table></td> + </tr> + <tr> + <td><input type='Submit' name='apply' value='anwenden' class='small_loginform_button'> + </form></td> + </tr> + + <tr> + <td height='40'></td> + </tr> + <tr> + <td colspan='2'><h4>Dem Dienst zugeordnete DHCP Subnets:</h4></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <tr valign='top'> + <td width='25%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Subnet</b></td> + <td width='25%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Netmask</b></td> + <td width='50%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Abteilung (AU)</b></td> + </tr> + <!-- BEGIN DYNAMIC BLOCK: Dhcpsubnets --> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>{SUBNET} </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>{NETMASK} </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>{SUBNETAU} </td> + </tr> + <!-- END DYNAMIC BLOCK: Dhcpsubnets --> + + </table></td> + </tr> + + <tr> + <td height='50'></td> + </tr> + <tr> + <td colspan='2'><h3>Config File für DHCP Generator Script</h3></td> + </tr> + <tr> + <td colspan='2'>Speichern Sie dieses als <b>dhcpgen.conf.pl</b> im gleichen Verzeichnis wie ihr DHCP Dienst Generator Skript <b>dhcp_generator.pl</b></td> + </tr> + <tr> + <td> + <table cellpadding='20' cellspacing='0' border='0' align='left' width='90%' style='border-color: black; border-style: solid; border-width: 2 2 2 2;'> + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + $ldaphost= "{DHCPGENLDAP}"; <br> + $basedn= "{DHCPGENBASE}"; <br> + $userdn= "{DHCPGENUDN}"; <br> + $passwd= "{DHCPGENPW}"; <br> + $dhcpservicedn= "{DHCPGENSVDN}"; + </td> + </tr> + + + </table></td> + </tr> + + + + <tr> + <td height='60'></td> + </tr> + + <tr> + <td colspan='2'><h4>DHCP Service <code class='font_object'>{CN}</code> löschen:</h4></td> + </tr> + <tr> + <td> + <table cellpadding='7' cellspacing='0' border='0' align='left' width='90%' style='border-width: 0 0 0 0;'> + <form action='delete_confirm.php' method='post'> + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + Der DHCP Dienst wird gelöscht, <br> + </tr> + + <input type='hidden' name='dn' value='{DHCPDN}'> + <input type='hidden' name='name' value='{CN}'> + <input type='hidden' name='type' value='dhcp'> + <input type='hidden' name='delurl' value='dhcpservice_delete.php'> + <input type='hidden' name='backurl' value='dhcpservice.php?dn={DHCPDN}&mnr={MNR}'> + </table></td> + </tr> + <tr> + <td> + <input type='Submit' name='apply' value='löschen' class='small_loginform_button'> + </form></td> + </tr> + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcpservice.php b/ldap-site-mngmt/webinterface/dhcp/dhcpservice.php new file mode 100644 index 00000000..59d77bbe --- /dev/null +++ b/ldap-site-mngmt/webinterface/dhcp/dhcpservice.php @@ -0,0 +1,164 @@ +<?php +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "DHCP Service Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 5; +$mnr = 0; +$sbmnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "dhcpservice.dwt"; + +include("../class.FastTemplate.php"); + +include('dhcp_header.inc.php'); + +################################################################################### + +$mnr = $_GET['mnr']; + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createDhcpMenu($rollen, $mnr, $auDN, $sbmnr); + +################################################################################### + +$template->assign(array("DHCPDN" => "", + "CN" => "", + "PRIMARY" => "", + "SECONDARY" => "", + "DESCRIPTION" => "", + "STATEMENTS" => "", + "ALLOW" => "", + "DENY" => "", + "IGNORE" => "", + "DDNSUPDATE" => "", + "DEFAULTLEASE" => "", + "MAXLEASE" => "", + "USEHOSTDCL" => "", + "DOMAINNAME" => "", + "DOMAINNAMESERVERS" => "", + "MAXMESSIZE" => "", + "SRVIDENT" => "", + "NTPSERVERS" => "", + "OPTGENERIC" => "", + "DHCPOFFERNOWDN" => "", + "DHCPOFFERNOW" => "")); + +# DHCP Service Daten +$dhcpsv_array = get_dhcpservices($auDN,array("dn","cn")); +$dhcpserviceDN = $dhcpsv_array[0]['dn']; +$attributes = array("dn","cn","dhcpprimarydn","dhcpsecondarydn","description","dhcpofferdn","dhcpstatements","dhcpoptallow", + "dhcpoptddns-update-style","dhcpoptdefault-lease-time","dhcpoptdeny","dhcpoptfilename", + "dhcpoptignore","dhcpoptmax-lease-time","dhcpoptnext-server","dhcpoptserver-identifier", + "dhcpoptuse-host-decl-names","dhcpoptbroadcast-address","dhcpoptdhcp-max-message-size", + "dhcpoptdomain-name","dhcpoptdomain-name-servers","dhcpoptgeneric","dhcpoptntp-servers", + "dhcpoptroot-path","dhcpoptrouters"); +$dhcpsv_data = get_node_data($dhcpserviceDN, $attributes); +#print_r($dhcpsv_data); + +# RBS Anbieten +# momentanes Offer +# todo: falls dhcpofferDN leer dann standardwert AU teilbaum +$offerexp = ldap_explode_dn($dhcpsv_data['dhcpofferdn'], 1); +$dhcpoffernow = $offerexp[0]; +# alternative Offers +$expdn = ldap_explode_dn($auDN, 0); # Mit Merkmalen +$expdn = array_slice($expdn, 1); +$expou = ldap_explode_dn($auDN, 1); # nur Werte +$expou = array_slice($expou, 1, -3); +#print_r($expou); echo "<br>"; +#print_r($expdn); echo "<br>"; +for ($i=0; $i<count($expou); $i++){ + $dhcpoffers[$i]['ou'] = $expou[$i]; + $dhcpoffers[$i]['dn'] = implode(',',$expdn); + $expdn = array_slice($expdn, 1); +} +#print_r($dhcpoffers); + +$expcn = explode('_',$dhcpsv_data['cn']); +$name = array_slice($expcn,1); +$dhcpcn = implode('_',$name); + + +$template->assign(array("DHCPDN" => $dhcpsv_data['dn'], + "CN" => $dhcpcn, + "PRIMARY" => $dhcpsv_data['dhcpprimarydn'], + "SECONDARY" => $dhcpsv_data['dhcpsecondarydn'], + "DESCRIPTION" => $dhcpsv_data['description'], + "STATEMENTS" => $dhcpsv_data['dhcpstatements'], + "ALLOW" => $dhcpsv_data['dhcpoptallow'], + "DENY" => $dhcpsv_data['dhcpoptdeny'], + "IGNORE" => $dhcpsv_data['dhcpoptignore'], + "DDNSUPDATE" => $dhcpsv_data['dhcpoptddns-update-style'], + "DEFAULTLEASE" => $dhcpsv_data['dhcpoptdefault-lease-time'], + "MAXLEASE" => $dhcpsv_data['dhcpoptmax-lease-time'], + "USEHOSTDCL" => $dhcpsv_data['dhcpoptuse-host-decl-names'], + "MAXMESSIZE" => $dhcpsv_data['dhcpoptdhcp-max-message-size'], + "DOMAINNAME" => $dhcpsv_data['dhcpoptdomain-name'], + "DOMAINNAMESERVERS" => $dhcpsv_data['dhcpoptdomain-name-servers'], + "NEXTSERVER" => $dhcpsv_data['dhcpoptnext-server'], + "FILENAME" => $dhcpsv_data['dhcpoptfilename'], + "SRVIDENT" => $dhcpsv_data['dhcpoptserver-identifier'], + "NTPSERVERS" => $dhcpsv_data['dhcpoptntp-servers'], + "OPTGENERIC" => $dhcpsv_data['dhcpoptgeneric'], + "DHCPOFFERNOWDN" => $dhcpsv_data['dhcpofferdn'], + "DHCPOFFERNOW" => $dhcpoffernow, + "MNR" => $mnr, + "SBMNR" => $sbmnr)); + +$template->define_dynamic("Dhcpoffers", "Webseite"); +foreach ($dhcpoffers as $offer){ + $template->assign(array("DHCPOFFER" => $offer['dn'], + "DHCPOFFEROU" => $offer['ou'],)); + $template->parse("DHCPOFFERS_LIST", ".Dhcpoffers"); +} + +# Subnetze und Hosts des Dienstes +$dhcpobjects = get_service_subnets($dhcpserviceDN, array("dn","cn","dhcpoptnetmask")); +#print_r($dhcpobjects); +$template->define_dynamic("Dhcpsubnets", "Webseite"); +foreach ($dhcpobjects as $subnet){ + $template->assign(array("SUBNET" => $subnet['cn'], + "NETMASK" => $subnet['dhcpoptnetmask'], + "SUBNETAU" => $subnet['auDN'])); + $template->parse("DHCPSUBNETS_LIST", ".Dhcpsubnets"); +} + +### Rechner +#$hostorgroup = $exp[0]; +#$hosts_array = get_hosts($auDN,array("dn","hostname","ipaddress")); +# +#$template->define_dynamic("TftpHosts", "Webseite"); +#$template->define_dynamic("NfsHosts", "Webseite"); +#$template->define_dynamic("NbdHosts", "Webseite"); +#foreach ($hosts_array as $item){ +# $template->assign(array("HDN" => $item['dn'], +# "HN" => $item['hostname'], +# "IP" => $item['ipaddress'])); +# $template->parse("TFTPHOSTS_LIST", ".TftpHosts"); +# $template->assign(array("HDN" => $item['dn'], +# "HN" => $item['hostname'], +# "IP" => $item['ipaddress'])); +# $template->parse("NFSHOSTS_LIST", ".NfsHosts"); +# $template->assign(array("HDN" => $item['dn'], +# "HN" => $item['hostname'], +# "IP" => $item['ipaddress'])); +# $template->parse("NBDHOSTS_LIST", ".NbdHosts"); +#} + +################################################ +# DHCP Generator Skript Config +$template->assign(array("DHCPGENLDAP" => "ldap://".LDAP_HOST, + "DHCPGENBASE" => "ou=RIPM,".$suffix, + "DHCPGENUDN" => $userDN, + "DHCPGENPW" => $userPassword, + "DHCPGENSVDN" => $dhcpserviceDN)); + + +################################################################################### + +include("dhcp_footer.inc.php"); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcpservice_add.php b/ldap-site-mngmt/webinterface/dhcp/dhcpservice_add.php new file mode 100644 index 00000000..bcb5899e --- /dev/null +++ b/ldap-site-mngmt/webinterface/dhcp/dhcpservice_add.php @@ -0,0 +1,70 @@ +<?php +include('../standard_header.inc.php'); + +$cn = $_POST['cn']; +$dhcpoffer = $_POST['dhcpoffer']; + +# 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>"; + +$nodeDN = "cn=dhcp,".$auDN; +$mnr = $_POST['mnr']; +$sbmnr = $_POST['sbmnr']; +$mcnr = $_POST['mcnr']; + +$get_dhcpcn = str_replace ( " ", "_", $cn ); +$seconds = 200; +$url = "new_dhcpservice.php?&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>"; + +if ( $cn != "" && $cn != "Hier_DHCP_NAME_eintragen" ){ + + $dhcpcn = "DHCP_".$cn; + + # Formulareingaben anpassen + $exp = explode(" ",$dhcpcn); + foreach ($exp as $word){$expuc[] = ucfirst($word);} + $dhcpcn = implode(" ",$expuc); + $dhcpcn = preg_replace ( '/\s+([0-9A-Z])/', '$1', $dhcpcn); + + #$dhcpDN = "cn=".$dhcpcn.",".$nodeDN; + #print_r($dhcpDN); echo "<br><br>"; + + if (add_dhcpservice ($dhcpcn,$dhcpoffer,$atts)){ + $mesg .= "<br>DHCP Service erfolgreich angelegt<br>"; + $url = "dhcpservice.php?mnr=1"; + }else{ + $mesg .= "<br>Fehler beim anlegen des DHCP Services!<br>"; + } +} + +elseif ( $cn == "" || $cn == "Hier_DHCP_NAME_eintragen" ){ + + $mesg = "Sie haben den Namen des neuen DHCP Service nicht angegeben. Dieser ist + aber ein notwendiges Attribut.<br> + Bitte geben Sie ihn an.<br><br>"; + $url = "new_dhcpservice.php?dhcpcn=Hier_DHCP_NAME_eintragen&mnr=1"; +} + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurü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 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ändert<br><br>"; + }else{ + $mesg = "Fehler beim ä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öschen<br><br>"; + echo "Wollen Sie den DHCP Service <b>".$oldcn."</b> wirklich lö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öschen' class='small_loginform_button'><br><br> + </form> + <form action='".$url."' method='post'> + Falls, nein:<br><br> + <input type='Submit' name='apply' value='zurü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ählt<br> + Keine Änderung!"; + } + + if ( $dhcpoffer != "off" && $dhcpoffer != $olddhcpoffer ){ + $entryoffer ['dhcpofferdn'] = $dhcpoffer; + if(ldap_mod_replace($ds,$dhcpDN,$entryoffer)){ + $mesg = "DHCP Service Offer erfolgreich geändert<br><br>"; + } + else{ + $mesg = "Fehler beim ä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ändert<br><br>"; + } + else{ + $mesg = "Fehler beim ä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 "ä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ö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ü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 diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcpservice_delete.php b/ldap-site-mngmt/webinterface/dhcp/dhcpservice_delete.php new file mode 100644 index 00000000..36260cd1 --- /dev/null +++ b/ldap-site-mngmt/webinterface/dhcp/dhcpservice_delete.php @@ -0,0 +1,37 @@ +<?php +include('../standard_header.inc.php'); + +$dhcpDN = $_POST['dn']; +$dhcpcn = $_POST['name']; + +$seconds = 100; +$url = "dhcpservice.php?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>"; + +if ( $dhcpDN != ""){ + if ( dive_into_tree_del($dhcpDN,"") ){ + cleanup_del_dhcpservice($dhcpDN); + $mesg = "DHCP Service <b>".$dhcpcn."</b> erfolgreich gelöscht!<br><br>"; + } + else{ + $mesg = "Fehler beim löschen des DHCP Services <b>".$dhcpcn."</b> !<br><br>"; + } +} + + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurü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 diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet.dwt b/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet.dwt new file mode 100644 index 00000000..394b63fc --- /dev/null +++ b/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet.dwt @@ -0,0 +1,207 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='2'><h3>DHCP Subnet <code class='font_object'> {CN} </code> </h3></td> + </tr> + <tr> + <td height='20'></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <form action='dhcpsubnet_change.php' method='post'> + + <tr> + <td width='40%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='60%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>DHCP Subnet (cn):</b><br>(Teil des dn, ohne Leerzeichen eingeben) </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='cn' value='{CN}' size='15' maxlength='15' class='medium_form_field'> + <input type='hidden' name='oldcn' value='{CN}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Netmask:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='netmask' value='{NETMASK}' size='15' maxlength='15' class='medium_form_field'> + <input type='hidden' name='oldnetmask' value='{NETMASK}'> + </td> + </tr> + <tr valign='top'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'><b>Eingebunden in DHCP Dienst: <b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'>Service <b>{DHCPSVNOW}</b> / AU <b>{DHCPSVNOWAU}</b> + </td> + </tr> + <tr height='50' valign='top'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>DHCP Dienst ändern:</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <select name='dhcpservice' size='5' class='medium_form_selectbox'> + <option selected value='none'>----------</option> + + <!-- BEGIN DYNAMIC BLOCK: Dhcpservices --> + <option value='{DHCPSVDN}'>{DHCPSVCN}{DHCPSVAU}</option> + <!-- END DYNAMIC BLOCK: Dhcpservices --> + + <option value='off'>-- keine DHCP Dienstzurordnung --</option> + + </select> + <input type='hidden' name='olddhcpservice' value='{DHCPOFFERNOWDN}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Beschreibung:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[description]' value='{DESCRIPTION}' size='50' class='medium_form_field'> + <input type='hidden' name='oldattribs[description]' value='{DESCRIPTION}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>IP Range:</b><br>(Zur dynamischen Vergabe)</td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='range1' value='{RANGE1}' size='15' maxlength='15' class='medium_form_field'> + - + <input type='Text' name='range2' value='{RANGE2}' size='15' maxlength='15' class='medium_form_field'> + <input type='hidden' name='oldrange1' value='{RANGE1}'> + <input type='hidden' name='oldrange2' value='{RANGE2}'> + </td> + </tr> + + </table></td> + </tr> + + <tr> + <td height='40'></td> + </tr> + <tr> + <td colspan='2'><h4>DHCP Optionen des Subnets (Subnet Scope):</h4></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <tr valign='top'> + <td width='40%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Option</b></td> + <td width='60%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert(e)</b></td> + </tr> + + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Default Lease Time:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[dhcpoptdefault-lease-time]' value='{DEFAULTLEASE}' size='40' class='medium_form_field'> + <input type='hidden' name='oldattribs[dhcpoptdefault-lease-time]' value='{DEFAULTLEASE}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Max Lease Time:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[dhcpoptmax-lease-time]' value='{MAXLEASE}' size='40' class='medium_form_field'> + <input type='hidden' name='oldattribs[dhcpoptmax-lease-time]' value='{MAXLEASE}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>DDNS Update Style:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[dhcpoptddns-update-style]' value='{DDNSUPDATE}' size='40' class='medium_form_field'> + <input type='hidden' name='oldattribs[dhcpoptddns-update-style]' value='{DDNSUPDATE}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Domain Name:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[dhcpoptdomain-name]' value='{DOMAINNAME}' size='40' class='medium_form_field'> + <input type='hidden' name='oldattribs[dhcpoptdomain-name]' value='{DOMAINNAME}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Domain Name Servers:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[dhcpoptdomain-name-servers]' value='{DOMAINNAMESERVERS}' size='40' class='medium_form_field'> + <input type='hidden' name='oldattribs[dhcpoptdomain-name-servers]' value='{DOMAINNAMESERVERS}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Routers:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[dhcpoptrouters]' value='{ROUTERS}' size='40' class='medium_form_field'> + <input type='hidden' name='oldattribs[dhcpoptrouters]' value='{ROUTERS}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Broadcast Address:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[dhcpoptbroadcast-address]' value='{BROADCAST}' size='40' class='medium_form_field'> + <input type='hidden' name='oldattribs[dhcpoptbroadcast-address]' value='{BROADCAST}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>NTP Servers:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[dhcpoptntp-servers]' value='{NTPSERVERS}' size='40' class='medium_form_field'> + <input type='hidden' name='oldattribs[dhcpoptntp-servers]' value='{NTPSERVERS}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Next Server:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[dhcpoptnext-server]' value='{NEXTSERVER}' size='40' class='medium_form_field'> + <input type='hidden' name='oldattribs[dhcpoptnext-server]' value='{NEXTSERVER}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Filename:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[dhcpoptfilename]' value='{FILENAME}' size='40' class='medium_form_field'> + <input type='hidden' name='oldattribs[dhcpoptfilename]' value='{FILENAME}'> + </td> + </tr> + + <input type='hidden' name='subnetdn' value='{SUBNETDN}'> + <input type='hidden' name='mnr' value='{MNR}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + + </table></td> + </tr> + <tr> + <td><input type='Submit' name='apply' value='anwenden' class='small_loginform_button'> + </form></td> + </tr> + + + <tr> + <td height='60'></td> + </tr> + + <tr> + <td colspan='2'><h4>DHCP Subnet <code class='font_object'>{CN}</code> löschen:</h4></td> + </tr> + <tr> + <td> + <table cellpadding='7' cellspacing='0' border='0' align='left' width='90%' style='border-width: 0 0 0 0;'> + <form action='delete_confirm.php' method='post'> + + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + Das DHCP Subnet wird gelöscht, <br> + </tr> + + <input type='hidden' name='dn' value='{SUBNETDN}'> + <input type='hidden' name='name' value='{CN}'> + <input type='hidden' name='type' value='dhcp'> + <input type='hidden' name='delurl' value='dhcpsubnet_delete.php'> + <input type='hidden' name='backurl' value='dhcpsubnet.php?dn={SUBNETDN}&mnr={MNR}&sbmnr{SBMNR}'> + + </table></td> + </tr> + <tr> + <td> + <input type='Submit' name='apply' value='löschen' class='small_loginform_button'> + </form></td> + </tr> + + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet.php b/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet.php new file mode 100644 index 00000000..235667aa --- /dev/null +++ b/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet.php @@ -0,0 +1,126 @@ +<?php +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "DHCP Service Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 5; +$mnr = 0; +$sbmnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "dhcpsubnet.dwt"; + +include("../class.FastTemplate.php"); + +include('dhcp_header.inc.php'); + +################################################################################### + +$mnr = $_GET['mnr']; +$sbmnr = $_GET['sbmnr']; + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createDhcpMenu($rollen, $mnr, $auDN, $sbmnr); + +################################################################################### + +$template->assign(array("SUBNETDN" => "", + "CN" => "", + "NETMASK" => "", + "RANGE1" => "", + "RANGE2" => "", + "DESCRIPTION" => "", + "STATEMENTS" => "", + "ALLOW" => "", + "DENY" => "", + "IGNORE" => "", + "DDNSUPDATE" => "", + "DEFAULTLEASE" => "", + "MAXLEASE" => "", + "USEHOSTDCL" => "", + "BROADCAST" => "", + "ROUTERS" => "", + "DOMAINNAME" => "", + "DOMAINNAMESERVERS" => "", + "NEXTSERVER" => "", + "FILENAME" => "", + "SRVIDENT" => "", + "NTPSERVERS" => "", + "OPTGENERIC" => "", + "DHCPOFFERNOWDN" => "", + "DHCPSVNOW" => "", + "DHCPSVNOWAU" => "", + "MNR" => $mnr, + "SBMNR" => $sbmnr, + "MCNR" => $mcnr)); + +# DHCP Subnet Daten +$dhcpsubnetDN = $_GET['dn']; +$attributes = array("dn","cn","dhcpoptnetmask","dhcphlpcont","dhcprange","description","dhcpstatements","dhcpoptallow", + "dhcpoptddns-update-style","dhcpoptdefault-lease-time","dhcpoptdeny","dhcpoptfilename", + "dhcpoptignore","dhcpoptmax-lease-time","dhcpoptnext-server","dhcpoptserver-identifier", + "dhcpoptuse-host-decl-names","dhcpoptbroadcast-address","dhcpoptdhcp-max-message-size", + "dhcpoptdomain-name","dhcpoptdomain-name-servers","dhcpoptgeneric","dhcpoptntp-servers", + "dhcpoptroot-path","dhcpoptrouters"); +$subnet_data = get_node_data($dhcpsubnetDN, $attributes); +#print_r($subnet_data); + +# momentane DHCP Service Zuordnung +$dhcpsvnowdn = ldap_explode_dn($subnet_data['dhcphlpcont'], 1); + +# DHCP Range +$iprange = explode('_',$subnet_data['dhcprange']); + +$template->assign(array("SUBNETDN" => $dhcpsubnetDN, + "CN" => $subnet_data['cn'], + "NETMASK" => $subnet_data['dhcpoptnetmask'], + "RANGE1" => $iprange[0], + "RANGE2" => $iprange[1], + "DESCRIPTION" => $subnet_data['description'], + "STATEMENTS" => $subnet_data['dhcpstatements'], + "ALLOW" => $subnet_data['dhcpoptallow'], + "DENY" => $subnet_data['dhcpoptdeny'], + "IGNORE" => $subnet_data['dhcpoptignore'], + "DDNSUPDATE" => $subnet_data['dhcpoptddns-update-style'], + "DEFAULTLEASE" => $subnet_data['dhcpoptdefault-lease-time'], + "MAXLEASE" => $subnet_data['dhcpoptmax-lease-time'], + "USEHOSTDCL" => $subnet_data['dhcpoptuse-host-decl-names'], + "BROADCAST" => $subnet_data['dhcpoptbroadcast-address'], + "ROUTERS" => $subnet_data['dhcpoptrouters'], + "DOMAINNAME" => $subnet_data['dhcpoptdomain-name'], + "DOMAINNAMESERVERS" => $subnet_data['dhcpoptdomain-name-servers'], + "NEXTSERVER" => $subnet_data['dhcpoptnext-server'], + "FILENAME" => $subnet_data['dhcpoptfilename'], + "SRVIDENT" => $subnet_data['dhcpoptserver-identifier'], + "NTPSERVERS" => $subnet_data['dhcpoptntp-servers'], + "OPTGENERIC" => $subnet_data['dhcpoptgeneric'], + "DHCPOFFERNOWDN" => $subnet_data['dhcphlpcont'], + "DHCPSVNOW" => $dhcpsvnowdn[0], + "DHCPSVNOWAU" => $dhcpsvnowdn[2], + "MNR" => $mnr, + "SBMNR" => $sbmnr, + "MCNR" => $mcnr)); + + +# alternative DHCP Services +$altdhcp = alternative_dhcpservices($subnet_data['dhcphlpcont']); + +$template->assign(array("DHCPSVDN" => "", + "DHCPSVCN" => "", + "DHCPSVAU" => "")); +if (count($altdhcp) != 0){ +$template->define_dynamic("Dhcpservices", "Webseite"); + foreach ($altdhcp as $item){ + $template->assign(array("DHCPSVDN" => $item['dn'], + "DHCPSVCN" => $item['cn'], + "DHCPSVAU" => $item['au'])); + $template->parse("DHCPSERVICES_LIST", ".Dhcpservices"); + } +} + +################################################################################### + +include("dhcp_footer.inc.php"); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet_add.php b/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet_add.php new file mode 100644 index 00000000..6939afe0 --- /dev/null +++ b/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet_add.php @@ -0,0 +1,71 @@ +<?php +include('../standard_header.inc.php'); + +$syntax = new Syntaxcheck; + +$cn = $_POST['cn']; +$netmask = $_POST['netmask']; +$dhcpservice = $_POST['dhcpservice']; +$range1 = $_POST['range1']; +$range2 = $_POST['range2']; + +# 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>"; + +$nodeDN = "cn=dhcp,".$auDN; +$mnr = $_POST['mnr']; +$sbmnr = $_POST['sbmnr']; + +$get_dhcpcn = str_replace ( " ", "_", $cn ); +$seconds = 200; +$url = "new_dhcpsubnet.php?&mnr=2"; + +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>"; + +if ( $cn != "" && $cn != "Hier_Subnetz_eintragen" && $netmask != "" && $netmask != "Hier_Netzmaske_eintragen" ){ + + if ( $syntax->check_netip_syntax($cn) && $syntax->check_ip_syntax($netmask) ){ + + if (add_dhcpsubnet ($cn,$dhcpservice,$netmask,$range1,$range2,$atts)){ + $mesg .= "<br>DHCP Subnet erfolgreich angelegt<br>"; + $url = "dhcpsubnets.php?mnr=2"; + }else{ + $mesg .= "<br>Fehler beim anlegen des DHCP Subnets!<br>"; + } + + }else{ + $mesg .= "Falsche IP Syntax! Geben Sie eine korrekte IP Adresse als Subnet Name oder Netzmaske ein."; + $url = "new_dhcpsubnet.php?subnetcn=Hier_Subnetz_eintragen&netmask=".$netmask."&mnr=2"; + } +} + +elseif ( $cn == "" || $cn == "Hier_Subnetz_eintragen" || $netmask == "" || $netmask == "Hier_Netzmaske_eintragen" ){ + + if ( $cn == ""){ $cn = "Hier_Subnetz_eintragen";} + if ( $netmask == ""){ $netmask = "Hier_Netzmaske_eintragen";} + $mesg = "Sie haben die notwendigen Attribute: Name (IP) und Netzmaske des neuen DHCP Subnets nicht angegeben.<br> + Bitte geben Sie fehlende ein.<br><br>"; + $url = "new_dhcpsubnet.php?subnetcn=".$cn."&netmask=".$netmask."&mnr=2"; +} + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurü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 diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet_change.php b/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet_change.php new file mode 100644 index 00000000..b0dc13c7 --- /dev/null +++ b/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet_change.php @@ -0,0 +1,292 @@ +<?php +include('../standard_header.inc.php'); + +$syntax = new Syntaxcheck; + +$cn = $_POST['cn']; +$oldcn = $_POST['oldcn']; +$netmask = $_POST['netmask']; +$oldnetmask = $_POST['oldnetmask']; +$dhcpservice = $_POST['dhcpservice']; +$olddhcpservice = $_POST['olddhcpservice']; +$newrange1 = $_POST['range1']; +$oldrange1 = $_POST['oldrange1']; +$newrange2 = $_POST['range2']; +$oldrange2 = $_POST['oldrange2']; + +$subnetDN = $_POST['subnetdn']; + +# 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']; + +$seconds = 200; +$url = "dhcpsubnet.php?dn=".$subnetDN."&mnr=".$mnr."&sbmnr=".$sbmnr; + +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 Subnet CN (DN) + +if ( $oldcn == $cn ){ + # $mesg = "keine Aenderung<br>"; +} + +if ( $oldcn != "" && $cn != "" && $oldcn != $cn ){ + + if ( $syntax->check_netip_syntax($cn) ){ + echo "Subnetz aendern<br>"; + $newsubnetDN = "cn=".$cn.",".$nodeDN; + print_r($newsubnetDN); echo "<br><br>"; + + if(modify_subnet_dn($subnetDN,$newsubnetDN)){ + $subnetDN = $newsubnetDN; + $mesg = "DHCP Subnet erfolgreich geändert<br><br>"; + $url = "dhcpsubnet.php?dn=".$subnetDN."&mnr=".$mnr."&sbmnr=".$sbmnr; + }else{ + $mesg = "Fehler beim ändern des DHCP Subnets!<br><br>"; + } + + }else{ + $mesg = "falsche IP Syntax<br>"; + } +} + +if ( $oldcn != "" && $cn == "" ){ + echo "DHCP Subnet loeschen!<br> + Dieser ist Teil des DN, Sie werden den DHCP Subnet komplett löschen<br><br>"; + echo "Wollen Sie den DHCP Subnet <b>".$oldcn."</b> wirklich löschen?<br><br> + <form action='dhcpsubnet_delete.php' method='post'> + Falls ja:<br><br> + <input type='hidden' name='dn' value='".$subnetDN."'> + <input type='hidden' name='name' value='".$oldcn."'> + <input type='Submit' name='apply' value='löschen' class='small_loginform_button'><br><br> + </form> + <form action='".$url."' method='post'> + Falls, nein:<br><br> + <input type='Submit' name='apply' value='zurück' class='small_loginform_button'> + </form>"; + $seconds = 600; +} + + +##################################### +# Netmask + +if ( $netmask != $oldnetmask ){ + + if ( $netmask == ""){ + echo "Die Subnetzmaske ist ein notwendiges Attribut.<br> + Keine Änderung!<br>"; + } + + if ( $netmask != "" ){ + if ( $syntax->check_ip_syntax($netmask) ){ + $entry ['dhcpoptnetmask'] = $netmask; + if(ldap_mod_replace($ds,$subnetDN,$entry)){ + $mesg = "Netzmaske erfolgreich geändert<br><br>"; + }else{ + $mesg = "Fehler beim ändern der Netzmaske!<br><br>"; + } + }else{ + $mesg = "falsche IP Syntax<br>"; + } + } + +} + + +##################################### +# DHCP Dienstzuordnung ändern + +if ( $dhcpservice != "none" ){ + + if ( $dhcpservice != "off" && $dhcpservice == $olddhcpservice ){ + $mesg = "Sie haben die gleiche Abteilung ausgewählt<br> + Keine Änderung!"; + } + + if ( $dhcpservice != "off" && $dhcpservice != $olddhcpservice ){ + $entrysv ['dhcphlpcont'] = $dhcpservice; + if(ldap_mod_replace($ds,$subnetDN,$entrysv)){ + $mesg = "DHCP Dienstzuordnung erfolgreich geändert<br><br>"; + } + else{ + $mesg = "Fehler beim ändern der DHCP Dienstzuordnung!<br><br>"; + } + } + + if ( $dhcpservice == "off" && $olddhcpservice != "" ){ + $entrysv ['dhcphlpcont'] = array(); + if(ldap_mod_del($ds,$subnetDN,$entrysv)){ + $mesg = "DHCP Dienstzuordnung erfolgreich geändert<br><br>"; + } + else{ + $mesg = "Fehler beim ändern der DHCP Dienstzuordnung!<br><br>"; + } + } + +} + + +##################################### +# DHCP Range + +if ( $newrange1 == $oldrange1 && $newrange2 == $oldrange2 ){ + # $mesg = "keine Aenderung<br>"; +}else{ + + if ( $newrange1 == "" xor $newrange2 == "" ){ + $mesg = "Bitte beide DHCP Range Felder ausfüllen, keine Aenderung<br>"; + } + + if ( $oldrange1 == "" && $oldrange2 == "" && $newrange1 != "" && $newrange2 != "" ){ + if ( $syntax->check_ip_syntax($newrange1) && $syntax->check_ip_syntax($newrange2) ){ + if ( check_ip_in_subnet($newrange1,$cn) && check_ip_in_subnet($newrange2,$cn)){ + $dhcprange = implode('_',array($newrange1,$newrange2)); + if ( new_ip_dhcprange($dhcprange,$subnetDN,$auDN) ){ + $mesg = "DHCP Range erfolgreich eingetragen"; + }else{ + $mesg = "Fehler beim eintragen der DHCP Range"; + } + }else{ + $mesg = "DHCP Range nicht in Subnetz ".$cn." enthalten"; + } + }else{ + $mesg = "falsche IP Syntax<br>"; + } + } + + if ( $oldrange1 != "" && $oldrange2 != "" && $newrange1 != "" && $newrange2 != "" ){ + if ( $syntax->check_ip_syntax($newrange1) && $syntax->check_ip_syntax($newrange2) ){ + if ( check_ip_in_subnet($newrange1,$cn) && check_ip_in_subnet($newrange2,$cn)){ + $dhcprange = implode('_',array($newrange1,$newrange2)); + $olddhcprange = implode('_',array($oldrange1,$oldrange2)); + if ( modify_ip_dhcprange($dhcprange,$subnetDN,$auDN) ){ + $mesg = "DHCP Range erfolgreich geändert"; + }else{ + $mesg = "Fehler beim ändern der DHCP Range"; + # alte Range wiederherstellen + new_ip_dhcprange($olddhcprange,$subnetDN,$auDN); + } + }else{ + $mesg = "DHCP Range nicht in Subnetz ".$cn." enthalten"; + } + }else{ + $mesg = "falsche IP Syntax<br>"; + } + } + + if ( $newrange1 == "" && $newrange2 == "" ){ + if ( delete_ip_dhcprange($subnetDN,$auDN) ){ + $mesg = "DHCP Range erfolgreich gelöscht"; + }else{ + $mesg = "Fehler beim löschen der DHCP Range"; + } + } + +} + +##################################### +# 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 "<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,$subnetDN,$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 "ändern<br>"; + foreach (array_keys($entrymod) as $key){ + $modatts .= "<b>".$key."</b>,"; + } + if(ldap_mod_replace($ds,$subnetDN,$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öschen<br>"; + foreach (array_keys($entrydel) as $key){ + $delatts .= "<b>".$key."</b>,"; + } + if(ldap_mod_del($ds,$subnetDN,$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ü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 diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet_delete.php b/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet_delete.php new file mode 100644 index 00000000..eb5d66aa --- /dev/null +++ b/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet_delete.php @@ -0,0 +1,34 @@ +<?php +include('../standard_header.inc.php'); + +$subnetDN = $_POST['dn']; +$cn = $_POST['name']; + +$seconds = 100; +$url = "dhcpsubnets.php?mnr=2"; + +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>"; + +if ( $subnetDN != ""){ + if( delete_dhcpsubnet($subnetDN,$cn)){ + $mesg = "Subnet <b>".$cn."</b> erfolgreich gelöscht!<br><br>"; + }else{ + $mesg = "Fehler beim löschen des Subnets <b>".$cn."</b> !<br><br>"; + } +} + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurü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 diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcpsubnets.dwt b/ldap-site-mngmt/webinterface/dhcp/dhcpsubnets.dwt new file mode 100644 index 00000000..e887509d --- /dev/null +++ b/ldap-site-mngmt/webinterface/dhcp/dhcpsubnets.dwt @@ -0,0 +1,37 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='2'><h3>DHCP Subnets</h3> + </td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + <tr> + <td width='15%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Subnet</b></td> + <td width='20%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Netmask</b></td> + <td width='25%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>DHCP Dienst</b></td> + <td width='25%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Range</b></td> + <td width='15%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Hostobjekte</b></td> + </tr> + + <!-- BEGIN DYNAMIC BLOCK: Subnets --> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>{SUBNETCN} </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>{NETMASK} </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>{DHCP} </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>{RANGE} </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <!-- BEGIN DYNAMIC BLOCK: Hosts --> + <b>{HOSTS}</b><br> + <!-- END DYNAMIC BLOCK: Hosts --> + </td> + </tr> + <!-- END DYNAMIC BLOCK: Subnets --> + + </table></td> + </tr> + + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcpsubnets.php b/ldap-site-mngmt/webinterface/dhcp/dhcpsubnets.php new file mode 100644 index 00000000..1104f496 --- /dev/null +++ b/ldap-site-mngmt/webinterface/dhcp/dhcpsubnets.php @@ -0,0 +1,65 @@ +<?php + +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "DHCP Service Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 5; +$mnr = 2; +$sbmnr = -1; +$mcnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "dhcpsubnets.dwt"; + +include("../class.FastTemplate.php"); + +include('dhcp_header.inc.php'); + +################################################################################### + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createDhcpMenu($rollen, $mnr, $auDN, $sbmnr); + +################################################################################### + +$template->assign(array("SUBNETDN" => "", + "SUBNETCN" => "Noch keine Subnets angelegt", + "NETMASK" => "", + "DHCP" => "", + "RANGE" => "", + "HOSTS" => "")); + +# rbservice und pxe daten (voerst nur ein rbs) +$subnet_array = get_dhcpsubnets($auDN,array("dn","cn","dhcpoptnetmask","dhcprange","dhcphlpcont")); + +$template->define_dynamic("Subnets", "Webseite"); +foreach ($subnet_array as $subnet){ + $range = ""; + if ($subnet['dhcprange'] != ""){ + $exp = explode('_',$subnet['dhcprange']); + $range = $exp[0]." - ".$exp[1]; + } + if ($subnet['dhcphlpcont'] != ""){ + $exp = ldap_explode_dn($subnet['dhcphlpcont'],1); + $dhcpservice = $exp[0]." [".$exp[2]."]"; + }else{ + $dhcpservice = ""; + } + + $template->assign(array("SUBNETDN" => $subnet['dn'], + "SUBNETCN" => $subnet['cn'], + "NETMASK" => $subnet['dhcpoptnetmask'], + "DHCP" => $dhcpservice, + "RANGE" => $range, + "HOSTS" => "")); + $template->parse("SUBNETS_LIST", ".Subnets"); +} + + +################################################################################### + +include("dhcp_footer.inc.php"); + +?> diff --git a/ldap-site-mngmt/webinterface/dhcp/menu.dwt b/ldap-site-mngmt/webinterface/dhcp/menu.dwt new file mode 100644 index 00000000..037bdf15 --- /dev/null +++ b/ldap-site-mngmt/webinterface/dhcp/menu.dwt @@ -0,0 +1,29 @@ + +<table cellpadding='0' cellspacing='0' border='0' width='100%'> + + + + <!-- BEGIN DYNAMIC BLOCK: Hauptmenu --> + + <tr valign='middle' align='left'> +
+ <td width='8%' align='right' style="border-style=none;">{ICON}</td> + <td width="8%" align="left" style="border-width:1 0 1 1;border-color:#000000;border-style:solid;padding:5;background-color:{FARBE}"> </td>
+ <td width="74%" align="left" style="border-width:1 1 1 0;border-color:#000000;border-style:solid;padding:5;background-color:{FARBE}"> + <a href="{LINK_M}" style="text-decoration:none"><b class="standard_schrift">{TEXT_M}</b></a></td>
+ <td width='10%'> </td> + + </tr> + + <!-- BEGIN DYNAMIC BLOCK: Submenu --> + + {SUB} + + <!-- END DYNAMIC BLOCK: Submenu --> + + <tr height='5'></tr> + <!-- END DYNAMIC BLOCK: Hauptmenu -->
+ + + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/dhcp/new_dhcpservice.dwt b/ldap-site-mngmt/webinterface/dhcp/new_dhcpservice.dwt new file mode 100644 index 00000000..7d964715 --- /dev/null +++ b/ldap-site-mngmt/webinterface/dhcp/new_dhcpservice.dwt @@ -0,0 +1,151 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='2'><h3>DHCP Service anlegen</td> + </tr> + <tr> + <td height='20'></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <form action='dhcpservice_add.php' method='post'> + + <tr> + <td width='40%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='60%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Eindeutiger DHCP Service Name (cn):</b><br>(Teil des dn, ohne Leerzeichen eingeben) </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <font size='+2'><b>DHCP_</b></font><input type='Text' name='cn' value='{CN}' size='40' class='medium_form_field'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Beschreibung:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[description]' value='{DESCRIPTION}' size='50' class='medium_form_field'> + </td> + </tr> + <tr height='50' valign='top'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <b>Wer soll Dienst nutzen dürfen:</b><br>(Wählen Sie eine Abteilung,<br> + impliziert alle Unterabteilungen) + </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <select name='dhcpoffer' size='5' class='medium_form_selectbox'> + <option selected value='{OFFERSELF}'>{SELFOU}</option> + + <!-- BEGIN DYNAMIC BLOCK: Dhcpoffers --> + <option value='{DHCPOFFER}'>{DHCPOFFEROU}</option> + <!-- END DYNAMIC BLOCK: Dhcpoffers --> + + </select> + </td> + </tr> + <!-- <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>PRIMARY DN:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[primary]' value='{PRIMARY}' size='50' class='medium_form_field'> + </td> + </tr> --> + + </table></td> + </tr> + + <tr> + <td height='40'></td> + </tr> + <tr> + <td colspan='2'><h4>DHCP Optionen des Dienstes (Globaler Scope):</h4></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <tr valign='top'> + <td width='40%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Option</b></td> + <td width='60%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert(e)</b></td> + </tr> + + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Server Identifier:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[dhcpoptserver-identifier]' value='{SRVIDENT}' size='40' class='medium_form_field'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Default Lease Time:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[dhcpoptdefault-lease-time]' value='{DEFAULTLEASE}' size='40' class='medium_form_field'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Max Lease Time:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[dhcpoptmax-lease-time]' value='{MAXLEASE}' size='40' class='medium_form_field'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Use Host DCL Names:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[dhcpoptuse-host-decl-names]' value='{USEHOSTDCL}' size='40' class='medium_form_field'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>DHCP Max Message Size:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[dhcpoptdhcp-max-message-size]' value='{MAXMESSIZE}' size='40' class='medium_form_field'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>DDNS Update Style:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[dhcpoptddns-update-style]' value='{DDNSUPDATE}' size='40' class='medium_form_field'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Domain Name:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[dhcpoptdomain-name]' value='{DOMAINNAME}' size='40' class='medium_form_field'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Domain Name Servers:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[dhcpoptdomain-name-servers]' value='{DOMAINNAMESERVERS}' size='40' class='medium_form_field'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>NTP Servers:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[dhcpoptntp-servers]' value='{NTPSERVERS}' size='40' class='medium_form_field'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Allow:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[dhcpoptallow]' value='{ALLOW}' size='40' class='medium_form_field'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Deny:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[dhcpoptdeny]' value='{DENY}' size='40' class='medium_form_field'> + </td> + </tr> + + <input type='hidden' name='mnr' value='{MNR}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + + </table></td> + </tr> + <tr> + <td><input type='Submit' name='apply' value='anlegen' class='small_loginform_button'> + </form></td> + </tr> + + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/dhcp/new_dhcpservice.php b/ldap-site-mngmt/webinterface/dhcp/new_dhcpservice.php new file mode 100644 index 00000000..83aa9cb5 --- /dev/null +++ b/ldap-site-mngmt/webinterface/dhcp/new_dhcpservice.php @@ -0,0 +1,79 @@ +<?php +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "DHCP Service Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 5; +$mnr = 0; +$sbmnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "new_dhcpservice.dwt"; + +include("../class.FastTemplate.php"); + +include('dhcp_header.inc.php'); + +################################################################################### + +$mnr = $_GET['mnr']; + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createDhcpMenu($rollen, $mnr, $auDN, $sbmnr); + +################################################################################### + +$dhcpcn = str_replace ( "_", " ", $_GET['dhcpcn']); +$template->assign(array("CN" => $dhcpcn, + "PRIMARY" => "", + "SECONDARY" => "", + "DESCRIPTION" => "", + "STATEMENTS" => "", + "ALLOW" => "", + "DENY" => "", + "IGNORE" => "", + "DDNSUPDATE" => "", + "DEFAULTLEASE" => "", + "MAXLEASE" => "", + "USEHOSTDCL" => "", + "DOMAINNAME" => "", + "DOMAINNAMESERVERS" => "", + "MAXMESSIZE" => "", + "SRVIDENT" => "", + "NTPSERVERS" => "", + "OPTGENERIC" => "", + "OFFERSELF" => $auDN, + "SELFOU" => $au_ou, + "MNR" => $mnr, + "SBMNR" => $sbmnr)); + + +# DHCP Service Anbieten (ausser eigene AU) +$expdn = ldap_explode_dn($auDN, 0); # Mit Merkmalen +$expdn = array_slice($expdn, 2); +$expou = ldap_explode_dn($auDN, 1); # nur Werte +$expou = array_slice($expou, 2, -3); +#print_r($expou); echo "<br>"; +#print_r($expdn); echo "<br>"; +for ($i=0; $i<count($expou); $i++){ + $dhcpoffers[$i]['ou'] = $expou[$i]; + $dhcpoffers[$i]['dn'] = implode(',',$expdn); + $expdn = array_slice($expdn, 1); +} +#print_r($dhcpoffers); + +$template->define_dynamic("Dhcpoffers", "Webseite"); +if ( count($dhcpoffers) != 0 ){ + foreach ($dhcpoffers as $offer){ + $template->assign(array("DHCPOFFER" => $offer['dn'], + "DHCPOFFEROU" => $offer['ou'],)); + $template->parse("DHCPOFFERS_LIST", ".Dhcpoffers"); + } +} + +################################################################################### + +include("dhcp_footer.inc.php"); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/dhcp/new_dhcpsubnet.dwt b/ldap-site-mngmt/webinterface/dhcp/new_dhcpsubnet.dwt new file mode 100644 index 00000000..8b710fb8 --- /dev/null +++ b/ldap-site-mngmt/webinterface/dhcp/new_dhcpsubnet.dwt @@ -0,0 +1,149 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='2'><h3>DHCP Subnet anlegen </h3></td> + </tr> + <tr> + <td height='20'></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <form action='dhcpsubnet_add.php' method='post'> + + <tr> + <td width='40%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='60%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>DHCP Subnet (cn):</b><br>(Teil des dn, ohne Leerzeichen eingeben) </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='cn' value='{CN}' size='15' maxlength='15' class='medium_form_field'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Netmask:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='netmask' value='{NETMASK}' size='15' maxlength='15' class='medium_form_field'> + </td> + </tr> + <tr height='50' valign='top'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>DHCP Dienst wählen:</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <select name='dhcpservice' size='5' class='medium_form_selectbox'> + <option selected value='none'>----------</option> + + <!-- BEGIN DYNAMIC BLOCK: Dhcpservices --> + <option value='{DHCPSVDN}'>{DHCPSVCN} / {DHCPSVAU}</option> + <!-- END DYNAMIC BLOCK: Dhcpservices --> + + </select> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Beschreibung:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[description]' value='{DESCRIPTION}' size='50' class='medium_form_field'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>IP Range:</b><br>(Zur dynamischen Vergabe)</td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='range1' value='{RANGE1}' size='15' maxlength='15' class='medium_form_field'> + - + <input type='Text' name='range2' value='{RANGE2}' size='15' maxlength='15' class='medium_form_field'> + </td> + </tr> + + </table></td> + </tr> + + <tr> + <td height='40'></td> + </tr> + <tr> + <td colspan='2'><h4>DHCP Optionen des Subnets (Subnet Scope):</h4></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <tr valign='top'> + <td width='40%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Option</b></td> + <td width='60%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert(e)</b></td> + </tr> + + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Default Lease Time:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[dhcpoptdefault-lease-time]' value='{DEFAULTLEASE}' size='40' class='medium_form_field'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Max Lease Time:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[dhcpoptmax-lease-time]' value='{MAXLEASE}' size='40' class='medium_form_field'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>DDNS Update Style:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[dhcpoptddns-update-style]' value='{DDNSUPDATE}' size='40' class='medium_form_field'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Domain Name:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[dhcpoptdomain-name]' value='{DOMAINNAME}' size='40' class='medium_form_field'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Domain Name Servers:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[dhcpoptdomain-name-servers]' value='{DOMAINNAMESERVERS}' size='40' class='medium_form_field'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Routers:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[dhcpoptrouters]' value='{ROUTERS}' size='40' class='medium_form_field'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Broadcast Address:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[dhcpoptbroadcast-address]' value='{BROADCAST}' size='40' class='medium_form_field'> + </td> + </tr> + <!-- <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Next Server:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[dhcpoptnext-server]' value='{NEXTSERVER}' size='40' class='medium_form_field'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Filename:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[dhcpoptfilename]' value='{FILENAME}' size='40' class='medium_form_field'> + </td> + </tr> --> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>NTP Servers:</b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[dhcpoptntp-servers]' value='{NTPSERVERS}' size='40' class='medium_form_field'> + </td> + </tr> + + <input type='hidden' name='mnr' value='{MNR}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + + </table></td> + </tr> + <tr> + <td><input type='Submit' name='apply' value='anlegen' class='small_loginform_button'> + </form></td> + </tr> + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/dhcp/new_dhcpsubnet.php b/ldap-site-mngmt/webinterface/dhcp/new_dhcpsubnet.php new file mode 100644 index 00000000..a7697c14 --- /dev/null +++ b/ldap-site-mngmt/webinterface/dhcp/new_dhcpsubnet.php @@ -0,0 +1,84 @@ +<?php +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "DHCP Service Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 5; +$mnr = 0; +$sbmnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "new_dhcpsubnet.dwt"; + +include("../class.FastTemplate.php"); + +include('dhcp_header.inc.php'); + +################################################################################### + +$mnr = $_GET['mnr']; +$sbmnr = $_GET['sbmnr']; + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createDhcpMenu($rollen, $mnr, $auDN, $sbmnr); + +################################################################################### + +$subnetcn = str_replace ( "_", " ", $_GET['subnetcn']); +$netmask = str_replace ( "_", " ", $_GET['netmask']); +$template->assign(array("CN" => $subnetcn, + "NETMASK" => $netmask, + "RANGE1" => "", + "RANGE2" => "", + "DESCRIPTION" => "", + "STATEMENTS" => "", + "ALLOW" => "", + "DENY" => "", + "IGNORE" => "", + "DDNSUPDATE" => "", + "DEFAULTLEASE" => "", + "MAXLEASE" => "", + "USEHOSTDCL" => "", + "BROADCAST" => "", + "ROUTERS" => "", + "DOMAINNAME" => "", + "DOMAINNAMESERVERS" => "", + "NEXTSERVER" => "", + "FILENAME" => "", + "SRVIDENT" => "", + "NTPSERVERS" => "", + "OPTGENERIC" => "", + "DHCPSVNOW" => "", + "DHCPSVNOWAU" => "", + "MNR" => $mnr, + "SBMNR" => $sbmnr, + "MCNR" => $mcnr)); + + + +# DHCP Services +$dhcpservices = get_dhcpoffers($auDN); +#print_r($dhcpservices); echo "<br>"; + +$template->assign(array("DHCPSVDN" => "", + "DHCPSVCN" => "", + "DHCPSVAU" => "")); +if (count($dhcpservices) != 0){ +$template->define_dynamic("Dhcpservices", "Webseite"); + foreach ($dhcpservices as $item){ + $exp = ldap_explode_dn($item,1); + + $template->assign(array("DHCPSVDN" => $item, + "DHCPSVCN" => $exp[0], + "DHCPSVAU" => $exp[2])); + $template->parse("DHCPSERVICES_LIST", ".Dhcpservices"); + } +} + + +################################################################################### + +include("dhcp_footer.inc.php"); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/dhcp/no_dhcp.dwt b/ldap-site-mngmt/webinterface/dhcp/no_dhcp.dwt new file mode 100644 index 00000000..5b8ffe4f --- /dev/null +++ b/ldap-site-mngmt/webinterface/dhcp/no_dhcp.dwt @@ -0,0 +1,25 @@ +<table border='0' cellpadding='5' cellspacing='0' width='90%'> + <tr> + <td colspan='2'><h3>Modul - DHCP Management: </h3></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr> + <td> + <p>Dieses Modul dient der Verwaltung des DHCP Dienstes und DHCP Subnetzen.<br> + <br> + <b>Sie verfügen über keine kompletten Netzwerke!</b> <br> + x.x.x.0/24<br> + x.x.0.0/16<br> + x.0.0.0/8<br> + <br> + Sie können daher keine DHCP Dienst- bzw. DHCP Subnetz-Objekte anlegen. <br> + <br> + Jedoch können Sie ihre Rechner in DHCP Diensten (Subnetzen) anderer AUs + anmelden (Modul Rechner Management). + + </td> + </tr> + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/dhcp/no_dhcp.php b/ldap-site-mngmt/webinterface/dhcp/no_dhcp.php new file mode 100644 index 00000000..57653255 --- /dev/null +++ b/ldap-site-mngmt/webinterface/dhcp/no_dhcp.php @@ -0,0 +1,27 @@ +<?php +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "DHCP Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 5; +$mnr = 0; +$sbmnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "no_dhcp.dwt"; + +include("../class.FastTemplate.php"); + +include('dhcp_header.inc.php'); + +################################################################################### + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createDhcpMenu($rollen, $mnr, $auDN, $sbmnr); + +################################################################################### + +include("dhcp_footer.inc.php"); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/dns/dns.dwt b/ldap-site-mngmt/webinterface/dns/dns.dwt new file mode 100644 index 00000000..ec6d0cbc --- /dev/null +++ b/ldap-site-mngmt/webinterface/dns/dns.dwt @@ -0,0 +1,79 @@ +<html> + +<head> + <title>{SEITENTITEL}</title> + <link rel='stylesheet' href='../styles.css' type='text/css'></head> +<body> + +<table cellpadding='0' cellspacing='0' border='0' width='95%' height='8%'> + <tr> + <td width='35%'> + <table cellpadding='5' cellspacing='0' border='0' width='100%'> + <tr valign='top'> + <td width='1'></td> + <td><h2>Rechner und IP Management</h2></td> + </tr> + </table> + </td> + + <td width='40%'> + <table cellpadding='5' cellspacing='0' border='0' width='100%'> + <tr valign='top' align='left'> + <td> + <h4><a href='../start.php' class='headerlink'>Startseite</a> + >> <a href='../au/au.php' class='headerlink'>{AU}</a> [ {DOMAIN} ]</h4> + </td> + </tr> + </table> + </td> + <td width='25%'> + <table cellpadding='5' cellspacing='0' border='0' width='100%' align='right'> + <tr valign='top' align='right'> + <td> + {LOGIN} + </td> + </tr> + </table> + </td> + </tr> +</table> + +<table cellpadding='5' cellspacing='0' border='0' width='95%' height='7%'> +<tr> + <td>{MAINMENU}</td> +</tr> +</table> + +<hr align='center' width='98%' noshade> + + + +<table cellpadding='5' cellspacing='0' border='0' width='100%' height='85%'> + + <tr valign='top' height='100%'> + <td width='28%'> + <table cellpadding='5' cellspacing='0' border='0' width='100%'> + <tr><td> + + {NAVIGATION} + + </td></tr> + </table> + </td> + + <td width='72%'> + <table cellpadding='5' cellspacing='0' border='0' width='100%'> + <tr><td> + + {HAUPTFENSTER} + + </td></tr> + </table> + </td> + + </tr> +</table> + +</body> + +</html> diff --git a/ldap-site-mngmt/webinterface/dns/dns.php b/ldap-site-mngmt/webinterface/dns/dns.php new file mode 100644 index 00000000..dd9e5756 --- /dev/null +++ b/ldap-site-mngmt/webinterface/dns/dns.php @@ -0,0 +1,26 @@ +<?php +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "DNS Zone Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mnr = 0; +$mainnr = 6; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "dns_start.dwt"; + +include("../class.FastTemplate.php"); + +include('dns_header.inc.php'); + +################################################################################### + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createDNSMenu($rollen, $mnr); + +################################################################################### + +include("dns_footer.inc.php"); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/dns/dns_footer.inc.php b/ldap-site-mngmt/webinterface/dns/dns_footer.inc.php new file mode 100644 index 00000000..311721c5 --- /dev/null +++ b/ldap-site-mngmt/webinterface/dns/dns_footer.inc.php @@ -0,0 +1,18 @@ +<?php + +$template->assign(array("PFAD" => $START_PATH)); + +# Daten in die Vorlage parsen +$template->parse("LOGIN", "Login"); +$template->parse("MAINMENU", "Mmenu"); +$template->parse("NAVIGATION", "Menu"); +$template->parse("HAUPTFENSTER", "Webseite"); +$template->parse("PAGE", "Vorlage"); + +# Fertige Seite an den Browser senden +$template->FastPrint("PAGE"); + +# Abmelden vom LDAP +ldap_unbind($ds); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/dns/dns_header.inc.php b/ldap-site-mngmt/webinterface/dns/dns_header.inc.php new file mode 100644 index 00000000..34632b37 --- /dev/null +++ b/ldap-site-mngmt/webinterface/dns/dns_header.inc.php @@ -0,0 +1,21 @@ +<?php +include("dns_menu.php"); + +$template = new FastTemplate("."); + +# dem erstellten Template-Objekt eine Vorlage zuweisen +$definedTemplates = array("Vorlage" => "dns.dwt", + "Login" => "../logout_form.inc.dwt", + "Mmenu" => "../hauptmenue.dwt", + "Menu" => "menu.dwt", + "Webseite" => $webseite); +if (isset($additionalTemplates)) { + foreach ($additionalTemplates as $templateKey => $templateFile) { + $definedTemplates[$templateKey] = $templateFile; + } +} +$template->define($definedTemplates); + +$template->assign(array("SEITENTITEL" => $titel, "ROLLE" => "mainadmin", "AU" => $au_ou, "DOMAIN" => $assocdom, "USERCN" => $usercn)); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/dns/dns_menu.php b/ldap-site-mngmt/webinterface/dns/dns_menu.php new file mode 100644 index 00000000..1ce8e5b7 --- /dev/null +++ b/ldap-site-mngmt/webinterface/dns/dns_menu.php @@ -0,0 +1,72 @@ +<?php + +function createDNSMenu($rollen , $mnr) { + global $template; + global $START_PATH; + # Struktur der Registerkartenleiste + $hauptmenu = array(array("link" => "dns.php", + "text" => "Übersicht", + "zugriff" => "alle"), + array("link" => "dns.php", + "text" => "SOA Record", + "zugriff" => array("MainAdmin")), + array("link" => "dns.php", + "text" => "INCLUDE Direktiven", + "zugriff" => array("MainAdmin","ZoneAdmin")), + array("link" => "dns.php", + "text" => "Zonen Delgierung", + "zugriff" => array("MainAdmin")), + array("link" => "dns.php", + "text" => "Resource Records", + "zugriff" => array("MainAdmin","HostAdmin","ZoneAdmin"))); + + #$rollen = array_keys($roles); + + # Zusammenstellen der Menuleiste + $template->define_dynamic("Hauptmenu", "Menu"); + $i=0; + foreach($hauptmenu as $item) { + if($item['zugriff'] === "alle" || vergleicheArrays($rollen , $item['zugriff'])) { + if ($i==0) { + if ($mnr==0) { + $zwisch=""; + $lastaktive=true; + $farb="#505050"; + } + else { + $zwisch=""; + $farb="#A0A0A0"; + $lastaktive=false; + } + } + else { + if ($mnr==$i) { + $zwisch=""; + $lastaktive=true; + $farb="#505050"; + } + else { + $farb="#A0A0A0"; + if ($lastaktive) {$zwisch="";} + else {$zwisch="";} + $lastaktive=false; + } + } + $template->assign(array("ZWISCHEN" => $zwisch, + "FARBE" => $farb, + "LINK_M" => $item["link"], + "TEXT_M" => $item["text"])); + $template->parse("HAUPTMENU_LIST", ".Hauptmenu"); + + } + $i=$i+1; + } + if ($lastaktive) {$template->assign(array("ENDE" => ""));} + else { + $template->assign(array("ENDE" => "")); + } + +} + + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/dns/dns_start.dwt b/ldap-site-mngmt/webinterface/dns/dns_start.dwt new file mode 100644 index 00000000..0595dde7 --- /dev/null +++ b/ldap-site-mngmt/webinterface/dns/dns_start.dwt @@ -0,0 +1,30 @@ +<table border='0' cellpadding='5' cellspacing='0' width='90%'> + <tr> + <td colspan='2'><h3>Modul - DNS Zonen Management: </h3></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr> + <td> + <p>Dieses Modul dient der Verwaltung ...<br> + Benutzen Sie die Navigation links, um die einzelnen Verwaltungsbereiche anzusteuern:</p> + <ul> + <li><p><b>SOA Record</b></p> + Verwalten Sie hier den Start Of Authority (SOA) ihrer DNS Zone ... + </li> + <li><p><b>Include Direktiven</b></p> + Verwalten Sie hier die $INCLUDE Direktiven ihrer includeten Zonendateien ... + </li> + <li><p><b>Zonen Delegierung</b></p> + Delegieren Sie hier neue DNS Zonen ... + </li> + <li><p><b>Resource Records Zone</b></p> + Verwalten Sie hier alle weiteren Namenseintraege ihrer Zone und deren RRs ... + </li> + </ul> + + </td> + </tr> + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/dns/menu.dwt b/ldap-site-mngmt/webinterface/dns/menu.dwt new file mode 100644 index 00000000..a57ab962 --- /dev/null +++ b/ldap-site-mngmt/webinterface/dns/menu.dwt @@ -0,0 +1,22 @@ + +<table cellpadding='5' cellspacing='0' border='0' width='100%'> + + + + <!-- BEGIN DYNAMIC BLOCK: Hauptmenu --> + + <tr valign='middle' align='left'>
+
+ <td width='8%' align='right' style="border-style=none;"></td> + <td width="8%" align="left" style="border-width:1 0 1 1;border-color:#000000;border-style:solid;padding:5;background-color:{FARBE}"> </td>
+ <td width="74%" align="left" style="border-width:1 1 1 0;border-color:#000000;border-style:solid;padding:5;background-color:{FARBE}"> + <a href="{LINK_M}" style="text-decoration:none"><b class="standard_schrift">{TEXT_M}</b></a></td>
+ <td width='10%'> </td> + + </tr> + <tr height='5'></tr> + <!-- END DYNAMIC BLOCK: Hauptmenu -->
+ + + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/ip/ip.dwt b/ldap-site-mngmt/webinterface/ip/ip.dwt new file mode 100644 index 00000000..804c18ef --- /dev/null +++ b/ldap-site-mngmt/webinterface/ip/ip.dwt @@ -0,0 +1,88 @@ +<html> + +<head> + <title>{SEITENTITEL}</title> + <link rel='stylesheet' href='../styles.css' type='text/css'></head> +<body> + +<table cellpadding='0' cellspacing='0' border='0' width='95%' height='8%'> + <tr> + <td width='35%'> + <table cellpadding='5' cellspacing='0' border='0' width='100%'> + <tr valign='top'> + <td width='1'></td> + <td><h2>Rechner und IP Management</h2></td> + </tr> + </table> + </td> + + <td width='40%'> + <table cellpadding='5' cellspacing='0' border='0' width='100%'> + <tr valign='top' align='left'> + <td> + <h4><a href='../start.php' class='headerlink'>Startseite</a> + >> <a href='../au/au.php' class='headerlink'>{AU}</a> [ {DOMAIN} ]</h4> + </td> + </tr> + </table> + </td> + <td width='25%'> + <table cellpadding='5' cellspacing='0' border='0' width='100%' align='right'> + <tr valign='top' align='right'> + <td> + {LOGIN} + </td> + </tr> + </table> + </td> + </tr> +</table> + +<table cellpadding='5' cellspacing='0' border='0' width='95%' height='7%'> +<tr> + <td>{MAINMENU}</td> +</tr> +</table> + +<hr align='center' width='98%' noshade> + + + +<table cellpadding='5' cellspacing='0' border='0' width='100%' height='85%'> + + <tr valign='top' height='100%'> + <td width='28%'> + <table cellpadding='5' cellspacing='0' border='0' width='100%'> + <tr> + <td> + + {NAVIGATION} + + </td> + </tr> + <tr> + <td> + + {IPBLOCKS} + + </td> + </tr> + </table> + </td> + + <td width='72%'> + <table cellpadding='5' cellspacing='0' border='0' width='100%'> + <tr><td> + + {HAUPTFENSTER} + + </td></tr> + </table> + </td> + + </tr> +</table> + +</body> + +</html>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/ip/ip.php b/ldap-site-mngmt/webinterface/ip/ip.php new file mode 100644 index 00000000..8a435442 --- /dev/null +++ b/ldap-site-mngmt/webinterface/ip/ip.php @@ -0,0 +1,29 @@ +<?php + +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "IP Address Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 2; +$mnr = 0; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "ip_start.dwt"; + +include("../class.FastTemplate.php"); + +include("ip_header.inc.php"); + +################################################################################### + +# Menuleiste erstellen +createMainMenu($rollen, $mainnr); +createIPMenu($rollen, $mnr); + +include("ip_blocks.inc.php"); + +################################################################################### + +include("ip_footer.inc.php"); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/ip/ip_blocks.inc.php b/ldap-site-mngmt/webinterface/ip/ip_blocks.inc.php new file mode 100644 index 00000000..8530e079 --- /dev/null +++ b/ldap-site-mngmt/webinterface/ip/ip_blocks.inc.php @@ -0,0 +1,68 @@ +<?php + +# Max und Free IP Blocks +$mipb_array = get_maxipblocks_au($auDN); +$fipb_array = get_freeipblocks_au($auDN); +#print_r(count($mipb_array)); echo "<br>"; +#print_r(count($fipb_array)); echo "<br>"; +$ipblocks = ""; + +# print_r($mipb_array); +if ($mipb_array[0] != "" ){ + if (count($mipb_array) > 1 ){ + $ipblocks .= "<table border='1' cellpadding='2' cellspacing='0' width='100%' style='border-width: 0 0 0 0;'> + <tr><td colspan='3' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'> + <h4>Zugewiesene IP Bereiche:</h4></td></tr>"; + foreach ($mipb_array as $mipb){ + $exp = explode('_',$mipb); + $ipblocks .= "<tr><td width='45%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>$exp[0] </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> - </td> + <td width='45%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>$exp[1] </td></td></tr>"; + } + } + elseif (count($mipb_array) == 1){ + $ipblocks .= "<table border='1' cellpadding='2' cellspacing='0' width='100%' style='border-width: 0 0 0 0;'> + <tr><td colspan='3' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'> + <h4>Zugewiesener IP Bereich:</h4></td></tr>"; + $exp = explode('_',$mipb_array[0]); + $ipblocks .= "<tr><td width='45%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>$exp[0] </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> - </td> + <td width='45%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>$exp[1] </td></tr>"; + } + elseif( $fipb_array[0] == "" ){ + $ipblocks .= "<table border='0' cellpadding='2' cellspacing='0' width='100%' style='border-width: 0 0 0 0;'> + <tr><td><h4>Keine IP Adressen mehr verfügbar</h4></td></tr>"; + } + if (count($fipb_array) > 1 ){ + $ipblocks .= "<table border='1' cellpadding='2' cellspacing='0' width='100%' style='border-width: 0 0 0 0;'> + <tr valign='bottom' height='50'> + <td colspan='3' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'> + <h4>Davon noch frei verfügbar:</h4></td></tr>"; + foreach ($fipb_array as $fipb){ + $exp = explode('_',$fipb); + $ipblocks .= "<tr><td width='45%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>$exp[0] </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> - </td> + <td width='45%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>$exp[1] </td></tr>"; + } + } + elseif (count($fipb_array) == 1){ + $ipblocks .= "<table border='1' cellpadding='2' cellspacing='0' width='100%' style='border-width: 0 0 0 0;'> + <tr><td colspan='3' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'> + <h4>Davon noch frei verfügbar:</h4></td></tr>"; + $exp = explode('_',$fipb_array[0]); + $ipblocks .= "<tr><td width='45%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>$exp[0] </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> - </td> + <td width='45%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>$exp[1] </td></tr>"; + } + +} + +if( $mipb_array[0] == "" ){ + $ipblocks .= "<table border='0' cellpadding='2' cellspacing='0' width='100%' style='border-width: 0 0 0 0;'> + <tr><td><h4>Ihnen wurden keine IP Adressen zugewiesen</h4></td></tr>"; +} +$ipblocks .= "</table>"; + +$template->assign(array("IPBLOCKS" => $ipblocks)); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/ip/ip_deleg.dwt b/ldap-site-mngmt/webinterface/ip/ip_deleg.dwt new file mode 100644 index 00000000..3eb0ea74 --- /dev/null +++ b/ldap-site-mngmt/webinterface/ip/ip_deleg.dwt @@ -0,0 +1,40 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='2'><h3>Folgende IP Adressen haben Sie an untergeordnete Abteilungen delegiert: </h3></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + <tr> + <td width='35%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Untergeordnete Abteilung</b></td> + <td width='65%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Delegierte IP Bereiche</b></td> + </tr> + + <form action='ip_deleg_change.php' method='post'> + + <!-- BEGIN DYNAMIC BLOCK: AUs --> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>{CHILDOU} </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + + <!-- BEGIN DYNAMIC BLOCK: Delegs --> + <input type='Text' name='range1[]' value='{RANGE1}' size='15' class='medium_form_field'> + - + <input type='Text' name='range2[]' value='{RANGE2}' size='15' class='medium_form_field'><br> + <input type='hidden' name='oldrange1[]' value='{RANGE1}'> + <input type='hidden' name='oldrange2[]' value='{RANGE2}'> + <input type='hidden' name='childaudn[]' value='{CHILDDN}'> + <input type='hidden' name='audn[]' value='{AUDN}'> + <!-- END DYNAMIC BLOCK: Delegs --> + </td> + </tr> + <!-- END DYNAMIC BLOCK: AUs --> + + </table></td> + <tr> + <td><input type='Submit' name='apply' value='anwenden' class='small_loginform_button'> + </form></td> + </tr> +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/ip/ip_deleg.php b/ldap-site-mngmt/webinterface/ip/ip_deleg.php new file mode 100644 index 00000000..dafdaff6 --- /dev/null +++ b/ldap-site-mngmt/webinterface/ip/ip_deleg.php @@ -0,0 +1,102 @@ +<?php + +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "IP Address Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 2; +$mnr = 3; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "ip_deleg.dwt"; + +include("../class.FastTemplate.php"); + +include("ip_header.inc.php"); + +############################################################################# + +# Menuleiste erstellen +createMainMenu($rollen, $mainnr); +createIPMenu($rollen, $mnr); + +include("ip_blocks.inc.php"); + + +############################################################################# + +$template->assign(array("CHILDOU" => "Noch keine untergeordnete AU angelegt", + "RANGE1" => "", + "RANGE2" => "", + "CHILDDN" => "")); + +$childau_array = get_childau($auDN,array("dn","ou","maxipblock")); +# print_r ($childau_array); + +$template->define_dynamic("Delegs", "Webseite"); +$template->define_dynamic("AUs", "Webseite"); + +foreach ($childau_array as $childau){ + + $template->clear_parse("DELEGS_LIST"); + if ( count($childau['maxipblock']) > 1 ){ + foreach ($childau['maxipblock'] as $j){ + $exp = explode('_',$j); + $template->assign(array("CHILDOU" => $childau['ou'], + "RANGE1" => $exp[0], + "RANGE2" => $exp[1], + "CHILDDN" => $childau['dn'], + "AUDN" => $auDN)); + $template->parse("DELEGS_LIST", ".Delegs"); + $template->clear_dynamic("Delegs"); + } + $template->assign(array("CHILDOU" => $childau['ou'], + "RANGE1" => "", + "RANGE2" => "", + "CHILDDN" => $childau['dn'], + "AUDN" => $auDN)); + $template->parse("DELEGS_LIST", ".Delegs"); + $template->clear_dynamic("Delegs"); + $template->assign(array("OU" => $childau['ou'])); + $template->parse("AUS_LIST", ".AUs"); + + }elseif ( count($childau['maxipblock']) == 1 ){ + + $exp = explode('_',$childau['maxipblock']); + $template->assign(array("CHILDOU" => $childau['ou'], + "RANGE1" => $exp[0], + "RANGE2" => $exp[1], + "CHILDDN" => $childau['dn'], + "AUDN" => $auDN)); + $template->parse("DELEGS_LIST", ".Delegs"); + $template->clear_dynamic("Delegs"); + $template->assign(array("CHILDOU" => $childau['ou'], + "RANGE1" => "", + "RANGE2" => "", + "CHILDDN" => $childau['dn'], + "AUDN" => $auDN)); + $template->parse("DELEGS_LIST", ".Delegs"); + $template->clear_dynamic("Delegs"); + $template->assign(array("OU" => $childau['ou'])); + $template->parse("AUS_LIST", ".AUs"); + + }else{ + $template->assign(array("CHILDOU" => $childau['ou'], + "RANGE1" => "", + "RANGE2" => "", + "CHILDDN" => $childau['dn'], + "AUDN" => $auDN)); + $template->parse("DELEGS_LIST", ".Delegs"); + $template->clear_dynamic("Delegs"); + $template->assign(array("OU" => $childau['ou'])); + $template->parse("AUS_LIST", ".AUs"); + } + +} + + +##################################################################################### + +include("ip_footer.inc.php"); + +?> diff --git a/ldap-site-mngmt/webinterface/ip/ip_deleg_change.php b/ldap-site-mngmt/webinterface/ip/ip_deleg_change.php new file mode 100644 index 00000000..d3fddc03 --- /dev/null +++ b/ldap-site-mngmt/webinterface/ip/ip_deleg_change.php @@ -0,0 +1,198 @@ +<?php + +include('../standard_header.inc.php'); + +$auDN = $_POST['audn']; +$childauDN = $_POST['childaudn']; +$oldrange1 = $_POST['oldrange1']; +$oldrange2 = $_POST['oldrange2']; +$newrange1 = $_POST['range1']; +$newrange2 = $_POST['range2']; + +/* +print_r($oldrange1);echo "<br>"; +print_r($newrange1);echo "<br><br>"; +print_r($oldrange2);echo "<br>"; +print_r($newrange2);echo "<br>"; +print_r($childauDN);echo "<br>"; +print_r($auDN);echo "<br><br>"; +*/ + +$syntax = new Syntaxcheck; +$url = "ip_deleg.php"; + +echo " +<html> +<head> + <title>IP Address Management</title> + <link rel='stylesheet' href='../styles.css' type='text/css'> +</head> +<body> +<table border='0' cellpadding='30' cellspacing='0'> +<tr><td>"; + + +$diff1 = array_keys(array_diff_assoc($oldrange1,$newrange1)); +$diff2 = array_keys(array_diff_assoc($newrange1,$oldrange1)); +$tochange1 = array_unique(array_merge($diff1,$diff2)); + +$diff3 = array_keys(array_diff_assoc($oldrange2,$newrange2)); +$diff4 = array_keys(array_diff_assoc($newrange2,$oldrange2)); +$tochange2 = array_unique(array_merge($diff3,$diff4)); + +# print_r($tochange1);echo "<br><br>"; +# print_r($tochange2);echo "<br><br>"; + +$tochange = array_unique(array_merge($tochange1,$tochange2)); +print_r($tochange);echo "<br><br>"; + + +foreach ($tochange as $i){ + + if ( $oldrange1[$i] == "" && $oldrange2[$i] == "" && $newrange1[$i] != "" && $newrange2[$i] != "" ){ + echo "neuer IP Bereich delegieren ...";echo "<br>";echo "<br>"; + print_r($auDN[$i]);echo "<br>"; + print_r($childauDN[$i]);echo "<br>"; + echo "<br>"; + # echo "alte IP Range: ";print_r($oldrange1[$i]);echo " - ";print_r($oldrange2[$i]);echo "<br>"; + echo "neue IP Range: ";print_r($newrange1[$i]);echo " - ";print_r($newrange2[$i]);echo "<br>"; + + if ($syntax->check_ip_syntax($newrange1[$i]) && $syntax->check_ip_syntax($newrange2[$i])){ + echo "korrekte IP Syntax<br>"; + $newrange1[$i] = htmlentities($newrange1[$i]); + $newrange2[$i] = htmlentities($newrange2[$i]); + $newrange_array = array($newrange1[$i],$newrange2[$i]); + print_r($newrange_array); + $newrange = implode('_',$newrange_array); + print_r($newrange); + # $oldip[$i] = htmlentities($oldip[$i]); + if (new_ip_delegation($newrange,$childauDN[$i],$auDN[$i])){ + echo "Neuer IP Bereich delegiert eingetragen<br>"; + }else{echo "Fehler beim delegieren des neuen IP Bereichs<br>";} + }else{echo "falsche IP Syntax<br>";} + + $mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> + Falls nicht, klicken Sie hier <a href='ip_deleg.php' style='publink'>back</a>"; + redirect(2, $url, $mesg, $addSessionId = TRUE); + } + + elseif ( $oldrange1[$i] != "" && $oldrange2[$i] != "" && $newrange1[$i] == "" && $newrange2[$i] == "" ){ + echo "loeschen IP Delegierung ...";echo "<br>";echo "<br>"; + print_r($auDN[$i]);echo "<br>"; + print_r($childauDN[$i]);echo "<br>"; + echo "<br>"; + echo "alte IP Range: ";print_r($oldrange1[$i]);echo " - ";print_r($oldrange2[$i]);echo "<br>"; + echo "neue IP Range: ";print_r($newrange1[$i]);echo " - ";print_r($newrange2[$i]);echo "<br>"; + + $oldrange1[$i] = htmlentities($oldrange1[$i]); + $oldrange2[$i] = htmlentities($oldrange2[$i]); + $oldip_array = array($oldrange1[$i],$oldrange2[$i]); + $oldrange = implode('_',$oldip_array); + if (delete_ip_delegation($oldrange,$childauDN[$i],$auDN[$i])){ + $mesg = "IP Delegierung geloescht<br>"; + }else{ + $mesg = "Fehler beim loeschen der IP Delegierung<br>"; + } + + $mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> + Falls nicht, klicken Sie hier <a href='ip_deleg.php' style='publink'>back</a>"; + redirect(2, $url, $mesg, $addSessionId = TRUE); + } + + elseif ( $oldrange1[$i] != "" && $oldrange2[$i] != "" && $newrange1[$i] != "" && $newrange2[$i] != "" ){ + $or1 = ip2long($oldrange1[$i]); + $or2 = ip2long($oldrange2[$i]); + $nr1 = ip2long($newrange1[$i]); + $nr2 = ip2long($newrange2[$i]); + + if ( ($nr1 > $or1 || $nr2 < $or2) && !($nr1 < $or1 || $nr2 > $or2) ){ + + echo "reduzieren IP Delegierung";echo "<br>";echo "<br>"; + print_r($auDN[$i]);echo "<br>"; + print_r($childauDN[$i]);echo "<br>"; + echo "alte IP Range: ";print_r($oldrange1[$i]);echo " - ";print_r($oldrange2[$i]);echo "<br>"; + echo "neue IP Range: ";print_r($newrange1[$i]);echo " - ";print_r($newrange2[$i]);echo "<br>"; + + if ($syntax->check_ip_syntax($newrange1[$i]) && $syntax->check_ip_syntax($newrange2[$i])){ + echo "korrekte IP Syntax<br>"; + + $newrange1[$i] = htmlentities($newrange1[$i]); + $newrange2[$i] = htmlentities($newrange2[$i]); + $newrange_array = array($newrange1[$i],$newrange2[$i]); + $newrange = implode('_',$newrange_array); + print_r($newrange); + + $oldrange1[$i] = htmlentities($oldrange1[$i]); + $oldrange2[$i] = htmlentities($oldrange2[$i]); + $oldip_array = array($oldrange1[$i],$oldrange2[$i]); + $oldrange = implode('_',$oldip_array); + print_r($oldrange); + + if (reduce_ip_delegation($oldrange,$newrange,$childauDN[$i],$auDN[$i])){ + $mesg = "IP Range verkleinert<br>"; + }else{ + $mesg = "Fehler beim verkleinern der IP Range<br>"; + } + }else{echo "falsche IP Syntax<br>";} + + $mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> + Falls nicht, klicken Sie hier <a href='ip_deleg.php' style='publink'>back</a>"; + redirect(2, $url, $mesg, $addSessionId = TRUE); + + + }elseif( ($nr1 < $or1 || $nr2 > $or2) && !($nr1 > $or1 || $nr2 < $or2) ){ + + echo "vergroessern IP Delegierung";echo "<br>";echo "<br>"; + print_r($auDN[$i]);echo "<br>"; + print_r($childauDN[$i]);echo "<br>"; + echo "<br>"; + echo "alte IP Range: ";print_r($oldrange1[$i]);echo " - ";print_r($oldrange2[$i]);echo "<br>"; + echo "neue IP Range: ";print_r($newrange1[$i]);echo " - ";print_r($newrange2[$i]);echo "<br>"; + + if ($syntax->check_ip_syntax($newrange1[$i]) && $syntax->check_ip_syntax($newrange2[$i])){ + echo "korrekte IP Syntax<br>"; + $newrange1[$i] = htmlentities($newrange1[$i]); + $newrange2[$i] = htmlentities($newrange2[$i]); + $newrange_array = array($newrange1[$i],$newrange2[$i]); + $newrange = implode('_',$newrange_array); + print_r($newrange); + + $oldrange1[$i] = htmlentities($oldrange1[$i]); + $oldrange2[$i] = htmlentities($oldrange2[$i]); + $oldip_array = array($oldrange1[$i],$oldrange2[$i]); + $oldrange = implode('_',$oldip_array); + print_r($oldrange); + + if (expand_ip_delegation($oldrange,$newrange,$childauDN[$i],$auDN[$i])){ + $mesg = "IP Range erweitert<br>"; + }else{ + $mesg = "Fehler beim erweitern der IP Range<br>"; + } + }else{ + echo "falsche IP Syntax<br>"; + } + $mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> + Falls nicht, klicken Sie hier <a href='ip_deleg.php' style='publink'>back</a>"; + redirect(2, $url, $mesg, $addSessionId = TRUE); + } + else{ + $mesg = "<br>Verschieben (Shiften) der Delegierung nicht moeglich!<br> + Nur Vergroessern und Verkleinern moeglich!<br>"; + $mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> + Falls nicht, klicken Sie hier <a href='ip_deleg.php' style='publink'>back</a>"; + redirect(2, $url, $mesg, $addSessionId = TRUE); + } + } + else{ + $mesg = "keine Aenderung<br>"; + $mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> + Falls nicht, klicken Sie hier <a href='ip_deleg.php' style='publink'>back</a>"; + redirect(2, $url, $mesg, $addSessionId = TRUE); + } +} + +echo " +</td></tr></table> +</head> +</html>"; +?> diff --git a/ldap-site-mngmt/webinterface/ip/ip_dhcp.dwt b/ldap-site-mngmt/webinterface/ip/ip_dhcp.dwt new file mode 100644 index 00000000..b2739df1 --- /dev/null +++ b/ldap-site-mngmt/webinterface/ip/ip_dhcp.dwt @@ -0,0 +1,39 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='2'><h3>Folgende IP Adressen haben Sie in DHCP Ranges vergeben: </h3></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + <tr> + <td width='35%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>DHCP Subnet</b></td> + <td width='65%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Dynamisch zuweisbare IP Adressen (range)</b></td> + </tr> + + <form action='ip_dhcp_change.php' method='post'> + + <!-- BEGIN DYNAMIC BLOCK: Subnets --> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>{SUBNET} </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='range1[]' value='{RANGE1}' size='15' class='medium_form_field'> + - + <input type='Text' name='range2[]' value='{RANGE2}' size='15' class='medium_form_field'> + + <input type='hidden' name='oldrange1[]' value='{RANGE1}'> + <input type='hidden' name='oldrange2[]' value='{RANGE2}'> + <input type='hidden' name='dhcpdn[]' value='{DHCPDN}'> + <input type='hidden' name='audn[]' value='{AUDN}'> + + </td> + </tr> + <!-- END DYNAMIC BLOCK: Subnets --> + + </table></td> + <tr> + <td><input type='Submit' name='apply' value='anwenden' class='small_loginform_button'> + </form></td> + </tr> +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/ip/ip_dhcp.php b/ldap-site-mngmt/webinterface/ip/ip_dhcp.php new file mode 100644 index 00000000..b89d6506 --- /dev/null +++ b/ldap-site-mngmt/webinterface/ip/ip_dhcp.php @@ -0,0 +1,54 @@ +<?php + +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "IP Address Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 2; +$mnr = 2; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "ip_dhcp.dwt"; + +include("../class.FastTemplate.php"); + +include("ip_header.inc.php"); + +############################################################################# + +# Menuleiste erstellen +createMainMenu($rollen, $mainnr); +createIPMenu($rollen, $mnr); + +include("ip_blocks.inc.php"); + + +############################################################################# + +$template->assign(array("SUBNET" => "Noch kein DHCP Objekt angelegt", + "RANGE1" => "", + "RANGE2" => "", + "DHCPDN" => "")); + +$subnet_array = get_subnets($auDN,array("dn","cn","dhcprange")); +# print_r ($subnet_array); + +$template->define_dynamic("Subnets", "Webseite"); + +foreach ($subnet_array as $subnet){ + $exp = explode('_',$subnet['dhcprange']); + + $template->assign(array("SUBNET" => $subnet['cn'], + "RANGE1" => $exp[0], + "RANGE2" => $exp[1], + "DHCPDN" => $subnet['dn'], + "AUDN" => $auDN )); + $template->parse("SUBNETS_LIST", ".Subnets"); +} + + +##################################################################################### + +include("ip_footer.inc.php"); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/ip/ip_dhcp_change.php b/ldap-site-mngmt/webinterface/ip/ip_dhcp_change.php new file mode 100644 index 00000000..43474eec --- /dev/null +++ b/ldap-site-mngmt/webinterface/ip/ip_dhcp_change.php @@ -0,0 +1,146 @@ +<?php + +include('../standard_header.inc.php'); + +$auDN = $_POST['audn']; +$dhcpDN = $_POST['dhcpdn']; +$oldrange1 = $_POST['oldrange1']; +$oldrange2 = $_POST['oldrange2']; +$newrange1 = $_POST['range1']; +$newrange2 = $_POST['range2']; + +/* +print_r($oldrange1);echo "<br>"; +print_r($newrange1);echo "<br><br>"; +print_r($oldrange2);echo "<br>"; +print_r($newrange2);echo "<br>"; +*/ + +$syntax = new Syntaxcheck; +$url = "ip_dhcp.php"; + +echo " +<html> +<head> + <title>IP Address Management</title> + <link rel='stylesheet' href='../styles.css' type='text/css'> +</head> +<body> +<table border='0' cellpadding='30' cellspacing='0'> +<tr><td>"; + + +$diff1 = array_keys(array_diff_assoc($oldrange1,$newrange1)); +$diff2 = array_keys(array_diff_assoc($newrange1,$oldrange1)); +$tochange1 = array_unique(array_merge($diff1,$diff2)); + +$diff3 = array_keys(array_diff_assoc($oldrange2,$newrange2)); +$diff4 = array_keys(array_diff_assoc($newrange2,$oldrange2)); +$tochange2 = array_unique(array_merge($diff3,$diff4)); + +# print_r($tochange1);echo "<br><br>"; +# print_r($tochange2);echo "<br><br>"; + +$tochange = array_unique(array_merge($tochange1,$tochange2)); +# print_r($tochange);echo "<br><br>"; + + +foreach ($tochange as $i){ + + if ( $oldrange1[$i] == "" && $oldrange2[$i] == "" && $newrange1[$i] != "" && $newrange2[$i] != "" ){ + echo "neue IP Range";echo "<br>";echo "<br>"; + print_r($auDN[$i]);echo "<br>"; + print_r($dhcpDN[$i]);echo "<br>"; + echo "<br>"; + echo "alte IP Range: ";print_r($oldrange1[$i]);echo " - ";print_r($oldrange2[$i]);echo "<br>"; + echo "neue IP Range: ";print_r($newrange1[$i]);echo " - ";print_r($newrange2[$i]);echo "<br>"; + + if ($syntax->check_ip_syntax($newrange1[$i]) && $syntax->check_ip_syntax($newrange2[$i])){ + echo "korrekte IP Syntax<br>"; + $newrange1[$i] = htmlentities($newrange1[$i]); + $newrange2[$i] = htmlentities($newrange2[$i]); + $newrange_array = array($newrange1[$i],$newrange2[$i]); + print_r($newrange_array); + $newrange = implode('_',$newrange_array); + print_r($newrange); + # $oldip[$i] = htmlentities($oldip[$i]); + if (new_ip_dhcprange($newrange,$dhcpDN[$i],$auDN[$i])){ + $mesg = "Neue IP Range eingetragen<br>"; + }else{ + $mesg = "Fehler beim eintragen der neuen IP Range<br>"; + } + }else{echo "falsche IP Syntax<br>";} + + $mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> + Falls nicht, klicken Sie hier <a href='ip_dhcp.php' style='publink'>back</a>"; + redirect(4, $url, $mesg, $addSessionId = TRUE); + } + + elseif ( $oldrange1[$i] != "" && $oldrange2[$i] != "" && $newrange1[$i] == "" && $newrange2[$i] == "" ){ + echo "loeschen IP Range";echo "<br>";echo "<br>"; + print_r($auDN[$i]);echo "<br>"; + print_r($dhcpDN[$i]);echo "<br>"; + echo "<br>"; + echo "alte IP Range: ";print_r($oldrange1[$i]);echo " - ";print_r($oldrange2[$i]);echo "<br>"; + echo "neue IP Range: ";print_r($newrange1[$i]);echo " - ";print_r($newrange2[$i]);echo "<br>"; + + $newrange1[$i] = htmlentities($newrange1[$i]); + $newrange2[$i] = htmlentities($newrange2[$i]); + if (delete_ip_dhcprange($dhcpDN[$i],$auDN[$i])){ + $mesg = "IP Range geloescht<br>"; + }else{ + $mesg = "Fehler beim loeschen der IP Range<br>"; + } + + $mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> + Falls nicht, klicken Sie hier <a href='ip_dhcp.php' style='publink'>back</a>"; + redirect(4, $url, $mesg, $addSessionId = TRUE); + } + + elseif ( $oldrange1[$i] != "" && $oldrange2[$i] != "" && $newrange1[$i] != "" && $newrange2[$i] != "" ){ + echo "aendern IP Range";echo "<br>";echo "<br>"; + print_r($auDN[$i]);echo "<br>"; + print_r($dhcpDN[$i]);echo "<br>"; + echo "<br>"; + echo "alte IP Range: ";print_r($oldrange1[$i]);echo " - ";print_r($oldrange2[$i]);echo "<br>"; + echo "neue IP Range: ";print_r($newrange1[$i]);echo " - ";print_r($newrange2[$i]);echo "<br>"; + + if ($syntax->check_ip_syntax($newrange1[$i]) && $syntax->check_ip_syntax($newrange2[$i])){ + echo "korrekte IP Syntax<br>"; + $newrange1[$i] = htmlentities($newrange1[$i]); + $newrange2[$i] = htmlentities($newrange2[$i]); + $newrange_array = array($newrange1[$i],$newrange2[$i]); + $newrange = implode('_',$newrange_array); + print_r($newrange); + $oldrange1[$i] = htmlentities($oldrange1[$i]); + $oldrange2[$i] = htmlentities($oldrange2[$i]); + $oldrange_array = array($oldrange1[$i],$oldrange2[$i]); + $oldrange = implode('_',$oldrange_array); + if (modify_ip_dhcprange($newrange,$dhcpDN[$i],$auDN[$i])){ + $mesg = "IP Range geaendert<br>"; + }else{ + $mesg = "Fehler beim aendern der IP Range<br>"; + # alte Range wiederherstellen + new_ip_dhcprange($oldrange,$dhcpDN[$i],$auDN[$i]); + } + }else{echo "falsche IP Syntax<br>";} + + $mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> + Falls nicht, klicken Sie hier <a href='ip_dhcp.php' style='publink'>back</a>"; + redirect(4, $url, $mesg, $addSessionId = TRUE); + } + + else{ + $mesg = "keine Aenderung<br>"; + $mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> + Falls nicht, klicken Sie hier <a href='ip_dhcp.php' style='publink'>back</a>"; + redirect(4, $url, $mesg, $addSessionId = TRUE); + } + +} + +echo " +</td></tr></table> +</head> +</html>"; +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/ip/ip_footer.inc.php b/ldap-site-mngmt/webinterface/ip/ip_footer.inc.php new file mode 100644 index 00000000..7849823e --- /dev/null +++ b/ldap-site-mngmt/webinterface/ip/ip_footer.inc.php @@ -0,0 +1,19 @@ +<?php + +$template->assign(array("PFAD" => $START_PATH)); + +# Daten in die Vorlage parsen +$template->parse("LOGIN", "Login"); +$template->parse("MAINMENU", "Mmenu"); +$template->parse("NAVIGATION", "Menu"); +$template->parse("IPBLOCKS", "IPBlocks"); +$template->parse("HAUPTFENSTER", "Webseite"); +$template->parse("PAGE", "Vorlage"); + +# Fertige Seite an den Browser senden +$template->FastPrint("PAGE"); + +# Abmelden vom LDAP +ldap_unbind($ds); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/ip/ip_header.inc.php b/ldap-site-mngmt/webinterface/ip/ip_header.inc.php new file mode 100644 index 00000000..96029f43 --- /dev/null +++ b/ldap-site-mngmt/webinterface/ip/ip_header.inc.php @@ -0,0 +1,22 @@ +<?php +include("ip_menu.php"); + +$template = new FastTemplate("."); + +# dem erstellten Template-Objekt eine Vorlage zuweisen +$definedTemplates = array("Vorlage" => "ip.dwt", + "Login" => "../logout_form.inc.dwt", + "Mmenu" => "../hauptmenue.dwt", + "Menu" => "menu.dwt", + "IPBlocks" => "ipblocks.dwt", + "Webseite" => $webseite); +if (isset($additionalTemplates)) { + foreach ($additionalTemplates as $templateKey => $templateFile) { + $definedTemplates[$templateKey] = $templateFile; + } +} +$template->define($definedTemplates); + +$template->assign(array("SEITENTITEL" => $titel, "ROLLE" => "mainadmin", "AU" => $au_ou, "DOMAIN" => $assocdom, "USERCN" => $usercn)); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/ip/ip_menu.php b/ldap-site-mngmt/webinterface/ip/ip_menu.php new file mode 100644 index 00000000..528a4066 --- /dev/null +++ b/ldap-site-mngmt/webinterface/ip/ip_menu.php @@ -0,0 +1,69 @@ +<?php + +function createIPMenu($rollen , $mnr) { + global $template; + global $START_PATH; + # Struktur der Registerkartenleiste + $hauptmenu = array(array("link" => "ip.php", + "text" => "Übersicht", + "zugriff" => "alle"), + array("link" => "ip_rechner.php", + "text" => "IP Adressen Rechner", + "zugriff" => array("MainAdmin","HostAdmin")), + array("link" => "ip_dhcp.php", + "text" => "IP Adressen DHCP", + "zugriff" => array("MainAdmin","HostAdmin","DhcpAdmin")), + array("link" => "ip_deleg.php", + "text" => "Delegierte IP Bereiche", + "zugriff" => array("MainAdmin"))); + + # $rollen = array_keys($roles); + + # Zusammenstellen der Menuleiste + $template->define_dynamic("Hauptmenu", "Menu"); + $i=0; + foreach($hauptmenu as $item) { + if($item['zugriff'] === "alle" || vergleicheArrays($rollen , $item['zugriff'])) { + if ($i==0) { + if ($mnr==0) { + $zwisch=""; + $lastaktive=true; + $farb="#505050"; + } + else { + $zwisch=""; + $farb="#A0A0A0"; + $lastaktive=false; + } + } + else { + if ($mnr==$i) { + $zwisch=""; + $lastaktive=true; + $farb="#505050"; + } + else { + $farb="#A0A0A0"; + if ($lastaktive) {$zwisch="";} + else {$zwisch="";} + $lastaktive=false; + } + } + $template->assign(array("ZWISCHEN" => $zwisch, + "FARBE" => $farb, + "LINK_M" => $item["link"], + "TEXT_M" => $item["text"])); + $template->parse("HAUPTMENU_LIST", ".Hauptmenu"); + + } + $i=$i+1; + } + if ($lastaktive) {$template->assign(array("ENDE" => ""));} + else { + $template->assign(array("ENDE" => "")); + } + +} + + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/ip/ip_rechner.dwt b/ldap-site-mngmt/webinterface/ip/ip_rechner.dwt new file mode 100644 index 00000000..ecadf98a --- /dev/null +++ b/ldap-site-mngmt/webinterface/ip/ip_rechner.dwt @@ -0,0 +1,39 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='2'><h3>Folgende IP Adressen haben Sie an Rechner vergeben: </h3></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + <tr> + <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Rechner Name</b></td> + <td width='70%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>IP Adresse</b></td> + </tr> + + <form action='ip_rechner_change.php' method='post'> + + <!-- BEGIN DYNAMIC BLOCK: Hosts --> + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>{HOSTNAME} </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='newip[]' value='{IP}' size='15' class='medium_form_field'> {DHCPCONT} + <input type='hidden' name='oldip[]' value='{OLDIP}'> + <input type='hidden' name='hostdn[]' value='{HOSTDN}'> + <input type='hidden' name='audn[]' value='{AUDN}'> + + </td> + </tr> + + <!-- END DYNAMIC BLOCK: Hosts --> + + </table></td> + </tr> + <tr> + <td> + <input type='Submit' name='apply' value='anwenden' class='small_loginform_button'></form> + </td> + </tr> +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/ip/ip_rechner.php b/ldap-site-mngmt/webinterface/ip/ip_rechner.php new file mode 100644 index 00000000..66ea23ee --- /dev/null +++ b/ldap-site-mngmt/webinterface/ip/ip_rechner.php @@ -0,0 +1,65 @@ +<?php + +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "IP Address Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 2; +$mnr = 1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "ip_rechner.dwt"; + +include("../class.FastTemplate.php"); + +include("ip_header.inc.php"); + +############################################################################# + +# Menuleiste erstellen +createMainMenu($rollen, $mainnr); +createIPMenu($rollen, $mnr); + +include("ip_blocks.inc.php"); + +############################################################################# + +$template->assign(array("IP" => "", + "OLDIP" => "", + "DHCPCONT" => "", + "HOSTNAME" => "Noch keine Rechner angelegt", + "HOSTDN" => "")); + +$host_array = get_hosts($auDN,array("dn","hostname","ipaddress","dhcphlpcont")); +# print_r ($host_array); + +$template->define_dynamic("Hosts", "Webseite"); + +foreach ($host_array as $host){ + $hostip = explode('_',$host['ipaddress']); + + if ( count($host['dhcphlpcont']) != 0 && $host['ipaddress'] == "" ){ + $subnetCN = explode('cn=',$host['dhcphlpcont']); + $dynsubnet = explode(',', $subnetCN[1]); + $dhcpcont = " DYNAMISCH (DHCP, Subnet $dynsubnet[0])"; + }elseif( count($host['dhcphlpcont']) != 0 && $host['ipaddress'] != "" ){ + $subnetCN = explode('cn=',$host['dhcphlpcont']); + $dynsubnet = explode(',', $subnetCN[1]); + $dhcpcont = " STATISCH (DHCP, Subnet $dynsubnet[0])"; + }else{$dhcpcont = "";} + + $template->assign(array("IP" => $hostip[0], + "OLDIP" => $hostip[0], + "DHCPCONT" => $dhcpcont, + "HOSTNAME" => $host['hostname'], + "HOSTDN" => $host['dn'], + "AUDN" => $auDN )); + $template->parse("HOSTS_LIST", ".Hosts"); +} + + +##################################################################################### + +include("ip_footer.inc.php"); + +?> diff --git a/ldap-site-mngmt/webinterface/ip/ip_rechner_change.php b/ldap-site-mngmt/webinterface/ip/ip_rechner_change.php new file mode 100644 index 00000000..68023cb0 --- /dev/null +++ b/ldap-site-mngmt/webinterface/ip/ip_rechner_change.php @@ -0,0 +1,125 @@ +<?php + +include('../standard_header.inc.php'); + +$auDN = $_POST['audn']; +$hostDN = $_POST['hostdn']; +$oldip = $_POST['oldip']; +$newip = $_POST['newip']; +# print_r($newip);echo "<br>"; +# print_r($oldip);echo "<br>"; + +$syntax = new Syntaxcheck; +$url = "ip_rechner.php"; + +echo " +<html> +<head> + <title>IP Address Management</title> + <link rel='stylesheet' href='../styles.css' type='text/css'> +</head> +<body> +<table border='0' cellpadding='30' cellspacing='0'> +<tr><td>"; + + +$diff1 = array_keys(array_diff_assoc($oldip,$newip)); +$diff2 = array_keys(array_diff_assoc($newip,$oldip)); +$tochange = array_unique(array_merge($diff1,$diff2)); +# print_r($diff1);echo "<br>"; +# print_r($diff2);echo "<br>"; +# print_r($tochange);echo "<br><br>"; + +foreach ($tochange as $i){ + + if ( $oldip[$i] == "" && $newip[$i] != "" ){ + echo "neue IP";echo "<br>";echo "<br>"; + #print_r($auDN[$i]);echo "<br>"; + #print_r($hostDN[$i]);echo "<br>"; + echo "<br>"; + echo "alte IP: ";print_r($oldip[$i]);echo "<br>"; + echo "neue IP: ";print_r($newip[$i]);echo "<br>"; + + if ($syntax->check_ip_syntax($newip[$i])){ + echo "korrekte IP Syntax"; + $newip[$i] = htmlentities($newip[$i]); + $newip_array = array($newip[$i],$newip[$i]); + #print_r($newip_array); + $newipp = implode('_',$newip_array); + #print_r($newipp); + $oldip[$i] = htmlentities($oldip[$i]); + if (new_ip_host($newipp,$hostDN[$i],$auDN[$i])){ + $mesg = "Neue IP Adresse eingetragen<br>"; + }else{$mesg = "Fehler beim eintragen der neuen IP Adresse<br>";} + }else{echo "falsche IP Syntax";} + + $mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> + Falls nicht, klicken Sie hier <a href='ip_rechner.php' style='publink'>back</a>"; + redirect(4, $url, $mesg, $addSessionId = TRUE); + } + + elseif ( $oldip[$i] != "" && $newip[$i] != "" ){ + echo "aendern IP";echo "<br>";echo "<br>"; + #print_r($auDN[$i]);echo "<br>"; + #print_r($hostDN[$i]);echo "<br>"; + echo "<br>"; + echo "alte IP: ";print_r($oldip[$i]);echo "<br>"; + echo "neue IP: ";print_r($newip[$i]);echo "<br>"; + + if ($syntax->check_ip_syntax($newip[$i])){ + echo "korrekte IP Syntax"; + $newip[$i] = htmlentities($newip[$i]); + $newip_array = array($newip[$i],$newip[$i]); + #print_r($newip_array); + $newipp = implode('_',$newip_array); + #print_r($newipp); + $oldip[$i] = htmlentities($oldip[$i]); + $oldip_array = array($oldip[$i],$oldip[$i]); + $oldipp = implode('_',$oldip_array); + if (modify_ip_host($newipp,$hostDN[$i],$auDN[$i])){ + $mesg = "IP Adresse geaendert<br>"; + }else{ + $mesg = "Fehler beim aendern der IP Adresse<br>"; + # oldip die schon gelöscht wurde wieder einfügen + new_ip_host($oldipp,$hostDN[$i],$auDN[$i]);} + }else{echo "falsche IP Syntax";} + + $mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> + Falls nicht, klicken Sie hier <a href='ip_rechner.php' style='publink'>back</a>"; + redirect(4, $url, $mesg, $addSessionId = TRUE); + } + + elseif ( $oldip[$i] != "" && $newip[$i] == "" ){ + echo "loeschen IP";echo "<br>";echo "<br>"; + #print_r($auDN[$i]);echo "<br>"; + #print_r($hostDN[$i]);echo "<br>"; + echo "<br>"; + echo "alte IP: ";print_r($oldip[$i]);echo "<br>"; + echo "neue IP: ";print_r($newip[$i]);echo "<br>"; + + echo "korrekte IP Syntax"; + $newip[$i] = htmlentities($newip[$i]); + $oldip[$i] = htmlentities($oldip[$i]); + if (delete_ip_host($hostDN[$i],$auDN[$i])){ + $mesg = "IP Adresse geloescht<br>"; + }else{$mesg = "Fehler beim loeschen der IP Adresse<br>";} + + $mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> + Falls nicht, klicken Sie hier <a href='ip_rechner.php' style='publink'>back</a>"; + redirect(4, $url, $mesg, $addSessionId = TRUE); + } + + else{ + $mesg = "keine Aenderung<br>"; + $mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> + Falls nicht, klicken Sie hier <a href='ip_rechner.php' style='publink'>back</a>"; + redirect(3, $url, $mesg, $addSessionId = TRUE); + } + +} + +echo " +</td></tr></table> +</head> +</html>"; +?> diff --git a/ldap-site-mngmt/webinterface/ip/ip_start.dwt b/ldap-site-mngmt/webinterface/ip/ip_start.dwt new file mode 100644 index 00000000..b5e4931f --- /dev/null +++ b/ldap-site-mngmt/webinterface/ip/ip_start.dwt @@ -0,0 +1,36 @@ +<table border='0' cellpadding='5' cellspacing='0' width='90%'> + <tr> + <td colspan='2'><h3>Modul - IP Adress Management: </h3></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr> + <td> + <p>Dieses Modul dient der Verwaltung von IP Adressen in ihrer Abteilung. + Benutzen Sie die Navigation links, um die einzelnen Bereiche anzusteuern. <br> + Unterhalb des Navigations-Menue haben Sie stets einen Ueberblick ueber die Ihnen + zugewiesenen IP Bereiche sowie ueber die davon noch frei verfuegbaren IP Adressen.</p> + <p> Folgende Bereiche stehen Ihnen zur Verfuegung:</p> + + <ul> + <li><p><b>IP Adressen Rechner</b></p> + Hier koennen Sie die IP Adressen ihrer Rechner verwalten. Sie koennen IP Adressen neu zuweisen, + aendern oder loeschen. + </li> + <li><p><b>IP Adressen DHCP</b></p> + In diesem Bereich koennen Sie die IP Adressen verwalten, die Sie fuer den DHCP Dienst reservieren. + D.h. die IP Adress Ranges, welche Sie DHCP Subnetzen oder Pools zugewiesen haben zur dynamischen + IP Adresszuweisung. + </li> + <li><p><b>Delegierte IP Adressen</b></p> + In diesem Bereich verwalten Sie ihre an untergeordnete Abteilungen delegierten + IP Adressbereiche. Sie koennen neue IP Bereiche delegieren, Delegierungen aendern oder + ganz zureucknehmen (loeschen). + </li> + </ul> + + </td> + </tr> + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/ip/ipblocks.dwt b/ldap-site-mngmt/webinterface/ip/ipblocks.dwt new file mode 100644 index 00000000..b77f53b3 --- /dev/null +++ b/ldap-site-mngmt/webinterface/ip/ipblocks.dwt @@ -0,0 +1,11 @@ +<table cellpadding='5' cellspacing='0' border='1' width='100%' style='border-width: 0 0 0 0;'> + + <tr align='left'>
+ <td width='8%'></td>
+ <td width='82%' style='border-color: black; border-style: solid; border-width: 1 1 1 1;'>{IPBLOCKS}</td> + <td width='10%'></td> + + </tr> + <tr height='5'></tr>
+ +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/ip/menu.dwt b/ldap-site-mngmt/webinterface/ip/menu.dwt new file mode 100644 index 00000000..34b227c1 --- /dev/null +++ b/ldap-site-mngmt/webinterface/ip/menu.dwt @@ -0,0 +1,22 @@ + +<table cellpadding='0' cellspacing='0' border='0' width='100%'> + + + <!-- BEGIN DYNAMIC BLOCK: Hauptmenu --> + + <tr valign='middle' align='left'> +
+ <td width='8%' align='right' style="border-style=none;"></td> + <td width="8%" align="left" style="border-width:1 0 1 1;border-color:#000000;border-style:solid;padding:5;background-color:{FARBE}"> </td>
+ <td width="74%" align="left" style="border-width:1 1 1 0;border-color:#000000;border-style:solid;padding:5;background-color:{FARBE}"> + <a href="{LINK_M}" style="text-decoration:none"><b class="standard_schrift">{TEXT_M}</b></a></td>
+ <td width='10%'> </td> + + </tr> + + <tr height='5'> + </tr> + +<!-- END DYNAMIC BLOCK: Hauptmenu --> + +</table> diff --git a/ldap-site-mngmt/webinterface/lib/au_management_functions.php b/ldap-site-mngmt/webinterface/lib/au_management_functions.php new file mode 100644 index 00000000..e6f46cfc --- /dev/null +++ b/ldap-site-mngmt/webinterface/lib/au_management_functions.php @@ -0,0 +1,1186 @@ +<?php + +/** +* au_management_functions.php - Administrative Unit Management Funktions-Bibliothek +* Diese Bibliothek enthält alle Funktionen für die Verwaltung von AUs, deren DNS Domains, sowie +* zum Rollen-Management +* +* @param string ldapError +* @param resource ds +* +* @author Tarik Gasmi +* @copyright Tarik Gasmi +*/ + +# Konfiguration laden +require_once("config.inc.php"); + +$ldapError = null; + +######################################################################################################## + + + +############################################################################### +# Funktionen zur Verwaltung der AU (und Child-AUs) +# + + +# Ändern des DN der AU, d.h. beim Ändern des Attributes 'ou' +function modify_au_dn($auDN, $newauDN){ + + global $ds, $suffix, $ldapError; + + if (move_subtree($auDN,$newauDN)){ + adjust_dn_entries($auDN,$newauDN);} +} + + + +# Anlegen neue untergeordnete AU +function new_childau($childDN,$childou,$childcn,$childdesc,$mainadmin){ + + global $ds, $suffix, $auDN, $ldapError; + + $entryAU ["objectclass"][0] = "administrativeunit"; + $entryAU ["objectclass"][1] = "organizationalunit"; + $entryAU ["objectclass"][2] = "top"; + $entryAU ["ou"] = $childou; + if ($childcn != ""){$entryAU ["cn"] = $childcn;} + if ($childdesc != ""){$entryAU ["description"] = $childdesc;} + + if ($resultAU = ldap_add($ds,$childDN,$entryAU)){ + + # alle Au Container anlegen + $containers = array("computers","dhcp","groups","rbs","roles"); + foreach ($containers as $cont){ + $entryCont = array(); + $entryCont ['objectclass'] = "AUContainer"; + $entryCont ['cn'] = $cont; + #print_r($entryRolesCont); echo "<br><br>"; + $resultC = ldap_add($ds,"cn=".$cont.",".$childDN,$entryCont); + if (!($resultC)) break; + } + + # MainAdmin anlegen + $entryMA ['objectclass'] = "groupOfNames"; + $entryMA ['cn'] = "MainAdmin"; + $entryMA ['member'] = $mainadmin; + if ($resultMA = ldap_add($ds,"cn=MainAdmin,cn=roles,".$childDN,$entryMA)){ + $admins = array("HostAdmin","DhcpAdmin","ZoneAdmin"); + foreach ($admins as $admin){ + $entryAdmin ['objectclass'] = "Admins"; + $entryAdmin ['cn'] = $admin; + ldap_add($ds,"cn=".$admin.",cn=roles,".$childDN,$entryAdmin); + } + return 1; + } + else{ + return 0; + } + } + else{ + return 0; + } +} + + + +# Löschen untergeordnete AU (d.h. deren untergeordnete AUs werden als neue uAUs integriert) +function delete_childau($childDN,$childou,$delmodus){ + + global $ds, $suffix, $auDN, $domDN, $assocdom, $ldapError; + + if ( $delmodus == "integrate"){ + + # Associated DNS Domain integrieren + $childdc = get_domain_data($childDN,array("dn","associatedname")); + print_r($childdc); echo "<br>"; + # wenn einzige AU dann einfach in Parentdomain aufnehmen und betroffene Einträge löschen + if (count($childdc[0]['associatedname']) == 1 ){ + echo "einzige AU<br>"; + # dc Childs verschieben + $dcchilds = get_dc_childs($childdc[0]['dn'],array("dn","dc")); + # print_r($dcchilds); echo "<br>"; + if (count($dcchilds) != 0){ + foreach ($dcchilds as $dcc){ + # print_r($dcc['dn']); echo " >> "; print_r("dc=".$dcc['dc'].",".$domDN); echo "<br>"; + if(move_subtree($dcc['dn'],"dc=".$dcc['dc'].",".$domDN)){ + $newdom = $dcc['dc'].".".$assocdom; + #print_r($newdom); echo "<br><br>"; + dive_into_dctree_adapt("dc=".$dcc['dc'].",".$domDN,$newdom); + } + } + } + + # alten dc-Knoten löschen + dive_into_tree_del($childdc[0]['dn'],""); + + } + # wenn noch andere AUs in der Domain, dann nur betroffene Einträge entfernen + if (count($childdc[0]['associatedname']) > 1 ){ + echo "mehrere AUs<br>"; + # ChildAU-Rollen unterhalb dc-Knoten löschen (nur diese)(oder übernehmen: MA zu HA, HA zu HA) + $roles = get_roles($childDN); + #print_r($roles); echo "<br>"; + if(count($roles['MainAdmin']) != 0){ + $mainadmins = $roles['MainAdmin']; + for ($i=0; $i<count($mainadmins); $i++){ + $entryRoleMain ['member'][$i] = $mainadmins[$i]; + } + #print_r($entryRoleHost); echo "<br>"; + $resultMA = ldap_mod_del($ds,"cn=MainAdmin,cn=roles,".$childdc[0]['dn'],$entryRoleMain); + } + if(count($roles['HostAdmin']) != 0){ + $hostadmins = $roles['HostAdmin']; + for ($i=0; $i<count($hostadmins); $i++){ + $entryRoleHost ['member'][$i] = $hostadmins[$i]; + } + #print_r($entryRoleHost); echo "<br>"; + $resultHA = ldap_mod_del($ds,"cn=HostAdmin,cn=roles,".$childdc[0]['dn'],$entryRoleHost); + } + if(count($roles['ZoneAdmin']) != 0){ + $zoneadmins = $roles['ZoneAdmin']; + for ($i=0; $i<count($zoneadmins); $i++){ + $entryRoleZone ['member'][$i] = $zoneadmins[$i]; + } + $resultZA = ldap_mod_del($ds,"cn=ZoneAdmin,cn=roles,".$childdc[0]['dn'],$entryRoleZone); + } + + $entrydel ['associatedname'] = $childDN; + # print_r($entrydel); echo "<br>"; + ldap_mod_del($ds, $childdc[0]['dn'], $entrydel); + $zentries = get_zone_entries_assocname($childdc[0]['dn'],array("dn"),$childDN); + # print_r($zentries); echo "<br>"; + foreach ($zentries as $ze){ + # print_r($ze['dn']); echo "<br>"; + ldap_delete($ds, $ze['dn']); + } + } + + # Rechner (mit IP) + dranhängende MCs, PXEs verschieben + $hosts = get_hosts($childDN,array("dn","hostname")); + if (count($hosts) != 0){ + foreach ($hosts as $host){ + # print_r($host['dn']); echo "<br>"; + # print_r($host['hostname']); echo "<br>"; + # print_r("hostname=".$host['hostname']."-int-".$childou.",cn=computers,".$auDN); echo "<br><br>"; + if (move_subtree($host['dn'], "hostname=".$host['hostname']."-ex-".$childou.",cn=computers,".$auDN)){ + $newhostDN = "hostname=".$host['hostname']."-ex-".$childou.",cn=computers,".$auDN; + $dhcp = get_node_data($newhostDN, array("dhcphlpcont")); + # print_r($dhcp); echo "<br>"; + if ($dhcp['dhcphlpcont'] != ""){ + $entrydel ['dhcphlpcont'] = array(); + $entrydel ['objectclass'] = "dhcpHost"; + # print_r($dhcphlpcont); + ldap_mod_del($ds, $newhostDN, $entrydel); + } + } + } + } + # DHCP Objekte IP Ranges löschen + $subnets = get_subnets($childDN,array("dn")); + # print_r($subnets); echo "<br>"; + if (count($subnets) != 0){ + foreach ($subnets as $subnet){ + # print_r($subnet['dn']); echo "<br>"; + delete_ip_dhcprange($subnet['dn'],$childDN); + } + } # DHCP Pools auch noch + + # Freie IP Bereiche zurücknehmen + $fipb_array = get_freeipblocks_au($childDN); + # print_r($fipb_array); echo "<br>"; + # print_r(count($fipb_array)); echo "<br>"; + if (count($fipb_array) == 1 && $fipb_array[0] != ""){ + $entry_ipblock ['freeipblock'] = $fipb_array[0]; + # print_r($entry_ipblock); echo "<br>"; + ldap_mod_add($ds,$auDN,$entry_ipblock); + } + if (count($fipb_array) > 1 ){ + foreach ($fipb_array as $fipb){ + $entry_ipblock ['FreeIPBlock'][] = $fipb; + # print_r($entry_ipblock); echo "<br>"; + ldap_mod_add($ds,$auDN,$entry_ipblock); + } + } + merge_ipranges($auDN); + + + # Verschieben der Childs an neue Stelle + $child_childs = get_childau($childDN,array("dn","ou")); + # print_r($child_childs); echo "<br>"; + if (count($child_childs) != 0){ + foreach ($child_childs as $cc){ + $child_childDN = $cc['dn']; + $newccDN = "ou=".$cc['ou'].",".$auDN; + # print_r($child_childDN); echo " >> "; + # print_r($newccDN); echo "<br>"; + if (move_subtree($child_childDN,$newccDN)){ + adjust_dn_entries($child_childDN,$newccDN); + } + } + } + + # Löschen des AU Knotens + dive_into_tree_del($childDN,""); + + $mesg = "<br>Erfolgreich gelöscht mit Integration<br>"; + return $mesg; + } + + if ( $delmodus == "complete" ){ + # IP Bereiche zurück + # DNS Teilbaum Objekte löschen + # alles rekursive löschen + + /*if (dive_into_tree_del($dcDN,"")){ + $delentry ['objectclass'] = "domainrelatedobject"; + $delentry ['associateddomain'] = $domsuffix; + #print_r($delentry); echo "<br>"; + $delresult = ldap_mod_del($ds,$childDN,$delentry); + if ($delresult){ + $mesg = "Domain komplett gelöscht<br>"; + }else{$mesg = "Fehler! ldap_mod_del<br>";} + }else{$mesg = "Fehler! dive_into_tree_del<br>";} + */ + $mesg = "Komplettes löschen mometan noch nicht unterstützt.<br> + Nur eine Ebene mit Integration ...<br>"; + return $mesg; + } +} + + + + +############################################################################### +# Funktionen zur Verwaltung von Domains +# + + +# Anlegen Domain beim Anlegen einer Child-AU +function new_child_domain($childdomain, $childDN, $assocdom, $domDN){ + + global $ds, $suffix, $domprefix, $domsuffix, $ldapError; + $domsuffix_actual = $domsuffix; + + # ChildAU in gleicher Domain wie AU + if ( $childdomain == "" || $childdomain == $domprefix ){ + + $entryDC ["associatedname"] = $childDN; + $resultDC = ldap_mod_add($ds,$domDN,$entryDC); + if ($resultDC){ + # HostAdmins übernehmen, welche Admins noch? MainAdmin? + $roles = get_roles($childDN); + if(count($roles['MainAdmin']) != 0){ + $mainadmins = $roles['MainAdmin']; + for ($i=0; $i<count($mainadmins); $i++){ + $entryRoleMain ['member'][$i] = $mainadmins[$i]; + } + #print_r($entryRoleHost); echo "<br>"; + $resultMA = ldap_mod_add($ds,"cn=MainAdmin,cn=roles,".$domDN,$entryRoleMain); + } + if(count($roles['HostAdmin']) != 0){ + $hostadmins = $roles['HostAdmin']; + for ($i=0; $i<count($hostadmins); $i++){ + $entryRoleHost ['member'][$i] = $hostadmins[$i]; + } + #print_r($entryRoleHost); echo "<br>"; + $resultHA = ldap_mod_add($ds,"cn=HostAdmin,cn=roles,".$domDN,$entryRoleHost); + } + # Domainname zu associatedDomain der ChildAU + $entryAD['objectclass'] = "domainRelatedObject"; + $entryAD['associateddomain'] = $assocdom; + $resultAD = ldap_mod_add($ds,$childDN,$entryAD); + if($resultAD){return 1;}else{return 0;} + } + else{return 0;} + } + + # ChildAU in eigner Domain (inklusive Subdomain von AU Domain) + if ( $childdomain != "" && $childdomain != $domprefix ){ + + # entsprechenden DC Knoten anlegen, sowie Roles (MainAdmin, HostAdmin) + $dc_array = explode('.',$childdomain); + $dc_array = array_reverse($dc_array); + $dcDN = "ou=DNS,".$suffix; + # $childdomainfull = $childdomain.".".$domsuffix; + #print_r($dc_array); + foreach ($dc_array as $dc){ + $resultsum = false; + if (check_for_dc($dcDN,$dc)){ + echo "dc <b>".$dc."</b> schon vorhanden ... nächster dc<br>"; + $domsuffix_actual = $dc.".".$domsuffix_actual; + $dcDN = "dc=".$dc.",".$dcDN; + } + else{ + $dcDN = "dc=".$dc.",".$dcDN; + + $entryDC ["objectclass"][0] = "dnsdomain"; + $entryDC ["objectclass"][1] = "domainrelatedobject"; + $entryDC ["objectclass"][2] = "top"; + $entryDC ["dc"] = $dc; + $entryDC ["associatedname"] = $childDN; + $entryDC ["associateddomain"] = $dc.".".$domsuffix_actual; + #print_r($entryDC); echo "<br>"; + #print_r($dcDN); echo "<br><br>"; + $resultDC = ldap_add($ds,$dcDN,$entryDC); + if ($resultDC){ + $domsuffix_actual = $dc.".".$domsuffix_actual; + + #print_r($dcDN); echo"<br><br>"; + + $entryRolesCont ['objectclass'] = "AUContainer"; + $entryRolesCont ['cn'] = "roles"; + #print_r($entryRolesCont); echo "<br><br>"; + $resultRC = ldap_add($ds,"cn=roles,".$dcDN,$entryRolesCont); + if ($resultRC){ + # Rollen eintragen + $roles = get_roles($childDN); + #print_r($roles); echo "<br><br>"; + $mainadmins = $roles['MainAdmin']; + $entryRoleMain ['objectclass'] = "groupOfNames"; + $entryRoleMain ['cn'] = "MainAdmin"; + for ($i=0; $i<count($mainadmins); $i++){ + $entryRoleMain ['member'][$i] = $mainadmins[$i]; + } + #print_r($entryRoleMain); echo "<br>"; + $resultMA = ldap_add($ds,"cn=MainAdmin,cn=roles,".$dcDN,$entryRoleMain); + + $entryRoleHost ['objectclass'] = "Admins"; + $entryRoleHost ['cn'] = "HostAdmin"; + if(count($roles['HostAdmin']) != 0){ + $hostadmins = $roles['HostAdmin']; + for ($i=0; $i<count($hostadmins); $i++){ + $entryRoleHost ['member'][$i] = $hostadmins[$i]; + } + #print_r($entryRoleHost); echo "<br>"; + } + $resultHA = ldap_add($ds,"cn=HostAdmin,cn=roles,".$dcDN,$entryRoleHost); + + $entryRoleZone ['objectclass'] = "Admins"; + $entryRoleZone ['cn'] = "ZoneAdmin"; + $resultZA = ldap_add($ds,"cn=ZoneAdmin,cn=roles,".$dcDN,$entryRoleZone); + + if ($resultMA){$resultsum = true;} + } + } + break; # damit dc-Zuwachs immer nur um eine neue Ebene moeglich + } + } + # Domainname zu associatedDomain der ChildAU + if ($resultsum == true){ + $entryAD['objectclass'] = "domainRelatedObject"; + $entryAD['associateddomain'] = $domsuffix_actual; + $resultAD = ldap_mod_add($ds,$childDN,$entryAD); + } + # fixme: fehlt noch anlegen der INCLUDE-Direktive in der parentdomain + if($resultAD){return 1;} + else{return 0;} + } +} + + +# Domain einer Child-AU ändern +function change_child_domain($childdomain, $oldchilddomain, $childDN, $assocdom, $domDN, $domprefix){ + + global $ds, $suffix, $domsuffix, $ldapError; + #print_r($oldchilddomain); echo "<br>"; + #print_r($domprefix); echo "<br>"; + # dcDNnew + $dcDN = "ou=DNS,".$suffix; + $dc_array = explode('.',$childdomain); + $dc_array = array_reverse($dc_array); + $dcDNnew = ""; + foreach ($dc_array as $dc){ + if (check_for_dc($dcDN,$dc)){ + $dcDN = "dc=".$dc.",".$dcDN; + } + else{ + $dcDN = "dc=".$dc.",".$dcDN; + $dcDNnew .= $dcDN; + break; + } + } + # dcDNold + $dcDNold = "ou=DNS,".$suffix; + $dcold_array = explode('.',$oldchilddomain); + $dcold_array = array_reverse($dcold_array); + foreach ($dcold_array as $dc){ + $dcDNold = "dc=".$dc.",".$dcDNold; + } + + #print_r($dcDNnew); echo "<br>"; + #print_r($dcDNold); echo "<br>"; + # Aus eigener AU Domain heraus in neue nicht AU Domain, d.h. dcDNold = domDN + # Subdomain oder neue Domain anlegen + if ($oldchilddomain == $domprefix){ + + # associatedDomain aus ChildAU entfernen + $entryAD['objectclass'] = "domainRelatedObject"; + $entryAD['associateddomain'] = $assocdom; + #print_r($entryAD); echo "<br>"; + if ($resultAD = ldap_mod_del($ds,$childDN,$entryAD)){ + + # neuen dc Knoten anlegen mit Rollen ... + if(new_child_domain($childdomain, $childDN, $assocdom, $domDN)){ + + # associatedName ChildDN aus altem dc-Knoten entfernen + $entryAN ['associatedname'] = $childDN; + #print_r($entryAN); echo "<br>"; + $result = ldap_mod_del($ds,$domDN,$entryAN); + + # Eigene Rollen aus dc-Knoten enrfernen + $roles = get_roles($childDN); + if(count($roles['MainAdmin']) != 0){ + $mainadmins = $roles['MainAdmin']; + if (count($mainadmins) > 1){ + for ($i=0; $i<count($mainadmins); $i++){ + $entryRoleMain ['member'][$i] = $mainadmins[$i]; + } + }else{ + $entryRoleMain ['member'] = $mainadmins[0]; + } + #print_r($entryRoleMain); echo "<br>"; + $resultMA = ldap_mod_del($ds,"cn=MainAdmin,cn=roles,".$dcDNold,$entryRoleMain); + } + if(count($roles['HostAdmin']) != 0){ + $hostadmins = $roles['HostAdmin']; + if (count($hostadmins) > 1){ + for ($i=0; $i<count($hostadmins); $i++){ + $entryRoleHost ['member'][$i] = $hostadmins[$i]; + } + }else{ + $entryRoleHost ['member'] = $hostadmins[0]; + } + #print_r($entryRoleHost); echo "<br>"; + $resultHA = ldap_mod_del($ds,"cn=HostAdmin,cn=roles,".$dcDNold,$entryRoleHost); + } + if(count($roles['ZoneAdmin']) != 0){ + $zoneadmins = $roles['ZoneAdmin']; + if (count($zoneadmins) > 1){ + for ($i=0; $i<count($zoneadmins); $i++){ + $entryRoleZone ['member'][$i] = $zoneadmins[$i]; + } + }else{ + $entryRoleZone ['member'] = $zoneadmins[0]; + } + #print_r($entryRoleZone); echo "<br>"; + $resultZA = ldap_mod_del($ds,"cn=ZoneAdmin,cn=roles,".$dcDNold,$entryRoleZone); + } + + + # DNS Einträge mit associatedName ChildDN verschieben + $zone_entries = get_zone_entries_assocname($domDN,array("dn","relativedomainname"),$childDN); + #echo "<br>"; print_r($zone_entries); echo "<br>"; + if (count($zone_entries) >= 1){ + foreach ($zone_entries as $ze){ + #print_r($ze['relativedomainname']); echo "<br>"; + #print_r($dcDNnew); echo "<br>"; + move_subtree($ze['dn'], "relativedomainname=".$ze['relativedomainname'].",".$dcDNnew); + $domsuffix = "uni-freiburg.de"; # neu setzen da es beim new_child_domain schon mal hochgezählt wurde + $newassocdom = $childdomain.".".$domsuffix; + $entryZE ['zonename'] = $newassocdom; + #print_r($entryZE); echo "<br>"; + $resultZE = ldap_mod_replace($ds,"relativedomainname=".$ze['relativedomainname'].",".$dcDNnew,$entryZE); + } + } + # fixme: fehlt noch anpassen der INCLUDE-Direktive in der parentdomain + return 1; + } + else{ + return 0; + } + } + else{ + return 0; + } + } + # Aus nicht AU Domain (aber eventuell Subdomain) in nicht AU Domain + # Verschieben des dc-Teilbaumes + if ($oldchilddomain != $domprefix){ + # Verschiebe dc-Baum von dcDNold nach dcDNnew + # dcDNnew + $dcDN = "ou=DNS,".$suffix; + $dc_array = explode('.',$childdomain); + $dc_array = array_reverse($dc_array); + $dcDNnew = ""; + foreach ($dc_array as $dc){ + if (check_for_dc($dcDN,$dc)){ + $dcDN = "dc=".$dc.",".$dcDN; + } + else{ + $dcDN = "dc=".$dc.",".$dcDN; + $dcDNnew .= $dcDN; + break; + } + } + + # dcDNold + $dcDNold = "ou=DNS,".$suffix; + $dcold_array = explode('.',$oldchilddomain); + $dcold_array = array_reverse($dcold_array); + foreach ($dcold_array as $dc){ + $dcDNold = "dc=".$dc.",".$dcDNold; + } + + # dc Baum verschieben + if ($dcDNnew != ""){ + if (move_subtree($dcDNold, $dcDNnew)){ + # rekursives anpassen im neue dc-Baum: + # associatedDomain, zoneName, includeFilename, includeOrigin + $newassocdom = $childdomain.".".$domsuffix; + if(dive_into_dctree_adapt($dcDNnew,$newassocdom)){ + return 1; + # fixme: fehlt noch anpassen der INCLUDE-Direktive in der parentdomain + } + else{ + return 0; + } + } + else{ + return 0; + } + }else{ + echo "Domain existiert schon, bitte anderen Domainnamen wählen!"; + return 0; + } + } +} + +function dive_into_dctree_adapt($dcDNnew,$newassocdom){ + + global $ds, $suffix, $domprefix, $domsuffix, $ldapError; + print_r($dcDNnew); echo "<br>"; + print_r($newassocdom); echo "<br><br>"; + + # associatedDomain in dc-Knoten und in allen (mehrere) associatedName-ou-Knoten + $entryAD['associateddomain'] = $newassocdom; + print_r($entryAD); echo "<br>"; + $resultAD = ldap_mod_replace($ds,$dcDNnew,$entryAD); + #$top_dcDN = str_replace("ou=DNS,","",$dcDNnew); + #print_r($top_dcDN); echo "<br>"; + $assocnames = get_dc_data($dcDNnew,array("associatedname")); # funkt nicht bei uni-freiburg.de + echo "<br>"; print_r($assocnames); echo "<br>"; + if (count($assocnames['associatedname']) > 1){ + foreach ($assocnames['associatedname'] as $aname){ + print_r($aname); echo "<br>"; + $resultAU = ldap_mod_replace($ds,$aname,$entryAD); + } + }else{ + $aname = $assocnames['associatedname']; + print_r($aname); echo "<br>"; + $resultAU = ldap_mod_replace($ds,$aname,$entryAD); + } + + # ZoneName in allen Knoten eine Ebene tiefer + $zone_entries = get_zone_entries($dcDNnew,array("dn","zonename")); + echo "<br>"; print_r($zone_entries); echo "<br>"; + foreach ($zone_entries as $ze){ + $entryZE ['zonename'] = $newassocdom; + print_r($entryZE); echo "<br>"; + $resultZE = ldap_mod_replace($ds,$ze['dn'],$entryZE); + } + + # Zonenamen in Reversezones ... Fehlt noch + + # Rekursion + # child dc für Rekursion + $dcchilds = get_dc_childs($dcDNnew,array("dn","dc")); + echo "<br>"; print_r($dcchilds); echo "<br>"; + foreach ($dcchilds as $dcc){ + $newassocdom = $dcc['dc'].".".$newassocdom; + print_r($dcc['dn']); echo " >> "; print_r($newassocdom); echo "<br>"; + dive_into_dctree_adapt($dcc['dn'],$newassocdom); + } + +} + + +function delete_child_domain($oldchilddomain,$assocdom,$childDN, $domDN, $delmodus){ + + global $ds, $suffix, $domprefix, $domsuffix, $ldapError; + #print_r($domDN); echo "<br>"; + + # dcDNold + $dcDNold = "ou=DNS,".$suffix; + $dcold_array = explode('.',$oldchilddomain); + $dcold_array = array_reverse($dcold_array); + foreach ($dcold_array as $dc){ + $dcDNold = "dc=".$dc.",".$dcDNold; + } + #print_r($dcDNold); echo "<br>"; + # dcDNnew = domDN + + if ( $delmodus == "integrate" ){ + + # associatedNames zu neuem dc-Knoten hinzufügen + $assocnames = get_dc_data($dcDNold,array("associatedname")); # funkt nicht bei uni-freiburg.de + # echo "<br>"; print_r($assocnames); echo "<br>"; + if (count($assocnames['associatedname']) > 1){ + foreach ($assocnames['associatedname'] as $aname){ + #print_r($aname); echo "<br>"; + $entryAN['associatedname'][] = $aname; + } + }else{ + $entryAN['associatedname'] = $assocnames['associatedname']; + $assocname = $assocnames['associatedname']; + $assocnames ['associatedname'] = array($assocname); + } + #print_r($entryAN); echo "<br>"; + $resultAN = ldap_mod_add($ds,$domDN,$entryAN); + if($resultAN){ + + # DNS Einträge verschieben und an neue Domain anpassen + $zone_entries = get_zone_entries($dcDNold,array("dn","relativedomainname")); + #echo "<br>"; print_r($zone_entries); echo "<br>"; + if (count($zone_entries) >= 1){ + foreach ($zone_entries as $ze){ + #print_r($ze['relativedomainname']); echo "<br>"; + #print_r($domDN); echo "<br>"; + move_subtree($ze['dn'], "relativedomainname=".$ze['relativedomainname'].",".$domDN); + $entryZE ['zonename'] = $assocdom; + print_r($entryZE); echo "<br>"; + $resultZE = ldap_mod_replace($ds,"relativedomainname=".$ze['relativedomainname'].",".$domDN,$entryZE); + } + } + + # Rollenmembers kopieren für jeden associatedName (ohne Duplikate zu generieren) + $newdom_roles = get_roles_dns($domDN); + #print_r($newdom_roles); echo "<br>"; + if (count($newdom_roles['MainAdmin']) != 0){$newmainadmins = $newdom_roles['MainAdmin'];}else{$newmainadmins = array();} + if (count($newdom_roles['HostAdmin']) != 0){$newhostadmins = $newdom_roles['HostAdmin'];}else{$newhostadmins = array();} + if (count($newdom_roles['ZoneAdmin']) != 0){$newzoneadmins = $newdom_roles['ZoneAdmin'];}else{$newzoneadmins = array();} + #print_r($newmainadmins); echo "<br>"; + #print_r($newhostadmins); echo "<br>"; + #print_r($newzoneadmins); echo "<br><br>"; + foreach ($assocnames['associatedname'] as $aname){ + #echo "_________________________________________<br>"; + #print_r($aname); echo "<br>"; + $roles = get_roles($aname); + #print_r($roles); echo "<br>"; + $mainadmins = $roles['MainAdmin']; + #print_r($mainadmins); echo "<br>"; + #print_r($newmainadmins); echo "<br>"; + $mainadmins = array_diff($mainadmins, $newmainadmins); + $mainadmins = array_merge($newmainadmins,$mainadmins); + #print_r($mainadmins); echo "<br>"; + if (count($mainadmins) > 1){ + for ($i=0; $i<count($mainadmins); $i++){ + $entryRoleMain ['member'][$i] = $mainadmins[$i]; + } + }else{ + $entryRoleMain ['member'] = $mainadmins[0]; + } + #print_r($entryRoleMain); echo "<br><br>"; + $resultMA = ldap_mod_replace($ds,"cn=MainAdmin,cn=roles,".$domDN,$entryRoleMain); + + if(count($roles['HostAdmin']) != 0){ + $hostadmins = $roles['HostAdmin']; + #print_r($hostadmins); echo "<br>"; + #print_r($newhostadmins); echo "<br>"; + $hostadmins = array_diff($hostadmins, $newhostadmins); + $hostadmins = array_merge($newhostadmins,$hostadmins); + #print_r($hostadmins); echo "<br>"; + if (count($hostadmins) > 1){ + for ($i=0; $i<count($hostadmins); $i++){ + $entryRoleHost ['member'][$i] = $hostadmins[$i]; + } + }else{ + $entryRoleHost ['member'] = $hostadmins[0]; + } + + #print_r($entryRoleHost); echo "<br><br>"; + $resultHA = ldap_mod_replace($ds,"cn=HostAdmin,cn=roles,".$domDN,$entryRoleHost); + + } + if(count($roles['ZoneAdmin']) != 0){ + $zoneadmins = $roles['ZoneAdmin']; + #print_r($zoneadmins); echo "<br>"; + #print_r($newzoneadmins); echo "<br>"; + $zoneadmins = array_diff($zoneadmins, $newzoneadmins); + $zoneadmins = array_merge($newzoneadmins,$zoneadmins); + #print_r($zoneadmins); echo "<br>"; + if (count($zoneadmins) > 1){ + for ($i=0; $i<count($zoneadmins); $i++){ + $entryRoleZone ['member'][$i] = $zoneadmins[$i]; + } + }else{ + $entryRoleZone ['member'] = $zoneadmins[0]; + } + #print_r($entryRoleZone); echo "<br><br>"; + $resultZA = ldap_mod_replace($ds,"cn=ZoneAdmin,cn=roles,".$domDN,$entryRoleZone); + + } + + # associatedDomain anpassen in allen AUs von $assocnames (alt) + $entryAD ['associateddomain'] = $assocdom; + #print_r($entryAD); echo "<br>"; + $resultAD = ldap_mod_replace($ds,$aname,$entryAD); + + #echo "_________________________________________<br>"; + } + + # Falls alter dc-Knoten noch Subdomains, d.h. dc-Teilbäume hat, diese verschieben mit + # rekursivem Anpassen aller Einträge + $dcchilds = get_dc_childs($dcDNold,array("dn","dc")); + #echo "<br><br>"; print_r($dcchilds); echo "<br>"; + if (count($dcchilds) != 0){ + foreach ($dcchilds as $dcc){ + print_r($dcc['dn']); echo " >> "; print_r("dc=".$dcc['dc'].",".$domDN); echo "<br>"; + if(move_subtree($dcc['dn'],"dc=".$dcc['dc'].",".$domDN)){ + $newdom = $dcc['dc'].".".$assocdom; + #print_r($newdom); echo "<br><br>"; + dive_into_dctree_adapt("dc=".$dcc['dc'].",".$domDN,$newdom); + } + } + } + + # alten dc-Knoten entfernen + dive_into_tree_del($dcDNold,""); + + # fixme: fehlt noch löschen der INCLUDE-Direktive in der parentdomain + + } + else{ + return 0; + } + } + + + if ( $delmodus == "complete" ){ + # if (dive_into_tree_del($dcDNold,"")){ + $delentry ['objectclass'] = "domainrelatedobject"; + $delentry ['associateddomain'] = $oldchilddomain.".".$domsuffix; + print_r($delentry); echo "<br>"; + # $delresult = ldap_mod_del($ds,$childDN,$delentry); + # if ($delresult){ + # $mesg = "Domain komplett gelöscht<br>"; + # }else{$mesg = "Fehler! ldap_mod_del<br>";} + # }else{$mesg = "Fehler! dive_into_tree_del<br>";} + } + + # return $mesg; +} + + +/* +function modify_childau_domain($childdomain, $oldchilddomain, $childDN){ + + global $ds, $suffix, $domsuffix, $ldapError; + $dcDN = "ou=DNS,".$suffix; + $dcoldDN = "ou=DNS,".$suffix; + + $dc_array = explode('.',$childdomain); + $dc_array = array_reverse($dc_array); + $dcold_array = explode('.',$oldchilddomain); + $dcold_array = array_reverse($dcold_array); + + foreach ($dcold_array as $dc){ + $dcoldDN = "dc=".$dc.",".$dcoldDN; + $aname = get_dc_data($dcoldDN,array("associatedname")); + if ($aname == $childDN){ + break; + } + } + #print_r($dcoldDN); echo "<br>"; + #print_r($domsuffix); echo "<br>"; + + $dcnewDN = ""; + foreach ($dc_array as $dc){ + if (check_for_dc($dc)){ + # echo "dc <b>".$dc."</b> schon vorhanden ... nächster dc<br>"; + $domsuffix = $dc.".".$domsuffix; + $dcDN = "dc=".$dc.",".$dcDN; + } + else{ + $dcDN = "dc=".$dc.",".$dcDN; + $domsuffix = $dc.".".$domsuffix; + $dcnewDN .= $dcDN; + break; + } + } + #print_r($dcnewDN); echo "<br>"; + #print_r($domsuffix); echo "<br>"; + + if ($dcnewDN != ""){ + if (move_subtree($dcoldDN,$dcnewDN)){ + $entryAD['associateddomain'] = $childdomain.".".$domsuffix; + $resultAD = ldap_mod_replace($ds,$childDN,$entryAD); + $resultAD2 = ldap_mod_replace($ds,$dcnewDN,$entryAD); + if ($resultAD && $resultAD2){return 1;}else{return 0;} + } + }else{ + echo "Domain existiert schon, bitte anderen Domainnamen wählen!"; + } + +} + + +function same_domain($assocdom, $dcDN, $childDN){ + + global $ds, $suffix, $domsuffix, $ldapError; + + $entryDC ["associatedname"] = $childDN; + $resultDC = ldap_mod_add($ds,$dcDN,$entryDC); + if ($resultDC){ + # HostAdmins übernehmen, welche Admins noch? MainAdmin? + $roles = get_roles($childDN); + if(count($roles['HostAdmin']) != 0){ + $hostadmins = $roles['HostAdmin']; + for ($i=0; $i<count($hostadmins); $i++){ + $entryRoleHost ['member'][$i] = $hostadmins[$i]; + } + #print_r($entryRoleHost); echo "<br>"; + $resultHA = ldap_mod_add($ds,"cn=HostAdmin,cn=roles,".$dcDN,$entryRoleHost); + } + # Domainname zu associatedDomain der ChildAU + $entryAD['objectclass'] = "domainRelatedObject"; + $entryAD['associateddomain'] = $assocdom; + $resultAD = ldap_mod_add($ds,$childDN,$entryAD); + if($resultAD){return 1;}else{return 0;} + } + else{return 0;} +} + + +function new_childau_domain($childdomain, $childDN){ + + global $ds, $suffix, $domsuffix, $ldapError; + + # entsprechenden DC Knoten anlegen, sowie Roles (MainAdmin, HostAdmin) + $dc_array = explode('.',$childdomain); + $dc_array = array_reverse($dc_array); + $dcDN = "ou=DNS,".$suffix; + # $childdomainfull = $childdomain.".".$domsuffix; + #print_r($dc_array); + foreach ($dc_array as $dc){ + $resultsum = false; + if (check_for_dc($dc)){ + echo "dc <b>".$dc."</b> schon vorhanden ... nächster dc<br>"; + $domsuffix = $dc.".".$domsuffix; + $dcDN = "dc=".$dc.",".$dcDN; + } + else{ + $dcDN = "dc=".$dc.",".$dcDN; + + $entryDC ["objectclass"][0] = "dnsdomain"; + $entryDC ["objectclass"][1] = "domainrelatedobject"; + $entryDC ["objectclass"][2] = "top"; + $entryDC ["dc"] = $dc; + $entryDC ["associatedname"] = $childDN; + $entryDC ["associateddomain"] = $dc.".".$domsuffix; + #print_r($entryDC); echo "<br>"; + #print_r($dcDN); echo "<br><br>"; + $resultDC = ldap_add($ds,$dcDN,$entryDC); + if ($resultDC){ + $domsuffix = $dc.".".$domsuffix; + + #print_r($dcDN); echo"<br><br>"; + + $entryRolesCont ['objectclass'] = "AUContainer"; + $entryRolesCont ['cn'] = "roles"; + #print_r($entryRolesCont); echo "<br><br>"; + $resultRC = ldap_add($ds,"cn=roles,".$dcDN,$entryRolesCont); + if ($resultRC){ + $roles = get_roles($childDN); + print_r($roles); echo "<br><br>"; + $mainadmins = $roles['MainAdmin']; + $entryRoleMain ['objectclass'] = "groupOfNames"; + $entryRoleMain ['cn'] = "MainAdmin"; + for ($i=0; $i<count($mainadmins); $i++){ + $entryRoleMain ['member'][$i] = $mainadmins[$i]; + } + #print_r($entryRoleMain); echo "<br>"; + $resultMA = ldap_add($ds,"cn=MainAdmin,cn=roles,".$dcDN,$entryRoleMain); + + if(count($roles['HostAdmin']) != 0){ + $hostadmins = $roles['HostAdmin']; + $entryRoleHost ['objectclass'] = "groupOfNames"; + $entryRoleHost ['cn'] = "HostAdmin"; + for ($i=0; $i<count($hostadmins); $i++){ + $entryRoleHost ['member'][$i] = $hostadmins[$i]; + } + #print_r($entryRoleHost); echo "<br>"; + $resultHA = ldap_add($ds,"cn=HostAdmin,cn=roles,".$dcDN,$entryRoleHost); + } + if ($resultMA){$resultsum = true;} + } + } + break; # damit dc-Zuwachs immer nur um eine neue Ebene moeglich + } + } + # Domainname zu associatedDomain der ChildAU + if ($resultsum == true){ + $entryAD['objectclass'] = "domainRelatedObject"; + $entryAD['associateddomain'] = $domsuffix; + $resultAD = ldap_mod_add($ds,$childDN,$entryAD); + } + if($resultAD){return 1;} + else{return 0;} + +} + + + +function delete_childau_domain($oldchilddomain,$childDN,$delmodus){ + + global $ds, $suffix, $domsuffix, $ldapError; + + $dcold_array = explode('.',$oldchilddomain); + $dcold_array = array_reverse($dcold_array); + $dcDN = "ou=DNS,".$suffix; + + foreach ($dcold_array as $dc){ + $dcDN = "dc=".$dc.",".$dcDN; + $aname = get_dc_data($dcDN,array("associatedname")); + $domsuffix = $dc.".".$domsuffix; + + if ($aname == $childDN){ + break; + } + } + #print_r($dcDN); echo "<br>"; + #print_r($domsuffix); echo "<br>"; + + if ( $delmodus == "complete" ){ + if (dive_into_tree_del($dcDN,"")){ + $delentry ['objectclass'] = "domainrelatedobject"; + $delentry ['associateddomain'] = $domsuffix; + #print_r($delentry); echo "<br>"; + $delresult = ldap_mod_del($ds,$childDN,$delentry); + if ($delresult){ + $mesg = "Domain komplett gelöscht<br>"; + }else{$mesg = "Fehler! ldap_mod_del<br>";} + }else{$mesg = "Fehler! dive_into_tree_del<br>";} + } + + if ( $delmodus == "integrate"){ + $mesg = "DNS Integration, noch nicht fertiggestellt"; + } + + return $mesg; +} +*/ + + + + +############################################################################### +# Funktionen für das Rollen Management +# + + +function new_role_member($userDN,$role,$auDN,$domDN){ + + global $ds, $suffix, $ldapError; + + $entry['member'] = $userDN; + + if ($domDN != ""){ + switch ($role){ + case 'MainAdmin': + $roleDN1 = "cn=".$role.",cn=roles,".$auDN; + $roleDN2 = "cn=".$role.",cn=roles,".$domDN; + $results1 = ldap_mod_add($ds,$roleDN1,$entry); + $results2 = ldap_mod_add($ds,$roleDN2,$entry); + if ($results1 && $results2){ + return 1; + }else{ + return 0; + } + break; + case 'HostAdmin': + $roleDN1 = "cn=".$role.",cn=roles,".$auDN; + $roleDN2 = "cn=".$role.",cn=roles,".$domDN; + $results1 = ldap_mod_add($ds,$roleDN1,$entry); + $results2 = ldap_mod_add($ds,$roleDN2,$entry); + if ($results1 && $results2){ + return 1; + }else{ + return 0; + } + break; + case 'DhcpAdmin': + $roleDN = "cn=".$role.",cn=roles,".$auDN; + $results = ldap_mod_add($ds,$roleDN,$entry); + if ($results){ + return 1; + }else{ + return 0; + } + break; + case 'ZoneAdmin': + $roleDN1 = "cn=".$role.",cn=roles,".$auDN; + $roleDN2 = "cn=".$role.",cn=roles,".$domDN; + $results1 = ldap_mod_add($ds,$roleDN1,$entry); + $results2 = ldap_mod_add($ds,$roleDN2,$entry); + if ($results1 && $results2){ + return 1; + }else{ + return 0; + } + break; + } + }else{ + switch ($role){ + case 'MainAdmin': + $roleDN = "cn=".$role.",cn=roles,".$auDN; + $results = ldap_mod_add($ds,$roleDN,$entry); + if ($results){ + return 1; + }else{ + return 0; + } + break; + case 'HostAdmin': + $roleDN = "cn=".$role.",cn=roles,".$auDN; + $results = ldap_mod_add($ds,$roleDN,$entry); + if ($results){ + return 1; + }else{ + return 0; + } + break; + case 'DhcpAdmin': + $roleDN = "cn=".$role.",cn=roles,".$auDN; + $results = ldap_mod_add($ds,$roleDN,$entry); + if ($results){ + return 1; + }else{ + return 0; + } + break; + case 'ZoneAdmin': + $roleDN = "cn=".$role.",cn=roles,".$auDN; + $results = ldap_mod_add($ds,$roleDN,$entry); + if ($results){ + return 1; + }else{ + return 0; + } + break; + } + } +} + + +function delete_role_member($userDN,$role,$auDN,$domDN){ + + global $ds, $suffix, $ldapError; + + $entry['member'] = $userDN; + + if ($domDN != ""){ + switch ($role){ + case 'MainAdmin': + $roleDN1 = "cn=".$role.",cn=roles,".$auDN; + $roleDN2 = "cn=".$role.",cn=roles,".$domDN; + $results1 = ldap_mod_del($ds,$roleDN1,$entry); + $results2 = ldap_mod_del($ds,$roleDN2,$entry); + if ($results1 && $results2){ + return 1; + }else{ + return 0; + } + break; + case 'HostAdmin': + $roleDN1 = "cn=".$role.",cn=roles,".$auDN; + $roleDN2 = "cn=".$role.",cn=roles,".$domDN; + $results1 = ldap_mod_del($ds,$roleDN1,$entry); + $results2 = ldap_mod_del($ds,$roleDN2,$entry); + if ($results1 && $results2){ + return 1; + }else{ + return 0; + } + break; + case 'DhcpAdmin': + $roleDN = "cn=".$role.",cn=roles,".$auDN; + $results = ldap_mod_del($ds,$roleDN,$entry); + if ($results){ + return 1; + }else{ + return 0; + } + break; + case 'ZoneAdmin': + $roleDN1 = "cn=".$role.",cn=roles,".$auDN; + $roleDN2 = "cn=".$role.",cn=roles,".$domDN; + $results1 = ldap_mod_del($ds,$roleDN1,$entry); + $results2 = ldap_mod_del($ds,$roleDN2,$entry); + if ($results1 && $results2){ + return 1; + }else{ + return 0; + } + break; + } + }else{ + switch ($role){ + case 'MainAdmin': + $roleDN = "cn=".$role.",cn=roles,".$auDN; + $results = ldap_mod_del($ds,$roleDN,$entry); + if ($results){ + return 1; + }else{ + return 0; + } + break; + case 'HostAdmin': + $roleDN = "cn=".$role.",cn=roles,".$auDN; + $results = ldap_mod_del($ds,$roleDN,$entry); + if ($results){ + return 1; + }else{ + return 0; + } + break; + case 'DhcpAdmin': + $roleDN = "cn=".$role.",cn=roles,".$auDN; + $results = ldap_mod_del($ds,$roleDN,$entry); + if ($results){ + return 1; + }else{ + return 0; + } + break; + case 'ZoneAdmin': + $roleDN = "cn=".$role.",cn=roles,".$auDN; + $results = ldap_mod_del($ds,$roleDN,$entry); + if ($results){ + return 1; + }else{ + return 0; + } + break; + } + } +} + + +function get_role_members($roleDN) +{ + global $ds, $suffix, $ldapError; + + if(!($result = uniLdapSearch($ds, $roleDN, "objectclass=*", array("member"), "", "one", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "search problem"; + die; + } else { + $members_array = array(); + $result = ldapArraySauber($result); + foreach ($result as $item){ + if (count($item['member']) > 1){ + $members_array = $item['member']; + } + else{ + $members_array[] = $item['member']; + } + } + } + return $members_array; +} + + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/lib/commonlib.inc.php b/ldap-site-mngmt/webinterface/lib/commonlib.inc.php new file mode 100644 index 00000000..32df2a1c --- /dev/null +++ b/ldap-site-mngmt/webinterface/lib/commonlib.inc.php @@ -0,0 +1,552 @@ +<?php + + +/** +* attributesToString($entry, $name, $delemiter = "", $pattern = "", $empty = " ") - +* Gibt die Attribute eines LDAP-Eintrages formatiert aus +* +* Gibt die Attribute des Schlüssels $name des LDAP-Eintraes $entry aus. Mehrere Werte werden mit $delemiter +* voneinander getrennt. Für jeden Wert des Attributes wird in $pattern an die Stelle "$name" (Dallarzeichen plus die Bezeichnung) +* das aktuelle Attribut eingefügt - ähnlich (aber nicht gleich!) der String-Interpretation von PHP. Falls $pattern = "" wird +* einfach der Wert zurück gegeben. Falls für den Schlüssel keine Attribut-Werte definiert sind, wird $empty zurück gegeben +* +* @param array entry LDAP-Array +* @param string name Hashbezeichnung +* @param string delimiter Trennzeichen +* @param string pattern Muster +* @param string empty Zeichen für leere Felder +* +* @return string Array-Werte als String +* +* @author Timothy Burk, lt. Musterlösung +* +*/ + + function attributesToString($entry, $name, $delimiter = "", $pattern = "", $empty = "") { + $buffer = ""; + $name=strtolower($name); + if (isset($entry[$name])) { + $count = $entry[$name]['count']; + for ($i = 0; $i < $count; $i++) { + if ($pattern) { + $tmp = $pattern; + $buffer .= str_replace('$' . $name, $entry[$name][$i], $tmp); + } else { + $buffer .= $entry[$name][$i]; + } + if ($delimiter && ($i + 1) < $count) { + $buffer .= $delimiter; + } + } + } + + if ("" == $buffer && $empty) { + $buffer = $empty; + } + return $buffer; + } + +/* + * oneAttribute($entry, $name, $empty = "", $i = 0) { + * liefert den ($i-ten) Wert des Attributes $name aus $entry + * Eingabe ist entweder ein Datensatz aus dem ldapsearch-Ergebnis, oder + * ein um die Meta-Infos (count) bereinigtes Ergebnis + * sorry für die mangelhafte Doku - Thomas + */ + + function oneAttribute($entry, $name, $empty = "", $i = 0) { + $buffer = ""; + if (isset($entry[$name][$i])) { + $buffer = $entry[$name]; + } else if (isset($entry[$name])) { + $buffer = $entry[$name]; + } + + if ("" == $buffer && $empty) { + $buffer = $empty; + } + return $buffer; + } + + + /** + * redirect($seconds, $url, $msg = "", $addSessionId = TRUE) - leitet den Benutzer auf eine andere Seite weiter + * + * Leitet den Benuzter nach $seconds Sekunden auf die Seite $url weiter. Während der Wartezeit bekommt der Benutzer + * die Information $msg mitgeteilt (Achtung: keine automatische Formatierung der $msg). Wenn $addSessionId TRUE ist, + * dann wird an den URL die SessionId angehängt. + * + * @author Timothy Burk, lt. Musterlösung + */ + + function redirect($seconds, $url, $msg = "", $addSessionId = TRUE) { + if ($addSessionId) { + if (strpos($url, "?") === FALSE) { + $url .= "?"; + } else { + $url .= "&"; + } + $url .= SID; + } + + echo "<html>\n" . + " <head>\n" . + ' <meta http-equiv="refresh" content="' . $seconds . "; URL=$url" . '">' . "\n" . + " </head>\n"; + if ($msg) { + echo " <body>\n" . + $msg . + " </body>\n"; + } + echo "</html>\n"; + } + + + +/** +* getRights($ds, $userDn) - ermittelt die Rechte eines Users. +* +* Die Funktion erwartet ein Directory-Handle und den vollständigen Distiguished Name des +* Users. Rückgabewert ist ein numerisches eindimensionales Array, welches die Rechte enthält. +* +* @param resource ds LDAP Directory Handle +* @param string userDn Distinguishedname des Users +* +* @return array rechte +* +* @author Timothy Burk +*/ + +function getRoles($ds, $userDN) { + global $ldapError, $suffix, $uid; + + if(!($result = uniLdapSearch($ds, "ou=RIPM,".$suffix, "(&(member=$userDN)(cn=*))", array("dn","cn"), "dn", "sub", 0, 0))) { + redirect(5, "index.php", $ldapError, FALSE); + die; + } + $result = ldapArraySauber($result); + $clean = array(); + + foreach($result as $item) { + $dn = ldap_explode_dn($item['dn'], 0); + $dnsub = array_slice($dn,3); + $auDN = implode(',',$dnsub); + $element['au'] = $auDN; + $element['role'] = $item['cn']; + $clean[] = $element; + } + + $res = array(); + foreach($clean as $item){ + $au = $item['au']; + $role = $item['role']; + if(array_key_exists($au,$res)){ + $res[$au][] = $role; + } + else{ + $res[$au] = array($role); + } + } + $i=0; + foreach (array_keys($res) as $key){ + $au_roles[$i]['au'] = $key; + $au_roles[$i]['role'] = $res[$key]; + $i++; + } + return $au_roles; +} + + +/** +* createMenu($rechte) - erstellt die Menuleiste abhängig von der Rechten des Users. +* +* Die Navigationsleiste wird dynamisch erzeugt und von dieser Funktion direkt in das +* entsprechende Template geparst. Dabei werden nur die Schaltflächen zur Verfügung +* gestellt, die der User mit seinen Rechten anzeigen darf. +* +* @param array rechte Eindimensionales Array mit den Rechten des Users +* @param int mainnr Nummer des aktiven Hauptmenus +* +* @author Timothy Burk +*/ + +function createMainMenu($rollen , $mainnr) { + global $template; + global $START_PATH; + + # pre-checks + if ( check_if_max_networks() ){ + $dhcplink = "dhcp/dhcp.php"; + }else{ + $dhcplink = "dhcp/no_dhcp.php"; + } + + # Struktur der Registerkartenleiste + $mainmenu = array(array("link" => "au/au.php", + "text" => "AU Home", + "zugriff" => "alle"), + array("link" => "roles/roles.php", + "text" => "Admin Rollen", + "zugriff" => array("MainAdmin")), + array("link" => "ip/ip.php", + "text" => "IP Management", + "zugriff" => array("MainAdmin","HostAdmin","DhcpAdmin")), + array("link" => "computers/computers.php", + "text" => "Rechner", + "zugriff" => array("MainAdmin","HostAdmin","DhcpAdmin")), + array("link" => "rbs/rbs.php", + "text" => "RemoteBoot/PXE", + "zugriff" => array("MainAdmin","HostAdmin")), + array("link" => $dhcplink, + "text" => "DHCP", + "zugriff" => array("MainAdmin","DhcpAdmin")), + array("link" => "dns/dns.php", + "text" => "DNS", + "zugriff" => array("MainAdmin","ZoneAdmin","HostAdmin"))); + + + # Zusammenstellen der Menuleiste + $template->define_dynamic("Mainmenu", "Mmenu"); + $i=0; + foreach($mainmenu as $item) { + if($item['zugriff'] === "alle" || vergleicheArrays($rollen , $item['zugriff'])) { + if ($i==0) { + if ($mainnr==0) { + $zwisch=""; + $lastaktive=true; + $farb="#505050"; + } + else { + $zwisch=""; + $farb="#A0A0A0"; + $lastaktive=false; + } + } + else { + if ($mainnr==$i) { + $zwisch=""; + $lastaktive=true; + $farb="#505050"; + } + else { + $farb="#A0A0A0"; + if ($lastaktive) {$zwisch="";} + else {$zwisch="";} + $lastaktive=false; + } + } + $template->assign(array("MZWISCHEN" => $zwisch, + "MFARBE" => $farb, + "MLINK_M" => $START_PATH.$item["link"], + "MTEXT_M" => $item["text"])); + $template->parse("MAINMENU_LIST", ".Mainmenu"); + } + $i=$i+1; + } + if ($lastaktive) {$template->assign(array("MENDE" => ""));} + else { + $template->assign(array("MENDE" => "")); + } + +} + + + +/** +* vergleicheArrays($a, $b) - Ermitteln der Schnittmenge zweier Arrays +* +* @param array a +* @param array b +* +* @return boolean TRUE, wenn die Schnittmenge von a und b nicht leer ist, sonst FALSE +* +* @author Timothy Burk +*/ + +function vergleicheArrays($a, $b) { + if((sizeof(array_unique($a)) + sizeof($b)) > sizeof(array_unique(array_merge($a, $b)))) { + return TRUE; + } else { + return FALSE; + } +} + + +/** +* inputArraySauber($Array) +* +* Löscht aus einem Array, welches POST-Daten enthält leere Felder. Nötig für die Formatierung +* vor dem Anlegen neuer Objekte. +* +* @param array _POST-Array +* +* @return array Bereinigtes Array. +* +* @author Timothy Burk +*/ +function inputArraySauber($Array) { + $b = array(); + foreach($Array as $key => $a) { + if(!is_array($a)) { + trim($a); + } + if (!$a == "") { + if(is_array($a)) { + $b[$key] = $a; + } else { + $b[$key] = htmlentities($a); + } + } + } + return $b; +} + + +/** +* numArraySauber($Array) +* +* Löscht aus einemn numerischen Array leere Felder. +* +* @param array Numerisches Array +* +* @return array Bereinigtes Array. +* +* @author Timothy Burk +*/ +function numArraySauber($Array) { + $b = array(); + $arr = array(); + if(!(is_array($Array))) { + $arr[] = $Array; + } else { + $arr = $Array; + } + foreach($arr as $key => $a) { + if (!$a == "") { + $b[] = $a; + } + } + return $b; +} + +/** +* ldapArraySauber($Array, [$delEmpty]) +* +* Bereinigt ein dreidimensionales Array, so wie es aus der Funktion uniLdapSearch kommt. +* Dabei werden alle count-Felder sowie alle numerischen Felder in denen der Schlüssel +* gespeichert ist entfernt. Attributarrays mit nur einem Element werden gelöscht, das Element +* wir als Skalar gespeichert. +* Wenn $delEmpty = TRUE ist, werden nur nichtleere Felder gespeichert. +* +* @param array $Array uniLdapSearch()-Ausgabe +* @param boolean $delEmpty (Standard: $delEmpty = FALSE) +* +* @return array Bereinigtes Array. +* +* @author Timothy Burk +*/ +function ldapArraySauber($Array, $delEmpty = FALSE) { + $b = array(); + foreach($Array as $key => $item) { + if(is_array($item)) { + foreach($item as $key_attr => $attr) { + if(!is_int($key_attr)) { + if(is_array($attr)) { + if($attr['count'] == 1) { + $attr[0] = str_replace(chr(160),"",trim($attr[0])); + if(($delEmpty && $attr[0] != "") || !($delEmpty)) { + $b[$key][$key_attr] = $attr[0]; + } + } else { + for($i=0; $i < $attr['count']; $i++) { + $attr[$i] = str_replace(chr(160),"",trim($attr[$i])); + if(($delEmpty && $attr[$i] != "") || !($delEmpty)) { + $b[$key][$key_attr][$i] = $attr[$i]; + } + } + } + } else { + $attr = str_replace(chr(160),"",trim($attr)); + if(($delEmpty && $attr != "") || !($delEmpty)) { + $b[$key][$key_attr] = $attr; + } + } + } + } + } else { + if(is_int($key)) { + $item = str_replace(chr(160),"",trim($item)); + if(($delEmpty && $item != "") || !($delEmpty)) { + $b[$key] = $item; + } + } + } + } + return $b; +} + +/** +* personOptionen($rechte) +* +* Enthält die möglichen Optionen, die auf einen User angewandt werden können als +* zweidimensionales Array mit folgenden Attributen: +* [ziel]: Aufzurufendes PHP-Skript +* [text]: Beschriftung der Schaltfläche +* [desc]: Beschreibung der Funktion +* [rechte][]: Array mit den erforderlichen Rechten für die jeweilige Option. array("alle") steht für "ohne Einschränkung". +* +* Dieses in dieser Funktion gespeicherte Array wird abhängig von den übergebenen +* Rechten um nicht erlaubte Optionen reduziert und dann ausgegeben. +* +* @param array $rechte Eindimensionales Array $_SESSION['rechte'] +* +* @return array Zweidimensionales Array mit den erlaubten Optionen. +* +* @author Timothy Burk +*/ +function personOptionen($rechte) { + global $utc_uid, $utc_cn, $START_PATH; + $optionen = array(); + $optionen[] = array("ziel" => $START_PATH."person/datensatz.php?aktion=edit", + "text" => "Userdaten bearbeiten", + "desc" => "Anzeigen und Ändern der persönlichen Daten des Users.", + "rechte" => array("writeMitarbeiter"), + "hidden" => array("aktion" => "edit")); + $optionen[] = array("ziel" => $START_PATH."person/datensatz.php", + "text" => "Datensatz löschen", + "desc" => "Der User wird vollständig mit allen Daten aus der Datenbank gelöscht.", + "rechte" => array("writeMitarbeiter"), + "hidden" => array("aktion" => "delete")); + $optionen[] = array("ziel" => $START_PATH."person/datensatz.php", + "text" => "User (de)aktivieren", + "desc" => "Diese Funktion legt einen User durch die Deaktivierung im Archiv ab. Von dort kann der Datensatz weiterhin eingesehen und ggf. reaktiviert werden.", + "rechte" => array("writeMitarbeiter"), + "hidden" => array("aktion" => "archiv")); + $optionen[] = array("ziel" => $START_PATH."person/vertrag_show.php", + "text" => "Verträge bearbeiten", + "desc" => "Bearbeiten oder Anlegen eines Vertrages. Sie können dabei zwischen verschiedenen Vertragsarten wählen.", + "rechte" => array("writeVertrag", "readVertrag")); + $optionen[] = array("ziel" => $START_PATH."urlaub/krank_angabe.php", + "text" => "Krankheitstage", + "desc" => "Krankheitsdaten bearbeiten.", + "rechte" => array("writeKrankheitUrlaub"), + "hidden" => array("uidToChange" => $utc_uid, "GName" => $utc_cn)); + $optionen[] = array("ziel" => $START_PATH."urlaub/liste.php", + "text" => "Urlaubstage anzeigen", + "desc" => "Urlaubstage des Users in grafischer Übersicht anzeigen.", + "rechte" => array("readKrankheitUrlaub"), + "hidden" => array("wer" => $utc_uid, "wann" => "g", "sub" => $utc_cn)); + $optionen[] = array("ziel" => $START_PATH."person/rechte_show.php", + "text" => "Rechte vergeben", + "desc" => "Diese Option dient dazu, dem User bestimmte Rechte zuzuweisen, beispielsweise das Recht Urlaub zu beantragen, Vertragsdaten andere User zu bearbeiten oder einzusehen usw..", + "rechte" => array("writeRechte")); + $optionen[] = array("ziel" => $START_PATH."person/suchen.php", + "text" => "Abbrechen", + "desc" => " ", + "rechte" => array("alle")); + + $opt_reduced = array(); + foreach($optionen as $option) { + if(in_array("alle",$option['rechte']) || vergleicheArrays($option['rechte'],$rechte)) { + array_push($opt_reduced, $option); + } + } + return $opt_reduced; +} + + +/** +* makeArrFromAttribute($a, $attribute) +* +* Ein zweidimensionales Array wird nach der ersten Dimension durchlaufen. +* Dabei werden die Werte des angegebenen Attributes $attribute für alle +* Einträge extrahiert und in einem neuen Array gespeichert, welches +* anschließend zurückgegeben wird. +* +* @param array $a Zweidimensionales Array +* @param string $attribute Schlüsselname der zweiten Dimension +* +* @return array Eindimensionales numerisches Array mit den Attributwerten. +* +* @author Timothy Burk +*/ +function makeArrFromAttribute($a, $attribute) { + $c = array(); + foreach($a as $b) { + $c[] = $b[$attribute]; + } + return $c; +} +?> + +<?php + + +/** +* sortArrayByKey sortiert die 1.Dimension von bis zu 5-dimensionalen Arrays +* nach den Werten in einem beliebigen Schlüssel in beliebiger Dimension +* +* PS: die Funktion sortArrayByKey ist nur sinnvoll, wenn sich die Array-Einträge +* der 1.Dim sehr ähnlich sind, sprich bei Suchergebnissen!! +* +* @param array $array : das zu sortierende Array +* @param string $sortKey : der Schlüssel, nach dem sortiert werden soll +* Bsp.: +* es soll nach $array[$i][$j][$k]['sortkey'] sortiert werden +* => $sortKey = "$j#$k#sortkey" +* @param string $sortDirection : die Sortierrichtung, gültige Werte sind "up", "down" +* +* +* @author Daniel Höfler +*/ +function sortArrayByKey($array, $sortKey, $sortDirection = "up") { + $sortKeyArray = explode("#", $sortKey); + $count = count($sortKeyArray); + if($count < 5) { + switch($count) { + case 0: + foreach($array as $key => $item) { + $toSortKeys[$key] = $item; + } + break; + case 1: + foreach($array as $key => $item) { + $toSortKeys[$key] = $item[$sortKeyArray[0]]; + } + break; + case 2: + foreach($array as $key => $item) { + $toSortKeys[$key] = $item[$sortKeyArray[0]][$sortKeyArray[1]]; + } + break; + case 3: + foreach($array as $key => $item) { + $toSortKeys[$key] = $item[$sortKeyArray[0]][$sortKeyArray[1]][$sortKeyArray[2]]; + } + break; + case 4: + foreach($array as $key => $item) { + $toSortKeys[$key] = $item[$sortKeyArray[0]][$sortKeyArray[1]][$sortKeyArray[2]][$sortKeyArray[3]]; + } + break; + } + } else { + echo "zu viele Dimensionen!! Höchstens 4 Dimensionen möglich"; + return false; + } + if($sortDirection == "up") { + asort($toSortKeys); + } elseif($sortDirection == "down") { + arsort($toSortKeys); + } else { + echo "Keine gültige Sortierrichtung!! Wählen sie \"up\" oder \"down\"\n"; + return false; + } + $sortArray = array(); + foreach($toSortKeys as $key => $item) { + $sortArray[$key] = $array[$key]; + } + return($sortArray); +} + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/lib/config.inc.php b/ldap-site-mngmt/webinterface/lib/config.inc.php new file mode 100644 index 00000000..50d7e465 --- /dev/null +++ b/ldap-site-mngmt/webinterface/lib/config.inc.php @@ -0,0 +1,27 @@ +<?php + + #Pfad festlegen wo die Anwendungsskripte sich befinden + #$START_PATH="http://132.230.4.150/test/"; + #$START_PATH="https://132.230.9.56/lsm/"; + $START_PATH="https://dhcp.uni-freiburg.de/lsm/"; + + # Anlegen einer Variablen für den Speicherort von den CSVs + # $TMPPATH_CSV="/home/gruppe1/public_html/htdocs/"; + + // einige LDAP-Angaben: + // der Anwendungs-LDAP + define('LDAP_HOST', '132.230.9.56'); + define('LDAP_PORT', 389); + $suffix = "dc=uni-freiburg,dc=de"; + $domsuffix = "uni-freiburg.de"; + // der LDAP-Server für die Authentisierung der User + #define('LDAP_HOST_RZ', '132.230.1.61'); + #define('LDAP_PORT_RZ', 636); + #$suffix_rz = "dc=uni-freiburg,dc=de"; + + // einige Sachen, die aus Sicherheitsgründen in produktiven Umgebungen geändert werden sollten!!! + #$dummyUid = "rz-ldap"; // Dummy-User für einige Aktionen - muss angelegt werden!!! + #$dummyPassword = "dummy"; + + #$standardPassword = "dipman02"; // das Passwort mit dem alle User im Anwendungsldap angelegt werden!!! +?> diff --git a/ldap-site-mngmt/webinterface/lib/dhcp_management_functions.php b/ldap-site-mngmt/webinterface/lib/dhcp_management_functions.php new file mode 100644 index 00000000..4194a1b3 --- /dev/null +++ b/ldap-site-mngmt/webinterface/lib/dhcp_management_functions.php @@ -0,0 +1,625 @@ +<?php + +/** +* dhcp_management_functions.php - DHCP Management Funktions-Bibliothek +* Diese Bibliothek enthält alle Funktionen für die Verwaltung des DHCP Dienstes +* +* @param string ldapError +* @param resource ds +* +* @author Tarik Gasmi +* @copyright Tarik Gasmi +*/ + +# Konfiguration laden +require_once("config.inc.php"); + +$ldapError = null; + +################################################################################################### + +# freie x.x.x.0/24 Netzwerke einer AU holen +function get_networks(){ + + global $ds, $suffix, $auDN, $ldapError; + + $networks = array(); + $fipb_array = get_freeipblocks_au($auDN); + foreach ( $fipb_array as $fipb ){ + $exp = explode('_',$fipb); + $fs = explode('.',$exp[0]); + $fe = explode('.',$exp[1]); + #print_r($fs); echo "<br>"; + #print_r($fe); echo "<br>"; + + if ($fs[3] == 0){$networks [] = $exp[0];} + $fs[2] = $fs[2] + 1; + $fs[3] = 0; + + while ( $fs[2] <= $fe[2] ){ + $iprange = implode('_',array(implode('.',$fs),implode('.',$fs))); + if (check_ip_in_iprange($iprange,$fipb)){ + $networks [] = implode('.',$fs); + if ($fs[2] == 255){ $fs[1] = $fs[1] + 1; $fs[2] = 0; } + else{ $fs[2] = $fs[2] + 1; } + } + } + } + #print_r($networks); echo "<br>"; + return $networks; +} + +# Check ob AU über noch freie x.x.x.0/24 Netzwerke verfügt (freie IP Blöcke) +function check_if_free_networks(){ + + global $ds, $suffix, $auDN, $ldapError; + + $networks = 0; + $fipb_array = get_freeipblocks_au($auDN); + if ( $fipb_array[0] != "" ){ + foreach ( $fipb_array as $fipb ){ + $exp = explode('_',$fipb); + $fs = explode('.',$exp[0]); + $fe = explode('.',$exp[1]); + + if ($fs[3] == 0){return 1; break;} + else{ + $fs[2] = $fs[2] + 1; + $fs[3] = 0; + + while ( $fs[2] <= $fe[2] ){ + $iprange = implode('_',array(implode('.',$fs),implode('.',$fs))); + if (check_ip_in_iprange($iprange,$fipb)){ + return 1; break 2; + } + if ($fs[2] == 255){ $fs[1] = $fs[1] + 1; $fs[2] = 0; } + else{ $fs[2] = $fs[2] + 1; } + } + } + } + } + return $networks; +} + +# Check ob AU über x.x.x.0/24 Netzwerke insgesamt verfügt (maximale IP Blöcke) +function check_if_max_networks(){ + + global $ds, $suffix, $auDN, $ldapError; + + $networks = 0; + $mipb_array = get_maxipblocks_au($auDN); + if ( $mipb_array[0] != "" ){ + foreach ( $mipb_array as $mipb ){ + $exp = explode('_',$mipb); + $fs = explode('.',$exp[0]); + $fe = explode('.',$exp[1]); + + if ($fs[3] == 0){return 1; break;} + else{ + $fs[2] = $fs[2] + 1; + $fs[3] = 0; + + while ( $fs[2] <= $fe[2] ){ + $iprange = implode('_',array(implode('.',$fs),implode('.',$fs))); + if (check_ip_in_iprange($iprange,$mipb)){ + return 1; break 2; + } + if ($fs[2] == 255){ $fs[1] = $fs[1] + 1; $fs[2] = 0; } + else{ $fs[2] = $fs[2] + 1; } + } + } + } + } + return $networks; +} + +################################################################################################### + +function get_dhcpoffers($auDN){ + + global $ds, $suffix, $auDN, $ldapError; + + $attribs = array("dn","dhcpofferdn"); + if(!($result = uniLdapSearch($ds, "ou=RIPM,".$suffix, "(objectclass=dhcpService)", $attribs, "dn", "sub", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + else{ + $result = ldapArraySauber($result); + #print_r($result);echo "<br><br>"; + + $dhcp_offers = array(); + foreach ($result as $dhcp){ + if ( strpos($auDN, $dhcp['dhcpofferdn']) !== false ) # && $dhcp['dn'] != $dhcpserviceDN + $dhcp_offers [] = $dhcp['dn']; + } + } + #print_r($dhcp_offers);echo "<br><br>"; + return $dhcp_offers; +} + +function alternative_dhcpservices($dhcpserviceDN){ + + global $ds, $suffix, $auDN, $ldapError; + + $alt_dhcp = array(); + + $dhcparray = get_dhcpoffers($auDN); + # print_r($dhcparray); echo "<br>"; + if (count($dhcparray) != 0){ + for ($i=0; $i < count($dhcparray); $i++){ + if ($dhcparray[$i] != $dhcpserviceDN){ + $exp = ldap_explode_dn ( $dhcparray[$i], 1 ); + $alt = array ("dn" => $dhcparray[$i], "cn" => $exp[0], "au" => " / ".$exp[2]); + $alt_dhcp[] = $alt; + } + } + } + + return $alt_dhcp; +} + +function alternative_dhcpsubnets($dhcpsubnetDN){ + + global $ds, $suffix, $auDN, $ldapError; + + $alt_subnet = array(); + $dhcpservices = get_dhcpoffers($auDN); + #print_r($dhcpservices); echo "<br>"; + if (count($dhcpservices) != 0){ + foreach ($dhcpservices as $servDN){ + $attribs = array("dn","cn","dhcphlpcont"); + #$servDN = $item['dn']; + #print_r($servDN); echo "<br>"; + $filter = "(&(objectclass=dhcpSubnet)(dhcphlpcont=$servDN))"; + if(!($result = uniLdapSearch($ds, "ou=RIPM,".$suffix, $filter, $attribs, "cn", "sub", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + }else{ + $result = ldapArraySauber($result); + #print_r($result); echo "<br>"; + foreach ($result as $subnet){ + if ( check_subnet_mipb($subnet['cn']) && $subnet['dn'] != $dhcpsubnetDN){ + $exp = ldap_explode_dn ( $subnet['dn'], 1 ); + $alt = array ("dn" => $subnet['dn'], "cn" => $exp[0], "au" => " / ".$exp[2]); + $alt_subnet[] = $alt; + } + } + } + + } + } + + return $alt_subnet; +} + +function check_subnet_mipb($subnet){ + + global $ds, $suffix, $auDN, $ldapError; + + $subexp = explode('.',$subnet); + $ret = 0; + $mipb_array = get_maxipblocks_au($auDN); + if ( $mipb_array[0] != "" ){ + foreach ( $mipb_array as $mipb ){ + $exp = explode('_',$mipb); + $ms = explode('.',$exp[0]); + $me = explode('.',$exp[1]); + if ( $subexp[2] >= $ms[2] && $subexp[2] <= $me[2] ){ + $ret = 1; + break; + } + } + } + if ($ret){return 1;} + else{return 0;} + +} + +############################################################################### +# Funktionen zur Verwaltung von DHCP Service Objekten +# + +function add_dhcpservice ($dhcpserviceName,$dhcpoffer,$atts){ + + global $ds, $suffix, $auDN, $ldapError; + + #$dnarray = ldap_explode_dn ( $dhcpserviceDN, 1 ); + $dhcpserviceDN = "cn=".$dhcpserviceName.",cn=dhcp,".$auDN; + + $entrydhcp ['objectclass'][0] = "dhcpService"; + $entrydhcp ['objectclass'][1] = "dhcpOptions"; + $entrydhcp ['objectclass'][2] = "top"; + $entrydhcp ['cn'] = $dhcpserviceName; + $entrydhcp ['dhcpofferdn'] = $dhcpoffer; + + # weitere Attribute + foreach (array_keys($atts) as $key){ + if ($atts[$key] != ""){ + $entrydhcp[$key] = $atts[$key]; + } + } + print_r($entrydhcp); echo "<br>"; + print_r($dhcpserviceDN); echo "<br>"; + + if ($result = ldap_add($ds, $dhcpserviceDN, $entrydhcp)){ + return 1; + } + else{ + $mesg = "Fehler beim eintragen des neuen DHCP Service Objekts!"; + return 0; + } +} + + + +function cleanup_del_dhcpservice ($dhcpserviceDN){ + + global $ds, $suffix, $auDN, $ldapError; + + $filter = "(&(|(objectClass=dhcpSubnet)(objectclass=dhcpHost))(dhcphlpcont=$dhcpserviceDN))"; + if(!($result = uniLdapSearch($ds, "ou=RIPM,".$suffix, $filter, array("dn"), "dn", "sub", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + $result = ldapArraySauber($result); + $delentry ['dhcphlpcont'] = $dhcpserviceDN; + foreach ($result as $item){ + ldap_mod_del($ds, $item['dn'], $delentry); + } +} + + + +function adjust_dhcpservice_dn ($newdhcpserviceDN,$dhcpserviceDN){ + + global $ds, $suffix, $auDN, $ldapError; + + $filter = "(&(|(objectClass=dhcpSubnet)(objectclass=dhcpHost))(dhcphlpcont=$dhcpserviceDN))"; + if(!($result = uniLdapSearch($ds, "ou=RIPM,".$suffix, $filter, array("dn"), "dn", "sub", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + $result = ldapArraySauber($result); + $modentry ['dhcphlpcont'] = $newdhcpserviceDN; + foreach ($result as $item){ + ldap_mod_replace($ds, $item['dn'], $modentry); + } + +} + + + +function alternative_dhcpobjects($objecttype,$objectDN,$ip){ + + global $ds, $suffix, $auDN, $assocdom, $ldapError; + + $alt_dhcp = array(); + $expip = explode('.',$ip); + $subnetDN = ""; + + if ($objecttype == "subnet"){ + # alternative DHCP Dienstobjekte eigene AU/übergeordnete AUs + $servarray = alternative_dhcpservices(""); + #print_r($servarray); echo "<br>"; + if (count($servarray) != 0){ + for ($i=0; $i < count($servarray); $i++){ + $alt_dhcp[] = $servarray[$i]; + } + } + if ($ip == ""){ + # alternative DHCP Subnetzobjekte eigene AU/übergeordnete AUs hinzufügen + $subarray = alternative_dhcpsubnets($objectDN); + #print_r($subarray); + if (count($subarray) != 0){ + for ($i=0; $i < count($subarray); $i++){ + $alt_dhcp[] = $subarray[$i]; + } + } + } + } + + if ($objecttype == "service"){ + # alternative DHCP Dienstobjekte eigene AU/übergeordnete AUs + $servarray = alternative_dhcpservices($objectDN); + #print_r($servarray); echo "<br>"; + if (count($servarray) != 0){ + for ($i=0; $i < count($servarray); $i++){ + $alt_dhcp[] = $servarray[$i]; + } + } + # Subnetz entsprechend IP + $subarray = alternative_dhcpsubnets($objectDN); + #print_r($subarray); + if (count($subarray) != 0){ + for ($i=0; $i < count($subarray); $i++){ + $expsub = explode('.', $subarray[$i]['cn']); + if ($expip[0] == $expsub[0] && $expip[1] == $expsub[1] && $expip[2] == $expsub[2]){ + $alt_dhcp[] = $subarray[$i]; + $subnetDN = $subarray[$i]['dn']; + break; + } + } + } + # falls keine IP weitere Subnetze hinzufügen + #print_r($subarray); + if ( $ip == "" && count($subarray) != 0 ){ + for ($i=0; $i < count($subarray); $i++){ + if ($subnetDN != $subarray[$i]['dn']){ + $alt_dhcp[] = $subarray[$i]; + } + } + } + } + + if ($objecttype == "nodhcp"){ + # alternative DHCP Dienstobjekte eigene AU/übergeordnete AUs + $servarray = alternative_dhcpservices(""); + #print_r($servarray); echo "<br>"; + if (count($servarray) != 0){ + for ($i=0; $i < count($servarray); $i++){ + $alt_dhcp[] = $servarray[$i]; + } + } + # Subnetz entsprechend IP + $subarray = alternative_dhcpsubnets($objectDN); + #print_r($subarray); + if (count($subarray) != 0){ + for ($i=0; $i < count($subarray); $i++){ + $expsub = explode('.', $subarray[$i]['cn']); + if ($expip[0] == $expsub[0] && $expip[1] == $expsub[1] && $expip[2] == $expsub[2]){ + $alt_dhcp[] = $subarray[$i]; + $subnetDN = $subarray[$i]['dn']; + break; + } + } + } + # falls keine IP weitere Subnetze hinzufügen + #print_r($subarray); echo "<br>";print_r($subnetDN); + if ( $ip == "" && count($subarray) != 0 ){ + for ($i=0; $i < count($subarray); $i++){ + if ($subnetDN != $subarray[$i]['dn']){ + $alt_dhcp[] = $subarray[$i]; + } + } + } + } + #echo "<br>";print_r($alt_dhcp); + return $alt_dhcp; +} + + +############################################################################### +# Funktionen zur Verwaltung von DHCP Subnet Objekten +# + +function add_dhcpsubnet ($cn,$dhcpservice,$netmask,$range1,$range2,$atts){ + + global $ds, $suffix, $auDN, $ldapError; + + $cnarray = array($cn,$cn); + $subnet = implode('_',$cnarray); + + # IP checken und FIBS anpassen + $fipb_array = get_freeipblocks_au($auDN); + + for ($i=0; $i < count($fipb_array); $i++){ + if ( split_iprange($subnet,$fipb_array[$i]) != 0 ){ + $ipranges = split_iprange($subnet,$fipb_array[$i]); + array_splice($fipb_array, $i, 1, $ipranges); + break; + } + } + + if ($i < count($fipb_array) ){ + # ldap_mod_replace -> Array fipb_array aktualisiert die FIPB in AU mit $auDN + foreach ( $fipb_array as $item ){ + $entry ['FreeIPBlock'][] = $item; + } + + $results = ldap_mod_replace($ds,$auDN,$entry); + if ($results){ + echo "<br>Neue FIPBs erfolgreich eingetragen!<br>" ; + + $dhcpsubnetDN = "cn=".$cn.",cn=dhcp,".$auDN; + + $entrydhcp ['objectclass'][0] = "dhcpSubnet"; + $entrydhcp ['objectclass'][1] = "dhcpOptions"; + $entrydhcp ['objectclass'][2] = "top"; + $entrydhcp ['cn'] = $cn; + $entrydhcp ['dhcpoptnetmask'] = $netmask; + if ( $dhcpservice != "none" ){ + $entrydhcp ['dhcphlpcont'] = $dhcpservice; + } + # weitere Attribute + foreach (array_keys($atts) as $key){ + if ($atts[$key] != ""){ + $entrydhcp[$key] = $atts[$key]; + } + } + print_r($entrydhcp); echo "<br>"; + print_r($dhcpsubnetDN); echo "<br>"; + + if ($result = ldap_add($ds, $dhcpsubnetDN, $entrydhcp)){ + if ( check_ip_in_subnet($range1,$cn) && check_ip_in_subnet($range2,$cn)){ + $dhcprange = implode('_',array($range1,$range2)); + if ( $range = new_ip_dhcprange($dhcprange,$dhcpsubnetDN,$auDN) ){ + echo "DHCP Range <b>".$range1." - ".$range2."</b> erfolgreich im Subnetobjekt eingetragen"; + }else{ + echo "DHCP Range <b>".$range1." - ".$range2."</b> konnte nicht im Subnetobjekt eingetragen werden!"; + } + return 1; + }else{ + echo "DHCP Range nicht in Subnetz ".$cn." enthalten.<br>Keine DHCP Range angelegt.<br>"; + return 1; + } + }else{ + echo "<br>Fehler beim anlegen des DHCP Subnet Objekts!<br>"; + return 0; + } + }else{ + echo "<br>Fehler beim eintragen der FIPBs!<br>"; + return 0; + } + } + else{ + printf("<br>Subnet %s nicht im verfuegbaren IP Bereich!<br>", $subnet ); + return 0; + } + +} + +function delete_dhcpsubnet($subnetDN,$cn){ + + global $ds, $suffix, $auDN, $ldapError; + + delete_ip_dhcprange($subnetDN,$auDN); + if ( dive_into_tree_del($subnetDN,"") ){ + cleanup_del_dhcpsubnet($subnetDN); + $oldsubnetip = implode("_",array($cn,$cn)); + $entry ['FreeIPBlock'] = $oldsubnetip; + $results = ldap_mod_add($ds,$auDN,$entry); + if ($results){ + merge_ipranges($auDN); + return 1; + }else{ + return 0; + } + }else{ + return 0; + } + +} + +function modify_subnet_dn($subnetDN,$newsubnetDN){ + + global $ds, $suffix, $auDN, $ldapError; + + # check IP-Net-Syntax ... + + # Subnet CNs (IP) in internes Range ".._.." Format bringen + $newcn = ldap_explode_dn($newsubnetDN,1); + $newcnarray = array($newcn[0],$newcn[0]); + $newsubnetip = implode("_",$newcnarray); + $oldcn = ldap_explode_dn($subnetDN,1); + $oldcnarray = array($oldcn[0],$oldcn[0]); + $oldsubnetip = implode("_",$oldcnarray); + + # IP checken und FIBS anpassen + $fipb_array = get_freeipblocks_au($auDN); + for ($i=0; $i < count($fipb_array); $i++){ + if ( split_iprange($newsubnetip,$fipb_array[$i]) != 0 ){ + $ipranges = split_iprange($newsubnetip,$fipb_array[$i]); + array_splice($fipb_array, $i, 1, $ipranges); + break; + } + } + + if ($i < count($fipb_array) ){ + + # zunächst alte DHCP Ranges löschen + delete_ip_dhcprange($subnetDN,$auDN); + # Move Subtree + if(move_subtree($subnetDN, $newsubnetDN)){ + adjust_dhcpsubnet_dn($newsubnetDN, $subnetDN); + printf("<br>Subnet Name (IP) erfolgreich von %s zu %s geändert!<br>", $oldcn[0], $newcn[0]); + # neue Subnetz-IP aus FIPBs entfernen + foreach ( $fipb_array as $item ){ + $entry ['FreeIPBlock'][] = $item; + } + # alte Subnetz-IP in FIPBs integrieren + $entry ['FreeIPBlock'][] = $oldsubnetip; + $results = ldap_mod_replace($ds,$auDN,$entry); + if ($results){ + merge_ipranges($auDN); + echo "<br>FIPBs erfolgreich angepasst!<br>" ; + return 1; + }else{ + echo "<br>Fehler beim Anpassen der FIPBs!<br>" ; + } + }else{ + echo "<br>Fehler beim ändern des Subnet Namens (IP)!<br>" ; + } + }else{ + printf("<br>Neues Subnet %s nicht im verfuegbaren IP Bereich!<br>", $newcn[0] ); + return 0; + } +} + + +function cleanup_del_dhcpsubnet ($dhcpsubnetDN){ + + global $ds, $suffix, $auDN, $ldapError; + + $filter = "(&(objectclass=dhcpHost)(dhcphlpcont=$dhcpsubnetDN))"; + if(!($result = uniLdapSearch($ds, "ou=RIPM,".$suffix, $filter, array("dn"), "dn", "sub", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + $result = ldapArraySauber($result); + $delentry ['dhcphlpcont'] = $dhcpsubnetDN; + foreach ($result as $item){ + ldap_mod_del($ds, $item['dn'], $delentry); + } +} + + + +function adjust_dhcpsubnet_dn ($newdhcpsubnetDN,$dhcpsubnetDN){ + + global $ds, $suffix, $auDN, $ldapError; + + $filter = "(&(objectclass=dhcpHost)(dhcphlpcont=$dhcpsubnetDN))"; + if(!($result = uniLdapSearch($ds, "ou=RIPM,".$suffix, $filter, array("dn"), "dn", "sub", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + $result = ldapArraySauber($result); + $modentry ['dhcphlpcont'] = $newdhcpsubnetDN; + foreach ($result as $item){ + ldap_mod_replace($ds, $item['dn'], $modentry); + } +} + + +# Nach Änderung der Host IP Adresse, überprüfen ob neue IP noch mit Subnet übereinstimmt +# Falls keine Ãœbereinstimmung mehr, dann Subnetzuordnung aus Host löschen. +function adjust_hostip_dhcpsubnet($ip,$hostDN,$dhcphlpcont) { + + global $ds, $suffix, $auDN, $ldapError; + + $subnet = ldap_explode_dn($dhcphlpcont, 1); + $expsub = explode('.', $subnet[0]); + print_r($expsub); echo "<br>"; + $expip = explode('.', $ip); + print_r($expsip); echo "<br>"; + if ($expip[0] != $expsub[0] || $expip[1] != $expsub[1] || $expip[2] != $expsub[2]){ + $entrydhcp ['dhcphlpcont'] = array(); + ldap_mod_del($ds,$hostDN,$entrydhcp); + echo "Host mit neuer IP <b>".$ip."</b> wurde aus DHCP Subnet <b>".$subnet[0]."</b> entfernt<br><br>"; + } +} + +function check_ip_in_subnet($ip,$subnet) { + + global $ds, $suffix, $auDN, $ldapError; + $ipchunks = explode('.',$ip); + $netchunks = explode('.',$subnet); + $return = 0; + for ($i=1; $i<4; $i++){ + if ( $netchunks[$i] == "0" ){ + if ( $ipchunks[$i-1] == $netchunks[$i-1] ){ + $return = 1; + } + break; + } + } + if ($return) { return 1; }else{ return 0; } +} +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/lib/host_management_functions.php b/ldap-site-mngmt/webinterface/lib/host_management_functions.php new file mode 100644 index 00000000..31f358b8 --- /dev/null +++ b/ldap-site-mngmt/webinterface/lib/host_management_functions.php @@ -0,0 +1,385 @@ +<?php + +/** +* host_management_functions.php - Rechner und Gruppen Management Funktions-Bibliothek +* Diese Bibliothek enthält alle Funktionen für die Verwaltung von Rechnern und Rechnergruppen, +* sowie von MachineConfig-Objekten +* +* @param string ldapError +* @param resource ds +* +* @author Tarik Gasmi +* @copyright Tarik Gasmi +*/ + +# Konfiguration laden +require_once("config.inc.php"); + +$ldapError = null; + +################################################################################################### + +############################################################################### +# Funktionen zur Verwaltung von Rechnern +# + +# Ändern des DN des Rechners, d.h. beim Ändern des Attributes 'hostname' +function modify_host_dn($hostDN, $newhostDN){ + + global $ds, $suffix, $auDN, $ldapError; + + if (move_subtree($hostDN,$newhostDN)){ + adjust_dn_entries($hostDN,$newhostDN); + + # Gruppen anpassen in denen Host Member ist + $groups = get_groups_member($auDN,array("dn","member"),$hostDN); + # print_r($groups); echo "<br>"; + if (count($groups != 0)){ + + foreach ($groups as $group){ + #$entry = array("member"); + if ( count($group['member']) > 1 ){ + for($i=0; $i<count($group['member']); $i++){ + if ($hostDN == $group['member'][$i]){ + $entry ['member'][$i] = $newhostDN; + }else{ + $entry ['member'][$i] = $group['member'][$i]; + } + } + # print_r($entry); echo "<br>"; + ldap_mod_replace($ds,$group['dn'],$entry); + } + if ( count($group['member']) == 1 && $group['member'] == $hostDN ){ + $entry['member'] = $newhostDN; + # print_r($entry); echo ""; + ldap_mod_replace($ds,$group['dn'],$entry); + } + } + } + + } +} + + +# Rechner neu anlegen +function add_host($hostDN,$hostname,$hostdesc,$mac,$ip,$atts){ + + global $ds, $suffix, $auDN, $assocdom, $ldapError; + + $entryhost ['objectclass'][0] = "Host"; + $entryhost ['objectclass'][1] = "dhcpHost"; + $entryhost ['objectclass'][2] = "dhcpOptions"; + $entryhost ['objectclass'][3] = "top"; + $entryhost ["hostname"] = $hostname; + $entryhost ["domainname"] = $assocdom; + if ($hostdesc != ""){$entryhost ["description"] = $hostdesc;} + if ($mac != ""){$entryhost ["hwaddress"] = $mac;} + foreach (array_keys($atts) as $key){ + if ($atts[$key] != ""){ + $entryhost[$key] = $atts[$key]; + } + } + + print_r($entryhost); echo "<br>"; + if ($result = ldap_add($ds, $hostDN, $entryhost)){ + + if($ip != ""){ + $syntax = new Syntaxcheck; + if( $syntax->check_ip_syntax($ip) ){ + $newip_array = array($ip,$ip); + $newip = implode('_',$newip_array); + print_r($newip); echo "<br><br>"; + if (new_ip_host($newip,$hostDN,$auDN)){ + echo "IP erfolgreich eingetragen<br><br>"; + }else{ + echo "Fehler beim eintragen der IP<br><br>"; + } + }else{ + echo "Falsche IP Syntax! IP nicht eingetragen"; + } + } + + return 1; + } + else{ + $mesg = "Fehler beim eintragen des neuen Rechners!"; + return 0; + } +} + + +# Rechner löschen +function delete_host($hostDN){ + + global $ds, $suffix, $auDN, $ldapError; + + $hostdata = get_node_data($hostDN,array("hwaddress","ipaddress")); + + # IP Adresse freigeben + if ($hostdata['ipaddress'] != ""){ + delete_ip_host($hostDN,$auDN); + } + + if (dive_into_tree_del($hostDN,"")){ + + # alle DN Objekte in denen Rechner stand ebenfalls löschen + # Member in Groups + $groups = get_groups_member($auDN,array("dn","cn"),$hostDN); + # echo "Rechner aus den Gruppen entfernen: <br>"; print_r($groups); echo "<br>"; + if (count($groups) != 0){ + $entrydel ['member'] = $hostDN; + foreach ($groups as $group){ + echo "Entferne gelöschten Rechner aus Gruppe <b>".$group['cn']."</b> <br>"; + $resultG = ldap_mod_del($ds, $group['dn'], $entrydel); + + # Filename in Gruppen-PXEs + $pxes = get_pxeconfigs($group['dn'],array("dn","cn")); + if ( count($pxes) != 0 && $hostdata['hwaddress'] != ""){ + foreach ($pxes as $pxe){ + $delfilename ['filename'] = "01-".$hostdata['hwaddress']; + $resultP = ldap_mod_del($ds,$pxe['dn'],$delfilename); + echo "Entferne MAC des gelöschten Rechners aus Gruppen-PXE <b>".$pxe['cn']."</b> <br>"; + } + } + } + } + + # DHCP, DNS, RBS Server ... noch todo + # ... + return 1; + } + else{ + return 0; + } +} + + +############################################################################### +# Funktionen zur Verwaltung von Rechnergruppen +# + +# Gruppen DN ändern +function modify_group_dn($groupDN, $newgroupDN){ + + global $ds, $suffix, $ldapError; + + if (move_subtree($groupDN,$newgroupDN)){ + adjust_dn_entries($groupDN,$newgroupDN);} +} + + +# Gruppe neu anlegen +function add_group($groupDN,$groupcn,$groupdesc,$addmember){ + + global $ds, $suffix, $auDN, $assocdom, $ldapError; + + $entrygroup ['objectclass'][0] = "groupOfComputers"; + $entrygroup ['objectclass'][1] = "top"; + $entrygroup ["cn"] = $groupcn; + if ($groupdesc != ""){$entrygroup ["description"] = $groupdesc;} + + # Members anlegen (zuerst 'none' rausnehmen) + $n = array_search('none',$addmember); + if ($n === 0 ){array_splice($addmember, $n, 1);} + + if (count($addmember) != 0){ + $i = 0; + foreach ($addmember as $member){ + $exp = explode('_',$member); + $entrygroup['member'][$i] = $exp[0]; + $i++; + } + } + print_r($entrygroup); echo "<br>"; + + if ($result = ldap_add($ds, $groupDN, $entrygroup)){ + return 1; + } + else{ + return 0; + } +} + + +# Gruppe löschen +function delete_group($groupDN){ + + global $ds, $suffix, $auDN, $ldapError; + + if (dive_into_tree_del($groupDN,"")){ + + # alle DN Objekte in denen Gruppe stand ebenfalls löschen + # DHCP ... noch todo + + return 1; + } + else{ + return 0; + } +} + + +function add_groupmember($groupDN,$member){ + + global $ds, $suffix, $auDN, $ldapError; + +} + + +function delete_groupmember($groupDN,$member){ + + global $ds, $suffix, $auDN, $ldapError; + +} + + +############################################################################### +# Funktionen zur Verwaltung von MachineConfigs +# + +function check_timerange($mcday,$mcbeg,$mcend,$nodeDN,$excepttimerange){ + + global $ds, $suffix, $auDN, $ldapError; + + $brothers = get_machineconfigs($nodeDN,array("timerange")); + # keine Ãœberschneidungen pro Spez.Ebene zulassen + #print_r($brothers); echo "<br><br>"; + if (count($brothers) != 0){ + + $intersect = 0; + foreach ($brothers as $item){ + + # Fall, dass Brother mehrere TimeRanges hat + if (count($item['timerange']) > 1){ + foreach ($item['timerange'] as $tr){ + + if($tr != $excepttimerange){ + $exptime = explode('_',$tr); + $bmcday = $exptime[0]; + $bmcbeg = $exptime[1]; + $bmcend = $exptime[2]; + #echo "mcday:"; print_r($mcday); echo "<br>"; + #echo "bmcday:"; print_r($bmcday); echo "<br>"; + #echo "mcbeg:"; print_r($mcbeg); echo "<br>"; + #echo "bmcbeg:"; print_r($bmcbeg); echo "<br>"; + #echo "mcend:"; print_r($mcend); echo "<br>"; + #echo "bmcend:"; print_r($bmcend); echo "<br>"; + + if ($mcday == $bmcday){ + if ( $mcbeg > $bmcend || $mcend < $bmcbeg ){ + # keine Ãœberschneidung in der Uhrzeit + }else{ + # Uhrzeit Ãœberschneidung + $intersect = 1; + $intersecttr = $bmcday."_".$bmcbeg."_".$bmcend; + break; + } + } + } + + } + } + # Fall, dass Brother nur eine TimeRange hat + elseif (count($item['timerange']) == 1){ + + if($item['timerange'] != $excepttimerange){ + $exptime = explode('_',$item['timerange']); + $bmcday = $exptime[0]; + $bmcbeg = $exptime[1]; + $bmcend = $exptime[2]; + #echo "mcday:"; print_r($mcday); echo "<br>"; + #echo "bmcday:"; print_r($bmcday); echo "<br>"; + #echo "mcbeg:"; print_r($mcbeg); echo "<br>"; + #echo "bmcbeg:"; print_r($bmcbeg); echo "<br>"; + #echo "mcend:"; print_r($mcend); echo "<br>"; + #echo "bmcend:"; print_r($bmcend); echo "<br>"; + + if ($mcday == $bmcday){ + if ( $mcbeg > $bmcend || $mcend < $bmcbeg ){ + # keine Ãœberschneidung in der Uhrzeit + }else{ + # Uhrzeit Ãœberschneidung + $intersect = 1; + $intersecttr = $bmcday."_".$bmcbeg."_".$bmcend; + break; + } + } + } + } + } + #echo "intersect: "; print_r($intersect); echo "<br>"; + if ($intersect == 1){ + echo "<b>[".$mcday."_".$mcbeg."_".$mcend."]</b> überschneidet sich mit der + bereits existierende <b>Time Range [".$intersecttr."]</b> !"; + return 0; + }else{ + return 1; + } + }else{ + return 1; + } +} + + + +function add_mc($mcDN,$mccn,$mctimerange,$mcdesc,$mcattribs){ + + global $ds, $suffix, $auDN, $ldapError; + + $mcentry ['objectclass'][0] = "MachineConfig"; + $mcentry ['objectclass'][1] = "top"; + $mcentry ['cn'] = $mccn; + if ($mctimerange != ""){$mcentry ['timerange'] = $mctimerange;} + if ($mcdesc != ""){$mcentry ['description'] = $mcdesc;} + if ($mcdesc == ""){$mcentry ['description'] = $mccn;} + foreach (array_keys($mcattribs) as $key){ + if ($mcattribs[$key] != ""){ + $mcentry[$key] = $mcattribs[$key]; + } + } + + #print_r($mcentry); echo "<br>"; + #print_r($mcDN); echo "<br>"; + if (ldap_add($ds,$mcDN,$mcentry)){ + return 1; + } + else{ + return 0; + } +} + +# MachineConfig CN (DN) ändern +function modify_mc_dn($mcDN, $newmcDN){ + + global $ds, $suffix, $ldapError; + + if (move_subtree($mcDN,$newmcDN)){ + return 1; + }else{ + return 0; + } +} + +function change_mc_timerange($mcDN,$newmcDN,$mctimerange){ + + global $ds, $suffix, $auDN, $ldapError; + + # move tree + if (move_subtree($mcDN,$newmcDN)){ + # timerange ändern + $entrymc ['timerange'] = $mctimerange; + if (ldap_mod_replace($ds,$newmcDN,$entrymc)){ + return 1; + } + else{ + return 0; + } + } + else{ + return 0; + } +} + + + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/lib/ip_management_functions.php b/ldap-site-mngmt/webinterface/lib/ip_management_functions.php new file mode 100644 index 00000000..b4f4a733 --- /dev/null +++ b/ldap-site-mngmt/webinterface/lib/ip_management_functions.php @@ -0,0 +1,1385 @@ +<?php + +/** +* ip_management_functions.php - IP Management Funktions-Bibliothek +* Diese Bibliothek enthält alle Funktionen für die Verwaltung der IP Adressen. +* +* @param string ldapError +* @param resource ds +* +* @author Tarik Gasmi +* @copyright Tarik Gasmi +*/ + +# Konfiguration laden +require_once("config.inc.php"); + +$ldapError = null; + + +#################################################################################### +# Basisfunktionen zur Verarbeitung von IP Ranges + +/*PHP Funktionen ip2long(), long2ip() machen dasselbe und werden verwendet +function ip_dot_to_long($ip_dot) +{ + $ip_long = unpack('N*', pack('C*', preg_split('/\./',$ip_dot))); + return $ip_long; +} + +function ip_long_to_dot($ip_long) +{ + $ip_dot = join('.',unpack('C*',pack('N',$ip_long))); + return $ip_dot; +}*/ + +/** +* check_ip_in_iprange($iprange1, $iprange2) +* Prueft ob erste IP Range in zweiter IP Range enthalten ist. +* +* @param string iprange1 erste IP Range +* @param string iprange2 zweite IP Range +* +* @return boolean Erfolg bzw. Misserfolg +* +* @author Tarik Gasmi +*/ +function check_ip_in_iprange($iprange1,$iprange2) +{ + $ipr1exploded = explode('_',$iprange1); + $ipr2exploded = explode('_',$iprange2); + $ipr1s = ip2long($ipr1exploded[0]); + $ipr1e = ip2long($ipr1exploded[1]); + $ipr2s = ip2long($ipr2exploded[0]); + $ipr2e = ip2long($ipr2exploded[1]); + + if( $ipr1s >= $ipr2s && $ipr1e <= $ipr2e ){ return 1;} + else{ return 0;} +} + + +/** +* split_iprange($iprange1, $iprange2) +* Entnimmt erste IP Range aus der zweiten IP Range und gibt bei Erfolg Array verbleibender +* IP Ranges zurueck. +* +* @param string iprange1 erste IP Range +* @param string iprange2 zweite IP Range +* +* @return array bei Erfolg bzw. boolean 0 bei Misserfolg +* +* @author Tarik Gasmi +*/ +function split_iprange($iprange1,$iprange2) +{ + $iprange3; + $iprange4; + $ipranges = array(); + + if (check_ip_in_iprange($iprange1,$iprange2) == 1) + { + $ipr1exploded = explode('_',$iprange1); + $ipr2exploded = explode('_',$iprange2); + $ipr1s = ip2long($ipr1exploded[0]); + $ipr1e = ip2long($ipr1exploded[1]); + $ipr2s = ip2long($ipr2exploded[0]); + $ipr2e = ip2long($ipr2exploded[1]); + + $ipr3s = $ipr2s; + $ipr3e = $ipr1s - 1; + $ipr4s = $ipr1e + 1; + $ipr4e = $ipr2e; + + if ($ipr3s <= $ipr3e){$iprange3 = long2ip($ipr3s)."_".long2ip($ipr3e); $ipranges[] = $iprange3;} + if ($ipr4s <= $ipr4e){$iprange4 = long2ip($ipr4s)."_".long2ip($ipr4e); $ipranges[] = $iprange4;} + + return $ipranges; + } + else + { + echo "IPRange1 not in IPRange2: "; + return 0; + } +} + + +/** +* intersect_ipranges($iprange1, $iprange2) +* Bildet die Schnittmenge zweier IP Ranges. +* +* @param string iprange1 erste IP Range +* @param string iprange2 zweite IP Range +* +* @return string iprange3 Schnitt-IP-Range +* +* @author Tarik Gasmi +*/ +function intersect_ipranges($iprange1,$iprange2) +{ + $ipr1exploded = explode('_',$iprange1); + $ipr2exploded = explode('_',$iprange2); + $ipr1s = ip2long($ipr1exploded[0]); + $ipr1e = ip2long($ipr1exploded[1]); + $ipr2s = ip2long($ipr2exploded[0]); + $ipr2e = ip2long($ipr2exploded[1]); + + if ( $ipr1s >= $ipr2s ){$ipr3s = $ipr1s;}else{$ipr3s = $ipr2s;} + if ( $ipr1e <= $ipr2e ){$ipr3e = $ipr1e;}else{$ipr3e = $ipr2e;} + + if ($ipr3s <= $ipr3e){ + $iprange3 = long2ip($ipr3s)."_".long2ip($ipr3e); + return $iprange3; + } + else{ + return ""; + echo "No Intersection<br>"; + } +} + + +/** +* merge_2_ipranges($iprange1, $iprange2) +* Vereinigt 2 IP Ranges zu einer IP Range, falls sie adjazent sind oder sich ueberschneiden. +* +* @param string iprange1 erste IP Range +* @param string iprange2 zweite IP Range +* +* @return string iprange3 bei Erfolg bzw. boolean 0 bei Misserfolg. +* +* @author Tarik Gasmi +*/ +function merge_2_ipranges($iprange1,$iprange2) +{ + + $ipr1exploded = explode('_',$iprange1); + $ipr2exploded = explode('_',$iprange2); + $ipr1s = ip2long($ipr1exploded[0]); + $ipr1e = ip2long($ipr1exploded[1]); + $ipr2s = ip2long($ipr2exploded[0]); + $ipr2e = ip2long($ipr2exploded[1]); + + if ( ($ipr1e + 1) >= $ipr2s && $ipr1s <= ($ipr2e + 1) ){ + if ($ipr1s <= $ipr2s){ $ipr3s = $ipr1s; }else{ $ipr3s = $ipr2s; } + if ($ipr1e <= $ipr2e){ $ipr3e = $ipr2e; }else{ $ipr3e = $ipr1e; } + + if ($ipr3s <= $ipr3e){ + $iprange3 = long2ip($ipr3s)."_".long2ip($ipr3e); + printf("Merging: %s and %s -> %s<br>",$iprange1,$iprange2,$iprange3); + return $iprange3; + } + else{ + # printf("No Merging possible: %s and %s<br>",$iprange1,$iprange2); + return 0; } + } + else{ + # printf("No Merging possible: %s and %s<br>",$iprange1,$iprange2); + return 0; + } +} + + +######################################################################################### +# IP Management LDAP Grundfunktionen + +/** +* get_freeipblocks_au($auDN) +* Holt die FreeIPBlocks einer AU und gibt sie in einem Array zurueck. +* +* @param string auDN Distinguished Name des LDAP AU-Objektes +* +* @return array fipb_array FreeIPBlocks der AU. +* +* @author Tarik Gasmi +*/ +function get_freeipblocks_au($auDN) +{ + global $ds, $suffix, $ldapError; + + if(!($result = uniLdapSearch($ds, $auDN, "objectclass=*", array("FreeIPBlock"), "", "one", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "search problem"; + die; + } else { + $fipb_array = array(); + $result = ldapArraySauber($result); + foreach ($result as $item){ + if (count($item['freeipblock']) > 1){ + $fipb_array = $item['freeipblock']; + } + else{ + $fipb_array[] = $item['freeipblock']; + } + } + } + return $fipb_array; +} + +/** +* get_maxipblocks_au($auDN) +* Holt die MaxIPBlocks einer AU und gibt sie in einem Array zurueck. +* +* @param string auDN Distinguished Name des LDAP AU-Objektes +* +* @return array mipb_array MaxIPBlocks der AU. +* +* @author Tarik Gasmi +*/ +function get_maxipblocks_au($auDN) +{ + global $ds, $suffix, $ldapError; + + if(!($result = uniLdapSearch($ds, $auDN, "objectclass=*", array("MaxIPBlock"), "", "one", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "search problem"; + die; + } else { + $result = ldapArraySauber($result); + foreach ($result as $item){ + if (count($item['maxipblock']) > 1){ + $mipb_array = $item['maxipblock']; + } + else{ + $mipb_array[] = $item['maxipblock']; + } + } + } + return $mipb_array; +} + + +/** +* get_host_ip($hostDN) +* Holt die IP Adressen eines Hosts und gibt sie in einem Array zurueck. +* +* @param string hostDN Distinguished Name des LDAP Host-Objektes +* +* @return array host_array IPs des Hosts. +* +* @author Tarik Gasmi +*/ +function get_host_ip($hostDN) +{ + global $ds, $suffix, $ldapError; + + if(!($result = uniLdapSearch($ds, $hostDN, "(objectclass=Host)", array("hostName","IPAddress","dhcpOptFixed-address"), "hostName", "one", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + return 0; + } + else { + $result = ldapArraySauber($result); + $host_array = array(); + + foreach ($result as $item){ + $host_array['hostname'] = $item['hostname']; + $host_array['ipaddress'] = $item['ipaddress']; + #if ( $item['dhcpoptfixed-address'] != "" ){ + $host_array['dhcpoptfixed-address'] = $item['dhcpoptfixed-address']; + #} + # $host_array = array('hostname' => $item['hostname'], 'ipaddress' => $item['ipaddress']); + } + return $host_array; + } +} + + +/** +* get_dhcp_range($dhcpobjectDN) +* Holt die IP Ranges eines DHCP Subnets/Pools und gibt sie in einem Array zurueck. +* +* @param string dhcpobjectDN Distinguished Name des LDAP DHCP-Objektes +* +* @return array dhcp_array IP Ranges des Subnets/Pools. +* +* @author Tarik Gasmi +*/ +function get_dhcp_range($dhcpobjectDN) +{ + global $ds, $suffix, $ldapError; + + if(!($result = uniLdapSearch($ds, $dhcpobjectDN, "(objectclass=*)", array("cn","dhcpRange"), "cn", "one", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + return 0; + } + else { + $result = ldapArraySauber($result); + $dhcp_array = array(); + + foreach ($result as $item){ + $dhcp_array['cn'] = $item['cn']; + $dhcp_array['dhcprange'] = $item['dhcprange']; + } + return $dhcp_array; + } +} + + +/** +* merge_ipranges($auDN) +* Nimmt die Arrays von IP Ranges eines AU Objektes, MaxIPBlocks und FreeIPBlocks, und vereinigt +* rekusriv alle adjazenten/sich ueberschneidenden IP Ranges zu einer IP Range. +* +* @param string auDN Distinguished Name des LDAP AU-Objektes +* +* @author Tarik Gasmi +*/ +function merge_ipranges($auDN) +{ + global $ds, $suffix, $ldapError; + + $fipb_array = get_freeipblocks_au($auDN); + $mipb_array = get_maxipblocks_au($auDN); + if ( count($fipb_array) > 1) sort($fipb_array); + if ( count($mipb_array) > 1) sort($mipb_array); + + $c = count($fipb_array); + for ($i=0; $i < $c; $i++){ + for ($j=$i+1; $j < $c; $j++){ + if ( merge_2_ipranges($fipb_array[$i],$fipb_array[$j])){ + $fipb_array[$i] = merge_2_ipranges($fipb_array[$i],$fipb_array[$j]); + array_splice($fipb_array, $j, 1); + $c--; + $i=-1; + break; + } + } + } + print_r($fipb_array);printf("<br>"); + foreach ( $fipb_array as $item ){ + $entry ['FreeIPBlock'][] = $item; + } + $results = ldap_mod_replace($ds,$auDN,$entry); + if ($results) echo "<br>FIPBs erfolgreich zusammengefasst!<br><br>" ; + else echo "<br>Fehler beim eintragen der FIPBs!<br><br>"; + + $d = count($mipb_array); + for ($i=0; $i < $d; $i++){ + for ($j=$i+1; $j < $d; $j++){ + if ( merge_2_ipranges($mipb_array[$i],$mipb_array[$j])){ + $mipb_array[$i] = merge_2_ipranges($mipb_array[$i],$mipb_array[$j]); + array_splice($mipb_array, $j, 1); + $d--; + $i=-1; + break; + } + } + } + print_r($mipb_array);printf("<br>"); + foreach ( $mipb_array as $item ){ + $entry2 ['MaxIPBlock'][] = $item; + } + $results = ldap_mod_replace($ds,$auDN,$entry2); + if ($results) echo "<br>MIPBs erfolgreich zusammengefasst!<br><br>" ; + else echo "<br>Fehler beim eintragen der MIPBs!<br><br>"; +} + + +/** +* new_ip_host($ip,$hostDN,$auDN) +* Weist einem Host eine IP Adresse neu zu, falls sie vergeben werden darf (in den FreeIPBlocks +* enthalten ist), und passt die FreeIPBlocks der AU an. +* +* @param string ip IP Adresse, die zugewiesen werden soll +* @param string hostDN Distinguished Name des LDAP Host-Objektes +* @param string auDN Distinguished Name des LDAP AU-Objektes +* +* @return boolean 1 bei Erfolg bzw. 0 bei Misserfolg +* +* @author Tarik Gasmi +*/ +function new_ip_host($ip,$hostDN,$auDN) +{ + global $ds, $suffix, $ldapError; + + $fipb_array = get_freeipblocks_au($auDN); + + for ($i=0; $i < count($fipb_array); $i++){ + if ( split_iprange($ip,$fipb_array[$i]) != 0 ){ + $ipranges = split_iprange($ip,$fipb_array[$i]); + array_splice($fipb_array, $i, 1, $ipranges); + break; + } + } + + if ($i < count($fipb_array) ){ + # ldap_mod_replace -> Array fipb_array aktualisiert die FIPB in AU mit $auDN + foreach ( $fipb_array as $item ){ + $entry ['FreeIPBlock'][] = $item; + } + + $results = ldap_mod_replace($ds,$auDN,$entry); + if ($results){ + echo "<br>Neue FIPBs erfolgreich eingetragen!<br>" ; + + # ldap_mod_add -> IPAddress = $ip , in Host mit $hostDN + $ipentry ['IPAddress'] = $ip; + $results = ldap_mod_add($ds,$hostDN,$ipentry); + if ($results){ + echo "<br>IP Adresse erfolgreich eingetragen!<br>" ; + return 1; + }else{ + echo "<br>Fehler beim eintragen der IP Adresse!<br>"; + return 0; + } + }else{ + echo "<br>Fehler beim eintragen der FIPBs!<br>"; + return 0; + } + } + else{ + printf("<br>IP Adresse %s nicht im verfuegbaren Bereich!<br>", $ip ); + return 0; + } +} + +/** +* new_ip_dhcprange($ip,$dhcpobjectDN,$auDN) +* Weist einem DHCP Subnet/Pool eine IP Range neu zu, falls sie vergeben werden darf (in den FreeIPBlocks +* enthalten ist), und passt die FreeIPBlocks der AU an. +* +* @param string ip IP Range, die zugewiesen werden soll +* @param string dhcpobjectDN Distinguished Name des LDAP DHCP-Objektes +* @param string auDN Distinguished Name des LDAP AU-Objektes +* +* @return boolean 1 bei Erfolg bzw. 0 bei Misserfolg +* +* @author Tarik Gasmi +*/ +function new_ip_dhcprange($ip,$dhcpobjectDN,$auDN) +{ + global $ds, $suffix, $ldapError; + + $fipb_array = get_freeipblocks_au($auDN); + + print_r($fipb_array); + + for ($i=0; $i < count($fipb_array); $i++){ + if ( split_iprange($ip,$fipb_array[$i]) != 0 ){ + $ipranges = split_iprange($ip,$fipb_array[$i]); + array_splice($fipb_array, $i, 1, $ipranges); + break; + } + } + + if ($i < count($fipb_array) ){ + # ldap_mod_replace -> Array fipb_array aktualisiert die FIPB in AU mit $auDN + foreach ( $fipb_array as $item ){ + $entry ['FreeIPBlock'][] = $item; + } + + $results = ldap_mod_replace($ds,$auDN,$entry); + if ($results){ + echo "<br>Neue FIPBs erfolgreich eingetragen!<br>" ; + + # ldap_mod_add -> IPAddress = $ip , in Host mit $hostDN + $ipentry ['dhcpRange'] = $ip; + $results = ldap_mod_add($ds,$dhcpobjectDN,$ipentry); + if ($results){ + echo "<br>IP Adresse erfolgreich eingetragen!<br>" ; + return 1; + }else{ + echo "<br>Fehler beim eintragen der IP Adresse!<br>"; + return 0; + } + }else{ + echo "<br>Fehler beim eintragen der FIPBs!<br>"; + return 0; + } + }else{ + printf("<br>IP Range %s ist nicht im verfuegbaren Bereich!<br>", $ip ); + return 0; + } +} + +/** +* delete_ip_host($hostDN,$auDN) +* Löscht die IP Adresse eines Hosts, und passt die FreeIPBlocks der AU an. +* +* @param string hostDN Distinguished Name des LDAP Host-Objektes +* @param string auDN Distinguished Name des LDAP AU-Objektes +* +* @return boolean 1 bei Erfolg bzw. 0 bei Misserfolg +* +* @author Tarik Gasmi +*/ +function delete_ip_host($hostDN,$auDN) +{ + global $ds, $suffix, $ldapError; + + $host_array = get_host_ip($hostDN); + $old_ip = $host_array['ipaddress']; # oder IP aus dem Formular + # print_r($host_array);printf("<br>"); + # printf($old_ip); + $delentry ['ipaddress'] = $old_ip; + if ( $host_array['dhcpoptfixed-address'] != "" ){ + $delentry ['dhcpoptfixed-address'] = array(); + } + # print_r($delentry);printf("<br>"); + + $results = ldap_mod_del($ds,$hostDN,$delentry); + if ($results){ + echo "<br>IP Adresse erfolgreich geloescht!<br>"; + $modentry['FreeIPBlock'] = $old_ip; + $results = ldap_mod_add($ds,$auDN,$modentry); + if ($results){ + echo "<br>geloeschte IP Adresse erfolgreich als neuer FIPB in die AU eingetragen!<br>" ; + merge_ipranges($auDN); + return 1; + } + else{ + echo "<br>Fehler beim eintragen der geloeschten IP Adresse als neuen FIPB!<br>"; + return 0; + } + } + else{ + echo "<br>Fehler beim loeschen der IP Adresse!<br>"; + return 0; + } +} + +/** +* delete_ip_dhcprange($dhcpobjectDN,$auDN) +* Loescht die IP Range eines DHCP Subnets/Pools, und passt die FreeIPBlocks der AU an. +* +* @param string dhcpobjectDN Distinguished Name des LDAP DHCP-Objektes +* @param string auDN Distinguished Name des LDAP AU-Objektes +* +* @return boolean 1 bei Erfolg bzw. 0 bei Misserfolg +* +* @author Tarik Gasmi +*/ +function delete_ip_dhcprange($dhcpobjectDN,$auDN) +{ + global $ds, $suffix, $ldapError; + + $dhcp_array = get_dhcp_range($dhcpobjectDN); + + if ( $dhcp_array['dhcprange'] != "" ){ + $old_ip = $dhcp_array['dhcprange']; # oder IP aus dem Formular besser da ja mehrere moeglich + # print_r($dhcp_array);printf("<br>"); + # printf($old_ip); + $delentry['dhcpRange'] = $old_ip; + # print_r($delentry);printf("<br>"); + + $results = ldap_mod_del($ds,$dhcpobjectDN,$delentry); + if ($results){ + echo "<br>DHCP IP Range erfolgreich geloescht!<br>"; + $modentry['FreeIPBlock'] = $old_ip; + $results = ldap_mod_add($ds,$auDN,$modentry); + if ($results){ + echo "<br>geloeschte IP Range erfolgreich als neuer FIPB in die AU eingetragen!<br>" ; + merge_ipranges($auDN); + return 1; + } + else{ + echo "<br>Fehler beim eintragen der geloeschten IP Range als neuen FIPB!<br>"; + # Transaktion simulieren und alte Range wieder eintragen ?? + return 0; + } + } + else{ + echo "<br>Fehler beim loeschen der DHCP IP Range!<br>"; + return 0; + } + } +} + +/** +* modify_ip_host($ip,$hostDN,$auDN) +* Aendert die IP Adresse eines Hosts, falls neue IP verfuegbar, und passt die FreeIPBlocks der AU an. +* +* @param string ip IP Adresse, die neu zugewiesen werden soll +* @param string hostDN Distinguished Name des LDAP Host-Objektes +* @param string auDN Distinguished Name des LDAP AU-Objektes +* +* @return boolean 1 bei Erfolg bzw. 0 bei Misserfolg +* +* @author Tarik Gasmi +*/ +function modify_ip_host($ip,$hostDN,$auDN) +{ + global $ds, $suffix, $ldapError; + + if ( delete_ip_host($hostDN,$auDN) ){ + if ( new_ip_host($ip,$hostDN,$auDN) ){ + echo "<br>IP Adresse erfolgeich geaendert!<br>"; + return 1; + }else{ + echo "<br>Fehler beim Aendern der IP Adresse!<br>"; + return 0; + } + }else{ + echo "<br>Fehler beim Aendern der IP Adresse!<br>"; + return 0; + } +} + +/** +* modify_ip_dhcprange($ip,$dhcpobjectDN,$auDN) +* Aendert IP Range eines DHCP Subnet/Pool, falls neue Range verfuegbar ist, +* und passt die FreeIPBlocks der AU an. +* +* @param string ip IP Range, die neu zugewiesen werden soll +* @param string dhcpobjectDN Distinguished Name des LDAP DHCP-Objektes +* @param string auDN Distinguished Name des LDAP AU-Objektes +* +* @return boolean 1 bei Erfolg bzw. 0 bei Misserfolg +* +* @author Tarik Gasmi +*/ +function modify_ip_dhcprange($ip,$dhcpobjectDN,$auDN) +{ + global $ds, $suffix, $ldapError; + + if ( delete_ip_dhcprange($dhcpobjectDN,$auDN) ){ + if ( new_ip_dhcprange($ip,$dhcpobjectDN,$auDN) ){ + echo "<br>DHCP IP Range erfolgeich geaendert!<br>"; + return 1; + }else{ + echo "<br>Fehler beim Aendern der DHCP IP Range!<br>"; + return 0; + } + }else{ + echo "<br>Fehler beim Aendern der DHCP IP Range!<br>"; + return 0; + } +} + + +/** +* new_ip_delegation($ip,$childauDN,$auDN) +* Delegiert einen neuen IP Bereich an eine untergeordnete AU, falls dieser verfuegbar ist +* (in den FreeIPBlocks enthalten ist), und passt die FreeIPBlocks der AU an. +* +* @param string ip IP Bereich, der zugewiesen werden soll +* @param string childauDN Distinguished Name des untergeordneten (Child) LDAP AU-Objektes +* @param string auDN Distinguished Name des LDAP AU-Objektes +* +* @return boolean 1 bei Erfolg bzw. 0 bei Misserfolg +* +* @author Tarik Gasmi +*/ +function new_ip_delegation($ip,$childauDN,$auDN) +{ + global $ds, $suffix, $ldapError; + + $fipb_array = get_freeipblocks_au($auDN); + echo "<br>---<br>";print_r($fipb_array);echo "<br>---<br>"; + for ($i=0; $i < count($fipb_array); $i++){ + if ( split_iprange($ip,$fipb_array[$i]) != 0 ){ + $ipranges = split_iprange($ip,$fipb_array[$i]); + array_splice($fipb_array, $i, 1, $ipranges); + break; + } + } + + if ($i < count($fipb_array) ){ + # ldap_mod_replace -> Array fipb_array aktualisiert die FIPB in AU mit $auDN + foreach ( $fipb_array as $item ){ + $entry ['FreeIPBlock'][] = $item; + } + + $results = ldap_mod_replace($ds,$auDN,$entry); + if ($results){ + echo "<br>Neue FIPBs erfolgreich eingetragen!<br>" ; + + # ldap_mod_add -> IPAddress = $ip , in Host mit $hostDN + $mipbentry['MaxIPBlock'] = $ip; + $mipbentry['FreeIPBlock'] = $ip; + print_r($mipbentry); + + $results = ldap_mod_add($ds,$childauDN,$mipbentry); + if ($results){ + echo "<br>IP Adressblock erfolgreich delegiert!<br>" ; + merge_ipranges($childauDN); + + return 1; + }else{ + echo "<br>Fehler beim eintragen der IP Adresse!<br>"; + return 0; + } + }else{ + echo "<br>Fehler beim eintragen der FIPBs!<br>"; + return 0; + } + } + else{ + printf("<br>Zu delegierende IP Range %s ist nicht im verfuegbaren Bereich!<br>", $ip ); + } +} + +/** +* delete_ip_delegation($oldmipb,$childauDN,$auDN) +* Einen an eine untergeordnete AU delegierten IP Bereich zuruecknehmen. Diese Funktion wird rekursiv fuer +* alle weiter-delegierten Teilbereiche abgearbeitet. FreeIPBlocks der AU und Child-AU, sowie MaxIPBlocks +* der Child-AU werden angepasst. +* +* @param string oldmipb delegierter maximaler IP Bereich, der zurueckgenommen werden soll +* @param string childauDN Distinguished Name des untergeordneten (Child) LDAP AU-Objektes +* @param string auDN Distinguished Name des LDAP AU-Objektes +* +* @return boolean 1 bei Erfolg bzw. 0 bei Misserfolg +* +* @author Tarik Gasmi +*/ +function delete_ip_delegation($oldmipb,$childauDN,$auDN) +{ + global $ds, $suffix, $ldapError; + + # Durch Reduzierung zu loeschende IP Ranges (Array) + $delip[] = $oldmipb; + print_r($delip);printf("<br><br>"); + + # Finde unter allen Child-AUs diejenigen, die von Reduzierung betroffene Child-Child-AUs haben + # Diese sind werden rekursiv abgearbeitet + $cchild_array = get_childau($childauDN,array("dn","maxipblock")); + # print_r($cchild_array);printf("<br><br>"); + $cchild_todo = array(); + foreach ($delip as $delipitem){ + foreach ($cchild_array as $item){ + if( count($item['maxipblock']) > 1 ){ + foreach ($item['maxipblock'] as $item2 ){ + if ( intersect_ipranges($delipitem,$item2) != false ){ + $cchild_todo[] = array('coldmipb' => $item2, + 'ccauDN' => $item['dn'], + 'childauDN' => $childauDN ); + } + } + } + elseif ( count($item['maxipblock']) == 1 ){ + if ( intersect_ipranges($delipitem,$item['maxipblock']) != false ){ + $cchild_todo[] = array('coldmipb' => $item['maxipblock'], + 'ccauDN' => $item['dn'], + 'childauDN' => $childauDN ); + } + } + } + } + print_r($cchild_todo);printf("<br><br>"); + + # Rekursionsaufruf (für jede Child-AU, die betroffene Child-Child-AU hat) + foreach ($cchild_todo as $item){ + delete_ip_delegation($item['coldmipb'],$item['ccauDN'],$item['childauDN']); + } + + # Ab hier: alles was bei jedem Fkt.Aufruf zu machen ist (in Ebene AU und Child-AU) + + # in CAU Check ob RechnerIPs oder DhcpIPs betroffen: + $del_objects = objects_to_delete($delip,$childauDN,$cchild_array); + # print_r($del_objects);printf("<br><br>"); + printf("<br>Host IP Addresses that will be deleted: <br>"); + foreach ($del_objects['hostips'] as $item){ + printf("HostDN: %s IP Address: %s <br>",$item['dn'],$item['ip']); + } + printf("<br>Subnet IP Ranges that will be adjusted: <br>"); + foreach ($del_objects['dhcpranges'] as $item){ + printf("DhcpObjectDN: %s Zu loeschende IP Range: %s <br>",$item['dn'],$item['delrange']); + } + # hier kommte Abfrage ob wirklich Aenderung ausfuehren, ja dann weiter mit loeschen + # sonst Abbruch + # momentan: einfach loeschen + foreach ($del_objects['hostips'] as $item){ + delete_ip_host($item['dn'],$item['auDN']); + } + foreach ($del_objects['dhcpranges'] as $item){ + delete_ip_dhcprange($item['dn'],$item['auDN']); + } + + # in Child-AU: oldmipb loeschen + $mipb_array = get_maxipblocks_au($childauDN); + print_r($mipb_array);printf("<br><br>"); + foreach ($delip as $delipitem){ + # if ( count($mipb_array) > 1 ){ + for ($i=0; $i < count($mipb_array); $i++){ + if ( intersect_ipranges($delipitem,$mipb_array[$i]) != 0 ){ + #$ipranges = intersect_ipranges($newmipb,$mipb_array[$i]); + array_splice($mipb_array, $i, 1); + } + } + # }else{ + # if ( intersect_ipranges($delipitem,$mipb_array) != 0 ){ + # # $ipranges = intersect_ipranges($newmipb,$mipb_array); + # $mipb_array = array(); + # } + # } + } + # print_r($mipb_array);printf("<br><br>"); + # for ($i=0; $i < count($mipb_array); $i++){ + # if ($mipb_array[$i] == false){array_splice($mipb_array, $i, 1);} + # } + print_r($mipb_array);printf("<br><br>"); + if (count($mipb_array) == 0){ + $entry ['MaxIPBlock'] = array(); + print_r($entry);printf("<br><br>"); + $results = ldap_mod_del($ds,$childauDN,$entry); + }else{ + foreach ( $mipb_array as $item ){ + $entry ['MaxIPBlock'][] = $item; + } + print_r($entry);printf("<br><br>"); + $results = ldap_mod_replace($ds,$childauDN,$entry); + } + + if ($results){ + echo "<br>MIPBs in Child-AU erfolgreich geloescht!<br>" ; + + # in Child-AU: FIPBs anpassen + $fipb_array = get_freeipblocks_au($childauDN); + print_r($fipb_array);printf("<br><br>"); + foreach ($delip as $delipitem){ + # if ( count($fipb_array) > 1 ){ + for ($i=0; $i < count($fipb_array); $i++){ + if ( intersect_ipranges($delipitem,$fipb_array[$i]) != 0 ){ + # $ipranges = intersect_ipranges($newmipb,$fipb_array[$i]); + array_splice($fipb_array, $i, 1); + } + } + # } + # else{ + # if ( intersect_ipranges($delipitem,$fipb_array) != 0 ){ + # # $ipranges = intersect_ipranges($newmipb,$fipb_array); + # $fipb_array = array(); + # } + # } + } + # print_r($fipb_array);printf("<br><br>"); + # for ($i=0; $i < count($fipb_array); $i++){ + # if ($fipb_array[$i] == false){array_splice($fipb_array, $i, 1);} + # } + print_r($fipb_array);printf("<br><br>"); + if (count($fipb_array) == 0){ + $entry1 ['FreeIPBlock'] = array(); + print_r($entry1);printf("<br><br>"); + $results = ldap_mod_del($ds,$childauDN,$entry1); + }else{ + foreach ( $fipb_array as $item ){ + $entry1 ['FreeIPBlock'][] = $item; + } + print_r($entry1);printf("<br><br>"); + $results = ldap_mod_replace($ds,$childauDN,$entry1); + } + + if ($results){ + echo "<br>FIPBs in Child-AU erfolgreich geloescht!<br>" ; + + # in AU: Geloeschte IP Bereiche als neue FIPBs aufnehmen + foreach ($delip as $item){ + $entry2 ['FreeIPBlock'][] = $item; + } + print_r($entry2);printf("<br><br>"); + $results = ldap_mod_add($ds,$auDN,$entry2); + if ($results){ + echo "<br>FIPBs in AU erfolgreich aktualisiert!<br>" ; + + # IP Bloecke aufraeumen in Child-AU und AU (Merging) + merge_ipranges($auDN); + merge_ipranges($childauDN); + return 1; + }else{ + echo "<br>Fehler beim aktualisieren!<br>"; + return 0; + } + }else{ + echo "<br>Fehler beim loeschen!<br>"; + return 0; + } + }else{ + echo "<br>Fehler beim loeschen!<br>"; + return 0; + } +} + + +/** +* reduce_ip_delegation($oldmipb,$newmipb,$childauDN,$auDN) +* Einen an eine untergeordnete AU delegierten IP Bereich verkleinern. Diese Funktion wird rekursiv fuer +* alle weiter-delegierten Teilbereiche abgearbeitet. FreeIPBlocks der AU und Child-AU, sowie MaxIPBlocks +* der Child-AU werden angepasst. +* +* @param string oldmipb delegierter maximaler IP Bereich, der verkleinert werden soll +* @param string newmipb delegierter maximaler IP Bereich nach der Verkleinerung +* @param string childauDN Distinguished Name des untergeordneten (Child) LDAP AU-Objektes +* @param string auDN Distinguished Name des LDAP AU-Objektes +* +* @return boolean 1 bei Erfolg bzw. 0 bei Misserfolg +* +* @author Tarik Gasmi +*/ +function reduce_ip_delegation($oldmipb,$newmipb,$childauDN,$auDN) +{ + global $ds, $suffix, $ldapError; + + # Durch Reduzierung zu loeschende IP Ranges (Array) + $delip = split_iprange($newmipb,$oldmipb); + print_r($delip);printf("<br><br>"); + + # Finde unter allen Child-AUs diejenigen, die von Reduzierung betroffene Child-Child-AUs haben + # Diese sind werden rekursiv abgearbeitet + $cchild_array = get_childau($childauDN,array("dn","maxipblock")); + + $cchild_todo = array(); + foreach ($delip as $delipitem){ + foreach ($cchild_array as $item){ + if( count($item['maxipblock']) > 1 ){ + foreach ($item['maxipblock'] as $item2 ){ + if ( intersect_ipranges($delipitem,$item2) != false ){ + $cchild_todo[] = array('coldmipb' => $item2, + 'cnewmipb' => intersect_ipranges($newmipb,$item2), + 'ccauDN' => $item['dn'], + 'childauDN' => $childauDN ); + } + } + } + elseif ( count($item['maxipblock']) == 1 ){ + if ( intersect_ipranges($delipitem,$item['maxipblock']) != false ){ + $cchild_todo[] = array('coldmipb' => $item['maxipblock'], + 'cnewmipb' => intersect_ipranges($newmipb,$item['maxipblock']), + 'ccauDN' => $item['dn'], + 'childauDN' => $childauDN ); + } + } + } + } + print_r($cchild_todo);printf("<br><br>"); + + + # Rekursionsaufruf (für jede Child-AU, die betroffene Child-Child-AU hat) + foreach ($cchild_todo as $item){ + if ($item['cnewmipb'] == false ){ + delete_ip_delegation($item['coldmipb'],$item['ccauDN'],$item['childauDN']); + } + else{ + reduce_ip_delegation($item['coldmipb'],$item['cnewmipb'],$item['ccauDN'],$item['childauDN']); + } + } + + + # Ab hier: alles was bei jedem Fkt.Aufruf zu machen ist (auf Ebene AU und Child-AU) + + # in CAU Check ob RechnerIPs oder DhcpIPs betroffen: + # - falls ja: nochmals Abfrage (Hammermethode: diese auch loeschen) ob diese zu loeschen sind + # -> ja, betreffende IPs loeschen + # -> nein, Abbruch. + # - falls nein: fuer jedes FIPB in CAU intersect(FIPB,newmipb)-> Schnittmengen bilden die neuen FIPB + $del_objects = objects_to_adjust($newmipb,$delip,$childauDN,$cchild_array); + # print_r($del_objects);printf("<br><br>"); + printf("<br>Host IP Addresses that will be deleted: <br>"); + foreach ($del_objects['hostips'] as $item){ + printf("HostDN: %s IP Address: %s <br>",$item['dn'],$item['ip']); + } + printf("<br>Subnet IP Ranges that will be adjusted: <br>"); + foreach ($del_objects['dhcpranges'] as $item){ + printf("DhcpObjectDN: %s New IP Range: %s <br>",$item['dn'],$item['newrange']); + } + + # momentan wird einfach geloescht: + foreach ($del_objects['hostips'] as $item){ + delete_ip_host($item['dn'],$item['auDN']); + } + foreach ($del_objects['dhcpranges'] as $item){ + if ( count($item['newrange']) >= 1 ){ + modify_ip_dhcprange($item['newrange'],$item['dn'],$item['auDN']); + }else{ + delete_ip_dhcprange($item['dn'],$item['auDN']); + } + } + + + # in Child-AU: oldmipb -> newmipb + $mipb_array = get_maxipblocks_au($childauDN); + # print_r($mipb_array);printf("<br><br>"); + foreach ($delip as $delipitem){ + for ($i=0; $i < count($mipb_array); $i++){ + if ( intersect_ipranges($delipitem,$mipb_array[$i]) != 0 ){ + $ipranges = intersect_ipranges($newmipb,$mipb_array[$i]); + array_splice($mipb_array, $i, 1, $ipranges); + } + } + } + # print_r($mipb_array);printf("<br><br>"); + for ($i=0; $i < count($mipb_array); $i++){ + if ($mipb_array[$i] == false){array_splice($mipb_array, $i, 1);} + } + print_r($mipb_array);printf("<br><br>"); + if (count($mipb_array) == 0){ + $entry ['MaxIPBlock'] = array(); + print_r($entry);printf("<br><br>"); + $results = ldap_mod_del($ds,$childauDN,$entry); + }else{ + foreach ( $mipb_array as $item ){ + $entry ['MaxIPBlock'][] = $item; + } + print_r($entry);printf("<br><br>"); + $results = ldap_mod_replace($ds,$childauDN,$entry); + } + + if ($results){ + echo "<br>MIPBs in Child-AU erfolgreich aktualisiert!<br>" ; + + # in Child-AU: FIPBs anpassen + $fipb_array = get_freeipblocks_au($childauDN); + #print_r($fipb_array);printf("<br><br>"); + foreach ($delip as $delipitem){ + for ($i=0; $i < count($fipb_array); $i++){ + if ( intersect_ipranges($delipitem,$fipb_array[$i]) != 0 ){ + $ipranges = intersect_ipranges($newmipb,$fipb_array[$i]); + array_splice($fipb_array, $i, 1, $ipranges); + } + } + } + # print_r($fipb_array);printf("<br><br>"); + for ($i=0; $i < count($fipb_array); $i++){ + if ($fipb_array[$i] == false){array_splice($fipb_array, $i, 1);} + } + print_r($fipb_array);printf("<br><br>"); + if (count($fipb_array) == 0){ + $entry1 ['FreeIPBlock'] = array(); + print_r($entry1);printf("<br><br>"); + $results = ldap_mod_del($ds,$childauDN,$entry1); + }else{ + foreach ( $fipb_array as $item ){ + $entry1 ['FreeIPBlock'][] = $item; + } + print_r($entry1);printf("<br><br>"); + $results = ldap_mod_replace($ds,$childauDN,$entry1); + } + + if ($results){ + echo "<br>FIPBs in Child-AU erfolgreich aktualisiert!<br>" ; + + # in AU: Geloeschte IP Bereiche als neue FIPBs aufnehmen + foreach ($delip as $item){ + $entry2 ['FreeIPBlock'][] = $item; + } + print_r($entry2);printf("<br><br>"); + $results = ldap_mod_add($ds,$auDN,$entry2); + if ($results){ + echo "<br>FIPBs in AU erfolgreich aktualisiert!<br>" ; + + # IP Bloecke aufraeumen in Child-AU und AU (Merging) + merge_ipranges($auDN); + merge_ipranges($childauDN); + + return 1; + }else{ + echo "<br>Fehler beim aktualisieren!<br>"; + return 0; + } + }else{ + echo "<br>Fehler beim aktualisieren!<br>"; + return 0; + } + }else{ + echo "<br>Fehler beim aktualisieren!<br>"; + return 0; + } +} + + +/** +* expand_ip_delegation($oldmipb,$newmipb,$childauDN,$auDN) +* Einen an eine untergeordnete AU delegierten IP Bereich erweitern. Diese Funktion wird rekursiv fuer +* alle weiter-delegierten Teilbereiche abgearbeitet. FreeIPBlocks der AU und Child-AU, sowie MaxIPBlocks +* der Child-AU werden angepasst. Entspricht einer Neu-Delegierung des erweiterten IP Bereichs. +* +* @param string oldmipb delegierter maximaler IP Bereich, der erweitert werden soll +* @param string newmipb delegierter maximaler IP Bereich nach der Erweiterung +* @param string childauDN Distinguished Name des untergeordneten (Child) LDAP AU-Objektes +* @param string auDN Distinguished Name des LDAP AU-Objektes +* +* @return boolean 1 bei Erfolg bzw. 0 bei Misserfolg +* +* @author Tarik Gasmi +*/ +function expand_ip_delegation($oldmipb,$newmipb,$childauDN,$auDN) +{ + global $ds, $suffix, $ldapError; + + $difference = split_iprange($oldmipb,$newmipb); + new_ip_delegation($difference[0],$childauDN,$auDN); +} + + +/** +* objects_to_delete($delip,$childauDN,$cchild_array) +* Liefert die durch eine Rücknahme einer IP Delegierung betroffenen Host/DHCP-Objekte der Child-AU +* und Child-Child-AUs in einem Array. Dieses enthaelt fuer jedes Objekt dessen Distinguished Name, +* dessen IP Adresse(n)/Range(s) und den Distinguished Name der AU der das Objekt angehoert. Parameter +* die fuer die Funktionen delete_ip_host(), delete_ip_range() Benoetigt werden. +* +* @param string delip IP Bereich der geloescht wird +* @param string childauDN Distinguished Name des untergeordneten (Child) LDAP AU-Objektes +* @param array cchild_array Array von allen Child-Child-AUs (jedes Item enthaelt DN und MaxIPBlock) +* +* @return array objects_to_delete Array aller betroffenen Objekte (DN, IP, auDN) +* +* @author Tarik Gasmi +*/ +function objects_to_delete($delip,$childauDN,$cchild_array) +{ + global $ds, $suffix, $ldapError; + + # Hosts von child-AU, child-child-AU + $chosts = get_hosts($childauDN,array("dn","ipaddress")); + # print_r($chosts);printf("<br><br>"); + foreach ($cchild_array as $item){ + $cchostsitem = get_hosts($item['dn'],array("dn","ipaddress")); + foreach ($cchostsitem as $item2){ + $cchosts[] = $item2; + } + } + $chosts = array_merge($chosts,$cchosts); + # print_r($chosts);printf("<br><br>"); + + # Subnets von child-AU, child-child-AU + $csubnets = get_subnets($childauDN,array("dn","dhcprange")); + # print_r($csubnets);printf("<br><br>"); + foreach ($cchild_array as $item){ + $ccsubnetsitem = get_hosts($item['dn'],array("dn","dhcprange")); + foreach ($ccsubnetsitem as $item2){ + $ccsubnets[] = $item2; + } + } + $csubnets = array_merge($csubnets,$ccsubnets); + # print_r($csubnets);printf("<br><br>"); + + # Pools von child-AU, child-child-AU + /*$cpools = get_pools($childauDN,array("dn","dhcprange")); + # print_r($cpools);printf("<br>"); + foreach ($cchild_array as $item){ + $ccpoolsitem = get_hosts($item['dn'],array("dn","dhcprange")); + foreach ($ccpoolsitem as $item2){ + $ccpools[] = $item2; + } + } + $cpools = array_merge($cpools,$ccpools); + # print_r($cpools);printf("<br><br>"); + */ + + # Zu loeschende Hosts bestimmen + $chosts_todo = array(); + foreach ($delip as $delipitem){ + foreach ($chosts as $item){ + if( count($item['ipaddress']) > 1 ){ + foreach ($item['ipaddress'] as $item2 ){ + if ( intersect_ipranges($delipitem,$item2) != false ){ + $chosts_todo[] = array('dn' => $item['dn'], + 'ip' => $item['ipaddress'], + 'auDN' => $item['auDN']); + } + } + } + elseif ( count($item['ipaddress']) == 1 ){ + if ( intersect_ipranges($delipitem,$item['ipaddress']) != false ){ + $chosts_todo[] = array('dn' => $item['dn'], + 'ip' => $item['ipaddress'], + 'auDN' => $item['auDN']); + } + } + } + } + # print_r($chosts_todo);printf("<br><br>"); + + # Zu loeschende Subnets bestimmen, und wie IP Range anzupassen ist + $csubnets_todo = array(); + foreach ($delip as $delipitem){ + foreach ($csubnets as $item){ + if( count($item['dhcprange']) > 1 ){ + foreach ($item['dhcprange'] as $item2 ){ + # print_r(intersect_ipranges($delipitem,$item2)); + if ( intersect_ipranges($delipitem,$item2) != false ){ + $csubnets_todo[] = array('dn'=> $item['dn'], + 'delrange' => $item2['dhcprange'], + 'auDN' => $item['auDN']); + } + } + } + elseif ( count($item['dhcprange']) == 1 ){ + # print_r(intersect_ipranges($delipitem,$item['dhcprange'])); + if ( intersect_ipranges($delipitem,$item['dhcprange']) != false ){ + $csubnets_todo[] = array('dn'=> $item['dn'], + 'delrange' => $item['dhcprange'], + 'auDN' => $item['auDN']); + } + } + } + } + # print_r($csubnets_todo);printf("<br><br>"); + + # Zu loeschende Pools bestimmen, und wie IP Range anzupassen ist + /*$cpools_todo = array(); + foreach ($delip as $delipitem){ + foreach ($cpools as $item){ + if( count($item['dhcprange']) > 1 ){ + foreach ($item['dhcprange'] as $item2 ){ + if ( intersect_ipranges($delipitem,$item2) != false ){ + $cpools_todo[] = array('dn'=> $item['dn'], + 'delrange' => $item2['dhcprange'], + 'auDN' => $item['auDN']); + } + } + } + elseif ( count($item['dhcprange']) == 1 ){ + if ( intersect_ipranges($delipitem,$item['dhcprange']) != false ){ + $cpools_todo[] = array('dn'=> $item['dn'], + 'delrange' => $item['dhcprange'], + 'auDN' => $item['auDN']); + } + } + } + } + # print_r($cpools_todo);printf("<br><br>"); + */ + + $dhcps_todo = array_merge($csubnets_todo,$cpools_todo); + + $objects_to_delete = array('hostips' => $chosts_todo, + 'dhcpranges' => $dhcps_todo); + return $objects_to_delete; +} + + +/** +* objects_to_adjust($newmipb,$delip,$childauDN,$cchild_array) +* Liefert die durch eine Reduzierung einer IP Delegierung betroffenen Host/DHCP-Objekte der Child-AU +* und Child-Child-AUs in einem Array. Dieses enthaelt fuer jedes Objekt dessen Distinguished Name, +* dessen IP Adresse(n)/Range(s) und den Distinguished Name der AU der das Objekt angehoert. Parameter +* die fuer die Funktionen delete_ip_host(), delete_ip_dhcprange(), modify_ip_dhcprange() benoetigt werden. +* +* @param string newmipb IP Bereich der nach Reduzierung verbleibt +* @param string delip IP Bereich der durch Reduzierung wegfaellt +* @param string childauDN Distinguished Name des untergeordneten (Child) LDAP AU-Objektes +* @param array cchild_array Array von allen Child-Child-AUs (jedes Item enthaelt DN und MaxIPBlock) +* +* @return array objects_to_adjust Array aller betroffenen Objekte (DN, IP, auDN) +* +* @author Tarik Gasmi +*/ +function objects_to_adjust($newmipb,$delip,$childauDN,$cchild_array) +{ + global $ds, $suffix, $ldapError; + + # Hosts von child-AU, child-child-AU + $chosts = get_hosts($childauDN,array("dn","ipaddress")); + # print_r($chosts);printf("<br><br>"); + foreach ($cchild_array as $item){ + $cchostsitem = get_hosts($item['dn'],array("dn","ipaddress")); + foreach ($cchostsitem as $item2){ + $cchosts[] = $item2; + } + } + $chosts = array_merge($chosts,$cchosts); + # print_r($chosts);printf("<br><br>"); + + # Subnets von child-AU, child-child-AU + $csubnets = get_subnets($childauDN,array("dn","dhcprange")); + # print_r($csubnets);printf("<br><br>"); + foreach ($cchild_array as $item){ + $ccsubnetsitem = get_hosts($item['dn'],array("dn","dhcprange")); + foreach ($ccsubnetsitem as $item2){ + $ccsubnets[] = $item2; + } + } + $csubnets = array_merge($csubnets,$ccsubnets); + # print_r($csubnets);printf("<br><br>"); + + # Pools von child-AU, child-child-AU + /*$cpools = get_pools($childauDN,array("dn","dhcprange")); + # print_r($cpools);printf("<br>"); + foreach ($cchild_array as $item){ + $ccpoolsitem = get_hosts($item['dn'],array("dn","dhcprange")); + foreach ($ccpoolsitem as $item2){ + $ccpools[] = $item2; + } + } + $cpools = array_merge($cpools,$ccpools); + # print_r($cpools);printf("<br><br>"); + */ + + # Zu loeschende Hosts bestimmen + $chosts_todo = array(); + foreach ($delip as $delipitem){ + foreach ($chosts as $item){ + if( count($item['ipaddress']) > 1 ){ + foreach ($item['ipaddress'] as $item2 ){ + if ( intersect_ipranges($delipitem,$item2) != false ){ + $chosts_todo[] = array('dn' => $item['dn'], + 'ip' => $item['ipaddress'], + 'auDN' => $item['auDN']); + } + } + } + elseif ( count($item['ipaddress']) == 1 ){ + if ( intersect_ipranges($delipitem,$item['ipaddress']) != false ){ + $chosts_todo[] = array('dn' => $item['dn'], + 'ip' => $item['ipaddress'], + 'auDN' => $item['auDN']); + } + } + } + } + # print_r($chosts_todo);printf("<br><br>"); + + # Zu loeschende Subnets bestimmen, und wie IP Range anzupassen ist + $csubnets_todo = array(); + foreach ($delip as $delipitem){ + foreach ($csubnets as $item){ + if( count($item['dhcprange']) > 1 ){ + foreach ($item['dhcprange'] as $item2 ){ + # print_r(intersect_ipranges($delipitem,$item2)); + if ( intersect_ipranges($delipitem,$item2) != false ){ + $csubnets_todo[] = array('dn'=> $item['dn'], + 'newrange' => intersect_ipranges($newmipb,$item2), + 'auDN' => $item['auDN']); + } + } + } + elseif ( count($item['dhcprange']) == 1 ){ + # print_r(intersect_ipranges($delipitem,$item['dhcprange'])); + if ( intersect_ipranges($delipitem,$item['dhcprange']) != false ){ + $csubnets_todo[] = array('dn'=> $item['dn'], + 'newrange' => intersect_ipranges($newmipb,$item['dhcprange']), + 'auDN' => $item['auDN']); + } + } + } + } + # print_r($csubnets_todo);printf("<br><br>"); + + # Zu loeschende Pools bestimmen, und wie IP Range anzupassen ist + /*$cpools_todo = array(); + foreach ($delip as $delipitem){ + foreach ($cpools as $item){ + if( count($item['dhcprange']) > 1 ){ + foreach ($item['dhcprange'] as $item2 ){ + if ( intersect_ipranges($delipitem,$item2) != false ){ + $cpools_todo[] = array('dn'=> $item['dn'], + 'newrange' => intersect_ipranges($newmipb,$item2), + 'auDN' => $item['auDN']); + } + } + } + elseif ( count($item['dhcprange']) == 1 ){ + if ( intersect_ipranges($delipitem,$item['dhcprange']) != false ){ + $cpools_todo[] = array('dn'=> $item['dn'], + 'newrange' => intersect_ipranges($newmipb,$item['dhcprange']), + 'auDN' => $item['auDN']); + } + } + } + } + # print_r($cpools_todo);printf("<br><br>"); + */ + + $dhcps_todo = array_merge($csubnets_todo,$cpools_todo); + + $objects_to_adjust = array('hostips' => $chosts_todo, + 'dhcpranges' => $dhcps_todo); + return $objects_to_adjust; +} + + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/lib/ldap.inc.php b/ldap-site-mngmt/webinterface/lib/ldap.inc.php new file mode 100644 index 00000000..204e3e3c --- /dev/null +++ b/ldap-site-mngmt/webinterface/lib/ldap.inc.php @@ -0,0 +1,996 @@ +<?php +/** +* ldap.inc.php - LDAP-Bibliothek +* Diese Bibliothek enthält alle Funktionen für den Zugriff auf den LDAP-Server. +* +* @param string ldapError +* @param resource ds +* +* @author Timothy Burk, Mahir Yildirim, Johannes Sprenger, Daniel Höfler +* @copyright Timothy Burk, Mahir Yildirim, Johannes Sprenger, Daniel Höfler +*/ +//Konfiguration laden +require_once("config.inc.php"); + +$ldapError = null; + +/** +* uniLdapConnect($userRdn, $userPwd) - Führt den Bind am Gruppe1-LDAP-Server durch +* +* @param string userRdn UID für den Login +* @param string userPwd Loginpasswort +* +* @return boolean Erfolg bzw. Misserfolg +* +* @author Timothy Burk +*/ +function uniLdapConnect($userRdn = "", $userPwd = "") { + global $ldapError, $suffix; + if(!(defined("LDAP_HOST") && defined("LDAP_PORT"))) { + $ldapError = "Hostname und/oder Port des LDAP-Servers wurden nicht angegeben!"; + return FALSE; + } + if($ds = ldap_connect(LDAP_HOST, LDAP_PORT)) { + # Connect zum LDAP-Server OK + if(ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3)) { + # Optionen gesetzt + if($userRdn != "" && $userPwd != "") { + # Anmeldung als User. + if($result = @ldap_bind($ds, "uid=".$userRdn.",ou=people,".$suffix, $userPwd)) { + # Bind erfolgreich ausgeführt + return $ds; + } else { + # Bind nicht erfolreich. + if(ldap_error($ds) == "Invalid credentials") { + $ldapError .= "Bind nicht erfolgreich: die Zugangsdaten sind nicht korrekt.<br>\n"; + } else { + $ldapError .= "Bind als User nicht erfolgreich: ".ldap_error($ds)."<br>\n"; + } + return false; + } + } else { + # Anonymer Bind. + if($result = ldap_bind($ds)) { + # Anonymer Bind erfolgreich ausgeführt + return $ds; + } else { + # Anonymer Bind nicht erfolreich. + $ldapError .= "Anonymer Bind nicht erfolgreich: ".ldap_error($ds)."<br>\n"; + return false; + } + } + } else { + # Optionen setzen fehlgeschlagen + $ldapError .= "Protokollversion setzen fehlgeschlagen: ".ldap_error($ds)."<br>\n"; + } + } else { + # Connect fehlgeschlagen. + $ldapError .= "Connect fehlgeschlagen: ".ldap_error($ds)."<br>\n"; + } +} + + +/** +* rzLdapConnect($userRdn, $userPwd) - Führt den Bind am RZ-LDAP-Server durch +* +* @param string userRdn UID für den Login +* @param string userPwd Loginpasswort +* +* @return boolean Erfolg bzw. Misserfolg +* +* @author Timothy Burk +*/ +function rzLdapConnect($userRdn = "", $userPwd = "") { + global $ldapError, $suffix_rz; + if(!(defined("LDAP_HOST_RZ") && defined("LDAP_PORT_RZ"))) { + $ldapError = "Hostname und/oder Port des LDAP-Servers wurden nicht angegeben!"; + return FALSE; + } + if($ds = ldap_connect(LDAP_HOST_RZ, LDAP_PORT_RZ)) { + # Connect zum LDAP-Server OK + if(ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3)) { + # Optionen gesetzt + if($userRdn != "" && $userPwd != "") { + # Anmeldung als User. + if($result = @ldap_bind($ds, "uid=".$userRdn.",ou=people,".$suffix_rz, $userPwd)) { + # Bind erfolgreich ausgeführt + return $ds; + } else { + # Bind nicht erfolreich. + if(ldap_error($ds) == "Invalid credentials") { + $ldapError .= "Bind nicht erfolgreich: die Zugangsdaten sind nicht korrekt.<br>\n"; + } else { + $ldapError .= "Bind als User nicht erfolgreich: ".ldap_error($ds)."<br>\n"; + } + return false; + } + } else { + # Anonymer Bind. + if($result = ldap_bind($ds)) { + # Anonymer Bind erfolgreich ausgeführt + return $ds; + } else { + # Anonymer Bind nicht erfolreich. + $ldapError .= "Anonymer Bind nicht erfolgreich: ".ldap_error($ds)."<br>\n"; + return false; + } + } + } else { + # Optionen setzen fehlgeschlagen + $ldapError .= "Protokollversion setzen fehlgeschlagen: ".ldap_error($ds)."<br>\n"; + } + } else { + # Connect fehlgeschlagen. + $ldapError .= "Connect fehlgeschlagen: ".ldap_error($ds)."<br>\n"; + } +} + + /** + * uniLdapSearch($ds, $base, $filter, $attributes, $sort, $mode, $resultLimit, $timeout) + * Sucht Einträge im LDAP-Server. + * + * Durchsucht den LDAP-Server vom Punkt $base ab nach Einträgen, die $filter entsprechen. Falls in $sort ein Feldname angegeben + * wurde, so wird danach sortiert. (ACHTUNG: die Funktion ldap_sort() ist nicht dokumentiert! Ich weiß nicht ob sie Sortierung + * nach mehreren Feldern zulässt und wie sie sich verhält, wenn zu einem Attribut mehrere Werte existieren.) $mode definiert die + * Art der Suche, wohingegen $resultLimit und $timeout die Anzahl der Ergebnis-Einträge bzw. die maximalen Suchdauer einschränken. + * Zurückgegeben werden die Attribute, die im Array $attributes aufgeführt sind. Im Erfolgsfalle wird ein multidimensionales Array + * zurückgeliefert, im Fehlerfalle FALSE. Dann steht die Fehlermeldung in der Variablen $ldapError. + * + * @param string $base die DN, das Verzeichnis, in dem die Suche startet + * + * @param string $filter die Suchbedingungen + * + * @param array attributes die Attributnamen, deren Werte im Ergebnis enthalten sein sollen. + * + * @param string $sort Sortiert die Ergebnis-Einträge nach dem angegebenen Feldnamen (undokumentiert! s.o.) + * + * @param string $mode Der Modus: "one" liefert einen Eintrag, "list" alle Einträge des Verzeichnisses und "sub" + * schließt alle Untervezeichnisse mit ein. + * + * @param int $resultLimit die maximale Anzahl zurückgegebener Einträge + * + * @param int $timeout die maximale Suchzeit, bevor der LDAP-Server abbrechen soll + * + * @return mixed multidimensionales array mit den Einträgen im Erfolgsfall, FALSE wenn ein Fehler auftrat + * + * @see ldap_read() + * @see ldap_list() + * @see ldap_search() + * @see ldap_sort() + * @see ldap_get_entries() + * @see ldap_free_result() + * + * @author Timothy Burk + */ +function uniLdapSearch($ds, $base, $filter, $attributes, $sort, $mode, $resultLimit, $timeout) { + global $ldapError; + $abfrage = false; + if($mode == "one") { + if($resource = ldap_read($ds, $base, $filter, $attributes, 0, $resultLimit, $timeout)) { + # Abfrage erfolgreich! + $abfrage = true; + } else { + # Abfrage fehlgeschlagen. + $ldapError .= "Abfrage mit Mode $mode ist fehlgeschlagen: ".ldap_error($ds)."<br>\n"; + return false; + } + } else if($mode == "list") { + if($resource = ldap_list($ds, $base, $filter, $attributes, 0, $resultLimit, $timeout)) { + # Abfrage erfolgreich! + ldap_sort($ds,$resource,$sort); + $abfrage = true; + } else { + # Abfrage fehlgeschlagen. + $ldapError .= "Abfrage mit Mode $mode ist fehlgeschlagen: ".ldap_error($ds)."<br>\n"; + return false; + } + } else if($mode == "sub") { + if($resource = ldap_search($ds, $base, $filter, $attributes, 0, $resultLimit, $timeout)) { + # Abfrage erfolgreich! + ldap_sort($ds,$resource,$sort); + $abfrage = true; + } else { + # Abfrage fehlgeschlagen. + $ldapError .= "Abfrage mit Mode $mode ist fehlgeschlagen: ".ldap_error($ds)."<br>\n"; + return false; + } + } else { + # Kein gültiger Modus angegeben. + $ldapError .= "Es wurde kein gültiger Modus angegeben."; + return false; + } + if($abfrage && ($entries = ldap_get_entries($ds, $resource))) { + # Auslesen des Verzeichnisses erfolgreich. + ldap_free_result($resource); + return $entries; + } else { + # Auslesen des Verzeichnisses nicht erfolgreich. + $ldapError .= "Auslesen des Verzeichnisses nicht erfolgreich: ".ldap_error($ds)."<br>\n"; + return false; + } +} +/** +* uniLdapAdd($ds, $dn, $daten, [$objectclass]) +* +* Fügt ein neues Objekt in die LDAP-Datenbank ein. +* +* @param resource $ds Datenbankhandler +* @param string $dn Distinguished Name des neuen Eintrages +* @param array $daten Assoziatives Array mit den gewünschten Attributen +* @param string $objectclass Objektklasse des neuen Eintrages (Standard = "") +* +* @return boolean TRUE wenn Eintrag erfolgreich, FALSE wenn ein Fehler aufgetreten ist. +* +* @see ldap_add() +* +* @author Timothy Burk +*/ +function uniLdapAdd($ds, $dn, $daten, $objectclass = "") { + if($objectclass != "") { + $daten['objectclass'] = $objectclass; + } + if(ldap_add($ds, $dn, $daten)) { + return true; + } else { + return false; + } +} + +/** +* uniLdapModify($ds, $dn, $daten_alt, $daten_neu, [$i]) +* +* Universalfunktion zum Ändern von Attributen und Werten. +* Bei Änderungsskripten muss zuerst ein Formular mit den alten Daten gefüllt werden. Die hierfür +* durchgeführte Suche wird in einem unbehandelten Array in der SESSION gespeichert und wieder +* ausgelesen, sobald die Änderungen gespeichert werden sollen. Es wird anschließend an diese Funktion +* (als $daten_alt)gegeben, die das Array mit ldapArraySauber von allen unnötigen Einträgen befreit. +* $daten_alt entspricht dann strukturell dem POST-Array des Änderungsformulars ($daten_neu). +* Letzteres wird nun durch laufen, alle Einträge werden mit ihrer Entsprechnung aus $daten_alt verglichen +* und ggf. werden dann Attribute geändert, gelöscht oder hinzugefügt. +* +* @param resource $ds Datenbankhandler +* @param string $dn Distinguished Name des Eintrages +* @param array $daten_alt Dreidimensionales mixed Array der Form $array[int][string][int], so wie es von uniLdapSearch zurückgeliefert wird. +* @param array $daten_neu Zweidimensionales mixed Array der Form $array[string][int], so wie ein Formular in $_POST gespeichert ist. +* @param int $i Gibt an, welcher Eintrag der ersten Dimension von $daten_alt verwendet werden soll. (Standard: $i=0) +* +* @return boolean TRUE wenn Änderung erfolgreich, FALSE wenn ein Fehler aufgetreten ist. +* +* @see ldap_mod_replace() +* @see ldap_mod_add() +* @see ldap_mod_del() +* @see ldapArraySauber() +* @see numArraySauber() +* +* @author Timothy Burk +*/ +function uniLdapModify($ds, $dn, $daten_alt, $daten_neu, $i = 0) { + $meldung = ""; + $daten_alt = ldapArraySauber($daten_alt, FALSE); + $daten_alt = $daten_alt[$i]; + foreach($daten_neu as $key => $value_neu) { + $key = strtolower($key); + if(!(is_array($value_neu))) { + # Wenn $value_neu ein Skalar ist... + # (d.h., das Attribut $key darf nur einen Wert annehmen) + $value_neu = htmlentities(str_replace(chr(160),"",trim($value_neu))); // ungewollte Leerzeichen und löschen + if (isset($daten_alt[$key])) { + $daten_alt[$key] = str_replace(chr(160),"",trim($daten_alt[$key])); // ungewollte Leerzeichen und löschen + } else { + $daten_alt[$key] = ""; + } + if($daten_alt[$key] == "" && $value_neu != "") { + # FALL 1: + # Alter Wert ist leer, neuer Wert ist nicht leer. + # Füge neues Attribut hinzu. + if(ldap_mod_add($ds, $dn, array($key => $value_neu))) { + $meldung .= "Add successfull: ".$key." -> ".$value_neu."<br>"; + } else { + $meldung .= "Add error: ".$key." -> ".$value_neu."<br>"; + } + + } else if($daten_alt[$key] != "" && $value_neu == "") { + # FALL 2: + # Alter Wert ist nicht leer, neuer Wert ist leer. + # Lösche Attribut. + if(ldap_mod_del($ds, $dn, array($key => $daten_alt[$key]))) { + $meldung .= "Delete successfull: ".$key." -> ".$daten_alt[$key]."<br>"; + } else { + $meldung .= "Delete error: ".$key." -> ".$daten_alt[$key]."<br>"; + } + + } else if($daten_alt[$key] != "" && $value_neu != "" && $daten_alt[$key] != $value_neu) { + # FALL 3: + # Alter und neuer Wert sind nicht leer und beide sind ungleich. + # Ändere das Attribut. Der bisherige Wert wird überschrieben. + if(ldap_mod_replace($ds, $dn, array($key => $value_neu))) { + $meldung .= "Replace successfull: ".$key." -> ".$value_neu."<br>"; + } else { + $meldung .= "Replace error: ".$key." -> ".$value_neu."<br>"; + } + + } else { + # In allen anderen Fällen ist keine Änderung nötig + } + } else { + # Wenn $value_neu ein Array ist... + # (d.h., das Attribut $key darf mehrere Werte annehmen) + $value_neu = numArraySauber($value_neu); + if (isset($daten_alt[$key])) { + $value_alt = numArraySauber($daten_alt[$key]); + foreach($value_alt as $item) { + #$item = htmlentities($item); + # Lösche alle alten Werte des Attributes $key. + if(ldap_mod_del($ds, $dn, array($key => $item))) { + $meldung .= "Delete successfull: ".$key." -> ".$item."<br>"; + } else { + $meldung .= "Delete error: ".$key." -> ".$item."<br>"; + } + } + } + foreach($value_neu as $item) { + $item = htmlentities($item); + # Füge alle neuen Werte des Attributes $key ein. + if(ldap_mod_add($ds, $dn, array($key => $item))) { + $meldung .= "Add successfull: ".$key." -> ".$item."<br>"; + } else { + $meldung .= "Add error: ".$key." -> ".$item."<br>"; + } + + } + } + } + #return $meldung; + if(eregi("error",$meldung)) { + return FALSE; + } else { + return TRUE; + } +} + +/** +* uniLdapDelete löscht beliebige Einträge mit dessen Subtree aus der Datenbank. +* Dabei wird der wird der Baum ab dem Eintrag $dn zu allen Blättern durchlaufen (Es +* können nur Blätter gelöscht werden!!) und die Einträge von hinten her bis einschließlich +* $dn gelöscht +* +* @param resource ds LDAP Directory Handle +* @param string dn Distiguished Name +* +* @return boolean +* +* @author Daniel Höfler +*/ + +function uniLdapDelete($ds, $dn) { + # Überprüfung, ob zu löschender Eintrag vorhanden ist + if(!uniLdapSearch($ds, $dn, "objectclass=*", array("*"), "", "one", 0, 0)) { + $ldapError .= "Löschen fehlgeschlagen: Eintrag nicht gefunden".ldap_error($ds)."<br>\n"; + return false; + } + # Auslesen der Daten unterhalb von $dn + $daten = uniLdapSearch($ds, $dn, "objectclass=*", array("*"), "", "list", 0, 0); + # for-Schleife wird nur ausgeführt, falls sich unterhalb von $dn Einträge befinden + for($i = 0; $i < $daten['count']; $i++){ + uniLdapDelete($ds, $daten[$i]['dn']); + } + # löschen der Blätter + if(ldap_delete($ds, $dn)) { + return true; + } else { + $ldapError .= "Löschen fehlgeschlagen".ldap_error($ds)."<br>\n"; + return false; + } +} + +############################################################################################ +# +# Ab hier LDAP Funktionen (Tarik Gasmi) nutzen die zuvor definierten Funktionen +# von Timothy Burk, u.A. +# +############################################################################################ +# Weitere LDAP Funktionen + +# +# LDAP Funktionen um alle Objekte der AU eines bestimmten Typs mit gewählten Attributen zu holen +# +function get_hosts($auDN,$attributes) +{ + global $ds, $suffix, $ldapError; + + if(!($result = uniLdapSearch($ds, "cn=computers,".$auDN, "(objectclass=Host)", $attributes, "hostname", "sub", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + else{ + $result = ldapArraySauber($result); + # print_r($result);printf("<br><br>"); + $host_array = array(); + foreach ($result as $item){ + foreach ($attributes as $att){ + $atts[$att] = $item[$att]; + } + $atts['auDN'] = $auDN; + $host_array[] = $atts; + } + if($attributes != false ){return $host_array;} + else{return $result;} + } +} + +function get_groups($auDN,$attributes) +{ + global $ds, $suffix, $ldapError; + + if(!($result = uniLdapSearch($ds, "cn=groups,".$auDN, "(objectclass=groupOfComputers)", $attributes, "cn", "sub", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + else{ + $result = ldapArraySauber($result); + # print_r($result);printf("<br><br>"); + $group_array = array(); + foreach ($result as $item){ + foreach ($attributes as $att){ + $atts[$att] = $item[$att]; + } + $atts['auDN'] = $auDN; + $group_array[] = $atts; + } + if($attributes != false ){return $group_array;} + else{return $result;} + } +} + +function get_groups_member($auDN,$attributes,$member) +{ + global $ds, $suffix, $ldapError; + + if(!($result = uniLdapSearch($ds, "cn=groups,".$auDN, "(&(objectclass=groupOfComputers)(member=$member))", $attributes, "cn", "sub", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + else{ + $result = ldapArraySauber($result); + # print_r($result);printf("<br><br>"); + $group_array = array(); + foreach ($result as $item){ + foreach ($attributes as $att){ + $atts[$att] = $item[$att]; + } + $atts['auDN'] = $auDN; + $group_array[] = $atts; + } + if($attributes != false ){return $group_array;} + else{return $result;} + } +} + +function get_machineconfigs($baseDN,$attributes) +{ + global $ds, $suffix, $ldapError; + + if(!($result = uniLdapSearch($ds, $baseDN, "(objectclass=MachineConfig)", $attributes, "", "list", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + elseif(count($result) == 0){return $result;} + else{ + $result = ldapArraySauber($result); + # print_r($result);printf("<br><br>"); + $mc_array = array(); + foreach ($result as $item){ + foreach ($attributes as $att){ + $atts[$att] = $item[$att]; + } + $atts['baseDN'] = $baseDN; + $atts['auDN'] = $auDN; + $mc_array[] = $atts; + } + if($attributes != false ){return $mc_array;} + else{return $result;} + } +} + +function get_pxeconfigs($baseDN,$attributes) +{ + global $ds, $suffix, $ldapError; + + if(!($result = uniLdapSearch($ds, $baseDN, "(objectclass=PxeConfig)", $attributes, "", "list", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + elseif(count($result) == 0){return $result;} + else{ + $result = ldapArraySauber($result); + # print_r($result);printf("<br><br>"); + $pxe_array = array(); + foreach ($result as $item){ + foreach ($attributes as $att){ + $atts[$att] = $item[$att]; + } + $atts['baseDN'] = $baseDN; + $atts['auDN'] = $auDN; + $pxe_array[] = $atts; + } + if($attributes != false ){return $pxe_array;} + else{return $result;} + } +} + +function get_menuentries($baseDN,$attributes) +{ + global $ds, $suffix, $ldapError; + + if(!($result = uniLdapSearch($ds, $baseDN, "(objectclass=MenuEntry)", $attributes, "menuposition", "list", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + elseif(count($result) == 0){return $result;} + else{ + $result = ldapArraySauber($result); + # print_r($result);printf("<br><br>"); + $menent_array = array(); + foreach ($result as $item){ + foreach ($attributes as $att){ + $atts[$att] = $item[$att]; + } + $atts['baseDN'] = $baseDN; + $atts['auDN'] = $auDN; + $menent_array[] = $atts; + } + if($attributes != false ){return $menent_array;} + else{return $result;} + } +} + +function get_rbservices($auDN,$attributes) +{ + global $ds, $suffix, $ldapError; + + if(!($result = uniLdapSearch($ds, "cn=rbs,".$auDN, "(objectclass=RBService)", $attributes, "", "list", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + elseif(count($result) == 0){return $result;} + else{ + $result = ldapArraySauber($result); + # print_r($result);printf("<br><br>"); + $rbs_array = array(); + foreach ($result as $item){ + foreach ($attributes as $att){ + $atts[$att] = $item[$att]; + } + $atts['auDN'] = $auDN; + $rbs_array[] = $atts; + } + if($attributes != false ){return $rbs_array;} + else{return $result;} + } +} + +function get_subnets($auDN,$attributes) +{ + global $ds, $suffix, $ldapError; + + if(!($result = uniLdapSearch($ds, "cn=dhcp,".$auDN, "(objectclass=dhcpSubnet)", $attributes, "cn", "sub", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + else { + $result = ldapArraySauber($result); + $subnet_array = array(); + foreach ($result as $item){ + foreach ($attributes as $att){ + $atts[$att] = $item[$att]; + } + $atts['auDN'] = $auDN; + $subnet_array[] = $atts; + } + if($attributes != false ){return $subnet_array;} + else{return $result;} + } +} + +function get_dhcppools($auDN,$attributes) +{ + global $ds, $suffix, $ldapError; + + if(!($result = uniLdapSearch($ds, "cn=dhcp,".$auDN, "(objectclass=dhcpPool)", $attributes, "cn", "sub", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + else { + $result = ldapArraySauber($result); + + $pool_array = array(); + foreach ($result as $item){ + foreach ($attributes as $att){ + $atts[$att] = $item[$att]; + } + $atts['auDN'] = $auDN; + $pool_array[] = $atts; + } + if($attributes != false ){return $pool_array;} + else{return $result;} + } +} + +function get_childau($auDN,$attributes) +{ + global $ds, $suffix, $ldapError; + + if(!($result = uniLdapSearch($ds, $auDN, "(objectclass=AdministrativeUnit)", $attributes, "ou", "list", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + else { + $result = ldapArraySauber($result); + + $childau_array = array(); + foreach ($result as $item){ + foreach ($attributes as $att){ + $atts[$att] = $item[$att]; + } + $atts['auDN'] = $auDN; + $childau_array[] = $atts; + } + if($attributes != false ){return $childau_array;} + else{return $result;} + } +} + +function get_au_data($auDN,$attributes) +{ + global $ds, $suffix, $ldapError; + + if(!($result = uniLdapSearch($ds, $auDN, "(objectclass=AdministrativeUnit)", $attributes, "ou", "one", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + else { + $result = ldapArraySauber($result); + + $au_array = array(); + foreach ($result as $item){ + foreach ($attributes as $att){ + $atts[$att] = $item[$att]; + } + $atts['auDN'] = $auDN; + $au_array[] = $atts; + } + if($attributes != false ){return $au_array;} + else{return $result;} + } +} + +function get_domain_data($auDN,$attributes) +{ + global $ds, $suffix, $ldapError; + + if(!($result = uniLdapSearch($ds, $suffix, "(&(objectclass=dnsdomain)(associatedname=$auDN))", $attributes, "", "sub", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + else { + $result = ldapArraySauber($result); + + $domain_array = array(); + foreach ($result as $item){ + foreach ($attributes as $att){ + $atts[$att] = $item[$att]; + } + $atts['auDN'] = $auDN; + $domain_array[] = $atts; + } + if($attributes != false ){return $domain_array;} + else{return $result;} + } +} + + +function get_roles($auDN) +{ + global $ds, $suffix, $domDN, $ldapError; + + if(!($result = uniLdapSearch($ds, "cn=roles,".$auDN, "(|(objectclass=GroupOfNames)(objectclass=Admins))", array("cn","member"), "cn", "sub", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + else{ + $result = ldapArraySauber($result); + $roles_array = array(); + #print_r($result); + foreach ($result as $item){ + if ( count($item['member']) > 1 ){ + foreach ($item['member'] as $member){ + $roles_array[$item['cn']][] = $member; + } + } + if ( count($item['member']) == 1 ){ + $roles_array[$item['cn']][] = $item['member']; + } + } + return $roles_array; + } +} + +function get_roles_dns($domDN) +{ + global $ds, $suffix, $ldapError; + + if(!($result = uniLdapSearch($ds, "cn=roles,".$domDN, "(objectclass=GroupOfNames)", array("cn","member"), "cn", "sub", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + else{ + $result = ldapArraySauber($result); + $roles_array = array(); + foreach ($result as $item){ + if ( count($item['member']) > 1){ + foreach ($item['member'] as $member){ + $roles_array[$item['cn']][] = $member; + } + }else{ + $roles_array[$item['cn']][] = $item['member']; + } + } + return $roles_array; + } +} + + +function get_users(){ + + global $ds, $suffix, $ldapError; + + if(!($result = uniLdapSearch($ds, "ou=people,".$suffix, "(objectclass=inetOrgPerson)", array("dn","cn","sn","uid"), "", "sub", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + else{ + $result = ldapArraySauber($result); + $users_array = array(); + # foreach ($result as $item){ + # $users_array[$item['cn']] = $item['member']; + # } + # return $users_array; + return $result; + } +} + +function get_user_data($userDN,$attributes) +{ + global $ds, $suffix, $ldapError; + + if(!($result = uniLdapSearch($ds, $userDN, "(objectclass=inetOrgPerson)", $attributes, "", "one", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + else { + $result = ldapArraySauber($result); + foreach ($result as $item){ + foreach ($attributes as $att){ + $atts[$att] = $item[$att]; + } + $user_data = $atts; + } + if($attributes != false ){return $user_data;} + else{return $result;} + } +} + + +function get_dc_data($dcDN,$attributes) +{ + global $ds, $suffix, $ldapError; + + if(!($result = uniLdapSearch($ds, $dcDN, "(objectclass=dnsdomain)", $attributes, "", "one", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + else { + $result = ldapArraySauber($result); + foreach ($result as $item){ + foreach ($attributes as $att){ + $atts[$att] = $item[$att]; + } + $dc_data = $atts; + } + if($attributes != false ){return $dc_data;} + else{return $result;} + } +} + +function get_node_data($nodeDN,$attributes) +{ + global $ds, $suffix, $ldapError; + + $node_data = array(); + + if(!($result = uniLdapSearch($ds, $nodeDN, "(objectclass=*)", $attributes, "", "one", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + else { + $result = ldapArraySauber($result); + foreach ($result as $item){ + foreach ($attributes as $att){ + $node_data[$att] = $item[$att]; + } + } + if($attributes != false ){return $node_data;} + else{return $result;} + } +} + + + +function get_zone_entries($dcDN,$attributes) +{ + global $ds, $suffix, $ldapError; + + if(!($result = uniLdapSearch($ds, $dcDN, "(|(objectclass=dNSZone)(objectclass=dNSZoneIncludeDirective))", $attributes, "", "list", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + else{ + $result = ldapArraySauber($result); + # print_r($result);printf("<br><br>"); + $zone_array = array(); + foreach ($result as $item){ + foreach ($attributes as $att){ + $atts[$att] = $item[$att]; + } + $atts['dcDN'] = $dcDN; + $zone_array[] = $atts; + } + if($attributes != false ){return $zone_array;} + else{return $result;} + } +} + + +function get_zone_entries_assocname($dcDN,$attributes,$assocname) +{ + global $ds, $suffix, $ldapError; + + if(!($result = uniLdapSearch($ds, $dcDN, "(&(|(objectclass=dNSZone)(objectclass=dNSZoneIncludeDirective))(associatedname=$assocname))", $attributes, "", "list", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + else{ + $result = ldapArraySauber($result); + # print_r($result);printf("<br><br>"); + $zone_array = array(); + foreach ($result as $item){ + foreach ($attributes as $att){ + $atts[$att] = $item[$att]; + } + $atts['dcDN'] = $dcDN; + $zone_array[] = $atts; + } + if($attributes != false ){return $zone_array;} + else{return $result;} + } +} + +function get_dn_menuposition($pxeDN,$pos) +{ + global $ds, $suffix, $ldapError; + + if(!($result = uniLdapSearch($ds, $pxeDN, "(menuposition=$pos)", array("dn"), "", "list", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + else { + $result = ldapArraySauber($result); + return $result[0]['dn']; + } +} + +function get_dhcpservices($auDN,$attributes) +{ + global $ds, $suffix, $ldapError; + + if(!($result = uniLdapSearch($ds, "cn=dhcp,".$auDN, "(objectclass=dhcpService)", $attributes, "", "list", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + elseif(count($result) == 0){return $result;} + else{ + $result = ldapArraySauber($result); + # print_r($result);printf("<br><br>"); + $dhcp_array = array(); + foreach ($result as $item){ + foreach ($attributes as $att){ + $atts[$att] = $item[$att]; + } + $atts['auDN'] = $auDN; + $dhcp_array[] = $atts; + } + if($attributes != false ){return $dhcp_array;} + else{return $result;} + } +} + +function get_dhcpsubnets($auDN,$attributes) +{ + global $ds, $suffix, $ldapError; + + if(!($result = uniLdapSearch($ds, "cn=dhcp,".$auDN, "(objectclass=dhcpSubnet)", $attributes, "", "list", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + elseif(count($result) == 0){return $result;} + else{ + $result = ldapArraySauber($result); + # print_r($result);printf("<br><br>"); + $dhcp_array = array(); + foreach ($result as $item){ + foreach ($attributes as $att){ + $atts[$att] = $item[$att]; + } + $atts['auDN'] = $auDN; + $dhcp_array[] = $atts; + } + if($attributes != false ){return $dhcp_array;} + else{return $result;} + } +} + +function get_service_subnets($dhcpserviceDN,$attributes) +{ + global $ds, $suffix, $ldapError; + + $filter = "(&(dhcphlpcont=".$dhcpserviceDN.")(objectclass=dhcpSubnet))"; + if(!($result = uniLdapSearch($ds, "ou=RIPM,".$suffix, $filter, $attributes, "", "sub", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + elseif(count($result) == 0){return $result;} + else{ + $result = ldapArraySauber($result); + # print_r($result); + $dhcpsubnets = array(); + foreach ($result as $item){ + foreach ($attributes as $att){ + $atts[$att] = $item[$att]; + } + $expdn = ldap_explode_dn($item['dn'],1); + $au = array_slice($expdn, 3, 1); + $atts['auDN'] = implode ( ',', $au ); + $dhcpsubnets [] = $atts; + } + #print_r($dhcpsubnets); + if($attributes != false ){ + return $dhcpsubnets; + } + else{return $result;} + } +} +?> diff --git a/ldap-site-mngmt/webinterface/lib/ldap2.inc.php b/ldap-site-mngmt/webinterface/lib/ldap2.inc.php new file mode 100644 index 00000000..3d0b26d9 --- /dev/null +++ b/ldap-site-mngmt/webinterface/lib/ldap2.inc.php @@ -0,0 +1,350 @@ +<?php +/** +* ldap2.inc.php - LDAP-Bibliothek +* Diese Bibliothek enthält weitere LDAP Hilfs-Funktionen +* +* @param string ldapError +* @param resource ds +* +* @author Tarik Gasmi +* @copyright Tarik Gasmi +*/ +//Konfiguration laden +require_once("config.inc.php"); + +$ldapError = null; + + +# Liefert Array aller Child-Knoten mit bestimmten ausgwählten Attributen +function get_childs($baseDN,$attributes) +{ + global $ds, $suffix, $ldapError; + + if(!($result = uniLdapSearch($ds, $baseDN, "(objectclass=*)", $attributes, "", "list", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + else { + $result = ldapArraySauber($result); + + $childau_array = array(); + foreach ($result as $item){ + foreach ($attributes as $att){ + $atts[$att] = $item[$att]; + } + $childau_array[] = $atts; + } + if($attributes != false ){return $childau_array;} + else{return $result;} + } +} + +# Liefert die RDNs aller Child-Knoten +function get_childs_rdn($baseDN){ + + $childs = get_childs($baseDN,array("dn")); + # print_r($childs); echo "<br><br>"; + + $childs_rdn = array(); + foreach ($childs as $item){ + $exp = explode(',',$item['dn']); + $rdn = $exp[0]; + $childs_rdn[] = $rdn; + } + + # print_r($childs_rdn); + return $childs_rdn; +} + + +# Attribute eines Knotens (Vorsicht Array enthält noch DN und COUNT) +# in einem Array wie er z.B. von ldap_add verwendet wird +function get_node_attributes($nodeDN){ + global $ds, $suffix, $ldapError; + + if(!($result = uniLdapSearch($ds, $nodeDN, "(objectclass=*)", array(), "", "one", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + $result = ldapArraySauber($result); + # print_r($result); + foreach ($result as $item){ + foreach (array_keys($item) as $merkmal) + $attrs[$merkmal] = $item[$merkmal]; + } + return $attrs; +} + +# Rekursives Kopieren +function dive_into_tree_cp($baseDN,$new_baseDN){ + + global $ds, $suffix, $ldapError; + + $expldn = ldap_explode_dn($new_baseDN,0); + $new_node_rdn = $expldn[0]; + $exp = explode('=',$new_node_rdn); + $new_node_rdn_merk = $exp[0]; + $new_node_rdn_val = $exp[1]; + $new_node_rdn_merk = strtolower($new_node_rdn_merk); + + $childs_rdn = get_childs_rdn($baseDN); + + $attrs = get_node_attributes($baseDN); + # print_r($attrs); echo "<br>"; + unset($attrs['dn']); + unset($attrs['count']); + $attrs["$new_node_rdn_merk"] = $new_node_rdn_val; + # print_r($attrs); echo "<br>"; + + $result = ldap_add($ds,$new_baseDN,$attrs); + + + //recursivly do dive for each child + foreach($childs_rdn as $rdn){ + dive_into_tree_cp( $rdn.",".$baseDN , $rdn.",".$new_baseDN); + } + return $result; +} + + +# +# Rekursives Loeschen +function dive_into_tree_del($baseDN,$except){ + + global $ds, $suffix, $ldapError; + + $childs_rdn = get_childs_rdn($baseDN); + //recursivly do dive for each child + foreach($childs_rdn as $rdn){ + dive_into_tree_del( $rdn.",".$baseDN , $except); + } + if($baseDN != $except){ + $result = ldap_delete($ds,$baseDN); + } + + return $result; +} + +# Rekursives Verschieben +function move_subtree($oldDN,$newDN){ + + if(dive_into_tree_cp($oldDN,$newDN)) + { + dive_into_tree_del($oldDN,""); + echo "Moved subtree<br>"; + return 1; + } + else echo "Moving subtree not possible!!!<br>"; +} + + +function adjust_dn_entries($oldDN,$newDN){ + + global $ds, $suffix, $ldapError; + + # single Attributes: + if(!($result = uniLdapSearch($ds, $newDN, "(objectclass=host)", array("dn","dhcphlpcont"), "", "sub", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + $result = ldapArraySauber($result); + #print_r($result); echo "<br><br>"; + foreach ($result as $item){ + if (strpos($item['dhcphlpcont'],$oldDN) != false){ + $newvalue = str_replace($oldDN,$newDN,$item['dhcphlpcont']); + $entry['dhcphlpcont'] = $newvalue; + ldap_mod_replace($ds,$item['dn'],$entry); + } + } + + if(!($result = uniLdapSearch($ds, $newDN, "(objectclass=PXEConfig)", array("dn","rbservicedn"), "", "sub", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + $result = ldapArraySauber($result); + #print_r($result); echo "<br><br>"; + foreach ($result as $item2){ + if (strpos($item2['rbservicedn'],$oldDN) != false){ + $newvalue = str_replace($oldDN,$newDN,$item2['rbservicedn']); + $entry2['rbservicedn'] = $newvalue; + ldap_mod_replace($ds,$item2['dn'],$entry2); + } + } + + if(!($result = uniLdapSearch($ds, $newDN, "(objectclass=dhcpService)", array("dn","dhcpprimarydn","dhcpsecondarydn"), "", "sub", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + $result = ldapArraySauber($result); + #print_r($result); echo "<br><br>"; + foreach ($result as $item3){ + if (strpos($item3['dhcpprimarydn'],$oldDN) != false){ + $newvalue = str_replace($oldDN,$newDN,$item3['dhcpprimarydn']); + $entry3['dhcpprimarydn'] = $newvalue; + ldap_mod_replace($ds,$item3['dn'],$entry3); + } + if (strpos($item3['dhcpsecondarydn'],$oldDN) != false){ + $newvalue = str_replace($oldDN,$newDN,$item3['dhcpsecondarydn']); + $entry4['dhcpsecondarydn'] = $newvalue; + ldap_mod_replace($ds,$item3['dn'],$entry4); + } + } + + if(!($result = uniLdapSearch($ds, $newDN, "(objectclass=MenuEntry)", array("dn","genericmenuentrydn","ldapuri"), "", "sub", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + $result = ldapArraySauber($result); + #print_r($result); echo "<br><br>"; + foreach ($result as $item4){ + if (strpos($item4['genericmenuentrydn'],$oldDN) != false){ + $newvalue = str_replace($oldDN,$newDN,$item4['genericmenuentrydn']); + $entry5['genericmenuentrydn'] = $newvalue; + ldap_mod_replace($ds,$item4['dn'],$entry5); + } + if (strpos($item4['ldapuri'],$oldDN) != false){ + $newvalue = str_replace($oldDN,$newDN,$item4['ldapuri']); + $entry6['ldapuri'] = $newvalue; + ldap_mod_replace($ds,$item4['dn'],$entry6); + } + } + + # Multi-Attribut member + if(!($result = uniLdapSearch($ds, $newDN, "(objectclass=groupOfComputers)", array("dn","member","dhcphlpcont"), "", "sub", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + $result = ldapArraySauber($result); + #print_r($result); echo "<br><br>"; + foreach ($result as $item5){ + for ($i=0; $i<count($item5['member']); $i++){ + if (strpos($item5['member'][$i],$oldDN) != false){ + $newvalue = str_replace($oldDN,$newDN,$item5['member'][$i]); + $entry7['member'][$i] = $newvalue; + }else{ + $entry7['member'][$i] = $item5['member'][$i]; + } + ldap_mod_replace($ds,$item5['dn'],$entry7); + } + if (strpos($item5['dhcphlpcont'],$oldDN) != false){ + $newvalue = str_replace($oldDN,$newDN,$item5['dhcphlpcont']); + $entry8['dhcphlpcont'] = $newvalue; + ldap_mod_replace($ds,$item5['dn'],$entry8); + } + + } + + # Attribut AssociatedName in DNS Teilbaum + if(!($result = uniLdapSearch($ds, "ou=DNS,".$suffix , "(associatedname=$oldDN)", array("dn","associatedname"), "", "sub", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + $result = ldapArraySauber($result); + #print_r($result); echo "<br><br>"; + foreach ($result as $item6){ + $newvalue = str_replace($oldDN,$newDN,$item6['associatedname']); + $entry9['associatedname'] = $newvalue; + ldap_mod_replace($ds,$item6['dn'],$entry9); + } + + # Attribut RelativeDomainName in DNS Teilbaum ... noch nicht fertig + $hostdnexpold = ldap_explode_dn($oldDN, 0); + $hostdnexpnew = ldap_explode_dn($newDN, 0); + $oldhostname = $hostdnexpold[0]; + $newhostname = $hostdnexpnew[0]; + if(!($result = uniLdapSearch($ds, "ou=DNS,".$suffix , "(relativedomainname=$oldhostname)", array("dn","relativedomainname"), "", "sub", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + $result = ldapArraySauber($result); + #print_r($result); echo "<br><br>"; + foreach ($result as $item7){ + $newvalue = str_replace($oldhostname,$newhostname,$item7['relativedomainname']); + $entry10['relativedomainname'] = $newvalue; + ldap_mod_replace($ds,$item7['dn'],$entry10); + } + +} + + + +function check_for_dc($dn, $dc){ + global $ds, $suffix, $ldapError; + if(!($result = uniLdapSearch($ds, $dn, "(dc=$dc)", array("dc"), "", "list", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + $result = ldapArraySauber($result); + if (count($result[0]['dc']) == 0 ) {return 0;} + elseif ($result[0]['dc'] == $dc){return 1;} +} + + +function get_dc_childs($baseDN,$attributes) +{ + global $ds, $suffix, $ldapError; + + if(!($result = uniLdapSearch($ds, $baseDN, "(objectclass=dnsdomain)", $attributes, "", "list", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + else { + $result = ldapArraySauber($result); + + $childau_array = array(); + foreach ($result as $item){ + foreach ($attributes as $att){ + $atts[$att] = $item[$att]; + } + $childau_array[] = $atts; + } + if($attributes != false ){return $childau_array;} + else{return $result;} + } +} + +# Liefert die RDNs aller dc-Child-Knoten +function get_dc_childs_rdn($baseDN){ + + global $ds, $suffix, $ldapError; + + $childs = get_dc_childs($baseDN,array("dn")); + # print_r($childs); echo "<br><br>"; + + $childs_rdn = array(); + foreach ($childs as $item){ + $exp = explode(',',$item['dn']); + $rdn = $exp[0]; + $childs_rdn[] = $rdn; + } + + # print_r($childs_rdn); + return $childs_rdn; +} + +function get_entry_number($entryDN,$entryobjectclass){ + + global $ds, $suffix, $ldapError; + + if(!($result = uniLdapSearch($ds, $entryDN, "(objectclass=machineconfig)", array("count"), "", "one", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + $result = ldapArraySauber($result); + print_r ($result); + +} + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/lib/rbs_management_functions.php b/ldap-site-mngmt/webinterface/lib/rbs_management_functions.php new file mode 100644 index 00000000..6b1f42fd --- /dev/null +++ b/ldap-site-mngmt/webinterface/lib/rbs_management_functions.php @@ -0,0 +1,591 @@ +<?php + +/** +* rbs_management_functions.php - Remote Boot Services Management Funktions-Bibliothek +* Diese Bibliothek enthält alle Funktionen für die Verwaltung von RBS Diensten, +* PXE Konfigurationsdateien ihren Menüeinträgen und ihren Genersichen Bootmenüeinträgen +* +* @param string ldapError +* @param resource ds +* +* @author Tarik Gasmi +* @copyright Tarik Gasmi +*/ + + +# Konfiguration laden +require_once("config.inc.php"); + +$ldapError = null; + + +####################################################################### +# Funktionen zur Verwaltung von RBS Diensten +# + +# +# Neues RBS Dienst-Objekt anlegen +# +function add_rbs($rbsDN,$rbscn,$rbsoffer,$server,$atts){ + + global $ds, $suffix, $auDN, $ldapError; + + $rbsentry ['objectclass'][0] = "RBService"; + $rbsentry ['objectclass'][1] = "top"; + $rbsentry ['cn'] = $rbscn; + $rbsentry ['rbsofferdn'] = $rbsoffer; + if (count($atts) != 0){ + foreach (array_keys($atts) as $key){ + if ($atts[$key] != ""){ + $rbsentry[$key] = $atts[$key]; + } + } + } + if (count($server) != 0){ + if ($server['tftp'] != ""){$rbsentry ['tftpserverip'] = $server['tftp'];} + if ($server['nfs'] != ""){$rbsentry ['nfsserverip'] = $server['nfs'];} + if ($server['nbd'] != ""){$rbsentry ['nbdserverip'] = $server['nbd'];} + } + # print_r($rbsentry); echo "<br>"; + print_r($rbsDN); echo "<br>"; + + # Standard Fallback Menü anlegen + $pxecn = "PXE_Fallback-No-Config"; + $pxeDN = "cn=".$pxecn.",".$rbsDN; + $filename = array("fallback-nopxe"); + $ldapuri = LDAP_HOST."/dn=cn=computers,".$auDN; # wirklich nötig?? + $mecn = "Fallback-Text"; + $meDN = "cn=".$mecn.",".$pxeDN; + $meattribs = array("label" => "Keine PXE Boot-Konfiguration fuer die aktuelle Zeit definiert", + "kernel" => "menu.c32", + "submenulink" => "fallback-nopxe"); + + if (ldap_add($ds,$rbsDN,$rbsentry)){ + if (add_pxe($pxeDN,$pxecn,$rbsDN,"",array(),$filename,$ldapuri)){ + if (add_me($meDN,$mecn,"","01",$meattribs,$pxeDN)){ + return 1; + } + else{ + return 0; + } + } + else{ + return 0; + } + } + else{ + return 0; + } +} + +# +# "RBS-Angebote" im Verzeichnis suchen, die die AU ($auDN) nutzen darf, +# Suche nach passenden RBS-Offer-DNs +# +function get_rbsoffers($auDN){ + + global $ds, $suffix, $auDN, $ldapError; + + $attribs = array("dn","rbsofferdn"); + if(!($result = uniLdapSearch($ds, "ou=RIPM,".$suffix, "(objectclass=RBService)", $attribs, "dn", "sub", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + else{ + $result = ldapArraySauber($result); + #print_r($result);echo "<br><br>"; + + $rbs_offers = array(); + foreach ($result as $rbs){ + #print_r(strpos($auDN, $rbs['rbsofferdn']));echo "<br>"; + if ( strpos($auDN, $rbs['rbsofferdn']) !== false ) + $rbs_offers [] = $rbs['dn']; + } + } + #print_r($rbs_offers);echo "<br><br>"; + return $rbs_offers; +} + + +# +# Beim Löschen von RBS-Objekten muss dafür gesorgt werden dass keine PXEs mehr auf +# diese zeigen, Ref. Abhängigkeiten +# +function clean_up_del_rbs($rbsDN){ + + global $ds, $suffix, $auDN, $ldapError; + + $attribs = array("dn"); + if(!($result = uniLdapSearch($ds, "ou=RIPM,".$suffix, "(&(objectclass=PXEConfig)(rbservicedn=$rbsDN))", $attribs, "dn", "sub", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + $result = ldapArraySauber($result); + #print_r($result); echo "<br><br>"; + $delentry ['rbservicedn'] = $rbsDN; + foreach ($result as $item){ + #print_r($item['dn']); echo "<br>"; + ldap_mod_del($ds, $item['dn'], $delentry); + } + + if(!($result = uniLdapSearch($ds, "ou=RIPM,".$suffix, "(&(objectclass=Host)(hlprbservice=$rbsDN))", $attribs, "dn", "sub", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + $result = ldapArraySauber($result); + #print_r($result); echo "<br><br>"; + $delentry2 ['hlprbservice'] = $rbsDN; + foreach ($result as $item){ + #print_r($item['dn']); echo "<br>"; + ldap_mod_del($ds, $item['dn'], $delentry2); + } + +} + +# +# beim ändern des CN (DN) des RBS muss dieses in allen referenzierenden PXEConfig-Objekten +# nachvollzogen werden, Ref. Abhängigkeiten +# +function adjust_rbs_dn($newrbsDN, $rbsDN){ + + global $ds, $suffix, $auDN, $ldapError; + + if(!($result = uniLdapSearch($ds, "ou=RIPM,".$suffix, "(&(objectclass=PXEConfig)(rbservicedn=$rbsDN))", array("dn"), "dn", "sub", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + $result = ldapArraySauber($result); + $modentry ['rbservicedn'] = $newrbsDN; + foreach ($result as $item){ + ldap_mod_replace($ds, $item['dn'], $modentry); + } + + if(!($result = uniLdapSearch($ds, "ou=RIPM,".$suffix, "(&(objectclass=Host)(hlprbservice=$rbsDN))", array("dn"), "dn", "sub", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + $result = ldapArraySauber($result); + $modentry2 ['hlprbservice'] = $newrbsDN; + foreach ($result as $item){ + ldap_mod_replace($ds, $item['dn'], $modentry2); + } +} + +function rbs_adjust_host($hostDN, $rbs){ + + global $ds, $suffix, $ldapError; + + $modentry ['rbservicedn'] = $rbs; + + $pxearray = get_pxeconfigs($hostDN,array("dn")); + if ( count($pxearray) != 0 ){ + foreach ( $pxearray as $item ){ + if ($result = ldap_mod_replace($ds,$item['dn'],$modentry)){ + return 1; + }else{ + return 0; + } + } + } +} + + +# +# Sucht den Hostname zu einer IP im Rechnerteilbaum der AU +# Verwaltung der am RBS beteiligten Server +# +function get_hostname_from_ip($ip,$auDN){ + + global $ds, $suffix, $ldapError; + + $ipp = array($ip,$ip); + $ipaddress = implode('_',$ipp); + + if(!($result = uniLdapSearch($ds, "cn=computers,".$auDN, "(&(objectclass=Host)(ipaddress=$ipaddress))", array("hostname"), "", "list", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + elseif(count($result) == 0){echo "kein Rechner mit dieser IP"; return "";} + else{ + $result = ldapArraySauber($result); + #print_r($result); + $host ['hostname'] = $result[0]['hostname']; + $host ['dn'] = $result[0]['dn']; + return $host; + } +} + + +############################################################################### +# Funktionen zur Verwaltung von PXE Bootmenüs + +# +# Ãœberprüft, ob sich die angegebene Timerange auf einer der 4 Spezifikationsstufen mit anderen +# Timeranges des Objkets überschneidet +# +function check_timerange_pxe($pxeday,$pxebeg,$pxeend,$nodeDN,$excepttimerange){ + + global $ds, $suffix, $auDN, $ldapError; + + $brothers = get_pxeconfigs($nodeDN,array("timerange")); + # keine Ãœberschneidungen pro Spez.Ebene zulassen + # print_r($brothers); echo "<br><br>"; + if (count($brothers) != 0){ + + $intersect = 0; + foreach ($brothers as $item){ + + # Fall das Brother mehrere TimeRanges hat + if (count($item['timerange']) > 1){ + foreach ($item['timerange'] as $tr){ + + if($tr != $excepttimerange){ + $exptime = explode('_',$tr); + $bpxeday = $exptime[0]; + $bpxebeg = $exptime[1]; + $bpxeend = $exptime[2]; + #echo "pxeday:"; print_r($pxeday); echo "<br>"; + #echo "bpxeday:"; print_r($bpxeday); echo "<br>"; + #echo "pxebeg:"; print_r($pxebeg); echo "<br>"; + #echo "bpxebeg:"; print_r($bpxebeg); echo "<br>"; + #echo "pxeend:"; print_r($pxeend); echo "<br>"; + #echo "bpxeend:"; print_r($bpxeend); echo "<br>"; + + if ($pxeday == $bpxeday){ + if ( $pxebeg > $bpxeend || $pxeend < $bpxebeg ){ + # keine Ãœberschneidung in der Uhrzeit + }else{ + # Uhrzeit Ãœberschneidung + $intersect = 1; + $intersecttr = $bpxeday."_".$bpxebeg."_".$bpxeend; + break; + } + } + } + + } + } + # Fall das Brother nur eine TimeRange hat + elseif (count($item['timerange']) == 1){ + + if($item['timerange'] != $excepttimerange){ + $exptime = explode('_',$item['timerange']); + $bpxeday = $exptime[0]; + $bpxebeg = $exptime[1]; + $bpxeend = $exptime[2]; + #echo "pxeday:"; print_r($pxeday); echo "<br>"; + #echo "bpxeday:"; print_r($bpxeday); echo "<br>"; + #echo "pxebeg:"; print_r($pxebeg); echo "<br>"; + #echo "bpxebeg:"; print_r($bpxebeg); echo "<br>"; + #echo "pxeend:"; print_r($pxeend); echo "<br>"; + #echo "bmcend:"; print_r($bpxeend); echo "<br>"; + + if ($pxeday == $bpxeday){ + if ( $pxebeg > $bpxeend || $pxeend < $bpxebeg ){ + # keine Ãœberschneidung in der Uhrzeit + }else{ + # Uhrzeit Ãœberschneidung + $intersect = 1; + $intersecttr = $bpxeday."_".$bpxebeg."_".$bpxeend; + break; + } + } + } + } + } + #echo "intersect: "; print_r($intersect); echo "<br>"; + if ($intersect == 1){ + echo "<b>[".$pxeday."_".$pxebeg."_".$pxeend."]</b> überschneidet sich mit der + bereits existierende <b>Time Range [".$intersecttr."]</b> !<br><br>"; + return 0; + }else{ + return 1; + } + }else{ + return 1; + } +} + + +# +# Neues PXE Bootmenü anlegen +# +function add_pxe($pxeDN,$pxecn,$rbsDN,$pxetimerange,$pxeattribs,$filenames,$conffile){ + + global $ds, $suffix, $auDN, $ldapError; + + $pxeentry ['objectclass'][0] = "PXEConfig"; + $pxeentry ['objectclass'][1] = "top"; + $pxeentry ['cn'] = $pxecn; + $pxeentry ['rbservicedn'] = $rbsDN; + #$pxeentry ['ldapuri'] = $ldapuri; + if ($conffile != ""){$pxeentry ['fileuri'] = $conffile;} + if (count($filenames) > 1 ){ + for ($i=0; $i<count($filenames); $i++){ + $pxeentry ['filename'][$i] = $filenames[$i]; + } + } + if (count($filenames) == 1){ + $pxeentry ['filename'] = $filenames[0]; + } + if ($pxetimerange != ""){$pxeentry ['timerange'] = $pxetimerange;} + if (count($pxeattribs) != 0){ + foreach (array_keys($pxeattribs) as $key){ + if ($pxeattribs[$key] != ""){ + $pxeentry[$key] = $pxeattribs[$key]; + } + } + } + #print_r($pxeentry); echo "<br>"; + print_r($pxeDN); echo "<br>"; + if (ldap_add($ds,$pxeDN,$pxeentry)){ + return 1; + } + else{ + return 0; + } +} + + +# +# PXE CN (DN) ändern, Teilbaum verschieben +# +function modify_pxe_dn($pxeDN, $newpxeDN){ + + global $ds, $suffix, $ldapError; + + if (move_subtree($pxeDN,$newpxeDN)){ + return 1; + }else{ + return 0; + } +} + + +# +# Timerange eines PXEConfig-Objekts ändern +# +function change_pxe_timerange($pxeDN,$newpxeDN,$pxetimerange){ + + global $ds, $suffix, $auDN, $ldapError; + + # move tree + if (move_subtree($pxeDN,$newpxeDN)){ + # timerange ändern + $entrypxe ['timerange'] = $pxetimerange; + if (ldap_mod_replace($ds,$newpxeDN,$entrypxe)){ + return 1; + } + else{ + return 0; + } + } + else{ + return 0; + } +} + +# +# nach dem Löschen von PXEConfig Menueinträgen müssen Menüpositionen in der PXEConfig +# angepasst werden (Lücken schließen) +# +function cleanup_menupositions($pxeDN){ + + global $ds, $suffix, $auDN, $ldapError; + + $me = get_menuentries($pxeDN,array("dn","menuposition")); + if (count($me) != 0){ + foreach ($me as $item){ + $pos = $item['menuposition']; + $pos = preg_replace ( '/0([0-9])/', '$1', $pos); + $menpos[$pos] = $item['dn']; + ksort($menpos); + } + $p = 1; + foreach ($menpos as $item){ + if (strlen($p) == 1){ + $p = "0".$p; + } + $entry ['menuposition'] = $p; + ldap_mod_replace($ds,$item,$entry); + $p++; + } + } +} + +# +# Hilfsfunktion zur Verarbeitung von Menüpositionen in PXEConfigs +# +function increment_menupositions($pxeDN,$menpos){ + + global $ds, $suffix, $auDN, $ldapError; + + if (strlen($menpos) == 1){ + $menpos = "0".$menpos; + } + $meDN = get_dn_menuposition($pxeDN,$menpos); + if ($meDN != ""){ + # zur Berechnung erst führende Nullen weg + $menpos = preg_replace ( '/0([0-9])/', '$1', $menpos); + $newpos = $menpos+1; + increment_menupositions($pxeDN,$newpos); + # zum Eintragen führenden Nullen wieder dazu + if (strlen($newpos) == 1){ + $newpos = "0".$newpos; + } + $entry ['menuposition'] = $newpos; + ldap_mod_replace($ds,$meDN,$entry); + } +} + +# +# Neuen Menüeintrag anlegen +# +function add_me($meDN,$mecn,$gbmDN,$menpos,$meattribs,$pxeDN){ + + global $ds, $suffix, $auDN, $ldapError; + + $mentry ['objectclass'][0] = "MenuEntry"; + $mentry ['objectclass'][1] = "top"; + $mentry ['cn'] = $mecn; + if($gbmDN != ""){$mentry ['genericmenuentrydn'] = $gbmDN;} + $mentry ['menuposition'] = $menpos; + if (count($meattribs) != 0){ + foreach (array_keys($meattribs) as $key){ + if ($meattribs[$key] != ""){ + $mentry[$key] = $meattribs[$key]; + } + } + } + print_r($mentry); echo "<br>"; + print_r($meDN); echo "<br>"; + increment_menupositions($pxeDN,$menpos); # andere jeweils um 1 erhöhen + if (ldap_add($ds,$meDN,$mentry)){ + return 1; + } + else{ + return 0; + } +} + + +# +# Menu Entry CN (DN) ändern +# +function modify_me_dn($meDN, $newmeDN){ + + global $ds, $suffix, $ldapError; + + if (move_subtree($meDN,$newmeDN)){ + return 1; + }else{ + return 0; + } +} + + + +##################################################################### +# Verwaltung von GBM +# + +function add_gbm($gbmDN,$gbmcn,$attribs){ + + global $ds, $suffix, $auDN, $ldapError; + + $entry ['objectclass'][0] = "MenuEntry"; + $entry ['objectclass'][1] = "top"; + $entry ['cn'] = $gbmcn; + if (count($attribs) != 0){ + foreach (array_keys($attribs) as $key){ + if ($attribs[$key] != ""){ + $entry[$key] = $attribs[$key]; + } + } + } + print_r($entry); echo "<br>"; + print_r($gbmDN); echo "<br>"; + if (ldap_add($ds,$gbmDN,$entry)){ + return 1; + } + else{ + return 0; + } +} + + +# +# beim löschen von GBMs muss dafür gesorgt werden, dass keine MEs mehr auf diese zeigen, +# Ref.Abhängigkeiten (sonst gibts Fehler beim PXE-Perlskript und die Nutzer wissen nicht dass ihr PXE Menü nicht +# mehr funktioniert, so kann man durch Fehlen des gbmDN wissen das es kein GBM mehr zu diesem ME gibt +# +function clean_up_del_gbm($gbmDN){ + + global $ds, $suffix, $auDN, $ldapError; + + $attribs = array("dn","genericmenuentrydn"); + if(!($result = uniLdapSearch($ds, "ou=RIPM,".$suffix, "(&(objectclass=MenuEntry)(genericmenuentrydn=$gbmDN))", $attribs, "dn", "sub", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + $result = ldapArraySauber($result); + #print_r($result); echo "<br><br>"; + $delentry ['genericmenuentrydn'] = $gbmDN; + foreach ($result as $item){ + #print_r($item['dn']); echo "<br>"; + ldap_mod_del($ds, $item['dn'], $delentry); + } + +} + + +# +# beim ändern des CN (DN) des GBM, Meüeinträge anpassen, Ref. Abhängigkeiten +# +function adjust_gbm_dn($newgbmDN, $gbmDN){ + + global $ds, $suffix, $auDN, $ldapError; + + if(!($result = uniLdapSearch($ds, "ou=RIPM,".$suffix, "(&(objectclass=MenuEntry)(genericmenuentrydn=$gbmDN))", array("dn"), "dn", "sub", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + $result = ldapArraySauber($result); + $modentry ['genericmenuentrydn'] = $newgbmDN; + foreach ($result as $item){ + ldap_mod_replace($ds, $item['dn'], $modentry); + } +} + + + +function alternative_rbservices($rbsDN){ + + global $ds, $suffix, $auDN, $ldapError; + + $alt_rbs = array(); + + $rbsarray = get_rbsoffers($auDN); + # print_r($rbsarray); echo "<br>"; + if (count($rbsarray) != 0){ + for ($i=0; $i < count($rbsarray); $i++){ + if ($rbsarray[$i] != $rbsDN){ + $exp = ldap_explode_dn ( $rbsarray[$i], 1 ); + $alt = array ("dn" => $rbsarray[$i], "cn" => $exp[0], "au" => " / ".$exp[2]); + $alt_rbs[] = $alt; + } + } + } + + return $alt_rbs; +} + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/lib/syntax_check.php b/ldap-site-mngmt/webinterface/lib/syntax_check.php new file mode 100644 index 00000000..35924e3c --- /dev/null +++ b/ldap-site-mngmt/webinterface/lib/syntax_check.php @@ -0,0 +1,268 @@ +<?php +/* + Syntaxcheck 1.2 2006/08/08 + + A class for checking syntax of forms data + Copyright (c) Tarik Gasmi, All Rights Reserved +*/ + + +class Syntaxcheck +{ + + var $ERROR = ""; + var $CLEAR = false; + + function Syntaxcheck () + { + return; + } + + function clear_error () + { + $this->ERROR = ""; + } + + + + + +# Ist "dotted quad IPAddress" in gueltigem Bereich? true or false +# Ueberprueft Format, fuehrende Nullen, und Werte > 255 +# +# Ueberprueft nicht nach reservierten oder nicht-route-baren IPs. +# +function check_ip_syntax($IP) +{ + if($this->CLEAR) { $this->clear_error();} + + $len = strlen($IP); + if( $len > 15 ){ + $this->ERROR = "check_ip_syntax: too long [$IP][$len]"; + return false; + } + + $badcharacter = eregi_replace("([0-9\.]+)","",$IP); + if(!empty($badcharacter)){ + $this->ERROR = "check_ip_syntax: Bad data in IP address [$badcharacter]"; + return false; + } + + $chunks = explode(".",$IP); + $count = count($chunks); + if ($count != 4){ + $this->ERROR = "check_ip_syntax: not a dotted quad [$IP]"; + return false; + } + + while ( list ($key,$val) = each ($chunks) ){ + if(ereg("^0",$val)){ + $this->ERROR = "check_ip_syntax: Invalid IP segment [$val]"; + return false; + } + $Num = $val; + settype($Num,"integer"); + if($Num > 255){ + $this->ERROR = "check_ip_syntax: Segment out of range [$Num]"; + return false; + } + } + + return true; + +} + +# Netzwerkaddresse +function check_netip_syntax($IP) +{ + if($this->CLEAR) { $this->clear_error();} + + if ( !($this->check_ip_syntax($IP)) ){ + return false; + } + $chunks = explode(".",$IP); + if ( $chunks[3] != "0" ){ + return false; + } + return true; +} + +# MAC Adresse + +# Domainname + +# Hostname +function is_hostname ($hostname = ""){ + + if($this->CLEAR) { $this->clear_error(); } + + $web = false; + + if(empty($hostname)) + { + $this->ERROR = "is_hostname: No hostname submitted"; + return false; + } + + // Only a-z, 0-9, and "-" or "." are permitted in a hostname + + // Patch for POSIX regex lib by Sascha Schumann sas@schell.de + $Bad = eregi_replace("[-A-Z0-9\.]","",$hostname); + + if(!empty($Bad)) + { + $this->ERROR = "is_hostname: invalid chars [$Bad]"; + return false; + } + + // See if we're doing www.hostname.tld or hostname.tld + if(eregi("^www\.",$hostname)) + { + $web = true; + } + + // double "." is a not permitted + if(ereg("\.\.",$hostname)) + { + $this->ERROR = "is_hostname: Double dot in [$hostname]"; + return false; + } + if(ereg("^\.",$hostname)) + { + $this->ERROR = "is_hostname: leading dot in [$hostname]"; + return false; + } + + $chunks = explode(".",$hostname); + + if( (gettype($chunks)) != "array") + { + $this->ERROR = "is_hostname: Invalid hostname, no dot seperator [$hostname]"; + return false; + } + + $count = ( (count($chunks)) - 1); + + if($count < 1) + { + $this->ERROR = "is_hostname: Invalid hostname [$count] [$hostname]\n"; + return false; + } + + // Bug that can't be killed without doing an is_host, + // something.something will return TRUE, even if it's something + // stupid like NS.SOMETHING (with no tld), because SOMETHING is + // construed to BE the tld. The is_bigfour and is_country + // checks should help eliminate this inconsistancy. To really + // be sure you've got a valid hostname, do an is_host() on it. + + if( ($web) and ($count < 2) ) + { + $this->ERROR = "is_hostname: Invalid hostname [$count] [$hostname]\n"; + return false; + } + + $tld = $chunks[$count]; + + if(empty($tld)) + { + $this->ERROR = "is_hostname: No TLD found in [$hostname]"; + return false; + } + + if(!$this->is_bigfour($tld)) + { + if(!$this->is_country($tld)) + { + $this->ERROR = "is_hostname: Unrecognized TLD [$tld]"; + return false; + } + } + + + return true; +} + + +# Syntax Check für die Eingaben: Uhrzeit, Wochentag, Monatstag, Monatstag.Monat +function check_timerange_syntax($mcday,$mcbeg,$mcend){ + + if($this->CLEAR) { $this->clear_error();} + + $badcharacter = eregi_replace("([a-z0-9\.]+)","",$mcday); + if(!empty($badcharacter)){ + $this->ERROR = "check_ip_syntax: Bad data in MC Day [$badcharacter]"; + return false; + } + $badcharacter = eregi_replace("([x0-9]+)","",$mcbeg); + if(!empty($badcharacter)){ + $this->ERROR = "check_ip_syntax: Bad data in MC Begin [$badcharacter]"; + return false; + } + $badcharacter = eregi_replace("([x0-9]+)","",$mcend); + if(!empty($badcharacter)){ + $this->ERROR = "check_ip_syntax: Bad data in MC End [$badcharacter]"; + return false; + } + + $lenmcday = strlen($mcday); + if (eregi("([a-z]+)",$mcday)){ + if ($lenmcday > 2){$this->ERROR = "WOTAG > 2"; return false;} + if (eregi("([0-9\.]+)",$mcday)){$this->ERROR = "WOTAG enthaelt (0-9.)"; return false;} + #if (!(eregi("[mdsfx][aiorx]",$mcday))){return false;} + if (!(eregi("(m[io]|d[io]|s[ao]|fr|x)",$mcday))){$this->ERROR = "WOTAG falscher String"; return false;} + } + if (eregi("([0-9]+)",$mcday)){ + if (eregi("[\.]",$mcday)){ + preg_match("/[\.]/",$mcday,$treffer); + if (count($treffer) > 1){$this->ERROR = "mehr als 2 Punkte"; return false;}; + $exp = explode('.',$mcday); + $day = $exp[0]; + $lenday = strlen($day); + if ($lenday > 2){$this->ERROR = "TAG > 2"; return false;} + if (!(eregi("(0[1-9]|[0-2][0-9]|3[01])",$day))){$this->ERROR = "TAG nicht korrekt"; return false;} + $month = $exp[1]; + $lenmonth = strlen($month); + if ($lenmonth > 2){$this->ERROR = "MONAT > 2"; return false;} + if (!(eregi("(0[0-9]|0[0-9]|1[0-2])",$month))){$this->ERROR = "Monat nicht korrekt"; return false;} + + } + else{ + if ($lenmcday > 2){$this->ERROR = "TAG > 2"; return false;} + if (!(eregi("(0[0-9]|[0-2][0-9]|3[01])",$mcday))){$this->ERROR = "Tag nicht korrekt"; return false;} + } + } + + $lenmcbeg = strlen($mcbeg); + if ($lenmcbeg == 2){ + if (!(eregi("(0[0-9]|1[0-9]|2[0-3]|x)",$mcbeg))){$this->ERROR = "Uhrzeit nicht korrekt"; return false;} + } + if ($lenmcbeg == 1){ + if (!(eregi("([0-9]|x)",$mcbeg))){$this->ERROR = "Uhrzeit nicht korrekt"; return false;} + } + $lenmcend = strlen($mcend); + if ($lenmcend == 2){ + if (!(eregi("(0[0-9]|1[0-9]|2[0-3]|x)",$mcend))){$this->ERROR = "Uhrzeit nicht korrekt"; return false;} + } + if ($lenmcend == 1){ + if (!(eregi("([0-9]|x)",$mcend))){$this->ERROR = "Uhrzeit nicht korrekt"; return false;} + } + + return true; +} + + +# Überprüft ob Menuposition ein Zahl ist +function check_menuposition($menpos){ + + if($this->CLEAR) { $this->clear_error();} + + $badcharacter = eregi_replace("([0-9]+)","",$menpos); + if(!empty($badcharacter)){ + $this->ERROR = "check_menupostion: Bad data in Menu Position [$badcharacter]"; + return false; + } +} + +} +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/login_form.inc.html b/ldap-site-mngmt/webinterface/login_form.inc.html new file mode 100644 index 00000000..13ecd9c7 --- /dev/null +++ b/ldap-site-mngmt/webinterface/login_form.inc.html @@ -0,0 +1,18 @@ +<!-- Author: Timothy Burk --> +<form action="{PFAD}login_sicher.php" method="post"> + <table border="0" cellspacing="0" cellpadding="2"> + <tr> + <td colspan="2"><p><b>Benutzerlogin:</b></p></td> + </tr> + <tr> + <td><p class="small_loginform_text">User-Id:</p></td> + <td><input type="Text" name="uid" size="15" class="small_loginform_field"> </td> + <td><p class="small_loginform_text"> </p></td> + </tr> + <tr> + <td><p class="small_loginform_text">Passwort:</p></td> + <td><input type="Password" name="userPassword" size="15" class="small_loginform_field"> </td> + <td><input type="Submit" name="Login" value="Login" class="small_loginform_button"></td> + </tr> + </table> +</form>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/rbs/delete_confirm.php b/ldap-site-mngmt/webinterface/rbs/delete_confirm.php new file mode 100644 index 00000000..11a04dfd --- /dev/null +++ b/ldap-site-mngmt/webinterface/rbs/delete_confirm.php @@ -0,0 +1,90 @@ +<?php +include('../standard_header.inc.php'); + +$dn = $_POST['dn']; +$name = $_POST['name']; +$delurl = $_POST['delurl']; +$backurl = $_POST['backurl']; +$successurl = $_POST['successurl']; + +$type = $_POST['type']; +$pxedn = $_POST['pxedn']; + +echo " +<html> +<head> + <title>AU Management</title> + <link rel='stylesheet' href='../styles.css' type='text/css'> +</head> +<body> +<table border='0' cellpadding='30' cellspacing='0'> + <tr> + <td>"; + + +if($type == "gbm"){ + $gbmDN = $dn; + $attribs = array("dn"); + if(!($result = uniLdapSearch($ds, "ou=RIPM,".$suffix, "(&(objectclass=MenuEntry)(genericmenuentrydn=$gbmDN))", $attribs, "dn", "sub", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + else{ + $result = ldapArraySauber($result); + if (count($result) > 0){ + echo "Folgende Menü Einträge sind davon betroffen: <br><br>"; + foreach ($result as $item){ + $exp = ldap_explode_dn($item['dn'], 1); + echo "Menü Eintrag <b>".$exp[0]."</b> in PXE Bootmenü <b>".$exp[1]."</b> [ Abteilung: ".$exp[4]." ]<br>"; + } + } + else{ + echo "Keine Menü Einträge davon betroffen!<br>"; + } + } +} + +if($type == "rbs"){ + $rbsDN = $dn; + $attribs = array("dn"); + if(!($result = uniLdapSearch($ds, "ou=RIPM,".$suffix, "(&(objectclass=PXEConfig)(rbservicedn=$rbsDN))", $attribs, "dn", "sub", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + else{ + $result = ldapArraySauber($result); + if (count($result) > 0){ + echo "Folgende PXE Boot Menüs sind davon betroffen: <br><br>"; + foreach ($result as $item){ + $exp = ldap_explode_dn($item['dn'], 1); + echo "PXE Boot Menü <b>".$exp[0]."</b> an Objekt <b>".$exp[1]."</b> [ Abteilung: ".$exp[3]." ]<br>"; + } + } + else{ + echo "Keine PXE Boot Menüs davon betroffen!<br>"; + } + } +} + + echo "<br><br> + Wollen Sie das Objekt <b>".$name."</b> wirklich löschen?<br><br> + <form action='".$delurl."' method='post'> + Falls ja:<br><br> + <input type='hidden' name='dn' value='".$dn."'> + <input type='hidden' name='name' value='".$name."'> + <input type='hidden' name='successurl' value='".$successurl."'> + <input type='hidden' name='pxedn' value='".$pxedn."'> + <input type='Submit' name='apply' value='löschen' class='small_loginform_button'><br><br> + </form> + <form action='".$backurl."' method='post'> + Falls, nein:<br><br> + <input type='Submit' name='apply' value='zurück' class='small_loginform_button'> + </form> + </td> + </tr> +</table> +</body> +</html>"; +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/rbs/gbm.dwt b/ldap-site-mngmt/webinterface/rbs/gbm.dwt new file mode 100644 index 00000000..b2f77800 --- /dev/null +++ b/ldap-site-mngmt/webinterface/rbs/gbm.dwt @@ -0,0 +1,129 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='2'><h3>Generisches Boot Image <code class='font_object'> {GBMCN} </code> </h3></td> + </tr> + <tr> + <td height='20'></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <form action='gbm_change.php' method='post'> + + <tr> + <td width='40%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='60%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Eindeutiger Name (cn):</b><br>(Teil des dn, ohne Leerzeichen eingeben) </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='gbmcn' value='{GBMCN}' size='50' class='medium_form_field'> + <input type='hidden' name='oldgbmcn' value='{GBMCN}'> + </td> + </tr> + + </table></td> + </tr> + <tr> + <td height='40'></td> + </tr> + <tr> + <td colspan='2'><h4>KERNEL und APPEND Parameter:</h4></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <tr> + <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='25%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Server Pfad</b></td> + <td width='15%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>KERNEL Image: </td> + <td align='right' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <font size='+1'>{TFTP}::{TFTPPATH}</font></td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[kernel]' value='{KERNEL}' size='45' class='medium_form_field'> + <input type='hidden' name='oldattribs[kernel]' value='{KERNEL}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Initialram FS <br>(APPEND initrd=..): </b></td> + <td align='right' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <font size='+1'>{TFTP}::{TFTPPATH}</font></td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[initrd]' value='{INITRD}' size='45' class='medium_form_field'> + <input type='hidden' name='oldattribs[initrd]' value='{INITRD}'> + </td> + </tr> + <tr valign='top'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Root Filesystem <br>(APPEND rootfs=..): </b></td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + {SELECTOPTIONS} + </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[rootfspath]' value='{ROOTFS}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[rootfspath]' value='{ROOTFS}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>IPAPPEND: </b> </td> + <td align='right' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> </td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[ipappend]' value='{IPAPPEND}' size='2' class='medium_form_field'> + <input type='hidden' name='oldattribs[ipappend]' value='{IPAPPEND}'> + </td> + </tr> + + <input type='hidden' name='gbmdn' value='{GBMDN}'> + <input type='hidden' name='rbsdn' value='{RBSDN}'> + <input type='hidden' name='mnr' value='{MNR}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + + </table></td> + </tr> + <tr> + <td><input type='Submit' name='apply' value='anwenden' class='small_loginform_button'> + </form></td> + </tr> + + + <tr> + <td height='40'></td> + </tr> + + <tr> + <td colspan='2'><h4>Generisches Boot Image <code class='font_object'>{GBMCN}</code> löschen:</h4></td> + </tr> + <tr> + <td> + <table cellpadding='7' cellspacing='0' border='0' align='left' width='90%' style='border-width: 0 0 0 0;'> + <form action='delete_confirm.php' method='post'> + + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + Das generische Boot Image wird komplett gelöscht. + </tr> + + <input type='hidden' name='dn' value='{GBMDN}'> + <input type='hidden' name='name' value='{GBMCN}'> + <input type='hidden' name='type' value='gbm'> + <input type='hidden' name='delurl' value='gbm_delete.php'> + <input type='hidden' name='backurl' value='gbm.php?dn={GBMDN}&mnr={MNR}&sbmnr={SBMNR}'> + + </table></td> + </tr> + <tr> + <td> + <input type='Submit' name='apply' value='löschen' class='small_loginform_button'> + </form></td> + </tr> + + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/rbs/gbm.php b/ldap-site-mngmt/webinterface/rbs/gbm.php new file mode 100644 index 00000000..59aefc5a --- /dev/null +++ b/ldap-site-mngmt/webinterface/rbs/gbm.php @@ -0,0 +1,110 @@ +<?php +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "Remote Boot Service Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 4; +$mnr = -1; +$sbmnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "gbm.dwt"; + +include("../class.FastTemplate.php"); + +include('rbs_header.inc.php'); + +################################################################################### + +$mnr = $_GET['mnr']; +$sbmnr = $_GET['sbmnr']; + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createRBSMenu($rollen, $mnr, $auDN, $sbmnr); + +################################################################################### + +$gbmDN = $_GET['dn']; + +# rbservice und pxe daten (voerst nur ein rbs) +$rbs_array = get_rbservices($auDN,array("dn","cn")); +$rbsDN = $rbs_array[0]['dn']; +# RBS Daten +$rbs_data = get_node_data($rbsDN, array("cn","nfsserverip","exportpath","tftpserverip","tftppath","nbdserverip")); +$template->assign(array("RBSCN" => $rbs_data['cn'], + "NFS" => $rbs_data['nfsserverip'], + "NFSPATH" => $rbs_data['exportpath'], + "TFTP" => $rbs_data['tftpserverip'], + "TFTPPATH" => $rbs_data['tftppath'], + "NBD" => $rbs_data['nbdserverip'])); + + +$template->assign(array("GBMDN" => $gbmDN, + "GBMCN" => "", + "LABEL" => "", + "KERNEL" => "", + "INITRD" => "", + "FSTYPE" => "", + "ROOTFS" => "", + "IPAPPEND" => "")); + +# GBM Daten +$attributes = array("dn","cn","label","kernel","initrd","rootfstype","rootfspath","ipappend"); +$gbm = get_node_data($gbmDN, $attributes); + +if ($gbm['rootfstype'] == 'nfs'){ + $options = "<select name='rootfstype' size='4' class='rootfs_form_selectbox'> + <option value='nfs' selected><b>nfs://".$rbs_data['nfsserverip'].":/".$rbs_data['exportpath']."</b></option> + <option value=''>---------------------------------</option> + <option value='nbd'>nbd://".$rbs_data['nbdserverip'].":</option> + <option value='dnbd'>dnbd://".$rbs_data['nbdserverip'].":</option> + </select> + <input type='hidden' name='oldrootfstype' value='".$gbm['rootfstype']."'>"; +} +if ($gbm['rootfstype'] == 'nbd'){ + $options = "<select name='rootfstype' size='4' class='rootfs_form_selectbox'> + <option value='nbd' selected><b>nbd://".$rbs_data['nbdserverip'].":</b></option> + <option value=''>---------------------------------</option> + <option value='nfs'>nfs://".$rbs_data['nfsserverip'].":/".$rbs_data['exportpath']."</option> + <option value='dnbd'>dnbd://".$rbs_data['nbdserverip'].":</option> + </select> + <input type='hidden' name='oldrootfstype' value='".$gbm['rootfstype']."'>"; +} +if ($gbm['rootfstype'] == 'dnbd'){ + $options = "<select name='rootfstype' size='4' class='rootfs_form_selectbox'> + <option value='dnbd' selected><b>dnbd://".$rbs_data['nbdserverip'].":</b></option> + <option value=''>---------------------------------</option> + <option value='nfs'>nfs://".$rbs_data['nfsserverip'].":/".$rbs_data['exportpath']."</option> + <option value='nbd'>nbd://".$rbs_data['nbdserverip'].":</option> + </select> + <input type='hidden' name='oldrootfstype' value='".$gbm['rootfstype']."'>"; +} +if ($gbm['rootfstype'] != 'nfs' && $gbm['rootfstype'] != 'nbd' && $gbm['rootfstype'] != 'dnbd'){ + $options = "<select name='rootfstype' size='4' class='rootfs_form_selectbox'> + <option value='' selected>---------------------------------</option> + <option value='nfs'><b>nfs://".$rbs_data['nfsserverip'].":/".$rbs_data['exportpath']."</b></option> + <option value='nbd'>nbd://".$rbs_data['nbdserverip'].":</option> + <option value='dnbd'>dnbd://".$rbs_data['nbdserverip'].":</option> + </select> + <input type='hidden' name='oldrootfstype' value=''>"; +} + + +$template->assign(array("GBMCN" => $gbm['cn'], + "LABEL" => $gbm['label'], + "KERNEL" => $gbm['kernel'], + "INITRD" => $gbm['initrd'], + "SELECTOPTIONS" => $options, + "ROOTFS" => $gbm['rootfspath'], + "IPAPPEND" => $gbm['ipappend'], + "RBSDN" => $rbsDN, + "MNR" => $mnr, + "SBMNR" => $sbmnr)); + + +################################################################################### + +include("rbs_footer.inc.php"); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/rbs/gbm_add.php b/ldap-site-mngmt/webinterface/rbs/gbm_add.php new file mode 100644 index 00000000..2202b4fb --- /dev/null +++ b/ldap-site-mngmt/webinterface/rbs/gbm_add.php @@ -0,0 +1,68 @@ +<?php +include('../standard_header.inc.php'); + +$gbmcn = $_POST['gbmcn']; $gbmcn = htmlentities($gbmcn); +$rbsDN = $_POST['rbsdn']; + +$mnr = $_POST['mnr']; +$sbmnr = $_POST['sbmnr']; + +$attribs = $_POST['attribs']; +if (count($attribs) != 0){ + foreach (array_keys($attribs) as $key){ + $atts[$key] = htmlentities($attribs[$key]); + } +} +# print_r($meatts); echo "<br><br>"; + +$seconds = 2; +$get_gbmcn = str_replace ( " ", "_", $gbmcn ); +$url = "gbm.php?gbmcn=".$get_gbmcn."&mnr=".$mnr."&sbmnr=".$sbmnr; + +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>"; + + +if ( $gbmcn != "" && $gbmcn != "Hier_NAME_eintragen" ){ + + # Formulareingaben anpassen + $expgbm = explode(" ",$gbmcn); + foreach ($expgbm as $word){$expuc[] = ucfirst($word);} + $gbmcn = implode(" ",$expuc); + $gbmcn = preg_replace ( '/\s+([0-9A-Z])/', '$1', $gbmcn); + + $gbmDN = "cn=".$gbmcn.",".$rbsDN; + + if (add_gbm($gbmDN,$gbmcn,$atts)){ + $mesg .= "<br>Neuen Generischen Menü Eintrag erfolgreich angelegt<br>"; + $url = "gbm_overview.php"; + } + else{ + $mesg .= "<br>Fehler beim anlegen des Generischen Menü Eintrags!<br>"; + } +} + +elseif ( $gbmcn == "" || $gbmcn == "Hier_NAME_eintragen" ){ + + $mesg = "Sie haben den Namen des neuen Generischen Menü Eintrags nicht angegeben. + Dies ist aber ein notwendiges Attribut.<br> + Bitte geben Sie sie an.<br><br>"; + $url = "new_gbm.php?gbmcn=Hier_NAME_eintragen&mnr=".$mnr."&sbmnr=".$sbmnr; +} + + + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurü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 diff --git a/ldap-site-mngmt/webinterface/rbs/gbm_change.php b/ldap-site-mngmt/webinterface/rbs/gbm_change.php new file mode 100644 index 00000000..86067acd --- /dev/null +++ b/ldap-site-mngmt/webinterface/rbs/gbm_change.php @@ -0,0 +1,210 @@ +<?php +include('../standard_header.inc.php'); + +$gbmcn = $_POST['gbmcn']; $gbmcn = htmlentities($gbmcn); +$oldgbmcn = $_POST['oldgbmcn']; + +$gbmDN = $_POST['gbmdn']; +$rbsDN = $_POST['rbsdn']; +$mnr = $_POST['mnr']; +$sbmnr = $_POST['sbmnr']; + +$rootfstype = $_POST['rootfstype']; +$oldrootfstype = $_POST['oldrootfstype']; + +$attribs = $_POST['attribs']; +if (count($attribs) != 0){ + foreach (array_keys($attribs) as $key){ + $atts[$key] = htmlentities($attribs[$key]); + } +} +# print_r($meatts); 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>"; + + +$seconds = 2; +$get_mecn = str_replace ( " ", "_", $mecn ); +$url = "gbm.php?dn=".$gbmDN."&mnr=".$mnr."&sbmnr=".$sbmnr; + +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>"; + +############################################## +# GBM CN (DN) + +if ( $oldgbmcn == $gbmcn ){ + # $mesg = "keine Aenderung<br>"; +} + +if ( $oldgbmcn != "" && $gbmcn != "" && $oldgbmcn != $gbmcn ){ + echo "Name Generisches Boot Menü aendern<br>"; + # hier noch Syntaxcheck + # Formulareingaben anpassen + $expgbm = explode(" ",$gbmcn); + foreach ($expgbm as $word){$expuc[] = ucfirst($word);} + $gbmcn = implode(" ",$expuc); + $gbmcn = preg_replace ( '/\s+([0-9A-Z])/', '$1', $gbmcn); + + + $newgbmDN = "cn=".$gbmcn.",".$rbsDN; + print_r($newgbmDN); echo "<br><br>"; + + if(move_subtree($gbmDN, $newgbmDN)){ + adjust_gbm_dn($newgbmDN, $gbmDN); + $mesg = "Name Generisches Bootmenü erfolgreich geändert<br><br>"; + $gbmDN = $newgbmDN; + }else{ + $mesg = "Fehler beim ändern des Namen des Generischen Bootmenüs!<br><br>"; + } + + # newsubmenu holen... + $url = "gbm.php?dn=".$newgbmDN."&mnr=".$mnr."&sbmnr=".$sbmnr; +} + +if ( $oldgbmcn != "" && $gbmcn == "" ){ + echo "Name Generisches Bootmenü loeschen!<br> + Dieses ist Teil des DN, Sie werden des Generische Boot Menü komplett löschen<br><br>"; + echo "Wollen Sie das Generische Boot Menü <b>".$oldgbmcn."</b> wirklich löschen?<br><br> + <form action='gbm_delete.php' method='post'> + Falls ja:<br><br> + <input type='hidden' name='dn' value='".$gbmDN."'> + <input type='hidden' name='name' value='".$oldgbmcn."'> + <input type='Submit' name='apply' value='löschen' class='small_loginform_button'><br><br> + </form> + <form action='".$url."' method='post'> + Falls, nein:<br><br> + <input type='Submit' name='apply' value='zurück' class='small_loginform_button'> + </form>"; + $seconds = 600; +} + +################################### +# RootFS Type + +if ( $oldrootfstype == $rootfstype ){ + # $mesg = "keine Aenderung<br>"; +} + +if ( $oldrootfstype == "" && $rootfstype != "" ){ + $entryadd ['rootfstype'] = $rootfstype; + if(ldap_mod_add($ds,$gbmDN,$entryadd)){ + $mesg = "Attribute <b>RootfsType</b> erfolgreich eingetragen<br><br>"; + }else{ + $mesg = "Fehler beim eintragen der Attribute <b>RootfsType</b><br><br>"; + } +} + + +if ( $oldrootfstype != "" && $rootfstype != "" && $oldrootfstype != $rootfstype ){ + echo "Root FS Type ändern<br>"; + $entrymod ['rootfstype'] = $rootfstype; + if(ldap_mod_replace($ds,$gbmDN,$entrymod)){ + $mesg = "Attribute <b>RootfsType</b> erfolgreich geaendert<br><br>"; + }else{ + $mesg = "Fehler beim aendern der Attribute <b>RootfsType</b><br><br>"; + } +} + + +if ( $oldrootfstype != "" && $rootfstype == "" ){ + echo "Root FS Type löschen!<br>"; + $entrydel ['rootfstype'] = array(); + if(ldap_mod_del($ds,$gbmDN,$entrydel)){ + $mesg = "Attribute <b>RootfsType</b> erfolgreich geloescht<br><br>"; + }else{ + $mesg = "Fehler beim loeschen der Attribute <b>RootfsType</b><br><br>"; + } +} + + +################################### +# restliche Attribute + +$entryadd = array(); +$entrymod = array(); +$entrydel = array(); + +foreach (array_keys($atts) as $key){ + + if ( $oldatts[$key] == $atts[$key] ){ + # nix + } + 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,$gbmDN,$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 "ändern<br>"; + foreach (array_keys($entrymod) as $key){ + $modatts .= "<b>".$key."</b>,"; + } + if(ldap_mod_replace($ds,$gbmDN,$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öschen<br>"; + foreach (array_keys($entrydel) as $key){ + $delatts .= "<b>".$key."</b>,"; + } + if(ldap_mod_del($ds,$gbmDN,$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ü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 diff --git a/ldap-site-mngmt/webinterface/rbs/gbm_delete.php b/ldap-site-mngmt/webinterface/rbs/gbm_delete.php new file mode 100644 index 00000000..8777981a --- /dev/null +++ b/ldap-site-mngmt/webinterface/rbs/gbm_delete.php @@ -0,0 +1,40 @@ +<?php +include('../standard_header.inc.php'); + +$gbmDN = $_POST['dn']; +$gbmcn = $_POST['name']; + +$seconds = 1; +$url = "gbm_overview.php?"; + +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>"; + +if ( $gbmDN != ""){ + + clean_up_del_gbm($gbmDN); + if ( dive_into_tree_del($gbmDN,"") ){ + clean_up_del_gbm($gbmDN); + $mesg = "Generisches Bootmenü <b>".$gbmcn."</b> erfolgreich gelöscht!<br><br>"; + } + else{ + $mesg = "Fehler beim löschen des Generischen Bootmenüs <b>".$gbmcn."</b> !<br><br>"; + } + +} + + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurü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 diff --git a/ldap-site-mngmt/webinterface/rbs/gbm_overview.dwt b/ldap-site-mngmt/webinterface/rbs/gbm_overview.dwt new file mode 100644 index 00000000..794315e6 --- /dev/null +++ b/ldap-site-mngmt/webinterface/rbs/gbm_overview.dwt @@ -0,0 +1,29 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='2'><h3>Generische Boot Images</h3> + Diese Boot Images werden vom Remote Boot Service <code class='font_object'> {RBSCN} </code> + angeboten. Sie können für jedes Image festlegen, wer dieses Angebot in Anspruch nehmen + kann (Spektrum zwischen (a) ihrer Abteilung <code class='font_object'> {AU} </code> und ihrer Unterabteilungen, und (b) organisationsweit) </td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + <tr> + <td width='50%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Generisches Boot Menü</b></td> + <td width='50%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Netzwerk Dateisystem</b></td> + </tr> + + <!-- BEGIN DYNAMIC BLOCK: Genericbm --> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>{GBMCN} </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>{FS} </td> + </tr> + <!-- END DYNAMIC BLOCK: Genericbm --> + + </table></td> + </tr> + + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/rbs/gbm_overview.php b/ldap-site-mngmt/webinterface/rbs/gbm_overview.php new file mode 100644 index 00000000..1158a396 --- /dev/null +++ b/ldap-site-mngmt/webinterface/rbs/gbm_overview.php @@ -0,0 +1,56 @@ +<?php + +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "Remote Boot Service Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 4; +$mnr = 2; +$sbmnr = -1; +$mcnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "gbm_overview.dwt"; + +include("../class.FastTemplate.php"); + +include('rbs_header.inc.php'); + +################################################################################### + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createRBSMenu($rollen, $mnr, $auDN, $sbmnr); + +################################################################################### + +$template->assign(array("GBMDN" => "", + "GBMCN" => "Noch keine Generischen Boot Menüs angelegt", + "KERNEL" => "", + "FS" => "")); + +# rbservice und pxe daten (voerst nur ein rbs) +$rbs_array = get_rbservices($auDN,array("dn","cn")); +$rbsDN = $rbs_array[0]['dn']; + +# Generic Bootmenüs +$generic_bms = get_menuentries($rbsDN,array("dn","cn","label","kernel","nfsroot","nbdroot")); + +$template->define_dynamic("Genericbm", "Webseite"); +$template->define_dynamic("Offers", "Webseite"); +foreach ($generic_bms as $gbm){ + if ($gbm['nfsroot'] != ""){$fs = "NFS";} + if ($gbm['nbdroot'] != ""){$fs = "NBD";} + $template->assign(array("GBMDN" => $gbm['dn'], + "GBMCN" => $gbm['cn'], + "KERNEL" => $gbm['kernel'], + "FS" => $fs)); + $template->parse("GENERICBM_LIST", ".Genericbm"); +} + + +################################################################################### + +include("rbs_footer.inc.php"); + +?> diff --git a/ldap-site-mngmt/webinterface/rbs/menu.dwt b/ldap-site-mngmt/webinterface/rbs/menu.dwt new file mode 100644 index 00000000..fe37aeee --- /dev/null +++ b/ldap-site-mngmt/webinterface/rbs/menu.dwt @@ -0,0 +1,31 @@ + +<table cellpadding='0' cellspacing='0' border='0' width='100%'> + + + <!-- BEGIN DYNAMIC BLOCK: Hauptmenu --> + + <tr valign='middle' align='left'> +
+ <td width='8%' align='right' style="border-style=none;">{ICON}</td> + <td width="8%" align="left" style="border-width:1 0 1 1;border-color:#000000;border-style:solid;padding:5;background-color:{FARBE}"> </td>
+ <td width="74%" align="left" style="border-width:1 1 1 0;border-color:#000000;border-style:solid;padding:5;background-color:{FARBE}"> + <a href="{LINK_M}" style="text-decoration:none"><b class="standard_schrift">{TEXT_M}</b></a></td>
+ <td width='10%'> </td> + + </tr> + + + + + <!-- BEGIN DYNAMIC BLOCK: Submenu --> + + {SUB} + + <!-- END DYNAMIC BLOCK: Submenu --> + + <tr height='5'> + </tr> + +<!-- END DYNAMIC BLOCK: Hauptmenu --> + +</table> diff --git a/ldap-site-mngmt/webinterface/rbs/menuentry.dwt b/ldap-site-mngmt/webinterface/rbs/menuentry.dwt new file mode 100644 index 00000000..07f71d95 --- /dev/null +++ b/ldap-site-mngmt/webinterface/rbs/menuentry.dwt @@ -0,0 +1,247 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td height='20'><h4>Zurück zu <a href='pxe.php?dn={PXEDN}&mnr={MNR}&sbmnr={SBMNR}&mcnr={MCNR}' class='headerlink'>{PXECN}</a></h4></td> + </tr> + <tr> + <td height='20'> </td> + </tr> + <tr> + <td colspan='2'><h3>Boot Menü Eintrag <code class='font_object'> {MECN} </code> </h3></td> + </tr> + <tr> + <td height='20'> </td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <form action='menuentry_change.php' method='post'> + + <tr> + <td width='40%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='60%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Eindeutiger Name (cn):</b><br>(Teil des dn, ohne Leerzeichen eingeben) </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='mecn' value='{MECN}' size='50' class='medium_form_field'> + <input type='hidden' name='oldmecn' value='{MECN}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Label:</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[label]' value='{LABEL}' size='50' class='medium_form_field'> + <input type='hidden' name='oldattribs[label]' value='{LABEL}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Generisches Boot Image: </b><br><br>(Angeboten von) </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <h4>{GMECN}</h4> Abteilung: {GMEOU} [Remote Boot Dienst: {GMERBS}] + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Menu Label:</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[menulabel]' value='{MELABEL}' size='50' class='medium_form_field'> + <input type='hidden' name='oldattribs[menulabel]' value='{MELABEL}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Menu Default:</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[menudefault]' value='{MEDEF}' size='50' class='medium_form_field'> + <input type='hidden' name='oldattribs[menudefault]' value='{MEDEF}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Menu Passwd:</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[menupasswd]' value='{MEPASSWD}' size='50' class='medium_form_field'> + <input type='hidden' name='oldattribs[menupasswd]' value='{MEPASSWD}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Menu Hide:</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[menuhide]' value='{MEHIDE}' size='50' class='medium_form_field'> + <input type='hidden' name='oldattribs[menuhide]' value='{MEHIDE}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Localboot:</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[localboot]' value='{LOCALBOOT}' size='50' class='medium_form_field'> + <input type='hidden' name='oldattribs[localboot]' value='{LOCALBOOT}'> + </td> + </tr> + + </table></td> + </tr> + <tr> + <td height='40'></td> + </tr> + <tr> + <td colspan='2'><h4>APPEND Parameter:</h4></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <tr> + <td width='20%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='80%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Client Konfiguration via: </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[clientconfvia]' value='{CCV}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[clientconfvia]' value='{CCV}'> ( dhcp | file | ldap ) + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>vga: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[vga]' value='{VGA}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[vga]' value='{VGA}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>splash: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[splash]' value='{SPLASH}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[splash]' value='{SPLASH}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>vci: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[vci]' value='{VCI}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[vci]' value='{VCI}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>no ldsc: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[noldsc]' value='{NOLDSC}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[noldsc]' value='{NOLDSC}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>elevator: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[elevator]' value='{ELEVATOR}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[elevator]' value='{ELEVATOR}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>apic: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[apic]' value='{APIC}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[apic]' value='{APIC}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Union FS: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[unionfs]' value='{UNIONFS}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[unionfs]' value='{UNIONFS}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>cowloop: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[cowloop]' value='{COWLOOP}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[cowloop]' value='{COWLOOP}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Debug Level: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[debug]' value='{DEBUG}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[debug]' value='{DEBUG}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Menü Position: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='menpos' value='{MENPOS}' size='2' class='medium_form_field'> + <input type='hidden' name='oldmenpos' value='{MENPOS}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Submenü Verweis: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[submenulink]' value='{SUBMENULINK}' size='50' class='medium_form_field'> + <br> + Dieses Feld sollte nur bei Verweisen auf Submenüs den vollständigen Link zu diesen enthalten + <br>(d.h. <TFTP-Server-IP>::/<TFTP-PXE-Pfad>/<Timerange>/<PXE-Dateiname>). <br> + Bei Textzeilen und Leerzeilen muss hier <b>"self"</b> stehen. <br> + Bei normalen Menüeinträgen (inklusive Localboot) muss diese Feld <b>leer</b> sein. + <input type='hidden' name='oldattribs[submenulink]' value='{SUBMENULINK}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Kernel: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[kernel]' value='{KERNEL}' size='50' class='medium_form_field'> + <br> + Angabe hier nur sinnvoll bei Leer-, Textzeilen oder Submenüverweisen, <br> + denn Eingabe wird, wenn der Menüeintrag auf ein generisches Boot Image verweist (siehe oben) <br> + bei der PXE Datei Generierung überschrieben. + <input type='hidden' name='oldattribs[kernel]' value='{KERNEL}'> + </td> + </tr> + + <input type='hidden' name='medn' value='{MEDN}'> + <input type='hidden' name='pxedn' value='{PXEDN}'> + <input type='hidden' name='mnr' value='{MNR}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + <input type='hidden' name='mcnr' value='{MCNR}'> + + </table></td> + </tr> + <tr> + <td><input type='Submit' name='apply' value='anwenden' class='small_loginform_button'> + </form></td> + </tr> + + + <tr> + <td height='40'></td> + </tr> + + <tr> + <td colspan='2'><h4>Boot Menü Eintrag <code class='font_object'>{MECN}</code> löschen:</h4></td> + </tr> + <tr> + <td> + <table cellpadding='7' cellspacing='0' border='0' align='left' width='90%' style='border-width: 0 0 0 0;'> + <form action='delete_confirm.php' method='post'> + + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + Das generische Boot Image wird komplett gelöscht. + </tr> + + <input type='hidden' name='dn' value='{MEDN}'> + <input type='hidden' name='name' value='{MECN}'> + <input type='hidden' name='pxedn' value='{PXEDN}'> + <input type='hidden' name='delurl' value='menuentry_delete.php'> + <input type='hidden' name='successurl' value='pxe.php?dn={PXEDN}&mnr={MNR}&sbmnr={SBMNR}&mcnr={MCNR}'> + <input type='hidden' name='backurl' value='menuentry.php?dn={MEDN}&mnr={MNR}&sbmnr={SBMNR}&mcnr={MCNR}'> + + </table></td> + </tr> + <tr> + <td> + <input type='Submit' name='apply' value='löschen' class='small_loginform_button'> + </form></td> + </tr> + + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/rbs/menuentry.php b/ldap-site-mngmt/webinterface/rbs/menuentry.php new file mode 100644 index 00000000..83396ec8 --- /dev/null +++ b/ldap-site-mngmt/webinterface/rbs/menuentry.php @@ -0,0 +1,158 @@ +<?php + +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "Remote Boot Service Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 4; +$mnr = 3; +$sbmnr = -1; +$mcnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "menuentry.dwt"; + +include("../class.FastTemplate.php"); + +include('rbs_header.inc.php'); + +################################################################################### + +$sbmnr = $_GET['sbmnr']; + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createRBSMenu($rollen, $mnr, $auDN, $sbmnr); + +################################################################################### + +$meDN = $_GET['dn']; + +$attributes = array("cn","genericmenuentrydn","label","menulabel","menudefault","menupasswd","vga","splash", + "noldsc","elevator","clientconfvia","apic", + "cowloop","unionfs","debug","vci","menuhide","menuposition","localboot","kernel","submenulink"); +$me = get_node_data($meDN,$attributes); +#print_r($me); + +# PXE DN +$exp = explode(',',$meDN); +$node = array_slice($exp,1); +$exppxecn = explode('=',$node[0]); +$pxecn = $exppxecn[1]; +$pxeDN = implode(',',$node); + +# Generic Menu Entry +$expgbm = ldap_explode_dn ($me['genericmenuentrydn'],1); +$gmecn = $expgbm[0]; +$gmerbs = $expgbm[1]; +$gmeou = $expgbm[3]; + +# RBS Daten +$pxe = get_node_data($pxeDN,array("rbservicedn")); +$rbsDN = $pxe['rbservicedn']; +$exp = explode(',',$rbsDN); +$exprbsau = explode('=',$exp[2]); $rbsau = $exprbsau[1]; +$rbsdata = get_node_data($rbsDN,array("cn","nfsserverip","exportpath","tftpserverip","tftppath")); + +# Bootmenu Daten +$template->assign(array("MEDN" => $meDN, + "MECN" => $me['cn'], + "GMECN" => $gmecn, + "GMEOU" => $gmeou, + "GMERBS" => $gmerbs, + "LABEL" => $me['label'], + "MELABEL" => $me['menulabel'], + "MEDEF" => $me['menudefault'], + "MEPASSWD" => $me['menupasswd'], + "MEHIDE" => $me['menuhide'], + "VGA" => $me['vga'], + "SPLASH" => $me['splash'], + "NOLDSC" => $me['noldsc'], + "ELEVATOR" => $me['elevator'], + "VCI" => $me['vci'], + "CCV" => $me['clientconfvia'], + "APIC" => $me['apic'], + "COWLOOP" => $me['cowloop'], + "UNIONFS" => $me['unionfs'], + "DEBUG" => $me['debug'], + "MENPOS" => $me['menuposition'], + "LOCALBOOT" => $me['localboot'], + "KERNEL" => $me['kernel'], + "SUBMENULINK" => $me['submenulink'], + "PXEDN" => $pxeDN, + "PXECN" => $pxecn, + "MNR" => $mnr, + "SBMNR" => $sbmnr, + "MCNR" => $mcnr)); + +# Alternative RB Dienste holen +$altrbs = get_rbservices($auDN,array("dn","cn")); +if (count($altrbs) != 0){ + for ($i=0; $i < count($altrbs); $i++){ + if ($rbsDN == $altrbs[$i]['dn']){ + array_splice($altrbs, $i, 1); + } + } +} + + +if (count($altrbs) != 0){ +$template->define_dynamic("Altrbs", "Webseite"); + foreach ($altrbs as $item){ + $altrbsexp = explode(',',$item['dn']); + $altrbsau = explode('=',$altrebsexp[2]); + $template->assign(array("ALTRBSDN" => $item['dn'], + "ALTRBSCN" => $item['cn'], + "ALTRBSAU" => "[ ".$altrbsau[1]." ]")); + $template->parse("ALTRBS_LIST", ".Altrbs"); + } +}else{ + $template->assign(array("ALTRBSDN" => "", + "ALTRBSCN" => "", + "ALTRBSAU" => "")); +} + +################################################ +# Bootmenü Einträge + +$menuentries = get_menuentries($pxeDN,array("dn","menuposition","label","menulabel")); +#print_r($menuentries); echo "<br>"; + +$template->define_dynamic("Bootmenu", "Webseite"); + +foreach ($menuentries as $me){ + $template->assign(array("MENDN" => $me['dn'], + "MENULABEL" => $me['menulabel'], + "POSITION" => $me['menuposition'], + "AUDN" => $auDN)); + $template->parse("BOOTMENU_LIST", ".Bootmenu"); +} + + +################################################ +# PXE kopieren + +$hostorgroup = $exp[0]; +$hgexp = explode('=',$exp[0]); + +$hosts_array = get_hosts($auDN,array("dn","hostname")); +$groups_array = get_groups($auDN,array("dn","cn")); + +$template->define_dynamic("Hosts", "Webseite"); +foreach ($hosts_array as $item){ + $template->assign(array("HDN" => $item['dn'], + "HN" => $item['hostname'])); + $template->parse("HOSTS_LIST", ".Hosts"); +} +$template->define_dynamic("Groups", "Webseite"); +foreach ($groups_array as $item){ + $template->assign(array("GDN" => $item['dn'], + "GN" => $item['cn'])); + $template->parse("GROUPS_LIST", ".Groups"); +} + +################################################################################### + +include("rbs_footer.inc.php"); + +?> diff --git a/ldap-site-mngmt/webinterface/rbs/menuentry_add.php b/ldap-site-mngmt/webinterface/rbs/menuentry_add.php new file mode 100644 index 00000000..8b0c4368 --- /dev/null +++ b/ldap-site-mngmt/webinterface/rbs/menuentry_add.php @@ -0,0 +1,258 @@ +<?php +include('../standard_header.inc.php'); + +$mecn = $_POST['mecn']; $mecn = htmlentities($mecn); +$gbmDN = $_POST['gbm']; +$menpos = $_POST['menpos']; +$maxpos = $_POST['maxpos']; + +$typ = $_POST['typ']; +$pxeDN = $_POST['pxedn']; +$timespan = $_POST['timerange']; +$mnr = $_POST['mnr']; +$sbmnr = $_POST['sbmnr']; + +$meattribs = $_POST['attribs']; +if (count($meattribs) != 0){ + foreach (array_keys($meattribs) as $key){ + $meatts[$key] = htmlentities($meattribs[$key]); + } +} +# print_r($meatts); echo "<br><br>"; + +$seconds = 2; +$get_mecn = str_replace ( " ", "_", $mecn ); +$url = "pxe.php?dn=".$pxeDN."&mecn=".$get_mecn."&mnr=".$mnr."&sbmnr=".$sbmnr; + +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>"; +# switch wäre besser ... +if ($typ == "newme" && $typ != "local" && $typ != "text" && $typ != "leer" && $typ != "submenu" ){ + + if ( $mecn != "" && $mecn != "Hier_NAME_eintragen" && $gbmDN != "none" ){ + + # Formulareingaben anpassen + $expme = explode(" ",$mecn); + foreach ($expme as $word){$expuc[] = ucfirst($word);} + $mecn = implode(" ",$expuc); + $mecn = preg_replace ( '/\s+([0-9A-Z])/', '$1', $mecn); + + if ($menpos != ""){ + # Syntaxcheck Menüposition + #$syntax = new Syntaxcheck; + #if (!($syntax->check_menuposition($menpos))){ + # $menpos = $maxpos; + #} + }else{ + $menpos = $maxpos; + } + if (strlen($menpos) == 1){ + $menpos = "0".$menpos; + } + # nun doch führende Nullen erzwingen + # also obsolet: $menpos = preg_replace ( '/0([0-9])/', '$1', $menpos); + + $meDN = "cn=".$mecn.",".$pxeDN; + + if (add_me($meDN,$mecn,$gbmDN,$menpos,$meatts,$pxeDN)){ + $mesg .= "<br>Neuen Menü Eintrag erfolgreich angelegt<br>"; + $url = "pxe.php?dn=".$pxeDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr; + } + else{ + $mesg .= "<br>Fehler beim anlegen des Menü Eintrags!<br>"; + } + } + + elseif ( $mecn == "" || $mecn == "Hier_NAME_eintragen" || $gbmDN == "none" ){ + + $mesg = "Sie haben den Namen des neuen Menü Eintrags nicht angegeben oder kein + Generisches Boot Image ausgewählt. Beide sind aber ein notwendige Attribute.<br> + Bitte geben Sie sie an.<br><br>"; + $url = "new_menuentry.php?mecn=Hier_NAME_eintragen&mnr=".$mnr."&sbmnr=".$sbmnr; + } +} + +# Localboot Zeile hinzufügen +elseif ($typ == "local" && $typ != "newme" && $typ != "text" && $typ != "leer" && $typ != "submenu" ){ + + # Menu Position + $menpos = $_POST['localpos']; + if ($menpos != ""){ + # Syntaxcheck Menüposition + #$syntax = new Syntaxcheck; + #if (!($syntax->check_menuposition($menpos))){ + # $menpos = $maxpos; + #} + }else{ + $menpos = $maxpos; + } + if (strlen($menpos) == 1){ + $menpos = "0".$menpos; + } + # nun doch führende Nullen erzwingen + # also obsolet: $menpos = preg_replace ( '/0([0-9])/', '$1', $menpos); + + # CN bilden + $brothers = get_menuentries($pxeDN,array("dn","cn")); + $i=1; + $localcn = "localboot".$i; + if(count($brothers) != 0){ + for ($c=0; $c<count($brothers); $c++){ + foreach ($brothers as $item){ + if ($localcn == strtolower($item['cn'])){ + $i++; + $localcn = "localboot".$i; + } + } + } + } + $meDN = "cn=".$localcn.",".$pxeDN; + $entry ['objectclass'][0] = "MenuEntry"; + $entry ['objectclass'][1] = "top"; + $entry ['cn'] = $localcn; + $entry ['menuposition'] = $menpos; + $entry ['label'] = $localcn; + $entry ['menulabel'] = $_POST['locallabel']; + $entry ['menupasswd'] = $_POST['localpasswd']; + $entry ['localboot'] = "level 0"; + $pos = preg_replace ( '/0([0-9])/', '$1', $menpos); + increment_menupositions($pxeDN,$pos); # andere jeweils um 1 erhöhen + if (ldap_add($ds,$meDN,$entry)){ + $mesg .= "Localboot Zeile erfolgeich an Position ".$menpos." eingetragen"; + }else{ + $mesg .= "Fehler beim eintragen der Localboot Zeile!"; + } + $url = "pxe.php?dn=".$pxeDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr; +} + + +# Text Zeile hinzufügen +elseif ($typ == "text" && $typ != "newme" && $typ != "local" && $typ != "leer" && $typ != "submenu" ){ + + # Menu Position + $menpos = $_POST['textpos']; + if ($menpos != ""){ + # Syntaxcheck Menüposition + #$syntax = new Syntaxcheck; + #if (!($syntax->check_menuposition($menpos))){ + # $menpos = $maxpos; + #} + }else{ + $menpos = $maxpos; + } + if (strlen($menpos) == 1){ + $menpos = "0".$menpos; + } + # nun doch führende Nullen erzwingen + # also obsolet: $menpos = preg_replace ( '/0([0-9])/', '$1', $menpos); + + $text = $_POST['text']; + if($text != "" && $text != "TEXT"){ + $brothers = get_menuentries($pxeDN,array("dn","cn")); + $i=1; + $textcn = "textzeile".$i; + if(count($brothers) != 0){ + for ($c=0; $c<count($brothers); $c++){ + foreach ($brothers as $item){ + if ($textcn == strtolower($item['cn'])){ + $i++; + $textcn = "textzeile".$i; + } + } + } + } + $meDN = "cn=".$textcn.",".$pxeDN; + $entry ['objectclass'][0] = "MenuEntry"; + $entry ['objectclass'][1] = "top"; + $entry ['cn'] = $textcn; + $entry ['menuposition'] = $menpos; + $entry ['label'] = $text; + $entry ['kernel'] = "menu.c32"; + # Submenulink auf sich selbst + $pxedata = get_node_data($pxeDN,array("filename")); + $entry ['submenulink'] = "self"; + + $pos = preg_replace ( '/0([0-9])/', '$1', $menpos); + increment_menupositions($pxeDN,$pos); # andere jeweils um 1 erhöhen + if (ldap_add($ds,$meDN,$entry)){ + $mesg .= "Textzeile erfolgeich an Position ".$menpos." eingetragen"; + }else{ + $mesg .= "Fehler beim eintragen der Textzeile!"; + } + $url = "pxe.php?dn=".$pxeDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr; + } +} + + +elseif ($typ == "leer" && $typ != "newme" && $typ != "local" && $typ != "text" && $typ != "submenu" ){ + + # Menu Position + $menpos = $_POST['leerpos']; + if ($menpos != ""){ + # Syntaxcheck Menüposition + #$syntax = new Syntaxcheck; + #if (!($syntax->check_menuposition($menpos))){ + # $menpos = $maxpos; + #} + }else{ + $menpos = $maxpos; + } + if (strlen($menpos) == 1){ + $menpos = "0".$menpos; + } + # nun doch führende Nullen erzwingen + # also obsolet: $menpos = preg_replace ( '/0([0-9])/', '$1', $menpos); + + # CN bilden + $brothers = get_menuentries($pxeDN,array("dn","cn")); + $i=1; + $leercn = "leerzeile".$i; + if(count($brothers) != 0){ + for ($c=0; $c<count($brothers); $c++){ + foreach ($brothers as $item){ + if ($leercn == strtolower($item['cn'])){ + $i++; + $leercn = "leerzeile".$i; + } + } + } + } + $meDN = "cn=".$leercn.",".$pxeDN; + $entry ['objectclass'][0] = "MenuEntry"; + $entry ['objectclass'][1] = "top"; + $entry ['cn'] = $leercn; + $entry ['menuposition'] = $menpos; + $entry ['kernel'] = "menu.c32"; + # Submenulink auf sich selbst + $pxedata = get_node_data($pxeDN,array("filename")); + $entry ['submenulink'] = "self"; + + # wieder führende Nullen weg für increment_menpos + $pos = preg_replace ( '/0([0-9])/', '$1', $menpos); + increment_menupositions($pxeDN,$pos); # andere jeweils um 1 erhöhen + if (ldap_add($ds,$meDN,$entry)){ + $mesg .= "Leerzeile erfolgeich an Position ".$menpos." eingetragen"; + }else{ + $mesg .= "Fehler beim eintragen der Leerzeile!"; + } + $url = "pxe.php?dn=".$pxeDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr; +} + + +elseif ($typ == "submenu" && $typ != "newme" && $typ != "local" && $typ != "text" && $typ != "leer" ){ +} + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurü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 diff --git a/ldap-site-mngmt/webinterface/rbs/menuentry_change.php b/ldap-site-mngmt/webinterface/rbs/menuentry_change.php new file mode 100644 index 00000000..40d5d60d --- /dev/null +++ b/ldap-site-mngmt/webinterface/rbs/menuentry_change.php @@ -0,0 +1,207 @@ +<?php +include('../standard_header.inc.php'); + +$mecn = $_POST['mecn']; $mecn = htmlentities($mecn); +$oldmecn = $_POST['oldmecn']; + +$menpos = $_POST['menpos']; +if (strlen($menpos) == 1){ + $menpos = "0".$menpos; +} +$oldmenpos = $_POST['oldmenpos']; +if (strlen($oldmenpos) == 1){ + $oldmenpos = "0".$oldmenpos; +} + +$meDN = $_POST['medn']; +$pxeDN = $_POST['pxedn']; +$mnr = $_POST['mnr']; +$sbmnr = $_POST['sbmnr']; + +$attribs = $_POST['attribs']; +if (count($attribs) != 0){ + foreach (array_keys($attribs) as $key){ + $atts[$key] = htmlentities($attribs[$key]); + } +} +# print_r($meatts); 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>"; + + + +$seconds = 2; +$get_mecn = str_replace ( " ", "_", $mecn ); +$url = "menuentry.php?dn=".$meDN."&mnr=".$mnr."&sbmnr=".$sbmnr; + +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>"; + +############################################## +# ME CN (DN) + +if ( $oldmecn == $mecn ){ + # $mesg = "keine Aenderung<br>"; +} + +if ( $oldmecn != "" && $mecn != "" && $oldmecn != $mecn ){ + echo "Menü Eintrag Name aendern<br>"; + # hier noch Syntaxcheck + # Formulareingaben anpassen + $expme = explode(" ",$mecn); + foreach ($expme as $word){$expuc[] = ucfirst($word);} + $mecn = implode(" ",$expuc); + $mecn = preg_replace ( '/\s+([0-9A-Z])/', '$1', $mecn); + + + $newmeDN = "cn=".$mecn.",".$pxeDN; + print_r($newmeDN); echo "<br><br>"; + + if(modify_me_dn($meDN, $newmeDN)){ + $mesg = "Menü Eintrag Name erfolgreich geändert<br><br>"; + $meDN = $newmeDN; + }else{ + $mesg = "Fehler beim ändern des PMenü Eintrag Namen!<br><br>"; + } + + + # newsubmenu holen... + $url = "menuentry.php?dn=".$newmeDN."&mnr=".$mnr."&sbmnr=".$sbmnr; +} + +if ( $oldmecn != "" && $mecn == "" ){ + echo "Menü Eintrag Name loeschen!<br> + Dieses ist Teil des DN, Sie werden den Menü Eintrag komplett löschen<br><br>"; + echo "Wollen Sie den Menü Eintrag <b>".$oldmecn."</b> wirklich löschen?<br><br> + <form action='menuentry_delete.php' method='post'> + Falls ja:<br><br> + <input type='hidden' name='dn' value='".$meDN."'> + <input type='hidden' name='name' value='".$oldmecn."'> + <input type='Submit' name='apply' value='löschen' class='small_loginform_button'><br><br> + </form> + <form action='".$url."' method='post'> + Falls, nein:<br><br> + <input type='Submit' name='apply' value='zurück' class='small_loginform_button'> + </form>"; + $seconds = 600; +} + + +################################### +# Menu Position + +if ( $menpos == $oldmenpos || $menpos == "" ){ + # keine Änderung +} + +if ( $menpos != "" && $oldmenpos != $menpos ){ + echo "Menü Position ändern<br><br>"; + # Syntax Check fehlt noch + + # switch partner finden + $secmeDN = get_dn_menuposition($pxeDN,$menpos); + $entrysec ['menuposition'] = $oldmenpos; + if (ldap_mod_replace($ds,$secmeDN,$entrysec)){ + $entry ['menuposition'] = $menpos; + if (ldap_mod_replace($ds,$meDN,$entry)){ + #cleanup_menupositions($pxeDN); + $mesg .= "Menü Position erfolgeich nach <b>".$menpos."</b> geändert"; + }else{ + $mesg .= "Fehler beim ändern der Menü Position!"; + } + }else{ + $mesg .= "Fehler beim ändern der Menü Position!"; + } +} + +################################### +# restliche Attribute + +$entryadd = array(); +$entrymod = array(); +$entrydel = array(); + +foreach (array_keys($atts) as $key){ + + if ( $oldatts[$key] == $atts[$key] ){ + # nix + } + 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,$meDN,$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 "ändern<br>"; + foreach (array_keys($entrymod) as $key){ + $modatts .= "<b>".$key."</b>,"; + } + if(ldap_mod_replace($ds,$meDN,$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öschen<br>"; + foreach (array_keys($entrydel) as $key){ + $delatts .= "<b>".$key."</b>,"; + } + if(ldap_mod_del($ds,$meDN,$entrydel)){ + $mesg = "Attribute ".$delatts." erfolgreich geloescht<br><br>"; + }else{ + $mesg = "Fehler beim loeschen der Attribute ".$delatts."<br><br>"; + } +} + +################################### +# Ende, noch Redirect + + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurü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 diff --git a/ldap-site-mngmt/webinterface/rbs/menuentry_delete.php b/ldap-site-mngmt/webinterface/rbs/menuentry_delete.php new file mode 100644 index 00000000..ba06eb55 --- /dev/null +++ b/ldap-site-mngmt/webinterface/rbs/menuentry_delete.php @@ -0,0 +1,41 @@ +<?php +include('../standard_header.inc.php'); + +$meDN = $_POST['dn']; +$mecn = $_POST['name']; + +$pxeDN = $_POST['pxedn']; + +$seconds = 1; +$url = $_POST['successurl']; + +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>"; + +if ( $meDN != ""){ + + if ( dive_into_tree_del($meDN,"") ){ + cleanup_menupositions($pxeDN); + $mesg = "Bootmenü Eintrag <b>".$mecn."</b> erfolgreich gelöscht!<br><br>"; + } + else{ + $mesg = "Fehler beim löschen des Bootmenü Eintrags <b>".$mecn."</b> !<br><br>"; + } + +} + + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurü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 diff --git a/ldap-site-mngmt/webinterface/rbs/menuposition_down.php b/ldap-site-mngmt/webinterface/rbs/menuposition_down.php new file mode 100644 index 00000000..d7b235ce --- /dev/null +++ b/ldap-site-mngmt/webinterface/rbs/menuposition_down.php @@ -0,0 +1,41 @@ +<?php +include('../standard_header.inc.php'); + +$meDN = $_GET['dn']; +$oldpos = $_GET['pos']; + +$pxeDN = $_GET['pxedn']; +$mnr = $_GET['mnr']; +$sbmnr = $_GET['sbmnr']; + +$me = get_menuentries($pxeDN,array("cn")); +$maxpos = count($me); + +$oldpos = preg_replace ( '/0([0-9])/', '$1', $oldpos); +if ($oldpos < $maxpos){ + + $newpos = $oldpos +1; + if (strlen($newpos) == 1){ + $newpos = "0".$newpos; + } + if (strlen($oldpos) == 1){ + $oldpos = "0".$oldpos; + } + + if ($secmeDN = get_dn_menuposition($pxeDN,$newpos)){ + #echo "other meDN:"; print_r($secmeDN); echo "<br>"; + $entrysec ['menuposition'] = $oldpos; + if ($result = ldap_mod_replace($ds,$secmeDN,$entrysec)){ + $entrymenu ['menuposition'] = $newpos; + $result = ldap_mod_replace($ds,$meDN,$entrymenu); + } + } +} +$seconds = 0; +$url = "pxe.php?dn=".$pxeDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&#menu"; +$mesg = ""; +#$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> +# Falls nicht, klicken Sie hier <a href=".$url." style='publink'>back</a>"; +redirect($seconds, $url, $mesg, $addSessionId = TRUE); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/rbs/menuposition_up.php b/ldap-site-mngmt/webinterface/rbs/menuposition_up.php new file mode 100644 index 00000000..c2611651 --- /dev/null +++ b/ldap-site-mngmt/webinterface/rbs/menuposition_up.php @@ -0,0 +1,39 @@ +<?php +include('../standard_header.inc.php'); + +$meDN = $_GET['dn']; +$oldpos = $_GET['pos']; + +$pxeDN = $_GET['pxedn']; +$mnr = $_GET['mnr']; +$sbmnr = $_GET['sbmnr']; + +$oldpos = preg_replace ( '/0([0-9])/', '$1', $oldpos); +if ($oldpos != 1){ + + $newpos = $oldpos-1; + if (strlen($newpos) == 1){ + $newpos = "0".$newpos; + } + if (strlen($oldpos) == 1){ + $oldpos = "0".$oldpos; + } + + if ($secmeDN = get_dn_menuposition($pxeDN,$newpos)){ + #echo "other meDN:"; print_r($secmeDN); echo "<br>"; + $entrysec ['menuposition'] = $oldpos; + if ($result = ldap_mod_replace($ds,$secmeDN,$entrysec)){ + $entrymenu ['menuposition'] = $newpos; + $result = ldap_mod_replace($ds,$meDN,$entrymenu); + } + + } +} +$seconds = 0; +$url = "pxe.php?dn=".$pxeDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&#menu"; +$mesg = ""; +#$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> +# Falls nicht, klicken Sie hier <a href=".$url." style='publink'>back</a>"; +redirect($seconds, $url, $mesg, $addSessionId = TRUE); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/rbs/new_gbm.dwt b/ldap-site-mngmt/webinterface/rbs/new_gbm.dwt new file mode 100644 index 00000000..b84cf66d --- /dev/null +++ b/ldap-site-mngmt/webinterface/rbs/new_gbm.dwt @@ -0,0 +1,91 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='2'><h3>Generisches Boot Image <code class='font_object'> {GBMCN} </code> </h3></td> + </tr> + <tr> + <td height='20'></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <form action='gbm_add.php' method='post'> + + <tr> + <td width='40%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='60%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Eindeutiger Name (cn):</b><br>(Teil des dn, ohne Leerzeichen eingeben) </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='gbmcn' value='{GBMCN}' size='50' class='medium_form_field'> + </td> + </tr> + + </table></td> + </tr> + <tr> + <td height='40'></td> + </tr> + <tr> + <td colspan='2'><h4>KERNEL und APPEND Parameter:</h4></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <tr> + <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='25%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Server Pfad</b></td> + <td width='15%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>KERNEL Image: </td> + <td align='right' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <font size='+1'>{TFTP}::{TFTPPATH}</font></td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[kernel]' value='' size='45' class='medium_form_field'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Initrd (APPEND): </b> </td> + <td align='right' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <font size='+1'>{TFTP}::{TFTPPATH}</font></td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[initrd]' value='' size='45' class='medium_form_field'> + + </td> + </tr> + <tr valign='top'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Root Filesystem <br>(APPEND rootfs=..): </b></td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <select name='attribs[rootfstype]' size='4' class='rootfs_form_selectbox'> + {SELECTOPTIONS} + </select></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[rootfspath]' value='{ROOTFS}' size='30' class='medium_form_field'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>IPAPPEND: </b> </td> + <td align='right' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> </td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[ipappend]' value='1' size='2' class='medium_form_field'> + </td> + </tr> + + <input type='hidden' name='rbsdn' value='{RBSDN}'> + <input type='hidden' name='mnr' value='{MNR}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + + </table></td> + </tr> + <tr> + <td><input type='Submit' name='apply' value='anlegen' class='small_loginform_button'> + </form></td> + </tr> + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/rbs/new_gbm.php b/ldap-site-mngmt/webinterface/rbs/new_gbm.php new file mode 100644 index 00000000..4ece741c --- /dev/null +++ b/ldap-site-mngmt/webinterface/rbs/new_gbm.php @@ -0,0 +1,66 @@ +<?php +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "Remote Boot Service Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 4; +$mnr = -1; +$sbmnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "new_gbm.dwt"; + +include("../class.FastTemplate.php"); + +include('rbs_header.inc.php'); + +################################################################################### + +$mnr = $_GET['mnr']; +$sbmnr = $_GET['sbmnr']; + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createRBSMenu($rollen, $mnr, $auDN, $sbmnr); + +################################################################################### + +$gbmcn = str_replace ( "_", " ", $_GET['gbmcn']); + +# rbservice und pxe daten (voerst nur ein rbs) +$rbs_array = get_rbservices($auDN,array("dn","cn")); +$rbsDN = $rbs_array[0]['dn']; + +# RBS Daten +$rbs_data = get_node_data($rbsDN, array("cn","nfsserverip","exportpath","tftpserverip","tftppath","nbdserverip")); +$template->assign(array("RBSCN" => $rbs_data['cn'], + "TFTP" => $rbs_data['tftpserverip'], + "TFTPPATH" => $rbs_data['tftppath'], + "NFS" => $rbs_data['nfsserverip'], + "NFSPATH" => $rbs_data['exportpath'], + "NBD" => $rbs_data['nbdserverip'])); + + +$options = "<option value='none' selected>----------------------------</option> + <option value='nfs'><b>nfs://".$rbs_data['nfsserverip'].":/".$rbs_data['exportpath']."</b></option> + <option value='nbd'>nbd://".$rbs_data['nbdserverip'].":</option> + <option value='dnbd'>dnbd://".$rbs_data['nbdserverip'].":</option>"; + +$template->assign(array("GBMCN" => $gbmcn, + "LABEL" => "", + "KERNEL" => "", + "INITRD" => "", + "SELECTOPTIONS" => $options, + "ROOTFS" => "", + "IPAPPEND" => "", + "RBSDN" => $rbsDN, + "MNR" => $mnr, + "SBMNR" => $sbmnr)); + + + +################################################################################### + +include("rbs_footer.inc.php"); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/rbs/new_menuentry.dwt b/ldap-site-mngmt/webinterface/rbs/new_menuentry.dwt new file mode 100644 index 00000000..2b0e7860 --- /dev/null +++ b/ldap-site-mngmt/webinterface/rbs/new_menuentry.dwt @@ -0,0 +1,188 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td height='20'><h4>Zurück zu <a href='pxe.php?dn={PXEDN}&mnr={MNR}&sbmnr={SBMNR}&mcnr={MCNR}' class='headerlink'>{PXECN}</a></h4></td> + </tr> + <tr> + <td height='20'> </td> + </tr> + <tr> + <td colspan='2'><h3>Neuen Boot Menü Eintrag anlegen:</h3></td> + </tr> + <tr> + <td height='20'> </td> + </tr> + <tr> + <td colspan='2'><h4>Notwendige Attribute:</h4></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <form action='menuentry_add.php' method='post'> + + <tr> + <td width='35%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='65%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Eindeutiger Name (cn):</b><br>(Teil des dn, ohne Leerzeichen eingeben) </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='mecn' value='{MECN}' size='60' class='medium_form_field'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Label:</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[label]' value='{LABEL}' size='60' class='medium_form_field'> + </td> + </tr> + <tr height='50' valign='top'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Generische Boot Images: </b><br>(Wählen Sie eines aus) </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <select name='gbm' size='5' class='large_form_selectbox'> + <option selected value='none'>----------</option> + <!-- BEGIN DYNAMIC BLOCK: Gbms --> + <option value='{GBMDN}'>{GBMCN} [Abt.: {RBSAU}]</option> + <!-- END DYNAMIC BLOCK: Gbms --> + </select> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Menü Position: </b><br> + (Bitte ohne führende Null) </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='menpos' value='{MAXPOS}' size='2' class='medium_form_field'> + </td> + </tr> + + </table></td> + </tr> + <tr> + <td height='40'> </td> + </tr> + <tr> + <td colspan='2'><h4>Optionale Attribute:</h4></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <tr> + <td width='35%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='65%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Menu Label:</b> <br>(Wird im Bootmenü statt Label angezeigt) </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[menulabel]' value='{MELABEL}' size='50' class='medium_form_field'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Menu Passwd:</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[menupasswd]' value='{MEPASSWD}' size='50' class='medium_form_field'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Menu Hide:</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[menuhide]' value='{MEHIDE}' size='50' class='medium_form_field'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Localboot:</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[localboot]' value='{LOCALBOOT}' size='50' class='medium_form_field'> + </td> + </tr> + + </table></td> + </tr> + <tr> + <td height='40'></td> + </tr> + <tr> + <td colspan='2'><h4>APPEND Parameter:</h4></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <tr> + <td width='20%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='80%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Client Konfiguration via: </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[clientconfvia]' value='{CCV}' size='30' class='medium_form_field'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>vga: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[vga]' value='{VGA}' size='30' class='medium_form_field'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>splash: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[splash]' value='{SPLASH}' size='30' class='medium_form_field'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>vci: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[vci]' value='{VCI}' size='30' class='medium_form_field'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>no ldsc: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[noldsc]' value='{NOLDSC}' size='30' class='medium_form_field'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>elevator: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[elevator]' value='{ELEVATOR}' size='30' class='medium_form_field'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>apic: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[apic]' value='{APIC}' size='30' class='medium_form_field'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Union FS: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[unionfs]' value='{UNIONFS}' size='30' class='medium_form_field'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>cowloop: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[cowloop]' value='{COWLOOP}' size='30' class='medium_form_field'> + </td> + </tr> + + <input type='hidden' name='typ' value='newme'> + <input type='hidden' name='maxpos' value='{MAXPOS}'> + <input type='hidden' name='pxedn' value='{PXEDN}'> + <input type='hidden' name='mnr' value='{MNR}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + <input type='hidden' name='mcnr' value='{MCNR}'> + + </table></td> + </tr> + <tr> + <td><input type='Submit' name='apply' value='anlegen' class='small_loginform_button'> + </form></td> + </tr> + + + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/rbs/new_menuentry.php b/ldap-site-mngmt/webinterface/rbs/new_menuentry.php new file mode 100644 index 00000000..a6ee6e3e --- /dev/null +++ b/ldap-site-mngmt/webinterface/rbs/new_menuentry.php @@ -0,0 +1,166 @@ +<?php + +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "Remote Boot Service Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 4; +$mnr = 3; +$sbmnr = -1; +$mcnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "new_menuentry.dwt"; + +include("../class.FastTemplate.php"); + +include('rbs_header.inc.php'); + +################################################################################### + +$sbmnr = $_GET['sbmnr']; + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createRBSMenu($rollen, $mnr, $auDN, $sbmnr); + +################################################################################### + +$mecn = str_replace ( "_", " ", $_GET['mecn']); + +$pxeDN = $_GET['dn']; +$dnexp = ldap_explode_dn($pxeDN, 1); +$pxecn = $dnexp[0]; + +# RBS Daten +$pxe = get_node_data($pxeDN,array("rbservicedn")); +$rbsDN = $pxe['rbservicedn']; +$exp = explode(',',$rbsDN); +$exprbsau = explode('=',$exp[2]); $rbsau = $exprbsau[1]; +$rbsdata = get_node_data($rbsDN,array("cn","nfsserverip","exportpath","tftpserverip","tftppath")); + +# Anzahl Menüeinträge +$menens = get_menuentries($pxeDN,array("dn")); +$maxpos = count($menens)+1; + +# Bootmenu Daten +$template->assign(array("MECN" => $mecn, + "LABEL" => "", + "MELABEL" => "", + "MEDEF" => "", + "MEPASSWD" => "", + "MEHIDE" => "", + "VGA" => "", + "SPLASH" => "", + "NOLDSC" => "", + "ELEVATOR" => "", + "VCI" => "", + "CCV" => "", + "APIC" => "", + "COWLOOP" => "", + "UNIONFS" => "", + "DEBUG" => "", + "LOCALBOOT" => "", + "SUBMENULINK" => "", + "MENPOS" => "", + "MAXPOS" => $maxpos, + "PXEDN" => $pxeDN, + "PXECN" => $pxecn, + "MNR" => $mnr, + "SBMNR" => $sbmnr, + "MCNR" => $mcnr)); + + +# verwendbare GBMs holen +# eigene AU (andere noch über "offer" Attribut in RBS suchen) +$attributes = array("dn","cn","label","kernel","initrd","nfsroot","nbdroot","ipappend"); +$gbm_array = get_menuentries($rbsDN,$attributes); +if (count($gbm_array) != 0){ +$template->define_dynamic("Gbms", "Webseite"); + foreach ($gbm_array as $item){ + $template->assign(array("GBMDN" => $item['dn'], + "GBMCN" => $item['cn'], + "GBMLABEL" => $item['label'], + "RBSAU" => $rbsau)); + $template->parse("GBMS_LIST", ".Gbms"); + } +}else{ + $template->assign(array("GBMDN" => "", + "GBMCN" => "Keine generischen Boot Images verfügbar", + "GBMLABEL" => "Keine generischen Boot Images verfügbar", + "RBSAU" => "")); +} + + +# Alternative RB Dienste holen +$altrbs = get_rbservices($auDN,array("dn","cn")); +if (count($altrbs) != 0){ + for ($i=0; $i < count($altrbs); $i++){ + if ($rbsDN == $altrbs[$i]['dn']){ + array_splice($altrbs, $i, 1); + } + } +} + + +if (count($altrbs) != 0){ +$template->define_dynamic("Altrbs", "Webseite"); + foreach ($altrbs as $item){ + $altrbsexp = explode(',',$item['dn']); + $altrbsau = explode('=',$altrebsexp[2]); + $template->assign(array("ALTRBSDN" => $item['dn'], + "ALTRBSCN" => $item['cn'], + "ALTRBSAU" => "[ ".$altrbsau[1]." ]")); + $template->parse("ALTRBS_LIST", ".Altrbs"); + } +}else{ + $template->assign(array("ALTRBSDN" => "", + "ALTRBSCN" => "", + "ALTRBSAU" => "")); +} + +################################################ +# Bootmenü Einträge + +$menuentries = get_menuentries($pxeDN,array("dn","menuposition","label","menulabel")); +#print_r($menuentries); echo "<br>"; + +$template->define_dynamic("Bootmenu", "Webseite"); + +foreach ($menuentries as $me){ + $template->assign(array("MENDN" => $me['dn'], + "MENULABEL" => $me['menulabel'], + "POSITION" => $me['menuposition'], + "AUDN" => $auDN)); + $template->parse("BOOTMENU_LIST", ".Bootmenu"); +} + + +################################################ +# PXE kopieren + +$hostorgroup = $exp[0]; +$hgexp = explode('=',$exp[0]); + + +$hosts_array = get_hosts($auDN,array("dn","hostname")); +$groups_array = get_groups($auDN,array("dn","cn")); + +$template->define_dynamic("Hosts", "Webseite"); +foreach ($hosts_array as $item){ + $template->assign(array("HDN" => $item['dn'], + "HN" => $item['hostname'])); + $template->parse("HOSTS_LIST", ".Hosts"); +} +$template->define_dynamic("Groups", "Webseite"); +foreach ($groups_array as $item){ + $template->assign(array("GDN" => $item['dn'], + "GN" => $item['cn'])); + $template->parse("GROUPS_LIST", ".Groups"); +} + +################################################################################### + +include("rbs_footer.inc.php"); + +?> diff --git a/ldap-site-mngmt/webinterface/rbs/new_pxe.dwt b/ldap-site-mngmt/webinterface/rbs/new_pxe.dwt new file mode 100644 index 00000000..c97324b5 --- /dev/null +++ b/ldap-site-mngmt/webinterface/rbs/new_pxe.dwt @@ -0,0 +1,157 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='2'><h3>Neues DEFAULT PXE Boot Menü anlegen:</h3></td> + </tr> + <tr> + <td height='10'> </td> + </tr> + <tr> + <td colspan='2'><h4>Allgemein:</h4></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <form action='pxe_add.php' method='post'> + <tr> + <td width='30%' style='border-color: black; border-style: solid; border-width: 3 0 1 0;'><b>Eindeutiger Name (cn):</b><br>(Bitte ohne Leerzeichen eingeben) </td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 3 0 1 0;'> + <font size='+2'><b>PXE_</b></font><input type='Text' name='pxecn' value='{PXECN}' size='50' class='medium_form_field'> + </td> + </tr> + <tr valign='top'> + <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Remote Boot Dienst <br> + auswählen: </b> </td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <select name='rbs' size='5' class='medium_form_selectbox'> + <option selected value='none'>----------</option> + + <!-- BEGIN DYNAMIC BLOCK: Altrbs --> + <option value='{ALTRBSDN}'>{ALTRBSCN} {ALTRBSAU}</option> + <!-- END DYNAMIC BLOCK: Altrbs --> + + </select> + </td> + </tr> + <tr valign='top'> + <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Gültigkeitsdauer <br>(Time Range): </b> </td> + <td width='40%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='pxeday' value='{PXEDAY}' size='5' maxlength='5' class='medium_form_field'> + <br> + Eines der folgenden:<br> + + - <b>Datum</b> (Format: dd.mm, z.B. 21.03/01.11) <br> + - <b>Monatstag</b> (Format: dd, z.B. 01 oder 25) <br> + - <b>Wochentag</b> (Format: MO, DI, ... , SO) <br> + - <b>X</b> für <b>täglich</b> + + <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='pxebeg' value='{PXEBEG}' size='2' maxlength='2' class='medium_form_field'> + <b><font size='+1'>:00</b> - </font> + <input type='Text' name='pxeend' value='{PXEEND}' size='2' maxlength='2' class='medium_form_field'> + <b><font size='+1'>:59</b> Uhr</font><br> + - <b>Uhrzeit</b> (Format: hh, z.B. 07-19)<br> + - <b>X</b> für rund um die Uhr + </td> + </tr> + + </table></td> + </tr> + + <tr> + <td height='40'></td> + </tr> + <tr> + <td colspan='2'><h4>Globale PXE Parameter:</h4></td> + </tr> + + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <tr> + <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='70%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Default: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[default]' value='{DEFAULT}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[default]' value='{DEFAULT}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Menu Title: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[menutitle]' value='{MENTIT}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[menutitle]' value='{MENTIT}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Menu Master Passwd: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[menumasterpasswd]' value='{MENMPW}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[menumasterpasswd]' value='{MENMPW}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Timeout: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[timeout]' value='{TIMEOUT}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[timeout]' value='{TIMEOUT}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>No Escape: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[noescape]' value='{NOESC}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[noescape]' value='{NOESC}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Prompt: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[prompt]' value='{PROMPT}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[prompt]' value='{PROMPT}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Allow Options: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[allowoptions]' value='{ALLOW}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[allowoptions]' value='{ALLOW}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>On Error: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[onerror]' value='{ONERR}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[onerror]' value='{ONERR}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>ON Timeout: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[ontimeout]' value='{ONTIME}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[ontimeout]' value='{ONTIME}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Client-Conf Dateiname <br>(File URI): </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='conffile' value='{FILEURI}' size='50' class='medium_form_field'> + + </td> + </tr> + + <input type='hidden' name='oldpxecn' value='{PXECN}'> + <input type='hidden' name='mnr' value='{MNR}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + <input type='hidden' name='mcnr' value='{MCNR}'> + </table></td> + </tr> + <tr> + <td><input type='Submit' name='apply' value='anlegen' class='small_loginform_button'> + </form></td> + </tr> + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/rbs/new_pxe.php b/ldap-site-mngmt/webinterface/rbs/new_pxe.php new file mode 100644 index 00000000..9a6afba0 --- /dev/null +++ b/ldap-site-mngmt/webinterface/rbs/new_pxe.php @@ -0,0 +1,95 @@ +<?php + +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "Remote Boot Service Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 4; +$mnr = -1; +$sbmnr = -1; +$mcnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "new_pxe.dwt"; + +include("../class.FastTemplate.php"); + +include('rbs_header.inc.php'); + +################################################################################### + +$mnr = $_GET['mnr']; +$sbmnr = $_GET['sbmnr']; +$mcnr = $_GET['mcnr']; + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createRBSMenu($rollen, $mnr, $auDN, $sbmnr); + +################################################################################### + +$pxecn = str_replace ( "_", " ", $_GET['pxecn']); +$pxeday = str_replace ( "_", " ", $_GET['pxeday']); +$pxebeg = str_replace ( "_", " ", $_GET['pxebeg']); +$pxeend = str_replace ( "_", " ", $_GET['pxeend']); + +$template->assign(array("PXECN" => $pxecn, + "PXEDAY" => $pxeday, + "PXEBEG" => $pxebeg, + "PXEEND" => $pxeend, + "LDAPURI" => "", + "FILEURI" => "", + "RBS" => "", + "RBSAU" => "", + "NFS" => "", + "NFSROOT" => "", + "TFTP" => "", + "TFTPROOT" => "", + "FILE" => "", + "ALLOW" => "", + "CONSOLE" => "", + "DEFAULT" => "menu.c32", + "DISPLAY" => "", + "FONT" => "", + "IMPLICIT" => "", + "KBDMAP" => "", + "MENMPW" => "", + "MENTIT" => "", + "NOESC" => "1", + "ONERR" => "", + "ONTIME" => "", + "PROMPT" => "0", + "SAY" => "", + "SERIAL" => "", + "TIMEOUT" => "600", + "MNR" => $mnr, + "SBMNR" => $sbmnr)); + +############################################# +# RB Dienste holen +$rbsoffers = get_rbsoffers($auDN); + +$template->assign(array("ALTRBSDN" => "", + "ALTRBSCN" => "", + "ALTRBSAU" => "")); + +if (count($rbsoffers) != 0){ +$template->define_dynamic("Altrbs", "Webseite"); + foreach ($rbsoffers as $item){ + $rbsdnexp = ldap_explode_dn($item,1); + $rbsoffcn = $rbsdnexp[0]; + $rbsoffau = $rbsdnexp[2]; + #$auexp = explode(',',$item['auDN']); + #$altrbsau = explode('=',$auexp[0]); + $template->assign(array("ALTRBSDN" => $item, + "ALTRBSCN" => $rbsoffcn, + "ALTRBSAU" => " [ Abt.: ".$rbsoffau." ]")); + $template->parse("ALTRBS_LIST", ".Altrbs"); + } +} + +################################################################################### + +include("rbs_footer.inc.php"); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/rbs/new_rbservice.dwt b/ldap-site-mngmt/webinterface/rbs/new_rbservice.dwt new file mode 100644 index 00000000..52e693b5 --- /dev/null +++ b/ldap-site-mngmt/webinterface/rbs/new_rbservice.dwt @@ -0,0 +1,117 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='2'><h3>Remote Boot Service anlegen</h3></td> + </tr> + <tr> + <td height='20'></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <form action='rbservice_add.php' method='post'> + + <tr> + <td width='40%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='60%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Eindeutiger RBS Name (cn):</b><br>(Teil des dn, ohne Leerzeichen eingeben) </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <font size='+2'><b>RBS_</b></font><input type='Text' name='rbscn' value='{RBSCN}' size='40' class='medium_form_field'> + </td> + </tr> + <tr height='50' valign='top'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <b>Wer soll Dienst nutzen dürfen:</b><br>(Wählen Sie eine Abteilung,<br> + impliziert alle Unterabteilungen) + </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <select name='rbsoffer' size='4' class='medium_form_selectbox'> + <option selected value='{OFFERSELF}'>------ {SELFOU} ------</option> + + <!-- BEGIN DYNAMIC BLOCK: Rbsoffers --> + <option value='{RBSOFFER}'>{RBSOFFEROU}</option> + <!-- END DYNAMIC BLOCK: Rbsoffers --> + + </select> + </td> + </tr> + + </table></td> + </tr> + <tr> + <td height='40'></td> + </tr> + <tr> + <td colspan='2'><h4>Boot Server System:</h4></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <tr valign='top'> + <td width='20%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Server</b></td> + <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>IP Adresse eingeben</b> oder<br><b>Rechner auswählen</b></td> + <td width='50%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Pfad</b> <br>(auf dem jeweiligen Server)</td> + </tr> + <tr valign='top'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>TFTP Server: </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='tftpserverip' value='' size='20' class='medium_form_field'> + <select name='tftpserver' size='4' class='small_form_selectbox'> + <option selected value='none'>----------------------------</option> + <!-- BEGIN DYNAMIC BLOCK: TftpHosts --> + <option value='{HDN}'>{HN}</option> + <!-- END DYNAMIC BLOCK: TftpHosts --> + </select> + </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + Initial Boot File <input type='Text' name='attribs[initbootfile]' value='{INITBOOTFILE}' size='25' class='medium_form_field'><br> + Kernel Path <input type='Text' name='attribs[tftpkernelpath]' value='{TFTPKERNEL}' size='25' class='medium_form_field'><br> + PXE Path<input type='Text' name='attribs[tftppxepath]' value='{TFTPPXE}' size='25' class='medium_form_field'><br> + Clientconf Path<input type='Text' name='attribs[tftpclientconfpath]' value='{TFTPCLIENTCONF}' size='25' class='medium_form_field'> + </td> + </tr> + <tr valign='top'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>NFS Server: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='nfsserverip' value='' size='20' class='medium_form_field'> + <select name='nfsserver' size='4' class='small_form_selectbox'> + <option selected value='none'>----------------------------</option> + <!-- BEGIN DYNAMIC BLOCK: NfsHosts --> + <option value='{HDN}'>{HN}</option> + <!-- END DYNAMIC BLOCK: NfsHosts --> + </select> + </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[exportpath]' value='{NFSPATH}' size='25' class='medium_form_field'> + </td> + </tr> + <tr valign='top'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>NBD Server: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='nbdserverip' value='' size='20' class='medium_form_field'> + <select name='nbdserver' size='4' class='small_form_selectbox'> + <option selected value='none'>----------------------------</option> + <!-- BEGIN DYNAMIC BLOCK: NbdHosts --> + <option value='{HDN}'>{HN}</option> + <!-- END DYNAMIC BLOCK: NbdHosts --> + </select> + </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> </td> + </tr> + + <input type='hidden' name='mnr' value='{MNR}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + + </table></td> + </tr> + <tr> + <td><input type='Submit' name='apply' value='anlegen' class='small_loginform_button'> + </form></td> + </tr> + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/rbs/new_rbservice.php b/ldap-site-mngmt/webinterface/rbs/new_rbservice.php new file mode 100644 index 00000000..020e3254 --- /dev/null +++ b/ldap-site-mngmt/webinterface/rbs/new_rbservice.php @@ -0,0 +1,107 @@ +<?php +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "Remote Boot Service Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 4; +$mnr = 0; +$sbmnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "new_rbservice.dwt"; + +include("../class.FastTemplate.php"); + +include('rbs_header.inc.php'); + +################################################################################### + +$mnr = $_GET['mnr']; + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createRBSMenu($rollen, $mnr, $auDN, $sbmnr); + +################################################################################### + +# nochmal zur Sicherheit: falls doch RBS angelegt +$rbs_array = get_rbservices($auDN,array("dn","cn")); +if (count($rbs_array) != 0){ + $url = "rbservice.php?mnr=1"; + $seconds = 1; + $mesg .= "<br>Sie werden automatisch auf die nächste Seite geleitet. <br> + Falls nicht, klicken Sie hier <a href=".$url." style='publink'>hier</a>"; + redirect($seconds, $url, $mesg, $addSessionId = TRUE); +} + +$rbscn = str_replace ( "_", " ", $_GET['rbscn']); +$template->assign(array("RBSCN" => $rbscn, + "TFTP" => "", + "TFTPIP" => "", + "INITBOOTFILE" => "", + "TFTPKERNEL" => "", + "TFTPPXE" => "", + "TFTPCLIENTCONF" => "", + "NFS" => "", + "NFSIP" => "", + "NFSPATH" => "", + "NBD" => "", + "NBDIP" => "", + "HDN" => "", + "HN" => "", + "IP" => "", + "OFFERSELF" => $auDN, + "SELFOU" => $au_ou, + "MNR" => $mnr, + "SBMNR" => $sbmnr)); + + +# RBS Anbieten (ausser eigene AU) +$expdn = ldap_explode_dn($auDN, 0); # Mit Merkmalen +$expdn = array_slice($expdn, 2); +$expou = ldap_explode_dn($auDN, 1); # nur Werte +$expou = array_slice($expou, 2, -3); +#print_r($expou); echo "<br>"; +#print_r($expdn); echo "<br>"; +for ($i=0; $i<count($expou); $i++){ + $rbsoffers[$i]['ou'] = $expou[$i]; + $rbsoffers[$i]['dn'] = implode(',',$expdn); + $expdn = array_slice($expdn, 1); +} +#print_r($rbsoffers); + +$template->define_dynamic("Rbsoffers", "Webseite"); +foreach ($rbsoffers as $offer){ + $template->assign(array("RBSOFFER" => $offer['dn'], + "RBSOFFEROU" => $offer['ou'],)); + $template->parse("RBSOFFERS_LIST", ".Rbsoffers"); +} + +### Rechner +$hostorgroup = $exp[0]; +$hosts_array = get_hosts($auDN,array("dn","hostname","ipaddress")); + +$template->define_dynamic("TftpHosts", "Webseite"); +$template->define_dynamic("NfsHosts", "Webseite"); +$template->define_dynamic("NbdHosts", "Webseite"); +foreach ($hosts_array as $item){ + $template->assign(array("HDN" => $item['dn'], + "HN" => $item['hostname'], + "IP" => $item['ipaddress'])); + $template->parse("TFTPHOSTS_LIST", ".TftpHosts"); + $template->assign(array("HDN" => $item['dn'], + "HN" => $item['hostname'], + "IP" => $item['ipaddress'])); + $template->parse("NFSHOSTS_LIST", ".NfsHosts"); + $template->assign(array("HDN" => $item['dn'], + "HN" => $item['hostname'], + "IP" => $item['ipaddress'])); + $template->parse("NBDHOSTS_LIST", ".NbdHosts"); +} + + +################################################################################### + +include("rbs_footer.inc.php"); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/rbs/no_rbservice.dwt b/ldap-site-mngmt/webinterface/rbs/no_rbservice.dwt new file mode 100644 index 00000000..2d7c1a87 --- /dev/null +++ b/ldap-site-mngmt/webinterface/rbs/no_rbservice.dwt @@ -0,0 +1,22 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='2'><h3>Remote Boot Service </h3> + + <p>Sie haben noch keinen <b>Remote Boot Service</b> eingerichtet.</p> + + <p>Um</p> + + <ul> + <li><p><b>Generische Boot Menüs</b></p></li> + <li><p><b>Default PXE Bootmenüs</b></p></li> + </ul> + + <p>anlegen zu können muss erst ein Remote Boot Service eingerichtet werden.</p> + + <p>Verwenden sie dafür den Link <b>"Remote Boot Service"</b> im Navigationsmenü links, um + zur Eingabemaske zu gelangen.</p> + + </td> + </tr> + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/rbs/no_rbservice.php b/ldap-site-mngmt/webinterface/rbs/no_rbservice.php new file mode 100644 index 00000000..657e3738 --- /dev/null +++ b/ldap-site-mngmt/webinterface/rbs/no_rbservice.php @@ -0,0 +1,32 @@ +<?php +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "Remote Boot Service Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 4; +$mnr = 1; +$sbmnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "no_rbservice.dwt"; + +include("../class.FastTemplate.php"); + +include('rbs_header.inc.php'); + +################################################################################### + +$mnr = $_GET['mnr']; + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createRBSMenu($rollen, $mnr, $auDN, $sbmnr); + +################################################################################### + + +################################################################################### + +include("rbs_footer.inc.php"); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/rbs/pxe.dwt b/ldap-site-mngmt/webinterface/rbs/pxe.dwt new file mode 100644 index 00000000..4ce35565 --- /dev/null +++ b/ldap-site-mngmt/webinterface/rbs/pxe.dwt @@ -0,0 +1,453 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='2'><h3>PXE Boot Menü <code class='font_object'> {PXECN} </code> </h3></td> + </tr> + <tr> + <td height='10'></td> + </tr> + + <tr> + <td colspan='2'>Klicken Sie auf einen Menüeintrag um zur Detailansicht zu gelangen und den Eintrag bearbeiten zu können</td> + </tr> + <tr> + <td> + <table cellpadding='7' cellspacing='0' border='0' align='left' width='80%' style='border-color: black; border-style: solid; border-width: 2 2 2 2;'> + + <tr> + <td width='8%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'>#</td> + <td width='8%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'>Flags</td> + <td width='64%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'>Menu Label </td> + <td width='5%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'> </td> + <td width='15%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'> </td> + </tr> + + <!-- BEGIN DYNAMIC BLOCK: Bootmenu --> + <form action='delete_confirm.php' method='post'> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;{BGCDEF}'>{POSITION} </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;{BGCDEF}'>{MEDEF} {MEPWD} {MEHIDE} </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;{BGCDEF}'><font size='+1'>{ANZEIGE} </font></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;{BGCDEF}'> + <a href='menuposition_up.php?dn={MENDN}&pos={POSITION}&pxedn={PXEDN}&mnr={MNR}&sbmnr={SBMNR}&mcnr={MCNR}'><img style='border-width:0;border-style=none;' src='../pics/up2.gif' height='15'></a> <br> + <a href='menuposition_down.php?dn={MENDN}&pos={POSITION}&pxedn={PXEDN}&mnr={MNR}&sbmnr={SBMNR}&mcnr={MCNR}'><img style='border-width:0;border-style=none;' src='../pics/down2.gif' height='15'></a></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;{BGCDEF}'> + <input type='hidden' name='dn' value='{MENDN}'> + <input type='hidden' name='name' value='{ANZEIGENAME}'> + <input type='hidden' name='pxedn' value='{PXEDN}'> + <input type='hidden' name='delurl' value='menuentry_delete.php'> + <input type='hidden' name='successurl' value='pxe.php?dn={PXEDN}&mnr={MNR}&sbmnr={SBMNR}&mcnr={MCNR}'> + <input type='hidden' name='backurl' value='pxe.php?dn={PXEDN}&mnr={MNR}&sbmnr={SBMNR}&mcnr={MCNR}'> + <input type='Submit' name='apply' value='löschen' class='small_loginform_button'> + </tr> + </form> + <!-- END DYNAMIC BLOCK: Bootmenu --> + + </table></td> + </tr> + <tr> + <td><h4>Flags:</h4></font> + <ul> + <li><b>D</b> -> Default Menüeintrag</li> + <li><b>P</b> -> Passwort geschützt</li> + <li><b>H</b> -> Hidden</li> + </ul> + </td> + </tr> + <tr> + <td height='20'></td> + </tr> + <tr> + <td colspan='2'><h4>Neuen Menüeintrag anlegen: </h4> + <a href='new_menuentry.php?dn={PXEDN}&mnr={MNR}&sbmnr={SBMNR}&mcnr={MCNR}' style='color:#FFFFFF;' class='small_loginform_button'> zur Eingabemaske </a> </td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr> + <td colspan='2'><h4>Standard Menüeinträge anlegen:</h4></td> + </tr> + <tr> + <td> + <table cellpadding='7' cellspacing='0' border='0' align='left' width='90%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + + <tr> + <td width='20%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'>Typ </td> + <td width='25%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'> </td> + <td width='25%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'> </td> + <td width='10%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'>Position</td> + <td width='10%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'> </td> + </tr> + <tr valign='top'> + <form action='menuentry_add.php' method='post'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Localboot</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + Menu Label<br><input type='Text' name='locallabel' value='' size='20' class='medium_form_field'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + Passwort (optional)<br><input type='Text' name='localpasswd' value='' size='20' class='medium_form_field'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><input type='Text' name='localpos' value='{MAXPOS}' size='2' class='medium_form_field'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><input type='Submit' name='apply' value='anlegen' class='small_loginform_button'></td> + <input type='hidden' name='typ' value='local'> + <input type='hidden' name='maxpos' value='{MAXPOS}'> + <input type='hidden' name='pxedn' value='{PXEDN}'> + <input type='hidden' name='timerange' value='{TIMERANGE}'> + <input type='hidden' name='mnr' value='{MNR}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + <input type='hidden' name='mcnr' value='{MCNR}'> + </form> + </tr> + <tr valign='top'> + <form action='menuentry_add.php' method='post'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Textzeile</b> </td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><input type='Text' name='text' value='TEXT' size='50' class='medium_form_field'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><input type='Text' name='textpos' value='{MAXPOS}' size='2' class='medium_form_field'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><input type='Submit' name='apply' value='anlegen' class='small_loginform_button'></td> + <input type='hidden' name='typ' value='text'> + <input type='hidden' name='maxpos' value='{MAXPOS}'> + <input type='hidden' name='pxedn' value='{PXEDN}'> + <input type='hidden' name='timerange' value='{TIMERANGE}'> + <input type='hidden' name='mnr' value='{MNR}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + <input type='hidden' name='mcnr' value='{MCNR}'> + </form> + </tr> + <tr valign='top'> + <form action='menuentry_add.php' method='post'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Leerzeile</b> </td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><input type='Text' name='leerpos' value='{MAXPOS}' size='2' class='medium_form_field'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><input type='Submit' name='apply' value='anlegen' class='small_loginform_button'></td> + <input type='hidden' name='typ' value='leer'> + <input type='hidden' name='maxpos' value='{MAXPOS}'> + <input type='hidden' name='pxedn' value='{PXEDN}'> + <input type='hidden' name='timerange' value='{TIMERANGE}'> + <input type='hidden' name='mnr' value='{MNR}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + <input type='hidden' name='mcnr' value='{MCNR}'> + </form> + </tr> + <tr valign='top'> + <form action='menuentry_add.php' method='post'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Verweis zu Submenü</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>Submenü Name<br> + <input type='Text' name='submenu' value='' size='20' class='medium_form_field'></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>Remote Boot Service + <select name='subrbs' size='3' class='small_form_selectbox'> + <option selected value='none'>----------</option> + <!-- BEGIN DYNAMIC BLOCK: Subrbs --> + <option value='{SUBRBSDN}'>{SUBRBSCN} {SUBRBSAU}</option> + <!-- END DYNAMIC BLOCK: Subrbs --> + </select> + </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><input type='Text' name='submenupos' value='{MAXPOS}' size='2' class='medium_form_field'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><input type='Submit' name='apply' value='anlegen' class='small_loginform_button'></td> + <input type='hidden' name='typ' value='submenu'> + <input type='hidden' name='maxpos' value='{MAXPOS}'> + <input type='hidden' name='pxedn' value='{PXEDN}'> + <input type='hidden' name='timerange' value='{TIMERANGE}'> + <input type='hidden' name='mnr' value='{MNR}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + <input type='hidden' name='mcnr' value='{MCNR}'> + </form> + </tr> + + </table></td> + </tr> + + <tr> + <td height='40'></td> + </tr> + <tr> + <td colspan='2'><h4>Allgemeine Parameter:</h4></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <form action='pxe_change.php' method='post'> + <tr> + <td width='25%' style='border-color: black; border-style: solid; border-width: 3 0 1 0;'><b>Eindeutiger Name (cn):</b><br>(Bitte ohne Leerzeichen eingeben) </td> + <td width='5%' style='border-color: black; border-style: solid; border-width: 3 0 1 0;'> </td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 3 0 1 0;'> + <font size='+2'><b>PXE_</b></font><input type='Text' name='pxecn' value='{PXECN}' size='50' class='medium_form_field'> + <input type='hidden' name='oldpxecn' value='{PXECN}'> + </td> + </tr> + + <tr valign='top'> + <td width='25%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'><b>Gültigkeitsdauer <br>(Time Range(s)): </b><br> + Zum Löschen einer Time Range<br>Häkchen setzen </td> + <td width='5%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> </td> + <td width='35%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + Eines der folgenden:<br> + + - <b>Datum</b> (dd.mm, z.B. 21.03/01.11) <br> + - <b>Monatstag</b> (dd, z.B. 01 oder 25) <br> + - <b>Wochentag</b> (MO, DI, ... , SO) <br> + - <b>X</b> für <b>täglich</b> + + <td width='35%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + - <b>Uhrzeit</b> (Format: hh, z.B. 07-19)<br> + - <b>X</b> für rund um die Uhr + + </td> + </tr> + + <!-- BEGIN DYNAMIC BLOCK: TRanges --> + <tr valign='top'> + <td width='25%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> </td> + <td width='5%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + <input type='checkbox' name='deltr[]' value='{PXEDAY}_{PXEBEG}_{PXEEND}'> + </td> + <td width='35%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + <input type='Text' name='pxeday[]' value='{PXEDAY}' size='5' maxlength='5' class='medium_form_field'> + <input type='hidden' name='oldpxeday[]' value='{PXEDAY}'> <br> + + + <td width='35%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + <input type='Text' name='pxebeg[]' value='{PXEBEG}' size='2' maxlength='2' class='medium_form_field'> + <input type='hidden' name='oldpxebeg[]' value='{PXEBEG}'> <b><font size='+1'>:00</b> - </font> + <input type='Text' name='pxeend[]' value='{PXEEND}' size='2' maxlength='2' class='medium_form_field'> + <input type='hidden' name='oldpxeend[]' value='{PXEEND}'> <b><font size='+1'>:59</b> Uhr</font><br> + </td> + </tr> + <!-- END DYNAMIC BLOCK: TRanges --> + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>Neue Time Range hinzufügen </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='newpxeday' value='' size='5' maxlength='5' class='medium_form_field'> + + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='newpxebeg' value='' size='2' maxlength='2' class='medium_form_field'> + <b><font size='+1'>:00</b> - </font> + <input type='Text' name='newpxeend' value='' size='2' maxlength='2' class='medium_form_field'> + <b><font size='+1'>:59</b> Uhr</font><br> + + </td> + </tr> + + </table></td> + </tr> + + + + <tr> + <td height='40'></td> + </tr> + <tr> + <td colspan='2'><h4>Globale PXE Parameter:</h4></td> + </tr> + + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <tr> + <td width='20%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='80%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Default: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[default]' value='{DEFAULT}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[default]' value='{DEFAULT}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Menu Title: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[menutitle]' value='{MENTIT}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[menutitle]' value='{MENTIT}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Menu Master Passwd: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[menumasterpasswd]' value='{MENMPW}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[menumasterpasswd]' value='{MENMPW}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Timeout: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[timeout]' value='{TIMEOUT}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[timeout]' value='{TIMEOUT}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>No Escape: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[noescape]' value='{NOESC}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[noescape]' value='{NOESC}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Prompt: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[prompt]' value='{PROMPT}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[prompt]' value='{PROMPT}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Allow Options: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[allowoptions]' value='{ALLOW}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[allowoptions]' value='{ALLOW}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>On Error: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[onerror]' value='{ONERR}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[onerror]' value='{ONERR}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>ON Timeout: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[ontimeout]' value='{ONTIME}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[ontimeout]' value='{ONTIME}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>File URI: </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <font size='+1'>tftp://{TFTP}/{TFTPFILE}</font><input type='Text' name='attribs[fileuri]' value='{FILEURI}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[fileuri]' value='{FILEURI}'> + + </td> + </tr> + + </table></td> + </tr> + + <tr> + <td height='20'></td> + </tr> + <tr> + <td colspan='2'><h4>PXE Dateiname:</h4> + Achtung: Änderungen hier können zu nicht verwendeten PXE Dateien führen!<br> + Sie sollten hier nur Änderungen vornehmen, wenn der PXE Datei offensichtlich ein falscher Name zugewiesen ist.<br> + Wird z.B. vom betroffenen Rechner die MAC Adresse geändert, so wird dies vom System automatisch an dieser Stelle nachvollzogen. + Diese Feld dient daher primär der Kontrolle.</td> + </tr> + <tr> + <td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <tr valign='top'> + <td width='40%' style='border-color: black; border-style: solid; border-width: 3 0 1 0;'> + <b>PXE Dateiname(n): </b><br> + Bei PXE von Gruppen ist für jeden Mitgliedsrechner<br> + der PXE Dateiname aufgelistet. + </td> + <td style='border-color: black; border-style: solid; border-width: 3 0 1 0;'> + <!-- BEGIN DYNAMIC BLOCK: Filenames --> + <input type='Text' name='filename[]' value='{FILE}' size='40' class='medium_form_field'> + <input type='hidden' name='oldfilename[]' value='{FILE}'> + <!-- END DYNAMIC BLOCK: Filenames --> + <input type='Text' name='newfilename' value='' size='40' class='medium_form_field'> + </td> + </tr> + + </table></td> + </tr> + <tr> + <td> + <input type='hidden' name='nodedn' value='{NODEDN}'> + <input type='hidden' name='pxedn' value='{PXEDN}'> + <input type='hidden' name='oldpxecn' value='{PXECN}'> + <input type='hidden' name='mnr' value='{MNR}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + <input type='hidden' name='mcnr' value='{MCNR}'> + <input type='Submit' name='apply' value='anwenden' class='small_loginform_button'> + </form></td> + </tr> + + + <tr> + <td height='50'></td> + </tr> + + <tr> + <td colspan='2'><h4>PXE Boot Menü <code class='font_object'>{PXECN}</code> kopieren:</h4> + Beachten Sie, dass die Time Ranges des PXE Boot Menüs nicht kopiert werden. Sie müssen diese anschließend + neu setzen. <br> + Geben Sie bitte den eindeutigen Namen des neuen PXE Boot Menüs an.</td> + </tr> + <tr> + <td> + <table cellpadding='7' cellspacing='0' border='0' align='left' width='90%' style='border-width: 0 0 0 0;'> + <form action='pxe_copy.php' method='post'> + + <tr valign='top'> + <td style='border-color: black; border-style: solid; border-width: 3 0 1 0;'><b>Ziel Objekt:</b><br> + (Mehrfachauswahl möglich) </td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 3 0 1 0;'> + + <select name='copytargets[]' size='10' multiple class='medium_form_selectbox'> + <option selected value='none'>----------------------------</option> + <option value='{DEFDN}'>DEFAULT</option> + + <option value='none'>---- RECHNER -----</option> + <!-- BEGIN DYNAMIC BLOCK: Hosts --> + <option value='{HDN}'>{HN}</option> + <!-- END DYNAMIC BLOCK: Hosts --> + + <option value='none'>---- GRUPPEN -----</option> + <!-- BEGIN DYNAMIC BLOCK: Groups --> + <option value='{GDN}'>{GN}</option> + <!-- END DYNAMIC BLOCK: Groups --> + </select> + </td> + </tr> + <tr> + <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Eindeutiger Name (cn):</b><br>(Bitte ohne Leerzeichen eingeben) </td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <font size='+2'><b>PXE_</b></font><input type='Text' name='pxecncp' value='{PXECN}' size='50' class='medium_form_field'> + <input type='hidden' name='oldpxecncp' value='{PXECN}'> + </td> + </tr> + + <input type='hidden' name='pxedn' value='{PXEDN}'> + <input type='hidden' name='oldpxecn' value='{PXECN}'> + <input type='hidden' name='mnr' value='{MNR}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + <input type='hidden' name='mcnr' value='{MCNR}'> + <input type='hidden' name='deltr' value='{DELTR}'> + + </table></td> + </tr><tr><td> + <input type='Submit' name='apply' value='kopieren' class='small_loginform_button'> + </form></td></tr> + + <tr> + <td height='50'></td> + </tr> + + <tr> + <td colspan='2'><h4>PXE Boot Menü <code class='font_object'>{PXECN}</code> löschen:</h4></td> + </tr> + <tr> + <td> + <table cellpadding='7' cellspacing='0' border='0' align='left' width='90%' style='border-width: 0 0 0 0;'> + <form action='delete_confirm.php' method='post'> + + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + Die MachineConfig wird komplett gelöscht. + </tr> + + <input type='hidden' name='dn' value='{PXEDN}'> + <input type='hidden' name='name' value='{PXECN}'> + <input type='hidden' name='delurl' value='pxe_delete.php'> + <input type='hidden' name='successurl' value='pxeconfig_default.php?&mnr={MNR}'> + <input type='hidden' name='backurl' value='pxe.php?dn={PXEDN}&mnr={MNR}&sbmnr={SBMNR}&mcnr={MCNR}'> + + </table></td> + </tr><tr><td> + <input type='Submit' name='apply' value='löschen' class='small_loginform_button'> + </form></td></tr> + +</table> diff --git a/ldap-site-mngmt/webinterface/rbs/pxe.php b/ldap-site-mngmt/webinterface/rbs/pxe.php new file mode 100644 index 00000000..85df99ac --- /dev/null +++ b/ldap-site-mngmt/webinterface/rbs/pxe.php @@ -0,0 +1,221 @@ +<?php + +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "Remote Boot Service Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 4; +$mnr = -1; +$sbmnr = -1; +# $mcnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "pxe.dwt"; + +include("../class.FastTemplate.php"); + +include('rbs_header.inc.php'); + +################################################################################### + +$mnr = $_GET['mnr']; +$sbmnr = $_GET['sbmnr']; +$mcnr = $_GET['mcnr']; + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createRBSMenu($rollen, $mnr, $auDN, $sbmnr); + +################################################################################### + +$pxeDN = $_GET['dn']; + +$attributes = array("dn","cn","rbservicedn","filename","timerange","allowoptions","console","default", + "display","font","implicit","kbdmap","menumasterpasswd","menutitle", + "noescape","onerror","ontimeout","prompt","say","serial","timeout","ldapuri","fileuri"); +$pxe = get_node_data($pxeDN,$attributes); +#print_r($pxe); + +$exp = explode(',',$pxeDN); +$node = array_slice($exp,1); +$nodeDN = implode(',',$node); + +# RBS Daten +$rbsDN = $pxe['rbservicedn']; +$exp = explode(',',$rbsDN); +$exprbsau = explode('=',$exp[2]); $rbsau = $exprbsau[1]; +$rbsdata = get_node_data($rbsDN,array("cn","nfsserverip","exportpath","tftpserverip","tftppath","tftpclientconfpath")); + +# Timerange Komponenten +$template->define_dynamic("TRanges", "Webseite"); +if (count($pxe['timerange']) > 1){ + foreach($pxe['timerange'] as $tr){ + $exptime = explode('_',$tr); + $template->assign(array("PXEDAY" => $exptime[0], + "PXEBEG" => $exptime[1], + "PXEEND" => $exptime[2])); + $template->parse("TRANGES_LIST", ".TRanges"); + } +}else{ + $exptime = explode('_',$pxe['timerange']); + $template->assign(array("PXEDAY" => $exptime[0], + "PXEBEG" => $exptime[1], + "PXEEND" => $exptime[2])); + $template->parse("TRANGES_LIST", ".TRanges"); +} + +# Filenames +$template->define_dynamic("Filenames", "Webseite"); +if (count($pxe['filename']) > 1){ + foreach($pxe['filename'] as $fi){ + $template->assign(array("FILE" => $fi)); + $template->parse("FILENAMES_LIST", ".Filenames"); + } +}else{ + $exptime = explode('_',$pxe['filename']); + $template->assign(array("FILE" => $pxe['filename'])); + $template->parse("FILENAMES_LIST", ".Filenames"); +} + +$expcn = explode('_',$pxe['cn']); +$name = array_slice($expcn,1); +$pxecn = implode('_',$name); + +# Bootmenü Einträge +$menuentries = get_menuentries($pxeDN,array("dn","menuposition","label","menulabel","menudefault","menupasswd","menuhide")); +#print_r($menuentries); echo "<br>"; +$maxpos = count($menuentries)+1; + +# Globale Parameter +$template->assign(array("PXEDN" => $pxeDN, + "PXECN" => $pxecn, + "TIMERANGE" => $pxe['timerange'], + "RBS" => $rbsdata['cn'], + "RBSAU" => $rbsau, + "NFS" => $rbsdata['nfsserverip'], + "NFSROOT" => $rbsdata['exportpath'], + "TFTP" => $rbsdata['tftpserverip'], + "TFTPROOT" => $rbsdata['tftppath'], + "TFTPFILE" => $rbsdata['tftpclientconfpath'], + #"LDAP" => LDAP_HOST, + #"LDAPURI" => $pxe['ldapuri'], + "FILEURI" => $pxe['fileuri'], + "FILE" => $pxe['filename'], + "ALLOW" => $pxe['allowoptions'], + "CONSOLE" => $pxe['console'], + "DEFAULT" => $pxe['default'], + "DISPLAY" => $pxe['display'], + "FONT" => $pxe['font'], + "IMPLICIT" => $pxe['implicit'], + "KBDMAP" => $pxe['kbdmap'], + "MENMPW" => $pxe['menumasterpasswd'], + "MENTIT" => $pxe['menutitle'], + "NOESC" => $pxe['noescape'], + "ONERR" => $pxe['onerror'], + "ONTIME" => $pxe['ontimeout'], + "PROMPT" => $pxe['prompt'], + "SAY" => $pxe['say'], + "SERIAL" => $pxe['serial'], + "TIMEOUT" => $pxe['timeout'], + "MAXPOS" => $maxpos, + "NODEDN" => $nodeDN, + "DEFDN" => $rbsDN, + "MNR" => $mnr, + "SBMNR" => $sbmnr, + "MCNR" => $mcnr)); + +# RB Dienste für Submenüeinträge holen +# kommt wohl wieder raus (->Submenüs nur im eigenen RBS Bereich) +$subrbs = get_rbsoffers($auDN); + +# Für Submenü Einträge +$template->assign(array("SUBRBSDN" => "", + "SUBRBSCN" => "", + "SUBRBSAU" => "")); +if (count($subrbs) != 0){ +$template->define_dynamic("Subrbs", "Webseite"); + foreach ($subrbs as $item){ + $rbsdnexp = ldap_explode_dn($item,1); + $subrbscn = $rbsdnexp[0]; + $subrbsau = $rbsdnexp[2]; + #$subrbsexp = explode(',',$item['dn']); + #$subrbsau = explode('=',$subrbsexp[2]); + $template->assign(array("SUBRBSDN" => $item, + "SUBRBSCN" => $subrbscn, + "SUBRBSAU" => "[ ".$subrbsau." ]")); + $template->parse("SUBRBS_LIST", ".Subrbs"); + } +} + + +################################################ +# Bootmenü Einträge + +$template->define_dynamic("Bootmenu", "Webseite"); +$template->assign(array("MENDN" => "", + "MENULABEL" => "", + "ANZEIGE" => "Noch kein Bootmenü Eintrag angelegt", + "MEDEF" => "", + "MEPWD" => "", + "MEHIDE" => "", + "BGCDEF" => "", + "POSITION" => "")); +foreach ($menuentries as $me){ + $anzeige = ""; + if ($me['label'] != "" && $me['menulabel'] == ""){$anzeige .= $me['label'];} + if ($me['menulabel'] != ""){$anzeige .= $me['menulabel'];} + if ($me['menudefault'] == 1){$medef = "<b>D</b>"; $bgcdef = "background-color:#EEDD82;";} + if ($me['menupasswd'] != ""){$mepwd = "<b>P</b>";} + if ($me['menuhide'] == 1){$mehide = "<b>H</b>"; $bgcdef = "background-color:#A0A0A0;";} + $template->assign(array("MENDN" => $me['dn'], + "ANZEIGE" => "<a href='menuentry.php?dn=".$me['dn']."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr."' class='headerlink'>".$anzeige."</a>", + "ANZEIGENAME" => $anzeige, + "POSITION" => $me['menuposition'], + "MEDEF" => $medef, + "MEPWD" => $mepwd, + "MEHIDE" => $mehide, + "BGCDEF" => $bgcdef, + "AUDN" => $auDN)); + $template->parse("BOOTMENU_LIST", ".Bootmenu"); + $medef = ""; + $bgcdef = ""; +} + + + +################################################ +# PXE kopieren + +$hostorgroup = $exp[0]; +$hgexp = explode('=',$exp[0]); + +$hosts_array = get_hosts($auDN,array("dn","hostname")); +$groups_array = get_groups($auDN,array("dn","cn")); + +$template->define_dynamic("Hosts", "Webseite"); +foreach ($hosts_array as $item){ + $template->assign(array("HDN" => $item['dn'], + "HN" => $item['hostname'])); + $template->parse("HOSTS_LIST", ".Hosts"); +} +$template->define_dynamic("Groups", "Webseite"); +foreach ($groups_array as $item){ + $template->assign(array("GDN" => $item['dn'], + "GN" => $item['cn'])); + $template->parse("GROUPS_LIST", ".Groups"); +} + + +# falls TR vorhanden dann soll sie gelöscht werden (flag deltr setzen) +if (count($pxe['timerange']) != 0){ + $template->assign(array("DELTR" => "1")); +} +else{ + $template->assign(array("DELTR" => "0")); +} + +################################################################################### + +include("rbs_footer.inc.php"); + +?> diff --git a/ldap-site-mngmt/webinterface/rbs/pxe_add.php b/ldap-site-mngmt/webinterface/rbs/pxe_add.php new file mode 100644 index 00000000..4b314ab1 --- /dev/null +++ b/ldap-site-mngmt/webinterface/rbs/pxe_add.php @@ -0,0 +1,118 @@ +<?php +include('../standard_header.inc.php'); + +$pxecn = $_POST['pxecn']; $pxecn = htmlentities($pxecn); +$rbsDN = $_POST['rbs']; +#print_r($rbsDN); +$pxeday = $_POST['pxeday']; $pxeday = htmlentities($pxeday); +$pxebeg = $_POST['pxebeg']; $pxebeg = htmlentities($pxebeg); +$pxeend = $_POST['pxeend']; $pxeend = htmlentities($pxeend); + +$conffile = $_POST['conffile']; $conffile = htmlentities($conffile); + +$pxeattribs = $_POST['pxeattribs']; +if (count($pxeattribs) != 0){ + foreach (array_keys($pxeattribs) as $key){ + $pxeatts[$key] = htmlentities($pxeattribs[$key]); + } +} +# print_r($pxeatts); echo "<br><br>"; +$mnr = $_POST['mnr']; +$sbmnr = $_POST['sbmnr']; +$mcnr = $_POST['mcnr']; + + +$seconds = 2; +$get_pxecn = str_replace ( " ", "_", $pxecn ); +$get_pxeday = str_replace ( " ", "_", $pxeday ); +$get_pxebeg = str_replace ( " ", "_", $pxebeg ); +$get_pxeend = str_replace ( " ", "_", $pxeend ); +$url = "new_pxe.php?pxecn=".$get_pxecn."&pxeday=".$get_pxeday."&pxebeg=".$get_pxebeg."&pxeend=".$get_pxeend."&mnr=".$mnr."&sbmnr=".$sbmnr; + +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>"; + +if ( $pxecn != "" && $pxecn != "Hier_PXE_NAME_eintragen" && $rbsDN != "none" ){ + + $pxecn = "PXE_".$pxecn; + # Formulareingaben anpassen + $exppxe = explode(" ",$pxecn); + foreach ($exppxe as $word){$expuc[] = ucfirst($word);} + $pxecn = implode(" ",$expuc); + $pxecn = preg_replace ( '/\s+([0-9A-Z])/', '$1', $pxecn); + + $pxetimerange = ""; + + if ( $pxeday != "" && $pxebeg != "" && $pxeend != "" && $pxebeg <= $pxeend ){ + + # TimeRange Syntax checken + $syntax = new Syntaxcheck; + if ($syntax->check_timerange_syntax($pxeday,$pxebeg,$pxeend)){ + + # in Grossbuchstaben + if (preg_match("/([a-z]+)/",$pxeday)){$pxeday = strtoupper($pxeday);} + if (preg_match("/([a-z]+)/",$pxebeg)){$pxebeg = strtoupper($pxebeg);} + if (preg_match("/([a-z]+)/",$pxeend)){$pxeend = strtoupper($pxeend);} + + # führende Nullen weg + $pxebeg = preg_replace ( '/0([0-9])/', '$1', $pxebeg); + $pxeend = preg_replace ( '/0([0-9])/', '$1', $pxeend); + + # TimeRange auf Ãœberschneidung mit vorhandenen checken + if(check_timerange_pxe($pxeday,$pxebeg,$pxeend,$rbsDN,"")){ + $pxetimerange = $pxeday."_".$pxebeg."_".$pxeend; + } + else{ + $mesg = "Es existiert bereits ein PXE Boot Menü, das sich mit der eingegebenen Time Range + überschneidet!<br> + Das neue PXE Boot Menü wird ohne Time Range angelegt.<br> + Bitte geben Sie diese anschließend ein.<br><br>"; + } + } + else{ + $mesg = "Falsche Syntax in der Time-Range-Eingabe! Das neue PXE Boot Menü wird ohne Time Range angelegt.<br> + Bitte geben Sie diese anschließend ein.<br><br>"; + } + } + else{ + $mesg = "Keine vollständige Time-Range-Eingabe! Das neue PXE Boot Menü wird ohne Time Range angelegt.<br> + Bitte geben Sie diese anschließend ein.<br><br>"; + } + + $pxeDN = "cn=".$pxecn.",".$rbsDN; + $filename = array("default"); + #$ldapuri = LDAP_HOST."/dn=cn=computers,".$auDN; + + if (add_pxe($pxeDN,$pxecn,$rbsDN,$pxetimerange,$pxeattribs,$filename,$conffile)){ + $mesg .= "<br>Neues PXE Boot Menü erfolgreich angelegt<br>"; + $url = "pxe.php?dn=".$pxeDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr; + } + else{ + $mesg .= "<br>Fehler beim anlegen des PXE Boot Menüs!<br>"; + } +} + +elseif ( $pxecn == "" || $pxecn == "Hier_PXE_NAME_eintragen" || $rbsDN == "none" ){ + + $mesg = "Sie haben den Namen des neuen PXE Boot Menüs nicht angegeben oder den + Remote Boot Dienst nicht ausgewählt. Beide sind aber ein notwendige Attribute.<br> + Bitte geben Sie sie an.<br><br>"; + $url = "new_pxe.php?pxecn=Hier_PXE_NAME_eintragen&pxeday=".$get_pxeday."&pxebeg=".$get_pxebeg."&pxeend=".$get_pxeend."&mnr=".$mnr."&sbmnr=".$sbmnr; +} + + + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurü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 diff --git a/ldap-site-mngmt/webinterface/rbs/pxe_change.php b/ldap-site-mngmt/webinterface/rbs/pxe_change.php new file mode 100644 index 00000000..d122a830 --- /dev/null +++ b/ldap-site-mngmt/webinterface/rbs/pxe_change.php @@ -0,0 +1,434 @@ +<?php +include('../standard_header.inc.php'); + +$pxecn = "PXE_".$_POST['pxecn']; + +$pxeday = $_POST['pxeday']; +$pxebeg = $_POST['pxebeg']; +$pxeend = $_POST['pxeend']; +foreach (array_keys($pxeday) as $key){ + $pxeday[$key] = htmlentities($pxeday[$key]); +} +foreach (array_keys($pxebeg) as $key){ + $pxebeg[$key] = htmlentities($pxebeg[$key]); +} +foreach (array_keys($pxeend) as $key){ + $pxeend[$key] = htmlentities($pxeend[$key]); +} + +$deltr = $_POST['deltr']; + +$newpxeday = $_POST['newpxeday']; $newpxeday = htmlentities($newpxeday); +$newpxebeg = $_POST['newpxebeg']; $newpxebeg = htmlentities($newpxebeg); +$newpxeend = $_POST['newpxeend']; $newpxeend = htmlentities($newpxeend); + +$oldpxeday = $_POST['oldpxeday']; +$oldpxebeg = $_POST['oldpxebeg']; +$oldpxeend = $_POST['oldpxeend']; + +$pxeDN = $_POST['pxedn']; +$oldpxecn = "PXE_".$_POST['oldpxecn']; + +$rbs = $_POST['rbs']; +$filename = $_POST['filename']; +if (count($filename) != 0){ + foreach (array_keys($filename) as $key){ + $file[$key] = htmlentities($filename[$key]); + } +} +$oldfilename = $_POST['oldfilename']; +if (count($oldfilename) != 0){ + foreach (array_keys($oldfilename) as $key){ + $oldfile[$key] = htmlentities($oldfilename[$key]); + } +} +$newfilename = $_POST['newfilename']; $newfilename = htmlentities($newfilename); + +$nodeDN = $_POST['nodedn']; +$mnr = $_POST['mnr']; +$sbmnr = $_POST['sbmnr']; +$mcnr = $_POST['mcnr']; + +# 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>"; + + +$seconds = 2; +$url = "pxe.php?dn=".$pxeDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr; + +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>"; + +############################################## +# PXE CN (DN) + +if ( $oldpxecn == $pxecn ){ + # $mesg = "keine Aenderung<br>"; +} + +if ( $oldpxecn != "" && $pxecn != "" && $oldpxecn != $pxecn ){ + echo "PXE Name aendern<br>"; + # hier noch Syntaxcheck + # Formulareingaben anpassen + $exppxe = explode(" ",$pxecn); + foreach ($exppxe as $word){$expuc[] = ucfirst($word);} + $pxecn = implode(" ",$expuc); + $pxecn = preg_replace ( '/\s+([0-9A-Z])/', '$1', $pxecn); + + $newpxeDN = "cn=".$pxecn.",".$nodeDN; + print_r($newpxeDN); echo "<br><br>"; + + if(modify_pxe_dn($pxeDN, $newpxeDN)){ + $mesg = "PXE Name erfolgreich geändert<br><br>"; + $pxeDN = $newpxeDN; + }else{ + $mesg = "Fehler beim ändern des PXE Namen!<br><br>"; + } + + + # newsubmenu holen... + $url = "pxe.php?dn=".$newpxeDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr; +} + +if ( $oldpxecn != "" && $pxecn == "" ){ + echo "Gruppenname loeschen!<br> + Dieses ist Teil des DN, Sie werden das PXE Boot Menü komplett löschen<br><br>"; + echo "Wollen Sie das PXE Boot Menü <b>".$oldpxecn."</b> wirklich löschen?<br><br> + <form action='pxe_delete.php' method='post'> + Falls ja:<br><br> + <input type='hidden' name='dn' value='".$pxeDN."'> + <input type='hidden' name='name' value='".$oldpxecn."'> + <input type='Submit' name='apply' value='löschen' class='small_loginform_button'><br><br> + </form> + <form action='".$url."' method='post'> + Falls, nein:<br><br> + <input type='Submit' name='apply' value='zurück' class='small_loginform_button'> + </form>"; + $seconds = 600; +} + +########################################## +# Remote Boot Dienst + +if ($rbs != "none"){ + $exp = explode(',',$rbs); + $exprbscn = explode('=',$exp[0]); + $rbscn = $exprbscn[1]; + $exprbsau = explode('=',$exp[2]); + $rbsau = $exprbsau[1]; + + $entryrbs ['rbservicedn'] = $rbs; + if ($result = ldap_mod_replace($ds,$pxeDN,$entryrbs)){ + $mesg = "Remote Boot Service erfolgreich zu <b>".$rbscn."[Abt.: ".$rbsau."]</b> geändert<br><br>"; + }else{ + $mesg = "Fehler beim ändern des Remote Boot Services zu <b>".$rbscn."</b>!<br><br>"; + } +} + + +########################################## +# bereits vorhandene TimeRange(s) bearbeiten + +$entrymodtr = array(); +$modtr = 0; +# TimeRanges zusammensetzen +# $t = 0; # Laufvariable für $entrymodtr, da nicht jede Timerange ok sein muss +for ($i=0; $i<count($pxeday); $i++){ + +$oldpxetimerange = $oldpxeday[$i]."_".$oldpxebeg[$i]."_".$oldpxeend[$i]; + +if ( ($pxebeg[$i] <= $pxeend[$i]) && ( ($pxeday[$i] != $oldpxeday[$i] && $pxeday[$i] != "") || ($pxebeg[$i] != $oldpxebeg[$i] && $pxebeg[$i] != "") || ($pxeend[$i] != $oldpxeend[$i] && $pxeend[$i] != "")) ){ + + + # TimeRange Syntax checken + $syntax = new Syntaxcheck; + if ($syntax->check_timerange_syntax($pxeday[$i],$pxebeg[$i],$pxeend[$i])){ + + # in Grossbuchstaben + if (preg_match("/([a-z]+)/",$pxeday[$i])){$pxeday[$i] = strtoupper($pxeday[$i]);} + if (preg_match("/([a-z]+)/",$pxebeg[$i])){$pxebeg[$i] = strtoupper($pxebeg[$i]);} + if (preg_match("/([a-z]+)/",$pxeend[$i])){$pxeend[$i] = strtoupper($pxeend[$i]);} + + # führende Nullen weg + $pxebeg[$i] = preg_replace ( '/0([0-9])/', '$1', $pxebeg[$i]); + $pxeend[$i] = preg_replace ( '/0([0-9])/', '$1', $pxeend[$i]); + + # TimeRange auf Ãœberschneidung mit vorhandenen checken außer mit eigener alter TR da diese + # ja geändert werden soll + if(check_timerange_pxe($pxeday[$i],$pxebeg[$i],$pxeend[$i],$nodeDN,$oldpxetimerange)){ + + $pxetimerange = $pxeday[$i]."_".$pxebeg[$i]."_".$pxeend[$i]; + $entrymodtr ['timerange'][$i] = $pxetimerange; + $modtr = 1; + + } + else{ + $mesg = "Es existiert bereits ein PXE Boot Menü, das sich mit der eingegebenen Time Range + überschneidet!<br> + Bitte geben Sie eine andere Time Range ein.<br><br>"; + $entrymodtr ['timerange'][$i] = $oldpxetimerange; + } + } + else{ + $mesg = "Falsche Syntax in der Timerange-Eingabe!<br> + Bitte geben Sie die erneut Time Range ein.<br><br>"; + $entrymodtr ['timerange'][$i] = $oldpxetimerange; + } + +} + + +elseif ( $pxeday[$i] == "" || $pxebeg[$i] == "" || $pxeend[$i] == "" || $pxebeg[$i] > $pxeend[$i]){ + + $mesg = "Sie haben die Time Range <b>Nr.".$i."</b> nicht vollständig angegeben. Diese ist aber ein notwendiges Attribut.<br> + Diese Time Range wird nicht bearbeitet.<br><br>"; + $entrymodtr ['timerange'][$i] = $oldpxetimerange; +} + +else{$entrymodtr ['timerange'][$i] = $oldpxetimerange;} +} # Ende for-Schleife für jede Timerange +# jetzt noch alle gesammelten Änderungen Durchführen ... +if ($modtr == 1){ + # erst ändern + echo "Ändern: "; print_r($entrymodtr); echo "<br>"; + if($result = ldap_mod_replace($ds,$pxeDN,$entrymodtr)){ + $mesg = "TimeRanges erfolgreich geändert<br><br>"; + }else{ + $mesg = "Fehler beim ändern der TimeRanges!<br><br>"; + } +} + + +if ( count($deltr) != 0 && $modtr == 0 ){ + # Time Range löschen + $j = 0; + foreach ($deltr as $delrange){ + $entrydeltr ['timerange'][$j] = $delrange; + $j++; + } + # dann löschen + echo "Löschen: "; print_r($entrydeltr); echo "<br>"; + if($result = ldap_mod_del($ds,$pxeDN,$entrydeltr)){ + $mesg = "TimeRanges erfolgreich gelöscht<br><br>"; + }else{ + $mesg = "Fehler beim löschen der TimeRanges!<br><br>"; + } +}elseif(count($deltr) != 0 && $modtr == 1){ + echo "Nur Ändern (gleichzeitig Löschen und Ändern geht nicht)"; +} + +##################################### +# TimeRange hinzufügen + +if ( $newpxeday != "" && $newpxebeg != "" && $newpxeend != "" && $newpxebeg <= $newpxeend ){ + + # TimeRange Syntax checken + $syntax = new Syntaxcheck; + if ($syntax->check_timerange_syntax($newpxeday,$newpxebeg,$newpxeend)){ + + # in Grossbuchstaben + if (preg_match("/([a-z]+)/",$newpxeday)){$newpxeday = strtoupper($newpxeday);} + if (preg_match("/([a-z]+)/",$newpxebeg)){$newpxebeg = strtoupper($newpxebeg);} + if (preg_match("/([a-z]+)/",$newpxeend)){$newpxeend = strtoupper($newpxeend);} + + # führende Nullen weg + $newpxebeg = preg_replace ( '/0([0-9])/', '$1', $newpxebeg); + $newpxeend = preg_replace ( '/0([0-9])/', '$1', $newpxeend); + + # TimeRange auf Ãœberschneidung mit vorhandenen checken + if(check_timerange_pxe($newpxeday,$newpxebeg,$newpxeend,$nodeDN,"")){ + + $newpxetimerange = $newpxeday."_".$newpxebeg."_".$newpxeend; + $entrytr ['timerange'] = $newpxetimerange; + if($result = ldap_mod_add($ds,$pxeDN,$entrytr)){ + $mesg = "Zusätzliche TimeRange erfolgreich eingetragen<br><br>"; + }else{ + $mesg = "Fehler beim eintragen der zusätzlichen TimeRange!<br><br>"; + } + }else{ + $mesg = "Es existiert bereits ein PXE Boot Menü, das sich mit der eingegebenen Time Range + überschneidet!<br> + Bitte geben Sie eine andere Time Range ein.<br><br>"; + } + }else{ + $mesg = "Falsche Syntax in der Timerange-Eingabe!<br> + Bitte geben Sie die erneut Time Range ein.<br><br>"; + } +} + + +##################################### +# PXE Filename(s) + +$filemod = array(); +$modfi = 0; +$filedel = array(); +$delfi = 0; +$j = 0; + +if (count($file) != 0){ + +for ($i=0; $i<count($file); $i++){ + + if ( $oldfile[$i] == $file[$i] ){ + $filemod ['filename'][$i] = $oldfile[$i]; + # $mesg = "keine Aenderung<br>"; + } + + if ( $oldfile[$i] != "" && $file[$i] != "" && $oldfile[$i] != $file[$i] ){ + echo "PXE Dateinamen aendern<br> + Vorsicht dies kann eine nicht verwendbare PXE Datei zur Folge haben!<br><br>"; + # hier noch Syntaxcheck + $filemod ['filename'][$i] = $file[$i]; + $modfi = 1; + } + + if ( $oldfile[$i] != "" && $file[$i] == "" ){ + echo "PXE Dateinamen loeschen!<br> + Achtung: aus ihren PXE Daten wird keine PXE Datei mehr generiert.<br> + Sie sind solange nicht mehr für den PXE Bootvorgang verwendbar bis Sie einen neuen Dateinamen anlegen!<br><br>"; + $filemod ['filename'][$i] = $oldfile[$i]; + $filedel ['filename'][$j] = $oldfile[$i]; + $j++; + $delfi = 1; + $seconds = 4; + } +} +#erst ändern +if ($modfi == 1){ + echo "Ändern: "; print_r($filemod); echo "<br>"; + if(ldap_mod_replace($ds,$pxeDN,$filemod)){ + $mesg = "PXE Dateiname(n) erfolgreich geändert<br><br>"; + }else{ + $mesg = "Fehler beim ändern des(r) PXE Dateinamens!<br><br>"; + } + $modfi = 0; +} +# dann löschen +if ($delfi == 1){ + echo "Löschen: "; print_r($filedel); echo "<br>"; + if(ldap_mod_del($ds,$pxeDN,$filedel)){ + $mesg = "PXE Dateiname(n) erfolgreich gelöscht<br><br>"; + }else{ + $mesg = "Fehler beim löschen des PXE Dateinamens !<br><br>"; + } + $delfi = 0; +} + +} + +# PXE Dateiname neu anlegen +if ($newfilename == ""){ +} +if ($newfilename != ""){ + echo "PXE Dateiname hinzufügen"; + $fileadd ['filename'] = $newfilename; + if(ldap_mod_add($ds,$pxeDN,$fileadd)){ + $mesg = "PXE Dateiname <b>".$newfilename."</b> erfolgreich angelegt<br><br>"; + }else{ + $mesg = "Fehler beim anlegen des PXE Dateinamens ".$newfilename." !<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,$pxeDN,$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 "ändern<br>"; + foreach (array_keys($entrymod) as $key){ + $modatts .= "<b>".$key."</b>,"; + } + if(ldap_mod_replace($ds,$pxeDN,$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öschen<br>"; + foreach (array_keys($entrydel) as $key){ + $delatts .= "<b>".$key."</b>,"; + } + if(ldap_mod_del($ds,$pxeDN,$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ü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 diff --git a/ldap-site-mngmt/webinterface/rbs/pxe_copy.php b/ldap-site-mngmt/webinterface/rbs/pxe_copy.php new file mode 100644 index 00000000..92e6ba0b --- /dev/null +++ b/ldap-site-mngmt/webinterface/rbs/pxe_copy.php @@ -0,0 +1,189 @@ +<?php +include('../standard_header.inc.php'); + +$pxeDN = $_POST['pxedn']; +$pxecn = "PXE_".$_POST['pxecncp']; +$oldpxecn = "PXE_".$_POST['oldpxecncp']; + +$deltr = $_POST['deltr']; + +$oldpxeday = $_POST['oldpxedaycp']; $oldpxeday = htmlentities($oldpxeday); +$oldpxebeg = $_POST['oldpxebegcp']; $oldpxebeg = htmlentities($oldpxebeg); +$oldpxeend = $_POST['oldpxeendcp']; $oldpxeend = htmlentities($oldpxeend); + +$nodeDN = $_POST['nodedn']; +$mnr = $_POST['mnr']; +$sbmnr = $_POST['sbmnr']; +$mcnr = $_POST['mcnr']; + +$copytargets = $_POST['copytargets']; +#print_r($copytargets); echo "<br>"; +$n = array_keys($copytargets,'none'); +#print_r($n); echo "<br>"; +for ($i=0; $i<count($n); $i++){ + $match = array_search('none',$copytargets); + array_splice($copytargets, $match, 1); +} +#print_r($copytargets); echo "<br>"; + + +$seconds = 2; +$url = "pxe.php?dn=".$pxeDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr; + +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>"; + +if ( $pxecn != ""){ + + # Formulareingaben anpassen + $exppxe = explode(" ",$pxecn); + foreach ($exppxe as $word){$expuc[] = ucfirst($word);} + $pxecn = implode(" ",$expuc); + $pxecn = preg_replace ( '/\s+([0-9A-Z])/', '$1', $pxecn); + + $nomac = 0; + + if (count($copytargets) != 0){ + foreach ($copytargets as $targetDN){ + + $exptargetdn = ldap_explode_dn($targetDN, 1); + $targetcn = $exptargetdn[0]; + $targettype = $exptargetdn[1]; + + # falls Target keine MAC hat dann kann keine PXE angelegt werden + if ($targettype == "computers"){ + $macdata = get_node_data($targetDN, array("hwaddress")); + if ($macdata['hwaddress'] == ""){ + $nomac = 1; + echo "Für den Ziel-Rechner ist keine MAC Adresse eingetragen <br> + Das PXE Bootmenü wird nicht angelegt. <br> + <br> + Tragen Sie zuerst eine MAC ein!<br><br>"; + } + } + if ($targettype == "groups"){ + $members = get_node_data($targetDN, array("member")); + if (count($members) > 1){ + foreach ($members['member'] as $hostDN){ + $macdata = get_node_data($hostDN, array("hwaddress","hostname")); + if ($macdata['hwaddress'] == ""){ + $nomac = 1; + echo "Für den Gruppen-Rechner <b>".$macdata['hostname']."</b> ist keine MAC Adresse eingetragen <br> + Das PXE Bootmenü für die Gruppe wird nicht angelegt. <br> + <br> + Tragen Sie zuerst bei Rechner <b>".$macdata['hostname']."</b> eine MAC ein!<br><br>"; + } + } + } + if (count($members) == 1){ + $macdata = get_node_data($members['member'], array("hwaddress")); + if ($macdata['hwaddress'] == ""){ + $nomac = 1; + echo "Für den Gruppen-Rechner <b>".$macdata['hostname']."</b> ist keine MAC Adresse eingetragen <br> + Das PXE Bootmenü für die Gruppe wird nicht angelegt. <br> + <br> + Tragen Sie zuerst bei Rechner <b>".$macdata['hostname']."</b> eine MAC ein!<br><br>"; + } + } + } + + $brothers = get_pxeconfigs($targetDN,array("cn")); + $brother = 0; + foreach ($brothers as $item){ + if( $item['cn'] == $pxecn ){ + $mesg = "Es existiert bereits ein PXE Boot Menü mit dem eingegebenen Namen!<br> + Bitte geben Sie einen anderen Namen ein.<br><br>"; + $url = "pxe.php?dn=".$pxeDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr; + $brother = 1; + break; + } + } + if ($brother == 0 && $nomac == 0){ + + $exptargetdn = ldap_explode_dn($targetDN, 1); + $target = $exptargetdn[0]; + $targettype = $exptargetdn[1]; + + $oldpxetimerange = $oldpxeday."_".$oldpxebeg."_".$oldpxeend; + $newpxeDN = "cn=".$pxecn.",".$targetDN; + print_r($newpxeDN); echo "<br>"; + + if (dive_into_tree_cp($pxeDN,$newpxeDN)){ + + $delfileuri = 0; + # Filename anpassen + if ($targettype == "rbs"){ + $entrymod ['filename'] = "default"; + } + if ($targettype == "computers"){ + $macdata = get_node_data($targetDN, array("hwaddress")); + $entrymod ['filename'] = "01-".$macdata['hwaddress']; + $delfileuri = 1; + #$entrymod ['fileuri'] = "01-".$macdata['hwaddress'].".tgz"; + } + if ($targettype == "groups"){ + $members = get_node_data($targetDN, array("member")); + if (count($members) != 0){ + foreach ($members['member'] as $hostDN){ + $macdata = get_node_data($hostDN, array("hwaddress")); + $entrymod ['filename'][] = "01-".$macdata['hwaddress']; + $delfileuri = 1; + #$entrymod ['fileuri'] = $target.".tgz"; + } + } + } + if(ldap_mod_replace($ds,$newpxeDN,$entrymod)){ + if($deltr == 1){ + # Timeranges und FileURI im neuen Objekt löschen + $entrydel ['timerange'] = array(); + if ($delfileuri == 1){ + $entrydel ['fileuri'] = array(); + } + if ( ldap_mod_del($ds,$newpxeDN,$entrydel) ){ + $mesg .= "<br>PXE Boot Menü erfolgreich nach ".$target[1]." kopiert<br>"; + } + else{ + ldap_delete($ds,$newpxeDN); + $mesg .= "<br>Fehler beim kopieren des PXE Boot Menüs nach <b>".$target[1]."</b><br>"; + } + } + } + else{ + ldap_delete($ds,$newpxeDN); + $mesg .= "<br>Fehler beim kopieren des PXE Boot Menüs nach <b>".$target[1]."</b><br>"; + } + } + else{ + $mesg .= "<br>Fehler beim kopieren des PXE Boot Menüs nach <b>".$target[1]."</b><br>"; + } + } + } + } + else{ + $mesg .= "<br>Sie haben kein Ziel angegeben!<br>"; + } +} + +elseif ( $pxecn == ""){ + + $mesg = "Sie haben den Namen des neuen PXE Boot Menüs nicht angegeben. Dieser ist aber ein notwendiges Attribut.<br> + Bitte geben Sie ihn an.<br><br>"; + $url = "pxe.php?dn=".$pxeDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr; +} + + + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurü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 diff --git a/ldap-site-mngmt/webinterface/rbs/pxe_delete.php b/ldap-site-mngmt/webinterface/rbs/pxe_delete.php new file mode 100644 index 00000000..a1b7a060 --- /dev/null +++ b/ldap-site-mngmt/webinterface/rbs/pxe_delete.php @@ -0,0 +1,42 @@ +<?php +include('../standard_header.inc.php'); + +$pxeDN = $_POST['dn']; +$oldpxecn = $_POST['name']; + +$mnr = $_POST['mnr']; +$sbmnr = $_POST['sbmnr']; +$mcnr = $_POST['mcnr']; + +$seconds = 1; +$url = $_POST['successurl']; + +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>"; + +if ( $pxeDN != ""){ + + if ( dive_into_tree_del($pxeDN,"") ){ + $mesg = "PXE Boot Menü <b>".$pxecn."</b> erfolgreich gelöscht!<br><br>"; + } + else{ + $mesg = "Fehler beim löschen des PXE Boot Menüs <b>".$pxecn."</b> !<br><br>"; + } + +} + + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurü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 diff --git a/ldap-site-mngmt/webinterface/rbs/pxe_wochenplan.php b/ldap-site-mngmt/webinterface/rbs/pxe_wochenplan.php new file mode 100644 index 00000000..7cb4d394 --- /dev/null +++ b/ldap-site-mngmt/webinterface/rbs/pxe_wochenplan.php @@ -0,0 +1,154 @@ +<?php + +##################################### +# Wochenübersicht + +$template->assign(array("A0" => "","B0" => "","C0" => "","D0" => "","E0" => "","F0" => "","G0" => "", + "A1" => "","B1" => "","C1" => "","D1" => "","E1" => "","F1" => "","G1" => "", + "A2" => "","B2" => "","C2" => "","D2" => "","E2" => "","F2" => "","G2" => "", + "A3" => "","B3" => "","C3" => "","D3" => "","E3" => "","F3" => "","G3" => "", + "A4" => "","B4" => "","C4" => "","D4" => "","E4" => "","F4" => "","G4" => "", + "A5" => "","B5" => "","C5" => "","D5" => "","E5" => "","F5" => "","G5" => "", + "A6" => "","B6" => "","C6" => "","D6" => "","E6" => "","F6" => "","G6" => "", + "A7" => "","B7" => "","C7" => "","D7" => "","E7" => "","F7" => "","G7" => "", + "A8" => "","B8" => "","C8" => "","D8" => "","E8" => "","F8" => "","G8" => "", + "A9" => "","B9" => "","C9" => "","D9" => "","E9" => "","F9" => "","G9" => "", + "A10" => "","B10" => "","C10" => "","D10" => "","E10" => "","F10" => "","G10" => "", + "A11" => "","B11" => "","C11" => "","D11" => "","E11" => "","F11" => "","G11" => "", + "A12" => "","B12" => "","C12" => "","D12" => "","E12" => "","F12" => "","G12" => "", + "A13" => "","B13" => "","C13" => "","D13" => "","E13" => "","F13" => "","G13" => "", + "A14" => "","B14" => "","C14" => "","D14" => "","E14" => "","F14" => "","G14" => "", + "A15" => "","B15" => "","C15" => "","D15" => "","E15" => "","F15" => "","G15" => "", + "A16" => "","B16" => "","C16" => "","D16" => "","E16" => "","F16" => "","G16" => "", + "A17" => "","B17" => "","C17" => "","D17" => "","E17" => "","F17" => "","G17" => "", + "A18" => "","B18" => "","C18" => "","D18" => "","E18" => "","F18" => "","G18" => "", + "A19" => "","B19" => "","C19" => "","D19" => "","E19" => "","F19" => "","G19" => "", + "A20" => "","B20" => "","C20" => "","D20" => "","E20" => "","F20" => "","G20" => "", + "A21" => "","B21" => "","C21" => "","D21" => "","E21" => "","F21" => "","G21" => "", + "A22" => "","B22" => "","C22" => "","D22" => "","E22" => "","F22" => "","G22" => "", + "A23" => "","B23" => "","C23" => "","D23" => "","E23" => "","F23" => "","G23" => "")); + +#print_r($timeranges); echo "<br>"; + +# vom spezifischsten zum unspezifischsten : +# FR_0_7 -> FR_X_X -> X_0_7 -> X_X_X +$daytime = array(); +$timex = array(); +$dayx = array(); +$allx = array(); +$legend = array(); +if(count($timeranges) != 0){ +foreach ($timeranges as $tr){ + if (count($tr[0]) > 1){ + foreach ($tr as $item){ + if ($item[0] != "X" && $item[1] != "X" && $item[2] != "X" && ($item[0] == "MO" || $item[0] == "DI" || $item[0] == "MI" || $item[0] == "DO" || $item[0] == "FR" || $item[0] == "SA" || $item[0] == "SO")){ + $daytime[] = $item; + } + if ($item[0] != "X" && $item[1] == "X" && $item[2] == "X"){ + $timex[] = $item; + } + if ($item[0] == "X" && $item[1] != "X" && $item[2] != "X"){ + $dayx[] = $item; + } + if ($item[0] == "X" && $item[1] == "X" && $item[2] == "X"){ + $allx[] = $item; + } + } + }else{ + if ($tr[0] != "X" && $tr[1] != "X" && $tr[2] != "X" && ($tr[0] == "MO" || $tr[0] == "DI" || $tr[0] == "MI" || $tr[0] == "DO" || $tr[0] == "FR" || $tr[0] == "SA" || $tr[0] == "SO")){ + $daytime[] = $tr; + } + if ($tr[0] != "X" && $tr[1] == "X" && $tr[2] == "X"){ + $timex[] = $tr; + } + if ($tr[0] == "X" && $tr[1] != "X" && $tr[2] != "X"){ + $dayx[] = $tr; + } + if ($tr[0] == "X" && $tr[1] == "X" && $tr[2] == "X"){ + $allx[] = $tr; + } + } +} + +#print_r($daytime); echo "<br>"; +#print_r($timex); echo "<br>"; +#print_r($dayx); echo "<br>"; +#print_r($allx); echo "<br>"; + +$daycode = array("MO" => "A", "DI" => "B", "MI" => "C", "DO" => "D", "FR" => "E", "SA" => "F", "SO" => "G"); +$allxcolors = array("#BEBEBE","A0A0A0","#696969","#EEDFCC","#D8BFD8","#505050"); +$dayxcolors = array("#483D8B","#7B68EE","#191970","#8470FF","#708090","#6A5ACD"); +$timexcolors = array("#CDC673","#A2CD5A","#BDB76B","#8B864E","#6B8E23","#CDBE70"); +$daytimecolors = array("880000","#CD6839","#CC3300","#CC6600","#993300","#8B4C39"); + + +if (count($allx) != 0){ + $c = 0; + foreach ($allx as $range){ + foreach ($daycode as $dc){ + for ($i = 0; $i <= 23; $i++){ + $template->assign(array($dc.$i => "background-color:".$allxcolors[$c].";")); + } + } + $legend[] = array($range ,$allxcolors[$c]); + $c++; + } +} + +if (count($dayx) != 0){ + $c = 0; + foreach ($dayx as $range){ + foreach ($daycode as $dc){ + for ($i = $range[1]; $i<= $range[2]; $i++){ + $template->assign(array($dc.$i => "background-color:".$dayxcolors[$c].";")); + } + } + $legend[] = array($range ,$dayxcolors[$c]); + $c++; + } +} + +if (count($timex) != 0){ + $c = 0; + foreach ($timex as $range){ + $dc = $daycode[$range[0]]; + for ($i = 0; $i<= 23; $i++){ + $template->assign(array($dc.$i => "background-color:".$timexcolors[$c].";")); + } + $legend[] = array($range ,$timexcolors[$c]); + $c++; + } +} + +if (count($daytime) != 0){ + $c = 0; + foreach ($daytime as $range){ + $dc = $daycode[$range[0]]; + for ($i = $range[1]; $i<= $range[2]; $i++){ + $template->assign(array($dc.$i => "background-color:".$daytimecolors[$c].";")); + } + $legend[] = array($range ,$daytimecolors[$c]); + $c++; + } +} + +} + +$template->assign(array("DESCRIPTION" => "")); +#print_r($legend); +if (count($legend) != 0){ + $template->define_dynamic("Legende", "Webseite"); + foreach ($legend as $item){ + # Timerange Komponente + $color = $item[1]; + $template->assign(array("TR1" => $item[0][0], + "TR2" => $item[0][1], + "TR3" => $item[0][2], + "CN" => $item[0][3], + "COLOR" => $color)); + $template->parse("LEGENDE_LIST", ".Legende"); + } +} + + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/rbs/pxeconfig_default.dwt b/ldap-site-mngmt/webinterface/rbs/pxeconfig_default.dwt new file mode 100644 index 00000000..bb630723 --- /dev/null +++ b/ldap-site-mngmt/webinterface/rbs/pxeconfig_default.dwt @@ -0,0 +1,323 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='2'><h3>Default PXE Boot Menüs <code class='font_object'> {AU} </code> </h3></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + <tr> + <td width='40%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>PXE Boot Menü</b></td> + <td width='60%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Gültigkeitsdauer (Time Range)</b></td> + </tr> + + + + <!-- BEGIN DYNAMIC BLOCK: Pxeconf --> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>{PXECN} </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>{TRANGES} </td> + </tr> + <!-- END DYNAMIC BLOCK: Pxeconf --> + + </table></td> + </tr> + <tr> + <td height='50'></td> + </tr> + + <tr> + <td colspan='2'><h4>Wochen Übersicht:</h4></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr><td> + <table cellpadding='0' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + <tr align='center'> + <td width='9%' style='border-color: black; border-style: solid; border-width: 2 0 2 2;'><b>Uhrzeit</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 0 2 1;'><b>Montag</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 0 2 1;'><b>Dienstag</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 0 2 1;'><b>Mittwoch</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 0 2 1;'><b>Donnerstag</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 0 2 1;'><b>Freitag</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 0 2 1;'><b>Samstag</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 2 2 1;'><b>Sonntag</b></td> + </tr> + <tr heigth='2' align='center'> + <td width='9%' style='border-color: black; border-style: solid; border-width: 0 0 0 2;'>0</td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A0}'> </td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B0}'> </td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C0}'> </td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D0}'> </td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E0}'> </td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F0}'> </td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G0}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A1}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B1}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C1}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D1}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E1}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F1}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G1}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>2</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A2}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B2}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C2}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D2}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E2}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F2}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G2}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A3}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B3}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C3}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D3}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E3}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F3}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G3}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>4</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A4}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B4}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C4}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D4}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E4}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F4}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G4}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A5}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B5}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C5}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D5}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E5}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F5}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G5}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>6</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A6}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B6}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C6}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D6}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E6}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F6}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G6}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A7}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B7}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C7}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D7}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E7}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F7}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G7}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>8</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A8}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B8}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C8}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D8}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E8}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F8}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G8}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A9}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B9}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C9}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D9}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E9}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F9}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G9}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>10</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A10}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B10}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C10}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D10}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E10}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F10}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G10}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A11}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B11}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C11}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D11}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E11}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F11}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G11}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>12</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A12}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B12}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C12}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D12}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E12}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F12}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G12}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A13}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B13}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C13}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D13}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E13}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F13}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G13}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>14</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A14}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B14}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C14}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D14}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E14}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F14}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G14}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A15}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B15}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C15}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D15}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E15}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F15}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G15}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>16</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A16}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B16}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C16}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D16}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E16}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F16}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G16}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A17}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B17}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C17}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D17}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E17}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F17}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G17}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>18</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A18}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B18}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C18}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D18}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E18}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F18}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G18}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A19}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B19}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C19}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D19}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E19}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F19}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G19}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>20</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A20}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B20}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C20}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D20}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E20}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F20}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G20}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A21}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B21}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C21}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D21}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E21}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F21}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G21}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>22</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A22}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B22}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C22}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D22}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E22}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F22}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G22}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 1;{A23}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 1;{B23}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 1;{C23}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 1;{D23}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 1;{E23}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 1;{F23}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 2 1;{G23}'> </td> + </tr> + + </table></td> + </tr> + + <tr> + <td height='10'></td> + </tr> + <tr> + <td colspan='2'><h4>Legende:</h4></td> + </tr> + <tr><td> + <table cellpadding='3' cellspacing='3' border='1' align='left' width='50%' style='border-width: 0 0 0 0;'> + <tr> + <td width='65%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'><b>PXE Boot Menü</b></td> + <td width='5%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> </td> + <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'><b>Farbe</b></td> + </tr> + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'>Keine PXE Definition </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 1 1 1;'> </td> + </tr> + + <!-- BEGIN DYNAMIC BLOCK: Legende --> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'>{CN} </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 1 1 1;background-color:{COLOR};'> </td> + </tr> + <!-- END DYNAMIC BLOCK: Legende --> + + </table></td> + </tr> + +</table> diff --git a/ldap-site-mngmt/webinterface/rbs/pxeconfig_default.php b/ldap-site-mngmt/webinterface/rbs/pxeconfig_default.php new file mode 100644 index 00000000..f9a2b7db --- /dev/null +++ b/ldap-site-mngmt/webinterface/rbs/pxeconfig_default.php @@ -0,0 +1,77 @@ +<?php + +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "Remote Boot Service Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 4; +$mnr = 3; +$sbmnr = -1; +$mcnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "pxeconfig_default.dwt"; + +include("../class.FastTemplate.php"); + +include('rbs_header.inc.php'); + +################################################################################### + +$mnr = $_GET['mnr']; + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createRBSMenu($rollen, $mnr, $auDN, $sbmnr); + +################################################################################### + +$template->assign(array("PXEDN" => "", + "PXECN" => "Noch kein Default PXE Boot Menü angelegt", + "TRANGES" => "", + "RBS" => "", + "CN" => "")); + +# rbservice und pxe daten (voerst nur ein rbs) +$rbs_array = get_rbservices($auDN,array("dn","cn")); +$rbsDN = $rbs_array[0]['dn']; +$pxe_array = get_pxeconfigs($rbsDN,array("dn","cn","timerange","rbservicedn")); +# print_r($pxe_array); + +$template->define_dynamic("Pxeconf", "Webseite"); + +for ($i=0; $i<count($pxe_array); $i++){ + # Timerange Komponenten + $trange = ""; + if (count($pxe_array[$i]['timerange']) > 1 ){ + foreach ($pxe_array[$i]['timerange'] as $tr){ + $exptime = array_merge(explode('_',$tr),$pxe_array[$i]['cn']); + $timeranges[$i][] = $exptime; # Für grafische Wo-Ansicht + if ($exptime[0] == "X"){$exptime[0]="täglich";} + # if ($exptime[1] == "X" && $exptime[2] == "X"){$exptime[1] = ""; $exptime[2]= "";} + $trange .= $exptime[0].", von ".$exptime[1].":00 bis ".$exptime[2].":59 / "; + } + }else{ + $exptime = array_merge(explode('_',$pxe_array[$i]['timerange']), $pxe_array[$i]['cn']); + $timeranges[$i] = $exptime; # Für grafische Wo-Ansicht + if ($exptime[0] == "X"){$exptime[0]="täglich";} + # if ($exptime[1] == "X" && $exptime[2] == "X"){$exptime[1] = ""; $exptime[2]= "";} + $trange .= $exptime[0].", von ".$exptime[1].":00 bis ".$exptime[2].":59"; + } + + $template->assign(array("PXEDN" => $pxe_array[$i]['dn'], + "PXECN" => $pxe_array[$i]['cn'], + "TRANGES" => $trange, + "RBS" => $pxe_array[$i]['rbservicedn'], + "AUDN" => $auDN)); + $template->parse("PXECONF_LIST", ".Pxeconf"); +} + +include("pxe_wochenplan.php"); + + +################################################################################### + +include("rbs_footer.inc.php"); + +?> diff --git a/ldap-site-mngmt/webinterface/rbs/rbs.dwt b/ldap-site-mngmt/webinterface/rbs/rbs.dwt new file mode 100644 index 00000000..ec6d0cbc --- /dev/null +++ b/ldap-site-mngmt/webinterface/rbs/rbs.dwt @@ -0,0 +1,79 @@ +<html> + +<head> + <title>{SEITENTITEL}</title> + <link rel='stylesheet' href='../styles.css' type='text/css'></head> +<body> + +<table cellpadding='0' cellspacing='0' border='0' width='95%' height='8%'> + <tr> + <td width='35%'> + <table cellpadding='5' cellspacing='0' border='0' width='100%'> + <tr valign='top'> + <td width='1'></td> + <td><h2>Rechner und IP Management</h2></td> + </tr> + </table> + </td> + + <td width='40%'> + <table cellpadding='5' cellspacing='0' border='0' width='100%'> + <tr valign='top' align='left'> + <td> + <h4><a href='../start.php' class='headerlink'>Startseite</a> + >> <a href='../au/au.php' class='headerlink'>{AU}</a> [ {DOMAIN} ]</h4> + </td> + </tr> + </table> + </td> + <td width='25%'> + <table cellpadding='5' cellspacing='0' border='0' width='100%' align='right'> + <tr valign='top' align='right'> + <td> + {LOGIN} + </td> + </tr> + </table> + </td> + </tr> +</table> + +<table cellpadding='5' cellspacing='0' border='0' width='95%' height='7%'> +<tr> + <td>{MAINMENU}</td> +</tr> +</table> + +<hr align='center' width='98%' noshade> + + + +<table cellpadding='5' cellspacing='0' border='0' width='100%' height='85%'> + + <tr valign='top' height='100%'> + <td width='28%'> + <table cellpadding='5' cellspacing='0' border='0' width='100%'> + <tr><td> + + {NAVIGATION} + + </td></tr> + </table> + </td> + + <td width='72%'> + <table cellpadding='5' cellspacing='0' border='0' width='100%'> + <tr><td> + + {HAUPTFENSTER} + + </td></tr> + </table> + </td> + + </tr> +</table> + +</body> + +</html> diff --git a/ldap-site-mngmt/webinterface/rbs/rbs.php b/ldap-site-mngmt/webinterface/rbs/rbs.php new file mode 100644 index 00000000..3460afa0 --- /dev/null +++ b/ldap-site-mngmt/webinterface/rbs/rbs.php @@ -0,0 +1,30 @@ +<?php +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "Remote Boot Service Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 4; +$mnr = -1; +$sbmnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "rbs_start.dwt"; + +include("../class.FastTemplate.php"); + +include('rbs_header.inc.php'); + +################################################################################### + +$mnr = $_GET['mnr']; +$sbmnr = $_GET['sbmnr']; + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createRBSMenu($rollen, $mnr, $auDN, $sbmnr); + +################################################################################### + +include("rbs_footer.inc.php"); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/rbs/rbs_footer.inc.php b/ldap-site-mngmt/webinterface/rbs/rbs_footer.inc.php new file mode 100644 index 00000000..311721c5 --- /dev/null +++ b/ldap-site-mngmt/webinterface/rbs/rbs_footer.inc.php @@ -0,0 +1,18 @@ +<?php + +$template->assign(array("PFAD" => $START_PATH)); + +# Daten in die Vorlage parsen +$template->parse("LOGIN", "Login"); +$template->parse("MAINMENU", "Mmenu"); +$template->parse("NAVIGATION", "Menu"); +$template->parse("HAUPTFENSTER", "Webseite"); +$template->parse("PAGE", "Vorlage"); + +# Fertige Seite an den Browser senden +$template->FastPrint("PAGE"); + +# Abmelden vom LDAP +ldap_unbind($ds); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/rbs/rbs_header.inc.php b/ldap-site-mngmt/webinterface/rbs/rbs_header.inc.php new file mode 100644 index 00000000..fb7e0751 --- /dev/null +++ b/ldap-site-mngmt/webinterface/rbs/rbs_header.inc.php @@ -0,0 +1,21 @@ +<?php +include("rbs_menu.php"); + +$template = new FastTemplate("."); + +# dem erstellten Template-Objekt eine Vorlage zuweisen +$definedTemplates = array("Vorlage" => "rbs.dwt", + "Login" => "../logout_form.inc.dwt", + "Mmenu" => "../hauptmenue.dwt", + "Menu" => "menu.dwt", + "Webseite" => $webseite); +if (isset($additionalTemplates)) { + foreach ($additionalTemplates as $templateKey => $templateFile) { + $definedTemplates[$templateKey] = $templateFile; + } +} +$template->define($definedTemplates); + +$template->assign(array("SEITENTITEL" => $titel, "ROLLE" => "mainadmin", "AU" => $au_ou, "DOMAIN" => $assocdom, "USERCN" => $usercn)); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/rbs/rbs_menu.php b/ldap-site-mngmt/webinterface/rbs/rbs_menu.php new file mode 100644 index 00000000..76a786c2 --- /dev/null +++ b/ldap-site-mngmt/webinterface/rbs/rbs_menu.php @@ -0,0 +1,215 @@ +<?php + +function createRBSMenu($rollen, $mnr, $auDN, $sbmnr) { + global $template; + global $START_PATH; + + # rbservices (momentan nur für einen RBS konzipiert) + $rbs_array = get_rbservices($auDN,array("dn","cn")); + if (count($rbs_array) == 0){ + $rbslink = "new_rbservice.php?mnr=1"; + $gbmlink = "no_rbservice.php?mnr=2"; + $pxelink = "no_rbservice.php?mnr=3"; + } + else { + $rbslink = "rbservice.php?mnr=1"; + $gbmlink = "gbm_overview.php?mnr=2"; + $pxelink = "pxeconfig_default.php?mnr=3"; + } + $rbsDN = $rbs_array[0]['dn']; + + # Struktur der Registerkartenleiste + $hauptmenu = array(array("link" => "rbs.php?mnr=0", + "text" => "Übersicht", + "zugriff" => "alle"), + array("link" => $rbslink, + "text" => "Remote Boot Service", + "zugriff" => array("MainAdmin","HostAdmin")), + array("link" => $gbmlink, + "text" => "Generische Bootmenüs", + "zugriff" => array("MainAdmin","HostAdmin")), + array("link" => $pxelink, + "text" => "Default PXE", + "zugriff" => array("MainAdmin","HostAdmin"))); + #print_r($hauptmenu); + + # Generische Bootmenüs + $gbm = array(); + if (count($rbs_array) != 0){ + $generic_bms = get_menuentries($rbsDN, array("dn","cn")); + for ($g=0;$g<count($generic_bms);$g++){ + $gbm[] = array("link" => "gbm.php?dn=".$generic_bms[$g]['dn']."&mnr=2&sbmnr=".$g, + "text" => $generic_bms[$g]['cn'], + "zugriff" => array("MainAdmin","HostAdmin")); + } + $gbm [] = array("link" => "new_gbm.php?mnr=2&sbmnr=".$g, + "text" => "Neues Generisches BM", + "zugriff" => array("MainAdmin","HostAdmin")); + } + + # default pxe-configs + $pxe = array(); + if (count($rbs_array) != 0){ + $pxe_array = get_pxeconfigs($rbsDN,array("dn","cn","timerange")); + for($n=0;$n<count($pxe_array);$n++){ + $pxe [] = array("link" => "pxe.php?dn=".$pxe_array[$n]['dn']."&mnr=3&sbmnr=".$n, + "text" => $pxe_array[$n]['cn'], + "zugriff" => array("MainAdmin","HostAdmin")); + } + $pxe [] = array("link" => "new_pxe.php?mnr=3&sbmnr=".$n, + "text" => "Neues Default PXE", + "zugriff" => array("MainAdmin","HostAdmin")); + } + $submenu = array(array(), + array(), + $gbm, + $pxe); + + #$rollen = array_keys($roles); + + # Zusammenstellen der Menuleiste + $template->define_dynamic("Hauptmenu", "Menu"); + $template->define_dynamic("Submenu", "Menu"); + $i=0; + $maxmenu = count($hauptmenu); + + foreach($hauptmenu as $item) { + $template->clear_parse("SUBMENU_LIST"); + + if($item['zugriff'] === "alle" || vergleicheArrays($rollen , $item['zugriff'])) { + + $subempty = 0; + $j=0; + $maxsub = count($submenu[$mnr]); + if($maxsub > 0){ + foreach($submenu[$mnr] as $item2) { + + if($item2['zugriff'] === "alle" || vergleicheArrays($rollen, $item2['zugriff'])) { + if($i != $mnr){ + $template->assign(array("SUB" => "")); + # "LINK_S" => "", + # "TEXT_S" => "")); + $template->parse("SUBMENU_LIST", ".Submenu"); + $template->clear_dynamic("Submenu"); + } + else{ + if ($j==0) { + if ($sbmnr==0) { + if($maxsub == 1){$zwisch="branchbottom2";} + else {$zwisch="branch2";} + $lastaktive=true; + $farb="#505050"; + } + else{ + if($maxsub == 1){$zwisch="branchbottom2";} + else {$zwisch="branch2";} + $farb="#A0A0A0"; + $lastaktive=false; + } + } + else { + if ($sbmnr==$j) { + if($maxsub == $j+1){$zwisch="branchbottom2";} + else {$zwisch="branch2";} + $lastaktive=true; + $farb="#505050"; + } + else { + $farb="#A0A0A0"; + if($maxsub == $j+1){$zwisch="branchbottom2";} + else {$zwisch="branch2";} + # if ($lastaktive) {$zwisch="branch";} + # else {$zwisch="branch";} + $lastaktive=false; + } + } + $htmlcode= " + <tr height='4'> + <td></td><td align='right'><img src='../pics/line2.gif' height='4'></td><td></td><td></td> + </tr> + <tr> + <td width='8%'> </td> + <td width='8%' align='right'><img src='../pics/".$zwisch.".gif'></td>
+ <td width='74%' align='left' style='border-width:1 1 1 1;border-color:#000000;border-style:solid;padding:2;padding-left:30px;background-color:{FARBE_S}'> + <a href='".$item2['link']."' style='text-decoration:none'><b class='standard_schrift'>".$item2['text']."</b></a></td> + <td width='10%'> </td> + </tr> + "; + $template->assign(array("SUB" => $htmlcode)); + $template->assign(array("FARBE_S" => $farb)); + $template->parse("SUBMENU_LIST", ".Submenu"); + $template->clear_dynamic("Submenu"); + } + } + else { + $subempty++; + } + $j=$j+1; + } + } + if($subempty == count($submenu[$mnr])) { + $template->assign(array("SUB" => "")); + # "LINK_S" => "", + # "TEXT_S" => "")); + $template->parse("SUBMENU_LIST", ".Submenu"); + $template->clear_dynamic("Submenu"); + } + if ($i==0) { + if ($mnr==0) { + if(count($submenu[$i][0]) != 0){ + if($maxmenu == 1){$zwisch="";} # {$zwisch="<img style='border-width:0;border-style=none;' src='../pics/minus2.gif'>";} + else {$zwisch="";} + }else{$zwisch="";} + $lastaktive=true; + $farb="#505050"; + } + else{ + if(count($submenu[$i][0]) != 0){ + if($maxmenu == 1){$zwisch="<a href='{LINK_M}' style='border-style=none;text-decoration:none'> + <img style='border-width:0;border-style=none;' src='../pics/plus2.gif'></a>";} + else {$zwisch="<a href='{LINK_M}' style='border-style=none;text-decoration:none'> + <img style='border-width:0;border-style=none;' src='../pics/plus2.gif'></a>";} + }else{$zwisch="";} + $farb="#A0A0A0"; + $lastaktive=false; + } + } + else { + if ($mnr==$i) { + if(count($submenu[$mnr][0]) != 0){ + if($maxmenu == $i+1){$zwisch="";} + else {$zwisch="";} + }else{$zwisch="";} + $lastaktive=true; + $farb="#505050"; + } + else { + $farb="#A0A0A0"; + if(count($submenu[$i][0]) != 0){ + if($maxmenu == $i+1){$zwisch="<a href='{LINK_M}' style='border-style=none;text-decoration:none'> + <img style='border-width:0;border-style=none;' src='../pics/plus2.gif'></a>";} + else {$zwisch="<a href='{LINK_M}' style='border-style=none;text-decoration:none'> + <img style='border-width:0;border-style=none;' src='../pics/plus2.gif'></a>";} + }else{$zwisch="";} + #if ($lastaktive) {$zwisch="";} + #else {$zwisch="";} + $lastaktive=false; + } + } + $template->assign(array("ICON" => $zwisch, + "FARBE" => $farb, + "LINK_M" => $item["link"], + "TEXT_M" => $item["text"])); + $template->parse("HAUPTMENU_LIST", ".Hauptmenu"); + $template->clear_dynamic("Hauptmenu"); + } + $i=$i+1; + } + if ($lastaktive) {$template->assign(array("ENDE" => ""));} + else{ + $template->assign(array("ENDE" => "")); + } + +} + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/rbs/rbs_start.dwt b/ldap-site-mngmt/webinterface/rbs/rbs_start.dwt new file mode 100644 index 00000000..3436b4ee --- /dev/null +++ b/ldap-site-mngmt/webinterface/rbs/rbs_start.dwt @@ -0,0 +1,41 @@ +<table border='0' cellpadding='5' cellspacing='0' width='90%'> + <tr> + <td colspan='2'><h3>Modul - Remote Boot Services (PXE) Management: </h3></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr> + <td> + <p>Dieses Modul dient der Verwaltung ihres <b>Remote Boot Services (RBS)</b><br> + Benutzen Sie die Navigation links, um die einzelnen Verwaltungsbereiche anzusteuern:</p> + <ul> + <li><p><b>Remote Boot Service</b></p> + Allgemeine Einstellungen Ihres Remote Boot Service.<br> + Falls Sie noch keinen RBS angelegt haben, können Sie dies hier tun. <br> + Daneben können Sie hier ihr RBS Bootserver-System (TFTP-, NFS-, NBD-Server) verwalten. + </li> + <li><p><b>Generische Boot Menüs</b></p> + Generische Boot Menues die Sie Nutzern ihres RBS anbieten wollen.<br> + Hier verwalten Sie Generische Boot Menues (GBM) oder legen neue an.<br><br> + GBMs enthalten alle Komponenten eines PXE Bootmenüs, welche + auf ihrem Bootserver-System gespeichert und von Ihnen verwaltet werden, d.h. + Kernel-Images, Initial-Ramdisks (initrd), usw. Diese sind unabhängig + von den PXE-Parametern, die das eigentliche Aussehen eines PXE Bootmenüs bestimmen, + wie z.B. Menu-Zeilen, oder PXE Parametern welche zur Bootclient Konfiguration verwendet + werden.<br> + Nutzer ihres RBS können aus diesen GBMs dann ihre individuellen PXE Boot + Menüs zusammenstellen. + + </li> + <li><p><b>Default PXE</b></p> + Default PXE Boot Konfigurationen, fuer die bootende Rechner ohne spezifische + PXEs.<br> + Hier können Sie Default PXEs anlegen und verwalten. + </li> + </ul> + + </td> + </tr> + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/rbs/rbservice.dwt b/ldap-site-mngmt/webinterface/rbs/rbservice.dwt new file mode 100644 index 00000000..c2af43fb --- /dev/null +++ b/ldap-site-mngmt/webinterface/rbs/rbservice.dwt @@ -0,0 +1,228 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='2'><h3>Remote Boot Service <code class='font_object'> {RBSCN} </code> </h3></td> + </tr> + <tr> + <td height='20'></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <form action='rbservice_change.php' method='post'> + + <tr> + <td width='40%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='60%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Eindeutiger RBS Name (cn):</b><br>(Teil des dn, ohne Leerzeichen eingeben) </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <font size='+2'><b>RBS_</b></font><input type='Text' name='rbscn' value='{RBSCN}' size='40' class='medium_form_field'> + <input type='hidden' name='oldrbscn' value='{RBSCN}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'><b>Dienst kann momentan genutzt werden von:</b><br></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'>Abteilung<b> {RBSOFFERNOW}</b> (und allen Unterabteilungen) + </td> + </tr> + <tr height='50' valign='top'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Ändern:</b><br>(Wählen Sie eine andere Abteilung)</td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <select name='rbsoffer' size='5' class='medium_form_selectbox'> + <option selected value='none'>----------</option> + + <!-- BEGIN DYNAMIC BLOCK: Rbsoffers --> + <option value='{RBSOFFER}'>{RBSOFFEROU}</option> + <!-- END DYNAMIC BLOCK: Rbsoffers --> + + <option value='off'>------ ABSCHALTEN ------</option> + + </select> + <input type='hidden' name='oldrbsoffer' value='{RBSOFFERNOWDN}'> + </td> + </tr> + + </table></td> + </tr> + <tr> + <td height='40'></td> + </tr> + <tr> + <td colspan='2'><h4>Boot Server System:</h4></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <tr valign='top'> + <td width='20%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Server</b></td> + <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>IP Adresse<br>(Rechner ändern)</b></td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Server Pfade</b></td> + </tr> + + <tr valign='top'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'><b>TFTP Server: </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + <input type='Text' name='tftpserverip' value='{TFTPIP}' size='15' class='medium_form_field'> + <input type='hidden' name='oldtftpserverip' value='{TFTPIP}'></td> + <td width='15%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'>Init Boot File</td> + <td width='35%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + <input type='Text' name='attribs[initbootfile]' value='{INITBOOTFILE}' size='25' class='medium_form_field'> + <input type='hidden' name='oldattribs[initbootfile]' value='{INITBOOTFILE}'></td> + </tr> + <tr valign='top'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'><font size='+1'>{TFTP}</font></td> + <td rowspan='3' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <select name='tftpserver' size='4' class='small_form_selectbox'> + <option selected value='none'>----------------------------</option> + <!-- BEGIN DYNAMIC BLOCK: TftpHosts --> + <option value='{HDN}'>{HN}</option> + <!-- END DYNAMIC BLOCK: TftpHosts --> + </select></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'>PXE Path</td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + <input type='Text' name='attribs[tftppxepath]' value='{TFTPPXE}' size='25' class='medium_form_field'> + <input type='hidden' name='oldattribs[tftppxepath]' value='{TFTPPXE}'></td> + </tr> + <tr valign='top'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'>Kernel Path</td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + <input type='Text' name='attribs[tftpkernelpath]' value='{TFTPKERNEL}' size='25' class='medium_form_field'> + <input type='hidden' name='oldattribs[tftpkernelpath]' value='{TFTPKERNEL}'></td> + </tr> + <tr valign='top'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>Clientconf Path</td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[tftpclientconfpath]' value='{TFTPCLIENTCONF}' size='25' class='medium_form_field'> + <input type='hidden' name='oldattribs[tftpclientconfpath]' value='{TFTPCLIENTCONF}'></td> + <input type='hidden' name='oldtftpserverdn' value='{TFTPDN}'> + </tr> + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'><b>NFS Server: </b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + <input type='Text' name='nfsserverip' value='{NFSIP}' size='15' class='medium_form_field'> + <input type='hidden' name='oldnfsserverip' value='{NFSIP}'></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'>Export Path</td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + <input type='Text' name='attribs[exportpath]' value='{NFSPATH}' size='25' class='medium_form_field'> + <input type='hidden' name='oldattribs[exportpath]' value='{NFSPATH}'></td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><font size='+1'>{NFS}</font> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <select name='nfsserver' size='4' class='small_form_selectbox'> + <option selected value='none'>----------------------------</option> + <!-- BEGIN DYNAMIC BLOCK: NfsHosts --> + <option value='{HDN}'>{HN}</option> + <!-- END DYNAMIC BLOCK: NfsHosts --> + </select> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> </td> + <input type='hidden' name='oldnfsserverdn' value='{NFSDN}'> + </tr> + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'><b>NBD Server: </b></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + <input type='Text' name='nbdserverip' value='{NBDIP}' size='15' class='medium_form_field'> + <input type='hidden' name='oldnbdserverip' value='{NBDIP}'></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><font size='+1'>{NBD}</font> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <select name='nbdserver' size='4' class='small_form_selectbox'> + <option selected value='none'>----------------------------</option> + <!-- BEGIN DYNAMIC BLOCK: NbdHosts --> + <option value='{HDN}'>{HN}</option> + <!-- END DYNAMIC BLOCK: NbdHosts --> + </select></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> </td> + <input type='hidden' name='oldnbdserverdn' value='{NBDDN}'> + </tr> + + <input type='hidden' name='rbsdn' value='{RBSDN}'> + <input type='hidden' name='mnr' value='{MNR}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + + </table></td> + </tr> + <tr> + <td><input type='Submit' name='apply' value='anwenden' class='small_loginform_button'> + </form></td> + </tr> + + + <tr> + <td height='50'></td> + </tr> + <tr> + <td colspan='2'><h3>Config File für PXE Generator Script</h3></td> + </tr> + <tr> + <td colspan='2'>Speichern Sie dieses als <b>pxegen.conf.pl</b> im gleichen Verzeichnis wie ihr PXE Generator Skript <b>pxe_generator.pl</b></td> + </tr> + <tr> + <td> + <table cellpadding='20' cellspacing='0' border='0' align='left' width='80%' style='border-color: black; border-style: solid; border-width: 2 2 2 2;'> + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + $ldaphost= "{PXEGENLDAP}"; <br> + $basedn= "{PXEGENBASE}"; <br> + $userdn= "{PXEGENUDN}"; <br> + $passwd= "{PXEGENPW}"; <br> + $rbsdn= "{PXEGENRBS}"; + </td> + </tr> + + + </table></td> + </tr> + + + + <tr> + <td height='60'></td> + </tr> + + <tr> + <td colspan='2'><h4>Remote Boot Service <code class='font_object'>{RBSCN}</code> löschen:</h4></td> + </tr> + <tr> + <td> + <table cellpadding='7' cellspacing='0' border='0' align='left' width='90%' style='border-width: 0 0 0 0;'> + <form action='delete_confirm.php' method='post'> + + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + Der Remote Boot Dienst wird komplett gelöscht, <br> + d.h. inklusive aller angelegten Generischen PXE Bootmenüs und Default PXEs. + </tr> + + <input type='hidden' name='dn' value='{RBSDN}'> + <input type='hidden' name='name' value='{RBSCN}'> + <input type='hidden' name='type' value='rbs'> + <input type='hidden' name='delurl' value='rbservice_delete.php'> + <input type='hidden' name='backurl' value='rbservice.php?dn={RBSDN}&mnr={MNR}'> + + </table></td> + </tr> + <tr> + <td> + <input type='Submit' name='apply' value='löschen' class='small_loginform_button'> + </form></td> + </tr> + + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/rbs/rbservice.php b/ldap-site-mngmt/webinterface/rbs/rbservice.php new file mode 100644 index 00000000..73dde633 --- /dev/null +++ b/ldap-site-mngmt/webinterface/rbs/rbservice.php @@ -0,0 +1,148 @@ +<?php +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "Remote Boot Service Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 4; +$mnr = 0; +$sbmnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "rbservice.dwt"; + +include("../class.FastTemplate.php"); + +include('rbs_header.inc.php'); + +################################################################################### + +$mnr = $_GET['mnr']; + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createRBSMenu($rollen, $mnr, $auDN, $sbmnr); + +################################################################################### + +$template->assign(array("RBSDN" => "", + "CN" => "", + "TFTP" => "", + "TFTPIP" => "", + "INITBOOTFILE" => "", + "TFTPKERNEL" => "", + "TFTPPXE" => "", + "TFTPCLIENTCONF" => "", + "NFS" => "", + "NFSIP" => "", + "NFSPATH" => "", + "NBD" => "", + "NBDIP" => "", + "RBSOFFERNOWDN" => "", + "RBSOFFERNOW" => "", + "HDN" => "", + "HN" => "", + "IP" => "")); + +# RBS Daten +$rbs_array = get_rbservices($auDN,array("dn","cn")); +$rbsDN = $rbs_array[0]['dn']; +$attributes = array("dn","cn","rbsofferdn","tftpserverip","tftpkernelpath","tftpclientconfpath","tftppxepath", + "nfsserverip","exportpath","nbdserverip","initbootfile"); +$rbs_data = get_node_data($rbsDN, $attributes); + +# RBS Anbieten +# momentanes Offer +$offerexp = ldap_explode_dn($rbs_data['rbsofferdn'], 1); +$rbsoffernow = $offerexp[0]; +# alternative Offers +$expdn = ldap_explode_dn($auDN, 0); # Mit Merkmalen +$expdn = array_slice($expdn, 1); +$expou = ldap_explode_dn($auDN, 1); # nur Werte +$expou = array_slice($expou, 1, -3); +#print_r($expou); echo "<br>"; +#print_r($expdn); echo "<br>"; +for ($i=0; $i<count($expou); $i++){ + $rbsoffers[$i]['ou'] = $expou[$i]; + $rbsoffers[$i]['dn'] = implode(',',$expdn); + $expdn = array_slice($expdn, 1); +} +#print_r($rbsoffers); + +$expcn = explode('_',$rbs_data['cn']); +$name = array_slice($expcn,1); +$rbscn = implode('_',$name); + +# Server Hostnamen holen +$tftpserver = get_hostname_from_ip($rbs_data['tftpserverip'],$auDN); +$nfsserver = get_hostname_from_ip($rbs_data['nfsserverip'],$auDN); +$nbdserver = get_hostname_from_ip($rbs_data['nbdserverip'],$auDN); + +$template->assign(array("RBSDN" => $rbs_data['dn'], + "RBSCN" => $rbscn, + "TFTP" => $tftpserver['hostname'], + "TFTPDN" => $tftpserver['dn'], + "TFTPIP" => $rbs_data['tftpserverip'], + "INITBOOTFILE" => $rbs_data['initbootfile'], + "TFTPKERNEL" => $rbs_data['tftpkernelpath'], + "TFTPPXE" => $rbs_data['tftppxepath'], + "TFTPCLIENTCONF" => $rbs_data['tftpclientconfpath'], + "NFS" => $nfsserver['hostname'], + "NFSDN" => $nfsserver['dn'], + "NFSIP" => $rbs_data['nfsserverip'], + "NFSPATH" => $rbs_data['exportpath'], + "NBD" => $nbdserver['hostname'], + "NBDDN" => $nbdserver['dn'], + "NBDIP" => $rbs_data['nbdserverip'], + "RBSOFFERNOWDN" => $rbs_data['rbsofferdn'], + "RBSOFFERNOW" => $rbsoffernow, + "MNR" => $mnr, + "SBMNR" => $sbmnr)); + +$template->define_dynamic("Rbsoffers", "Webseite"); +foreach ($rbsoffers as $offer){ + $template->assign(array("RBSOFFER" => $offer['dn'], + "RBSOFFEROU" => $offer['ou'],)); + $template->parse("RBSOFFERS_LIST", ".Rbsoffers"); +} + +### Rechner +$hostorgroup = $exp[0]; +$hosts_array = get_hosts($auDN,array("dn","hostname","ipaddress")); + +$template->define_dynamic("TftpHosts", "Webseite"); +$template->define_dynamic("NfsHosts", "Webseite"); +$template->define_dynamic("NbdHosts", "Webseite"); +foreach ($hosts_array as $item){ + $template->assign(array("HDN" => $item['dn'], + "HN" => $item['hostname'], + "IP" => $item['ipaddress'])); + $template->parse("TFTPHOSTS_LIST", ".TftpHosts"); + $template->assign(array("HDN" => $item['dn'], + "HN" => $item['hostname'], + "IP" => $item['ipaddress'])); + $template->parse("NFSHOSTS_LIST", ".NfsHosts"); + $template->assign(array("HDN" => $item['dn'], + "HN" => $item['hostname'], + "IP" => $item['ipaddress'])); + $template->parse("NBDHOSTS_LIST", ".NbdHosts"); +} + +################################################ +# PXE Generator Skript Config +$pxegen_ldap = "ldap://".LDAP_HOST; +$pxegen_base = "ou=RIPM,".$suffix; +$pxegen_udn = $userDN; +$pxegen_pw = $userPassword; +$pxegen_rbsdn = $rbsDN; +$template->assign(array("PXEGENLDAP" => $pxegen_ldap, + "PXEGENBASE" => $pxegen_base, + "PXEGENUDN" => $pxegen_udn, + "PXEGENPW" => $pxegen_pw, + "PXEGENRBS" => $pxegen_rbsdn)); + + +################################################################################### + +include("rbs_footer.inc.php"); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/rbs/rbservice_add.php b/ldap-site-mngmt/webinterface/rbs/rbservice_add.php new file mode 100644 index 00000000..54494999 --- /dev/null +++ b/ldap-site-mngmt/webinterface/rbs/rbservice_add.php @@ -0,0 +1,140 @@ +<?php +include('../standard_header.inc.php'); + +$rbscn = $_POST['rbscn']; $rbscn = htmlentities($rbscn); + +$nodeDN = "cn=rbs,".$auDN; + +$rbsoffer = $_POST['rbsoffer']; + +$tftpserverip = $_POST['tftpserverip']; +$nfsserverip = $_POST['nfsserverip']; +$nbdserverip = $_POST['nbdserverip']; + +$tftpserver = $_POST['tftpserver']; +$nfsserver = $_POST['nfsserver']; +$nbdserver = $_POST['nbdserver']; + +$host_array = get_hosts($auDN,array("dn","hostname","ipaddress")); + +$mnr = $_POST['mnr']; +$sbmnr = $_POST['sbmnr']; +$mcnr = $_POST['mcnr']; + +# sosntige 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>"; + + +$get_rbscn = str_replace ( " ", "_", $rbscn ); +$seconds = 300; +$url = "new_rbservice.php?&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>"; + +if ( $rbscn != "" && $rbscn != "Hier_RBS_NAME_eintragen" ){ + + $rbscn = "RBS_".$rbscn; + + # Formulareingaben anpassen + $exprbs = explode(" ",$rbscn); + foreach ($exprbs as $word){$expuc[] = ucfirst($word);} + $rbscn = implode(" ",$expuc); + $rbscn = preg_replace ( '/\s+([0-9A-Z])/', '$1', $rbscn); + + $rbsDN = "cn=".$rbscn.",".$nodeDN; + print_r($rbsDN); echo "<br><br>"; + + # Server_array zusammenstellen + $server = array(); + # TFTP Server + if ($tftpserverip != ""){ + if ($syntax->check_ip_syntax($tftpserverip)){ + $tftpserverip = htmlentities($tftpserverip); + $mesg .= "Suche nach dem Rechner mit IP ".$tftpserverip." :<br>"; + foreach ($host_array as $host){ + $hostipexp = explode('_',$host['ipaddress']); + $hostip = $hostipexp[0]; + if ($tftpserverip == $hostip){ + $server ['tftp'] = $tftpserverip; + break; + }else{ + $mesg .= "Rechner ".$host['hostname'].": keine Übereinstimmung mit eingegebener IP ".$tftpserverip."!<br>"; + } + } + }else{$mesg .= "Falsche IP Syntax!<br>";} + } + # NFS Server + if ( $nfsserverip != "" ){ + if ($syntax->check_ip_syntax($nfsserverip)){ + $nfsserverip = htmlentities($nfsserverip); + $mesg .= "Suche nach dem Rechner mit IP ".$nfsserverip." :<br>"; + foreach ($host_array as $host){ + $hostipexp = explode('_',$host['ipaddress']); + $hostip = $hostipexp[0]; + if ($nfsserverip == $hostip){ + $server ['nfs'] = $nfsserverip; + break; + }else{ + $mesg .= "Rechner ".$host['hostname'].": keine Übereinstimmung mit eingegebener IP ".$nfsserverip."!<br>"; + } + } + }else{$mesg .= "Falsche IP Syntax!<br>";} + } + # NBD Server + if ( $nbdserverip != "" ){ + if ($syntax->check_ip_syntax($nbdserverip)){ + $nbdserverip = htmlentities($nbdserverip); + $mesg .= "Suche nach dem Rechner mit IP ".$nbdserverip." :<br>"; + foreach ($host_array as $host){ + $hostipexp = explode('_',$host['ipaddress']); + $hostip = $hostipexp[0]; + if ($nbdserverip == $hostip){ + $server ['nbd'] = $nbdserverip; + break; + }else{ + $mesg .= "Rechner ".$host['hostname'].": keine Übereinstimmung mit eingegebener IP ".$nbdserverip."!<br>"; + } + } + }else{$mesg .= "Falsche IP Syntax!<br>";} + } + echo "Server Array: ";print_r($server); echo "<br>"; + + if (add_rbs($rbsDN,$rbscn,$rbsoffer,$server,$atts)){ + $mesg .= "<br>Remote Boot Service erfolgreich angelegt<br>"; + $url = "rbservice.php?mnr=1"; + }else{ + $mesg .= "<br>Fehler beim anlegen des Remote Boot Services!<br>"; + } +} + +elseif ( $rbscn == "" || $rbscn == "Hier_RBS_NAME_eintragen" ){ + + $mesg = "Sie haben den Namen des neuen Remote Boot Service nicht angegeben. Dieser ist + aber ein notwendiges Attribut.<br> + Bitte geben Sie ihn an.<br><br>"; + $url = "new_rbservice.php?rbscn=Hier_RBS_NAME_eintragen&mnr=1"; +} + + + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurü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 diff --git a/ldap-site-mngmt/webinterface/rbs/rbservice_change.php b/ldap-site-mngmt/webinterface/rbs/rbservice_change.php new file mode 100644 index 00000000..e5419c36 --- /dev/null +++ b/ldap-site-mngmt/webinterface/rbs/rbservice_change.php @@ -0,0 +1,337 @@ +<?php +include('../standard_header.inc.php'); + +$rbscn = "RBS_".$_POST['rbscn']; +$oldrbscn = "RBS_".$_POST['oldrbscn']; +$rbsoffer = $_POST['rbsoffer']; +$oldrbsoffer = $_POST['oldrbsoffer']; + +$tftpserverip = $_POST['tftpserverip']; +$oldtftpserverip = $_POST['oldtftpserverip']; +$nfsserverip = $_POST['nfsserverip']; +$oldnfsserverip = $_POST['oldnfsserverip']; +$nbdserverip = $_POST['nbdserverip']; +$oldnbdserverip = $_POST['oldnbdserverip']; + +$tftpserver = $_POST['tftpserver']; +$nfsserver = $_POST['nfsserver']; +$nbdserver = $_POST['nbdserver']; +$oldtftpserverdn = $_POST['oldtftpserverdn']; +$oldnfsserverdn = $_POST['oldnfsserverdn']; +$oldnbdserverdn = $_POST['oldnbdserverdn']; + +$host_array = get_hosts($auDN,array("dn","hostname","ipaddress")); + +$rbsDN = $_POST['rbsdn']; +$nodeDN = "cn=rbs,".$auDN; + +$mnr = $_POST['mnr']; +$sbmnr = $_POST['sbmnr']; +$mcnr = $_POST['mcnr']; + +# sosntige 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>"; + + +$seconds = 2; +$url = "rbservice.php?&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>"; + +############################################## +# RBS CN (DN) + +if ( $oldrbscn == $rbscn ){ + # $mesg = "keine Aenderung<br>"; +} + +if ( $oldrbscn != "" && $rbscn != "" && $oldrbscn != $rbscn ){ + echo "RBS Name aendern<br>"; + # hier noch Syntaxcheck + # Formulareingaben anpassen + $exprbs = explode(" ",$rbscn); + foreach ($exprbs as $word){$expuc[] = ucfirst($word);} + $rbscn = implode(" ",$expuc); + $rbscn = preg_replace ( '/\s+([0-9A-Z])/', '$1', $rbscn); + + $newrbsDN = "cn=".$rbscn.",".$nodeDN; + print_r($newrbsDN); echo "<br><br>"; + + if(move_subtree($rbsDN, $newrbsDN)){ + adjust_rbs_dn($newrbsDN, $rbsDN); + $rbsDN = $newrbsDN; + $mesg = "RBS Name erfolgreich geändert<br><br>"; + }else{ + $mesg = "Fehler beim ändern des RBS Namen!<br><br>"; + } +} + +if ( $oldrbscn != "" && $rbscn == "" ){ + echo "Gruppenname loeschen!<br> + Dieses ist Teil des DN, Sie werden den RBS komplett löschen<br><br>"; + echo "Wollen Sie den RBS Dienst <b>".$oldrbscn."</b> wirklich löschen?<br><br> + <form action='rbservice_delete.php' method='post'> + Falls ja:<br><br> + <input type='hidden' name='dn' value='".$pxeDN."'> + <input type='hidden' name='name' value='".$oldrbscn."'> + <input type='Submit' name='apply' value='löschen' class='small_loginform_button'><br><br> + </form> + <form action='".$url."' method='post'> + Falls, nein:<br><br> + <input type='Submit' name='apply' value='zurück' class='small_loginform_button'> + </form>"; + $seconds = 600; +} + + +##################################### +# Offer ändern + +if ( $rbsoffer != "none" && $rbsoffer == $oldrbsoffer ){ + $mesg = "Sie haben die gleiche Abteilung ausgewählt<br> + Keine Änderung!"; +} + +if ( $rbsoffer != "none" && $rbsoffer != $oldrbsoffer ){ + $entryoffer ['rbsofferdn'] = $rbsoffer; + if(ldap_mod_replace($ds,$rbsDN,$entryoffer)){ + $mesg = "RBS Offer erfolgreich geändert<br><br>"; + } + else{ + $mesg = "Fehler beim ändern des RBS Offers!<br><br>"; + } +} + + +##################################### +# Server ändern über IP Feld + +$syntax = new Syntaxcheck; + +if ( $tftpserverip != "" && $tftpserverip != $oldtftpserverip ){ + + if ($syntax->check_ip_syntax($tftpserverip)){ + $tftpserverip = htmlentities($tftpserverip); + + $mesg .= "Suche nach dem Rechner mit IP ".$tftpserverip." :<br>"; + foreach ($host_array as $host){ + $hostipexp = explode('_',$host['ipaddress']); + $hostip = $hostipexp[0]; + if ($tftpserverip == $hostip){ + $entrytftp ['tftpserverip'] = $tftpserverip; + if (ldap_mod_replace($ds,$rbsDN,$entrytftp)){ + $mesg .= "Treffer: Rechner ".$host['hostname']."<br>TFTP Server erfolgreich geändert<br>"; + }else{ + $mesg .= "Fehler beim ändern des TFTP Servers!<br>"; + } + break; + }else{ + $mesg .= "Rechner ".$host['hostname'].": keine Übereinstimmung mit eingegebener IP ".$tftpserverip."!<br>"; + } + } + } + else{ + $mesg .= "Falsche IP Syntax!<br>"; + } +} + +if ( $nfsserverip != "" && $nfsserverip != $oldnfsserverip ){ + + if ($syntax->check_ip_syntax($nfsserverip)){ + $nfsserverip = htmlentities($nfsserverip); + + $mesg .= "Suche nach dem Rechner mit IP ".$nfsserverip." :<br>"; + foreach ($host_array as $host){ + $hostipexp = explode('_',$host['ipaddress']); + $hostip = $hostipexp[0]; + if ($nfsserverip == $hostip){ + $entrytnfs ['nfsserverip'] = $nfsserverip; + if (ldap_mod_replace($ds,$rbsDN,$entrytnfs)){ + $mesg .= "Treffer: Rechner ".$host['hostname']."<br>NFS Server erfolgreich geändert<br>"; + }else{ + $mesg .= "Fehler beim ändern des NFS Servers!<br>"; + } + break; + }else{ + $mesg .= "Rechner ".$host['hostname'].": keine Übereinstimmung mit eingegebener IP ".$nfsserverip."!<br>"; + } + } + } + else{ + $mesg .= "Falsche IP Syntax!<br>"; + } +} + +if ( $nbdserverip != "" && $nbdserverip != $oldnbdserverip ){ + + if ($syntax->check_ip_syntax($nbdserverip)){ + $nbdserverip = htmlentities($nbdserverip); + + $mesg .= "Suche nach dem Rechner mit IP ".$nbdserverip." :<br>"; + foreach ($host_array as $host){ + $hostipexp = explode('_',$host['ipaddress']); + $hostip = $hostipexp[0]; + if ($nbdserverip == $hostip){ + $entrytnbd ['nbdserverip'] = $nbdserverip; + if (ldap_mod_replace($ds,$rbsDN,$entrytnbd)){ + $mesg .= "Treffer: Rechner ".$host['hostname']."<br>NBD Server erfolgreich geändert<br>"; + }else{ + $mesg .= "Fehler beim ändern des NBD Servers!<br>"; + } + break; + }else{ + $mesg .= "Rechner ".$host['hostname'].": keine Übereinstimmung mit eingegebener IP ".$nbdserverip."!<br>"; + } + } + } + else{ + $mesg .= "Falsche IP Syntax!<br>"; + } +} + +##################################### +# Server ändern über Hostname + +if ($tftpserver != "none" && $tftpserver != $oldtftpserverdn){ + + $host = get_host_ip($tftpserver); + $hostipexp = explode('_',$host['ipaddress']); + $hostip = $hostipexp[0]; + $entrytftp ['tftpserverip'] = $hostip; + if (ldap_mod_replace($ds,$rbsDN,$entrytftp)){ + $mesg .= "TFTP Server erfolgreich geändert<br>"; + }else{ + $mesg .= "Fehler beim ändern des TFTP Servers!<br>"; + } + +} + +if ($nfsserver != "none" && $nfsserver != $oldnfsserverdn){ + + $host = get_host_ip($nfsserver); + $hostipexp = explode('_',$host['ipaddress']); + $hostip = $hostipexp[0]; + $entrynfs ['nfsserverip'] = $hostip; + if (ldap_mod_replace($ds,$rbsDN,$entrynfs)){ + $mesg .= "NFS Server erfolgreich geändert<br>"; + }else{ + $mesg .= "Fehler beim ändern des NFS Servers!<br>"; + } + +} + +if ($nbdserver != "none" && $nbdserver != $oldnbdserverdn){ + + $host = get_host_ip($nbdserver); + $hostipexp = explode('_',$host['ipaddress']); + $hostip = $hostipexp[0]; + $entrytnbd ['nbdserverip'] = $hostip; + if (ldap_mod_replace($ds,$rbsDN,$entrytnbd)){ + $mesg .= "NBD Server erfolgreich geändert<br>"; + }else{ + $mesg .= "Fehler beim ändern des NBD Servers!<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,$rbsDN,$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 "ändern<br>"; + foreach (array_keys($entrymod) as $key){ + $modatts .= "<b>".$key."</b>,"; + } + if(ldap_mod_replace($ds,$rbsDN,$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öschen<br>"; + foreach (array_keys($entrydel) as $key){ + $delatts .= "<b>".$key."</b>,"; + } + if(ldap_mod_del($ds,$rbsDN,$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ü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 diff --git a/ldap-site-mngmt/webinterface/rbs/rbservice_delete.php b/ldap-site-mngmt/webinterface/rbs/rbservice_delete.php new file mode 100644 index 00000000..919987bd --- /dev/null +++ b/ldap-site-mngmt/webinterface/rbs/rbservice_delete.php @@ -0,0 +1,41 @@ +<?php +include('../standard_header.inc.php'); + +$rbsDN = $_POST['dn']; +$rbscn = $_POST['name']; + +$seconds = 100; +$url = 'rbs.php'; + +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>"; + +if ( $rbsDN != ""){ + + if ( dive_into_tree_del($rbsDN,"") ){ + clean_up_del_rbs($rbsDN); + $mesg = "Remote Boot Service <b>".$rbscn."</b> erfolgreich gelöscht!<br><br>"; + } + else{ + $mesg = "Fehler beim löschen des Remote Boot Services <b>".$rbscn."</b> !<br><br>"; + } + +} + + + + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurü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 diff --git a/ldap-site-mngmt/webinterface/roles/menu.dwt b/ldap-site-mngmt/webinterface/roles/menu.dwt new file mode 100644 index 00000000..9aadc1c5 --- /dev/null +++ b/ldap-site-mngmt/webinterface/roles/menu.dwt @@ -0,0 +1,22 @@ + +<table cellpadding='5' cellspacing='0' border='0' width='100%'> + + + + <!-- BEGIN DYNAMIC BLOCK: Hauptmenu --> + + <tr valign='middle' align='left'>
+
+ <td width='8%' align='right' style="border-style=none;"> </td> + <td width="8%" align="left" style="border-width:1 0 1 1;border-color:#000000;border-style:solid;padding:5;background-color:{FARBE}"> </td>
+ <td width="74%" align="left" style="border-width:1 1 1 0;border-color:#000000;border-style:solid;padding:5;background-color:{FARBE}"> + <a href="{LINK_M}" style="text-decoration:none"><b class="standard_schrift">{TEXT_M}</b></a></td>
+ <td width='10%'> </td> + + </tr> + <tr height='5'></tr> + <!-- END DYNAMIC BLOCK: Hauptmenu -->
+ + + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/roles/role_add.php b/ldap-site-mngmt/webinterface/roles/role_add.php new file mode 100644 index 00000000..3c628066 --- /dev/null +++ b/ldap-site-mngmt/webinterface/roles/role_add.php @@ -0,0 +1,53 @@ +<?php + +include('../standard_header.inc.php'); + + +$adduser = $_POST['adduser']; +$role = $_POST['role']; +$menr = $_POST['menr']; + +$exp = explode('_',$adduser); +$adduserDN = $exp[0]; +$adduserUID = $exp[1]; + +echo " +<html> +<head> + <title>Roles Management</title> + <link rel='stylesheet' href='../styles.css' type='text/css'> +</head> +<body> +<table border='0' cellpadding='30' cellspacing='0'> +<tr><td>"; + +# print_r($adduser);echo "<br>"; +# print_r($adduserDN);echo "<br>"; +# print_r($adduserUID);echo "<br>"; +# print_r($role);echo "<br>"; +# print_r($menr);echo "<br><br>"; + +$url = 'role_show.php?role='.$role.'&mnr='.$menr; + +if ($adduser != 'none'){ + $res = new_role_member($adduserDN,$role,$auDN,$domDN); + if ($res == 1){ + $mesg = "Der Benutzer <b>".$adduserUID."</b> wurde erfolgreich als neuer <b>".$role."</b> aufgenommen.<br><br>"; + }else{ + $mesg = "Fehler! Der Benutzer <b>".$adduserUID."</b> konnte nicht aufgenommen werden<br><br>"; + } + $mesg .= "Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> + Falls nicht, klicken Sie hier <a href='role_show.php?role=$role&mnr=$menr' style='publink'>back</a>"; + redirect(3, $url, $mesg, $addSessionId = TRUE); +} + +else { + $mesg = "Sie haben keinen Benutzer ausgewählt<br><br> + Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> + Falls nicht, klicken Sie hier <a href='role_show.php?role=$role&mnr=$menr' style='publink'>back</a>"; + redirect(3, $url, $mesg, $addSessionId = TRUE); +} + +echo "</td></tr></table></body> +</html>"; +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/roles/role_delete.php b/ldap-site-mngmt/webinterface/roles/role_delete.php new file mode 100644 index 00000000..297136e0 --- /dev/null +++ b/ldap-site-mngmt/webinterface/roles/role_delete.php @@ -0,0 +1,57 @@ +<?php + +include('../standard_header.inc.php'); + + +$deluser = $_POST['deluser']; +$role = $_POST['role']; +$menr = $_POST['menr']; + +echo " +<html> +<head> + <title>Roles Management</title> + <link rel='stylesheet' href='../styles.css' type='text/css'> +</head> +<body> +<table border='0' cellpadding='30' cellspacing='0'> +<tr><td>"; + +if (isset($_POST['deluser'])){ + + # print_r($deluser);echo "<br>"; + # print_r($role);echo "<br>"; + # print_r($menr);echo "<br>"; + + $url = 'role_show.php?role='.$role.'&mnr='.$menr; + $mesg = ""; + + foreach ($deluser as $item){ + $exp = explode('_',$item); + $deluserDN = $exp[0]; + $deluserUID = $exp[1]; + # print_r($deluserDN);echo "<br>"; + # print_r($deluserUID);echo "<br>"; + $res = delete_role_member($deluserDN,$role,$auDN,$domDN); + if ($res == 1){ + $mesg .= "Der Benutzer <b>".$deluserUID."</b> wurde erfolgreich aus der Rolle <b>".$role."</b> entfernt.<br>"; + }else{ + $mesg .= "<b>Fehler!</b> Der Benutzer <b>".$deluserUID."</b> konnte nicht entfernt werden<br>"; + } + } + $mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> + Falls nicht, klicken Sie hier <a href='role_show.php?role=$role&mnr=$menr' style='publink'>back</a><br><br>"; + redirect(3, $url, $mesg, $addSessionId = TRUE); + +} + +else { + $mesg .= "<br>Sie haben keinen Benutzer ausgewählt<br><br> + Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> + Falls nicht, klicken Sie hier <a href='role_show.php?role=$role&mnr=$menr' style='publink'>back</a>"; + redirect(3, $url, $mesg, $addSessionId = TRUE); +} + +echo "</td></tr></table></body> +</html>"; +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/roles/role_show.dwt b/ldap-site-mngmt/webinterface/roles/role_show.dwt new file mode 100644 index 00000000..3eb05b79 --- /dev/null +++ b/ldap-site-mngmt/webinterface/roles/role_show.dwt @@ -0,0 +1,70 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='2'><h3>{ROLE_DESC}</h3></td></tr><tr><td height='20'></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + <tr> + <td width='5%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'> </td> + <td width='25%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Benutzer</b></td> + <td width='25%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>UID</b></td> + <td width='45%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Email</b></td> + </tr> + + <form action='role_delete.php' method='post'> + + <!-- BEGIN DYNAMIC BLOCK: Members --> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='checkbox' name='deluser[]' value='{VALUE}_{UID}' size='15' class='medium_form_checkbox'></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>{USERNAME} </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>{UID} </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><a href'mailto:{MAIL}' style='publink'>{MAIL}</a> </td> + </tr> + <!-- END DYNAMIC BLOCK: Members --> + <input type='hidden' name='role' value='{ROLE}'> + <input type='hidden' name='menr' value='{MENR}'> + + + <tr> + <td colspan='3' style='border-width: 0 0 0 0;'><input type='Submit' name='delete' value='entfernen' class='small_loginform_button'></td> + + </form> + </tr> + </table></td> + </tr> + + <tr height='30'></tr> + <tr> + <td colspan='2'><h4>Neuen Administrator anlegen:</h4></td> + </tr> + <tr><td height='10'></td></tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + <tr> + + <form action='role_add.php' method='post'> + + <td width='60%' style='border-color: black; border-style: solid; border-width: 3 0 1 0;'> + Wählen Sie einen Benutzer aus <br> + <select name='adduser' size='1' class='medium_form_selectbox'> + <option selected value='none'>----------</option> + + <!-- BEGIN DYNAMIC BLOCK: Users --> + <option value='{UDN}_{USER}'>{USER}</option> + <!-- END DYNAMIC BLOCK: Users --> + + </select> + <input type='hidden' name='role' value='{ROLE}'> + <input type='hidden' name='menr' value='{MENR}'> + </td> + </tr> + <tr> + <td style='border-width: 0 0 0 0;'><input type='Submit' name='add' value='anlegen' class='small_loginform_button'></td> + + </form> + </tr> + </table></td> + </tr> + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/roles/role_show.php b/ldap-site-mngmt/webinterface/roles/role_show.php new file mode 100644 index 00000000..d209d3e9 --- /dev/null +++ b/ldap-site-mngmt/webinterface/roles/role_show.php @@ -0,0 +1,116 @@ +<?php +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "Roles Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 1; +$mnr = 1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "role_show.dwt"; +$role = "MainAdmin"; + +include("../class.FastTemplate.php"); + +include("roles_header.inc.php"); + + +############################################################################### + +$mnr = $_GET['mnr']; + +# Menuleiste erstellen +createMainMenu($rollen, $mainnr); +createRolesMenu($rollen, $mnr, $assocdom); + +#################################### +# Admins anzeigen und loeschen + +$role = $_GET['role']; +$roles_array = get_roles($auDN); +# print_r($roles_array); + +# jeder Rolle entsprechend Members holen und Überschrift setzen +switch ($role){ +case 'MainAdmin': + $template->assign(array("ROLE" => "MainAdmin","ROLE_DESC" => "Haupt Administratoren","MENR" => $mnr)); + $members = $roles_array['MainAdmin']; + break; +case 'HostAdmin': + $template->assign(array("ROLE" => "HostAdmin","ROLE_DESC" => "Administratoren - Rechner, Rechnergruppen, Remote Boot Services (PXE)","MENR" => $mnr)); + $members = $roles_array['HostAdmin']; + break; +case 'DhcpAdmin': + $template->assign(array("ROLE" => "DhcpAdmin","ROLE_DESC" => "Administratoren - DHCP","MENR" => $mnr)); + $members = $roles_array['DhcpAdmin']; + break; +case 'ZoneAdmin': + $template->assign(array("ROLE" => "ZoneAdmin","ROLE_DESC" => "Administratoren - DNS Zone [ {DOM} ]","MENR" => $mnr,"DOM" => $assocdom)); + $members = $roles_array['ZoneAdmin']; + break; +} + +# print_r($members); echo "<br><br>"; + +# für jedes Member Daten holen (Benutzername, UID) +if ( count($members) != 0 ){ + $members_data = array(); + foreach ($members as $item){ + $members_data[] = get_user_data($item,array("dn","cn","uid","mail")); + # print_r(get_user_data($item,array("dn","cn","uid"))); echo "<br>"; + } +} +# echo "<br>"; +# print_r($members_data); echo "<br><br>"; + +if (count($members_data) != 0){ + $template->define_dynamic("Members", "Webseite"); + foreach ($members_data as $item){ + $template->assign(array("VALUE" => $item['dn'], + "USERNAME" => $item['cn'], + "UID" => $item['uid'], + "MAIL" => $item['mail'])); + $template->parse("MEMBERS_LIST", ".Members"); + } +}else{ + $template->assign(array("VALUE" => "","USERNAME" => "","UID" => "","MAIL" => "")); +} + + +############################################## +# Admin anlegen ... +$users_array = get_users(); +# print_r($users_array); echo "<br><br>"; + +if (count($members_data) != 0){ +for ($i=0; $i < count($users_array); $i++){ + foreach ($members_data as $item){ + if ($users_array[$i]['uid'] == $item['uid']){ + array_splice($users_array, $i, 1); + # break; + } + } +} +# print_r($users_array); echo "<br><br>"; +} + +# if (count($users_array) != 0){ + $template->define_dynamic("Users", "Webseite"); + foreach ($users_array as $item){ + $template->assign(array("UDN" => $item['dn'], + "USER" => $item['uid'])); + $template->parse("USERS_LIST", ".Users"); + } +#}else{ +# $template->assign(array("UDN" => "","USER" => "")); +# } + + + + + +############################################################################### + +include("roles_footer.inc.php"); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/roles/roles.dwt b/ldap-site-mngmt/webinterface/roles/roles.dwt new file mode 100644 index 00000000..8e775327 --- /dev/null +++ b/ldap-site-mngmt/webinterface/roles/roles.dwt @@ -0,0 +1,79 @@ +<html> + +<head> + <title>{SEITENTITEL}</title> + <link rel='stylesheet' href='../styles.css' type='text/css'></head> +<body> + +<table cellpadding='0' cellspacing='0' border='0' width='95%' height='8%'> + <tr> + <td width='35%'> + <table cellpadding='5' cellspacing='0' border='0' width='100%'> + <tr valign='top'> + <td width='1'></td> + <td><h2>Rechner und IP Management</h2></td> + </tr> + </table> + </td> + + <td width='40%'> + <table cellpadding='5' cellspacing='0' border='0' width='100%'> + <tr valign='top' align='left'> + <td> + <h4><a href='../start.php' class='headerlink'>Startseite</a> + >> <a href='../au/au.php' class='headerlink'>{AU}</a> [ {DOMAIN} ]</h4> + </td> + </tr> + </table> + </td> + <td width='25%'> + <table cellpadding='5' cellspacing='0' border='0' width='100%' align='right'> + <tr valign='top' align='right'> + <td> + {LOGIN} + </td> + </tr> + </table> + </td> + </tr> +</table> +<table cellpadding='5' cellspacing='0' border='0' width='95%' height='7%'> +<tr> + <td>{MAINMENU}</td> +</tr> +</table> + + +<hr align='center' width='98%' noshade> + + + +<table cellpadding='5' cellspacing='0' border='0' width='100%' height='85%'> + + <tr valign='top' height='100%'> + <td width='28%'> + <table cellpadding='5' cellspacing='0' border='0' width='100%'> + <tr><td> + + {NAVIGATION} + + </td></tr> + </table> + </td> + + <td width='72%'> + <table cellpadding='5' cellspacing='0' border='0' width='100%'> + <tr><td> + + {HAUPTFENSTER} + + </td></tr> + </table> + </td> + + </tr> +</table> + +</body> + +</html> diff --git a/ldap-site-mngmt/webinterface/roles/roles.php b/ldap-site-mngmt/webinterface/roles/roles.php new file mode 100644 index 00000000..0ae79cf9 --- /dev/null +++ b/ldap-site-mngmt/webinterface/roles/roles.php @@ -0,0 +1,26 @@ +<?php +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "Roles Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 1; +$mnr = 0; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "roles_start.dwt"; + +include("../class.FastTemplate.php"); + +include("roles_header.inc.php"); + +################################################################################### + +# Menuleiste erstellen +createMainMenu($rollen, $mainnr); +createRolesMenu($rollen, $mnr, $assocdom); + +################################################################################### + +include("roles_footer.inc.php"); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/roles/roles_footer.inc.php b/ldap-site-mngmt/webinterface/roles/roles_footer.inc.php new file mode 100644 index 00000000..311721c5 --- /dev/null +++ b/ldap-site-mngmt/webinterface/roles/roles_footer.inc.php @@ -0,0 +1,18 @@ +<?php + +$template->assign(array("PFAD" => $START_PATH)); + +# Daten in die Vorlage parsen +$template->parse("LOGIN", "Login"); +$template->parse("MAINMENU", "Mmenu"); +$template->parse("NAVIGATION", "Menu"); +$template->parse("HAUPTFENSTER", "Webseite"); +$template->parse("PAGE", "Vorlage"); + +# Fertige Seite an den Browser senden +$template->FastPrint("PAGE"); + +# Abmelden vom LDAP +ldap_unbind($ds); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/roles/roles_header.inc.php b/ldap-site-mngmt/webinterface/roles/roles_header.inc.php new file mode 100644 index 00000000..74c96f74 --- /dev/null +++ b/ldap-site-mngmt/webinterface/roles/roles_header.inc.php @@ -0,0 +1,19 @@ +<?php +include("roles_menu.php"); + +$template = new FastTemplate("."); +# dem erstellten Template-Objekt eine Vorlage zuweisen +$definedTemplates = array("Vorlage" => "roles.dwt", + "Login" => "../logout_form.inc.dwt", + "Mmenu" => "../hauptmenue.dwt", + "Menu" => "menu.dwt", + "Webseite" => $webseite); +if (isset($additionalTemplates)) { + foreach ($additionalTemplates as $templateKey => $templateFile) { + $definedTemplates[$templateKey] = $templateFile; + } +} +$template->define($definedTemplates); +$template->assign(array("SEITENTITEL" => $titel, "AU" => $au_ou, "DOMAIN" => $assocdom, "USERCN" => $usercn)); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/roles/roles_menu.php b/ldap-site-mngmt/webinterface/roles/roles_menu.php new file mode 100644 index 00000000..e389f4e9 --- /dev/null +++ b/ldap-site-mngmt/webinterface/roles/roles_menu.php @@ -0,0 +1,87 @@ +<?php + + +function createRolesMenu($rollen , $mnr, $assocdom) { + global $template; + global $START_PATH; + # Struktur der Registerkartenleiste + if ($assocdom != ""){ + $hauptmenu = array(array("link" => "roles.php", + "text" => "Übersicht", + "zugriff" => array("MainAdmin")), + array("link" => "role_show.php?role=MainAdmin&mnr=1", + "text" => "Main Admins", + "zugriff" => array("MainAdmin")), + array("link" => "role_show.php?role=HostAdmin&mnr=2", + "text" => "Host Admins", + "zugriff" => array("MainAdmin")), + array("link" => "role_show.php?role=DhcpAdmin&mnr=3", + "text" => "DHCP Admins", + "zugriff" => array("MainAdmin")), + array("link" => "role_show.php?role=ZoneAdmin&mnr=4", + "text" => "DNS Admins", + "zugriff" => array("MainAdmin"))); + }else{ + $hauptmenu = array(array("link" => "roles.php", + "text" => "Übersicht", + "zugriff" => array("MainAdmin")), + array("link" => "role_show.php?role=MainAdmin&mnr=1", + "text" => "Main Admins", + "zugriff" => array("MainAdmin")), + array("link" => "role_show.php?role=HostAdmin&mnr=2", + "text" => "Host Admins", + "zugriff" => array("MainAdmin")), + array("link" => "role_show.php?role=DhcpAdmin&mnr=3", + "text" => "DHCP Admins", + "zugriff" => array("MainAdmin"))); + } + # $rollen = array_keys($roles); + + # Zusammenstellen der Menuleiste + $template->define_dynamic("Hauptmenu", "Menu"); + $i=0; + foreach($hauptmenu as $item) { + if($item['zugriff'] === "alle" || vergleicheArrays($rollen , $item['zugriff'])) { + if ($i==0) { + if ($mnr==0) { + $zwisch=""; + $lastaktive=true; + $farb="#505050"; + } + else { + $zwisch=""; + $farb="#A0A0A0"; + $lastaktive=false; + } + } + else { + if ($mnr==$i) { + $zwisch=""; + $lastaktive=true; + $farb="#505050"; + } + else { + $farb="#A0A0A0"; + if ($lastaktive) {$zwisch="";} + else {$zwisch="";} + $lastaktive=false; + } + } + $template->assign(array("ZWISCHEN" => $zwisch, + "FARBE" => $farb, + "LINK_M" => $item["link"], + "TEXT_M" => $item["text"])); + $template->parse("HAUPTMENU_LIST", ".Hauptmenu"); + + } + $i=$i+1; + } + if ($lastaktive) {$template->assign(array("ENDE" => ""));} + else { + $template->assign(array("ENDE" => "")); + } + +} + + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/roles/roles_start.dwt b/ldap-site-mngmt/webinterface/roles/roles_start.dwt new file mode 100644 index 00000000..22ab0857 --- /dev/null +++ b/ldap-site-mngmt/webinterface/roles/roles_start.dwt @@ -0,0 +1,37 @@ +<table border='0' cellpadding='5' cellspacing='0' width='90%'> + <tr> + <td colspan='2'><h3>Modul - Administratoren Rollen Management: </h3></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr> + <td> + <p>Dieses Modul dient der Verwaltung von Administratoren Rollen in ihrer Abteilung. + Benutzen Sie die Navigation links, um die Verwaltungsbereiche der einzelnen Rollen anzusteuern. + Dort koennen Sie dann Benutzer den Rollen zuweisen oder wieder entziehen.</p> + <p>Folgende administrative Rollen stehen zur Verfuegung:</p> + <ul> + <li><p><b>Main Admins</b></p> + Hauptadministratoren, der AU mit uneingeschraenkten Rechten. Sie verwalten: u.a. + untergeordnete AUs (anlegen/loeschen/im DNS anmelden), + Rollen, IP Adressen und deren Delegierung, Rechner (Gruppen), deren Hardware-Profile und + PXE Boot Konfigurationen, sowie die Dienste DHCP und DNS. + </li> + <li><p><b>Host Admins</b></p> + Diese verwalten Rechner (Gruppen), deren Hardware-Profile und PXE Boot Konfigurationen, + und koennen diese im DHCP und DNS anmelden (verwalten im DNS nur deren Namenseintraege). + </li> + <li><p><b>DHCP Admins</b></p> + Verwalten den DHCP Dienst, d.h. Subnetz-, Pool-, Class-Objekte. + </li> + <li><p><b>DNS Admins</b></p> + Sind die Administratoren der mit der AU assozierten DNS Zone. D.h. sie verwalten SOA, + Include Direktiven untergeordneter Include Files, sowie alle Nameneintraege der Zone. + </li> + </ul> + + </td> + </tr> + +</table>
\ No newline at end of file |