diff --git a/html/cgi-bin/captive.cgi b/html/cgi-bin/captive.cgi index 2d2c792ad..10198721f 100755 --- a/html/cgi-bin/captive.cgi +++ b/html/cgi-bin/captive.cgi @@ -215,13 +215,168 @@ 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(); +# 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(); +} -#call config() to display the configuration box -&config(); +# Prints the config box on the website +&Header::openbox('100%', 'left', $Lang::tr{'Captive config'}); +print <\n + + +END +; -sub getterms(){ +#check which parameters have to be enabled (from settings file) +$checked{'ENABLE_GREEN'}{'off'} = ''; +$checked{'ENABLE_GREEN'}{'on'} = ''; +$checked{'ENABLE_GREEN'}{$settings{'ENABLE_GREEN'}} = "checked='checked'"; + +$checked{'ENABLE_BLUE'}{'off'} = ''; +$checked{'ENABLE_BLUE'}{'on'} = ''; +$checked{'ENABLE_BLUE'}{$settings{'ENABLE_BLUE'}} = "checked='checked'"; + +$checked{'UNLIMITED'}{'off'} = ''; +$checked{'UNLIMITED'}{'on'} = ''; +$checked{'UNLIMITED'}{$settings{'UNLIMITED'}} = "checked='checked'"; + +if ($netsettings{'GREEN_DEV'}){ + print ""; +} +if ($netsettings{'BLUE_DEV'}){ + print ""; +} + +print< + + + + +END +; + +if ($settings{'AUTH'} eq 'TERMS') { + $selected{'SESSION_TIME'} = (); + $selected{'SESSION_TIME'}{'0'} = ""; + $selected{'SESSION_TIME'}{'3600'} = ""; + $selected{'SESSION_TIME'}{'86400'} = ""; + $selected{'SESSION_TIME'}{'604800'} = ""; + $selected{'SESSION_TIME'}{'18144000'} = ""; + $selected{'SESSION_TIME'}{$settings{'SESSION_TIME'}} = "selected"; + + my $terms = &getterms(); + print < + + + + + + + + +END +} + +print< + + + + + + + + + + +END + +# Logo Upload +print < + + + +END + +if (-e $logo) { + print < + + + +END +} + +print < + + + +
$Lang::tr{'Captive active on'} Green
$Lang::tr{'Captive active on'} Blue
+ $Lang::tr{'Captive authentication'} + +
+ +
$Lang::tr{'Captive client session expiry time'} + +
+
+ $Lang::tr{'Captive branding'} +
+ $Lang::tr{'Captive title'} + + +
$Lang::tr{'Captive brand color'} + +
+ $Lang::tr{'Captive logo_upload'} +
+ $Lang::tr{'Captive logo_upload1'} +
+ +
$Lang::tr{'Captive logo uploaded'}$Lang::tr{'yes'}
+ +
+END + +&Header::closebox(); + +#if settings is set to use coupons, the coupon part has to be displayed +if ($settings{'AUTH'} eq 'COUPON') { + &coupons(); +} else { + #otherwise we show the licensepart + &show_license_connections(); +} + +sub getterms() { my @ret; open(FILE, "<:utf8", "/var/ipfire/captive/terms.txt"); @@ -233,159 +388,6 @@ sub getterms(){ return join(/\n/, @ret); } -sub config(){ - #prints the config box on the website - &Header::openbox('100%', 'left', $Lang::tr{'Captive config'}); - print <\n - - -END -; - #check which parameters have to be enabled (from settings file) - $checked{'ENABLE_GREEN'}{'off'} = ''; - $checked{'ENABLE_GREEN'}{'on'} = ''; - $checked{'ENABLE_GREEN'}{$settings{'ENABLE_GREEN'}} = "checked='checked'"; - - $checked{'ENABLE_BLUE'}{'off'} = ''; - $checked{'ENABLE_BLUE'}{'on'} = ''; - $checked{'ENABLE_BLUE'}{$settings{'ENABLE_BLUE'}} = "checked='checked'"; - - $checked{'UNLIMITED'}{'off'} = ''; - $checked{'UNLIMITED'}{'on'} = ''; - $checked{'UNLIMITED'}{$settings{'UNLIMITED'}} = "checked='checked'"; - - if ($netsettings{'GREEN_DEV'}){ - print ""; - } - if ($netsettings{'BLUE_DEV'}){ - print ""; - } - -print< - - - - -END -; - if ($settings{'AUTH'} eq 'TERMS') { - $selected{'SESSION_TIME'} = (); - $selected{'SESSION_TIME'}{'0'} = ""; - $selected{'SESSION_TIME'}{'3600'} = ""; - $selected{'SESSION_TIME'}{'86400'} = ""; - $selected{'SESSION_TIME'}{'604800'} = ""; - $selected{'SESSION_TIME'}{'18144000'} = ""; - $selected{'SESSION_TIME'}{$settings{'SESSION_TIME'}} = "selected"; - - my $terms = &getterms(); - print < - - - - - - - - -END - } - - print< - - - - - - - - - - -END - - # Logo Upload - print < - - - -END - - if (-e $logo) { - print < - - - -END - } - - print < - - - -
$Lang::tr{'Captive active on'} Green
$Lang::tr{'Captive active on'} Blue
- $Lang::tr{'Captive authentication'} - -
- -
$Lang::tr{'Captive client session expiry time'} - -
-
- $Lang::tr{'Captive branding'} -
- $Lang::tr{'Captive title'} - - -
$Lang::tr{'Captive brand color'} - -
- $Lang::tr{'Captive logo_upload'} -
- $Lang::tr{'Captive logo_upload1'} -
- -
$Lang::tr{'Captive logo uploaded'}$Lang::tr{'yes'}
- -
-END - - &Header::closebox(); - - #if settings is set to use coupons, the coupon part has to be displayed - if ($settings{'AUTH'} eq 'COUPON'){ - &coupons(); - }else{ - #otherwise we show the licensepart - &show_license_connections(); - } -} - sub gencode(){ #generate a random code only letters from A-Z except 'O' and 0-9 my @chars = ("A".."N", "P".."Z", "0".."9"); @@ -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 "$errormessage\n"; - print " \n"; - &Header::closebox(); - } -} - &Header::closebigbox(); &Header::closepage();