Control Skripe korrigiert

Pakfire 2sprachig gemacht
MPFire Gui erweitert
Language Missings bereinigt


git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@688 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8
This commit is contained in:
maniacikarus
2007-07-15 07:33:07 +00:00
parent 872a05ee8b
commit bac7231b69
12 changed files with 157 additions and 484 deletions

View File

@@ -32,10 +32,10 @@ close(DATEI);
&Header::showhttpheaders();
sub refreshpage{&Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' content='1;'>" );print "<center><img src='/images/clock.gif' alt='' /><br/><font color='red'>$Lang::tr{'pagerefresh'}</font></center>";&Header::closebox();}
sub refreshpage{&Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' content='1;' />" );print "<center><img src='/images/clock.gif' alt='' /><br/><font color='red'>$Lang::tr{'pagerefresh'}</font></center>";&Header::closebox();}
&Header::getcgihash(\%mpfiresettings);
&Header::openpage($Lang::tr{'mpfire'}, 1, "<meta http-equiv='refresh' content='120'>");
&Header::openpage($Lang::tr{'mpfire'}, 1, "<meta http-equiv='refresh' content='120' />");
&Header::openbigbox('100%', 'left', '', $errormessage);
############################################################################################################################
@@ -48,20 +48,19 @@ delete $mpfiresettings{'__CGI__'};delete $mpfiresettings{'x'};delete $mpfiresett
system("/usr/local/bin/mpfirectrl scan $mpfiresettings{'SCANDIR'} $mpfiresettings{'SCANDIRDEPS'}");
refreshpage();
}
if ( $mpfiresettings{'ACTION'} eq ">" ){system("/usr/local/bin/mpfirectrl","play","\"$mpfiresettings{'FILE'}\"");}
if ( $mpfiresettings{'ACTION'} eq "x" ){system("/usr/local/bin/mpfirectrl stop");}
if ( $mpfiresettings{'ACTION'} eq "||" ){system("/usr/local/bin/mpfirectrl pause");}
if ( $mpfiresettings{'ACTION'} eq "|>" ){system("/usr/local/bin/mpfirectrl resume");}
if ( $mpfiresettings{'ACTION'} eq ">>" ){system("/usr/local/bin/mpfirectrl next");}
if ( $mpfiresettings{'ACTION'} eq "stopweb" ){system("/usr/local/bin/mpfirectrl stopweb");}
if ( $mpfiresettings{'ACTION'} eq "playweb" ){system("/usr/local/bin/mpfirectrl","playweb","\"$mpfiresettings{'FILE'}\"");}
if ( $mpfiresettings{'ACTION'} eq "+" ){system("/usr/local/bin/mpfirectrl volup 5");}
if ( $mpfiresettings{'ACTION'} eq "-" ){system("/usr/local/bin/mpfirectrl voldown 5");}
if ( $mpfiresettings{'ACTION'} eq "++" ){system("/usr/local/bin/mpfirectrl volup 10");}
if ( $mpfiresettings{'ACTION'} eq "--" ){system("/usr/local/bin/mpfirectrl voldown 10");}
if ( $mpfiresettings{'ACTION'} eq "playlist" ){system("/usr/local/bin/mpfirectrl playall");}
if ( $mpfiresettings{'ACTION'} eq "playalbum" )
elsif ( $mpfiresettings{'ACTION'} eq ">" ){system("/usr/local/bin/mpfirectrl","play","\"$mpfiresettings{'FILE'}\"");}
elsif ( $mpfiresettings{'ACTION'} eq "x" ){system("/usr/local/bin/mpfirectrl stop");}
elsif ( $mpfiresettings{'ACTION'} eq "||" ){system("/usr/local/bin/mpfirectrl pause");}
elsif ( $mpfiresettings{'ACTION'} eq "|>" ){system("/usr/local/bin/mpfirectrl resume");}
elsif ( $mpfiresettings{'ACTION'} eq ">>" ){system("/usr/local/bin/mpfirectrl next");}
elsif ( $mpfiresettings{'ACTION'} eq "stopweb" ){system("/usr/local/bin/mpfirectrl stopweb");}
elsif ( $mpfiresettings{'ACTION'} eq "playweb" ){system("/usr/local/bin/mpfirectrl","playweb","\"$mpfiresettings{'FILE'}\"");}
elsif ( $mpfiresettings{'ACTION'} eq "+" ){system("/usr/local/bin/mpfirectrl volup 5");}
elsif ( $mpfiresettings{'ACTION'} eq "-" ){system("/usr/local/bin/mpfirectrl voldown 5");}
elsif ( $mpfiresettings{'ACTION'} eq "++" ){system("/usr/local/bin/mpfirectrl volup 10");}
elsif ( $mpfiresettings{'ACTION'} eq "--" ){system("/usr/local/bin/mpfirectrl voldown 10");}
elsif ( $mpfiresettings{'ACTION'} eq "playlist" ){system("/usr/local/bin/mpfirectrl playall");}
elsif ( $mpfiresettings{'ACTION'} eq "playalbum" )
{
my @temp = "";
my @album = split(/\|/,$mpfiresettings{'album'});
@@ -77,7 +76,7 @@ print DATEI @temp;
close(DATEI);
system("/usr/local/bin/mpfirectrl playall");
}
if ( $mpfiresettings{'ACTION'} eq "playartist" )
elsif ( $mpfiresettings{'ACTION'} eq "playartist" )
{
my @temp = "";
my @artist = split(/\|/,$mpfiresettings{'artist'});
@@ -93,7 +92,7 @@ print DATEI @temp;
close(DATEI);
system("/usr/local/bin/mpfirectrl playall");
}
if ( $mpfiresettings{'ACTION'} eq "playall" )
elsif ( $mpfiresettings{'ACTION'} eq "playall" )
{
my @temp = "";
foreach (@songdb){
@@ -106,7 +105,7 @@ print DATEI @temp;
close(DATEI);
system("/usr/local/bin/mpfirectrl playall");
}
if ( $mpfiresettings{'SHOWLIST'} ){delete $mpfiresettings{'__CGI__'};delete $mpfiresettings{'x'};delete $mpfiresettings{'y'};&General::writehash("${General::swroot}/mpfire/settings", \%mpfiresettings);}
elsif ( $mpfiresettings{'SHOWLIST'} ){delete $mpfiresettings{'__CGI__'};delete $mpfiresettings{'x'};delete $mpfiresettings{'y'};&General::writehash("${General::swroot}/mpfire/settings", \%mpfiresettings);}
############################################################################################################################
################################### Aufbau der HTML Seite fr globale Sambaeinstellungen ####################################
@@ -260,10 +259,22 @@ open(DATEI, "<${General::swroot}/mpfire/playlist") || die "Could not open playli
my @playlist = <DATEI>;
close(DATEI);
my %hash;
foreach (@songdb){
my @song = split(/\|/,$_);
chomp($song[0]);
$hash{$song[0]}=$song[1]." - ".$song[2]." - ".$song[7].":".$song[8];
}
print <<END
<table width='95%' cellspacing='0'>
<tr bgcolor='$color{'color20'}'><td colspan='9' align='left'><b>$Lang::tr{'current playlist'}</b></td></tr>
<tr><td align='center'><textarea cols='120' rows='10' name='playlist' style='font-size:10px' readonly='readonly' >@playlist</textarea><br/>
<tr><td align='center'><textarea cols='120' rows='10' name='playlist' style='font-size:11px' readonly='readonly' >
END
;
foreach (@playlist){chomp($_);print $hash{$_}."\n";}
print <<END
</textarea><br/>
<form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='ACTION' value='playlist' />
<input type='image' alt='$Lang::tr{'play'}' title='$Lang::tr{'play'}' src='/images/media-playback-start.png' />

View File

@@ -47,7 +47,7 @@ if ($pakfiresettings{'ACTION'} eq 'install'){
&Header::openbox("100%", "center", "Abfrage");
my @output = `/usr/local/bin/pakfire resolvedeps $pakfiresettings{'INSPAKS'}`;
print <<END;
<table><tr><td colspan='2'>Sie maechten folgende Pakete installieren: "$pakfiresettings{'INSPAKS'}". Moeglicherweise haben diese Pakete Abhaengigkeiten, d.h. andere Pakete muessen zusaetzlich installiert werden. Dazu sehen sie unten eine Liste.
<table><tr><td colspan='2'>$Lang::tr{'pakfire install package'}.$pakfiresettings{'INSPAKS'}.$Lang::tr{'pakfire possible dependency'}
<pre>
END
foreach (@output) {
@@ -55,7 +55,7 @@ END
}
print <<END;
</pre>
<tr><td colspan='2'>Moechten Sie der Installation aller Pakete zustimmen?
<tr><td colspan='2'>$Lang::tr{'pakfire accept all'}
<tr><td colspan='2'>&nbsp;
<tr><td align='right'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='INSPAKS' value='$pakfiresettings{'INSPAKS'}' />
@@ -119,7 +119,7 @@ if ($return) {
<tr><td>
<img src='/images/indicator.gif' alt='$Lang::tr{'aktiv'}' />&nbsp;
<td>
Pakfire fuehrt gerade eine Aufgabe aus... Bitte warten sie, bis diese erfolgreich beendet wurde.
$Lang::tr{'pakfire working'}
<tr><td colspan='2' align='center'>
<form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='image' alt='$Lang::tr{'reload'}' src='/images/view-refresh.png' />
@@ -171,7 +171,7 @@ print <<END;
<input type='hidden' name='ACTION' value='remove' />
<input type='image' alt='$Lang::tr{'remove'}' src='/images/list-remove.png' />
</td>
<td width='40%' align="center">Installierte Addons:<br />
<td width='40%' align="center">$Lang::tr{'pakfire installed addons'}<br />
<select name="DELPAKS" size="10" multiple>
END
@@ -183,7 +183,7 @@ print <<END;
<br /><hr /><br />
<form method='post' action='$ENV{'SCRIPT_NAME'}'>
<table width='100%'>
<tr><td colspan='2'>Zur Verfuegung stehende Updates:
<tr><td colspan='2'>$Lang::tr{'pakfire updates'}
<tr><td width='20%'>&nbsp;<td width='60%' align='center'>
<select name="UPDPAKS" size="5" disabled>
END
@@ -198,9 +198,9 @@ print <<END;
<br /><hr /><br />
<form method='post' action='$ENV{'SCRIPT_NAME'}'>
<table width='100%'>
<tr><td width='40%' align="right">Automatische Updates taeglich ausfuehren:
<tr><td width='40%' align="right">$Lang::tr{'pakfire update daily'}
<td width='10%' align="left"><input type="checkbox" name="AUTOUPDATE" $checked{'AUTOUPDATE'}{'on'} />
<td width='40%' align="right">Registrierung am Master-Server:
<td width='40%' align="right">$Lang::tr{'pakfire register'}
<td width='10%' align="left"><input type="checkbox" name="UUID" $checked{'UUID'}{'on'} />
<tr><td width='100%' colspan="4" align="right"><input type="submit" name="ACTION" value="$Lang::tr{'save'}" />
</table>

View File

@@ -1,237 +0,0 @@
#!/usr/bin/perl
#
# SmoothWall CGIs
#
# This code is distributed under the terms of the GPL
#
# (c) The SmoothWall Team
#
#
use strict;
# enable only the following on debugging purpose
use warnings;
use CGI::Carp 'fatalsToBrowser';
require '/var/ipfire/general-functions.pl';
require "${General::swroot}/lang.pl";
require "${General::swroot}/header.pl";
require "${General::swroot}/graphs.pl";
#workaround to suppress a warning when a variable is used only once
my @dummy = ( ${Header::colourred} );
undef (@dummy);
my %qossettings = ();
my %checked = ();
my %netsettings = ();
my $message = '';
my $errormessage = "";
my $c = "";
my $direntry = "";
my $classentry = "";
my $subclassentry = "";
my $l7ruleentry = "";
my $portruleentry = "";
my $tosruleentry = "";
my @tmp = ();
my @classes = ();
my @subclasses = ();
my @l7rules = ();
my @portrules = ();
my @tosrules = ();
my @tmpline = ();
my @classline = ();
my @subclassline = ();
my @l7ruleline = ();
my @portruleline = ();
my @tosruleline = ();
my @proto = ();
my %selected= ();
my @checked = ();
my $classfile = "/var/ipfire/qos/classes";
my $subclassfile = "/var/ipfire/qos/subclasses";
my $level7file = "/var/ipfire/qos/level7config";
my $portfile = "/var/ipfire/qos/portconfig";
my $tosfile = "/var/ipfire/qos/tosconfig";
&General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
&overviewgraph($qossettings{'RED_DEV'});
&overviewgraph($qossettings{'IMQ_DEV'});
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 %cgiparams=();
# Maps a nice printable name to the changing part of the pid file, which
# is also the name of the program
# Generate Graphs from rrd Data
&Graphs::updatecpugraph ("day");
&Graphs::updateloadgraph ("day");
&Header::showhttpheaders();
&Header::getcgihash(\%cgiparams);
&Header::openpage($Lang::tr{'status information'}, 1, '');
&Header::openbigbox('100%', 'left');
open( FILE, "< $classfile" ) or die "Unable to read $classfile";
@classes = <FILE>;
close FILE;
open( FILE, "< $subclassfile" ) or die "Unable to read $subclassfile";
@subclasses = <FILE>;
close FILE;
&Header::openbox('100%', 'left', 'QoS Graphen');
print <<END
<table width='100%'> <tr><td align='center'><font color='red'>Diese Seite braucht je nach Geschwindigkeit des Computers laenger zum Laden.</font>
<tr><td align='center'><b>Klasse:</b>
END
;
foreach $classentry (sort @classes)
{
@classline = split( /\;/, $classentry );
$qossettings{'CLASS'}=$classline[1];
print <<END
<input type="button" onClick="swapVisibility('$qossettings{'CLASS'}')" value='$qossettings{'CLASS'}' />
END
;
}
print <<END
</table>
END
;
&Header::closebox();
foreach $classentry (sort @classes)
{
@classline = split( /\;/, $classentry );
$qossettings{'DEV'}=$classline[0];
$qossettings{'CLASS'}=$classline[1];
&gengraph($qossettings{'DEV'},$qossettings{'CLASS'});
print "<div id='$qossettings{'CLASS'}' style='display: none'>";
&Header::openbox('100%', 'center', "$qossettings{'CLASS'} ($qossettings{'DEV'})");
print <<END
<table>
<tr><td colspan='2' align='center'><img src='/graphs/class_$qossettings{'CLASSPRFX'}-$qossettings{'CLASS'}_$qossettings{'DEV'}-packets.png' />
<tr><td colspan='2' align='center'><img src='/graphs/class_$qossettings{'CLASSPRFX'}-$qossettings{'CLASS'}_$qossettings{'DEV'}-borrowed.png' />
<tr><td colspan='2' align='center'><img src='/graphs/class_$qossettings{'CLASSPRFX'}-$qossettings{'CLASS'}_$qossettings{'DEV'}-bytes.png' />
END
;
foreach $subclassentry (sort @subclasses)
{
@subclassline = split( /\;/, $subclassentry );
if ($subclassline[1] eq $classline[1]) {
$qossettings{'DEV'}=$subclassline[0];
$qossettings{'SCLASS'}=$subclassline[2];
&gengraph($qossettings{'DEV'},$qossettings{'SCLASS'});
print <<END
<tr><td colspan='2' align='center'><img src='/graphs/class_$qossettings{'CLASSPRFX'}-$qossettings{'SCLASS'}_$qossettings{'DEV'}-packets.png' />
<tr><td colspan='2' align='center'><img src='/graphs/class_$qossettings{'CLASSPRFX'}-$qossettings{'SCLASS'}_$qossettings{'DEV'}-borrowed.png' />
<tr><td colspan='2' align='center'><img src='/graphs/class_$qossettings{'CLASSPRFX'}-$qossettings{'SCLASS'}_$qossettings{'DEV'}-bytes.png' />
END
;
}
}
print "\t\t</table>";
&Header::closebox();
print "</div>\n";
}
print <<END
</table>
END
;
if (( -e "/srv/web/ipfire/html/graphs/qos-graph-$qossettings{'RED_DEV'}.png") && ( -e "/srv/web/ipfire/html/graphs/qos-graph-$qossettings{'IMQ_DEV'}.png")) {
print <<END
<tr><td colspan='9' align='center'><img alt="" src="/graphs/qos-graph-$qossettings{'RED_DEV'}.png" />
<tr><td colspan='9' align='center'><img alt="" src="/graphs/qos-graph-$qossettings{'IMQ_DEV'}.png" />
END
;}
&Header::closebox();
&Header::closebigbox();
&Header::closepage();
sub gengraph {
$qossettings{'DEV'} = shift;
$qossettings{'CLASS'} = shift;
my $ERROR="";
if ( $qossettings{'DEV'} eq $qossettings{'RED_DEV'} ) {
$qossettings{'CLASSPRFX'} = '1';
} else {
$qossettings{'CLASSPRFX'} = '2';
}
my $color=random_hex_color(6);
RRDs::graph ("/srv/web/ipfire/html/graphs/class_$qossettings{'CLASSPRFX'}-$qossettings{'CLASS'}_$qossettings{'DEV'}-packets.png",
"--start", "-3240", "-aPNG", "-i", "-z",
"--alt-y-grid", "-w 600", "-h 150", "-r",
"--color", "SHADEA#EAE9EE",
"--color", "SHADEB#EAE9EE",
"--color", "BACK#FFFFFF",
"-t $qossettings{'CLASS'} ($qossettings{'DEV'})",
"DEF:pkts=/var/log/rrd/class_$qossettings{'CLASSPRFX'}-$qossettings{'CLASS'}_$qossettings{'DEV'}.rrd:pkts:AVERAGE",
"DEF:dropped=/var/log/rrd/class_$qossettings{'CLASSPRFX'}-$qossettings{'CLASS'}_$qossettings{'DEV'}.rrd:dropped:AVERAGE",
"DEF:overlimits=/var/log/rrd/class_$qossettings{'CLASSPRFX'}-$qossettings{'CLASS'}_$qossettings{'DEV'}.rrd:overlimits:AVERAGE",
"AREA:pkts$color:packets",
"GPRINT:pkts:LAST:total packets\\:%8.3lf %s packets\\j",
"LINE3:dropped#FF0000:dropped",
"GPRINT:dropped:LAST:dropped packets\\:%8.3lf %s packets\\j",
"LINE3:overlimits#0000FF:overlimits",
"GPRINT:overlimits:LAST:overlimits\\:%8.3lf %s packets\\j",
);
}
sub overviewgraph {
$qossettings{'DEV'} = shift;
if ( $qossettings{'DEV'} eq $qossettings{'RED_DEV'} ) {
$qossettings{'CLASSPRFX'} = '1';
} else {
$qossettings{'CLASSPRFX'} = '2';
}
my $ERROR="";
my $count="1";
my $color="#000000";
my @command=("/srv/web/ipfire/html/graphs/qos-graph-$qossettings{'DEV'}.png",
"--start", "-3240", "-aPNG", "-i", "-z",
"--alt-y-grid", "-w 600", "-h 150", "-r",
"--color", "SHADEA#EAE9EE",
"--color", "SHADEB#EAE9EE",
"--color", "BACK#FFFFFF",
"-t Auslastung auf ($qossettings{'DEV'})"
);
open( FILE, "< $classfile" ) or die "Unable to read $classfile";
@classes = <FILE>;
close FILE;
foreach $classentry (sort @classes)
{
@classline = split( /\;/, $classentry );
if ( $classline[0] eq $qossettings{'DEV'} )
{
$color=random_hex_color(6);
push(@command, "DEF:$classline[1]=/var/log/rrd/class_$qossettings{'CLASSPRFX'}-$classline[1]_$qossettings{'DEV'}.rrd:bits:AVERAGE");
if ($count eq "1") {
push(@command, "AREA:$classline[1]$color:Klasse $classline[1] - $classline[8]\\j");
} else {
push(@command, "STACK:$classline[1]$color:Klasse $classline[1] - $classline[8]\\j");
}
$count++;
}
}
RRDs::graph (@command);
}
sub random_hex_color {
my $size = shift;
$size = 6 if $size !~ /^3|6$/;
my @hex = ( 0 .. 9, 'a' .. 'f' );
my @color;
push @color, @hex[rand(@hex)] for 1 .. $size;
return join('', '#', @color);
}

View File

@@ -1,139 +0,0 @@
#!/usr/bin/perl
#
# redirect.cgi - By IPFire-Team (C)
#
use CGI qw(param);
$swroot="/var/ipfire";
my %netsettings;
my %filtersettings;
&readhash("$swroot/ethernet/settings", \%netsettings);
&readhash("$swroot/urlfilter/settings", \%filtersettings);
$category=param("category");
$url=param("url");
$ip=param("ip");
if ($filtersettings{'MSG_TEXT_1'} eq '') {
$msgtext1 = "A C C E S S &nbsp;&nbsp; D E N I E D";
} else { $msgtext1 = $filtersettings{'MSG_TEXT_1'}; }
if ($filtersettings{'MSG_TEXT_2'} eq '') {
$msgtext2 = "Access to the requested page has been denied";
} else { $msgtext2 = $filtersettings{'MSG_TEXT_2'}; }
if ($filtersettings{'MSG_TEXT_3'} eq '') {
$msgtext3 = "Please contact the Network Administrator if you think there has been an error";
} else { $msgtext3 = $filtersettings{'MSG_TEXT_3'}; }
if ($category eq '') { $category = '&nbsp;'; } else { $category = '['.$category.']'; }
print "Pragma: no-cache\n";
print "Cache-control: no-cache\n";
print "Connection: close\n";
print "Content-type: text/html\n\n";
print <<END
<html>
<head>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>ACCESS MESSAGE</title>
</head>
<body>
<table width="100%" height='100%' border="0">
<tr>
<td colspan='3' width='100%' height='130' align="center" background="http://$netsettings{'GREEN_ADDRESS'}:81/images/background.gif">
<tr> <td width='10%'><td align='center' bgcolor='#CC000000' width='80%'><font face="verdana, arial, sans serif" color="#FFFFFF" size="5">
<b>$msgtext1</b>
</font>
<td width='10%'>
END
;
if (!($category eq ""))
{
print <<END
<tr> <td colspan='3' align='center'>
<font face="verdana, arial, sans serif" color="#CC000000" size="1">
<b>$category</b>
</font>
END
;
}
print <<END
<tr>
<td colspan='3' align="center">
<font face="verdana, arial, sans serif" color="#000000" size="4">
<b>$msgtext2</b>
</font>
<font face="verdana,arial,sans serif" color="#000000" size="2">
END
;
if (!($url eq ""))
{
print <<END
<p>URL: <a href="$url">$url</a>
END
;
}
if (!($ip eq ""))
{
print <<END
<p>Client IP address: <i>$ip</i>
END
;
}
print <<END
<br><p>$msgtext3
</font>
<tr>
<td colspan='3' height='60%' valign="bottom" align="right">
<font face="verdana,arial,sans serif" color="#656565" size="1">Web Filtering by
</font>
<a href="http://www.ipfire.eu" target="_blank"><b>
<font face="verdana,arial,sans serif" color="#656565" size="1">IPFire</b></a>
</font>
</table>
</body>
</html>
END
;
sub readhash
{
my $filename = $_[0];
my $hash = $_[1];
my ($var, $val);
if (-e $filename)
{
open(FILE, $filename) or die "Unable to read file $filename";
while (<FILE>)
{
chop;
($var, $val) = split /=/, $_, 2;
if ($var)
{
$val =~ s/^\'//g;
$val =~ s/\'$//g;
# Untaint variables read from hash
$var =~ /([A-Za-z0-9_-]*)/; $var = $1;
$val =~ /([\w\W]*)/; $val = $1;
$hash->{$var} = $val;
}
}
close FILE;
}
}