# Get the available filter categories.
#
-# Open the JSON file.
+# Open the JSON file.
open(DNSBL, $dnsbl_json_file);
# Read-in the dnsbl.json file content and append the lines to a string.
my $enabled_zone_lc = lc($enabled_zone);
# Check if the zone is known.
- if( ! grep(/$enabled_zone_lc/, @network_zones) ) {
+ unless (grep(/$enabled_zone_lc/, @network_zones)) {
# Display error message about unknown network zone.
$errormessage = "$enabled_zone - $Lang::tr{'unknown network zone'}.";
}
next unless($address);
if ((!&Network::check_ip_address($address)) && (!&Network::check_subnet($address))) {
- $errormessage = "$address - $Lang::tr{'guardian invalid address or subnet'}";
- }
+ $errormessage = "$address - $Lang::tr{'guardian invalid address or subnet'}";
+ }
}
# Only go further, if there was no error message.
$errormessage = "$dup - $Lang::tr{'dnsbl error domain specified twice'}";
}
- # Check for valid domains.
- #
+ # Check for valid domains
unless ($errormessage) {
# Loop through the arrays and check for valid domains and duplicates.
foreach my $domain (@merged) {
}
}
+ # Check if a domain from the posted blocked domains array is allready part of
+ # the saved allowed domains array.
unless ($errormessage) {
- # Check if a domain from the posted blocked domains array is allready part of the saved allowed domains
- # array.
$dup = &compare_arrays(\@custom_allowed_domains, \@cgi_blocked_domains);
if ($dup) {
}
}
+ # Check if a domain from the posted allowed domains array is allready part of
+ # the saved blocked domains array.
unless ($errormessage) {
- # Check if a domain from the posted allowed domains array is allready part of the saved blocked domains
- # array.
$dup = &compare_arrays(\@custom_blocked_domains, \@cgi_allowed_domains);
if ($dup) {
%$hash = ();
open(FILE, $filename) or die "Unable to read file $filename";
-
+
while (<FILE>) {
my ($key, $rest, @temp);
chomp;
# Store last processed element.
$lastelement = $element;
}
-
- return;
}
sub compare_arrays (\@\@) {
return unless (@data);
return unless (@test);
-
# Loop through the content of the test array and check
# if the current processed element is part of the data array.
foreach my $element (@test) {
if (grep(/$element/, @data)) {
- return "$element"
+ return "$element";
}
}
-
- return;
}