&General::readhasharray("$confighost", \%customhost);
#check name
if (!&validhostname($grp)){$errormessage.=$Lang::tr{'fwhost err name'};}
+ #check existing name
+ if (!checkgroup(\%customgrp,$grp) && $fwhostsettings{'update'} ne 'on'){$errormessage.=$Lang::tr{'fwhost err grpexist'};}
#check remark
if ($rem ne '' && !&validremark($rem) && $fwhostsettings{'update'} ne 'on'){
$errormessage.=$Lang::tr{'fwhost err remark'};
my $delflag;
if (!keys %customgrp)
{
- print "<center><b>$Lang::tr{'fwhost empty'}</b>";
+ print "<center><b>$Lang::tr{'fwhost err emptytable'}</b>";
}else{
foreach my $key (sort { ncmp($customgrp{$a}[0],$customgrp{$b}[0]) } sort { ncmp ($customgrp{$a}[2],$customgrp{$b}[2]) } keys %customgrp){
$count++;
}
}
$number=1;
- if ($customgrp{$key}[2] eq "none"){$customgrp{$key}[2]=$Lang::tr{'fwhost empty'};}
+ if ($customgrp{$key}[2] eq "none"){$customgrp{$key}[2]=$Lang::tr{'fwhost err emptytable'};}
$grpname=$customgrp{$key}[0];
$remark="$customgrp{$key}[1]";
if($count gt 2){ print"</table>";}
}else{
print "$customgrp{$key}[2]</td>";
}
- if ($ip eq '' && $customgrp{$key}[2] ne $Lang::tr{'fwhost empty'}){
+ if ($ip eq '' && $customgrp{$key}[2] ne $Lang::tr{'fwhost err emptytable'}){
print "<td align='center'>$Lang::tr{'fwhost deleted'}</td><td align='center'>$customgrp{$key}[3]</td><td width='1%'><form method='post'>";
}else{
my ($colip,$colsub) = split("/",$ip);
return 1;
}
+sub checkgroup
+{
+ my %hash=%{(shift)};
+ my $name=shift;
+ foreach my $key (keys %hash) {
+ if($hash{$key}[0] eq $name){
+ return 0;
+ }
+ }
+ return 1;
+}
sub checkip
{
-%tr = (
+%tr = (
%tr,
'Act as' => 'Konfiguriert als',
'fwhost err addr' => 'IP-Adresse oder Subnetzmaske ungültig',
'fwhost err addrgrp' => 'Bitte Gruppennamen angeben',
'fwhost err empty' => 'Bitte alle Felder ausfüllen',
+'fwhost err emptytable' => 'Keine Einträge in Gruppe',
'fwhost err groupempty' => 'Die gewählte Gruppe ist leer',
'fwhost err grpexist' => 'Die Gruppe existiert bereits',
'fwhost err hostexist' => 'Ein Host mit diesem Namen existiert bereits',
-%tr = (
+%tr = (
%tr,
'Act as' => 'Act as:',
'fwhost err addr' => 'Invalid IP address or subnet',
'fwhost err addrgrp' => 'Please provide a group name',
'fwhost err empty' => 'Please fill in all input fields',
+'fwhost err emptytable' => 'No entries in this group',
'fwhost err groupempty' => 'The selected group is empty',
'fwhost err grpexist' => 'Group already exists',
'fwhost err hostexist' => 'A host with the same name already exists',