mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-27 03:07:43 +02:00
captive: Rename "License" mode to "Terms & Conditions"
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
@@ -101,14 +101,15 @@ if ($cgiparams{'ACTION'} eq "$Lang::tr{'save'}"){
|
||||
|
||||
&General::writehash("$settingsfile", \%settings);
|
||||
|
||||
#write Licensetext if defined
|
||||
if ($cgiparams{'AGB'}){
|
||||
$cgiparams{'AGB'} = &Header::escape($cgiparams{'AGB'});
|
||||
open( FH, ">:utf8", "/var/ipfire/captive/agb.txt" ) or die("$!");
|
||||
print FH $cgiparams{'AGB'};
|
||||
close( FH );
|
||||
$cgiparams{'AGB'}="";
|
||||
# Save terms
|
||||
if ($cgiparams{'TERMS'}){
|
||||
$cgiparams{'TERMS'} = &Header::escape($cgiparams{'TERMS'});
|
||||
open(FH, ">:utf8", "/var/ipfire/captive/terms.txt") or die("$!");
|
||||
print FH $cgiparams{'TERMS'};
|
||||
close(FH);
|
||||
$cgiparams{'TERMS'} = "";
|
||||
}
|
||||
|
||||
#execute binary to reload firewall rules
|
||||
system("/usr/local/bin/captivectrl");
|
||||
|
||||
@@ -224,14 +225,16 @@ if ($cgiparams{'ACTION'} eq 'delvoucherinuse'){
|
||||
#call config() to display the configuration box
|
||||
&config();
|
||||
|
||||
sub getagb(){
|
||||
#open textfile from /var/ipfire/captive/agb.txt
|
||||
open( my $handle, "<:utf8", "/var/ipfire/captive/agb.txt" ) or die("$!");
|
||||
while(<$handle>){
|
||||
#read line by line and print on screen
|
||||
$cgiparams{'AGB'}.= HTML::Entities::decode_entities($_);
|
||||
}
|
||||
close( $handle );
|
||||
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 config(){
|
||||
@@ -282,12 +285,12 @@ print<<END
|
||||
$Lang::tr{'Captive authentication'}
|
||||
</td>
|
||||
<td><br>
|
||||
<select name='AUTH' style='width:8em;'>
|
||||
<select name='AUTH'>
|
||||
END
|
||||
;
|
||||
print "<option value='LICENSE' ";
|
||||
print " selected='selected'" if ($settings{'AUTH'} eq 'LICENSE');
|
||||
print ">$Lang::tr{'Captive auth_lic'}</option>";
|
||||
print "<option value='TERMS' ";
|
||||
print " selected='selected'" if ($settings{'AUTH'} eq 'TERMS');
|
||||
print ">$Lang::tr{'Captive terms'}</option>";
|
||||
|
||||
print "<option value='VOUCHER' ";
|
||||
print " selected='selected'" if ($settings{'AUTH'} eq 'VOUCHER');
|
||||
@@ -299,7 +302,17 @@ END
|
||||
</tr>
|
||||
END
|
||||
;
|
||||
if ($settings{'AUTH'} eq 'LICENSE'){ &agbbox(); };
|
||||
if ($settings{'AUTH'} eq 'TERMS') {
|
||||
my $terms = &getterms();
|
||||
print <<END;
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<textarea cols="50" rows="10" name="TERMS">$terms</textarea>
|
||||
</td>
|
||||
</tr>
|
||||
END
|
||||
}
|
||||
|
||||
#Logo Upload
|
||||
print "<tr><td><br>$Lang::tr{'Captive logo_upload'}<br>$Lang::tr{'Captive logo_upload1'}</td><td><br><INPUT TYPE='file' NAME='uploaded_file' SIZE=30 MAXLENGTH=80></td></tr><tr>";
|
||||
@@ -343,22 +356,6 @@ END
|
||||
}
|
||||
}
|
||||
|
||||
sub agbbox(){
|
||||
&getagb();
|
||||
print<<END
|
||||
<tr>
|
||||
<td>
|
||||
License agreement
|
||||
</td>
|
||||
<td>
|
||||
<br>
|
||||
<textarea cols="50" rows="10" name="AGB">$cgiparams{'AGB'}</textarea>
|
||||
</td>
|
||||
</tr>
|
||||
END
|
||||
;
|
||||
}
|
||||
|
||||
sub gencode(){
|
||||
#generate a random code only letters from A-Z except 'O' and 0-9
|
||||
my @chars = ("A".."N", "P".."Z", "0".."9");
|
||||
|
||||
Reference in New Issue
Block a user