From: ms Date: Thu, 22 Mar 2007 20:56:22 +0000 (+0000) Subject: Neue UPNP.CGI vom Christian X-Git-Tag: v2.3-beta1~803 X-Git-Url: http://git.ipfire.org/?p=people%2Fpmueller%2Fipfire-2.x.git;a=commitdiff_plain;h=2abc4aad764ccc198e265a7dc5a5c10b3f62275a Neue UPNP.CGI vom Christian git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@452 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8 --- diff --git a/html/cgi-bin/upnp.cgi b/html/cgi-bin/upnp.cgi index 4623d72c2f..3afaee2c47 100644 --- a/html/cgi-bin/upnp.cgi +++ b/html/cgi-bin/upnp.cgi @@ -26,11 +26,21 @@ my %selected= () ; my %servicenames = ( - 'UPnP Daemon' => 'upnpd', + 'UPnP Daemon' => 'upnpd', ); &Header::showhttpheaders(); - +############################################################################################################################ +############################################### Setzen von Standartwerten ################################################## + +$upnpsettings{'DEBUGMODE'} = '3'; +$upnpsettings{'FORWARDRULES'} = 'yes'; +$upnpsettings{'FORWARDCHAIN'} = 'FORWARD'; +$upnpsettings{'PREROUTINGCHAIN'} = 'PORTFW'; +$upnpsettings{'DOWNSTREAM'} = '900000'; +$upnpsettings{'UPSTREAM'} = '16000000'; +$upnpsettings{'DESCRIPTION'} = 'gatedesc.xml'; +$upnpsettings{'XML'} = '/etc/linuxigd'; $upnpsettings{'ENABLED'} = 'off'; $upnpsettings{'GREEN'} = 'on'; $upnpsettings{'BLUE'} = 'off'; @@ -44,37 +54,57 @@ $upnpsettings{'ACTION'} = ''; &Header::openbigbox('100%', 'left', '', $errormessage); ############################################################################################################################ -############################################################################################################################ +################################################### Speichern der Config ################################################### if ($upnpsettings{'ACTION'} eq $Lang::tr{'save'}) { - &General::writehash("${General::swroot}/upnp/settings", \%upnpsettings); -} +&General::writehash("${General::swroot}/upnp/settings", \%upnpsettings); + + open (FILE, ">${General::swroot}/upnp/upnpd.conf") or die "Can't save the upnp config: $!"; + flock (FILE, 2); + +print FILE <$errormessage\n"; - print " \n"; - &Header::closebox(); + &Header::openbox('100%', 'left', $Lang::tr{'error messages'}); + print "$errormessage\n"; + print " \n"; + &Header::closebox(); } $checked{'GREEN'}{'on'} = ''; @@ -89,53 +119,65 @@ $checked{'BLUE'}{"$upnpsettings{'BLUE'}"} = 'checked'; &Header::openbox('100%', 'center', 'UPnP'); print < - + +
END ; - if ( $message ne "" ) { - print "\n"; } - else { - print "\n"; } - print "
$message"; - } - - my $lines = 0; - my $key = ''; - foreach $key (sort keys %servicenames) - { - if ($lines % 2) { - print "
$key\n"; - my $shortname = $servicenames{$key}; - my $status = &isrunning($shortname); - print "$status\n"; - $lines++; - } - print <Alle Dienste: - - - -
- -
-
- - \n"; } + else { + print "\n"; } + print "
$Lang::tr{'options'} -
$Lang::tr{'interfaces'} -   $Lang::tr{'green'} - $netsettings{'GREEN_DEV'} + if ( $message ne "" ) { + print "
$message"; + } + + my $lines = 0; + my $key = ''; + foreach $key (sort keys %servicenames) + { + if ($lines % 2) { + print "
$key\n"; + my $shortname = $servicenames{$key}; + my $status = &isrunning($shortname); + print "$status\n"; + $lines++; + } + print <Alle Dienste: + + + +
+
+
+
+ +
$Lang::tr{'options'} +
$Lang::tr{'interfaces'} +   $Lang::tr{'green'} - $netsettings{'GREEN_DEV'} END ; - if (&Header::blue_used()){ - print <  $Lang::tr{'wireless'} - $netsettings{'BLUE_DEV'} + if (&Header::blue_used()){ + print <  $Lang::tr{'wireless'} - $netsettings{'BLUE_DEV'} END ; - } - print < -
-
+ } + print < + + + + + + + + + + +
Debug Mode:
Forward Rules:
Forward Chain:
Prerouting Chain:
Down Stream:
Up Strean:
Description Document:
XML Document:
+
+

+
END ; &Header::closebox(); @@ -148,34 +190,33 @@ END sub isrunning { - my $cmd = $_[0]; - my $status = "$Lang::tr{'stopped'}"; - my $pid = ''; - my $testcmd = ''; - my $exename; - - $cmd =~ /(^[a-z]+)/; - $exename = $1; - - if (open(FILE, "/var/run/${cmd}.pid")) - { - $pid = ; chomp $pid; - close FILE; - if (open(FILE, "/proc/${pid}/status")) - { - while () - { - if (/^Name:\W+(.*)/) { - $testcmd = $1; } - } - close FILE; - if ($testcmd =~ /$exename/) - { - $status = "$Lang::tr{'running'}"; - } - } - } - - return $status; + my $cmd = $_[0]; + my $status = "$Lang::tr{'stopped'}"; + my $pid = ''; + my $testcmd = ''; + my $exename; + + $cmd =~ /(^[a-z]+)/; + $exename = $1; + + if (open(FILE, "/var/run/${cmd}.pid")) + { + $pid = ; chomp $pid; + close FILE; + if (open(FILE, "/proc/${pid}/status")) + { + while () + { + if (/^Name:\W+(.*)/) { + $testcmd = $1; } + } + close FILE; + if ($testcmd =~ /$exename/) + { + $status = "$Lang::tr{'running'}"; + } + } + } + + return $status; } -