]> git.ipfire.org Git - ipfire-2.x.git/blobdiff - html/cgi-bin/dhcp.cgi
DHCP Webseite angepasst damit beim speichern auch die rc links gesetzt werden
[ipfire-2.x.git] / html / cgi-bin / dhcp.cgi
index 06019f98b31871afba51e0a82e8c0c4b8eb5a9f1..6d88a7f46a7ffcc244096be448e9ceaf5fa5474f 100644 (file)
@@ -22,8 +22,8 @@
 use strict;
 
 # enable only the following on debugging purpose
-#use warnings;
-#use CGI::Carp 'fatalsToBrowser';
+use warnings;
+use CGI::Carp 'fatalsToBrowser';
 
 require '/var/ipfire/general-functions.pl';
 require "${General::swroot}/lang.pl";
@@ -44,12 +44,14 @@ our $filename3 = "${General::swroot}/dhcp/advoptions-list"; # Describe the allow
 my $errormessage = '';
 my $warnNTPmessage = '';
 my @nosaved=();
+my %color = ();
 
 #Basic syntax allowed for new Option definition. Not implemented: RECORDS & array of RECORDS 
 our $OptionTypes = 'boolean|((un)?signed )?integer (8|16|32)|ip-address|text|string|encapsulate \w+|array of ip-address';
 
 &Header::showhttpheaders();
-our @ITFs=('GREEN','BLUE');
+our @ITFs=('GREEN');
+if (&Header::blue_used()){push(@ITFs,'BLUE');}
 
 #Settings1 for the first screen box
 foreach my $itf (@ITFs) {
@@ -101,6 +103,7 @@ foreach my $itf (@ITFs) {
 &General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
 &General::readhash("${General::swroot}/main/settings", \%mainsettings);
 &General::readhash("${General::swroot}/time/settings", \%timesettings);
+&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
 
 #Get GUI values
 &Header::getcgihash(\%dhcpsettings);
@@ -539,7 +542,7 @@ print <<END
     <td width='25%' class='boldbase'><b><font color='${lc_itf}'>$Lang::tr{"$lc_itf interface"}</font></b></td>
     <td class='base'>$Lang::tr{'enabled'}
     <input type='checkbox' name='ENABLE_${itf}' $checked{'ENABLE'}{'on'} /></td>
-    <td width='25%' class='base'>$Lang::tr{'ip address'}/$Lang::tr{'netmask'}:</td><td><b>$netsettings{"${itf}_ADDRESS"}/$netsettings{"${itf}_NETMASK"}</b></td>
+    <td width='25%' class='base'>$Lang::tr{'ip address'}<br />$Lang::tr{'netmask'}:</td><td><b>$netsettings{"${itf}_ADDRESS"}<br />$netsettings{"${itf}_NETMASK"}</b></td>
 </tr><tr>
     <td width='25%' class='base'>$Lang::tr{'start address'}&nbsp;<img src='/blob.gif' alt='*' /></td>
     <td width='25%'><input type='text' name='START_ADDR_${itf}' value='$dhcpsettings{"START_ADDR_${itf}"}' /></td>
@@ -720,9 +723,9 @@ foreach my $line (@current1) {
     if ($dhcpsettings{'KEY1'} eq $key) {
        print "<tr bgcolor='${Header::colouryellow}'>";
     } elsif ($key % 2) {
-       print "<tr bgcolor='${Header::table2colour}'>";
+       print "<tr bgcolor='$color{'color22'}'>";
     } else {
-       print "<tr bgcolor='${Header::table1colour}'>"; 
+       print "<tr bgcolor='$color{'color20'}'>"; 
     }
 
     print <<END
@@ -918,9 +921,9 @@ foreach my $line (@current2) {
     if ($dhcpsettings{'KEY2'} eq $key) {
        print "<tr bgcolor='${Header::colouryellow}'>";
     } elsif ($key % 2) {
-       print "<tr bgcolor='${Header::table2colour}'>";
+       print "<tr bgcolor='$color{'color22'}'>";
     } else {
-       print "<tr bgcolor='${Header::table1colour}'>"; 
+       print "<tr bgcolor='$color{'color20'}'>"; 
     }
     my $TAG0 = '';
     my $TAG1 = '';
@@ -1011,6 +1014,32 @@ END
 
 &Header::closebox();
 
+&Header::openbox('100%', 'left', $Lang::tr{'arp table entries'});
+my @ip = qx(/sbin/ip neigh show | awk '{print \$1}');
+my @mac = qx(/sbin/ip neigh show | awk '{print \$5}');
+
+print <<END
+<hr />
+<table width='100%'>
+<tr>
+<td width='40%'><b>$Lang::tr{'ip address'}</b></td><td width='40%'><b>$Lang::tr{'mac address'}</b></td><td width='20%'>Optionen</td>
+</tr>
+END
+;
+my $i=0;
+
+foreach my $ip(@ip)
+{
+ print"<tr><form method='post' action='$ENV{'SCRIPT_NAME'}'><td><input type='hidden' name='FIX_ADDR' value='$ip' />$ip</td>";
+ print"<td><input type='hidden' name='FIX_MAC' value='@mac[$i]' />@mac[$i]</td>";
+ print"<td><input type='hidden' name='ACTION' value='$Lang::tr{'add'}2' /><input type='submit' name='SUBMIT' value='$buttontext' /></td></form></tr>";
+}
+
+
+print"</table>";
+
+&Header::closebox();
+
 
 foreach my $itf (@ITFs) {
     if ($dhcpsettings{"ENABLE_${itf}"} eq 'on') {
@@ -1172,7 +1201,7 @@ sub buildconf {
            }# foreach line
            print FILE "} #$itf\n";
 
-           system ('/bin/touch', "${General::swroot}/dhcp/enable_${lc_itf}");
+           system ('/usr/bin/touch', "${General::swroot}/dhcp/enable_${lc_itf}");
            &General::log("DHCP on ${itf}: " . $Lang::tr{'dhcp server enabled'})
        } else {
            unlink "${General::swroot}/dhcp/enable_${lc_itf}";
@@ -1198,7 +1227,9 @@ sub buildconf {
        }
     }
     close FILE;
-    system '/usr/local/bin/restartdhcp';
+    if ( $dhcpsettings{"ENABLE_GREEN"} eq 'on' || $dhcpsettings{"ENABLE_BLUE"} eq 'on' ) {system '/usr/local/bin/dhcpctrl enable >/dev/null 2>&1';}
+    else {system '/usr/local/bin/dhcpctrl disable >/dev/null 2>&1';}
+    system '/usr/local/bin/dhcpctrl restart >/dev/null 2>&1';
 }
 
 #