]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blobdiff - html/cgi-bin/upnp.cgi
cgi-bin: Remove font tags with no effect, and style tags
[people/teissler/ipfire-2.x.git] / html / cgi-bin / upnp.cgi
index eb635bb5bd9a90e464fef3ff60d6839d4a0dbd96..07dfa2677c970e49a9be6ae9ffe5f209fb26616c 100644 (file)
@@ -1,16 +1,28 @@
 #!/usr/bin/perl
-#
-# IPFire CGIs
-#
-# This code is distributed under the terms of the GPL
-#
-# (c) The IPFire Team
-#
+###############################################################################
+#                                                                             #
+# 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;
 # 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";
@@ -24,6 +36,11 @@ my %selected= () ;
 
 my %servicenames =('UPnP Daemon' => 'upnpd',);
 
+my %color = ();
+my %mainsettings = ();
+&General::readhash("${General::swroot}/main/settings", \%mainsettings);
+&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
+
 &Header::showhttpheaders();
 ############################################################################################################################
 ############################################### Setzen von Standartwerten ##################################################
@@ -65,7 +82,7 @@ if ($upnpsettings{'ACTION'} eq $Lang::tr{'save'})
 debug_mode = $upnpsettings{'DEBUGMODE'}
 insert_forward_rules = $upnpsettings{'FORWARDRULES'}
 forward_chain_name = FORWARD
-prerouting_chain_name = PORTFW
+prerouting_chain_name = UPNPFW
 upstream_bitrate = $upnpsettings{'DOWNSTREAM'}
 downstream_bitrate = $upnpsettings{'UPSTREAM'}
 description_document_name = $upnpsettings{'DESCRIPTION'}
@@ -74,7 +91,7 @@ xml_document_path = $upnpsettings{'XML'}
 END
 ;
        close FILE;
-       system("/usr/local/bin/upnpctrl upnpxml $upnpsettings{'XML'} $upnpsettings{'DESCRIPTION'} $upnpsettings{'manufacturer'}");
+       system("/usr/local/bin/upnpctrl","upnpxml","$upnpsettings{'friendlyName'}","$upnpsettings{'XML'}","$upnpsettings{'DESCRIPTION'}");
        }
 elsif ($upnpsettings{'ACTION'} eq 'Start')
        {
@@ -116,18 +133,13 @@ print <<END
 <table width='95%' cellspacing='0'>
 END
 ;
-if ( $message ne "" ) {print "<tr><td colspan='3' align='center'><font color='red'>$message</font>";}
+if ( $message ne "" ) {print "<tr><td colspan='3' style='text-align:center; color:red;'>$message</td></tr>";}
 
 my $lines = 0;
 my $key = '';
 foreach $key (sort keys %servicenames)
 {
-       if ($lines % 2)
-               {print "<tr bgcolor='${Header::table1colour}'>\n";}
-       else
-               {print "<tr bgcolor='${Header::table2colour}'>\n"; }
-
-       print "<td align='left'>$key\n";
+  print "<tr><td align='left'>$key\n";
        my $shortname = $servicenames{$key};
        my $status = &isrunning($shortname);
        print "$status\n";
@@ -144,7 +156,7 @@ print <<END
 <br />
 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
 <table width='95%' cellspacing='0'>
-<tr><td colspan='2' align='left' bgcolor='${Header::table1colour}'><b>$Lang::tr{'options'}</b></td></tr>
+<tr><td colspan='2' align='left' bgcolor='$color{'color20'}'><b>$Lang::tr{'options'}</b></td></tr>
 <tr><td align='left' colspan='2'><br /></td></tr>
 <tr><td align='left'>UPnP Device Name:</td><td><input type='text' name='friendlyName' value='$upnpsettings{'friendlyName'}' size="30" /></td></tr>
 <tr><td align='left' colspan='2'><br /></td></tr>
@@ -152,7 +164,7 @@ print <<END
 <tr><td align='left'>Upstream in KB:</td><td><input type='text' name='UPSTREAM' value='$upnpsettings{'UPSTREAM'}' size="30" /></td></tr>
 <tr><td align='left' colspan='2'><br /></td></tr>
 <tr><td colspan='2' align='center'>    <input type='hidden' name='ACTION' value=$Lang::tr{'save'} />
-                                                                                                                                               <input type='image' alt=$Lang::tr{'save'} src='/images/floppy.gif' /></td></tr>
+<input type='image' alt='$Lang::tr{'save'}' title='$Lang::tr{'save'}' src='/images/floppy.gif' /></td></tr>
 </table></form>
 END
 ;
@@ -187,9 +199,9 @@ print "</table>";
 ############################################################################################################################
 
 sub isrunning
-       {
+{
        my $cmd = $_[0];
-       my $status = "<td bgcolor='${Header::colourred}' align='center'><font color='white'><b>$Lang::tr{'stopped'}</b></font></td>";
+       my $status = "<td bgcolor='${Header::colourred}' style='text-align:center; color:white;'><b>$Lang::tr{'stopped'}</b></td>";
        my $pid = '';
        my $testcmd = '';
        my $exename;
@@ -207,9 +219,10 @@ sub isrunning
                                {if (/^Name:\W+(.*)/) {$testcmd = $1; }}
                        close FILE;
                        if ($testcmd =~ /$exename/)
-                               {$status = "<td bgcolor='${Header::colourgreen}'><font color='white'><b>$Lang::tr{'running'}</b></font></td>";}
+                               {$status = "<td style='color:white; background-color:${Header::colourgreen};'><b>$Lang::tr{'running'}</b></td>";}
                        }
                }
 
                return $status;
-       }
+}
+