Revision d9ed341d
Added by sbeaver over 10 years ago
usr/local/www/services_captiveportal_vouchers.php | ||
---|---|---|
56 | 56 |
if (isset($_POST['zone'])) |
57 | 57 |
$cpzone = $_POST['zone']; |
58 | 58 |
|
59 |
if (empty($cpzone)) { |
|
60 |
header("Location: services_captiveportal_zones.php");
|
|
61 |
exit;
|
|
59 |
if (false && empty($cpzone)) {
|
|
60 |
header("Location: services_captiveportal_zones.php"); |
|
61 |
exit; |
|
62 | 62 |
} |
63 | 63 |
|
64 | 64 |
if($_REQUEST['generatekey']) { |
... | ... | |
79 | 79 |
} |
80 | 80 |
|
81 | 81 |
if (!is_array($config['captiveportal'])) |
82 |
$config['captiveportal'] = array();
|
|
82 |
$config['captiveportal'] = array(); |
|
83 | 83 |
|
84 | 84 |
$a_cp =& $config['captiveportal']; |
85 | 85 |
|
86 | 86 |
if (!is_array($config['voucher'])) |
87 | 87 |
$config['voucher'] = array(); |
88 | 88 |
|
89 |
if (empty($a_cp[$cpzone])) { |
|
89 |
if (false && empty($a_cp[$cpzone])) {
|
|
90 | 90 |
log_error("Submission on captiveportal page with unknown zone parameter: " . htmlspecialchars($cpzone)); |
91 | 91 |
header("Location: services_captiveportal_zones.php"); |
92 | 92 |
exit; |
... | ... | |
113 | 113 |
continue; |
114 | 114 |
|
115 | 115 |
$exponent = ($exponent * 2) + 1; // Make it odd number |
116 |
|
|
116 | 117 |
if ($exponent <= 65537) |
117 | 118 |
break; |
118 | 119 |
} |
... | ... | |
152 | 153 |
unlock($voucherlck); |
153 | 154 |
write_config(); |
154 | 155 |
} |
156 |
|
|
155 | 157 |
header("Location: services_captiveportal_vouchers.php?zone={$cpzone}"); |
156 | 158 |
exit; |
157 | 159 |
} |
... | ... | |
248 | 250 |
|
249 | 251 |
if (!$input_errors) { |
250 | 252 |
if (empty($config['voucher'][$cpzone])) |
251 |
$newvoucher = array(); |
|
252 |
else |
|
253 |
$newvoucher = $config['voucher'][$cpzone]; |
|
253 |
$newvoucher = array(); |
|
254 |
else |
|
255 |
$newvoucher = $config['voucher'][$cpzone]; |
|
256 |
|
|
254 | 257 |
if ($_POST['enable'] == "yes") |
255 | 258 |
$newvoucher['enable'] = true; |
256 | 259 |
else |
257 | 260 |
unset($newvoucher['enable']); |
261 |
|
|
258 | 262 |
if (empty($_POST['vouchersyncusername'])) { |
259 | 263 |
unset($newvoucher['vouchersyncdbip']); |
260 | 264 |
unset($newvoucher['vouchersyncport']); |
... | ... | |
472 | 476 |
'Sample Text', |
473 | 477 |
// 'Voucher Public Key', |
474 | 478 |
$pconfig['publickey'] |
475 |
))->setHelp(gettext('Paste an RSA public key (64 Bit or smaller) in PEM format here. This key is used to decrypt vouchers.') . "<a href='#' onclick='generatenewkey();'>" . gettext('Generate new key') . "</a>");
|
|
479 |
))->setHelp('Paste an RSA public key (64 Bit or smaller) in PEM format here. This key is used to decrypt vouchers.' . "<a href='#' onclick='generatenewkey();'>" . 'Generate new key' . "</a>");
|
|
476 | 480 |
|
477 | 481 |
$section->addInput(new Form_TextArea( |
478 | 482 |
'privatekey', |
479 | 483 |
'Voucher Private Key', |
480 | 484 |
$pconfig['privatekey'] |
481 |
))->setHelp(gettext('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.'));
|
|
485 |
))->setHelp('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.');
|
|
482 | 486 |
|
483 | 487 |
$section->addInput(new Form_Input( |
484 | 488 |
'charset', |
485 | 489 |
'Character set', |
486 | 490 |
'text', |
487 |
htmlspecialchars($pconfig['charset'])
|
|
488 |
))->setHelp(gettext('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.'));
|
|
491 |
$pconfig['charset']
|
|
492 |
))->setHelp('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.');
|
|
489 | 493 |
|
490 | 494 |
$section->addInput(new Form_Input( |
491 | 495 |
'rollbits', |
492 | 496 |
'# of Roll bits', |
493 | 497 |
'text', |
494 |
htmlspecialchars($pconfig['rollbits'])
|
|
495 |
))->setHelp(gettext('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.'));
|
|
498 |
$pconfig['rollbits']
|
|
499 |
))->setHelp('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.');
|
|
496 | 500 |
|
497 | 501 |
$section->addInput(new Form_Input( |
498 | 502 |
'ticketbits', |
499 | 503 |
'# of Ticket bits', |
500 | 504 |
'text', |
501 |
htmlspecialchars($pconfig['ticketbits'])
|
|
502 |
))->setHelp(gettext('Reserves a range in each voucher to store the Ticket# it belongs to. Allowed range: 1..16. ' .
|
|
505 |
$pconfig['ticketbits']
|
|
506 |
))->setHelp('Reserves a range in each voucher to store the Ticket# it belongs to. Allowed range: 1..16. ' . |
|
503 | 507 |
'Using 16 bits allows a roll to have up to 65535 vouchers. ' . |
504 |
'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. '));
|
|
508 |
'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. '); |
|
505 | 509 |
|
506 | 510 |
$section->addInput(new Form_Input( |
507 | 511 |
'checksumbits', |
508 | 512 |
'# of Checksum bits', |
509 | 513 |
'text', |
510 |
htmlspecialchars($pconfig['checksumbits'])
|
|
511 |
))->setHelp(gettext('Reserves a range in each voucher to store a simple checksum over Roll # and Ticket#. Allowed range is 0..31.'));
|
|
514 |
$pconfig['checksumbits']
|
|
515 |
))->setHelp('Reserves a range in each voucher to store a simple checksum over Roll # and Ticket#. Allowed range is 0..31.');
|
|
512 | 516 |
|
513 | 517 |
$section->addInput(new Form_Input( |
514 | 518 |
'magic', |
515 | 519 |
'Magic number', |
516 | 520 |
'text', |
517 |
htmlspecialchars($pconfig['magic'])
|
|
518 |
))->setHelp(gettext('Magic number stored in every voucher. Verified during voucher check. ' .
|
|
519 |
'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.'));
|
|
521 |
$pconfig['magic']
|
|
522 |
))->setHelp('Magic number stored in every voucher. Verified during voucher check. ' . |
|
523 |
'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.'); |
|
520 | 524 |
|
521 | 525 |
$section->addInput(new Form_Input( |
522 | 526 |
'msgnoaccess', |
523 | 527 |
'Invalid voucher message', |
524 | 528 |
'text', |
525 |
htmlspecialchars($pconfig['msgnoaccess'])
|
|
526 |
))->setHelp(gettext('Error message displayed for invalid vouchers on captive portal error page ($PORTAL_MESSAGE$).'));
|
|
529 |
$pconfig['msgnoaccess']
|
|
530 |
))->setHelp('Error message displayed for invalid vouchers on captive portal error page ($PORTAL_MESSAGE$).');
|
|
527 | 531 |
|
528 | 532 |
|
529 | 533 |
$section->addInput(new Form_Input( |
530 | 534 |
'msgexpired', |
531 | 535 |
'Expired voucher message', |
532 | 536 |
'text', |
533 |
htmlspecialchars($pconfig['msgexpired'])
|
|
534 |
))->setHelp(gettext('Error message displayed for expired vouchers on captive portal error page ($PORTAL_MESSAGE$).'));
|
|
537 |
$pconfig['msgexpired']
|
|
538 |
))->setHelp('Error message displayed for expired vouchers on captive portal error page ($PORTAL_MESSAGE$).');
|
|
535 | 539 |
|
536 | 540 |
$form->add($section); |
537 | 541 |
|
... | ... | |
541 | 545 |
$section->addInput(new Form_IpAddress( |
542 | 546 |
'vouchersyncdbip', |
543 | 547 |
'Synchronize Voucher Database IP', |
544 |
htmlspecialchars($pconfig['vouchersyncdbip'])
|
|
545 |
))->setHelp(gettext('IP address of master nodes webConfigurator to synchronize voucher database and used vouchers from.') . '<br />' .
|
|
546 |
gettext('NOTE: this should be setup on the slave nodes and not the primary node!'));
|
|
548 |
$pconfig['vouchersyncdbip']
|
|
549 |
))->setHelp('IP address of master nodes webConfigurator to synchronize voucher database and used vouchers from.' . '<br />' .
|
|
550 |
'NOTE: this should be setup on the slave nodes and not the primary node!');
|
|
547 | 551 |
|
548 | 552 |
$section->addInput(new Form_Input( |
549 | 553 |
'vouchersyncport', |
550 | 554 |
'Vouchwe sync port', |
551 | 555 |
'text', |
552 |
htmlspecialchars($pconfig['vouchersyncport'])
|
|
553 |
))->setHelp(gettext('The port of the master voucher node\'s webConfigurator. Example: 443 '));
|
|
556 |
$pconfig['vouchersyncport']
|
|
557 |
))->setHelp('The port of the master voucher node\'s webConfigurator. Example: 443 ');
|
|
554 | 558 |
|
555 | 559 |
$section->addInput(new Form_Input( |
556 | 560 |
'vouchersyncusername', |
557 | 561 |
'Voucher sync username', |
558 | 562 |
'text', |
559 |
htmlspecialchars($pconfig['vouchersyncusername'])
|
|
560 |
))->setHelp(gettext('This is the username of the master voucher nodes webConfigurator.'));
|
|
563 |
$pconfig['vouchersyncusername']
|
|
564 |
))->setHelp('This is the username of the master voucher nodes webConfigurator.');
|
|
561 | 565 |
|
562 | 566 |
$section->addInput(new Form_Input( |
563 | 567 |
'vouchersyncpass', |
564 | 568 |
'Voucher sync password', |
565 | 569 |
'password', |
566 |
htmlspecialchars($pconfig['vouchersyncuserpass'])
|
|
567 |
))->setHelp(gettext('This is the password of the master voucher nodes webConfigurator.'));
|
|
570 |
$pconfig['vouchersyncuserpass']
|
|
571 |
))->setHelp('This is the password of the master voucher nodes webConfigurator.');
|
|
568 | 572 |
|
569 | 573 |
$section->addInput(new Form_Input( |
570 | 574 |
'zone', |
571 | 575 |
null, |
572 | 576 |
'hidden', |
573 |
htmlspecialchars($cpzone)
|
|
577 |
$cpzone
|
|
574 | 578 |
)); |
575 | 579 |
|
576 | 580 |
$section->addInput(new Form_Input( |
577 | 581 |
'exponent', |
578 | 582 |
null, |
579 | 583 |
'hidden', |
580 |
htmlspecialchars($pconfig['exponent'])
|
|
584 |
$pconfig['exponent']
|
|
581 | 585 |
)); |
582 | 586 |
|
583 | 587 |
$form->add($section); |
Also available in: Unified diff
Removed unneeded gettext/htmlspecialcharacter