From: maniacikarus Date: Thu, 21 Jun 2007 18:14:48 +0000 (+0000) Subject: Einige CGI Fixes X-Git-Url: http://git.ipfire.org/?p=people%2Fteissler%2Fipfire-2.x.git;a=commitdiff_plain;h=fe6cda9204068d973e4b84d25861c485e1c1bea9 Einige CGI Fixes git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@643 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8 --- diff --git a/html/cgi-bin/dhcp.cgi b/html/cgi-bin/dhcp.cgi index e24f7336d..c51834e8e 100644 --- a/html/cgi-bin/dhcp.cgi +++ b/html/cgi-bin/dhcp.cgi @@ -44,6 +44,7 @@ our $filename3 = "${General::swroot}/dhcp/advoptions-list"; # Describe the allow my $errormessage = ''; my $warnNTPmessage = ''; my @nosaved=(); +my %color = (); #Basic syntax allowed for new Option definition. Not implemented: RECORDS & array of RECORDS our $OptionTypes = 'boolean|((un)?signed )?integer (8|16|32)|ip-address|text|string|encapsulate \w+|array of ip-address'; @@ -102,6 +103,7 @@ foreach my $itf (@ITFs) { &General::readhash("${General::swroot}/ethernet/settings", \%netsettings); &General::readhash("${General::swroot}/main/settings", \%mainsettings); &General::readhash("${General::swroot}/time/settings", \%timesettings); +&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color); #Get GUI values &Header::getcgihash(\%dhcpsettings); @@ -721,9 +723,9 @@ foreach my $line (@current1) { if ($dhcpsettings{'KEY1'} eq $key) { print ""; } elsif ($key % 2) { - print ""; + print ""; } else { - print ""; + print ""; } print <"; } elsif ($key % 2) { - print ""; + print ""; } else { - print ""; + print ""; } my $TAG0 = ''; my $TAG1 = ''; diff --git a/html/cgi-bin/hardwaregraphs.cgi b/html/cgi-bin/hardwaregraphs.cgi index 473d1fe8e..478bf9c38 100644 --- a/html/cgi-bin/hardwaregraphs.cgi +++ b/html/cgi-bin/hardwaregraphs.cgi @@ -18,6 +18,11 @@ require "${General::swroot}/lang.pl"; require "${General::swroot}/header.pl"; require "${General::swroot}/graphs.pl"; +my %color = (); +my %mainsettings = (); +&General::readhash("${General::swroot}/main/settings", \%mainsettings); +&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color); + my %cgiparams=(); my @cgigraphs=(); @@ -180,7 +185,7 @@ if ($cgigraphs[1] =~ /hddtemp/){ } &Header::closebox(); print "
"; - print ""; + print ""; print "$Lang::tr{'back'}
\n"; } else @@ -274,11 +279,11 @@ foreach $key ( sort(keys %mbmon_values) ) { if ( $i % 2 ) { - print(""); + print(""); } else { - print(""); + print(""); } $mbmon_settings{'LABEL-'.$key} = &Header::cleanhtml($mbmon_settings{'LABEL-'.$key}); print(""); diff --git a/html/cgi-bin/index.cgi b/html/cgi-bin/index.cgi index f53536b09..4a90705a8 100644 --- a/html/cgi-bin/index.cgi +++ b/html/cgi-bin/index.cgi @@ -282,11 +282,11 @@ END if ($confighash{$key}[0] eq 'on') { $gif = 'on.gif'; } else { $gif = 'off.gif'; } if ($id % 2) { - print "\n"; + print " $confighash{$key}[1] / " . $Lang::tr{"$confighash{$key}[3]"} . " (" . $Lang::tr{"$confighash{$key}[4]"} . ")"; } else { - print "\n"; + print " $confighash{$key}[1] / " . $Lang::tr{"$confighash{$key}[3]"} . " (" . $Lang::tr{"$confighash{$key}[4]"} . ")"; } - print " $confighash{$key}[1] / " . $Lang::tr{"$confighash{$key}[3]"} . " (" . $Lang::tr{"$confighash{$key}[4]"} . ")"; + my $active = "
$Lang::tr{'capsclosed'}
"; if ($confighash{$key}[0] eq 'off') { $active = "
$Lang::tr{'capsclosed'}
"; diff --git a/html/cgi-bin/updatexlrator.cgi b/html/cgi-bin/updatexlrator.cgi index aa4395110..5fd57599a 100644 --- a/html/cgi-bin/updatexlrator.cgi +++ b/html/cgi-bin/updatexlrator.cgi @@ -21,6 +21,7 @@ require '/var/ipfire/general-functions.pl'; require "${General::swroot}/lang.pl"; require "${General::swroot}/header.pl"; +my %color = (); my %checked=(); my %selected=(); my %netsettings=(); @@ -60,6 +61,7 @@ my $chk_cron_mly = "${General::swroot}/updatexlrator/autocheck/cron.monthly"; &General::readhash("${General::swroot}/ethernet/settings", \%netsettings); &General::readhash("${General::swroot}/main/settings", \%mainsettings); &General::readhash("${General::swroot}/proxy/settings", \%proxysettings); +&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color); $xlratorsettings{'ACTION'} = ''; $xlratorsettings{'ENABLE_LOG'} = 'off'; @@ -385,9 +387,9 @@ END { $id++; if ($id % 2) { - print "\n"; } + print "\n"; } else { - print "\n"; } + print "\n"; } $filesize = (-s "$repository/$updatefile"); 1 while $filesize =~ s/^(-?\d+)(\d{3})/$1.$2/; diff --git a/src/misc-progs/ipsecctrl.c b/src/misc-progs/ipsecctrl.c index 05c8de34a..7f332e4d9 100644 --- a/src/misc-progs/ipsecctrl.c +++ b/src/misc-progs/ipsecctrl.c @@ -279,14 +279,16 @@ int main(int argc, char *argv[]) { if (!(initsetuid())) exit(1); + FILE *file = NULL; + /* Get vpnwatch pid */ - int fd; - if (( fd = open("/var/run/vpn-watch.pid", O_RDONLY)) != "" ) { - close(fd); - safe_system("kill -9 $(cat /var/run/vpn-watch.pid)"); + + if (file = fopen("/var/run/vpn-watch.pid", "r")) { + safe_system("kill -9 fd"); safe_system("unlink /var/run/vpn-watch.pid)"); } - + close(fd); + /* FIXME: workaround for pclose() issue - still no real idea why * this is happening */ signal(SIGCHLD, SIG_DFL); @@ -356,7 +358,6 @@ int main(int argc, char *argv[]) { char if_orange[STRING_SIZE] = ""; char if_blue[STRING_SIZE] = ""; char s[STRING_SIZE]; - FILE *file = NULL; if (!(file = fopen(CONFIG_ROOT "/vpn/config", "r"))) { fprintf(stderr, "Couldn't open vpn settings file");