Commit d03721da authored by Franco Fichtner's avatar Franco Fichtner

captiveportal: apply PSR2 style

parent 87387963
...@@ -33,37 +33,39 @@ require_once("shaper.inc"); ...@@ -33,37 +33,39 @@ require_once("shaper.inc");
require_once("captiveportal.inc"); require_once("captiveportal.inc");
$cpzone = $_GET['zone']; $cpzone = $_GET['zone'];
if (isset($_POST['zone'])) if (isset($_POST['zone'])) {
$cpzone = $_POST['zone']; $cpzone = $_POST['zone'];
}
if (empty($cpzone) || empty($config['captiveportal'][$cpzone])) { if (empty($cpzone) || empty($config['captiveportal'][$cpzone])) {
header("Location: services_captiveportal_zones.php"); header("Location: services_captiveportal_zones.php");
exit; exit;
} }
if (!is_array($config['captiveportal'])) if (!is_array($config['captiveportal'])) {
$config['captiveportal'] = array(); $config['captiveportal'] = array();
}
$a_cp =& $config['captiveportal']; $a_cp =& $config['captiveportal'];
$pgtitle = array(gettext("Services"),gettext("Captive portal"), $a_cp[$cpzone]['zone']); $pgtitle = array(gettext("Services"),gettext("Captive portal"), $a_cp[$cpzone]['zone']);
$shortcut_section = "captiveportal"; $shortcut_section = "captiveportal";
if ($_GET['act'] == "del") { if ($_GET['act'] == "del") {
$a_allowedips =& $config['captiveportal'][$cpzone]['allowedip']; $a_allowedips =& $config['captiveportal'][$cpzone]['allowedip'];
if ($a_allowedips[$_GET['id']]) { if ($a_allowedips[$_GET['id']]) {
$ipent = $a_allowedips[$_GET['id']]; $ipent = $a_allowedips[$_GET['id']];
unset($a_allowedips[$_GET['id']]); unset($a_allowedips[$_GET['id']]);
write_config(); write_config();
header("Location: services_captiveportal_ip.php?zone={$cpzone}"); header("Location: services_captiveportal_ip.php?zone={$cpzone}");
exit; exit;
} }
} }
include("head.inc"); include("head.inc");
$main_buttons = array( $main_buttons = array(
array('label'=>'Add IP address', 'href'=>'services_captiveportal_ip_edit.php?zone='.$cpzone), array('label'=>'Add IP address', 'href'=>'services_captiveportal_ip_edit.php?zone='.$cpzone),
); );
...@@ -77,21 +79,23 @@ $main_buttons = array( ...@@ -77,21 +79,23 @@ $main_buttons = array(
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<?php if ($savemsg) print_info_box($savemsg); ?> <?php if ($savemsg) {
print_info_box($savemsg);
} ?>
<section class="col-xs-12"> <section class="col-xs-12">
<?php <?php
$tab_array = array(); $tab_array = array();
$tab_array[] = array(gettext("Captive portal(s)"), false, "services_captiveportal.php?zone={$cpzone}"); $tab_array[] = array(gettext("Captive portal(s)"), false, "services_captiveportal.php?zone={$cpzone}");
$tab_array[] = array(gettext("MAC"), false, "services_captiveportal_mac.php?zone={$cpzone}"); $tab_array[] = array(gettext("MAC"), false, "services_captiveportal_mac.php?zone={$cpzone}");
$tab_array[] = array(gettext("Allowed IP addresses"), true, "services_captiveportal_ip.php?zone={$cpzone}"); $tab_array[] = array(gettext("Allowed IP addresses"), true, "services_captiveportal_ip.php?zone={$cpzone}");
// Hide Allowed Hostnames as this feature is currently not supported // Hide Allowed Hostnames as this feature is currently not supported
// $tab_array[] = array(gettext("Allowed Hostnames"), false, "services_captiveportal_hostname.php?zone={$cpzone}"); // $tab_array[] = array(gettext("Allowed Hostnames"), false, "services_captiveportal_hostname.php?zone={$cpzone}");
$tab_array[] = array(gettext("Vouchers"), false, "services_captiveportal_vouchers.php?zone={$cpzone}"); $tab_array[] = array(gettext("Vouchers"), false, "services_captiveportal_vouchers.php?zone={$cpzone}");
$tab_array[] = array(gettext("File Manager"), false, "services_captiveportal_filemanager.php?zone={$cpzone}"); $tab_array[] = array(gettext("File Manager"), false, "services_captiveportal_filemanager.php?zone={$cpzone}");
display_top_tabs($tab_array, true); display_top_tabs($tab_array, true);
?> ?>
<div class="tab-content content-box col-xs-12"> <div class="tab-content content-box col-xs-12">
...@@ -109,41 +113,50 @@ $main_buttons = array( ...@@ -109,41 +113,50 @@ $main_buttons = array(
</td> </td>
</tr> </tr>
<?php if (is_array($a_cp[$cpzone]['allowedip'])): <?php if (is_array($a_cp[$cpzone]['allowedip'])) :
$i = 0; foreach ($a_cp[$cpzone]['allowedip'] as $ip): ?> $i = 0; foreach ($a_cp[$cpzone]['allowedip'] as $ip) :
<tr ondblclick="document.location='services_captiveportal_ip_edit.php?zone=<?=$cpzone;?>&amp;id=<?=$i;?>'"> ?>
<tr ondblclick="document.location='services_captiveportal_ip_edit.php?zone=<?=$cpzone;
?>&amp;id=<?=$i;?>'">
<td class="listlr"> <td class="listlr">
<?php <?php
if($ip['dir'] == "to") { if ($ip['dir'] == "to") {
echo "any <span class=\"glyphicon glyphicon-arrow-right\" aria-hidden=\"true\" alt=\"in\"></span> "; echo "any <span class=\"glyphicon glyphicon-arrow-right\" aria-hidden=\"true\" alt=\"in\"></span> ";
} }
if($ip['dir'] == "both") { if ($ip['dir'] == "both") {
echo "<span class=\"glyphicon glyphicon-resize-horizontal\" aria-hidden=\"true\" alt=\"pass\"></span> "; echo "<span class=\"glyphicon glyphicon-resize-horizontal\" aria-hidden=\"true\" alt=\"pass\"></span> ";
} }
echo strtolower($ip['ip']); echo strtolower($ip['ip']);
if($ip['sn'] != "32" && is_numeric($ip['sn'])) { if ($ip['sn'] != "32" && is_numeric($ip['sn'])) {
$sn = $ip['sn']; $sn = $ip['sn'];
echo "/$sn"; echo "/$sn";
} }
if($ip['dir'] == "from") { if ($ip['dir'] == "from") {
echo "<span class=\"glyphicon glyphicon-arrow-right\" aria-hidden=\"true\" alt=\"any\"></span> any"; echo "<span class=\"glyphicon glyphicon-arrow-right\" aria-hidden=\"true\" alt=\"any\"></span> any";
} }
?> ?>
</td> </td>
<td class="listbg"> <td class="listbg">
<?=htmlspecialchars($ip['descr']);?>&nbsp; <?=htmlspecialchars($ip['descr']);?>&nbsp;
</td> </td>
<td valign="middle" class="list nowrap"><a href="services_captiveportal_ip_edit.php?zone=<?=$cpzone;?>&amp;id=<?=$i;?>" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-pencil"></span></a> <td valign="middle" class="list nowrap"><a href="services_captiveportal_ip_edit.php?zone=<?=$cpzone;
<a href="services_captiveportal_ip.php?zone=<?=$cpzone;?>&amp;act=del&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this address?"); ?>')" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-remove"></span></a></td> ?>&amp;id=<?=$i;?>" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-pencil"></span></a>
<a href="services_captiveportal_ip.php?zone=<?=$cpzone;
?>&amp;act=del&amp;id=<?=$i;
?>" onclick="return confirm('<?=gettext("Do you really want to delete this address?"); ?>')" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-remove"></span></a></td>
</tr> </tr>
<?php $i++; endforeach; endif; ?> <?php $i++;
endforeach;
endif; ?>
<tr> <tr>
<td colspan="2" class="list"><p class="vexpl"><span class="red"><strong> <td colspan="2" class="list"><p class="vexpl"><span class="red"><strong>
<?=gettext("Note:"); ?><br /> <?=gettext("Note:"); ?><br />
</strong></span> </strong></span>
<?=gettext("Adding allowed IP addresses will allow IP access to/from these addresses through the captive portal without being taken to the portal page. This can be used for a web server serving images for the portal page or a DNS server on another network, for example."); ?></p> <?=gettext("Adding allowed IP addresses will allow IP access to/from these addresses through the captive portal without being taken to the portal page. This can be used for a web server serving images for the portal page or a DNS server on another network, for example."); ?></p>
</td> </td>
<td class="list">&nbsp;</td> <td class="list">&nbsp;</td>
</tr> </tr>
...@@ -157,4 +170,4 @@ $main_buttons = array( ...@@ -157,4 +170,4 @@ $main_buttons = array(
</div> </div>
</section> </section>
<?php include("foot.inc"); ?> <?php include("foot.inc");
...@@ -28,14 +28,16 @@ ...@@ -28,14 +28,16 @@
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
*/ */
function allowedipscmp($a, $b) { function allowedipscmp($a, $b)
return strcmp($a['ip'], $b['ip']); {
return strcmp($a['ip'], $b['ip']);
} }
function allowedips_sort() { function allowedips_sort()
global $g, $config, $cpzone; {
global $g, $config, $cpzone;
usort($config['captiveportal'][$cpzone]['allowedip'],"allowedipscmp"); usort($config['captiveportal'][$cpzone]['allowedip'], "allowedipscmp");
} }
require_once("guiconfig.inc"); require_once("guiconfig.inc");
...@@ -48,102 +50,114 @@ $pgtitle = array(gettext("Services"),gettext("Captive portal"),gettext("Edit all ...@@ -48,102 +50,114 @@ $pgtitle = array(gettext("Services"),gettext("Captive portal"),gettext("Edit all
$shortcut_section = "captiveportal"; $shortcut_section = "captiveportal";
$cpzone = $_GET['zone']; $cpzone = $_GET['zone'];
if (isset($_POST['zone'])) if (isset($_POST['zone'])) {
$cpzone = $_POST['zone']; $cpzone = $_POST['zone'];
}
if (empty($cpzone) || empty($config['captiveportal'][$cpzone])) { if (empty($cpzone) || empty($config['captiveportal'][$cpzone])) {
header("Location: services_captiveportal_zones.php"); header("Location: services_captiveportal_zones.php");
exit; exit;
} }
if (!is_array($config['captiveportal'])) if (!is_array($config['captiveportal'])) {
$config['captiveportal'] = array(); $config['captiveportal'] = array();
}
$a_cp =& $config['captiveportal']; $a_cp =& $config['captiveportal'];
if (is_numericint($_GET['id'])) if (is_numericint($_GET['id'])) {
$id = $_GET['id']; $id = $_GET['id'];
if (isset($_POST['id']) && is_numericint($_POST['id'])) }
$id = $_POST['id']; if (isset($_POST['id']) && is_numericint($_POST['id'])) {
$id = $_POST['id'];
}
if (!is_array($config['captiveportal'][$cpzone]['allowedip'])) if (!is_array($config['captiveportal'][$cpzone]['allowedip'])) {
$config['captiveportal'][$cpzone]['allowedip'] = array(); $config['captiveportal'][$cpzone]['allowedip'] = array();
}
$a_allowedips =& $config['captiveportal'][$cpzone]['allowedip']; $a_allowedips =& $config['captiveportal'][$cpzone]['allowedip'];
if (isset($id) && $a_allowedips[$id]) { if (isset($id) && $a_allowedips[$id]) {
$pconfig['ip'] = $a_allowedips[$id]['ip']; $pconfig['ip'] = $a_allowedips[$id]['ip'];
$pconfig['sn'] = $a_allowedips[$id]['sn']; $pconfig['sn'] = $a_allowedips[$id]['sn'];
$pconfig['bw_up'] = $a_allowedips[$id]['bw_up']; $pconfig['bw_up'] = $a_allowedips[$id]['bw_up'];
$pconfig['bw_down'] = $a_allowedips[$id]['bw_down']; $pconfig['bw_down'] = $a_allowedips[$id]['bw_down'];
$pconfig['descr'] = $a_allowedips[$id]['descr']; $pconfig['descr'] = $a_allowedips[$id]['descr'];
} }
if ($_POST) { if ($_POST) {
unset($input_errors);
unset($input_errors); $pconfig = $_POST;
$pconfig = $_POST;
/* input validation */
/* input validation */ $reqdfields = explode(" ", "ip sn");
$reqdfields = explode(" ", "ip sn"); $reqdfieldsn = array(gettext("Allowed IP address"), gettext("Subnet mask"));
$reqdfieldsn = array(gettext("Allowed IP address"), gettext("Subnet mask"));
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
if ($_POST['ip'] && !is_ipaddr($_POST['ip'])) {
if ($_POST['ip'] && !is_ipaddr($_POST['ip'])) $input_errors[] = sprintf(gettext("A valid IP address must be specified. [%s]"), $_POST['ip']);
$input_errors[] = sprintf(gettext("A valid IP address must be specified. [%s]"), $_POST['ip']); }
if ($_POST['sn'] && (!is_numeric($_POST['sn']) || ($_POST['sn'] < 1) || ($_POST['sn'] > 32))) if ($_POST['sn'] && (!is_numeric($_POST['sn']) || ($_POST['sn'] < 1) || ($_POST['sn'] > 32))) {
$input_errors[] = gettext("A valid subnet mask must be specified"); $input_errors[] = gettext("A valid subnet mask must be specified");
}
if ($_POST['bw_up'] && !is_numeric($_POST['bw_up']))
$input_errors[] = gettext("Upload speed needs to be an integer"); if ($_POST['bw_up'] && !is_numeric($_POST['bw_up'])) {
$input_errors[] = gettext("Upload speed needs to be an integer");
if ($_POST['bw_down'] && !is_numeric($_POST['bw_down'])) }
$input_errors[] = gettext("Download speed needs to be an integer");
if ($_POST['bw_down'] && !is_numeric($_POST['bw_down'])) {
foreach ($a_allowedips as $ipent) { $input_errors[] = gettext("Download speed needs to be an integer");
if (isset($id) && ($a_allowedips[$id]) && ($a_allowedips[$id] === $ipent)) }
continue;
foreach ($a_allowedips as $ipent) {
if ($ipent['ip'] == $_POST['ip']){ if (isset($id) && ($a_allowedips[$id]) && ($a_allowedips[$id] === $ipent)) {
$input_errors[] = sprintf("[%s] %s.", $_POST['ip'], gettext("already allowed")) ; continue;
break ; }
}
} if ($ipent['ip'] == $_POST['ip']) {
$input_errors[] = sprintf("[%s] %s.", $_POST['ip'], gettext("already allowed")) ;
if (!$input_errors) { break ;
$ip = array(); }
$ip['ip'] = $_POST['ip']; }
$ip['sn'] = $_POST['sn'];
$ip['descr'] = $_POST['descr']; if (!$input_errors) {
if ($_POST['bw_up']) $ip = array();
$ip['bw_up'] = $_POST['bw_up']; $ip['ip'] = $_POST['ip'];
if ($_POST['bw_down']) $ip['sn'] = $_POST['sn'];
$ip['bw_down'] = $_POST['bw_down']; $ip['descr'] = $_POST['descr'];
if (isset($id) && $a_allowedips[$id]) { if ($_POST['bw_up']) {
$oldip = $a_allowedips[$id]['ip']; $ip['bw_up'] = $_POST['bw_up'];
if (!empty($a_allowedips[$id]['sn'])) }
$oldmask = $a_allowedips[$id]['sn']; if ($_POST['bw_down']) {
else $ip['bw_down'] = $_POST['bw_down'];
$oldmask = 32; }
$a_allowedips[$id] = $ip; if (isset($id) && $a_allowedips[$id]) {
} else { $oldip = $a_allowedips[$id]['ip'];
$a_allowedips[] = $ip; if (!empty($a_allowedips[$id]['sn'])) {
} $oldmask = $a_allowedips[$id]['sn'];
allowedips_sort(); } else {
$oldmask = 32;
write_config(); }
$a_allowedips[$id] = $ip;
if (isset($a_cp[$cpzone]['enable']) && is_module_loaded("ipfw.ko")) { } else {
$rules = ""; $a_allowedips[] = $ip;
$cpzoneid = $a_cp[$cpzone]['zoneid']; }
unset($ipfw); allowedips_sort();
captiveportal_allowedip_configure_entry($ip);
$uniqid = uniqid("{$cpzone}_allowed"); write_config();
}
if (isset($a_cp[$cpzone]['enable']) && is_module_loaded("ipfw.ko")) {
header("Location: services_captiveportal_ip.php?zone={$cpzone}"); $rules = "";
exit; $cpzoneid = $a_cp[$cpzone]['zoneid'];
} unset($ipfw);
captiveportal_allowedip_configure_entry($ip);
$uniqid = uniqid("{$cpzone}_allowed");
}
header("Location: services_captiveportal_ip.php?zone={$cpzone}");
exit;
}
} }
include("head.inc"); include("head.inc");
...@@ -160,7 +174,9 @@ include("head.inc"); ...@@ -160,7 +174,9 @@ include("head.inc");
<div class="row"> <div class="row">
<?php if ($input_errors) print_input_errors($input_errors); ?> <?php if ($input_errors) {
print_input_errors($input_errors);
} ?>
<section class="col-xs-12"> <section class="col-xs-12">
...@@ -176,11 +192,17 @@ include("head.inc"); ...@@ -176,11 +192,17 @@ include("head.inc");
<tr> <tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("IP address"); ?></td> <td width="22%" valign="top" class="vncellreq"><?=gettext("IP address"); ?></td>
<td width="78%" class="vtable"> <td width="78%" class="vtable">
<?=$mandfldhtml;?><input name="ip" type="text" class="formfld unknown" id="ip" size="17" value="<?=htmlspecialchars($pconfig['ip']);?>" /> <?=$mandfldhtml;
?><input name="ip" type="text" class="formfld unknown" id="ip" size="17" value="<?=htmlspecialchars($pconfig['ip']);?>" />
/<select name='sn' class="formselect" id='sn'> /<select name='sn' class="formselect" id='sn'>
<?php for ($i = 32; $i >= 1; $i--): ?> <?php for ($i = 32; $i >= 1; $i--) :
<option value="<?=$i;?>" <?php if ($i == $pconfig['sn']) echo "selected=\"selected\""; ?>><?=$i;?></option> ?>
<?php endfor; ?> <option value="<?=$i;?>" <?php if ($i == $pconfig['sn']) {
echo "selected=\"selected\"";
} ?>><?=$i;?></option>
<?php
endfor; ?>
</select> </select>
<br /> <br />
<span class="vexpl"><?=gettext("IP address and subnet mask. Use /32 for a single IP");?>.</span> <span class="vexpl"><?=gettext("IP address and subnet mask. Use /32 for a single IP");?>.</span>
...@@ -214,9 +236,11 @@ include("head.inc"); ...@@ -214,9 +236,11 @@ include("head.inc");
<td width="78%"> <td width="78%">
<input name="Submit" type="submit" class="btn btn-primary" value="<?=gettext("Save"); ?>" /> <input name="Submit" type="submit" class="btn btn-primary" value="<?=gettext("Save"); ?>" />
<input name="zone" type="hidden" value="<?=htmlspecialchars($cpzone);?>" /> <input name="zone" type="hidden" value="<?=htmlspecialchars($cpzone);?>" />
<?php if (isset($id) && $a_allowedips[$id]): ?> <?php if (isset($id) && $a_allowedips[$id]) :
?>
<input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" /> <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" />
<?php endif; ?> <?php
endif; ?>
</td> </td>
</tr> </tr>
</table> </table>
...@@ -228,4 +252,4 @@ include("head.inc"); ...@@ -228,4 +252,4 @@ include("head.inc");
</div> </div>
</section> </section>
<?php include("foot.inc"); ?> <?php include("foot.inc");
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -34,23 +34,25 @@ require_once("captiveportal.inc"); ...@@ -34,23 +34,25 @@ require_once("captiveportal.inc");
global $cpzone; global $cpzone;
global $cpzoneid; global $cpzoneid;
if (!is_array($config['captiveportal'])) if (!is_array($config['captiveportal'])) {
$config['captiveportal'] = array(); $config['captiveportal'] = array();
}
$a_cp = &$config['captiveportal']; $a_cp = &$config['captiveportal'];
if ($_GET['act'] == "del" && !empty($_GET['zone'])) { if ($_GET['act'] == "del" && !empty($_GET['zone'])) {
$cpzone = $_GET['zone']; $cpzone = $_GET['zone'];
if ($a_cp[$cpzone]) { if ($a_cp[$cpzone]) {
$cpzoneid = $a_cp[$cpzone]['zoneid']; $cpzoneid = $a_cp[$cpzone]['zoneid'];
unset($a_cp[$cpzone]['enable']); unset($a_cp[$cpzone]['enable']);
captiveportal_configure(); captiveportal_configure();
unset($a_cp[$cpzone]); unset($a_cp[$cpzone]);
if (isset($config['voucher'][$cpzone])) if (isset($config['voucher'][$cpzone])) {
unset($config['voucher'][$cpzone]); unset($config['voucher'][$cpzone]);
write_config(); }
header("Location: services_captiveportal_zones.php"); write_config();
exit; header("Location: services_captiveportal_zones.php");
} exit;
}
} }
$pgtitle = array(gettext("Captiveportal"),gettext("Zones")); $pgtitle = array(gettext("Captiveportal"),gettext("Zones"));
...@@ -58,7 +60,7 @@ $shortcut_section = "captiveportal"; ...@@ -58,7 +60,7 @@ $shortcut_section = "captiveportal";
include("head.inc"); include("head.inc");
$main_buttons = array( $main_buttons = array(
array('href'=>'services_captiveportal_zones_edit.php', 'label'=>gettext("add a new captiveportal instance")), array('href'=>'services_captiveportal_zones_edit.php', 'label'=>gettext("add a new captiveportal instance")),
); );
?> ?>
...@@ -70,10 +72,14 @@ $main_buttons = array( ...@@ -70,10 +72,14 @@ $main_buttons = array(
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<?php if ($savemsg) print_info_box($savemsg); ?> <?php if ($savemsg) {
<?php if (is_subsystem_dirty('captiveportal')): ?><p> print_info_box($savemsg);
} ?>
<?php if (is_subsystem_dirty('captiveportal')) :
?><p>
<?php print_info_box_np(gettext("The CaptivePortal entry list has been changed") . ".<br />" . gettext("You must apply the changes in order for them to take effect."));?> <?php print_info_box_np(gettext("The CaptivePortal entry list has been changed") . ".<br />" . gettext("You must apply the changes in order for them to take effect."));?>
<?php endif; ?> <?php
endif; ?>
<section class="col-xs-12"> <section class="col-xs-12">
...@@ -93,35 +99,40 @@ $main_buttons = array( ...@@ -93,35 +99,40 @@ $main_buttons = array(
</td> </td>
</tr> </tr>
<?php foreach ($a_cp as $cpzone => $cpitem): <?php foreach ($a_cp as $cpzone => $cpitem) :
if (!is_array($cpitem)) if (!is_array($cpitem)) {
continue; continue;
?> }
?>
<tr> <tr>
<td class="listlr" ondblclick="document.location='services_captiveportal.php?zone=<?=$cpzone;?>';"> <td class="listlr" ondblclick="document.location='services_captiveportal.php?zone=<?=$cpzone;?>';">
<?=htmlspecialchars($cpitem['zone']);?> <?=htmlspecialchars($cpitem['zone']);?>
</td> </td>
<td class="listlr" ondblclick="document.location='services_captiveportal.php?zone=<?=$cpzone;?>';"> <td class="listlr" ondblclick="document.location='services_captiveportal.php?zone=<?=$cpzone;?>';">
<?php $cpifaces = explode(",", $cpitem['interface']); <?php $cpifaces = explode(",", $cpitem['interface']);
foreach ($cpifaces as $cpiface) foreach ($cpifaces as $cpiface) {
echo convert_friendly_interface_to_friendly_descr($cpiface) . " "; echo convert_friendly_interface_to_friendly_descr($cpiface) . " ";
?> }
?>
</td> </td>
<td class="listr" ondblclick="document.location='services_captiveportal.php?zone=<?=$cpzone;?>';"> <td class="listr" ondblclick="document.location='services_captiveportal.php?zone=<?=$cpzone;?>';">
<?php <?php
$cpdb = new OPNsense\CaptivePortal\DB($cpzone) ; $cpdb = new OPNsense\CaptivePortal\DB($cpzone) ;
echo $cpdb->countClients() ; echo $cpdb->countClients() ;
?> ?>
</td> </td>
<td class="listbg" ondblclick="document.location='services_captiveportal.php?zone=<?=$cpzone;?>';"> <td class="listbg" ondblclick="document.location='services_captiveportal.php?zone=<?=$cpzone;?>';">
<?=htmlspecialchars($cpitem['descr']);?>&nbsp; <?=htmlspecialchars($cpitem['descr']);?>&nbsp;
</td> </td>
<td valign="middle" class="list nowrap"> <td valign="middle" class="list nowrap">
<a href="services_captiveportal.php?zone=<?=$cpzone?>" title="<?=gettext("edit captiveportal instance"); ?>" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-pencil"></span></a> <a href="services_captiveportal.php?zone=<?=$cpzone?>" title="<?=gettext("edit captiveportal instance"); ?>" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-pencil"></span></a>
<a href="services_captiveportal_zones.php?act=del&amp;zone=<?=$cpzone;?>" onclick="return confirm('<?=gettext("Do you really want to delete this entry?");?>')" title="<?=gettext("delete captiveportal instance");?>" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-remove"></span></a> <a href="services_captiveportal_zones.php?act=del&amp;zone=<?=$cpzone;
?>" onclick="return confirm('<?=gettext("Do you really want to delete this entry?");
?>')" title="<?=gettext("delete captiveportal instance");?>" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-remove"></span></a>
</td> </td>
</tr> </tr>
<?php endforeach; ?> <?php
endforeach; ?>
</table> </table>
</div> </div>
</form> </form>
...@@ -130,4 +141,4 @@ $main_buttons = array( ...@@ -130,4 +141,4 @@ $main_buttons = array(
</div> </div>
</div> </div>
</section> </section>
<?php include("foot.inc"); ?> <?php include("foot.inc");
...@@ -35,43 +35,43 @@ require_once("captiveportal.inc"); ...@@ -35,43 +35,43 @@ require_once("captiveportal.inc");
$pgtitle = array(gettext("Services"),gettext("Captive portal"),gettext("Edit Zones")); $pgtitle = array(gettext("Services"),gettext("Captive portal"),gettext("Edit Zones"));
$shortcut_section = "captiveportal"; $shortcut_section = "captiveportal";
if (!is_array($config['captiveportal'])) if (!is_array($config['captiveportal'])) {
$config['captiveportal'] = array(); $config['captiveportal'] = array();
}
$a_cp =& $config['captiveportal']; $a_cp =& $config['captiveportal'];
if ($_POST) { if ($_POST) {
unset($input_errors);
unset($input_errors); $pconfig = $_POST;
$pconfig = $_POST;
/* input validation */
/* input validation */ $reqdfields = explode(" ", "zone");
$reqdfields = explode(" ", "zone"); $reqdfieldsn = array(gettext("Zone name"));
$reqdfieldsn = array(gettext("Zone name"));
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
if (preg_match('/[^A-Za-z0-9_]/', $_POST['zone'])) {
if (preg_match('/[^A-Za-z0-9_]/', $_POST['zone'])) { $input_errors[] = gettext("The zone name can only contain letters, digits, and underscores (_).");
$input_errors[] = gettext("The zone name can only contain letters, digits, and underscores (_)."); }
}
foreach ($a_cp as $cpkey => $cpent) {
foreach ($a_cp as $cpkey => $cpent) { if ($cpent['zone'] == $_POST['zone']) {
if ($cpent['zone'] == $_POST['zone']) { $input_errors[] = sprintf("[%s] %s.", $_POST['zone'], gettext("already exists"));
$input_errors[] = sprintf("[%s] %s.", $_POST['zone'], gettext("already exists")); break;
break; }
} }
}
if (!$input_errors) {
if (!$input_errors) { $cpzone = strtolower($_POST['zone']);
$cpzone = strtolower($_POST['zone']); $a_cp[$cpzone] = array();
$a_cp[$cpzone] = array(); $a_cp[$cpzone]['zone'] = str_replace(" ", "", $_POST['zone']);
$a_cp[$cpzone]['zone'] = str_replace(" ", "", $_POST['zone']); $a_cp[$cpzone]['descr'] = $_POST['descr'];
$a_cp[$cpzone]['descr'] = $_POST['descr']; $a_cp[$cpzone]['localauth_priv'] = true;
$a_cp[$cpzone]['localauth_priv'] = true; write_config();
write_config();
header("Location: services_captiveportal.php?zone={$cpzone}");
header("Location: services_captiveportal.php?zone={$cpzone}"); exit;
exit; }
}
} }
include("head.inc"); include("head.inc");
?> ?>
...@@ -84,7 +84,9 @@ include("head.inc"); ...@@ -84,7 +84,9 @@ include("head.inc");
<div class="row"> <div class="row">
<?php if ($input_errors) print_input_errors($input_errors); ?> <?php if ($input_errors) {
print_input_errors($input_errors);
} ?>
<section class="col-xs-12"> <section class="col-xs-12">
...@@ -131,4 +133,4 @@ include("head.inc"); ...@@ -131,4 +133,4 @@ include("head.inc");
</div> </div>
</section> </section>
<?php include("foot.inc"); ?> <?php include("foot.inc");
...@@ -35,16 +35,18 @@ require_once("captiveportal.inc"); ...@@ -35,16 +35,18 @@ require_once("captiveportal.inc");
require_once("voucher.inc"); require_once("voucher.inc");
$cpzone = $_GET['zone']; $cpzone = $_GET['zone'];
if (isset($_POST['zone'])) if (isset($_POST['zone'])) {
$cpzone = $_POST['zone']; $cpzone = $_POST['zone'];
}
if (empty($cpzone)) { if (empty($cpzone)) {
header("Location: status_captiveportal.php"); header("Location: status_captiveportal.php");
exit; exit;
} }
if (!is_array($config['captiveportal'])) if (!is_array($config['captiveportal'])) {
$config['captiveportal'] = array(); $config['captiveportal'] = array();
}
$a_cp =& $config['captiveportal']; $a_cp =& $config['captiveportal'];
$pgtitle = array(gettext("Status"), gettext("Captive portal"), gettext("Expire Vouchers"), $a_cp[$cpzone]['zone']); $pgtitle = array(gettext("Status"), gettext("Captive portal"), gettext("Expire Vouchers"), $a_cp[$cpzone]['zone']);
...@@ -64,14 +66,14 @@ include("head.inc"); ...@@ -64,14 +66,14 @@ include("head.inc");
<section class="col-xs-12"> <section class="col-xs-12">
<?php <?php
$tab_array = array(); $tab_array = array();
$tab_array[] = array(gettext("Active Users"), false, "status_captiveportal.php?zone={$cpzone}"); $tab_array[] = array(gettext("Active Users"), false, "status_captiveportal.php?zone={$cpzone}");
$tab_array[] = array(gettext("Active Vouchers"), false, "status_captiveportal_vouchers.php?zone={$cpzone}"); $tab_array[] = array(gettext("Active Vouchers"), false, "status_captiveportal_vouchers.php?zone={$cpzone}");
$tab_array[] = array(gettext("Voucher Rolls"), false, "status_captiveportal_voucher_rolls.php?zone={$cpzone}"); $tab_array[] = array(gettext("Voucher Rolls"), false, "status_captiveportal_voucher_rolls.php?zone={$cpzone}");
$tab_array[] = array(gettext("Test Vouchers"), false, "status_captiveportal_test.php?zone={$cpzone}"); $tab_array[] = array(gettext("Test Vouchers"), false, "status_captiveportal_test.php?zone={$cpzone}");
$tab_array[] = array(gettext("Expire Vouchers"), true, "status_captiveportal_expire.php?zone={$cpzone}"); $tab_array[] = array(gettext("Expire Vouchers"), true, "status_captiveportal_expire.php?zone={$cpzone}");
display_top_tabs($tab_array); display_top_tabs($tab_array);
?> ?>
<div class="tab-content content-box col-xs-12"> <div class="tab-content content-box col-xs-12">
...@@ -99,20 +101,20 @@ include("head.inc"); ...@@ -99,20 +101,20 @@ include("head.inc");
</table> </table>
<?php <?php
if ($_POST) { if ($_POST) {
if ($_POST['vouchers']) { if ($_POST['vouchers']) {
$result = voucher_expire($_POST['vouchers']); $result = voucher_expire($_POST['vouchers']);
echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"4\" width=\"100%\" summary=\"results\">\n"; echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"4\" width=\"100%\" summary=\"results\">\n";
if ( $result) { if ($result) {
echo "<tr><td bgcolor=\"#D9DEE8\"><img src=\"/themes/{$g['theme']}/images/icons/icon_pass.gif\" alt=\"pass\" /></td>"; echo "<tr><td bgcolor=\"#D9DEE8\"><img src=\"/themes/{$g['theme']}/images/icons/icon_pass.gif\" alt=\"pass\" /></td>";
echo "<td bgcolor=\"#D9DEE8\">Success</td></tr>"; echo "<td bgcolor=\"#D9DEE8\">Success</td></tr>";
} else { } else {
echo "<tr><td bgcolor=\"#FFD9D1\"><img src=\"/themes/{$g['theme']}/images/icons/icon_block.gif\" alt=\"block\" /></td>"; echo "<tr><td bgcolor=\"#FFD9D1\"><img src=\"/themes/{$g['theme']}/images/icons/icon_block.gif\" alt=\"block\" /></td>";
echo "<td bgcolor=\"#FFD9D1\">Error</td></tr>"; echo "<td bgcolor=\"#FFD9D1\">Error</td></tr>";
} }
echo "</table>"; echo "</table>";
} }
} }
?> ?>
</div> </div>
...@@ -125,4 +127,4 @@ if ($_POST) { ...@@ -125,4 +127,4 @@ if ($_POST) {
</section> </section>
<?php include("foot.inc"); ?> <?php include("foot.inc");
...@@ -35,16 +35,18 @@ require_once("captiveportal.inc"); ...@@ -35,16 +35,18 @@ require_once("captiveportal.inc");
require_once("voucher.inc"); require_once("voucher.inc");
$cpzone = $_GET['zone']; $cpzone = $_GET['zone'];
if (isset($_POST['zone'])) if (isset($_POST['zone'])) {
$cpzone = $_POST['zone']; $cpzone = $_POST['zone'];
}
if (empty($cpzone)) { if (empty($cpzone)) {
header("Location: status_captiveportal.php"); header("Location: status_captiveportal.php");
exit; exit;
} }
if (!is_array($config['captiveportal'])) if (!is_array($config['captiveportal'])) {
$config['captiveportal'] = array(); $config['captiveportal'] = array();
}
$a_cp =& $config['captiveportal']; $a_cp =& $config['captiveportal'];
$pgtitle = array(gettext("Status"), gettext("Captive portal"), gettext("Test Vouchers"), $a_cp[$cpzone]['zone']); $pgtitle = array(gettext("Status"), gettext("Captive portal"), gettext("Test Vouchers"), $a_cp[$cpzone]['zone']);
...@@ -65,14 +67,14 @@ include("head.inc"); ...@@ -65,14 +67,14 @@ include("head.inc");
<section class="col-xs-12"> <section class="col-xs-12">
<?php <?php
$tab_array = array(); $tab_array = array();
$tab_array[] = array(gettext("Active Users"), false, "status_captiveportal.php?zone={$cpzone}"); $tab_array[] = array(gettext("Active Users"), false, "status_captiveportal.php?zone={$cpzone}");
$tab_array[] = array(gettext("Active Vouchers"), false, "status_captiveportal_vouchers.php?zone={$cpzone}"); $tab_array[] = array(gettext("Active Vouchers"), false, "status_captiveportal_vouchers.php?zone={$cpzone}");
$tab_array[] = array(gettext("Voucher Rolls"), false, "status_captiveportal_voucher_rolls.php?zone={$cpzone}"); $tab_array[] = array(gettext("Voucher Rolls"), false, "status_captiveportal_voucher_rolls.php?zone={$cpzone}");
$tab_array[] = array(gettext("Test Vouchers"), true, "status_captiveportal_test.php?zone={$cpzone}"); $tab_array[] = array(gettext("Test Vouchers"), true, "status_captiveportal_test.php?zone={$cpzone}");
$tab_array[] = array(gettext("Expire Vouchers"), false, "status_captiveportal_expire.php?zone={$cpzone}"); $tab_array[] = array(gettext("Expire Vouchers"), false, "status_captiveportal_expire.php?zone={$cpzone}");
display_top_tabs($tab_array); display_top_tabs($tab_array);
?> ?>
<div class="tab-content content-box col-xs-12"> <div class="tab-content content-box col-xs-12">
...@@ -128,4 +130,4 @@ if ($_POST) { ...@@ -128,4 +130,4 @@ if ($_POST) {
<? include("foot.inc"); ?> <? include("foot.inc");
...@@ -35,22 +35,24 @@ require_once("captiveportal.inc"); ...@@ -35,22 +35,24 @@ require_once("captiveportal.inc");
require_once("voucher.inc"); require_once("voucher.inc");
$cpzone = $_GET['zone']; $cpzone = $_GET['zone'];
if (isset($_POST['zone'])) if (isset($_POST['zone'])) {
$cpzone = $_POST['zone']; $cpzone = $_POST['zone'];
}
if (empty($cpzone)) { if (empty($cpzone)) {
header("Location: status_captiveportal.php"); header("Location: status_captiveportal.php");
exit; exit;
} }
if (!is_array($config['captiveportal'])) if (!is_array($config['captiveportal'])) {
$config['captiveportal'] = array(); $config['captiveportal'] = array();
}
$a_cp =& $config['captiveportal']; $a_cp =& $config['captiveportal'];
$pgtitle = array(gettext("Status"), gettext("Captive portal"), gettext("Voucher Rolls"), $a_cp[$cpzone]['zone']); $pgtitle = array(gettext("Status"), gettext("Captive portal"), gettext("Voucher Rolls"), $a_cp[$cpzone]['zone']);
$shortcut_section = "captiveportal-vouchers"; $shortcut_section = "captiveportal-vouchers";
if (!is_array($config['voucher'][$cpzone]['roll'])) { if (!is_array($config['voucher'][$cpzone]['roll'])) {
$config['voucher'][$cpzone]['roll'] = array(); $config['voucher'][$cpzone]['roll'] = array();
} }
$a_roll = &$config['voucher'][$cpzone]['roll']; $a_roll = &$config['voucher'][$cpzone]['roll'];
...@@ -69,14 +71,14 @@ include("head.inc"); ...@@ -69,14 +71,14 @@ include("head.inc");
<section class="col-xs-12"> <section class="col-xs-12">
<?php <?php
$tab_array = array(); $tab_array = array();
$tab_array[] = array(gettext("Active Users"), false, "status_captiveportal.php?zone={$cpzone}"); $tab_array[] = array(gettext("Active Users"), false, "status_captiveportal.php?zone={$cpzone}");
$tab_array[] = array(gettext("Active Vouchers"), false, "status_captiveportal_vouchers.php?zone={$cpzone}"); $tab_array[] = array(gettext("Active Vouchers"), false, "status_captiveportal_vouchers.php?zone={$cpzone}");
$tab_array[] = array(gettext("Voucher Rolls"), true, "status_captiveportal_voucher_rolls.php?zone={$cpzone}"); $tab_array[] = array(gettext("Voucher Rolls"), true, "status_captiveportal_voucher_rolls.php?zone={$cpzone}");
$tab_array[] = array(gettext("Test Vouchers"), false, "status_captiveportal_test.php?zone={$cpzone}"); $tab_array[] = array(gettext("Test Vouchers"), false, "status_captiveportal_test.php?zone={$cpzone}");
$tab_array[] = array(gettext("Expire Vouchers"), false, "status_captiveportal_expire.php?zone={$cpzone}"); $tab_array[] = array(gettext("Expire Vouchers"), false, "status_captiveportal_expire.php?zone={$cpzone}");
display_top_tabs($tab_array); display_top_tabs($tab_array);
?> ?>
<div class="tab-content content-box col-xs-12"> <div class="tab-content content-box col-xs-12">
...@@ -96,14 +98,14 @@ include("head.inc"); ...@@ -96,14 +98,14 @@ include("head.inc");
<td class="listhdr"><?=gettext("ready"); ?></td> <td class="listhdr"><?=gettext("ready"); ?></td>
</tr> </tr>
<?php <?php
$voucherlck = lock("vouche{$cpzone}r"); $voucherlck = lock("vouche{$cpzone}r");
$i = 0; foreach($a_roll as $rollent): $i = 0; foreach ($a_roll as $rollent) :
$used = voucher_used_count($rollent['number']); $used = voucher_used_count($rollent['number']);
$active = count(voucher_read_active_db($rollent['number']),$rollent['minutes']); $active = count(voucher_read_active_db($rollent['number']), $rollent['minutes']);
$ready = $rollent['count'] - $used; $ready = $rollent['count'] - $used;
/* used also count active vouchers, remove them */ /* used also count active vouchers, remove them */
$used = $used - $active; $used = $used - $active;
?> ?>
<tr> <tr>
<td class="listlr"> <td class="listlr">
<?=htmlspecialchars($rollent['number']); ?>&nbsp; <?=htmlspecialchars($rollent['number']); ?>&nbsp;
...@@ -127,7 +129,10 @@ include("head.inc"); ...@@ -127,7 +129,10 @@ include("head.inc");
<?=htmlspecialchars($ready); ?>&nbsp; <?=htmlspecialchars($ready); ?>&nbsp;
</td> </td>
</tr> </tr>
<?php $i++; endforeach; unlock($voucherlck); ?> <?php $i++;
endforeach;
unlock($voucherlck); ?>
</table> </table>
</div> </div>
</form> </form>
...@@ -138,4 +143,4 @@ include("head.inc"); ...@@ -138,4 +143,4 @@ include("head.inc");
</div> </div>
</section> </section>
<?php include("foot.inc"); ?> <?php include("foot.inc");
...@@ -35,58 +35,61 @@ require_once("captiveportal.inc"); ...@@ -35,58 +35,61 @@ require_once("captiveportal.inc");
require_once("voucher.inc"); require_once("voucher.inc");
$cpzone = $_GET['zone']; $cpzone = $_GET['zone'];
if (isset($_POST['zone'])) if (isset($_POST['zone'])) {
$cpzone = $_POST['zone']; $cpzone = $_POST['zone'];
}
if (empty($cpzone)) { if (empty($cpzone)) {
header("Location: status_captiveportal.php"); header("Location: status_captiveportal.php");
exit; exit;
} }
if (!is_array($config['captiveportal'])) if (!is_array($config['captiveportal'])) {
$config['captiveportal'] = array(); $config['captiveportal'] = array();
}
$a_cp =& $config['captiveportal']; $a_cp =& $config['captiveportal'];
$pgtitle = array(gettext("Status"), gettext("Captive portal"), gettext("Vouchers"), $a_cp[$cpzone]['zone']); $pgtitle = array(gettext("Status"), gettext("Captive portal"), gettext("Vouchers"), $a_cp[$cpzone]['zone']);
$shortcut_section = "captiveportal-vouchers"; $shortcut_section = "captiveportal-vouchers";
function clientcmp($a, $b) { function clientcmp($a, $b)
global $order; {
return strcmp($a[$order], $b[$order]); global $order;
return strcmp($a[$order], $b[$order]);
} }
if (!is_array($config['voucher'][$cpzone]['roll'])) { if (!is_array($config['voucher'][$cpzone]['roll'])) {
$config['voucher'][$cpzone]['roll'] = array(); $config['voucher'][$cpzone]['roll'] = array();
} }
$a_roll = $config['voucher'][$cpzone]['roll']; $a_roll = $config['voucher'][$cpzone]['roll'];
$db = array(); $db = array();
foreach($a_roll as $rollent) { foreach ($a_roll as $rollent) {
$roll = $rollent['number']; $roll = $rollent['number'];
$minutes = $rollent['minutes']; $minutes = $rollent['minutes'];
if (!file_exists("/var/db/voucher_{$cpzone}_active_{$roll}.db")) { if (!file_exists("/var/db/voucher_{$cpzone}_active_{$roll}.db")) {
continue; continue;
} }
$active_vouchers = file("/var/db/voucher_{$cpzone}_active_{$roll}.db", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); $active_vouchers = file("/var/db/voucher_{$cpzone}_active_{$roll}.db", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
foreach($active_vouchers as $voucher => $line) { foreach ($active_vouchers as $voucher => $line) {
list($voucher,$timestamp, $minutes) = explode(",", $line); list($voucher,$timestamp, $minutes) = explode(",", $line);
$remaining = (($timestamp + 60*$minutes) - time()); $remaining = (($timestamp + 60*$minutes) - time());
if ($remaining > 0) { if ($remaining > 0) {
$dbent[0] = $voucher; $dbent[0] = $voucher;
$dbent[1] = $roll; $dbent[1] = $roll;
$dbent[2] = $timestamp; $dbent[2] = $timestamp;
$dbent[3] = intval($remaining/60); $dbent[3] = intval($remaining/60);
$dbent[4] = $timestamp + 60*$minutes; // expires at $dbent[4] = $timestamp + 60*$minutes; // expires at
$db[] = $dbent; $db[] = $dbent;
} }
} }
} }
if ($_GET['order']) { if ($_GET['order']) {
$order = $_GET['order']; $order = $_GET['order'];
usort($db, "clientcmp"); usort($db, "clientcmp");
} }
include("head.inc"); include("head.inc");
...@@ -104,14 +107,14 @@ include("head.inc"); ...@@ -104,14 +107,14 @@ include("head.inc");
<section class="col-xs-12"> <section class="col-xs-12">
<?php <?php
$tab_array = array(); $tab_array = array();
$tab_array[] = array(gettext("Active Users"), false, "status_captiveportal.php?zone={$cpzone}"); $tab_array[] = array(gettext("Active Users"), false, "status_captiveportal.php?zone={$cpzone}");
$tab_array[] = array(gettext("Active Vouchers"), true, "status_captiveportal_vouchers.php?zone={$cpzone}"); $tab_array[] = array(gettext("Active Vouchers"), true, "status_captiveportal_vouchers.php?zone={$cpzone}");
$tab_array[] = array(gettext("Voucher Rolls"), false, "status_captiveportal_voucher_rolls.php?zone={$cpzone}"); $tab_array[] = array(gettext("Voucher Rolls"), false, "status_captiveportal_voucher_rolls.php?zone={$cpzone}");
$tab_array[] = array(gettext("Test Vouchers"), false, "status_captiveportal_test.php?zone={$cpzone}"); $tab_array[] = array(gettext("Test Vouchers"), false, "status_captiveportal_test.php?zone={$cpzone}");
$tab_array[] = array(gettext("Expire Vouchers"), false, "status_captiveportal_expire.php?zone={$cpzone}"); $tab_array[] = array(gettext("Expire Vouchers"), false, "status_captiveportal_expire.php?zone={$cpzone}");
display_top_tabs($tab_array); display_top_tabs($tab_array);
?> ?>
<div class="tab-content content-box col-xs-12"> <div class="tab-content content-box col-xs-12">
...@@ -122,23 +125,31 @@ include("head.inc"); ...@@ -122,23 +125,31 @@ include("head.inc");
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped table-sort"> <table class="table table-striped table-sort">
<tr> <tr>
<td class="listhdrr"><a href="?order=0&amp;showact=<?=htmlspecialchars($_GET['showact']);?>"><?=gettext("Voucher"); ?></a></td> <td class="listhdrr"><a href="?order=0&amp;showact=<?=htmlspecialchars($_GET['showact']);
<td class="listhdrr"><a href="?order=1&amp;showact=<?=htmlspecialchars($_GET['showact']);?>"><?=gettext("Roll"); ?></a></td> ?>"><?=gettext("Voucher"); ?></a></td>
<td class="listhdrr"><a href="?order=2&amp;showact=<?=htmlspecialchars($_GET['showact']);?>"><?=gettext("Activated at"); ?></a></td> <td class="listhdrr"><a href="?order=1&amp;showact=<?=htmlspecialchars($_GET['showact']);
<td class="listhdrr"><a href="?order=3&amp;showact=<?=htmlspecialchars($_GET['showact']);?>"><?=gettext("Expires in"); ?></a></td> ?>"><?=gettext("Roll"); ?></a></td>
<td class="listhdr"><a href="?order=4&amp;showact=<?=htmlspecialchars($_GET['showact']);?>"><?=gettext("Expires at"); ?></a></td> <td class="listhdrr"><a href="?order=2&amp;showact=<?=htmlspecialchars($_GET['showact']);
?>"><?=gettext("Activated at"); ?></a></td>
<td class="listhdrr"><a href="?order=3&amp;showact=<?=htmlspecialchars($_GET['showact']);
?>"><?=gettext("Expires in"); ?></a></td>
<td class="listhdr"><a href="?order=4&amp;showact=<?=htmlspecialchars($_GET['showact']);
?>"><?=gettext("Expires at"); ?></a></td>
<td class="list"></td> <td class="list"></td>
</tr> </tr>
<?php foreach ($db as $dbent): ?> <?php foreach ($db as $dbent) :
?>
<tr> <tr>
<td class="listlr"><?=$dbent[0];?></td> <td class="listlr"><?=$dbent[0];?></td>
<td class="listr"><?=$dbent[1];?></td> <td class="listr"><?=$dbent[1];?></td>
<td class="listr"><?=htmlspecialchars(date("m/d/Y H:i:s", $dbent[2]));?></td> <td class="listr"><?=htmlspecialchars(date("m/d/Y H:i:s", $dbent[2]));?></td>
<td class="listr"><?=$dbent[3];?> <?=gettext("min"); ?></td> <td class="listr"><?=$dbent[3];
?> <?=gettext("min"); ?></td>
<td class="listr"><?=htmlspecialchars(date("m/d/Y H:i:s", $dbent[4]));?></td> <td class="listr"><?=htmlspecialchars(date("m/d/Y H:i:s", $dbent[4]));?></td>
<td class="list"></td> <td class="list"></td>
</tr> </tr>
<?php endforeach; ?> <?php
endforeach; ?>
</table> </table>
</div> </div>
</form> </form>
...@@ -149,4 +160,4 @@ include("head.inc"); ...@@ -149,4 +160,4 @@ include("head.inc");
</div> </div>
</section> </section>
<?php include("foot.inc"); ?> <?php include("foot.inc");
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment