mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-09 18:45:54 +02:00
kleine Aenderungen in der Gui und ein paar Dateien geloescht
git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@603 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8
This commit is contained in:
@@ -22,12 +22,6 @@
|
||||
'title' => "$Lang::tr{'gui settings'}",
|
||||
'enabled' => 1,
|
||||
};
|
||||
$subsystem->{'50.shutdown'} = {
|
||||
'caption' => $Lang::tr{'shutdown'},
|
||||
'uri' => '/cgi-bin/shutdown.cgi',
|
||||
'title' => "$Lang::tr{'shutdown'} / $Lang::tr{'reboot'}",
|
||||
'enabled' => 1,
|
||||
};
|
||||
$subsystem->{'99.credits'} = {
|
||||
'caption' => $Lang::tr{'credits'},
|
||||
'uri' => '/cgi-bin/credits.cgi',
|
||||
|
||||
@@ -1268,8 +1268,8 @@ srv/web/ipfire/cgi-bin/country.cgi
|
||||
srv/web/ipfire/cgi-bin/credits.cgi
|
||||
srv/web/ipfire/cgi-bin/ddns.cgi
|
||||
srv/web/ipfire/cgi-bin/dhcp.cgi
|
||||
srv/web/ipfire/cgi-bin/dial
|
||||
srv/web/ipfire/cgi-bin/dial.cgi
|
||||
#srv/web/ipfire/cgi-bin/dial
|
||||
#srv/web/ipfire/cgi-bin/dial.cgi
|
||||
#srv/web/ipfire/cgi-bin/dial/dial.cgi
|
||||
#srv/web/ipfire/cgi-bin/dial/index.cgi
|
||||
srv/web/ipfire/cgi-bin/dmzholes.cgi
|
||||
@@ -1313,13 +1313,13 @@ srv/web/ipfire/cgi-bin/proxygraphs.cgi
|
||||
srv/web/ipfire/cgi-bin/qos.cgi
|
||||
srv/web/ipfire/cgi-bin/remote.cgi
|
||||
srv/web/ipfire/cgi-bin/services.cgi
|
||||
srv/web/ipfire/cgi-bin/shaping.cgi
|
||||
srv/web/ipfire/cgi-bin/shutdown.cgi
|
||||
#srv/web/ipfire/cgi-bin/shaping.cgi
|
||||
#srv/web/ipfire/cgi-bin/shutdown.cgi
|
||||
srv/web/ipfire/cgi-bin/speed.cgi
|
||||
srv/web/ipfire/cgi-bin/system.cgi
|
||||
srv/web/ipfire/cgi-bin/time.cgi
|
||||
srv/web/ipfire/cgi-bin/traffic.cgi
|
||||
srv/web/ipfire/cgi-bin/trafficadm.cgi
|
||||
#srv/web/ipfire/cgi-bin/trafficadm.cgi
|
||||
srv/web/ipfire/cgi-bin/traffics.cgi
|
||||
srv/web/ipfire/cgi-bin/updatexlrator.cgi
|
||||
srv/web/ipfire/cgi-bin/upload.cgi
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# SmoothWall CGIs
|
||||
#
|
||||
# This code is distributed under the terms of the GPL
|
||||
#
|
||||
# (c) The SmoothWall Team
|
||||
#
|
||||
# $Id: dial.cgi,v 1.4.2.3 2005/02/22 22:21:55 gespinasse Exp $
|
||||
#
|
||||
|
||||
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";
|
||||
|
||||
my %cgiparams=();
|
||||
|
||||
$cgiparams{'ACTION'} = '';
|
||||
&Header::getcgihash(\%cgiparams);
|
||||
|
||||
if ($cgiparams{'ACTION'} eq $Lang::tr{'dial profile'})
|
||||
{
|
||||
my $profile = $cgiparams{'PROFILE'};
|
||||
my %tempcgiparams = ();
|
||||
$tempcgiparams{'PROFILE'} = '';
|
||||
&General::readhash("${General::swroot}/ppp/settings-$cgiparams{'PROFILE'}",
|
||||
\%tempcgiparams);
|
||||
|
||||
# make a link from the selected profile to the "default" one.
|
||||
unlink("${General::swroot}/ppp/settings");
|
||||
link("${General::swroot}/ppp/settings-$cgiparams{'PROFILE'}",
|
||||
"${General::swroot}/ppp/settings");
|
||||
system ("/usr/bin/touch", "${General::swroot}/ppp/updatesettings");
|
||||
|
||||
# read in the new params "early" so we can write secrets.
|
||||
%cgiparams = ();
|
||||
&General::readhash("${General::swroot}/ppp/settings", \%cgiparams);
|
||||
$cgiparams{'PROFILE'} = $profile;
|
||||
$cgiparams{'BACKUPPROFILE'} = $profile;
|
||||
&General::writehash("${General::swroot}/ppp/settings-$cgiparams{'PROFILE'}",
|
||||
\%cgiparams);
|
||||
|
||||
# write secrets file.
|
||||
open(FILE, ">/${General::swroot}/ppp/secrets") or die "Unable to write secrets file.";
|
||||
flock(FILE, 2);
|
||||
my $username = $cgiparams{'USERNAME'};
|
||||
my $password = $cgiparams{'PASSWORD'};
|
||||
print FILE "'$username' * '$password'\n";
|
||||
chmod 0600, "${General::swroot}/ppp/secrets";
|
||||
close FILE;
|
||||
|
||||
&General::log("$Lang::tr{'profile made current'} $tempcgiparams{'PROFILENAME'}");
|
||||
$cgiparams{'ACTION'} = "$Lang::tr{'dial'}";
|
||||
}
|
||||
|
||||
if ($cgiparams{'ACTION'} eq $Lang::tr{'dial'}) {
|
||||
system('/usr/local/bin/redctrl','start') == 0
|
||||
or &General::log("Dial failed: $?"); }
|
||||
elsif ($cgiparams{'ACTION'} eq $Lang::tr{'hangup'}) {
|
||||
system('/usr/local/bin/redctrl','stop') == 0
|
||||
or &General::log("Hangup failed: $?"); }
|
||||
sleep 1;
|
||||
|
||||
print "Status: 302 Moved\nLocation: /cgi-bin/index.cgi\n\n";
|
||||
@@ -85,10 +85,10 @@ if ($cgiparams{'ACTION'} eq $Lang::tr{'dial profile'})
|
||||
}
|
||||
|
||||
if ($cgiparams{'ACTION'} eq $Lang::tr{'dial'}) {
|
||||
system('/usr/local/bin/redctrl','start') == 0
|
||||
system('/usr/local/bin/redctrl start > /dev/null') == 0
|
||||
or &General::log("Dial failed: $?"); sleep 1;}
|
||||
elsif ($cgiparams{'ACTION'} eq $Lang::tr{'hangup'}) {
|
||||
system('/usr/local/bin/redctrl','stop') == 0
|
||||
system('/usr/local/bin/redctrl stop > /dev/null') == 0
|
||||
or &General::log("Hangup failed: $?"); sleep 1;}
|
||||
|
||||
my $c;
|
||||
@@ -135,13 +135,61 @@ if ( $netsettings{'RED_TYPE'} =~ /^(DHCP|STATIC)$/ ) {
|
||||
$ipaddr = $netsettings{'RED_ADDRESS'};
|
||||
}
|
||||
|
||||
print <<END;
|
||||
<table border='0'>
|
||||
my $death = 0;
|
||||
my $rebirth = 0;
|
||||
|
||||
if ($cgiparams{'ACTION'} eq $Lang::tr{'shutdown'}) {
|
||||
$death = 1;
|
||||
&General::log($Lang::tr{'shutting down ipfire'});
|
||||
system '/usr/local/bin/ipfirereboot down';
|
||||
} elsif ($cgiparams{'ACTION'} eq $Lang::tr{'reboot'}) {
|
||||
$rebirth = 1;
|
||||
&General::log($Lang::tr{'rebooting ipfire'});
|
||||
system '/usr/local/bin/ipfirereboot boot';
|
||||
}
|
||||
|
||||
if ($death == 0 && $rebirth == 0) {
|
||||
|
||||
print <<END
|
||||
<form method='post' action='$ENV{'SCRIPT_NAME'}'>
|
||||
<table width='100%'>
|
||||
<tr>
|
||||
<td align='center'><form method='post' action="$ENV{'SCRIPT_NAME'}">
|
||||
<input type='submit' name='ACTION' value='$Lang::tr{'refresh'}' />
|
||||
</form></td>
|
||||
</tr></table>
|
||||
<td width='33%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'reboot'}' /></td>
|
||||
<td width='33%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'refresh'}' /></td>
|
||||
<td width='33%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'shutdown'}' /></td>
|
||||
</tr>
|
||||
</table>
|
||||
END
|
||||
;
|
||||
} else {
|
||||
my $message='';
|
||||
my $title='';
|
||||
my $refresh = "<meta http-equiv='refresh' content='5; URL=/cgi-bin/index.cgi' />";
|
||||
if ($death) {
|
||||
$title = $Lang::tr{'shutting down'};
|
||||
$message = $Lang::tr{'ipfire has now shutdown'};
|
||||
} else {
|
||||
$title = $Lang::tr{'rebooting'};
|
||||
$message = $Lang::tr{'ipfire has now rebooted'};
|
||||
}
|
||||
&Header::openpage($title, 0, $refresh);
|
||||
|
||||
&Header::openbigbox('100%', 'center');
|
||||
print <<END
|
||||
<div align='center'>
|
||||
<table width='100%' bgcolor='#ffffff'>
|
||||
<tr><td align='center'>
|
||||
<br /><br /><img src='/ipfire_big.gif' /><br /><br /><br />
|
||||
</td></tr>
|
||||
</table>
|
||||
<br />
|
||||
<font size='6'>$message</font>
|
||||
</div>
|
||||
END
|
||||
;
|
||||
}
|
||||
|
||||
print <<END;
|
||||
|
||||
<!-- Table of networks -->
|
||||
<table border='0' width=80%>
|
||||
@@ -335,62 +383,6 @@ print <<END;
|
||||
|
||||
END
|
||||
|
||||
require "${General::swroot}/net-traffic/net-traffic-admin.pl";
|
||||
|
||||
if($NETTRAFF::settings{'SHOW_AT_HOME'} eq 'on')
|
||||
{
|
||||
my %calc = ();
|
||||
$calc{'CALC_VOLUME_TOTAL'} = 0;
|
||||
$calc{'CALC_VOLUME_IN'} = 0;
|
||||
$calc{'CALC_VOLUME_OUT'} = 0;
|
||||
$calc{'CALC_WEEK_TOTAL'} = 0;
|
||||
$calc{'CALC_WEEK_IN'} = 0;
|
||||
$calc{'CALC_WEEK_OUT'} = 0;
|
||||
$calc{'CALC_LAST_RUN'} = 0;
|
||||
$calc{'CALC_PERCENT'} = 0;
|
||||
|
||||
&General::readhash($NETTRAFF::logfile, \%calc);
|
||||
|
||||
my $calctime = &NETTRAFF::getFormatedDate($calc{'CALC_LAST_RUN'});
|
||||
|
||||
print <<END;
|
||||
<hr /><br />
|
||||
|
||||
<table width='80%'>
|
||||
<tr>
|
||||
<td colspan='4' align='center' nowrap='nowrap' >$Lang::tr{'traffic monitor'} ($Lang::tr{'traffic calc time'} $calctime)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align='center' nowrap='nowrap' > </td>
|
||||
<td align='center' nowrap='nowrap' class='boldbase'><font color='$Header::colourred'><b>$Lang::tr{'trafficin'}</b></font></td>
|
||||
<td align='center' nowrap='nowrap' class='boldbase'><font color='$Header::colourred'><b>$Lang::tr{'trafficout'}</b></font></td>
|
||||
<td align='center' nowrap='nowrap' class='boldbase'><font color='$Header::colourred'><b>$Lang::tr{'trafficsum'}</b></font></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align='center' nowrap='nowrap' >$Lang::tr{'this weeks volume'} (MB):</td>
|
||||
<td align='center' nowrap='nowrap' class='boldbase'>$calc{'CALC_WEEK_IN'}</td>
|
||||
<td align='center' nowrap='nowrap' class='boldbase'>$calc{'CALC_WEEK_OUT'}</td>
|
||||
<td align='center' nowrap='nowrap' class='boldbase'>$calc{'CALC_WEEK_TOTAL'}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align='center' nowrap='nowrap' >$Lang::tr{'this months volume'} (MB):</td>
|
||||
<td align='center' nowrap='nowrap' class='boldbase'>$calc{'CALC_VOLUME_IN'}</td>
|
||||
<td align='center' nowrap='nowrap' class='boldbase'>$calc{'CALC_VOLUME_OUT'}</td>
|
||||
<td align='center' nowrap='nowrap' class='boldbase'>$calc{'CALC_VOLUME_TOTAL'}</td>
|
||||
</tr>
|
||||
END
|
||||
|
||||
if($NETTRAFF::settings{'MONTHLY_VOLUME_ON'} eq 'on')
|
||||
{
|
||||
print "<tr><td align='center'>max. $NETTRAFF::settings{'MONTHLY_VOLUME'} MB</td><td align='left' colspan='3' nowrap='nowrap'>";
|
||||
&NETTRAFF::traffPercentbar("$calc{'CALC_PERCENT'}%");
|
||||
print "</td><td align='left' nowrap='nowrap'> $calc{'CALC_PERCENT'}%</td></tr>";
|
||||
}
|
||||
print "</table>";
|
||||
}
|
||||
|
||||
&Header::closebox();
|
||||
|
||||
&Header::closebigbox();
|
||||
|
||||
&Header::closepage();
|
||||
|
||||
@@ -1,367 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# Traffic shaping CGI
|
||||
#
|
||||
# Copyright 2003-04-06 David Kilpatrick <dave@thunder.com.au>
|
||||
#
|
||||
# $Id: shaping.cgi,v 1.3.2.15 2005/02/27 13:42:05 eoberlander Exp $
|
||||
#
|
||||
|
||||
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";
|
||||
|
||||
#workaround to suppress a warning when a variable is used only once
|
||||
my @dummy = ( ${Header::table2colour}, ${Header::colouryellow} );
|
||||
undef (@dummy);
|
||||
|
||||
my %shapingsettings=();
|
||||
my $configfile = "${General::swroot}/shaping/config";
|
||||
my $settingsfile = "${General::swroot}/shaping/settings";
|
||||
my $errormessage = '';
|
||||
|
||||
&Header::showhttpheaders();
|
||||
|
||||
$shapingsettings{'ACTION'} = '';
|
||||
$shapingsettings{'ENABLE'} = 'off';
|
||||
$shapingsettings{'VALID'} = '';
|
||||
$shapingsettings{'UPLINK'} = '';
|
||||
$shapingsettings{'DOWNLINK'} = '';
|
||||
$shapingsettings{'SERVICE_ENABLED'} = '';
|
||||
$shapingsettings{'SERVICE_PROT'} = '';
|
||||
$shapingsettings{'SERVICE_PRIO'} = '';
|
||||
$shapingsettings{'SERVICE_PORT'} = '';
|
||||
|
||||
&Header::getcgihash(\%shapingsettings);
|
||||
|
||||
open(FILE, "$configfile") or die 'Unable to open shaping config file.';
|
||||
my @current = <FILE>;
|
||||
close(FILE);
|
||||
|
||||
if ($shapingsettings{'ACTION'} eq $Lang::tr{'save'})
|
||||
{
|
||||
if (!($shapingsettings{'UPLINK'} =~ /^\d+$/) ||
|
||||
($shapingsettings{'UPLINK'} < 2))
|
||||
{
|
||||
$errormessage = $Lang::tr{'invalid uplink speed'};
|
||||
goto ERROR;
|
||||
}
|
||||
|
||||
if (!($shapingsettings{'DOWNLINK'} =~ /^\d+$/) ||
|
||||
($shapingsettings{'DOWNLINK'} < 2))
|
||||
{
|
||||
$errormessage = $Lang::tr{'invalid downlink speed'};
|
||||
goto ERROR;
|
||||
}
|
||||
|
||||
ERROR:
|
||||
if ($errormessage) {
|
||||
$shapingsettings{'VALID'} = 'no'; }
|
||||
else {
|
||||
$shapingsettings{'VALID'} = 'yes'; }
|
||||
|
||||
open(FILE,">$settingsfile") or die 'Unable to open shaping settings file.';
|
||||
flock FILE, 2;
|
||||
print FILE "VALID=$shapingsettings{'VALID'}\n";
|
||||
print FILE "ENABLE=$shapingsettings{'ENABLE'}\n";
|
||||
print FILE "UPLINK=$shapingsettings{'UPLINK'}\n";
|
||||
print FILE "DOWNLINK=$shapingsettings{'DOWNLINK'}\n";
|
||||
close FILE;
|
||||
|
||||
if ($shapingsettings{'VALID'} eq 'yes') {
|
||||
system('/usr/local/bin/restartshaping');
|
||||
}
|
||||
}
|
||||
if ($shapingsettings{'ACTION'} eq $Lang::tr{'add'})
|
||||
{
|
||||
unless($shapingsettings{'SERVICE_PROT'} =~ /^(tcp|udp)$/) { $errormessage = $Lang::tr{'invalid input'}; }
|
||||
unless($shapingsettings{'SERVICE_PRIO'} =~ /^(10|20|30)$/) { $errormessage = $Lang::tr{'invalid input'}; }
|
||||
unless(&General::validport($shapingsettings{'SERVICE_PORT'})) { $errormessage = $Lang::tr{'invalid port'}; }
|
||||
|
||||
if ( ! $errormessage)
|
||||
{
|
||||
if ($shapingsettings{'EDITING'} eq 'no')
|
||||
{
|
||||
open(FILE,">>$configfile") or die 'Unable to open shaping config file';
|
||||
flock FILE, 2;
|
||||
print FILE "$shapingsettings{'SERVICE_PROT'},$shapingsettings{'SERVICE_PORT'},$shapingsettings{'SERVICE_PRIO'},$shapingsettings{'SERVICE_ENABLED'}\n";
|
||||
} else {
|
||||
open(FILE,">$configfile") or die 'Unable to open shaping config file';
|
||||
flock FILE, 2;
|
||||
my $id = 0;
|
||||
foreach my $line (@current)
|
||||
{
|
||||
$id++;
|
||||
chomp($line);
|
||||
my @temp = split(/\,/,$line);
|
||||
if ($shapingsettings{'EDITING'} eq $id) {
|
||||
print FILE "$shapingsettings{'SERVICE_PROT'},$shapingsettings{'SERVICE_PORT'},$shapingsettings{'SERVICE_PRIO'},$shapingsettings{'SERVICE_ENABLED'}\n";
|
||||
} else {
|
||||
print FILE "$line\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
close FILE;
|
||||
undef %shapingsettings;
|
||||
system ('/usr/local/bin/restartshaping');
|
||||
} else {
|
||||
# stay on edit mode if an error occur
|
||||
if ($shapingsettings{'EDITING'} ne 'no')
|
||||
{
|
||||
$shapingsettings{'ACTION'} = $Lang::tr{'edit'};
|
||||
$shapingsettings{'ID'} = $shapingsettings{'EDITING'};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($shapingsettings{'ACTION'} eq $Lang::tr{'edit'})
|
||||
{
|
||||
my $id = 0;
|
||||
foreach my $line (@current)
|
||||
{
|
||||
$id++;
|
||||
if ($shapingsettings{"ID"} eq $id)
|
||||
{
|
||||
chomp($line);
|
||||
my @temp = split(/\,/,$line);
|
||||
$shapingsettings{'SERVICE_PROT'} = $temp[0];
|
||||
$shapingsettings{'SERVICE_PORT'} = $temp[1];
|
||||
$shapingsettings{'SERVICE_PRIO'} = $temp[2];
|
||||
$shapingsettings{'SERVICE_ENABLED'} = $temp[3];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($shapingsettings{'ACTION'} eq $Lang::tr{'remove'} || $shapingsettings{'ACTION'} eq $Lang::tr{'toggle enable disable'})
|
||||
{
|
||||
open(FILE, ">$configfile") or die 'Unable to open config file.';
|
||||
flock FILE, 2;
|
||||
my $id = 0;
|
||||
foreach my $line (@current)
|
||||
{
|
||||
$id++;
|
||||
unless ($shapingsettings{"ID"} eq $id) { print FILE "$line"; }
|
||||
elsif ($shapingsettings{'ACTION'} eq $Lang::tr{'toggle enable disable'})
|
||||
{
|
||||
chomp($line);
|
||||
my @temp = split(/\,/,$line);
|
||||
if ($temp[3] eq "on") {
|
||||
print FILE "$temp[0],$temp[1],$temp[2],off\n";
|
||||
} else {
|
||||
print FILE "$temp[0],$temp[1],$temp[2],on\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
close(FILE);
|
||||
system ('/usr/local/bin/restartshaping');
|
||||
}
|
||||
|
||||
&General::readhash("${General::swroot}/shaping/settings", \%shapingsettings);
|
||||
|
||||
if ($shapingsettings{'ACTION'} eq '')
|
||||
{
|
||||
$shapingsettings{'SERVICE_ENABLED'} = 'on';
|
||||
$shapingsettings{'SERVICE_PROT'} = 'tcp';
|
||||
$shapingsettings{'SERVICE_PRIO'} = '20';
|
||||
$shapingsettings{'SERVICE_PORT'} = '';
|
||||
}
|
||||
|
||||
my %checked=();
|
||||
$checked{'ENABLE'}{'off'} = '';
|
||||
$checked{'ENABLE'}{'on'} = '';
|
||||
$checked{'ENABLE'}{$shapingsettings{'ENABLE'}} = "checked='checked'";
|
||||
|
||||
my %service_checked=();
|
||||
$service_checked{'SERVICE_ENABLED'}{'off'} = '';
|
||||
$service_checked{'SERVICE_ENABLED'}{'on'} = '';
|
||||
$service_checked{'SERVICE_ENABLED'}{$shapingsettings{'SERVICE_ENABLED'}} = "checked='checked'";
|
||||
|
||||
my %service_selected=();
|
||||
$service_selected{'SERVICE_PROT'}{'udp'} = '';
|
||||
$service_selected{'SERVICE_PROT'}{'tcp'} = '';
|
||||
$service_selected{'SERVICE_PROT'}{$shapingsettings{'SERVICE_PROT'}} = "selected='selected'";
|
||||
|
||||
$service_selected{'SERVICE_PRIO'}{'10'} = '';
|
||||
$service_selected{'SERVICE_PRIO'}{'20'} = '';
|
||||
$service_selected{'SERVICE_PRIO'}{'30'} = '';
|
||||
$service_selected{'SERVICE_PRIO'}{$shapingsettings{'SERVICE_PRIO'}} = "selected='selected'";
|
||||
|
||||
&Header::openpage($Lang::tr{'traffic shaping settings'}, 1, '');
|
||||
|
||||
&Header::openbigbox('100%', 'left', '', $errormessage);
|
||||
|
||||
if ($errormessage) {
|
||||
&Header::openbox('100%', 'left', $Lang::tr{'error messages'});
|
||||
print "<font class='base'>$errormessage </font>\n";
|
||||
&Header::closebox();
|
||||
}
|
||||
|
||||
print "<form method='post' action='$ENV{'SCRIPT_NAME'}'>\n";
|
||||
|
||||
&Header::openbox('100%', 'left', "$Lang::tr{'settings'}:");
|
||||
print <<END
|
||||
<table width='100%'>
|
||||
<tr>
|
||||
<td><input type='checkbox' name='ENABLE' $checked{'ENABLE'}{'on'} /></td>
|
||||
<td class='base' colspan='2'>$Lang::tr{'traffic shaping'}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td width='30%' class='base'>$Lang::tr{'downlink speed'}: </td>
|
||||
<td width='70%'><input type='text' name='DOWNLINK' value='$shapingsettings{'DOWNLINK'}' size='5' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td class='base'>$Lang::tr{'uplink speed'}: </td>
|
||||
<td><input type='text' name='UPLINK' value='$shapingsettings{'UPLINK'}' size='5' /></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table width='100%'>
|
||||
<hr />
|
||||
<tr>
|
||||
<td width='50%'> </td>
|
||||
<td width='50%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'save'}' /></td>
|
||||
</tr>
|
||||
</table>
|
||||
END
|
||||
;
|
||||
&Header::closebox;
|
||||
|
||||
print "</form>\n";
|
||||
print "<form method='post' action='$ENV{'SCRIPT_NAME'}'>\n";
|
||||
|
||||
my $buttontext = $Lang::tr{'add'};
|
||||
if($shapingsettings{'ACTION'} eq $Lang::tr{'edit'}) {
|
||||
$buttontext = $Lang::tr{'update'};
|
||||
&Header::openbox('100%', 'left', $Lang::tr{'edit service'});
|
||||
} else {
|
||||
&Header::openbox('100%', 'left', $Lang::tr{'add service'});
|
||||
}
|
||||
|
||||
print <<END
|
||||
|
||||
<table width='100%'>
|
||||
<tr>
|
||||
<td class='base'>$Lang::tr{'priority'}: </td>
|
||||
<td><select name='SERVICE_PRIO'>
|
||||
<option value='10' $service_selected{'SERVICE_PRIO'}{'10'}>$Lang::tr{'high'}</option>
|
||||
<option value='20' $service_selected{'SERVICE_PRIO'}{'20'}>$Lang::tr{'medium'}</option>
|
||||
<option value='30' $service_selected{'SERVICE_PRIO'}{'30'}>$Lang::tr{'low'}</option>
|
||||
</select></td>
|
||||
<td width='20%' class='base' align='right'>$Lang::tr{'port'}: </td>
|
||||
<td><input type='text' name='SERVICE_PORT' value='$shapingsettings{'SERVICE_PORT'}' size='5' /></td>
|
||||
<td width='20%' class='base' align='right'>$Lang::tr{'protocol'}: </td>
|
||||
<td><select name='SERVICE_PROT'>
|
||||
<option value='tcp' $service_selected{'SERVICE_PROT'}{'tcp'}>TCP</option>
|
||||
<option value='udp' $service_selected{'SERVICE_PROT'}{'udp'}>UDP</option>
|
||||
</select></td>
|
||||
<td width='20%' class='base' align='right'>$Lang::tr{'enabled'} </td>
|
||||
<td width='20%'><input type='checkbox' name='SERVICE_ENABLED' $service_checked{'SERVICE_ENABLED'}{'on'} /></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table width='100%'>
|
||||
<hr />
|
||||
<tr>
|
||||
<td width='50%'> </td>
|
||||
<td width='50%' align='center'><input type='submit' name='SUBMIT' value='$buttontext' /><input type='hidden' name='ACTION' value='$Lang::tr{'add'}' /></td>
|
||||
</tr>
|
||||
</table>
|
||||
END
|
||||
;
|
||||
&Header::closebox;
|
||||
|
||||
if ($shapingsettings{'ACTION'} eq $Lang::tr{'edit'}) {
|
||||
print "<input type='hidden' name='EDITING' value='$shapingsettings{'ID'}' />\n";
|
||||
} else {
|
||||
print "<input type='hidden' name='EDITING' value='no' />\n";
|
||||
}
|
||||
|
||||
print "</form>\n";
|
||||
|
||||
&Header::openbox('100%', 'left', $Lang::tr{'shaping list options'});
|
||||
print <<END
|
||||
<table width='100%' align='center'>
|
||||
<tr>
|
||||
<td width='33%' align='center' class='boldbase'><b>$Lang::tr{'priority'}</b></td>
|
||||
<td width='33%' align='center' class='boldbase'><b>$Lang::tr{'port'}</b></td>
|
||||
<td width='33%' align='center' class='boldbase'><b>$Lang::tr{'protocol'}</b></td>
|
||||
<td align='center' class='boldbase' colspan='3'><b>$Lang::tr{'action'}</b></td>
|
||||
</tr>
|
||||
END
|
||||
;
|
||||
|
||||
my $id = 0;
|
||||
open(SERVICES, "$configfile") or die 'Unable to open shaping config file.';
|
||||
while (<SERVICES>)
|
||||
{
|
||||
my $gif = '';
|
||||
my $prio = '';
|
||||
my $gdesc = '';
|
||||
$id++;
|
||||
chomp($_);
|
||||
my @temp = split(/\,/,$_);
|
||||
if ($temp[3] eq "on") {
|
||||
$gif = 'on.gif'; $gdesc=$Lang::tr{'click to disable'}; }
|
||||
else {
|
||||
$gif = 'off.gif'; $gdesc=$Lang::tr{'click to enable'}; }
|
||||
if ($shapingsettings{'ACTION'} eq $Lang::tr{'edit'} && $shapingsettings{'ID'} eq $id) {
|
||||
print "<tr bgcolor='${Header::colouryellow}'>\n"; }
|
||||
elsif ($id % 2) {
|
||||
print "<tr bgcolor='${Header::table1colour}'>\n"; }
|
||||
else {
|
||||
print "<tr bgcolor='${Header::table2colour}'>\n"; }
|
||||
if ($temp[2] eq "10") { $prio = $Lang::tr{'high'}; }
|
||||
if ($temp[2] eq "20") { $prio = $Lang::tr{'medium'}; }
|
||||
if ($temp[2] eq "30") { $prio = $Lang::tr{'low'}; }
|
||||
|
||||
print <<END
|
||||
<td align='center'>$prio</td>
|
||||
<td align='center'>$temp[1]</td>
|
||||
<td align='center'>$temp[0]</td>
|
||||
|
||||
<td align='center'>
|
||||
<form method='post' action='$ENV{'SCRIPT_NAME'}' name='frma$id'>
|
||||
<input type='image' name='$Lang::tr{'toggle enable disable'}' src='/images/$gif' alt='$gdesc' title='$gdesc' />
|
||||
<input type='hidden' name='ACTION' value='$Lang::tr{'toggle enable disable'}' />
|
||||
<input type='hidden' name='ID' value='$id' />
|
||||
</form>
|
||||
</td>
|
||||
|
||||
<td align='center'>
|
||||
<form method='post' name='frmb$id' action='$ENV{'SCRIPT_NAME'}'>
|
||||
<input type='image' name='$Lang::tr{'edit'}' src='/images/edit.gif' title='$Lang::tr{'edit'}' alt='$Lang::tr{'edit'}' />
|
||||
<input type='hidden' name='ID' value='$id' />
|
||||
<input type='hidden' name='ACTION' value='$Lang::tr{'edit'}' />
|
||||
</form>
|
||||
</td>
|
||||
|
||||
<td align='center'>
|
||||
<form method='post' name='frmc$id' action='$ENV{'SCRIPT_NAME'}'>
|
||||
<input type='image' name='$Lang::tr{'remove'}' src='/images/delete.gif' title='$Lang::tr{'remove'}' alt='$Lang::tr{'remove'}' />
|
||||
<input type='hidden' name='ID' value='$id' />
|
||||
<input type='hidden' name='ACTION' value='$Lang::tr{'remove'}' />
|
||||
</form>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
END
|
||||
;
|
||||
}
|
||||
close(SERVICES);
|
||||
|
||||
print <<END
|
||||
</table>
|
||||
END
|
||||
;
|
||||
&Header::closebox;
|
||||
|
||||
|
||||
&Header::closebigbox();
|
||||
|
||||
&Header::closepage;
|
||||
@@ -1,87 +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";
|
||||
|
||||
my %cgiparams=();
|
||||
my $death = 0;
|
||||
my $rebirth = 0;
|
||||
|
||||
&Header::showhttpheaders();
|
||||
|
||||
$cgiparams{'ACTION'} = '';
|
||||
&Header::getcgihash(\%cgiparams);
|
||||
|
||||
if ($cgiparams{'ACTION'} eq $Lang::tr{'shutdown'}) {
|
||||
$death = 1;
|
||||
&General::log($Lang::tr{'shutting down ipfire'});
|
||||
system '/usr/local/bin/ipfirereboot down';
|
||||
} elsif ($cgiparams{'ACTION'} eq $Lang::tr{'reboot'}) {
|
||||
$rebirth = 1;
|
||||
&General::log($Lang::tr{'rebooting ipfire'});
|
||||
system '/usr/local/bin/ipfirereboot boot';
|
||||
}
|
||||
if ($death == 0 && $rebirth == 0) {
|
||||
|
||||
&Header::openpage($Lang::tr{'shutdown control'}, 1, '');
|
||||
|
||||
&Header::openbigbox('100%', 'left');
|
||||
|
||||
print "<form method='post' action='$ENV{'SCRIPT_NAME'}'>\n";
|
||||
|
||||
&Header::openbox('100%', 'left', $Lang::tr{'shutdown2'});
|
||||
print <<END
|
||||
<table width='100%'>
|
||||
<tr>
|
||||
<td width='50%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'reboot'}' /></td>
|
||||
<td width='50%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'shutdown'}' /></td>
|
||||
</tr>
|
||||
</table>
|
||||
END
|
||||
;
|
||||
&Header::closebox();
|
||||
|
||||
} else {
|
||||
my $message='';
|
||||
my $title='';
|
||||
my $refresh = "<meta http-equiv='refresh' content='5; URL=/cgi-bin/index.cgi' />";
|
||||
if ($death) {
|
||||
$title = $Lang::tr{'shutting down'};
|
||||
$message = $Lang::tr{'ipfire has now shutdown'};
|
||||
} else {
|
||||
$title = $Lang::tr{'rebooting'};
|
||||
$message = $Lang::tr{'ipfire has now rebooted'};
|
||||
}
|
||||
&Header::openpage($title, 0, $refresh);
|
||||
|
||||
&Header::openbigbox('100%', 'center');
|
||||
print <<END
|
||||
<div align='center'>
|
||||
<table width='100%' bgcolor='#ffffff'>
|
||||
<tr><td align='center'>
|
||||
<br /><br /><img src='/ipfire_big.gif' /><br /><br /><br />
|
||||
</td></tr>
|
||||
</table>
|
||||
<br />
|
||||
<font size='6'>$message</font>
|
||||
</div>
|
||||
END
|
||||
;
|
||||
}
|
||||
|
||||
&Header::closebigbox();
|
||||
&Header::closepage();
|
||||
@@ -131,10 +131,6 @@ print <<END;
|
||||
<input type='submit' name='ACTION' value='$Lang::tr{'update'}' />
|
||||
</form>
|
||||
</td>
|
||||
<td width='5%' align='center'>
|
||||
<form method='post' action='/cgi-bin/trafficadm.cgi'>
|
||||
<input type='submit' name='ACTION' value='$Lang::tr{'net-traffic configuration'}' />
|
||||
</form>
|
||||
</td>
|
||||
<td width='5%' align='center'>
|
||||
<form method='post' action='/cgi-bin/traffics.cgi'>
|
||||
|
||||
@@ -1,407 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# This code is distributed under the terms of the GPL
|
||||
#
|
||||
# Copyright (c) 2005 Achim Weber
|
||||
#
|
||||
# $Id: trafficadm.cgi,v 1.21 2006/12/31 14:33:18 dotzball Exp $
|
||||
#
|
||||
|
||||
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}/net-traffic/net-traffic-admin.pl";
|
||||
|
||||
my %cgiparams;
|
||||
my $errormessage = '';
|
||||
my $infomessage = '';
|
||||
my $saveerror = 0;
|
||||
my @days = ( 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31 );
|
||||
my @warnLevels = ( 50,60,70,80,90,100 );
|
||||
|
||||
my @dummy = ($NETTRAFF::settingsfile, ${Header::colourred});
|
||||
undef(@dummy);
|
||||
|
||||
&Header::showhttpheaders();
|
||||
|
||||
# Init parameters
|
||||
$cgiparams{'MONTHLY_VOLUME_ON'} = 'off';
|
||||
$cgiparams{'MONTHLY_VOLUME'} = '';
|
||||
$cgiparams{'STARTDAY'} = '1';
|
||||
$cgiparams{'WARN_ON'} = 'off';
|
||||
$cgiparams{'WARN'} = '80';
|
||||
$cgiparams{'CALC_INTERVAL'} = '60';
|
||||
$cgiparams{'SHOW_AT_HOME'} = 'off';
|
||||
$cgiparams{'SEND_EMAIL_ON'} = 'off';
|
||||
$cgiparams{'EMAIL_TO'} = '';
|
||||
$cgiparams{'EMAIL_FROM'} = '';
|
||||
$cgiparams{'EMAIL_USR'} = '';
|
||||
$cgiparams{'EMAIL_PW'} = '';
|
||||
$cgiparams{'EMAIL_SERVER'} = '';
|
||||
$cgiparams{'VERSION_CHECK_ON'} = 'off';
|
||||
|
||||
|
||||
&Header::getcgihash(\%cgiparams);
|
||||
|
||||
if ($cgiparams{'ACTION'} eq $Lang::tr{'save'})
|
||||
{
|
||||
&validSave();
|
||||
|
||||
if ($errormessage) {
|
||||
$saveerror = 1;
|
||||
}
|
||||
else { # no error, all right, save new settings
|
||||
&General::writehash($NETTRAFF::settingsfile, \%cgiparams);
|
||||
# calculate traffic
|
||||
`/usr/local/bin/monitorTraff --force < /dev/null > /dev/null 2>&1 &`;
|
||||
}
|
||||
} # end if ($cgiparams{'ACTION'} eq $Lang::tr{'save'})
|
||||
|
||||
|
||||
# if user want to save settings and get a errormessage, we don<6F>t
|
||||
# overwrite users input
|
||||
unless ($saveerror) {
|
||||
|
||||
&NETTRAFF::readSettings();
|
||||
|
||||
$cgiparams{'MONTHLY_VOLUME_ON'} = $NETTRAFF::settings{'MONTHLY_VOLUME_ON'};
|
||||
$cgiparams{'MONTHLY_VOLUME'} = $NETTRAFF::settings{'MONTHLY_VOLUME'};
|
||||
$cgiparams{'STARTDAY'} = $NETTRAFF::settings{'STARTDAY'};
|
||||
$cgiparams{'WARN_ON'} = $NETTRAFF::settings{'WARN_ON'};
|
||||
$cgiparams{'WARN'} = $NETTRAFF::settings{'WARN'};
|
||||
$cgiparams{'CALC_INTERVAL'} = $NETTRAFF::settings{'CALC_INTERVAL'};
|
||||
$cgiparams{'SHOW_AT_HOME'} = $NETTRAFF::settings{'SHOW_AT_HOME'};
|
||||
$cgiparams{'SEND_EMAIL_ON'} = $NETTRAFF::settings{'SEND_EMAIL_ON'};
|
||||
$cgiparams{'EMAIL_TO'} = $NETTRAFF::settings{'EMAIL_TO'};
|
||||
$cgiparams{'EMAIL_FROM'} = $NETTRAFF::settings{'EMAIL_FROM'};
|
||||
$cgiparams{'EMAIL_USR'} = $NETTRAFF::settings{'EMAIL_USR'};
|
||||
$cgiparams{'EMAIL_PW'} = $NETTRAFF::settings{'EMAIL_PW'};
|
||||
$cgiparams{'EMAIL_SERVER'} = $NETTRAFF::settings{'EMAIL_SERVER'};
|
||||
$cgiparams{'VERSION_CHECK_ON'} = $NETTRAFF::settings{'VERSION_CHECK_ON'};
|
||||
|
||||
} # end unless ($saveerror)
|
||||
|
||||
|
||||
if ($cgiparams{'ACTION'} eq $Lang::tr{'send test mail'})
|
||||
{
|
||||
# send test email
|
||||
my $return = `/usr/local/bin/monitorTraff --testEmail`;
|
||||
|
||||
if($return =~ /Email was sent successfully!/)
|
||||
{
|
||||
$infomessage = "$Lang::tr{'test email was sent'}<br/>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$errormessage = "$Lang::tr{'test email could not be sent'}:<br/>";
|
||||
$errormessage .= "$return <br />";
|
||||
}
|
||||
|
||||
|
||||
} # end if ($cgiparams{'ACTION'} eq $Lang::tr{'send test mail'})
|
||||
|
||||
|
||||
|
||||
my %selected;
|
||||
$selected{'CALC_INTERVAL'}{'5'} = '';
|
||||
$selected{'CALC_INTERVAL'}{'10'} = '';
|
||||
$selected{'CALC_INTERVAL'}{'15'} = '';
|
||||
$selected{'CALC_INTERVAL'}{'30'} = '';
|
||||
$selected{'CALC_INTERVAL'}{'60'} = '';
|
||||
$selected{'CALC_INTERVAL'}{$cgiparams{'CALC_INTERVAL'}} = "selected='selected'";
|
||||
|
||||
my %checked;
|
||||
$checked{'MONTHLY_VOLUME_ON'}{'off'} = '';
|
||||
$checked{'MONTHLY_VOLUME_ON'}{'on'} = '';
|
||||
$checked{'MONTHLY_VOLUME_ON'}{$cgiparams{'MONTHLY_VOLUME_ON'}} = "checked='checked'";
|
||||
|
||||
$checked{'WARN_ON'}{'off'} = '';
|
||||
$checked{'WARN_ON'}{'on'} = '';
|
||||
$checked{'WARN_ON'}{$cgiparams{'WARN_ON'}} = "checked='checked'";
|
||||
|
||||
$checked{'SHOW_AT_HOME'}{'off'} = '';
|
||||
$checked{'SHOW_AT_HOME'}{'on'} = '';
|
||||
$checked{'SHOW_AT_HOME'}{$cgiparams{'SHOW_AT_HOME'}} = "checked='checked'" ;
|
||||
|
||||
$checked{'SEND_EMAIL_ON'}{'off'} = '';
|
||||
$checked{'SEND_EMAIL_ON'}{'on'} = '';
|
||||
$checked{'SEND_EMAIL_ON'}{$cgiparams{'SEND_EMAIL_ON'}} = "checked='checked'" ;
|
||||
|
||||
$checked{'VERSION_CHECK_ON'}{'off'} = '';
|
||||
$checked{'VERSION_CHECK_ON'}{'on'} = '';
|
||||
$checked{'VERSION_CHECK_ON'}{$cgiparams{'VERSION_CHECK_ON'}} = "checked='checked'" ;
|
||||
|
||||
|
||||
my $btnTestmailDisabled = "";
|
||||
$btnTestmailDisabled = "disabled='disabled'" if($cgiparams{'SEND_EMAIL_ON'} ne 'on');
|
||||
|
||||
&Header::openpage($Lang::tr{'traffic monitor'}, 1, '');
|
||||
&Header::openbigbox('100%', 'left');
|
||||
|
||||
if ($errormessage) {
|
||||
&Header::openbox('100%', 'left', $Lang::tr{'error messages'});
|
||||
print "<class name='base'><font color='${Header::colourred}'>$errormessage\n</font>";
|
||||
print " </class>\n";
|
||||
&Header::closebox();
|
||||
}
|
||||
|
||||
if($infomessage) {
|
||||
&Header::openbox('100%', 'left', "$Lang::tr{'traffic info messages'}:");
|
||||
print "<class name='base'>$infomessage\n";
|
||||
print " </class>\n";
|
||||
&Header::closebox();
|
||||
}
|
||||
|
||||
&Header::openbox('100%', 'left', "$Lang::tr{'net-traffic configuration'}:");
|
||||
|
||||
print <<END;
|
||||
<form method='post' action='$ENV{'SCRIPT_NAME'}'>
|
||||
<table width='100%'>
|
||||
<tr>
|
||||
<td align='left' class='base' width='1%'>
|
||||
<input type="checkbox" name="SHOW_AT_HOME" $checked{'SHOW_AT_HOME'}{'on'} />
|
||||
</td>
|
||||
<td align='left' class='base' nowrap='nowrap' colspan="3">
|
||||
$Lang::tr{'display traffic at home'}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align='left' class='base'>
|
||||
<input type="checkbox" name="MONTHLY_VOLUME_ON" $checked{'MONTHLY_VOLUME_ON'}{'on'} />
|
||||
</td>
|
||||
<td align='left' class='base' nowrap='nowrap' colspan="2">
|
||||
$Lang::tr{'monthly volume'} (MByte):
|
||||
</td>
|
||||
<td align='left' class='base' >
|
||||
<input type='text' name='MONTHLY_VOLUME' value='$cgiparams{'MONTHLY_VOLUME'}' size='20' maxlength='17' />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align='left' class='base' colspan="2"></td>
|
||||
<td align='left' class='base' nowrap='nowrap' >
|
||||
$Lang::tr{'monthly volume start day'}:
|
||||
</td>
|
||||
<td align='left' class='base' >
|
||||
<select name='STARTDAY'>
|
||||
END
|
||||
|
||||
foreach my $day (@days)
|
||||
{
|
||||
print " <option ";
|
||||
if ($day == $cgiparams{'STARTDAY'}) {
|
||||
print 'selected=\'selected\' '; }
|
||||
print "value='$day'>$day</option>\n";
|
||||
}
|
||||
print <<END;
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align='left' class='base' width='1%'></td>
|
||||
<td align='left' class='base' width='1%'>
|
||||
<input type="checkbox" name="WARN_ON" $checked{'WARN_ON'}{'on'} />
|
||||
</td>
|
||||
<td align='left' class='base' width='20%' nowrap='nowrap'>
|
||||
$Lang::tr{'warn when traffic reaches'}:
|
||||
</td>
|
||||
<td align='left' class='base' width='78%'>
|
||||
<select name='WARN'>
|
||||
END
|
||||
|
||||
foreach my $level (@warnLevels)
|
||||
{
|
||||
print " <option ";
|
||||
if ($level == $cgiparams{'WARN'}) {
|
||||
print 'selected=\'selected\' '; }
|
||||
print "value='$level'>$level</option>\n";
|
||||
}
|
||||
print <<END;
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align='left' class='base' colspan="2"></td>
|
||||
<td align='left' class='base' nowrap='nowrap' >
|
||||
$Lang::tr{'calc traffic all x minutes'}:
|
||||
</td>
|
||||
<td align='left' class='base' >
|
||||
<select name='CALC_INTERVAL'>
|
||||
<option value='5' $selected{'CALC_INTERVAL'}{'5'} > 5</option>
|
||||
<option value='10' $selected{'CALC_INTERVAL'}{'10'}>10</option>
|
||||
<option value='15' $selected{'CALC_INTERVAL'}{'15'}>15</option>
|
||||
<option value='30' $selected{'CALC_INTERVAL'}{'30'}>30</option>
|
||||
<option value='60' $selected{'CALC_INTERVAL'}{'60'}>60</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align='left' class='base'> </td>
|
||||
<td align='left' class='base'>
|
||||
<input type="checkbox" name="SEND_EMAIL_ON" $checked{'SEND_EMAIL_ON'}{'on'} />
|
||||
</td>
|
||||
<td align='left' class='base' colspan="2" nowrap='nowrap' >
|
||||
$Lang::tr{'send email notification'}:
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align='left' class='base' colspan="2"> </td>
|
||||
<td align='left' class='base' nowrap='nowrap'>
|
||||
$Lang::tr{'to email adr'}:
|
||||
</td>
|
||||
<td align='left' class='base' >
|
||||
<input type='text' name='EMAIL_TO' value='$cgiparams{'EMAIL_TO'}' size='25' />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align='left' class='base' colspan="2"> </td>
|
||||
<td align='left' class='base' nowrap='nowrap'>
|
||||
$Lang::tr{'from email adr'}:
|
||||
</td>
|
||||
<td align='left' class='base' >
|
||||
<input type='text' name='EMAIL_FROM' value='$cgiparams{'EMAIL_FROM'}' size='25' />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align='left' class='base' colspan="2"> </td>
|
||||
<td align='left' class='base' nowrap='nowrap'>
|
||||
$Lang::tr{'from email user'}:
|
||||
</td>
|
||||
<td align='left' class='base' >
|
||||
<input type='text' name='EMAIL_USR' value='$cgiparams{'EMAIL_USR'}' size='25' />
|
||||
<img src='/blob.gif' alt='*' />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align='left' class='base' colspan="2"> </td>
|
||||
<td align='left' class='base' nowrap='nowrap'>
|
||||
$Lang::tr{'from email pw'}:
|
||||
</td>
|
||||
<td align='left' class='base' >
|
||||
<input type='password' name='EMAIL_PW' value='$cgiparams{'EMAIL_PW'}' size='25' />
|
||||
<img src='/blob.gif' alt='*' />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align='left' class='base' colspan="2"> </td>
|
||||
<td align='left' class='base' nowrap='nowrap'>
|
||||
$Lang::tr{'from email server'}:
|
||||
</td>
|
||||
<td align='left' class='base' >
|
||||
<input type='text' name='EMAIL_SERVER' value='$cgiparams{'EMAIL_SERVER'}' size='25' />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align='left' class='base' colspan="2"> </td>
|
||||
<td align='left' class='base' colspan="2">
|
||||
<input type='submit' name='ACTION' value='$Lang::tr{'send test mail'}' $btnTestmailDisabled />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<hr />
|
||||
<table width='100%'>
|
||||
<tr>
|
||||
<td align='left' class='base' nowrap='nowrap' width='2%'>
|
||||
<img src='/blob.gif' alt ='*' align='top' />
|
||||
<font class='base'>$Lang::tr{'this field may be blank'}</font>
|
||||
</td>
|
||||
<td align='center' class='base' width='48%'>
|
||||
<input type='submit' name='ACTION' value='$Lang::tr{'save'}' />
|
||||
END
|
||||
|
||||
# if user input cause an error
|
||||
# and user want a reset, we re-read settings from settingsfile
|
||||
if ($errormessage ne '') {
|
||||
print "<input type='submit' name='ACTION' value='$Lang::tr{'reset'}' />";
|
||||
}
|
||||
else {
|
||||
print "<input type='reset' name='ACTION' value='$Lang::tr{'reset'}' />";
|
||||
}
|
||||
|
||||
print <<END;
|
||||
</td>
|
||||
<td align='left' class='base' nowrap='nowrap' width='50%'> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<hr />
|
||||
<table width='100%'>
|
||||
<tr>
|
||||
<td align='left' class='base' width='2%'>
|
||||
|
||||
</td>
|
||||
<td align='left' class='base' width='98%'>
|
||||
<form method='post' action='/cgi-bin/traffic.cgi'>
|
||||
<input type='submit' name='ACTION' value='$Lang::tr{'traffic back'}' />
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
END
|
||||
|
||||
&Header::closebox();
|
||||
&Header::closebigbox();
|
||||
&Header::closepage();
|
||||
|
||||
|
||||
sub validSave
|
||||
{
|
||||
if ($cgiparams{'SHOW_AT_HOME'} ne 'on' ) {
|
||||
$cgiparams{'SHOW_AT_HOME'} = 'off';
|
||||
}
|
||||
|
||||
if ($cgiparams{'MONTHLY_VOLUME_ON'} ne 'on' ) {
|
||||
$cgiparams{'MONTHLY_VOLUME_ON'} = 'off';
|
||||
}
|
||||
|
||||
if($cgiparams{'MONTHLY_VOLUME_ON'} eq 'on')
|
||||
{
|
||||
if($cgiparams{'MONTHLY_VOLUME'} !~ /^\d+$/ || $cgiparams{'MONTHLY_VOLUME'} < 1) {
|
||||
$errormessage .= "$Lang::tr{'monthly traffic bad'}<br/>";
|
||||
}
|
||||
|
||||
if($cgiparams{'STARTDAY'} < 1 || 31 < $cgiparams{'STARTDAY'}) {
|
||||
$errormessage .= "$Lang::tr{'monthly start day bad'}<br/>";
|
||||
}
|
||||
|
||||
if ($cgiparams{'WARN_ON'} ne 'on' ) {
|
||||
$cgiparams{'WARN_ON'} = 'off';
|
||||
}
|
||||
|
||||
if($cgiparams{'WARN_ON'} eq 'on' && $cgiparams{'WARN'} !~ /^\d+$/) {
|
||||
$errormessage .= "$Lang::tr{'traffic warn level bad'}<br/>";
|
||||
}
|
||||
|
||||
if($cgiparams{'CALC_INTERVAL'} < 5 || 60 < $cgiparams{'CALC_INTERVAL'}) {
|
||||
$errormessage .= "$Lang::tr{'traffic calc time bad'}<br/>";
|
||||
}
|
||||
|
||||
if ($cgiparams{'SEND_EMAIL_ON'} ne 'on' ) {
|
||||
$cgiparams{'SEND_EMAIL_ON'} = 'off';
|
||||
}
|
||||
|
||||
if($cgiparams{'SEND_EMAIL_ON'} eq 'on' )
|
||||
{
|
||||
if($cgiparams{'EMAIL_TO'} eq '' || (! &General::validemail($cgiparams{'EMAIL_TO'})) ) {
|
||||
$errormessage .= "$Lang::tr{'to warn email bad'}<br/>";
|
||||
}
|
||||
|
||||
if($cgiparams{'EMAIL_FROM'} eq '' || (! &General::validemail($cgiparams{'EMAIL_FROM'}))) {
|
||||
$errormessage .= "$Lang::tr{'from warn email bad'}<br/>";
|
||||
}
|
||||
|
||||
if($cgiparams{'EMAIL_SERVER'} eq '') {
|
||||
$errormessage .= "$Lang::tr{'email server can not be empty'}<br/>";
|
||||
}
|
||||
}
|
||||
} # monthly volumne == on
|
||||
|
||||
if ($cgiparams{'VERSION_CHECK_ON'} ne 'on' ) {
|
||||
$cgiparams{'VERSION_CHECK_ON'} = 'off';
|
||||
}
|
||||
}
|
||||
@@ -63,7 +63,6 @@ case "${2}" in
|
||||
boot_mesg "Registering DNS server..."
|
||||
echo $DNS1 > /var/ipfire/red/dns1
|
||||
echo $DNS2 > /var/ipfire/red/dns2
|
||||
echo "nameserver 127.0.0.1" > /etc/resolv.conf
|
||||
echo $ADDRESS > /var/ipfire/red/local-ipaddress
|
||||
evaluate_retval
|
||||
fi
|
||||
@@ -76,7 +75,12 @@ case "${2}" in
|
||||
ip route del default
|
||||
evaluate_retval
|
||||
fi
|
||||
|
||||
|
||||
if [ "${CONFIG_TYPE}" == "0" ] || [ "${CONFIG_TYPE}" == "" ]; then
|
||||
boot_mesg "Restoring default DNS Proxy Adress in resolv.conf..."
|
||||
echo "nameserver 127.0.0.1" > /etc/resolv.conf
|
||||
fi
|
||||
|
||||
boot_mesg "Removing IPv4 address ${ADDRESS} from the ${1} interface..."
|
||||
ip addr del ${args} dev ${1}
|
||||
evaluate_retval
|
||||
|
||||
Reference in New Issue
Block a user