summaryrefslogtreecommitdiffstats
path: root/usr/local/www/services_captiveportal_hostname_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_hostname_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_hostname_edit.php')
-rwxr-xr-xusr/local/www/services_captiveportal_hostname_edit.php28
1 files changed, 21 insertions, 7 deletions
diff --git a/usr/local/www/services_captiveportal_hostname_edit.php b/usr/local/www/services_captiveportal_hostname_edit.php
index cc09459..f67ac6e 100755
--- a/usr/local/www/services_captiveportal_hostname_edit.php
+++ b/usr/local/www/services_captiveportal_hostname_edit.php
@@ -46,8 +46,8 @@ function allowedhostnamescmp($a, $b) {
}
function allowedhostnames_sort() {
- global $g, $config;
- usort($config['captiveportal']['allowedhostname'],"allowedhostname");
+ global $g, $config, $cpzone;
+ usort($config['captiveportal'][$cpzone]['allowedhostname'],"allowedhostname");
}
$statusurl = "status_captiveportal.php";
@@ -61,16 +61,29 @@ require("captiveportal.inc");
$pgtitle = array(gettext("Services"),gettext("Captive portal"),gettext("Edit allowed Hostname"));
-if (!is_array($config['captiveportal']['allowedhostname']))
- $config['captiveportal']['allowedhostname'] = array();
+$cpzone = $_GET['zone'];
+if (isset($_POST['zone']))
+ $cpzone = $_POST['zone'];
-$a_allowedhostnames = &$config['captiveportal']['allowedhostname'];
+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]['allowedhostname']))
+ $a_cp[$cpzone]['allowedhostname'] = array();
+$a_allowedhostnames = &$a_cp[$cpzone]['allowedhostname'];
+
if (isset($id) && $a_allowedhostnames[$id]) {
+ $pconfig['zone'] = $a_allowedhostnames[$id]['zone'];
$pconfig['hostname'] = $a_allowedhostnames[$id]['hostname'];
$pconfig['sn'] = $a_allowedhostnames[$id]['sn'];
$pconfig['dir'] = $a_allowedhostnames[$id]['dir'];
@@ -127,10 +140,10 @@ if ($_POST) {
write_config();
- if (isset($config['captiveportal']['enable']) && is_module_loaded("ipfw.ko"))
+ if (isset($a_cp[$cpzone]['enable']) && is_module_loaded("ipfw.ko"))
captiveportal_init_rules();
- header("Location: services_captiveportal_hostname.php");
+ header("Location: services_captiveportal_hostname.php?zone={$cpzone}");
exit;
}
}
@@ -188,6 +201,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_allowedhostnames[$id]): ?>
<input name="id" type="hidden" value="<?=htmlspecialchars($id);?>">
<?php endif; ?>
OpenPOWER on IntegriCloud