captive: Code cleanup

No functional changes

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
Michael Tremer
2017-04-28 14:34:14 +01:00
parent b7a126d9c8
commit a41fe924ae

View File

@@ -215,26 +215,14 @@ if ($cgiparams{'ACTION'} eq 'delete-client') {
&Header::openpage($Lang::tr{'Captive menu'}, 1, '');
&Header::openbigbox();
#call error() to see if we have to print an errormessage on website
&error();
#call config() to display the configuration box
&config();
sub getterms(){
my @ret;
open(FILE, "<:utf8", "/var/ipfire/captive/terms.txt");
while(<FILE>) {
push(@ret, HTML::Entities::decode_entities($_));
}
close(FILE);
return join(/\n/, @ret);
# If an error message exists, show a box with the error message
if ($errormessage) {
&Header::openbox('100%', 'left', $Lang::tr{'error messages'});
print $errormessage;
&Header::closebox();
}
sub config(){
#prints the config box on the website
# Prints the config box on the website
&Header::openbox('100%', 'left', $Lang::tr{'Captive config'});
print <<END
<form method='post' action='$ENV{'SCRIPT_NAME'}' enctype="multipart/form-data">\n
@@ -242,6 +230,7 @@ sub config(){
<tr>
END
;
#check which parameters have to be enabled (from settings file)
$checked{'ENABLE_GREEN'}{'off'} = '';
$checked{'ENABLE_GREEN'}{'on'} = '';
@@ -272,6 +261,7 @@ print<<END
<select name='AUTH'>
END
;
print "<option value='TERMS' ";
print " selected='selected'" if ($settings{'AUTH'} eq 'TERMS');
print ">$Lang::tr{'Captive terms'}</option>";
@@ -286,6 +276,7 @@ END
</tr>
END
;
if ($settings{'AUTH'} eq 'TERMS') {
$selected{'SESSION_TIME'} = ();
$selected{'SESSION_TIME'}{'0'} = "";
@@ -384,6 +375,17 @@ END
#otherwise we show the licensepart
&show_license_connections();
}
sub getterms() {
my @ret;
open(FILE, "<:utf8", "/var/ipfire/captive/terms.txt");
while(<FILE>) {
push(@ret, HTML::Entities::decode_entities($_));
}
close(FILE);
return join(/\n/, @ret);
}
sub gencode(){
@@ -623,15 +625,5 @@ sub validremark
return 1;
}
sub error{
#if an errormessage exits, show a box with errormessage
if ($errormessage) {
&Header::openbox('100%', 'left', $Lang::tr{'error messages'});
print "<class name='base'>$errormessage\n";
print "&nbsp;</class>\n";
&Header::closebox();
}
}
&Header::closebigbox();
&Header::closepage();