summaryrefslogtreecommitdiffstats
path: root/usr/local/www/services_captiveportal_mac_edit.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_mac_edit.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_mac_edit.php')
-rwxr-xr-xusr/local/www/services_captiveportal_mac_edit.php34
1 files changed, 24 insertions, 10 deletions
diff --git a/usr/local/www/services_captiveportal_mac_edit.php b/usr/local/www/services_captiveportal_mac_edit.php
index 07f6d8c..9f590cb 100755
--- a/usr/local/www/services_captiveportal_mac_edit.php
+++ b/usr/local/www/services_captiveportal_mac_edit.php
@@ -43,9 +43,9 @@ function passthrumacscmp($a, $b) {
}
function passthrumacs_sort() {
- global $config;
+ global $config, $cpzone;
- usort($config['captiveportal']['passthrumac'],"passthrumacscmp");
+ usort($config['captiveportal'][$cpzone]['passthrumac'],"passthrumacscmp");
}
$statusurl = "status_captiveportal.php";
@@ -59,15 +59,27 @@ require("captiveportal.inc");
$pgtitle = array(gettext("Services"),gettext("Captive portal"),gettext("Edit pass-through MAC address"));
-if (!is_array($config['captiveportal']['passthrumac']))
- $config['captiveportal']['passthrumac'] = array();
+$cpzone = $_GET['zone'];
+if (isset($_POST['zone']))
+ $cpzone = $_POST['zone'];
-$a_passthrumacs = &$config['captiveportal']['passthrumac'];
+if (empty($cpzone)) {
+ header("Location: services_captiveportal_zones.php");
+ exit;
+}
+
+if (!is_array($config['captiveportal']))
+ $config['captiveportal'] = array();
+$a_cp =& $config['captiveportal'];
$id = $_GET['id'];
if (isset($_POST['id']))
$id = $_POST['id'];
+if (!is_array($a_cp[$cpzone]['passthrumac']))
+ $a_cp[$cpzone]['passthrumac'] = array();
+$a_passthrumacs = &$a_cp[$cpzone]['passthrumac'];
+
if (isset($id) && $a_passthrumacs[$id]) {
$pconfig['mac'] = $a_passthrumacs[$id]['mac'];
$pconfig['bw_up'] = $a_passthrumacs[$id]['bw_up'];
@@ -138,11 +150,12 @@ if ($_POST) {
}
$rules .= captiveportal_passthrumac_configure_entry($mac);
- file_put_contents("{$g['tmp_path']}/tmpmacedit{$id}", $rules);
- mwexec("/sbin/ipfw -q {$g['tmp_path']}/tmpmacedit{$id}");
- @unlink("{$g['tmp_path']}/tmpmacedit{$id}");
+ file_put_contents("{$g['tmp_path']}/{$cpzone}_tmpmacedit{$id}", $rules);
+ captiveportal_ipfw_set_context($cpzone);
+ mwexec("/sbin/ipfw -q {$g['tmp_path']}/{$cpzone}_tmpmacedit{$id}");
+ @unlink("{$g['tmp_path']}/{$cpzone}_tmpmacedit{$id}");
- header("Location: services_captiveportal_mac.php");
+ header("Location: services_captiveportal_mac.php?zone={$cpzone}");
exit;
}
}
@@ -156,7 +169,7 @@ include("head.inc");
<tr>
<td colspan="2" valign="top" class="listtopic"><?=gettext("Edit Pass-through MAC address");?></td>
</tr>
- <tr>
+ <tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("MAC address"); ?></td>
<td width="78%" class="vtable">
<?=$mandfldhtml;?><input name="mac" type="text" class="formfld unknown" id="mac" size="17" value="<?=htmlspecialchars($pconfig['mac']);?>">
@@ -186,6 +199,7 @@ include("head.inc");
<td width="22%" valign="top">&nbsp;</td>
<td width="78%">
<input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>">
+ <input name="zone" type="hidden" value="<?=htmlspecialchars($cpzone);?>">
<?php if (isset($id) && $a_passthrumacs[$id]): ?>
<input name="id" type="hidden" value="<?=htmlspecialchars($id);?>">
<?php endif; ?>
OpenPOWER on IntegriCloud