diff --git a/usr/local/www/services_captiveportal_vouchers.php b/usr/local/www/services_captiveportal_vouchers.php index f6c4577dd4..c6cf3e9a0b 100644 --- a/usr/local/www/services_captiveportal_vouchers.php +++ b/usr/local/www/services_captiveportal_vouchers.php @@ -36,7 +36,6 @@ ##|*MATCH=services_captiveportal_vouchers.php* ##|-PRIV -$pgtitle = array("Services", "Captive portal", "Vouchers"); $statusurl = "status_captiveportal_vouchers.php"; $logurl = "diag_logs_auth.php"; @@ -47,6 +46,8 @@ require("shaper.inc"); require("captiveportal.inc"); require_once("voucher.inc"); +$pgtitle = array(gettext("Services"), gettext("Captive portal"), gettext("Vouchers")); + if (!is_array($config['voucher'])) { $config['voucher'] = array(); } @@ -87,10 +88,10 @@ if (!isset($config['voucher']['publickey'])) { } } if (!isset($config['voucher']['msgnoaccess'])) { - $config['voucher']['msgnoaccess'] = "Voucher invalid"; + $config['voucher']['msgnoaccess'] = gettext("Voucher invalid"); } if (!isset($config['voucher']['msgexpired'])) { - $config['voucher']['msgexpired'] = "Voucher expired"; + $config['voucher']['msgexpired'] = gettext("Voucher expired"); } $a_roll = &$config['voucher']['roll']; @@ -115,7 +116,7 @@ if ($_GET['act'] == "csv") { if (strstr($privkey,"BEGIN RSA PRIVATE KEY")) { $fd = fopen("{$g['varetc_path']}/voucher.private","w"); if (!$fd) { - $input_errors[] = "Cannot write private key file.\n"; + $input_errors[] = gettext("Cannot write private key file") . ".\n"; } else { chmod("{$g['varetc_path']}/voucher.private", 0600); fwrite($fd, $privkey); @@ -135,7 +136,7 @@ if ($_GET['act'] == "csv") { } } } else { - $input_errors[] = "Need private RSA key to print vouchers\n"; + $input_errors[] = gettext("Need private RSA key to print vouchers") . "\n"; } } @@ -159,37 +160,37 @@ if ($_POST) { /* input validation */ if ($_POST['enable']) { $reqdfields = explode(" ", "charset rollbits ticketbits checksumbits publickey magic saveinterval"); - $reqdfieldsn = explode(",", "charset,rollbits,ticketbits,checksumbits,publickey,magic,saveinterval"); + $reqdfieldsn = array(gettext("charset"),gettext("rollbits"),gettext("ticketbits"),gettext("checksumbits"),gettext("publickey"),gettext("magic"),gettext("saveinterval")); do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); } if ($_POST['charset'] && (strlen($_POST['charset'] < 2))) { - $input_errors[] = "Need at least 2 characters to create vouchers."; + $input_errors[] = gettext("Need at least 2 characters to create vouchers."); } if ($_POST['charset'] && (strpos($_POST['charset'],"\"")>0)) { - $input_errors[] = "Double quotes aren't allowed."; + $input_errors[] = gettext("Double quotes aren't allowed."); } if ($_POST['charset'] && (strpos($_POST['charset'],",")>0)) { - $input_errors[] = "',' aren't allowed."; + $input_errors[] = "',' " . gettext("aren't allowed."); } if ($_POST['rollbits'] && (!is_numeric($_POST['rollbits']) || ($_POST['rollbits'] < 1) || ($_POST['rollbits'] > 31))) { - $input_errors[] = "# of Bits to store Roll Id needs to be between 1..31."; + $input_errors[] = gettext("# of Bits to store Roll Id needs to be between 1..31."); } if ($_POST['ticketbits'] && (!is_numeric($_POST['ticketbits']) || ($_POST['ticketbits'] < 1) || ($_POST['ticketbits'] > 16))) { - $input_errors[] = "# of Bits to store Ticket Id needs to be between 1..16."; + $input_errors[] = gettext("# of Bits to store Ticket Id needs to be between 1..16."); } if ($_POST['checksumbits'] && (!is_numeric($_POST['checksumbits']) || ($_POST['checksumbits'] < 1) || ($_POST['checksumbits'] > 31))) { - $input_errors[] = "# of Bits to store checksum needs to be between 1..31."; + $input_errors[] = gettext("# of Bits to store checksum needs to be between 1..31."); } if ($_POST['saveinterval'] && (!is_numeric($_POST['saveinterval']) || ($_POST['saveinterval'] < 1))) { - $input_errors[] = "Save interval in minutes cant be negative."; + $input_errors[] = gettext("Save interval in minutes cant be negative."); } if ($_POST['publickey'] && (!strstr($_POST['publickey'],"BEGIN PUBLIC KEY"))) { - $input_errors[] = "This doesn't look like an RSA Public key."; + $input_errors[] = gettext("This doesn't look like an RSA Public key."); } if ($_POST['privatekey'] && (!strstr($_POST['privatekey'],"BEGIN RSA PRIVATE KEY"))) { - $input_errors[] = "This doesn't look like an RSA Private key."; + $input_errors[] = gettext("This doesn't look like an RSA Private key."); } if (!$input_errors) { @@ -208,7 +209,7 @@ if ($_POST) { write_config(); voucher_configure(); if (isset($config['voucher']['enable']) && !isset($config['captiveportal']['enable'])) { - $savemsg = "Don't forget to configure and enable Captive Portal."; + $savemsg = gettext("Don't forget to configure and enable Captive Portal."); } } } @@ -242,11 +243,11 @@ function enable_change(enable_change) { @@ -258,18 +259,18 @@ function enable_change(enable_change) {   onClick="enable_change(false)"> - Enable Vouchers + - Voucher Rolls + - - - - + + + + @@ -288,9 +289,9 @@ function enable_change(enable_change) { @@ -299,99 +300,99 @@ function enable_change(enable_change) { \"add"; + echo ""; } ?>
Roll#Minutes/Ticket# of TicketsComment##
- edit voucher - delete vouchers - generate vouchers for this roll to CSV file + " width="17" height="17" border="0" alt=""> + ')">" width="17" height="17" border="0" alt=""> + " width="11" height="15" border="0" alt="">
\""
-Create, generate and activate Rolls with Vouchers that allow access through the -captive portal for the configured time. Once a voucher is activated, -its clock is started and runs uninterrupted until it expires. During that -time, the voucher can be re-used from the same or a different computer. If the voucher -is used again from another computer, the previous session is stopped. +. -Enable Voucher support first using the checkbox above and hit Save at the bottom. +. - Voucher public key +
- Paste an RSA public key (64 Bit or smaller) in PEM format here. This key is used to decrypt vouchers. + . - Voucher private key +
- Paste an RSA private key (64 Bit or smaller) in PEM format here. This key is only used to generate encrypted vouchers and doesn't need to be available if the vouchers have been generated offline. + . - Character set +
- Tickets are generated with the specified character set. It should contain printable characters (numbers, lower case and upper case letters) that are hard to confuse with others. Avoid e.g. 0/O and l/1. + . - # of Roll Bits + #
- Reserves a range in each voucher to store the Roll# it belongs to. Allowed range: 1..31. Sum of Roll+Ticket+Checksum bits must be one Bit less than the RSA key size. + . - # of Ticket Bits + #
- Reserves a range in each voucher to store the Ticket# it belongs to. Allowed range: 1..16. Using 16 bits allows a roll to have up to 65535 vouchers. A bit array, stored in RAM and in the config, is used to mark if a voucher has been used. A bit array for 65535 vouchers requires 8 KB of storage. + . - # of Checksum Bits + #
- Reserves a range in each voucher to store a simple checksum over Roll# and Ticket#. Allowed range is 0..31. + . - Magic Number +
- Magic number stored in every voucher. Verified during voucher check. Size depends on how many bits are left by Roll+Ticket+Checksum bits. If all bits are used, no magic number will be used and checked. + . - Save Interval + - Minutes
- The list of active and used vouchers can be stored in the system's configuration file once every x minutes to survive power outages. No save is done if no new vouchers have been activated. Enter 0 to never write runtime state to XML config. +
+ . - Invalid Voucher Message + -
Error message displayed for invalid vouchers on captive portal error page ($PORTAL_MESSAGE$). +
($PORTAL_MESSAGE$). - Expired Voucher Message + -
Error message displayed for expired vouchers on captive portal error page ($PORTAL_MESSAGE$). +
($PORTAL_MESSAGE$).   - + " onClick="enable_change(true)">

- Note:
- Changing any Voucher parameter (apart from managing the list of Rolls) on this page will render existing vouchers useless if they were generated with different settings. + :
+ .