diff options
author | Tarik Gasmi | 2007-07-31 09:29:53 +0200 |
---|---|---|
committer | Tarik Gasmi | 2007-07-31 09:29:53 +0200 |
commit | c7b4e4a81d7f38c0f1f927f6804ef281c4f67dcd (patch) | |
tree | 974eb0c95d0ff2678439b161246433cde972564d /ldap-site-mngmt/webinterface/dhcp | |
parent | * more work towards Debian & Ubuntu support, Debian-4.0, Ubuntu-6.10 (diff) | |
download | core-c7b4e4a81d7f38c0f1f927f6804ef281c4f67dcd.tar.gz core-c7b4e4a81d7f38c0f1f927f6804ef281c4f67dcd.tar.xz core-c7b4e4a81d7f38c0f1f927f6804ef281c4f67dcd.zip |
Actualized LDAP SiteManagement Code - Web Interface, DHCP Generationscript
git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1284 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'ldap-site-mngmt/webinterface/dhcp')
28 files changed, 944 insertions, 138 deletions
diff --git a/ldap-site-mngmt/webinterface/dhcp/delete_confirm.php b/ldap-site-mngmt/webinterface/dhcp/delete_confirm.php index 62225afc..3bb798b2 100644 --- a/ldap-site-mngmt/webinterface/dhcp/delete_confirm.php +++ b/ldap-site-mngmt/webinterface/dhcp/delete_confirm.php @@ -6,6 +6,7 @@ $name = $_POST['name']; $delurl = $_POST['delurl']; $backurl = $_POST['backurl']; $successurl = $_POST['successurl']; +$mnr = $_POST['mnr']; echo " <html> @@ -23,6 +24,7 @@ echo " <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='mnr' value='".$mnr."'> <input type='Submit' name='apply' value='löschen' class='small_loginform_button'><br><br> </form> <form action='".$backurl."' method='post'> diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcp.dwt b/ldap-site-mngmt/webinterface/dhcp/dhcp.dwt index 4aadeba5..0a79961c 100644 --- a/ldap-site-mngmt/webinterface/dhcp/dhcp.dwt +++ b/ldap-site-mngmt/webinterface/dhcp/dhcp.dwt @@ -52,11 +52,20 @@ <tr valign='top' height='100%'> <td width='28%'> <table cellpadding='5' cellspacing='0' border='0' width='100%'> - <tr><td> + <tr> + <td> - {NAVIGATION} + {NAVIGATION} - </td></tr> + </td> + </tr> + <tr> + <td> + + {IPBLOCKS} + + </td> + </tr> </table> </td> diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcp.php b/ldap-site-mngmt/webinterface/dhcp/dhcp.php index d757ba3b..bd30ba4f 100644 --- a/ldap-site-mngmt/webinterface/dhcp/dhcp.php +++ b/ldap-site-mngmt/webinterface/dhcp/dhcp.php @@ -20,6 +20,8 @@ include('dhcp_header.inc.php'); createMainMenu($rollen, $mainnr); createDhcpMenu($rollen, $mnr, $auDN, $sbmnr); +include("ip_blocks.inc.php"); + ################################################################################### include("dhcp_footer.inc.php"); diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcp_footer.inc.php b/ldap-site-mngmt/webinterface/dhcp/dhcp_footer.inc.php index 311721c5..7849823e 100644 --- a/ldap-site-mngmt/webinterface/dhcp/dhcp_footer.inc.php +++ b/ldap-site-mngmt/webinterface/dhcp/dhcp_footer.inc.php @@ -6,6 +6,7 @@ $template->assign(array("PFAD" => $START_PATH)); $template->parse("LOGIN", "Login"); $template->parse("MAINMENU", "Mmenu"); $template->parse("NAVIGATION", "Menu"); +$template->parse("IPBLOCKS", "IPBlocks"); $template->parse("HAUPTFENSTER", "Webseite"); $template->parse("PAGE", "Vorlage"); diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcp_header.inc.php b/ldap-site-mngmt/webinterface/dhcp/dhcp_header.inc.php index 9eaac019..783c86e6 100644 --- a/ldap-site-mngmt/webinterface/dhcp/dhcp_header.inc.php +++ b/ldap-site-mngmt/webinterface/dhcp/dhcp_header.inc.php @@ -8,6 +8,7 @@ $definedTemplates = array("Vorlage" => "dhcp.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) { diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcp_menu.php b/ldap-site-mngmt/webinterface/dhcp/dhcp_menu.php index f9a6fae6..3e9638ed 100644 --- a/ldap-site-mngmt/webinterface/dhcp/dhcp_menu.php +++ b/ldap-site-mngmt/webinterface/dhcp/dhcp_menu.php @@ -1,57 +1,72 @@ <?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", + global $template, $START_PATH, $rootAU; + + $mipbs = get_maxipblocks_au($auDN); + #echo "MIPB: "; print_r ($mipbs); echo "<br>"; + if ($mipbs[0] != ""){ + $hauptmenu = array(array("link" => "dhcp.php", "text" => "Übersicht", "zugriff" => "alle")); - $submenu = array(array()); }else{ - # DHCP Services (momentan nur für einen DHCP konzipiert) - $dhcpservice_array = get_dhcpservices($auDN,array("dn","cn")); + $hauptmenu = array(array("link" => "no_dhcp.php", + "text" => "Übersicht", + "zugriff" => "alle")); + } + $i=1; + if ( $auDN == $rootAU ) { + $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, + $hauptmenu []= 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")); - } - + "zugriff" => array("MainAdmin","DhcpAdmin")); + $i++; + } + if ($mipbs[0] != ""){ + if ( check_if_max_networks() ){ + $hauptmenu [] = array("link" => "dhcpsubnets.php?mnr=".$i, + "text" => "DHCP Subnets", + "zugriff" => array("MainAdmin","DhcpAdmin")); + + $subnets = array(); # 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", + #$dhcpsubnet_array = get_dhcpsubnets($auDN,array("dn","cn")); + /*for ($j=0;$j<count($dhcpsubnet_array);$j++){ + $subnets[] = array("link" => "dhcpsubnet.php?dn=".$dhcpsubnet_array[$j]['dn']."&mnr=".$i."&sbmnr=".$j, + "text" => $dhcpsubnet_array[$j]['cn'], + "zugriff" => array("MainAdmin","DhcpAdmin")); + }*/ + $subnets[] = array("link" => "new_dhcpsubnet.php?mnr=".$i."&sbmnr=0", + "text" => "Neues DHCP Subnet anlegen", "zugriff" => array("MainAdmin","DhcpAdmin")); - } - $submenu = array(array(), - array(), - $subnets); - - } - # $rollen = array_keys($roles); + } + $i++; + $hauptmenu [] = array("link" => "dhcppool.php?mnr=".$i, + "text" => "Dynamische DHCP Pools", + "zugriff" => "alle"); + + $submenu = array(array(), + $subnets, + array()); + + }else{ + $hauptmenu [] = array("link" => "dhcppool.php?mnr=".$i, + "text" => "Dynamische DHCP Pools", + "zugriff" => "alle"); + } + } + + #print_r ($hauptmenu);cho "<br>"; + #print_r ($submenu); + #$rollen = array_keys($roles); # Zusammenstellen der Menuleiste $template->define_dynamic("Hauptmenu", "Menu"); @@ -80,29 +95,29 @@ function createDhcpMenu($rollen , $mnr, $auDN, $sbmnr) { else{ if ($j==0) { if ($sbmnr==0) { - if($maxsub == 1){$zwisch="branchbottom2";} - else {$zwisch="branch2";} + if($maxsub == 1){$zwisch="";} + else {$zwisch="";} $lastaktive=true; $farb="#505050"; } else{ - if($maxsub == 1){$zwisch="branchbottom2";} - else {$zwisch="branch2";} + if($maxsub == 1){$zwisch="";} + else {$zwisch="";} $farb="#A0A0A0"; $lastaktive=false; } } else { if ($sbmnr==$j) { - if($maxsub == $j+1){$zwisch="branchbottom2";} - else {$zwisch="branch2";} + if($maxsub == $j+1){$zwisch="";} + else {$zwisch="";} $lastaktive=true; $farb="#505050"; } else { $farb="#A0A0A0"; - if($maxsub == $j+1){$zwisch="branchbottom2";} - else {$zwisch="branch2";} + if($maxsub == $j+1){$zwisch="";} + else {$zwisch="";} # if ($lastaktive) {$zwisch="branch";} # else {$zwisch="branch";} $lastaktive=false; @@ -110,12 +125,12 @@ function createDhcpMenu($rollen , $mnr, $auDN, $sbmnr) { } $htmlcode= " <tr height='4'> - <td></td><td align='right'><img src='../pics/line2.gif' height='4'></td><td></td><td></td> + <td></td><td></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}'> + <td width='8%' align='right'>".$zwisch."</td>
+ <td width='74%' align='left' style='border-width:1 1 1 1;border-color:#000000;border-style:solid;padding:2;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> diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcp_start.dwt b/ldap-site-mngmt/webinterface/dhcp/dhcp_start.dwt index 2e1c0f02..a80c77d7 100644 --- a/ldap-site-mngmt/webinterface/dhcp/dhcp_start.dwt +++ b/ldap-site-mngmt/webinterface/dhcp/dhcp_start.dwt @@ -7,20 +7,25 @@ </tr> <tr> <td> - <p>Dieses Modul dient der Verwaltung eines DHCP Dienstes und DHCP Subnets, Classes <br> + <p>Modul zur Verwaltung von DHCP Subnets, dynamischen Pools und Classes <br> Benutzen Sie die Navigation links, um die einzelnen Verwaltungsbereiche anzusteuern:</p> <ul> - <li><p><b>DHCP Service</b></p> - ... + <li><p><b>DHCP Subnets</b><br> + Verwalten Sie ihre Subnetze ... </p> </li> - <li><p><b>DHCP Subnets</b></p> - ... + <li><p><b>DHCP Pools</b><br> + Weisen Sie ihren DHCP Subnets IP Ranges zur dynamischen Adressvergabe zu ... </p> </li> - <li><p><b>DHCP Classes</b></p> - ... + <li><p><b>DHCP Classes</b><br> + Verwalten Sie Klassen von DHCP Objekten ...</p> </li> </ul> + <br> + <p>Die Verwaltung von DHCP Hosts, etwa das Eintragen ihrer Rechner im zentralen DHCP Dienst, erfolgt über das<br> + Modul <a class='headerlink' href='../computers/computers.php' >Rechner Management</a>. + + </p> </td> </tr> diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcppool.dwt b/ldap-site-mngmt/webinterface/dhcp/dhcppool.dwt new file mode 100644 index 00000000..0d6a8684 --- /dev/null +++ b/ldap-site-mngmt/webinterface/dhcp/dhcppool.dwt @@ -0,0 +1,106 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='2'><h3>Dynamische DHCP Pools </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='dhcppools_change.php' method='post'> + + <tr> + <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Subnetz</b></td> + <td width='50%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>IP Ranges (innerhalb Subnetz)</b></td> + <td width='20%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Unknown Clients</b></td> + </tr> + + <!-- BEGIN DYNAMIC BLOCK: Dhcppools --> + <tr height='50' valign='top'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>{SUBNET}/24</b><br><br> + <input type='checkbox' name='delpool[]' value='{POOLDN}' size='10' class='medium_form_field'> + Pool löschen (Häkchen setzen)</td> + + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <!-- BEGIN DYNAMIC BLOCK: Dhcpranges --> + <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}'><br> + <input type='hidden' name='rangepooldn[]' value='{RPOOLDN}'> + <!-- END DYNAMIC BLOCK: Dhcpranges --> + + <input type='Text' name='addrange1[]' value='' size='15' maxlength='15' class='medium_form_field'> + - + <input type='Text' name='addrange2[]' value='' size='15' maxlength='15' class='medium_form_field'> + </td> + + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <select name='unknownclients[]' size='3' class='small_form_selectbox'> + {UCSELECT} + </select> + <input type='hidden' name='olduc[]' value='{UCNOW}'> + </td> + </tr> + <!--<tr> + <td colspan='3' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><input type='checkbox' name='delpool[]' value='{POOLDN}' size='10' class='medium_form_field'> + Pool löschen (Häkchen setzen)</td> + </tr>--> + + <input type='hidden' name='pooldn[]' value='{POOLDN}'> + <input type='hidden' name='subnet[]' value='{SUBNET}'> + <!-- END DYNAMIC BLOCK: Dhcppools --> + + <input type='hidden' name='mnr' value='{MNR}'> + + </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'><h4>Dynamischen DHCP Pool hinzufügen </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='dhcppool_add.php' method='post'> + + <tr valign='bottom'> + <td width='50%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>IP Range (innerhalb eines Subnetzes)</b><br> + weitere Ranges können später hinzugefügt werden</td> + <td width='50%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Unknown Clients</b></td> + </tr> + + <tr height='50' valign='top'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + <input type='Text' name='addrange1' value='' size='15' maxlength='15' class='medium_form_field'> + - + <input type='Text' name='addrange2' value='' size='15' maxlength='15' class='medium_form_field'> + </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + <select name='unknownclients' size='3' class='small_form_selectbox'> + <option selected value='deny'> DENY </option> + <option value='allow'> ALLOW </option> + <option value='ignore'> IGNORE </option> + </select> + </td> + </tr> + <input type='hidden' name='mnr' value='{MNR}'> + + </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/dhcppool.php b/ldap-site-mngmt/webinterface/dhcp/dhcppool.php new file mode 100644 index 00000000..dd648f49 --- /dev/null +++ b/ldap-site-mngmt/webinterface/dhcp/dhcppool.php @@ -0,0 +1,132 @@ +<?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 = 3; +$sbmnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "dhcppool.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); + +include("ip_blocks.inc.php"); + +################################################################################### + +$template->assign(array("POOLDN" => "", + "CN" => "", + "SUBNETDN" => "", + "SUBNET" => "", + "RANGE1" => "", + "RANGE2" => "", + "DESCRIPTION" => "", + "STATEMENTS" => "", + "ALLOW" => "", + "DENY" => "", + "IGNORE" => "", + "DEFAULTLEASE" => "", + "MAXLEASE" => "", + "MNR" => $mnr)); + +# DHCP Subnet Daten +#$dhcppoolDN = $_GET['dn']; +$attributes = array("dn","cn","dhcphlpcont","dhcprange","description","dhcpstatements","dhcpoptallow", + "dhcpoptdefault-lease-time","dhcpoptdeny","dhcpoptignore","dhcpoptmax-lease-time", + "dhcpoptgeneric"); +$pools = get_dhcppools($auDN, $attributes); +#print_r($pools); +$template->define_dynamic("Dhcppools", "Webseite"); +$template->define_dynamic("Dhcpranges", "Webseite"); + +foreach ($pools as $pool){ + + $template->clear_parse("DHCPRANGES_LIST"); + + # DHCP Range + if (count($pool['dhcprange']) != 0){ + #$template->define_dynamic("Dhcpranges", "Webseite"); + if (count($pool['dhcprange']) > 1){ + foreach ($pool['dhcprange'] as $dhcprange){ + $iprange = explode('_',$dhcprange); + $template->assign(array( + "RANGE1" => $iprange[0], + "RANGE2" => $iprange[1], + "RPOOLDN" => $pool['dn'])); + $template->parse("DHCPRANGES_LIST", ".Dhcpranges"); + $template->clear_dynamic("Dhcpranges"); + } + }else{ + $iprange = explode('_',$pool['dhcprange']); + $template->assign(array( + "RANGE1" => $iprange[0], + "RANGE2" => $iprange[1], + "RPOOLDN" => $pool['dn'])); + $template->parse("DHCPRANGES_LIST", ".Dhcpranges"); + $template->clear_dynamic("Dhcpranges"); + } + } + + # DHCP Subnet + $subnet = ldap_explode_dn($pool['dhcphlpcont'],1); + + + if ($pool['dhcpoptallow'] == "unknown-clients"){ + $unknownclients = "allow"; + $ucselectbox = "<option selected value='allow'> ALLOW </option> + <option value='deny'> DENY </option> + <option value='ignore'> IGNORE </option>"; + } + elseif ($pool['dhcpoptignore'] == "unknown-clients") { + $unknownclients = "ignore"; + $ucselectbox = "<option selected value='ignore'> IGNORE </option> + <option value='allow'> ALLOW </option> + <option value='deny'> DENY </option>"; + } + else{ + $unknownclients = "deny"; + $ucselectbox = "<option selected value='deny'> DENY </option> + <option value='allow'> ALLOW </option> + <option value='ignore'> IGNORE </option>"; + } + + + $template->assign(array("POOLDN" => $pool['dn'], + "CN" => $pool['cn'], + "SUBNETDN" => $pool['dhcphlpcont'], + "SUBNET" => $subnet[0], + "DESCRIPTION" => $pool['description'], + "STATEMENTS" => $pool['dhcpstatements'], + "UCSELECT" => $ucselectbox, + "UCNOW" => $unknownclients, + "ALLOW" => $pool['dhcpoptallow'], + "DENY" => $pool['dhcpoptdeny'], + "IGNORE" => $pool['dhcpoptignore'], + "DEFAULTLEASE" => $pool['dhcpoptdefault-lease-time'], + "MAXLEASE" => $pool['dhcpoptmax-lease-time'], + "MNR" => $mnr)); + $template->parse("DHCPPOOLS_LIST", ".Dhcppools"); + #$template->clear_dynamic("Dhcppools"); + + +} + +################################################################################### + +include("dhcp_footer.inc.php"); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcppool_add.php b/ldap-site-mngmt/webinterface/dhcp/dhcppool_add.php new file mode 100644 index 00000000..c6cef33a --- /dev/null +++ b/ldap-site-mngmt/webinterface/dhcp/dhcppool_add.php @@ -0,0 +1,98 @@ +<?php +include('../standard_header.inc.php'); + +$syntax = new Syntaxcheck; + +$range1 = $_POST['addrange1']; +$range2 = $_POST['addrange2']; +$unknownclients = $_POST['unknownclients']; +$mnr = $_POST['mnr']; + +$seconds = 200; +$url = "dhcppool.php?mnr=".$mnr; + +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 ($syntax->check_ip_syntax($range1) && $syntax->check_ip_syntax($range2)){ + + $fs = explode('.',$range1); + $fe = explode('.',$range2); + if ( $fs[0] == $fe[0] && $fs[1] == $fe[1] && $fs[2] == $fe[2] ) { + if ( $fs[3] <= $fe[3] ){ + # Range zusammenstellen + $range = implode("_", array($range1,$range2)); + + # Freie IP Bereiche testen + $fipb_array = get_freeipblocks_au($auDN); + for ($i=0; $i < count($fipb_array); $i++){ + if ( split_iprange($range,$fipb_array[$i]) != 0 ){ + $ipranges = split_iprange($range,$fipb_array[$i]); + array_splice($fipb_array, $i, 1, $ipranges); + break; + } + } + if ($i < count($fipb_array) ){ + foreach ( $fipb_array as $item ){ + $entry ['FreeIPBlock'][] = $item; + } + $results = ldap_mod_replace($ds,$auDN,$entry); + if ($results){ + echo "<br>Neue FIPBs erfolgreich eingetragen!<br>"; + + # DHCP Subnet DN finden + $subnet = implode(".", array($fs[0],$fs[1],$fs[2],"0")); + print_r($subnet);echo"<br><br>"; + if(!($result = uniLdapSearch($ds, "ou=RIPM,".$suffix, "(&(objectclass=dhcpSubnet)(cn=$subnet))", array("dn","dhcphlpcont"), "", "sub", 0, 0))) { + # redirect(5, "", $ldapError, FALSE); + echo "no search"; + die; + } + $result = ldapArraySauber($result); + print_r($result);echo "<br><br>"; + if (count($result[0]) != 0){ + $result = add_dhcppool($result[0]['dn'],$range,$unknownclients,$result[0]['dhcphlpcont']); + if ($result){ + echo "<br>Dynamischer DHCP Pool erfolgreich eingetragen!<br>" ; + update_dhcpmtime(); + }else{ + echo "<br>Fehler beim eintragen des dynamischen DHCP Pools!<br>"; + # Range wieder in FIPBs aufnehmen. + $entry2 ['FreeIPBlock'] = $range; + ldap_mod_add($ds,$auDN,$entry2); + merge_ipranges($auDN); + } + }else{ + echo "DHCP Subnet nicht im System vorhanden!<br>"; + } + }else{ + echo "<br>Fehler beim eintragen der FIPBs!<br>"; + } + }else{ + printf("<br>IP Range %s ist nicht im verfuegbaren Bereich!<br>", $range ); + } + }else{ + echo "erster Range Wert grösser als zweiter Range Wert<br>"; + } + }else{ + echo "Range nicht im gleichen Subnetz<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=".$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/dhcppools_change.php b/ldap-site-mngmt/webinterface/dhcp/dhcppools_change.php new file mode 100644 index 00000000..b0ed4210 --- /dev/null +++ b/ldap-site-mngmt/webinterface/dhcp/dhcppools_change.php @@ -0,0 +1,277 @@ +<?php +include('../standard_header.inc.php'); + +$syntax = new Syntaxcheck; + +$pooldn = $_POST['pooldn']; +$subnet = $_POST['subnet']; +$delpool = $_POST['delpool']; +$poolranges = array(); +foreach ($pooldn as $dn){ + $poolranges [$dn] = get_dhcppoolranges($dn); +} +$range1 = $_POST['range1']; +$range2 = $_POST['range2']; +$oldrange1 = $_POST['oldrange1']; +$oldrange2 = $_POST['oldrange2']; +$rangepooldn = $_POST['rangepooldn']; +$addrange1 = $_POST['addrange1']; +$addrange2 = $_POST['addrange2']; +$uc = $_POST['unknownclients']; +$olduc = $_POST['olduc']; + +#print_r($pooldn); echo "<br>"; +#print_r($subnet); echo "<br>"; +#print_r($delpool); echo "<br><br>"; +#print_r($oldrange1); echo "<br>"; +#print_r($oldrange2); echo "<br>"; +#print_r($range1); echo "<br>"; +#print_r($range2); echo "<br>"; +#print_r($rangepooldn); echo "<br><br>"; +#print_r($addrange1); echo "<br>"; +#print_r($addrange2); echo "<br><br>"; +#print_r($olduc); echo "<br><br>"; +#print_r($uc); echo "<br><br>"; + +$mnr = $_POST['mnr']; + +$seconds = 2000; +$url = "dhcppool.php?mnr=".$mnr; + +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>"; + + +for ($i=0;$i<count($delpool);$i++){ + # Löschen und Arrays $pooldn, $uc, ... und $rpooldn anpassen zur weiteren Verarbeitung + + $key = array_keys ( $pooldn, $delpool[$i] ); + $key_r = array_keys ( $rangepooldn, $delpool[$i] ); + + # Ranges wieder in FIPBs aufnehmen + if (count($key_r) > 1){ + foreach ($key_r as $item){ + $modentry['FreeIPBlock'][] = $oldrange1[$item]."_".$oldrange2[$item]; + } + }else{ + $modentry['FreeIPBlock'] = $oldrange1[$key_r[0]]."_".$oldrange2[$key_r[0]]; + } + print_r($modentry); echo "<br><br>"; + $add_fipb = ldap_mod_add($ds,$auDN,$modentry); + if ($add_fipb){ + echo "<br>geloeschte IP Range(s) erfolgreich als neuer FIPB in die AU eingetragen!<br>" ; + merge_ipranges($auDN); + + $delete = ldap_delete($ds,$delpool[$i]); + if ($delete){ + # Arrays von gelöschten Pools für weitere Verarbeitung bereinigen + foreach ( $key as $nr ){ + array_splice ( &$pooldn, $nr, 1 ); + array_splice ( &$addrange1, $nr, 1 ); + array_splice ( &$addrange2, $nr, 1 ); + array_splice ( &$uc, $nr, 1 ); + array_splice ( &$olduc, $nr, 1 ); + } + # da sich Arrays verkleinern, Wert in $key_r entsprechend verkleinern, + $j=0; # Variable $j als Zähler um wieviel + foreach ( $key_r as $nr ){ + array_splice ( &$rangepooldn, $nr-$j, 1 ); + array_splice ( &$range1, $nr-$j, 1 ); + array_splice ( &$range2, $nr-$j, 1 ); + array_splice ( &$oldrange1, $nr-$j, 1 ); + array_splice ( &$oldrange2, $nr-$j, 1 ); + $j++; + } + printf("Pool <b>%s</b> erfolgreich gelöscht<br>", $delpool[$i]); + }else{ + printf("Fehler beim Löschen des Pools <b>%s</b>", $delpool[$i]); + } + }else{ + echo "<br>Fehler beim eintragen der geloeschten IP Range(s) als neuen FIPB! <br>DHCP Pool nicht gelöscht<br>"; + } +} + + +for ($i=0;$i<count($pooldn);$i++){ + + $entrydel = array(); + $entryadd = array(); + # DENY, ALLOW, IGNORE Unknown-clients verarbeiten + if ( $uc[$i] != $olduc[$i] ){ + printf("Unknown-Clients für Pool %s ändern<br>", $pooldn[$i]); + $dhcpoptdel = "dhcpopt".$olduc[$i]; + $entrydel [$dhcpoptdel] = array(); + print_r($entrydel); echo "<br>"; + ldap_mod_del($ds,$pooldn[$i],$entrydel); + $dhcpoptadd = "dhcpopt".$uc[$i]; + $entryadd [$dhcpoptadd] = "unknown-clients"; + print_r($entryadd); echo "<br><br>"; + ldap_mod_add($ds,$pooldn[$i],$entryadd); + } + # Ranges hinzufügen + if ( $addrange1[$i] != "" && $addrange2[$i] != "" ){ + if ($syntax->check_ip_syntax($addrange1[$i]) && $syntax->check_ip_syntax($addrange2[$i])){ + $net = strrev(strchr(strrev($subnet[$i]), ".")); + $add1 = strrev(strchr(strrev($addrange1[$i]), ".")); + $add2 = strrev(strchr(strrev($addrange2[$i]), ".")); + if ( $net == $add1 && $net == $add2 ){ + + printf("Range in Pool %s hinzufügen<br>",$pooldn[$i]); + # Range zusammenstellen + $newrange = implode("_", array($addrange1[$i],$addrange2[$i])); + $result = add_dhcprange($newrange,$pooldn[$i]); + if ($result){ + printf("Neue dynamische IP Range %s - %s erfolgreich in Subnetz %s0 eingetragen!<br>",$addrange1[$i],$addrange2[$i],$net); + }else{ + echo "<br>Fehler beim eintragen des dynamischen DHCP Pools!<br>"; + } + + }else{ + printf("Neue Range %s - %s nicht in Subnetz %s0",$addrange1[$i],$addrange2[$i],$net); + } + }else{ + printf("falsche IP Syntax der neuen Range %s - %s<br>", $addrange1[$i],$addrange2[$i]); + } + } + +} + +# bereits angelegte Ranges verarbeiten (löschen, verkleinern, vergrößern) +$fipbs = get_freeipblocks_au($auDN); +$new_fipbs ['freeipblock'] = $fipbs; +$mod_dhcpranges = array(); + +for ($i=0;$i<count($rangepooldn);$i++){ + + $range = implode('_',array($range1[$i],$range2[$i])); + $oldrange = implode('_',array($oldrange1[$i],$oldrange2[$i])); + + if ( $oldrange1[$i] != "" && $oldrange2[$i] != "" && $range1[$i] == "" && $range2[$i] == "" ){ + # Range löschen + $mod_dhcpranges [$rangepooldn[$i]] = $poolranges [$rangepooldn[$i]]; + $range_key = array_search ( $oldrange, $mod_dhcpranges[$rangepooldn[$i]] ); + #print_r($range_key); echo "<br>"; + array_splice ( &$mod_dhcpranges[$rangepooldn[$i]], $range_key, 1 ); + array_splice ( &$poolranges[$rangepooldn[$i]], $range_key, 1 ); + $new_fipbs ['freeipblock'][] = $oldrange; + } + elseif ( $oldrange1[$i] != "" && $oldrange2[$i] != "" && $range1[$i] != "" && $range2[$i] != "" ){ + $or1 = ip2long($oldrange1[$i]); + $or2 = ip2long($oldrange2[$i]); + $nr1 = ip2long($range1[$i]); + $nr2 = ip2long($range2[$i]); + + if ( ($nr1 > $or1 || $nr2 < $or2) && !($nr1 < $or1 || $nr2 > $or2) ){ + if ($syntax->check_ip_syntax($range1[$i]) && $syntax->check_ip_syntax($range2[$i])){ + # Range verkleinern + $diffrange = split_iprange($range,$oldrange); + echo "<br>diffrange: "; print_r($diffrange); echo "<br>"; + # array $poolranges aktualisieren (neue Ranges) + $mod_dhcpranges [$rangepooldn[$i]] = $poolranges [$rangepooldn[$i]]; + $range_key = array_search ( $oldrange, $mod_dhcpranges [$rangepooldn[$i]] ); + #print_r($range_key); echo "<br>"; + $poolranges [$rangepooldn[$i]][$range_key] = $range; + $mod_dhcpranges [$rangepooldn[$i]][$range_key] = $range; + + foreach ($diffrange as $dr){ + $new_fipbs ['freeipblock'][] = $dr; + } + }else{ + printf("falsche IP Syntax der neuen Range %s - %s<br>", $range1[$i],$range2[$i]); + } + } + elseif( ($nr1 < $or1 || $nr2 > $or2) && !($nr1 > $or1 || $nr2 < $or2) ){ + if ($syntax->check_ip_syntax($range1[$i]) && $syntax->check_ip_syntax($range2[$i])){ + # Range vergrößern + $addrange = split_iprange($oldrange,$range); + echo "addrange: "; print_r($addrange); echo "<br>"; + $mod_dhcpranges [$rangepooldn[$i]] = $poolranges [$rangepooldn[$i]]; + + foreach ($addrange as $ar){ + $test = 0; + for ($c=0; $c < count($new_fipbs['freeipblock']); $c++){ + if ( split_iprange($ar,$new_fipbs['freeipblock'][$c]) != 0 ){ + $ipranges = split_iprange($ar,$new_fipbs['freeipblock'][$c]); + array_splice($new_fipbs['freeipblock'], $c, 1, $ipranges); + $test = 1; + break; + } + } + if ( $test ){ + $poolranges [$rangepooldn[$i]][] = $ar; + $mod_dhcpranges [$rangepooldn[$i]][] = $ar; + } + } + }else{ + printf("falsche IP Syntax der neuen Range %s - %s<br>", $range1[$i],$range2[$i]); + } + } + #else{ + # $mesg = "<br>Verschieben (Shiften) einer IP Range 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='dhcppool.php' style='publink'>back</a>"; + # redirect($seconds, $url, $mesg, $addSessionId = TRUE); + #} + } +} + +#print_r($mod_dhcpranges); echo "<br>"; +#print_r($new_fipbs); echo "<br><br>"; +$keys = array_keys($mod_dhcpranges); +foreach ($keys as $pdn){ + #print_r($pdn); echo "<br>"; + #print_r($mod_dhcpranges[$pdn]); echo "<br>"; + if ( count($mod_dhcpranges[$pdn]) == 0 ){ + printf("Pool %s löschen<br>",$pdn); + if ($res = ldap_delete($ds,$pdn)){ + printf("Pool %s erfolgreich gelöscht",$pdn); + }else{ + printf("Fehler beim Löschen von %s",$pdn); + } + }else{ + echo "Pool Ranges anpassen<br>"; + foreach ($mod_dhcpranges[$pdn] as $rg){ + $modpool ['dhcprange'][] = $rg; + } + #print_r($modpool); echo "<br>"; + $modpool ['dhcprange'] = merge_ipranges_array($modpool ['dhcprange']); + print_r($modpool); echo "<br>"; + if ($res = ldap_mod_replace($ds,$pdn,$modpool)){ + printf("Pool Ranges von %s erfolgreich angepasst",$pdn); + }else{ + printf("Fehler beim Anpassen der Pool Ranges von %s",$pdn); + } + } +} + +$diff = array_diff( $new_fipbs['freeipblock'], $fipbs ); +$revdiff = array_diff( $fipbs, $new_fipbs['freeipblock'] ); +if ( count($diff) != 0 || count($revdiff) != 0 ){ + echo "<br>FIPBS anpassen<br>"; + #print_r($new_fipbs['freeipblock']); echo "<br>"; + $new_fipbs['freeipblock'] = merge_ipranges_array($new_fipbs['freeipblock']); + print_r($new_fipbs); echo "<br>"; + if ($res = ldap_mod_replace($ds,$auDN,$new_fipbs)){ + printf("FIPBs erfolgreich angepasst"); + }else{ + printf("Fehler beim Anpassen der FIPBs"); + } +} +# DHCP Modify Timestamp festhalten +update_dhcpmtime(); + +$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.php b/ldap-site-mngmt/webinterface/dhcp/dhcpservice.php index 144ae183..388f01ff 100644 --- a/ldap-site-mngmt/webinterface/dhcp/dhcpservice.php +++ b/ldap-site-mngmt/webinterface/dhcp/dhcpservice.php @@ -22,6 +22,8 @@ $mnr = $_GET['mnr']; createMainMenu($rollen, $mainnr); createDhcpMenu($rollen, $mnr, $auDN, $sbmnr); +include("ip_blocks.inc.php"); + ################################################################################### $template->assign(array("DHCPDN" => "", diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcpservice_add.php b/ldap-site-mngmt/webinterface/dhcp/dhcpservice_add.php index bcb5899e..ecaa27d9 100644 --- a/ldap-site-mngmt/webinterface/dhcp/dhcpservice_add.php +++ b/ldap-site-mngmt/webinterface/dhcp/dhcpservice_add.php @@ -19,7 +19,7 @@ $sbmnr = $_POST['sbmnr']; $mcnr = $_POST['mcnr']; $get_dhcpcn = str_replace ( " ", "_", $cn ); -$seconds = 200; +$seconds = 2; $url = "new_dhcpservice.php?&mnr=1"; echo " diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcpservice_change.php b/ldap-site-mngmt/webinterface/dhcp/dhcpservice_change.php index 55e51cd9..4b17dec9 100644 --- a/ldap-site-mngmt/webinterface/dhcp/dhcpservice_change.php +++ b/ldap-site-mngmt/webinterface/dhcp/dhcpservice_change.php @@ -35,7 +35,7 @@ $mcnr = $_POST['mcnr']; #$deltr = $_POST['deltr']; -$seconds = 200; +$seconds = 2; $url = "dhcpservice.php?dn=".$dhcpdn."&mnr=1"; echo " @@ -133,6 +133,7 @@ if ( $adddhcpoptdefinition != "" ){ $entryadd['optiondefinition'] = $adddhcpoptdefinition; if(ldap_mod_add($ds,$dhcpDN,$entryadd)){ $mesg = "Selbst-definierte DHCP Option erfolgreich eingetragen<br><br>"; + update_dhcpmtime(); }else{ $mesg = "Fehler beim eintragen Selbst-definierte DHCP Option<br><br>"; } @@ -175,6 +176,7 @@ if (count($entryadd) != 0 ){ } if(ldap_mod_add($ds,$dhcpDN,$entryadd)){ $mesg = "Attribute ".$addatts." erfolgreich eingetragen<br><br>"; + update_dhcpmtime(); }else{ $mesg = "Fehler beim eintragen der Attribute ".$addatts."<br><br>"; } @@ -186,6 +188,7 @@ if (count($entrymod) != 0 ){ } if(ldap_mod_replace($ds,$dhcpDN,$entrymod)){ $mesg = "Attribute ".$modatts." erfolgreich geaendert<br><br>"; + update_dhcpmtime(); }else{ $mesg = "Fehler beim aendern der Attribute ".$modatts."<br><br>"; } @@ -197,6 +200,7 @@ if (count($entrydel) != 0 ){ } if(ldap_mod_del($ds,$dhcpDN,$entrydel)){ $mesg = "Attribute ".$delatts." erfolgreich geloescht<br><br>"; + update_dhcpmtime(); }else{ $mesg = "Fehler beim loeschen der Attribute ".$delatts."<br><br>"; } diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcpservice_delete.php b/ldap-site-mngmt/webinterface/dhcp/dhcpservice_delete.php index 36260cd1..3d121397 100644 --- a/ldap-site-mngmt/webinterface/dhcp/dhcpservice_delete.php +++ b/ldap-site-mngmt/webinterface/dhcp/dhcpservice_delete.php @@ -4,7 +4,7 @@ include('../standard_header.inc.php'); $dhcpDN = $_POST['dn']; $dhcpcn = $_POST['name']; -$seconds = 100; +$seconds = 2; $url = "dhcpservice.php?mnr=1"; echo " diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet.dwt b/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet.dwt index d35b3d30..0f16f966 100644 --- a/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet.dwt +++ b/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet.dwt @@ -1,9 +1,11 @@ <table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> - <td colspan='2'><h3>DHCP Subnet <code class='font_object'> {CN} </code> </h3></td> + <td colspan='4' height='20'><h4><a href='dhcpsubnets.php?mnr={MNR}' class='headerlink'><< Zurück zur Übersicht </a></h4></td> </tr> + <tr> - <td height='20'></td> + <td colspan='2'><h3>DHCP Subnet <code class='font_object'> {CN} </code> </h3></td> </tr> <tr><td> <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> @@ -31,7 +33,7 @@ </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 style='border-color: black; border-style: solid; border-width: 0 0 0 0;'>{DHCPSVNOW} </td> </tr> <tr height='50' valign='top'> @@ -60,7 +62,7 @@ </table></td> </tr> - <tr> + <!--<tr> <td height='40'></td> </tr> <tr> @@ -88,7 +90,7 @@ <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> </td> </tr> </table></td> - </tr> + </tr>--> <tr> <td height='40'></td> @@ -96,9 +98,6 @@ <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;'> @@ -203,6 +202,7 @@ <input type='hidden' name='dn' value='{SUBNETDN}'> <input type='hidden' name='name' value='{CN}'> + <input type='hidden' name='mnr' value='{MNR}'> <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}'> diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet.php b/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet.php index 235667aa..ee3338ef 100644 --- a/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet.php +++ b/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet.php @@ -5,7 +5,7 @@ include('../standard_header.inc.php'); $titel = "DHCP Service Management"; # 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. $mainnr = 5; -$mnr = 0; +$mnr = -1; $sbmnr = -1; # 3. Dateiname und evtl. Pfad des Templates für die Webseite $webseite = "dhcpsubnet.dwt"; @@ -17,12 +17,14 @@ include('dhcp_header.inc.php'); ################################################################################### $mnr = $_GET['mnr']; -$sbmnr = $_GET['sbmnr']; +#$sbmnr = $_GET['sbmnr']; # Menuleisten erstellen createMainMenu($rollen, $mainnr); createDhcpMenu($rollen, $mnr, $auDN, $sbmnr); +include("ip_blocks.inc.php"); + ################################################################################### $template->assign(array("SUBNETDN" => "", @@ -50,7 +52,6 @@ $template->assign(array("SUBNETDN" => "", "OPTGENERIC" => "", "DHCPOFFERNOWDN" => "", "DHCPSVNOW" => "", - "DHCPSVNOWAU" => "", "MNR" => $mnr, "SBMNR" => $sbmnr, "MCNR" => $mcnr)); @@ -67,7 +68,12 @@ $subnet_data = get_node_data($dhcpsubnetDN, $attributes); #print_r($subnet_data); # momentane DHCP Service Zuordnung -$dhcpsvnowdn = ldap_explode_dn($subnet_data['dhcphlpcont'], 1); +if ($subnet_data['dhcphlpcont'] != ""){ + $dhcpsvnowdn = ldap_explode_dn($subnet_data['dhcphlpcont'], 1); + $dhcpsvnow = "<b>".$dhcpsvnowdn[0]."</b> [AU: ".$dhcpsvnowdn[2]."]"; +}else{ + $dhcpsvnow = "<b>–</b>"; +} # DHCP Range $iprange = explode('_',$subnet_data['dhcprange']); @@ -96,8 +102,7 @@ $template->assign(array("SUBNETDN" => $dhcpsubnetDN, "NTPSERVERS" => $subnet_data['dhcpoptntp-servers'], "OPTGENERIC" => $subnet_data['dhcpoptgeneric'], "DHCPOFFERNOWDN" => $subnet_data['dhcphlpcont'], - "DHCPSVNOW" => $dhcpsvnowdn[0], - "DHCPSVNOWAU" => $dhcpsvnowdn[2], + "DHCPSVNOW" => $dhcpsvnow, "MNR" => $mnr, "SBMNR" => $sbmnr, "MCNR" => $mcnr)); @@ -110,7 +115,7 @@ $template->assign(array("DHCPSVDN" => "", "DHCPSVCN" => "", "DHCPSVAU" => "")); if (count($altdhcp) != 0){ -$template->define_dynamic("Dhcpservices", "Webseite"); + $template->define_dynamic("Dhcpservices", "Webseite"); foreach ($altdhcp as $item){ $template->assign(array("DHCPSVDN" => $item['dn'], "DHCPSVCN" => $item['cn'], diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet_add.php b/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet_add.php index 6939afe0..5fdc0dec 100644 --- a/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet_add.php +++ b/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet_add.php @@ -3,12 +3,17 @@ include('../standard_header.inc.php'); $syntax = new Syntaxcheck; -$cn = $_POST['cn']; -$netmask = $_POST['netmask']; -$dhcpservice = $_POST['dhcpservice']; -$range1 = $_POST['range1']; -$range2 = $_POST['range2']; +$subnet = $_POST['dhcpsubnet']; +$subnetexp = explode("|",$subnet); +$cn = $subnetexp[0]; +$netmask = $subnetexp[1]; +#print_r($subnet); echo "<br><br>"; +#print_r($cn); echo "<br><br>"; +#print_r($netmask); echo "<br><br>"; +$dhcpservice = $_POST['dhcpservice']; +#$range1 = $_POST['range1']; +#$range2 = $_POST['range2']; # sonstige Attribute $attribs = $_POST['attribs']; if (count($attribs) != 0){ @@ -23,7 +28,7 @@ $mnr = $_POST['mnr']; $sbmnr = $_POST['sbmnr']; $get_dhcpcn = str_replace ( " ", "_", $cn ); -$seconds = 200; +$seconds = 2; $url = "new_dhcpsubnet.php?&mnr=2"; echo " @@ -40,16 +45,16 @@ if ( $cn != "" && $cn != "Hier_Subnetz_eintragen" && $netmask != "" && $netmask if ( $syntax->check_netip_syntax($cn) && $syntax->check_ip_syntax($netmask) ){ - if (add_dhcpsubnet ($cn,$dhcpservice,$netmask,$range1,$range2,$atts)){ + if (add_dhcpsubnet ($cn,$dhcpservice,$netmask,$atts)){ $mesg .= "<br>DHCP Subnet erfolgreich angelegt<br>"; - $url = "dhcpsubnets.php?mnr=2"; + $url = "dhcpsubnets.php?mnr=".$mnr; }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"; + $url = "new_dhcpsubnet.php?subnetcn=Hier_Subnetz_eintragen&netmask=".$netmask."&mnr=".$mnr; } } @@ -59,7 +64,7 @@ elseif ( $cn == "" || $cn == "Hier_Subnetz_eintragen" || $netmask == "" || $netm 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"; + $url = "new_dhcpsubnet.php?subnetcn=".$cn."&netmask=".$netmask."&mnr=".$mnr; } $mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet_change.php b/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet_change.php index b0dc13c7..ded54e2c 100644 --- a/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet_change.php +++ b/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet_change.php @@ -37,7 +37,7 @@ $mnr = $_POST['mnr']; $sbmnr = $_POST['sbmnr']; $mcnr = $_POST['mcnr']; -$seconds = 200; +$seconds = 2; $url = "dhcpsubnet.php?dn=".$subnetDN."&mnr=".$mnr."&sbmnr=".$sbmnr; echo " @@ -283,6 +283,8 @@ if (count($entrydel) != 0 ){ } +update_dhcpmtime(); + $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); diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet_delete.php b/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet_delete.php index eb5d66aa..5bbe10d0 100644 --- a/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet_delete.php +++ b/ldap-site-mngmt/webinterface/dhcp/dhcpsubnet_delete.php @@ -3,9 +3,10 @@ include('../standard_header.inc.php'); $subnetDN = $_POST['dn']; $cn = $_POST['name']; +$mnr = $_POST['mnr']; -$seconds = 100; -$url = "dhcpsubnets.php?mnr=2"; +$seconds = 1; +$url = "dhcpsubnets.php?mnr=".$mnr; echo " <html> @@ -20,6 +21,7 @@ echo " if ( $subnetDN != ""){ if( delete_dhcpsubnet($subnetDN,$cn)){ $mesg = "Subnet <b>".$cn."</b> erfolgreich gelöscht!<br><br>"; + update_dhcpmtime(); }else{ $mesg = "Fehler beim löschen des Subnets <b>".$cn."</b> !<br><br>"; } diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcpsubnets.dwt b/ldap-site-mngmt/webinterface/dhcp/dhcpsubnets.dwt index e887509d..76c2913f 100644 --- a/ldap-site-mngmt/webinterface/dhcp/dhcpsubnets.dwt +++ b/ldap-site-mngmt/webinterface/dhcp/dhcpsubnets.dwt @@ -3,30 +3,22 @@ <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> + <td width='15%' 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 Service</b></td> + <td width='45%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Dynamic Pools (IP Ranges)</b></td> </tr> <!-- BEGIN DYNAMIC BLOCK: Subnets --> - <tr height='50'> + <tr height='45' valign='top'> <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> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>{POOLS} </td> </tr> <!-- END DYNAMIC BLOCK: Subnets --> diff --git a/ldap-site-mngmt/webinterface/dhcp/dhcpsubnets.php b/ldap-site-mngmt/webinterface/dhcp/dhcpsubnets.php index 1104f496..d0d61aa5 100644 --- a/ldap-site-mngmt/webinterface/dhcp/dhcpsubnets.php +++ b/ldap-site-mngmt/webinterface/dhcp/dhcpsubnets.php @@ -6,7 +6,7 @@ include('../standard_header.inc.php'); $titel = "DHCP Service Management"; # 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. $mainnr = 5; -$mnr = 2; +$mnr = -1; $sbmnr = -1; $mcnr = -1; # 3. Dateiname und evtl. Pfad des Templates für die Webseite @@ -18,42 +18,73 @@ include('dhcp_header.inc.php'); ################################################################################### +$mnr = $_GET['mnr']; + # Menuleisten erstellen createMainMenu($rollen, $mainnr); createDhcpMenu($rollen, $mnr, $auDN, $sbmnr); +include("ip_blocks.inc.php"); + ################################################################################### $template->assign(array("SUBNETDN" => "", "SUBNETCN" => "Noch keine Subnets angelegt", "NETMASK" => "", "DHCP" => "", - "RANGE" => "", - "HOSTS" => "")); + "POOLS" => "")); # rbservice und pxe daten (voerst nur ein rbs) $subnet_array = get_dhcpsubnets($auDN,array("dn","cn","dhcpoptnetmask","dhcprange","dhcphlpcont")); $template->define_dynamic("Subnets", "Webseite"); +$template->define_dynamic("Pools", "Webseite"); + foreach ($subnet_array as $subnet){ - $range = ""; - if ($subnet['dhcprange'] != ""){ - $exp = explode('_',$subnet['dhcprange']); - $range = $exp[0]." - ".$exp[1]; + # Pools des Subnetzes + $pools = get_dhcppools_subnet($subnet['dn'],array("dhcprange","dhcpoptallow","dhcpoptdeny","dhcpoptignore")); + #print_r($pools); echo "<br><br>"; + $poollist = "<ul>"; + foreach ($pools as $pool){ + $poollist .= "<li>"; + if (count($pool['dhcprange']) >1){ + for ($i=0; $i<count($pool['dhcprange']); $i++){ + $range = explode('_',$pool['dhcprange'][$i]); + $poollist .= $range[0]." - ".$range[1]; + if ($i+1 != count($pool['dhcprange'])){ + $poollist .= "<br>"; + } + } + }else{ + $range = explode('_',$pool['dhcprange']); + $poollist .= $range[0]." - ".$range[1]; + } + if ($pool['dhcpoptallow'] != ""){ + $poollist .= "<br>ALLOW ".$pool['dhcpoptallow']; + } + if ($pool['dhcpoptignore'] != ""){ + $poollist .= "<br>IGNORE ".$pool['dhcpoptignore']; + } + if ($pool['dhcpoptdeny'] != ""){ + $poollist .= "<br>DENY ".$pool['dhcpoptdeny']; + } + $poollist .= " [Abt.: ".$pool['poolAU']."]</li><br>"; } + $poollist .= "</ul>"; + + # Dienstzuordnung des Subnetzes + $dhcpservice = ""; if ($subnet['dhcphlpcont'] != ""){ $exp = ldap_explode_dn($subnet['dhcphlpcont'],1); $dhcpservice = $exp[0]." [".$exp[2]."]"; - }else{ - $dhcpservice = ""; } + $subnetcn = "<a href='dhcpsubnet.php?dn=".$subnet['dn']."&mnr=".$mnr."' class='headerlink'><b>".$subnet['cn']."</b></a>"; $template->assign(array("SUBNETDN" => $subnet['dn'], - "SUBNETCN" => $subnet['cn'], + "SUBNETCN" => $subnetcn, "NETMASK" => $subnet['dhcpoptnetmask'], "DHCP" => $dhcpservice, - "RANGE" => $range, - "HOSTS" => "")); + "POOLS" => $poollist)); $template->parse("SUBNETS_LIST", ".Subnets"); } diff --git a/ldap-site-mngmt/webinterface/dhcp/ip_blocks.inc.php b/ldap-site-mngmt/webinterface/dhcp/ip_blocks.inc.php new file mode 100644 index 00000000..8530e079 --- /dev/null +++ b/ldap-site-mngmt/webinterface/dhcp/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/dhcp/ipblocks.dwt b/ldap-site-mngmt/webinterface/dhcp/ipblocks.dwt new file mode 100644 index 00000000..b77f53b3 --- /dev/null +++ b/ldap-site-mngmt/webinterface/dhcp/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/dhcp/new_dhcpsubnet.dwt b/ldap-site-mngmt/webinterface/dhcp/new_dhcpsubnet.dwt index 8b710fb8..7cf7f42c 100644 --- a/ldap-site-mngmt/webinterface/dhcp/new_dhcpsubnet.dwt +++ b/ldap-site-mngmt/webinterface/dhcp/new_dhcpsubnet.dwt @@ -11,26 +11,27 @@ <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> + <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 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> + <tr height='50' valign='top'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>DHCP Subnet (+ Netmask):</b><br> + (Noch freie verfügbare Netze) </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'> + <select name='dhcpsubnet' size='{SUBLIST}' class='medium_form_selectbox'> + + <!-- BEGIN DYNAMIC BLOCK: Dhcpsubnets --> + <option value='{SUBNET}'>{CN} / {NETMASK}</option> + <!-- END DYNAMIC BLOCK: Dhcpsubnets --> + + </select> </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'> + <select name='dhcpservice' size='{SRVLIST}' class='medium_form_selectbox'> <option selected value='none'>----------</option> <!-- BEGIN DYNAMIC BLOCK: Dhcpservices --> @@ -46,14 +47,14 @@ <input type='Text' name='attribs[description]' value='{DESCRIPTION}' size='50' class='medium_form_field'> </td> </tr> - <tr height='50'> + <!--<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> + </tr>--> </table></td> </tr> @@ -71,8 +72,8 @@ <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> + <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Option</b></td> + <td width='70%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert(e)</b></td> </tr> <tr height='50'> diff --git a/ldap-site-mngmt/webinterface/dhcp/new_dhcpsubnet.php b/ldap-site-mngmt/webinterface/dhcp/new_dhcpsubnet.php index a7697c14..adf7720f 100644 --- a/ldap-site-mngmt/webinterface/dhcp/new_dhcpsubnet.php +++ b/ldap-site-mngmt/webinterface/dhcp/new_dhcpsubnet.php @@ -23,14 +23,14 @@ $sbmnr = $_GET['sbmnr']; createMainMenu($rollen, $mainnr); createDhcpMenu($rollen, $mnr, $auDN, $sbmnr); +include("ip_blocks.inc.php"); + ################################################################################### $subnetcn = str_replace ( "_", " ", $_GET['subnetcn']); $netmask = str_replace ( "_", " ", $_GET['netmask']); $template->assign(array("CN" => $subnetcn, "NETMASK" => $netmask, - "RANGE1" => "", - "RANGE2" => "", "DESCRIPTION" => "", "STATEMENTS" => "", "ALLOW" => "", @@ -57,6 +57,30 @@ $template->assign(array("CN" => $subnetcn, +$freenets = get_networks(); +#print_r($freenets); +$subnets = array(); +if (count($freenets) != 0){ + $template->define_dynamic("Dhcpsubnets", "Webseite"); + + foreach ($freenets as $subnet){ + $netexp = explode(".",$subnet); + $mask = array(255,255,255,255); + for ($i=0; $i<count($netexp); $i++){ + if ($netexp[$i] == "0"){ + $mask[$i] = "0"; + } + } + $netmask = implode(".", $mask); + $subnets[] = $subnet."|".$netmask; + + $template->assign(array("SUBNET" => $subnet."|".$netmask, + "CN" => $subnet, + "NETMASK" => $netmask)); + $template->parse("DHCPSUBNETS_LIST", ".Dhcpsubnets"); + } + #print_r($subnets); + # DHCP Services $dhcpservices = get_dhcpoffers($auDN); #print_r($dhcpservices); echo "<br>"; @@ -76,6 +100,13 @@ $template->define_dynamic("Dhcpservices", "Webseite"); } } +$template->assign(array("SUBLIST" => count($freenets)+1, + "SRVLIST" => count($dhcpservices)+1)); + +}else{ + # keine freie Netze mehr zur Verfügung + # wird schon über das DHCP Menu abgefangen ... +} ################################################################################### diff --git a/ldap-site-mngmt/webinterface/dhcp/no_dhcp.dwt b/ldap-site-mngmt/webinterface/dhcp/no_dhcp.dwt index 5b8ffe4f..4e83f948 100644 --- a/ldap-site-mngmt/webinterface/dhcp/no_dhcp.dwt +++ b/ldap-site-mngmt/webinterface/dhcp/no_dhcp.dwt @@ -7,17 +7,19 @@ </tr> <tr> <td> - <p>Dieses Modul dient der Verwaltung des DHCP Dienstes und DHCP Subnetzen.<br> + <p>Verwaltung von DHCP Subnets, Pools (und Classes).<br> <br> - <b>Sie verfügen über keine kompletten Netzwerke!</b> <br> + <b>Sie verfügen über keine IP Adressen, so dass Sie keine dieser Objekte + anlegen bzw. verwalten können.</b><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> + 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). + Sie können jedoch ihre Rechner im zentralen DHCP Dienst eintragen, über das<br> + Modul <a class='headerlink' href='../computers/computers.php' >Rechner Management</a>. </td> </tr> diff --git a/ldap-site-mngmt/webinterface/dhcp/no_dhcp.php b/ldap-site-mngmt/webinterface/dhcp/no_dhcp.php index 57653255..2a09a6e7 100644 --- a/ldap-site-mngmt/webinterface/dhcp/no_dhcp.php +++ b/ldap-site-mngmt/webinterface/dhcp/no_dhcp.php @@ -20,6 +20,8 @@ include('dhcp_header.inc.php'); createMainMenu($rollen, $mainnr); createDhcpMenu($rollen, $mnr, $auDN, $sbmnr); +include("ip_blocks.inc.php"); + ################################################################################### include("dhcp_footer.inc.php"); |