summaryrefslogtreecommitdiffstats
path: root/ldap-site-mngmt/webinterface/dhcp/dhcpsubnets.php
blob: d0d61aa54a599a92279728919e5c70afc11b3102 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?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 = -1; 
$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');

###################################################################################

$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" => "",
								"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){
   # 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 .= " &nbsp;[Abt.: ".$pool['poolAU']."]</li><br>";
   }
   $poollist .= "</ul>";
   
   # Dienstzuordnung des Subnetzes 
   $dhcpservice = "";
   if ($subnet['dhcphlpcont'] != ""){
      $exp = ldap_explode_dn($subnet['dhcphlpcont'],1);
      $dhcpservice = $exp[0]." &nbsp;[".$exp[2]."]";
   }
   
   $subnetcn = "<a href='dhcpsubnet.php?dn=".$subnet['dn']."&mnr=".$mnr."' class='headerlink'><b>".$subnet['cn']."</b></a>";
	$template->assign(array("SUBNETDN" => $subnet['dn'],
									"SUBNETCN" => $subnetcn,
	   	        		      "NETMASK" => $subnet['dhcpoptnetmask'],
	   	        		      "DHCP" => $dhcpservice,
	   	        			   "POOLS" => $poollist));
	$template->parse("SUBNETS_LIST", ".Subnets");
}


###################################################################################

include("dhcp_footer.inc.php");

?>