Fix voucher test and expire pages. Fixes #7939

This commit is contained in:
jim-p 2017-10-14 22:00:21 -04:00
parent c5a3368303
commit 0b2d15478e
2 changed files with 14 additions and 18 deletions

View File

@ -57,13 +57,11 @@ $pglinks = array("", "status_captiveportal.php", "status_captiveportal.php?zone=
include("head.inc");
if ($_POST['save']) {
if ($_POST['vouchers']) {
if (voucher_expire($_POST['vouchers'])) {
print_info_box(gettext('Voucher(s) successfully marked.'), 'success', false);
} else {
print_info_box(gettext('Voucher(s) could not be processed.'), 'danger', false);
}
if ($_POST['Submit'] && $_POST['vouchers']) {
if (voucher_expire(trim($_POST['vouchers']))) {
print_info_box(gettext('Voucher(s) successfully marked.'), 'success', false);
} else {
print_info_box(gettext('Voucher(s) could not be processed.'), 'danger', false);
}
}

View File

@ -58,21 +58,19 @@ $shortcut_section = "captiveportal-vouchers";
include("head.inc");
if ($_POST['save']) {
if ($_POST['vouchers']) {
$test_results = voucher_auth($_POST['vouchers'], 1);
$output = "";
$class = 'warning';
if ($_POST['Submit'] && $_POST['vouchers']) {
$test_results = voucher_auth(trim($_POST['vouchers']), 1);
$output = "";
$class = 'warning';
foreach ($test_results as $result) {
$output .= htmlspecialchars($result) . '<br />';
foreach ($test_results as $result) {
$output .= htmlspecialchars($result) . '<br />';
if (strpos($result, " good ") || strpos($result, " granted ")) {
$class = 'success';
}
if (strpos($result, " good ") || strpos($result, " granted ")) {
$class = 'success';
}
print_info_box($output, $class, false);
}
print_info_box($output, $class, false);
}
$tab_array = array();