Firewallhitgraphs gefixt.

Colours.txt fehlt noch fuer unseren Style.
...und wieder einige Sprachfixes.


git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@457 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8
This commit is contained in:
ms
2007-03-25 04:05:41 +00:00
parent 1065bfea84
commit 786f2c8a29
21 changed files with 158 additions and 1342 deletions

View File

@@ -4,57 +4,51 @@
'title' => "$tr{'sssystem status'}",
'enabled' => 1,
};
$substatus->{'20.networkstatus'} = {
'caption' => $tr{'ssnetwork status'},
'uri' => '/cgi-bin/netstatus.cgi',
'title' => "$tr{'ssnetwork status'}",
'enabled' => 1,
};
$substatus->{'30.systemgraphs'} = {
$substatus->{'20.systemgraphs'} = {
'caption' => $tr{'system graphs'},
'uri' => '/cgi-bin/graphs.cgi',
'novars' => 1,
'title' => "$tr{'system graphs'}",
'enabled' => 1,
};
$substatus->{'40.trafficgraphs'} = {
$substatus->{'30.trafficgraphs'} = {
'caption' => $tr{'sstraffic graphs'},
'uri' => '/cgi-bin/graphs.cgi',
'vars' => 'graph=network',
'title' => "$tr{'sstraffic graphs'}",
'enabled' => 1,
};
$substatus->{'50.proxygraphs'} = {
$substatus->{'40.proxygraphs'} = {
'caption' => $tr{'ssproxy graphs'},
'uri' => '/cgi-bin/proxygraphs.cgi',
'title' => "$tr{'ssproxy graphs'}",
'enabled' => 1,
};
$substatus->{'60.fwhits'} = {
$substatus->{'50.fwhits'} = {
'caption' => 'Firewall-Diagramme',
'uri' => '/cgi-bin/fwhits.cgi',
'title' => "Firewall-Diagramme",
'enabled' => 1,
};
$substatus->{'70.hardwaregraphs'} = {
$substatus->{'60.hardwaregraphs'} = {
'caption' => "$tr{'hardware graphs'}",
'uri' => '/cgi-bin/hardwaregraphs.cgi',
'title' => "$tr{'hardware graphs'}",
'enabled' => 1,
};
$substatus->{'80.connections'} = {
$substatus->{'70.connections'} = {
'caption' => $tr{'connections'},
'uri' => '/cgi-bin/connections.cgi',
'title' => "$tr{'connections'}",
'enabled' => 1,
};
$substatus->{'90.nettraf'} = {
$substatus->{'80.nettraf'} = {
'caption' => $tr{'sstraffic'},
'uri' => '/cgi-bin/traffic.cgi',
'title' => "$tr{'sstraffic'}",
'enabled' => 1,
};
$substatus->{'99.iptable'} = {
$substatus->{'90.iptable'} = {
'caption' => $tr{'iptable rules'},
'uri' => '/cgi-bin/iptables.cgi',
'title' => "$tr{'iptable rules'}",

View File

@@ -0,0 +1,9 @@
#usr/lib/perl5/site_perl/5.8.8/GD/Text
usr/lib/perl5/site_perl/5.8.8/GD/Text.pm
usr/lib/perl5/site_perl/5.8.8/GD/Text/Align.pm
usr/lib/perl5/site_perl/5.8.8/GD/Text/Wrap.pm
#usr/lib/perl5/site_perl/5.8.8/i586-linux/auto/GD/Text
#usr/lib/perl5/site_perl/5.8.8/i586-linux/auto/GD/Text/.packlist
#usr/share/man/man3/GD::Text.3
#usr/share/man/man3/GD::Text::Align.3
#usr/share/man/man3/GD::Text::Wrap.3

View File

@@ -1261,8 +1261,6 @@ srv/web/ipfire/cgi-bin/aliases.cgi
#srv/web/ipfire/cgi-bin/asterisk.cgi/calls
#srv/web/ipfire/cgi-bin/asterisk.cgi/conf
#srv/web/ipfire/cgi-bin/asterisk.cgi/status
#srv/web/ipfire/cgi-bin/backup.cgi
#srv/web/ipfire/cgi-bin/base.cgi
srv/web/ipfire/cgi-bin/changepw.cgi
srv/web/ipfire/cgi-bin/chpasswd.cgi
srv/web/ipfire/cgi-bin/connections.cgi
@@ -1287,11 +1285,16 @@ srv/web/ipfire/cgi-bin/index.cgi
srv/web/ipfire/cgi-bin/ipinfo.cgi
srv/web/ipfire/cgi-bin/iptables.cgi
srv/web/ipfire/cgi-bin/logs.cgi
#srv/web/ipfire/cgi-bin/logs.cgi/colours.txt
#srv/web/ipfire/cgi-bin/logs.cgi/config.dat
#srv/web/ipfire/cgi-bin/logs.cgi/firewalllog.dat
#srv/web/ipfire/cgi-bin/logs.cgi/firewalllogip.dat
#srv/web/ipfire/cgi-bin/logs.cgi/firewalllogport.dat
#srv/web/ipfire/cgi-bin/logs.cgi/ids.dat
#srv/web/ipfire/cgi-bin/logs.cgi/log.dat
#srv/web/ipfire/cgi-bin/logs.cgi/proxylog.dat
#srv/web/ipfire/cgi-bin/logs.cgi/showrequestfromip.dat
#srv/web/ipfire/cgi-bin/logs.cgi/showrequestfromport.dat
#srv/web/ipfire/cgi-bin/logs.cgi/summary.dat
#srv/web/ipfire/cgi-bin/logs.cgi/urlfilter.dat
srv/web/ipfire/cgi-bin/modem.cgi
@@ -1320,7 +1323,6 @@ srv/web/ipfire/cgi-bin/traffics.cgi
srv/web/ipfire/cgi-bin/updatexlrator.cgi
srv/web/ipfire/cgi-bin/upload.cgi
srv/web/ipfire/cgi-bin/upnp.cgi
#srv/web/ipfire/cgi-bin/uptime.cgi
srv/web/ipfire/cgi-bin/urlfilter.cgi
srv/web/ipfire/cgi-bin/vpnmain.cgi
srv/web/ipfire/cgi-bin/wakeonlan.cgi

View File

@@ -45,6 +45,9 @@ var/ipfire/extrahd/devices
var/ipfire/extrahd/partitions
var/ipfire/extrahd/scan
var/ipfire/extrahd/settings
var/ipfire/fwlogs
#var/ipfire/fwlogs/ipsettings
#var/ipfire/fwlogs/portsettings
var/ipfire/general-functions.pl
var/ipfire/header.pl
var/ipfire/isdn

View File

@@ -1,3 +1,4 @@
usr/local/bin/extrahdctrl
usr/local/bin/getipstat
#usr/local/bin/installfcdsl
#usr/local/bin/installpackage
@@ -21,6 +22,7 @@ usr/local/bin/restartsquid
usr/local/bin/restartssh
usr/local/bin/restartsyslogd
usr/local/bin/restartwireless
#usr/local/bin/sambactrl
usr/local/bin/setaliases
usr/local/bin/setdate
usr/local/bin/setdmzholes
@@ -28,3 +30,4 @@ usr/local/bin/setfilters
usr/local/bin/setportfw
usr/local/bin/setxtaccess
usr/local/bin/timecheckctrl
usr/local/bin/upnpctrl

View File

@@ -46,8 +46,6 @@ WARNING: translation string unused: backup
WARNING: translation string unused: backup config floppy
WARNING: translation string unused: backup password
WARNING: translation string unused: bad characters in
WARNING: translation string unused: bad destination range
WARNING: translation string unused: bad source range
WARNING: translation string unused: blue access
WARNING: translation string unused: blue access use hint
WARNING: translation string unused: blue interface
@@ -62,7 +60,6 @@ WARNING: translation string unused: comment
WARNING: translation string unused: compression
WARNING: translation string unused: connect
WARNING: translation string unused: connect the modem
WARNING: translation string unused: connected
WARNING: translation string unused: could not connect to
WARNING: translation string unused: could not connect to www ipcop org
WARNING: translation string unused: could not create directory
@@ -82,7 +79,6 @@ WARNING: translation string unused: ddns help dnsmadeeasy
WARNING: translation string unused: ddns help freedns
WARNING: translation string unused: ddns help plus
WARNING: translation string unused: debugme
WARNING: translation string unused: destination port numbers
WARNING: translation string unused: dhcp base ip fixed lease
WARNING: translation string unused: dhcp create fixed leases
WARNING: translation string unused: dhcp fixed lease err1
@@ -127,7 +123,6 @@ WARNING: translation string unused: host configuration
WARNING: translation string unused: hostname and domain already in use
WARNING: translation string unused: hours2
WARNING: translation string unused: id
WARNING: translation string unused: idle
WARNING: translation string unused: idle cpu
WARNING: translation string unused: idle cpu usage
WARNING: translation string unused: ids logs
@@ -224,7 +219,6 @@ WARNING: translation string unused: sectors read from disk per second
WARNING: translation string unused: sectors written to disk per second
WARNING: translation string unused: select media
WARNING: translation string unused: shared memory
WARNING: translation string unused: source port numbers
WARNING: translation string unused: squid extension methods
WARNING: translation string unused: squid extension methods invalid
WARNING: translation string unused: squid fix cache

View File

@@ -48,8 +48,6 @@ WARNING: translation string unused: backup
WARNING: translation string unused: backup archive
WARNING: translation string unused: backup config floppy
WARNING: translation string unused: backup erase key
WARNING: translation string unused: bad destination range
WARNING: translation string unused: bad source range
WARNING: translation string unused: bewan adsl pci st
WARNING: translation string unused: bewan adsl usb
WARNING: translation string unused: blue access
@@ -65,7 +63,6 @@ WARNING: translation string unused: comment
WARNING: translation string unused: compression
WARNING: translation string unused: connect
WARNING: translation string unused: connect the modem
WARNING: translation string unused: connected
WARNING: translation string unused: could not connect to
WARNING: translation string unused: could not connect to www ipfire org
WARNING: translation string unused: could not create directory
@@ -82,7 +79,6 @@ WARNING: translation string unused: current profile
WARNING: translation string unused: daily firewallhits
WARNING: translation string unused: dat without key
WARNING: translation string unused: debugme
WARNING: translation string unused: destination port numbers
WARNING: translation string unused: dhcp server disabled on blue interface
WARNING: translation string unused: dhcp server enabled on blue interface
WARNING: translation string unused: dialup settings
@@ -124,7 +120,6 @@ WARNING: translation string unused: host configuration
WARNING: translation string unused: hostname and domain already in use
WARNING: translation string unused: hours2
WARNING: translation string unused: id
WARNING: translation string unused: idle
WARNING: translation string unused: idle cpu
WARNING: translation string unused: idle cpu usage
WARNING: translation string unused: ids logs
@@ -216,7 +211,6 @@ WARNING: translation string unused: sectors read from disk per second
WARNING: translation string unused: sectors written to disk per second
WARNING: translation string unused: shaping add options
WARNING: translation string unused: shared memory
WARNING: translation string unused: source port numbers
WARNING: translation string unused: squid extension methods
WARNING: translation string unused: squid extension methods invalid
WARNING: translation string unused: ssdmz pinholes

View File

@@ -1,7 +1,6 @@
############################################################################
# Checking install/setup translations for language: en #
############################################################################
< TR_INSTALLING_LANG_CACHE
############################################################################
# Checking cgi-bin translations for language: en #
############################################################################

View File

@@ -11,6 +11,7 @@
* Digest-SHA1-2.10
* GD-2.35
* GDGraph-1.4308
* GDTextUtil-0.86
* Geo-IP-PurePerl-1.17
* HTML-Parser-3.45
* HTML-Tagset-3.04
@@ -118,7 +119,6 @@
* ipp2p-0.8.2-iptables
* iproute2-2.6.16-060323
* iptables-1.3.5
* iptables-1.3.7
* iptraf-3.0.0
* iptstate-2.1
* iputils-ss020927

View File

@@ -1,652 +0,0 @@
#!/usr/bin/perl
#
# IPFire CGI's - backup.cgi: manage import/export of configuration files
#
# This code is distributed under the terms of the GPL
#
# (c) The IPFire Team
# 2005 Franck Bourdonnec, major rewrite
#
# $Id: backup.cgi,v 1.2.2.15 2006/01/29 15:31:49 eoberlander Exp $
#
#
# to fully troubleshot your code, uncomment diagnostics, Carp and cluck lines
# use diagnostics; # need to add the file /usr/lib/perl5/5.8.x/pods/perldiag.pod before to work
# next look at /var/log/httpd/error_log , http://www.perl.com/pub/a/2002/05/07/mod_perl.html may help
#use warnings;
use strict;
#use Carp ();
#local $SIG{__WARN__} = \&Carp::cluck;
use File::Copy;
use Sys::Hostname;
require '/var/ipfire/general-functions.pl';
require "${General::swroot}/lang.pl";
require "${General::swroot}/header.pl";
my $errormessage = '';
my $warnmessage = '';
my $setdir = '/home/httpd/html/backup'; # location where sets are stored and imported
my $datafile = hostname() . '.dat'; # file containing data backup
my $datefile = $datafile . '.time'; # and creation date
# ask if backup crypting key exists
my $tmpkeyfile = "$setdir/key"; # import the backup key
# Get GUI values
my %settings = ();
&Header::getcgihash(\%settings, {'wantfile' => 1, 'filevar' => 'FH'});
##
## Backup key management
##
#
# Export the key. root pw is required to avoid user 'noboby' uses the helper to read it and creates
# fake backup.
#
if ($settings{'ACTION'} eq $Lang::tr{'backup export key'}) {
my $size = 0;
if ($settings{'PASSWORD1'} ne '' && $settings{'PASSWORD1'} ne $settings{'PASSWORD2'} ){
$errormessage = $Lang::tr{'passwords do not match'}
} else {
my @lines = `/usr/local/bin/ipfirebackup -keycat $settings{'PASSWORD'}`;
# If previous operation succeded and the key need to be crypted, redo operation with pipe to openssl
if (@lines && $settings{'PASSWORD1'}) {
@lines = `/usr/local/bin/ipfirebackup -keycat $settings{'PASSWORD'}|openssl enc -a -e -aes256 -salt -pass pass:$settings{'PASSWORD1'} `;
}
if (@lines) {
use bytes;
foreach (@lines) {$size += length($_)};
print "Pragma: no-cache\n";
print "Cache-control: no-cache\n";
print "Connection: close\n";
print "Content-type: application/octet-stream\n";
print "Content-Disposition: filename=backup.key\n";
print "Content-Length: $size\n\n";
print @lines;
exit (0);
} else {
$errormessage = $Lang::tr{'incorrect password'};
}
}
}
#
# Import the key. Fail if key exists. This avoid creating fake backup.
#
if ($settings{'ACTION'} eq $Lang::tr{'backup import key'}) {
if (ref ($settings{'FH'}) ne 'Fh') {
$errormessage = $Lang::tr{'no cfg upload'};
} else {
if (copy ($settings{'FH'}, $tmpkeyfile) != 1) {
$errormessage = $Lang::tr{'save error'};
} else {
# if a password is given, decrypt the key received in $tmpkeyfile file with it.
# no error is produce if the password is wrong.
if ($settings{'PASSWORD1'}) {
my @lines = `openssl enc -a -d -aes256 -salt -pass pass:$settings{'PASSWORD1'} -in $tmpkeyfile`;
open(FILE,">$tmpkeyfile");
print FILE @lines;
close (FILE);
}
$errormessage = &get_bk_error(system ('/usr/local/bin/ipfirebackup -key import')>>8);
}
}
}
#
# Import the key. Fail if key exists. Key is extracted from a non-encrypted backup (pre 1.4.10)
#
if ($settings{'ACTION'} eq $Lang::tr{'backup extract key'}) {
if (ref ($settings{'FH'}) ne 'Fh') {
$errormessage = $Lang::tr{'no cfg upload'};
} else {
if (copy ($settings{'FH'}, '/tmp/tmptarfile.tgz') != 1) {
$errormessage = $Lang::tr{'save error'};
} else {
system( "tar -C /tmp -xzf /tmp/tmptarfile.tgz */backup/backup.key;\
mv -f /tmp${General::swroot}/backup/backup.key $tmpkeyfile;\
rm -rf /tmp${General::swroot};\
rm /tmp/tmptarfile.tgz");
$errormessage = &get_bk_error(system ('/usr/local/bin/ipfirebackup -key import')>>8);
}
}
}
#
# Create the key. Cannot overwrite existing key to avoid difference with exported (saved) key
#
if ($settings{'ACTION'} eq $Lang::tr{'backup generate key'}) {
$errormessage = &get_bk_error(system('/usr/local/bin/ipfirebackup -key new')>>8);
}
my $cryptkeymissing = system ('/usr/local/bin/ipfirebackup -key exist')>>8;
&Header::showhttpheaders();
if ($cryptkeymissing) { #If no key is present, force creation or import
&Header::openpage($Lang::tr{'backup configuration'}, 1, '');
&Header::openbigbox('100%', 'left', '', $errormessage);
if ($errormessage) {
&Header::openbox('100%', 'left', $Lang::tr{'error messages'});
print "<font class='base'>$errormessage&nbsp;</font>";
&Header::closebox();
}
&Header::openbox('100%', 'left', $Lang::tr{'backup key'});
print <<END
<form method = 'post' enctype = 'multipart/form-data'>
<table>
<tr>
<td colspan='2'>
$Lang::tr{'backup explain key'}:
<ul>
<li>$Lang::tr{'backup explain key li1'}
<li>$Lang::tr{'backup explain key li2'}
<li>$Lang::tr{'backup explain key li3'}
</ul>
</td>
</tr><tr>
<td width='15%'></td><td width='20%'></td><td>
<input type = 'submit' name = 'ACTION' value = '$Lang::tr{'backup generate key'}' />
</td>
</tr><tr>
<td align='right'>$Lang::tr{'backup key file'}:</td><td><input type = 'file' name = 'FH' size = '30' value='backup.key' />
</td><td>
<input type = 'submit' name = 'ACTION' value = '$Lang::tr{'backup import key'}' />
</tr><tr>
<td align='right'>$Lang::tr{'backup protect key password'}:<td><input type = 'password' name='PASSWORD1' size='10' />
</td>
</tr><tr>
<td align='right'>$Lang::tr{'backup clear archive'}:</td><td><input type = 'file' name = 'FH' size = '30' value='your-ipfire.tar.gz' />
</td><td>
<input type = 'submit' name = 'ACTION' value = '$Lang::tr{'backup extract key'}' />
</td>
</tr>
</table>
$Lang::tr{'notes'}:
<ul>
<li>$Lang::tr{'backup explain key no1'}
<li>$Lang::tr{'backup explain key no2'}
</ul>
</form>
END
;
&floppybox();
&Header::closebox();
&Header::closebigbox();
&Header::closepage();
exit (0);
}
##
## Sets management (create/delete/import/restore)
##
erase_files ($setdir); #clean up
#
# create new archive set
#
if ($settings{'ACTION'} eq $Lang::tr{'create'}) {
$errormessage = &get_bk_error(system('/usr/local/bin/ipfirebkcfg > /dev/null')>>8);
&import_set (" ".&Header::cleanhtml ($settings{'COMMENT'})) if (!$errormessage);
}
#
# delete a backup set
#
if ($settings{'ACTION'} eq $Lang::tr{'remove'}) {
erase_files (&Header::cleanhtml ($settings{'KEY'})); # remove files
rmdir($settings{'KEY'}); # remove directory
}
#
# import an archive set
#
if ($settings{'ACTION'} eq $Lang::tr{'import'}) {
if (ref ($settings{'FH'}) ne 'Fh') {
$errormessage = $Lang::tr{'no cfg upload'};
} else {
if (!copy ($settings{'FH'}, "$setdir/$datafile")) {
$errormessage = $Lang::tr{'save error'};
} else {
&import_set ('&nbsp;(imported)');
}
}
}
#
# restore an archive
#
if ($settings{'ACTION'} eq $Lang::tr{'restore'}) {
if ($settings{'AreYouSure'} eq 'yes') {
if (!$cryptkeymissing) { # if keyfile exists
if (-e "$settings{'KEY'}/$datafile"){ # encrypted dat is required
copy_files($settings{'KEY'}, $setdir); # to working dir
$errormessage = get_rs_error(system("/usr/local/bin/ipfirerscfg"
. ($settings{'RESTOREHW'} eq 'on' ? ' --hardware' : '')
. ' >/dev/null')>>8);
if (!$errormessage) {
# restored ok, recommend restarting system
$warnmessage = $Lang::tr{'cfg restart'};
}
erase_files ($setdir); #clean up
} else {
$errormessage = $Lang::tr{'missing dat'}."$settings{'KEY'}/$datafile";
}
} else { # if keyfile does not exist
$errormessage = $Lang::tr{'backup missing key'};
}
} else { # not AreYouSure=yes
&Header::openpage($Lang::tr{'backup configuration'}, 1, '');
&Header::openbigbox('100%', 'left');
&Header::openbox('100%', 'left', $Lang::tr{'are you sure'});
print <<END
<form method = 'post'>
<input type = 'hidden' name = 'KEY' value ='$settings{'KEY'}' />
<input type = 'hidden' name = 'AreYouSure' value ='yes' />
<table align = 'center'>
<tr>
<td align = 'center'>
<input type = 'submit' name = 'ACTION' value = '$Lang::tr{'restore'}' />
</td><td>
<input type = 'submit' name = 'ACTION' value = '$Lang::tr{'cancel'}' />
</td>
</tr><tr>
<td>
$Lang::tr{'restore hardware settings'}: <input type = 'checkbox' name = 'RESTOREHW'>
</td>
</tr>
</table>
</form>
END
;
&Header::closebox();
&Header::closebigbox();
&Header::closepage();
exit (0);
}
}
##
## Media management
##
#
# now build the list of removable device
#
# Read partitions sizes registered with the system
my %partitions;
foreach my $li (`/usr/local/bin/ipfirebackup -proc partitions`) { # use suid helper...
# partitions{'sda1'} = 128M if /major minor blocks name/
$partitions{$4} = &kmgt($3*1024,4) if ($li =~ /(\d+) +(\d+) +(\d+) +(.*)/);
}
# Search usb-storage scsi device
my %medias;
foreach (`/usr/local/bin/ipfirebackup -glob '/proc/scsi/usb-storage*/*'`) {# use suid helper...
my $m;
foreach ( `cat $_` ) { # list each line of information for the device:
# Host scsi0: usb-storage
# Vendor: SWISSBIT
# Product: Black Silver
# Serial Number: D0ED423A4F84A31E
# Protocol: Transparent SCSI
# Transport: Bulk
# GUID: 13706828d0ed423a4f84a31e
# Attached: Yes
chomp;
my ($key,$val) = split(': ',$_,2);
$key =~ s/^ *//; # remove front space
# convert 'scsi?' key to sda, sdb,... and use it as a %medias keyhash
if ($key =~ /Host scsi(.)/) {
$val = $m = 'sd' . chr(97+$1);
$key = 'Host';
}
$medias{$m}{$key} = $val; # save data
}
}
#
# Switch mounted media
#
if ($settings{'ACTION'} eq $Lang::tr{'mount'})
{
# Find what is really mounted under backup. Can be local hard disk or any removable media
my $mounted = &findmounted();
#umount previous, even if same device already mouted.
system ("/usr/local/bin/ipfirebackup -U $mounted") if ($mounted ne $Lang::tr{'local hard disk'});
$errormessage = `/usr/local/bin/ipfirebackup -M $settings{'SELECT'}` if (grep (/$settings{'SELECT'}/,%partitions));
}
#
# Compute a full description of device
#
my $mounted = &findmounted();
my $media_des = $mounted; # Description
if ($mounted ne $Lang::tr{'local hard disk'}) {
$_ = $mounted; # sda1 => sda
tr/0-9//d;
$media_des = "$medias{$_}{'Product'} ($media_des, $partitions{$mounted})";
}
&Header::openpage($Lang::tr{'backup configuration'}, 1, '');
&Header::openbigbox('100%', 'left', '', $errormessage);
if ($errormessage) {
&Header::openbox('100%', 'left', $Lang::tr{'error messages'});
print "<font class='base'>$errormessage&nbsp;</font>";
&Header::closebox();
}
$warnmessage = "<font color=${Header::colourred}><b>$Lang::tr{'capswarning'}</b></font>: $warnmessage <p>" if ($warnmessage);
&Header::openbox('100%', 'left', $Lang::tr{'backup configuration'});
#Divide the window in two : left and right
print <<END
<table width = '100%' >
<tr>
<th width = '50%'>$Lang::tr{'current media'}:<font color=${Header::colourred}><b>$media_des</b></font></th>
<th width = '3%'></th>
<th>$Lang::tr{'choose media'}</th>
</tr>
END
;
# Left part of window
print <<END
<tr><td>
<ul>
<li>$Lang::tr{'backup sets'}:
<table width = '80%' border='0'>
<tr>
<th class = 'boldbase' align = 'center'>$Lang::tr{'name'}</th>
<th class = 'boldbase' align = 'center' colspan = '3'>$Lang::tr{'action'}</th>
</tr>
END
;
# get list of available sets by globbing directories under $setdir
# External device (usk key) are mounted in $setdir. -R permits finding sets in hierarchy.
my $i = 0;
foreach my $set (`ls -Rt1 $setdir`) {
chop ($set); #remove ':' & newline from line
chop ($set);
if (-d $set && ($set =~ m!/.+/\d{8}_\d{6}! ) ) { # filter out things not sets !
if ($i++ % 2) {
print "<tr bgcolor = '$Header::table2colour'>";
} else {
print "<tr bgcolor = '$Header::table1colour'>";
}
my $settime = read_timefile( "$set/$datefile", "$set/$datafile" );
my $name = substr ($set,length($setdir)+1);
print<<EOF
<td>
$settime
</td>
<td align = 'center'>
<form method = 'post'>
<input type = 'hidden' name = 'ACTION' value ='$Lang::tr{'restore'}' />
<input type = 'image' name = '$Lang::tr{'restore'}' src = '/images/reload.gif' alt = '$Lang::tr{'restore'}' title = '$Lang::tr{'restore'}' />
<input type = 'hidden' name = 'KEY' value = '$set' />
</form>
</td>
<td align = 'center'>
<a href = '/backup/$name/$datafile'><img src = '/images/floppy.gif' title = '$Lang::tr{'export'}'></a>
</td>
<td align = 'center'>
<form method = 'post'>
<input type = 'hidden' name = 'ACTION' value = '$Lang::tr{'remove'}' />
<input type = 'image' name = '$Lang::tr{'remove'}' src = '/images/delete.gif' alt = '$Lang::tr{'remove'}' title = '$Lang::tr{'remove'}' border = '0' />
<input type = 'hidden' name = 'KEY' value = '$set' />
</form>
</td>
</tr>
EOF
;
}
}
print "</table>" . ($i ? "<br>" : "$Lang::tr{'empty'}!<hr /><br>");
print <<EOF
$warnmessage
<form method = 'post'>
<li>$Lang::tr{'backup configuration'}<br>
$Lang::tr{'description'}:<input type = 'text' name = 'COMMENT' size='30' />
<input type = 'submit' name = 'ACTION' value = '$Lang::tr{'create'}' />
</form><p>
<form method = 'post' enctype = 'multipart/form-data'>
<li>$Lang::tr{'backup import dat file'}:<br>
<input type = 'file' name = 'FH' size = '20' />
<input type = 'submit' name = 'ACTION' value = '$Lang::tr{'import'}' />
</form>
</ul>
EOF
;
print "</td><td></td><td valign='top'>"; # Start right part (devices selection)
print $Lang::tr{'backup media info'};
print "<form method = 'post'>";
print "<table width = '100%'><tr><td>";
my $nodev = 1; # nothing present
foreach my $media (keys %medias) {
if ( $medias{$media}{'Attached'} eq 'Yes') { # device is attached to USB bus ?
$nodev = 0; # at least one device present
my $checked = $medias{$media}{'Host'} eq $mounted ? "checked='checked'" : '';
print "<input type='radio' name = 'SELECT' value = '$medias{$media}{'Host'}' $checked />";
print "<b>$medias{$media}{'Product'}</b><br>";
# list attached partitions to this media
foreach my $part (sort (keys (%partitions))) {
if ($part =~ /$medias{$media}{'Host'}./) {
my $checked = $part eq $mounted ? "checked='checked'" : '';
print "&nbsp;&nbsp;&nbsp;<input type='radio' name = 'SELECT' value = '$part' $checked />$part ($partitions{$part})<br>";
}
}
}
}
if ($nodev) {
print "<br>$Lang::tr{'insert removable device'}";
print "</td><td>";
print "<br><input type = 'submit' name = 'ACTION' value = '$Lang::tr{'done'}' />";
} else {
#Add an entry for the local disk
my $checked = $Lang::tr{'local hard disk'} eq $mounted ? "checked='checked'" : '';
print "<input type = 'radio' name = 'SELECT' value = '$Lang::tr{'local hard disk'}' $checked />";
print "<b>$Lang::tr{'local hard disk'}</b>";
print "</td><td>";
print "<br><input type = 'submit' name = 'ACTION' value = '$Lang::tr{'mount'}' />";
}
print "</tr></table>";
print "</form>";
#
#Backup key
#
print<<EOF
<hr />
<form method='post'>
<b>$Lang::tr{'backup key'}</b><br>
$Lang::tr{'backup key info'}<br>
<table><tr>
<td align= 'right'>$Lang::tr{'root user password'}:
<td align='left'><input type = 'password' name='PASSWORD' />
<input type = 'submit' name = 'ACTION' value = '$Lang::tr{'backup export key'}' />
</tr><tr>
<td align='right'>$Lang::tr{'backup protect key password'}:
<td align='left'><input type = 'password' name='PASSWORD1' size='10' />
</tr><tr>
<td align='right'>$Lang::tr{'again'}
<td align='left'><input type = 'password' name='PASSWORD2' size='10'/>
</tr></table>
</form>
EOF
;
# End of right table
print "</td></tr></table>";
&floppybox();
&Header::closebox();
&Header::closebigbox();
&Header::closepage();
sub floppybox {
print <<END
<hr />
<form method = 'post'>
<table width='100%'>
<tr>
<td>
<b>$Lang::tr{'backup to floppy'}</b>
</td>
</tr>
<tr>
<td width='50%'>
$Lang::tr{'insert floppy'}
</td>
<td align='center'>
<input type='submit' name='ACTION' value='$Lang::tr{'backup to floppy'}' />
</td>
</tr>
</table>
</form>
END
;
print "<b>$Lang::tr{'alt information'}</b><pre>" .
`/usr/local/bin/ipfirebackup -savecfg floppy` .
'&nbsp;</pre>' if ($settings{'ACTION'} eq $Lang::tr{'backup to floppy'} );
}
# Return device name of what is mounted under 'backup'
sub findmounted() {
my $mounted = `mount|grep ' /home/httpd/html/backup '`;
if ($mounted) { # extract device name
$mounted =~ m!^/dev/(.*) on!; # device on mountmoint options
return $1;
} else { # it's the normal subdir
return $Lang::tr{'local hard disk'};
}
}
# read and return a date/time string from a time file
sub read_timefile() {
my $fname = shift; # name of file to read from
my $fname2 = shift; # if first file doesn't exist, get date of this file
my $dt;
if (defined(open(FH, "<$fname"))) {
$dt = <FH>;
chomp $dt;
close(FH);
} else {
$dt = &get_fdate($fname2); # get file date/time
write_timefile($fname, $dt); # write to expected time file
}
return $dt;
}
# write a date/time string to a time file
sub write_timefile() {
my $fname = shift; # name of file to write to
my $dt = shift; # date/time string to write
if (open(FH, ">$fname")) {
print FH "$dt\n";
close(FH);
}
}
# move a dat file without time stamp to subdir
sub import_set() {
my $dt = get_fdate("$setdir/$datafile") . shift;
&write_timefile("$setdir/$datefile", $dt);
# create set directory
my $setname = "$setdir/" . get_ddate("$setdir/$datafile");
mkdir($setname);
# move files to the new set directory
copy_files($setdir, $setname);
erase_files ($setdir);
}
# get date/time string from file
sub get_fdate() {
my $fname = shift;
open(DT, "/bin/date -r $fname|");
my $dt = <DT>;
close(DT);
chomp $dt;
$dt =~ s/\s+/ /g; # remove duplicate spaces
return $dt;
}
# get date/time string from file for use as directory name
sub get_ddate() {
my $fname = shift;
open(DT, "/bin/date -r $fname +%Y%m%d_%H%M%S|");
my $dt = <DT>;
close(DT);
chomp $dt;
return $dt;
}
# copy archive files from source directory to destination directory
sub copy_files() {
my $src_dir = shift;
my $dest_dir = shift;
map (copy ("$src_dir/$_", "$dest_dir/$_"), ($datafile, $datefile) );
}
# erase set files
sub erase_files() {
my $src_dir = shift;
map (unlink ("$src_dir/$_"), ($datafile, $datefile));
}
# get backup error text
sub get_bk_error() {
my $exit_code = shift || return '';
if ($exit_code == 0) {
return '';
} elsif ($exit_code == 2) {
return $Lang::tr{'err bk 2 key'};
} elsif ($exit_code == 3) {
return $Lang::tr{'err bk 3 tar'};
} elsif ($exit_code == 4) {
return $Lang::tr{'err bk 4 gz'};
} elsif ($exit_code == 5) {
return $Lang::tr{'err bk 5 encrypt'};
} else {
return $Lang::tr{'err bk 1'};
}
}
# show any restore errors
sub get_rs_error() {
my $exit_code = shift || return '';
if ($exit_code == 0) {
return '';
} elsif ($exit_code == 6) {
return $Lang::tr{'err rs 6 decrypt'};
} elsif ($exit_code == 7) {
return $Lang::tr{'err rs 7 untartst'};
} elsif ($exit_code == 8) {
return $Lang::tr{'err rs 8 untar'};
} elsif ($exit_code == 9) {
return $Lang::tr{'missing dat'};
} else {
return $Lang::tr{'err rs 1'}."($exit_code)";
}
}
sub kmgt {
my ($value,$length,$opt_U) = @_;
if ( $value > 10**( $length + 8 ) or $opt_U eq 'T' ) {
return sprintf( "%d%s", int( ( $value / 1024**4 ) + .5 ), 'T' );
} elsif ( $value > 10**( $length + 5 ) or $opt_U eq 'G' ) {
return sprintf( "%d%s", int( ( $value / 1024**3 ) + .5 ), 'G' );
} elsif ( $value > 10**( $length + 2 ) or $opt_U eq 'M' ) {
return sprintf( "%d%s", int( ( $value / 1024**2 ) + .5 ), 'M' );
} elsif ( $value > 10**($length) or $opt_U eq 'K' ) {
return sprintf( "%d%s", int( ( $value / 1024 ) + .5 ), 'K' );
} else {
return $value;
}
}
1;

View File

@@ -1,488 +0,0 @@
#!/usr/bin/perl
#
# IPFire CGI's - base.cgi
#
# This code is distributed under the terms of the GPL
#
# (c) place a name here
#
# $Id: base.cgi,v 1.1.2.10 2005/11/03 19:20:50 franck78 Exp $
#
#
# This file is a starting base for writting a new GUI screen using the three box model
# Box 1 : global settings for the application
# Box 2 : line editor for multiple data line
# Box 3 : the list of data line, with edit/remove buttons
#
# This example do the following
# Read global settings:
# a NAME and an interface (IT)
# Lines of data composed of:
# an ipaddress (IP), an enabled/disabled options (CB), a comment (CO)
#
#
# All you need to do is
# replace 'XY' with your app name
# define your global $settings{'var name'}
# define your strings
# write validation code for Settings1 and Settings2
# write HTML box Settings1 and Settings2
# adapt the sort function
# write the correct configuration file
#
#
# to fully troubleshot your code, uncomment diagnostics, Carp and cluck lines
# use diagnostics; # need to add the file /usr/lib/perl5/5.8.x/pods/perldiag.pod before to work
# next look at /var/log/httpd/error_log , http://www.perl.com/pub/a/2002/05/07/mod_perl.html may help
#use warnings;
use strict;
#use Carp ();
#local $SIG{__WARN__} = \&Carp::cluck;
require '/var/ipfire/general-functions.pl'; # Replace all occurences of </var/ipfire> with CONFIG_ROOT
# before updating cvs IPFire file.
require "${General::swroot}/lang.pl";
require "${General::swroot}/header.pl";
# Files used
our $setting = "${General::swroot}/XY/settings"; # particular settings
my $datafile = "${General::swroot}/XY/data"; # repeted settings (multilines)
our $conffile = "${General::swroot}/XY/XY.conf"; # Config file for application XY
# strings to add to languages databases or in addon language file
$Lang::tr{'XY title'} = 'XY service';
$Lang::tr{'XY settings'} = 'XY setup';
$Lang::tr{'XY add data'} = 'add data';
$Lang::tr{'XY edit data'} = 'edit data';
$Lang::tr{'XY data'} = 'XY data';
# informationnal & log strings, no translation required
my $msg_added = 'XY added';
my $msg_modified = 'XY modified';
my $msg_deleted = 'XY removed';
my $msg_datafileerror = 'XY data file error';
our $msg_configfileerror = 'XY configuration file error';
my %settings=();
# Settings1
$settings{'NAME'} = ''; # a string field than must be 'GOOD' or 'good'
$settings{'IT'} = ''; # a 'choose' field for color interface
$settings{'TURBO'} = 'off'; # a checkbox field to enable something
# Settings2 for editing the multi-line list
# Must not be saved by writehash !
$settings{'IP'} = ''; # datalines are: IPaddress,enable,comment
$settings{'CB'} = 'off'; # Every check box must be set to off
$settings{'COMMENT'} = '';
my @nosaved=('IP','CB','COMMENT'); # List here ALL setting2 fields. Mandatory
$settings{'ACTION'} = ''; # add/edit/remove....
$settings{'KEY1'} = ''; # point record for ACTION
# Define each field that can be used to sort columns
my $sortstring='^IP|^COMMENT';
my $errormessage = '';
my $warnmessage = '';
&Header::showhttpheaders();
# Read needed Ipcop settings (exemple)
my %mainsettings=();
&General::readhash("${General::swroot}/main/settings", \%mainsettings);
# Get GUI values
&Header::getcgihash(\%settings);
# Load multiline data. Do it before use in save action
our $f = new Multilines (filename => $datafile,
fields => ['IP','CB','COMMENT'],
comment => 1
);
##
## SAVE Settings1
##
# Remove if no Settings1 needed
if ($settings{'ACTION'} eq $Lang::tr{'save'}) {
#
#Validate static Settings1 here
#
if (($settings{"NAME"} ne "GOOD") &&
($settings{"NAME"} ne "good")) {
$errormessage = 'Enter good or GOOD in Name field';
}
unless ($errormessage) { # Everything is ok, save settings
map (delete ($settings{$_}) ,(@nosaved,'ACTION','KEY1'));# Must never be saved
&General::writehash($setting, \%settings); # Save good settings
$settings{'ACTION'} = $Lang::tr{'save'}; # Recreate 'ACTION'
map ($settings{$_}= '',(@nosaved,'KEY1')); # and reinit var to empty
# Rebuild configuration file if needed
&BuildConfiguration;
}
ERROR: # Leave the faulty field untouched
} else {
&General::readhash($setting, \%settings); # Get saved settings and reset to good if needed
}
##
## Now manipulate the multiline list with Settings2
##
# Basic actions are:
# toggle the check box
# add/update a new line
# begin editing a line
# remove a line
# $KEY1 contains the index of the line manipulated
##
## Toggle CB field.
##
if ($settings{'ACTION'} eq $Lang::tr{'toggle enable disable'}) {
$f->togglebyfields($settings{'KEY1'},'CB'); # toggle checkbox
$settings{'KEY1'} = ''; # End edit mode
&General::log($msg_modified);
# save changes
$f->savedata || die "$msg_datafileerror";
# Rebuild configuration file
&BuildConfiguration;
}
##
## ADD/UPDATE a line of configuration from Settings2
##
if ($settings{'ACTION'} eq $Lang::tr{'add'}) {
# Validate inputs
if (! &General::validip($settings{'IP'})) {$errormessage = "Specify an IP value !"};
if (! $settings{'COMMENT'} ) {$warnmessage = "no comment specified"};
unless ($errormessage) {
if ($settings{'KEY1'} eq '') { #add or edit ?
# insert new data line
$f->writedata(-1, $settings{'IP'},$settings{'CB'},$settings{'COMMENT'});
&General::log($msg_added);
} else {
# modify data line
$f->writedata($settings{'KEY1'}, $settings{'IP'},$settings{'CB'},$settings{'COMMENT'});
$settings{'KEY1'} = ''; # End edit mode
&General::log($msg_modified);
}
# save changes
$f->savedata || die "$msg_datafileerror";
# Rebuild configuration file
&BuildConfiguration;
# if entering data line is a repetitive task, choose here to not erase fields between each addition
map ($settings{$_}='' ,@nosaved);
}
}
##
## begin EDIT: move data fields to Settings2 controls
##
if ($settings{'ACTION'} eq $Lang::tr{'edit'}) {
$f->readdata ($settings{'KEY1'},
$settings{'IP'},
$settings{'CB'},
$settings{'COMMENT'});
}
##
## REMOVE: remove selected line
##
if ($settings{'ACTION'} eq $Lang::tr{'remove'}) {
$f->deleteline ($settings{'KEY1'});
$settings{'KEY1'} = ''; # End remove mode
&General::log($msg_deleted);
# save changes
$f->savedata || die "$msg_datafileerror";
# Rebuild configuration file
&BuildConfiguration;
}
##
## Check if sorting is asked
##
if ($ENV{'QUERY_STRING'} =~ /$sortstring/ ) {
my $newsort=$ENV{'QUERY_STRING'};
my $actual=$settings{'SORT_XY'};
# Reverse actual sort or choose new column ?
if ($actual =~ $newsort) {
$f->setsortorder ($newsort ,rindex($actual,'Rev'));
$newsort .= rindex($actual,'Rev')==-1 ? 'Rev' : '';
} else {
$f->setsortorder ($newsort ,1);
}
$f->savedata; # Synchronise file & display
$settings{'SORT_XY'} = $newsort;
map (delete ($settings{$_}) ,(@nosaved,'ACTION','KEY1')); # Must never be saved
&General::writehash($setting, \%settings);
$settings{'ACTION'} = 'SORT'; # Recreate an 'ACTION'
map ($settings{$_}= '',(@nosaved,,'KEY1')); # and reinit var to empty
}
##
## Remove if no Setting1 needed
##
if ($settings{'ACTION'} eq '' ) { # First launch from GUI
# Place here default value when nothing is initialized
}
&Header::openpage($Lang::tr{'XY title'}, 1, '');
&Header::openbigbox('100%', 'left', '', $errormessage);
my %checked =(); # Checkbox manipulations
if ($errormessage) {
&Header::openbox('100%', 'left', $Lang::tr{'error messages'});
print "<font class='base'>$errormessage&nbsp;</font>";
&Header::closebox();
}
##
## First box Settings1. Remove if not needed
##
$warnmessage = "<font color=${Header::colourred}><b>$Lang::tr{'capswarning'}</b></font>: $warnmessage" if ($warnmessage);
&Header::openbox('100%', 'left', $Lang::tr{'XY settings'});
print "<form method='post' action='$ENV{'SCRIPT_NAME'}'>";
$checked{'IT'}{'RED'} = '';
$checked{'IT'}{'GREEN'} = '';
$checked{'IT'}{'ORANGE'} = '';
$checked{'IT'}{'BLUE'} = '';
$checked{'IT'}{$settings{'IT'}} = "checked='checked'";
$checked{'TURBO'} = ($settings{'TURBO'} eq 'on') ? "checked='checked'" : '';
print<<END
<table width='100%'>
<tr>
<td class='base'>Name:</td>
<td><input type='text' name='NAME' value='$settings{'NAME'}' /></td>
<td align='right'>INTERFACE</td>
<td align='right'>red<input type='radio' name='IT' value='RED' $checked{'IT'}{'RED'} /></td>
</tr><tr>
<td>Turbo:</td>
<td><input type='checkbox' name='TURBO' $checked{'TURBO'}' /></td>
<td></td>
<td align='right'>green<input type='radio' name='IT' value='GREEN' $checked{'IT'}{'GREEN'} /></td>
</tr><tr>
<td></td>
<td></td>
<td></td>
<td align='right'>blue<input type='radio' name='IT' value='BLUE' $checked{'IT'}{'BLUE'} /></td>
</tr><tr>
<td></td>
<td></td>
<td></td>
<td align='right'>orange<input type='radio' name='IT' value='ORANGE' $checked{'IT'}{'ORANGE'} /></td>
</tr>
</table>
<br />
END
;
print<<END
<table width='100%'>
<hr />
<tr>
<td class='base' width='25%'><img src='/blob.gif' align='top' alt='*' />&nbsp;$Lang::tr{'this field may be blank'}</td>
<td class='base' width='25%'>$warnmessage</td>
<td width='50%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'save'}' /></td>
</tr>
</table>
</form>
END
;
&Header::closebox(); # end of Settings1
##
## Second box is for editing the an item of the list
##
$checked{'CB'} = ($settings{'CB'} eq 'on') ? "checked='checked'" : '';
my $buttontext = $Lang::tr{'add'};
if ($settings{'KEY1'} ne '') {
$buttontext = $Lang::tr{'update'};
&Header::openbox('100%', 'left', $Lang::tr{'XY edit data'});
} else {
&Header::openbox('100%', 'left', $Lang::tr{'XY add data'});
}
# Edited line number (KEY1) passed until cleared by 'save' or 'remove' or 'new sort order'
print <<END
<form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='KEY1' value='$settings{'KEY1'}' />
<table width='100%'>
<tr>
<td class='base'>$Lang::tr{'ip address'}:</td>
<td><input type='text' name='IP' value='$settings{'IP'}' /></td>
<td class='base'>$Lang::tr{'enabled'}</td>
<td><input type='checkbox' name='CB' $checked{'CB'} /></td>
<td class='base'>$Lang::tr{'remark'}:&nbsp;<img src='/blob.gif' alt='*' /></td>
<td><input type 'text' name='COMMENT' value='$settings{'COMMENT'}' /></td>
</tr>
</table>
<hr />
<table width='100%'>
<tr>
<td class='base' width='50%'><img src='/blob.gif' align='top' alt='*' />&nbsp;$Lang::tr{'this field may be blank'}</td>
<td width='50%' align='center'><input type='hidden' name='ACTION' value='$Lang::tr{'add'}' /><input type='submit' name='SUBMIT' value='$buttontext' /></td>
</tr>
</table>
</form>
END
;
&Header::closebox();
##
## Third box shows the list
##
# Columns headers may be a sort link. In this case it must be named in $sortstring
&Header::openbox('100%', 'left', $Lang::tr{'XY data'});
print <<END
<table width='100%'>
<tr>
<td width='20%' align='center'><a href='$ENV{'SCRIPT_NAME'}?IP'><b>$Lang::tr{'ip address'}</b></a></td>
<td width='70%' align='center'><a href='$ENV{'SCRIPT_NAME'}?COMMENT'><b>$Lang::tr{'remark'}</b></a></td>
<td width='10%' colspan='3' class='boldbase' align='center'><b>$Lang::tr{'action'}</b></td>
</tr>
END
;
##
## Print each line of @current list
##
my $key = 0;
$f->readreset; # beginning of data
for ($key=0; $key<$f->getnumberofline; $key++) {
my($cb,$comment,$ip) = $f->readbyfieldsseq($key,'CB','COMMENT','IP');
#Choose icon for checkbox
my $gif = '';
my $gdesc = '';
if ($cb eq "on") {
$gif = 'on.gif';
$gdesc = $Lang::tr{'click to disable'};
} else {
$gif = 'off.gif';
$gdesc = $Lang::tr{'click to enable'};
}
#Colorize each line
if ($settings{'KEY1'} eq $key) {
print "<tr bgcolor='${Header::colouryellow}'>";
} elsif ($key % 2) {
print "<tr bgcolor='${Header::table2colour}'>";
} else {
print "<tr bgcolor='${Header::table1colour}'>";
}
print <<END
<td align='center'>$ip</td>
<td align='center'>$comment</td>
<td align='center'>
<form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='ACTION' value='$Lang::tr{'toggle enable disable'}' />
<input type='image' name='$Lang::tr{'toggle enable disable'}' src='/images/$gif' alt='$gdesc' title='$gdesc' />
<input type='hidden' name='KEY1' value='$key' />
</form>
</td>
<td align='center'>
<form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='ACTION' value='$Lang::tr{'edit'}' />
<input type='image' name='$Lang::tr{'edit'}' src='/images/edit.gif' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' />
<input type='hidden' name='KEY1' value='$key' />
</form>
</td>
<td align='center'>
<form method='post' action='$ENV{'SCRIPT_NAME'}'>
<input type='hidden' name='ACTION' value='$Lang::tr{'remove'}' />
<input type='image' name='$Lang::tr{'remove'}' src='/images/delete.gif' alt='$Lang::tr{'remove'}' title='$Lang::tr{'remove'}' />
<input type='hidden' name='KEY1' value='$key' />
</form>
</td>
</tr>
END
;
} print "</table>";
# If table contains entries, print 'Key to action icons'
if ($key) {
print <<END
<table>
<tr>
<td class='boldbase'>&nbsp;<b>$Lang::tr{'legend'}:&nbsp;</b></td>
<td><img src='/images/on.gif' alt='$Lang::tr{'click to disable'}' /></td>
<td class='base'>$Lang::tr{'click to disable'}</td>
<td>&nbsp;&nbsp;</td>
<td><img src='/images/off.gif' alt='$Lang::tr{'click to enable'}' /></td>
<td class='base'>$Lang::tr{'click to enable'}</td>
<td>&nbsp;&nbsp;</td>
<td><img src='/images/edit.gif' alt='$Lang::tr{'edit'}' /></td>
<td class='base'>$Lang::tr{'edit'}</td>
<td>&nbsp;&nbsp;</td>
<td><img src='/images/delete.gif' alt='$Lang::tr{'remove'}' /></td>
<td class='base'>$Lang::tr{'remove'}</td>
</tr>
</table>
END
;
}
&Header::closebox();
&Header::closebigbox();
&Header::closepage();
## Ouf it's the end !
##
## Build the configuration file for application XY
##
sub BuildConfiguration {
open(FILE, ">/$conffile") or die "$msg_configfileerror";
flock(FILE, 2);
#Global settings
print FILE "#\n# Configuration file for application XY\n#\n\n";
print FILE "# do not edit manually\n";
print FILE "# build for Ipcop:$mainsettings{'HOSTNAME'}\n\n\n";
print FILE "service=$settings{'NAME'}\n";
print FILE "activate-turbo\n" if $settings{'TURBO'} eq 'on';
print FILE "interface=$settings{'IT'}\n\n\n";
#write data line
{
my ($IP,$CB,$COMMENT);
$f->readreset;
while (defined ($f->readdataseq($IP,$CB,$COMMENT))) {
if ($CB eq "on") {
print FILE "$IP\t\t\t\t\t#$COMMENT\n";
} else {
print FILE "#DISABLED $IP\t\t\t\t#$COMMENT\n";
}
}
}
close FILE;
# Restart service
#system '/usr/local/bin/restartyourhelper';
}

View File

@@ -10,8 +10,8 @@
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";
@@ -74,7 +74,7 @@ if ( ( $pppsettings{'VALID'} eq 'yes' && $modemsettings{'VALID'} eq 'yes' ) || (
chomp ($ipaddr);
}
if (open(IPADDR,"${General::swroot}/red/local-ipaddress")) {
my $ipaddr = <IPADDR>;
$ipaddr = <IPADDR>;
close IPADDR;
chomp ($ipaddr);
}
@@ -136,6 +136,21 @@ END
print "$Lang::tr{'profile has errors'}\n </b></font>\n";
}
my $HOSTNAME = (gethostbyaddr(pack("C4", split(/\./, $ipaddr)), 2))[0];
if ( "$HOSTNAME" ne "" ) {
print <<END;
<tr><td><b>Hostname:</b><td>$HOSTNAME<td>&nbsp;
END
}
if ( -e "/var/ipfire/red/remote-ipaddress" ) {
my $GATEWAY = `cat /var/ipfire/red/remote-ipaddress`;
chomp($GATEWAY);
print <<END;
<tr><td><b>Gateway:</b><td>$GATEWAY<td>&nbsp;
END
}
my $DNS1 = `cat /var/ipfire/red/dns1`;
my $DNS2 = `cat /var/ipfire/red/dns2`;
chomp($DNS1);

View File

@@ -0,0 +1,12 @@
!"R" "G" "B" "Colour Name"
57 44 187 colour1
79 125 255 colour2
79 185 255 colour3
79 225 255 colour4
189 225 255 colour5
195 183 255 colour6
195 125 255 colour7
195 241 197 colour8
195 241 140 colour9
86 202 145 colour10

View File

@@ -7,7 +7,8 @@
# JC HERITIER
# page inspired from the initial firewalllog.dat
#
# Modified for IPFire by Christian Schmidt (www.ipfire.org)
# Modified for IPFire by Christian Schmidt
# and Michael Tremer (www.ipfire.org)
use strict;
use Geo::IP::PurePerl;
@@ -387,16 +388,16 @@ if ($showpie != 2 && $pienumber <= 50 && $pienumber != 0) {
$mygraph->set( dclrs => [ "colour1" , "colour2" , "colour3" , "colour4" , "colour5" , "colour6" , "colour7" , "colour8" , "colour9" , "colour10" ] );
my $myimage = $mygraph->plot(\@data) or die $mygraph->error;
my @filenames = glob("/srv/web/ipfire/html/fwlogs/ip*.png");
my @filenames = glob("/srv/web/ipfire/html/graphs/fwlog-ip*.png");
unlink(@filenames);
my $imagerandom = rand(1000000);
my $imagename = "/srv/web/ipfire/html/fwlogs/ip$imagerandom.png";
my $imagename = "/srv/web/ipfire/html/graphs/fwlog-ip$imagerandom.png";
open(FILE,">$imagename");
print FILE $myimage->png;
close(FILE);
#####################################################
print "<table align='center'><tr><td>";
print "<img src='/fwlogs/ip$imagerandom.png'>";
print "<img src='/graphs/fwlog-ip$imagerandom.png'>";
print "</td></tr></table>";
}

View File

@@ -7,7 +7,8 @@
# JC HERITIER
# page inspired from the initial firewalllog.dat
#
# Modified for IPFire by Christian Schmidt (www.ipfire.org)
# Modified for IPFire by Christian Schmidt
# and Michael Tremer (www.ipfire.org)
use strict;
@@ -387,16 +388,16 @@ if ($showpie != 2 && $pienumber <= 50 && $pienumber != 0) {
$mygraph->set( dclrs => [ "colour1" , "colour2" , "colour3" , "colour4" , "colour5" , "colour6" , "colour7" , "colour8" , "colour9" , "colour10" ] );
my $myimage = $mygraph->plot(\@data) or die $mygraph->error;
my @filenames = glob("/srv/web/ipfire/html/fwlogs/port*.png");
my @filenames = glob("/srv/web/ipfire/html/graphs/fwlog-port*.png");
unlink(@filenames);
my $imagerandom = rand(1000000);
my $imagename = "/srv/web/ipfire/html/fwlogs/port$imagerandom.png";
my $imagename = "/srv/web/ipfire/html/graphs/fwlog-port$imagerandom.png";
open(FILE,">$imagename");
print FILE $myimage->png;
close(FILE);
#####################################################
print "<table align='center'><tr><td>";
print "<img src='/fwlogs/port$imagerandom.png'>";
print "<img src='/graphs/fwlog-port$imagerandom.png'>";
print "</td></tr></table>";
}

View File

@@ -1,154 +0,0 @@
#!/usr/bin/perl
#
# IPFire CGIs
#
# This code is distributed under the terms of the GPL
#
# (c) The IPFire 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 %uptimesettings = ();
my %proxysettings = ();
my %checked = ();
my $message = "";
my $errormessage = "";
my %selected= () ;
my $uptimefile = "/var/ipfire/uptime/yasuc.conf";
&General::readhash("${General::swroot}/proxy/advanced/settings", \%proxysettings);
&Header::showhttpheaders();
$uptimesettings{'ENABLE'} = 'off';
$uptimesettings{'USER'} = '';
$uptimesettings{'PASS'} = '';
$uptimesettings{'PROXY'} = $proxysettings{'ENABLE'};
### Values that have to be initialized
$uptimesettings{'ACTION'} = '';
&General::readhash("${General::swroot}/uptime/settings", \%uptimesettings);
&Header::getcgihash(\%uptimesettings);
&Header::openpage('Uptime Client', 1, '');
&Header::openbigbox('100%', 'left', '', $errormessage);
############################################################################################################################
############################################################################################################################
if ($uptimesettings{'ACTION'} eq $Lang::tr{'save'})
{
&save_configuration();
}
elsif ($uptimesettings{'ACTION'} eq $Lang::tr{'uptime enable'})
{
&save_configuration();
system("/usr/bin/touch ${General::swroot}/uptime/enabled");
system("/usr/local/bin/yasucctrl enable");
}
elsif ($uptimesettings{'ACTION'} eq $Lang::tr{'uptime disable'})
{
unlink "${General::swroot}/uptime/enabled";
system("/usr/local/bin/yasucctrl disable");
}
elsif ($uptimesettings{'ACTION'} eq $Lang::tr{'uptime update now'})
{
&save_configuration();
system("/usr/local/bin/yasucctrl");
}
&General::readhash("${General::swroot}/uptime/settings", \%uptimesettings);
if ($errormessage) {
&Header::openbox('100%', 'left', $Lang::tr{'error messages'});
print "<class name='base'>$errormessage\n";
print "&nbsp;</class>\n";
&Header::closebox();
}
$checked{'PROXY'}{'on'} = '';
$checked{'PROXY'}{'off'} = '';
$checked{'PROXY'}{"$uptimesettings{'PROXY'}"} = 'checked';
############################################################################################################################
############################################################################################################################
&Header::openbox('100%', 'center', 'Uptime Client');
print <<END
<table width='300px' cellspacing='0'>
END
;
if ( $message ne "" ) {
print "<tr><td colspan='3' align='center'><font color='red'>$message</font>";
}
my $status = "";
my $status_color = "";
if ( -e "${General::swroot}/uptime/enabled" ){
$status_color = $Header::colourgreen;
$status = $Lang::tr{'running'};
} else {
$status_color = $Header::colourred;
$status = $Lang::tr{'stopped'};
}
print <<END
<form method='post' action='$ENV{'SCRIPT_NAME'}'>
<tr><td><b>Uptime Client:</b></td><td colspan='2'>
<input type='submit' name='ACTION' value='$Lang::tr{'uptime enable'}' />
<input type='submit' name='ACTION' value='$Lang::tr{'uptime disable'}' />
<input type='submit' name='ACTION' value='$Lang::tr{'uptime update now'}' />
</td></tr></form>
<tr><td colspan='2' bgcolor=$status_color align='center'><font color='white'<b>$status</b></font></td></tr>
</table>
<hr>
<form method='post' action='$ENV{'SCRIPT_NAME'}'>
<table width='500px'>
<tr><td colspan='2' align='left'><b>Basisoptionen</b>
<tr><td align='left'>Username:<td><input type='text' name='USER' value='$uptimesettings{'USER'}'>
<tr><td align='left'>Password:<td><input type='password' name='PASS' value='$uptimesettings{'PASS'}'>
<tr><td colspan='2' align='left'><b>Proxyeinstellungen</b>
<tr><td align='left'>Use proxy:<td><input type='checkbox' name='PROXY' $checked{'PROXY'}{'on'}>
<tr><td colspan='2' align='right'><input type='submit' name='ACTION' value=$Lang::tr{'save'}>
</table>
</form>
END
;
&Header::closebox();
&Header::closebigbox();
&Header::closepage();
############################################################################################################################
############################################################################################################################
sub save_configuration {
# A small helper to create our configurationfile
&General::writehash("${General::swroot}/uptime/settings", \%uptimesettings);
if ($uptimesettings{'PROXY'} == "on"){ $uptimesettings{'PROXY'} = "yes";}
if ($uptimesettings{'PROXY'} == "off"){ $uptimesettings{'PROXY'} = "no";}
open( FILE, "> $uptimefile" ) or die "Unable to write $uptimefile";
print FILE <<END
[global]
user = $uptimesettings{'USER'}
password= $uptimesettings{'PASS'}
proxy = $uptimesettings{'PROXY'}
debug = no
[proxy]
host = localhost
port = $proxysettings{'PROXY_PORT'}
[debug]
path = /var/log/yasuc.log
END
;
close FILE;
}

View File

@@ -183,10 +183,10 @@ char *de_tr[] = {
"Installation abgebrochen.",
/* TR_INSTALLING_FILES */
"Installiere Dateien...",
/* TR_INSTALLING_LANG_CACHE */
"Installiere Sprachunterstützung...",
/* TR_INSTALLING_GRUB */
"Installiere GRUB...",
/* TR_INSTALLING_LANG_CACHE */
"Installiere Sprachunterstützung...",
/* TR_INTERFACE */
"%s Schnittstelle",
/* TR_INTERFACE_FAILED_TO_COME_UP */

79
lfs/GD-TextUtil Normal file
View File

@@ -0,0 +1,79 @@
###############################################################################
# This file is part of the IPCop Firewall. #
# #
# IPCop 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 2 of the License, or #
# (at your option) any later version. #
# #
# IPCop 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 IPCop; if not, write to the Free Software #
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
# #
# Makefiles are based on LFSMake, which is #
# Copyright (C) 2002 Rod Roard <rod@sunsetsystems.com> #
# #
###############################################################################
###############################################################################
# Definitions
###############################################################################
include Config
VER = 0.86
THISAPP = GDTextUtil-$(VER)
DL_FILE = $(THISAPP).tar.gz
DL_FROM = $(URL_IPFIRE)
DIR_APP = $(DIR_SRC)/$(THISAPP)
TARGET = $(DIR_INFO)/$(THISAPP)
###############################################################################
# Top-level Rules
###############################################################################
objects = $(DL_FILE)
$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
$(DL_FILE)_MD5 = 941ad06eadc86b47f3a32da405665c41
install : $(TARGET)
check : $(patsubst %,$(DIR_CHK)/%,$(objects))
download :$(patsubst %,$(DIR_DL)/%,$(objects))
md5 : $(subst %,%_MD5,$(objects))
###############################################################################
# Downloading, checking, md5sum
###############################################################################
$(patsubst %,$(DIR_CHK)/%,$(objects)) :
@$(CHECK)
$(patsubst %,$(DIR_DL)/%,$(objects)) :
@$(LOAD)
$(subst %,%_MD5,$(objects)) :
@$(MD5)
###############################################################################
# Installation Details
###############################################################################
$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
@$(PREBUILD)
@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
cd $(DIR_APP) && perl Makefile.PL
cd $(DIR_APP) && make $(MAKETUNING)
cd $(DIR_APP) && make install
@rm -rf $(DIR_APP)
@$(POSTBUILD)

View File

@@ -52,9 +52,11 @@ $(TARGET) :
@$(PREBUILD)
# Create all directories
for i in addon-lang alcatelusb auth backup ca certs cnx_pci connscheduler crls ddns dhcp dhcpc dmzholes \
eagle-usb eciadsl ethernet extrahd/bin isdn key langs logging main mbmon menu.d modem net-traffic nfs optionsfw outgoing/bin patches pakfire portfw \
ppp private proxy/advanced qos/bin red remote snort time updatexlrator/bin updatexlrator/autocheck urlfilter/autoupdate urlfilter/bin upnp vpn \
for i in addon-lang auth backup ca certs connscheduler crls ddns dhcp dhcpc dmzholes \
ethernet extrahd/bin fwlogs isdn key langs logging main mbmon menu.d modem net-traffic \
nfs optionsfw outgoing/bin patches pakfire portfw \
ppp private proxy/advanced qos/bin red remote snort time \
updatexlrator/bin updatexlrator/autocheck urlfilter/autoupdate urlfilter/bin upnp vpn \
wakeonlan wireless xtaccess ; do \
mkdir -p $(CONFIG_ROOT)/$$i; \
done
@@ -63,7 +65,7 @@ $(TARGET) :
for i in auth/users backup/include.user backup/exclude.user \
certs/index.txt ddns/config ddns/noipsettings ddns/settings ddns/ipcache dhcp/settings \
dhcp/fixleases dhcp/advoptions dmzholes/config ethernet/aliases ethernet/settings \
extrahd/scan extrahd/devices extrahd/partitions extrahd/settings \
extrahd/scan extrahd/devices extrahd/partitions extrahd/settings fwlogs/ipsettings fwlogs/portsettings\
isdn/settings main/hosts main/settings optionsfw/settings outgoing/settings outgoing/rules pakfire/settings \
portfw/config ppp/settings-1 ppp/settings-2 ppp/settings-3 ppp/settings-4 \
ppp/settings-5 ppp/settings proxy/settings proxy/advanced/settings remote/settings qos/settings qos/classes qos/subclasses qos/level7config qos/portconfig \

View File

@@ -395,6 +395,7 @@ buildipfire() {
ipfiremake fcron
ipfiremake GD
ipfiremake GD-Graph
ipfiremake GD-TextUtil
ipfiremake gnupg
ipfiremake hdparm
ipfiremake ibod

View File

@@ -49,6 +49,7 @@ sub wanted {
## Main
find (\&wanted, "$basedir/html" );
find (\&wanted, "$basedir/src/scripts" );
find (\&wanted, "$basedir/config/cfgroot" );
for my $key ( sort (keys %tr) ) {
my $value = $tr{$key};