summaryrefslogtreecommitdiffstats
path: root/usr/local/www/services_captiveportal_hostname.php
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2011-09-07 06:42:58 +0000
committerErmal <eri@pfsense.org>2011-09-07 13:04:01 +0000
commitb4792bf8fe3b1cef416c7135fea88c1a0b08800a (patch)
treed32a5fb188939e28cd42c92aa9b4cf6729ff4947 /usr/local/www/services_captiveportal_hostname.php
parent9b55203f878786a2bbd0b7d5dda4474d2533695b (diff)
downloadpfsense-b4792bf8fe3b1cef416c7135fea88c1a0b08800a.zip
pfsense-b4792bf8fe3b1cef416c7135fea88c1a0b08800a.tar.gz
Add the multi instance CP to master branch. This allows to define CP with different properties on different interfaces.
Diffstat (limited to 'usr/local/www/services_captiveportal_hostname.php')
-rwxr-xr-xusr/local/www/services_captiveportal_hostname.php58
1 files changed, 35 insertions, 23 deletions
diff --git a/usr/local/www/services_captiveportal_hostname.php b/usr/local/www/services_captiveportal_hostname.php
index 3668a35..3955da8 100755
--- a/usr/local/www/services_captiveportal_hostname.php
+++ b/usr/local/www/services_captiveportal_hostname.php
@@ -50,22 +50,32 @@ require("filter.inc");
require("shaper.inc");
require("captiveportal.inc");
-$pgtitle = array(gettext("Services"),gettext("Captive portal"));
+$cpzone = $_GET['zone'];
+if (isset($_POST['zone']))
+ $cpzone = $_POST['zone'];
-if (!is_array($config['captiveportal']['allowedhostname']))
- $config['captiveportal']['allowedhostname'] = array();
+if (empty($cpzone)) {
+ header("Location: services_captiveportal_zones.php");
+ exit;
+}
+
+if (!is_array($config['captiveportal']))
+ $config['captiveportal'] = array();
+$a_cp =& $config['captiveportal'];
-$a_allowedhostnames = &$config['captiveportal']['allowedhostname'] ;
+$pgtitle = array(gettext("Services"),gettext("Captive portal"), $a_cp[$cpzone]['zone']);
-if ($_GET['act'] == "del") {
- if ($a_allowedhostnames[$_GET['id']]) {
+if ($_GET['act'] == "del" && !empty($cpzone)) {
+ $a_allowedhostnames =& $a_cp[$cpzone]['allowedhostname'];
+ if ($allowedhostnames[$_GET['id']]) {
$ipent = $a_allowedhostnames[$_GET['id']];
- if (isset($config['captiveportal']['enable'])) {
+ if (isset($a_cp[$cpzone]['enable'])) {
if (!empty($ipent['sn']))
$ipent['ip'] .= "/{$ipent['sn']}";
$ip = gethostbyname($ipent['ip']);
if(is_ipaddr($ip)) {
+ captiveportal_ipfw_set_context($zone);
mwexec("/sbin/ipfw table 3 delete {$ip}");
mwexec("/sbin/ipfw table 4 delete {$ip}");
mwexec("/sbin/ipfw table 5 delete {$ip}");
@@ -79,7 +89,7 @@ if ($_GET['act'] == "del") {
unset($a_allowedhostnames[$_GET['id']]);
write_config();
- header("Location: services_captiveportal_hostname.php");
+ header("Location: services_captiveportal_hostname.php?zone={$cpzone}");
exit;
}
}
@@ -90,17 +100,18 @@ include("head.inc");
<?php include("fbegin.inc"); ?>
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
<form action="services_captiveportal_hostname.php" method="post">
+<input type="hidden" name="zone" id="zone" value="<?=$cpzone;?>" />
<?php if ($savemsg) print_info_box($savemsg); ?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td class="tabnavtbl">
<?php
$tab_array = array();
- $tab_array[] = array(gettext("Captive portal"), false, "services_captiveportal.php");
- $tab_array[] = array(gettext("Pass-through MAC"), false, "services_captiveportal_mac.php");
- $tab_array[] = array(gettext("Allowed IP Addresses"), false, "services_captiveportal_ip.php");
- $tab_array[] = array(gettext("Allowed Hostnames"), true, "services_captiveportal_hostname.php");
- $tab_array[] = array(gettext("Vouchers"), false, "services_captiveportal_vouchers.php");
- $tab_array[] = array(gettext("File Manager"), false, "services_captiveportal_filemanager.php");
+ $tab_array[] = array(gettext("Captive portal"), false, "services_captiveportal.php?zone={$cpzone}");
+ $tab_array[] = array(gettext("Pass-through MAC"), false, "services_captiveportal_mac.php?zone={$cpzone}");
+ $tab_array[] = array(gettext("Allowed IP Addresses"), false, "services_captiveportal_ip.php?zone={$cpzone}");
+ $tab_array[] = array(gettext("Allowed Hostnames"), true, "services_captiveportal_hostname.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}");
display_top_tabs($tab_array, true);
?>
</td></tr>
@@ -108,19 +119,20 @@ include("head.inc");
<td class="tabcont">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
- <td width="30%" class="listhdrr"><?=gettext("Hostname"); ?></td>
- <td width="60%" class="listhdr"><?=gettext("Description"); ?></td>
+ <td width="60%" class="listhdrr"><?=gettext("Hostname"); ?></td>
+ <td width="40%" class="listhdr"><?=gettext("Description"); ?></td>
<td width="10%" class="list">
<table border="0" cellspacing="0" cellpadding="1">
<tr>
<td width="17" heigth="17"></td>
- <td><a href="services_captiveportal_hostname_edit.php"><img src="/themes/<?php echo $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add address"); ?>" width="17" height="17" border="0"></a></td>
+ <td><a href="services_captiveportal_hostname_edit.php?zone=<?=$cpzone;?>"><img src="/themes/<?php echo $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add address"); ?>" width="17" height="17" border="0"></a></td>
</tr>
</table>
</td>
</tr>
- <?php $i = 0; foreach ($a_allowedhostnames as $ip): ?>
- <tr ondblclick="document.location='services_captiveportal_hostname_edit.php?id=<?=$i;?>'">
+<?php if (is_array($a_cp[$cpzone]['allowedhostname'])):
+ $i = 0; foreach ($a_cp[$cpzone]['allowedhostname'] as $ip): ?>
+ <tr ondblclick="document.location='services_captiveportal_hostname_edit.php?zone=<?=$cpzone;?>&id=<?=$i;?>'">
<td class="listlr">
<?php
if($ip['dir'] == "to") {
@@ -139,17 +151,17 @@ include("head.inc");
<td class="listbg">
<?=htmlspecialchars($ip['descr']);?>&nbsp;
</td>
- <td valign="middle" nowrap class="list"> <a href="services_captiveportal_hostname_edit.php?id=<?=$i;?>"><img src="/themes/<?php echo $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit address"); ?>" width="17" height="17" border="0"></a>
- &nbsp;<a href="services_captiveportal_hostname.php?act=del&id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this address?"); ?>')"><img src="/themes/<?php echo $g['theme']; ?>/images/icons/icon_x.gif" title="<?=gettext("delete address"); ?>" width="17" height="17" border="0"></a></td>
+ <td valign="middle" nowrap class="list"> <a href="services_captiveportal_hostname_edit.php?zone=<?=$cpzone;?>&id=<?=$i;?>"><img src="/themes/<?php echo $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit address"); ?>" width="17" height="17" border="0"></a>
+ &nbsp;<a href="services_captiveportal_hostname.php?zone=<?=$cpzone;?>&act=del&id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this address?"); ?>')"><img src="/themes/<?php echo $g['theme']; ?>/images/icons/icon_x.gif" title="<?=gettext("delete address"); ?>" width="17" height="17" border="0"></a></td>
</tr>
- <?php $i++; endforeach; ?>
+ <?php $i++; endforeach; endif; ?>
<tr>
<td class="list" colspan="2">&nbsp;</td>
<td class="list">
<table border="0" cellspacing="0" cellpadding="1">
<tr>
<td width="17" heigth="17"></td>
- <td><a href="services_captiveportal_hostname_edit.php"><img src="/themes/<?php echo $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add address"); ?>" width="17" height="17" border="0"></a></td>
+ <td><a href="services_captiveportal_hostname_edit.php?zone=<?=$cpzone;?>"><img src="/themes/<?php echo $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add address"); ?>" width="17" height="17" border="0"></a></td>
</tr>
</table>
</td>
OpenPOWER on IntegriCloud