our %color = ();
our %mainsettings = ();
&General::readhash("${General::swroot}/main/settings", \%mainsettings);
-&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
+&General::readhash("/srv/web/ipfire/html/themes/ipfire/include/colors.txt", \%color);
# File declarations.
my $settingsfile = "${General::swroot}/guardian/settings";
my $ignoredfile = "${General::swroot}/guardian/ignored";
# Create empty settings and ignoredfile if they do not exist yet.
-unless (-e "$settingsfile") { system("touch $settingsfile"); }
-unless (-e "$ignoredfile") { system("touch $ignoredfile"); }
+unless (-e "$settingsfile") { &General::system("touch", "$settingsfile"); }
+unless (-e "$ignoredfile") { &General::system("touch", "$ignoredfile"); }
our %settings = ();
our %ignored = ();
my @hosts;
# Launch helper to get chains from iptables.
- system('/usr/local/bin/getipstat');
+ open (FILE, '/usr/local/bin/getipstat | ');
- # Open temporary file which contains the chains and rules.
- open (FILE, '/var/tmp/iptables.txt');
-
- # Loop through the entire file.
+ # Loop through the entire output.
while (<FILE>) {
my $line = $_;
# Close filehandle.
close(FILE);
- # Remove recently created temporary files of the "getipstat" binary.
- system("rm -f /var/tmp/iptables.txt");
- system("rm -f /var/tmp/iptablesmangle.txt");
- system("rm -f /var/tmp/iptablesnat.txt");
-
# Convert entries, sort them, write back and store the sorted entries into new array.
my @sorted = map { $_->[0] }
sort { $a->[1] <=> $b->[1] }
my $configfile = "${General::swroot}/guardian/guardian.conf";
# Create the configfile if none exists yet.
- unless (-e "$configfile") { system("touch $configfile"); }
+ unless (-e "$configfile") { &General::system("touch", "$configfile"); }
# Open configfile for writing.
open(FILE, ">$configfile");
&Guardian::Socket::Client("reload");
} else {
# Launch guardian.
- system("/usr/local/bin/addonctrl guardian start &>/dev/null");
+ &General::system("/usr/local/bin/addonctrl", "guardian", "start");
}
} else {
# Stop the daemon.
- system("/usr/local/bin/addonctrl guardian stop &>/dev/null");
+ &General::system("/usr/local/bin/addonctrl", "guardian", "stop");
}
}
&General::readhasharray($ignoredfile, \%ignored);
# Create the guardian.ignore file if not exist yet.
- unless (-e "$ignorefile") { system("touch $ignorefile"); }
+ unless (-e "$ignorefile") { &General::system("touch", "$ignorefile"); }
# Open ignorefile for writing.
open(FILE, ">$ignorefile");