]> git.ipfire.org Git - ipfire-2.x.git/blobdiff - html/cgi-bin/wakeonlan.cgi
proxy: Drop support for throttling only certain mime types
[ipfire-2.x.git] / html / cgi-bin / wakeonlan.cgi
index 87d540cbbb5f9a6219ae86f9d5ae088356eed188..bb55add70f640e2ce390229db9559393bbd24878 100644 (file)
@@ -1,9 +1,23 @@
 #!/usr/bin/perl
-#
-# IPFire WakeOnLan-AddOn CGI
-#
-# This code is distributed under the terms of the GPL
-#
+###############################################################################
+#                                                                             #
+# IPFire.org - A linux based firewall                                         #
+# Copyright (C) 2007  Michael Tremer & Christian Schmidt                      #
+#                                                                             #
+# This program is free software: you can redistribute it and/or modify        #
+# it under the terms of the GNU General Public License as published by        #
+# the Free Software Foundation, either version 3 of the License, or           #
+# (at your option) any later version.                                         #
+#                                                                             #
+# This program is distributed in the hope that it will be useful,             #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+# GNU General Public License for more details.                                #
+#                                                                             #
+# You should have received a copy of the GNU General Public License           #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+###############################################################################
 
 use strict;
 
@@ -34,6 +48,11 @@ my @wol_devices = ();
 our $datafile = "/var/ipfire/wakeonlan/clients.conf";
 &ReadConfig;
 
+my %color = ();
+my %mainsettings = ();
+&General::readhash("${General::swroot}/main/settings", \%mainsettings);
+&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
+
 my %netsettings = ();
 &General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
 my %cgiparams = ();
@@ -152,7 +171,7 @@ if ( $cgiparams{'ACTION'} eq 'wakeup' )
 
   undef %cgiparams;
 
-  system("/usr/local/sbin/launch-ether-wake $mac $iface");
+  system("/usr/local/bin/launch-ether-wake $mac $iface");
 
   # make a box with info, 'refresh' to normal screen after 5 seconds
   if ( $refresh eq 'yes' )
@@ -213,7 +232,7 @@ else
 print <<END
 <table width='100%'>
 <tr>
-  <td width='15%' class='base'>$Lang::tr{'mac address'}:&nbsp;</td>
+  <td width='15%' class='base'>$Lang::tr{'mac address'}:&nbsp;<img src='/blob.gif' alt='*' /></td>
   <td width='40%'><input type='text' name='CLIENT_MAC' value='$cgiparams{'CLIENT_MAC'}' size='25' /></td>
   <td width='10%' class='base'>$Lang::tr{'interface'}:&nbsp;</td>
   <td align='left'>
@@ -237,16 +256,16 @@ print <<END
   </td>
 </tr>
 <tr>
-  <td width='15%' class='base'>$Lang::tr{'remark'}:&nbsp;<img src='/blob.gif' alt='*' /></td>
+  <td width='15%' class='base'>$Lang::tr{'remark'}:</td>
   <td colspan='4' align='left'><input type='text' name='CLIENT_COMMENT' value='$cgiparams{'CLIENT_COMMENT'}' size='40' /></td>
 </tr>
 </table>
+<br>
 <hr />
 <table width='100%'>
 <tr>
-  <td class='base' valign='top'><img src='/blob.gif' alt='*' /></td>
-  <td width='55%' class='base'>$Lang::tr{'this field may be blank'}</td>
-  <td width='40%' align='center'>
+  <td class='base' valign='top'><img src='/blob.gif' alt='*' />$Lang::tr{'required field'}</td>
+  <td width='40%' align='right'>
 END
 ;
 
@@ -273,16 +292,17 @@ print "</form>\n";
 &Header::openbox('100%', 'left', "$Lang::tr{'current devices'}");
 
 print <<END
-<table width='100%'>
+<table width='100%' class='tbl'>
 <tr>
-<td align='center' width='20%'><b>$Lang::tr{'mac address'}</b></td>
-<td align='center' width='10%'><b>$Lang::tr{'interface'}</b></td>
-<td align='center' width='60%'><b>$Lang::tr{'remark'}</b></td>
-<td align='center' colspan='2'><b>$Lang::tr{'action'}</b></td>
+<th align='center' width='20%'><b>$Lang::tr{'mac address'}</b></th>
+<th align='center' width='10%'><b>$Lang::tr{'interface'}</b></th>
+<th align='center' width='60%'><b>$Lang::tr{'remark'}</b></th>
+<th align='center' colspan='2'><b>$Lang::tr{'action'}</b></th>
+<th></th>
 </tr>
 END
 ;
-
+my $col="";
 for $i ( 0 .. $#wol_devices )
 {
   my $wol_mac = $wol_devices[$i]{'MAC'};
@@ -291,22 +311,25 @@ for $i ( 0 .. $#wol_devices )
 
   if ( (($cgiparams{'ACTION'} eq 'edit') || ($cgiparams{'ACTION'} eq 'update')) && ($i == $cgiparams{'ID'}) ) 
   {
-    print "<tr bgcolor='${Header::colouryellow}'>";
+    print "<tr>";
+    $col="bgcolor='${Header::colouryellow}'";
   }
   elsif ( $i % 2) 
   {
-    print "<tr bgcolor='$Header::table2colour'>";
+    print "<tr>";
+    $col="bgcolor='$color{'color20'}'";
   }
-  else 
+  else
   {
-    print "<tr bgcolor='$Header::table1colour'>";
+    print "<tr>";
+    $col="bgcolor='$color{'color22'}'";
   }
 
   print <<END
-<td align='center'>$wol_mac</td>
-<td align='center'>$Lang::tr{"$wol_iface"}</td>
-<td align='left'>$wol_txt</td>
-<td align='center'>
+<td align='center' $col>$wol_mac</td>
+<td align='center' $col>$Lang::tr{"$wol_iface"}</td>
+<td align='left' $col>$wol_txt</td>
+<td align='center' $col>
 END
 ;
   if ( (($wol_iface eq 'blue') && ! &haveBlueNet()) 
@@ -328,14 +351,14 @@ END
   }
   print <<END
 </td>
-<td align='center'>
+<td align='center' $col>
   <form method='post' name='frmb$i' action='$ENV{'SCRIPT_NAME'}'>
   <input type='hidden' name='ACTION' value='edit' />
   <input type='image' name='$Lang::tr{'edit'}' src='/images/edit.gif' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' />
   <input type='hidden' name='ID' value='$i' />
   </form>
 </td>
-<td align='center'>
+<td align='center' $col>
   <form method='post' name='frmc$i' action='$ENV{'SCRIPT_NAME'}'>
   <input type='hidden' name='ACTION' value='remove' />
   <input type='image' name='$Lang::tr{'remove'}' src='/images/delete.gif' alt='$Lang::tr{'remove'}' title='$Lang::tr{'remove'}' />
@@ -422,18 +445,14 @@ sub WriteConfig
 #
 sub haveOrangeNet
 {
-  if ($netsettings{'CONFIG_TYPE'} == 1) {return 1;}
-  if ($netsettings{'CONFIG_TYPE'} == 3) {return 1;}
-  if ($netsettings{'CONFIG_TYPE'} == 5) {return 1;}
-  if ($netsettings{'CONFIG_TYPE'} == 7) {return 1;}
+  if ($netsettings{'CONFIG_TYPE'} == 2) {return 1;}
+  if ($netsettings{'CONFIG_TYPE'} == 4) {return 1;}
   return 0;
 }
 
 sub haveBlueNet
 {
+  if ($netsettings{'CONFIG_TYPE'} == 3) {return 1;}
   if ($netsettings{'CONFIG_TYPE'} == 4) {return 1;}
-  if ($netsettings{'CONFIG_TYPE'} == 5) {return 1;}
-  if ($netsettings{'CONFIG_TYPE'} == 6) {return 1;}
-  if ($netsettings{'CONFIG_TYPE'} == 7) {return 1;}
   return 0;
 }