Ticket #4746 Correctly set global variables to be used by hostnames cod epaths

This commit is contained in:
Ermal LUÇI 2015-06-19 17:35:31 +02:00
parent 320ed23cef
commit 3378289af3
2 changed files with 6 additions and 4 deletions

View File

@ -1175,7 +1175,7 @@ function captiveportal_allowedip_configure_entry($ipent, $ishostname = false) {
}
function captiveportal_allowedhostname_configure() {
global $config, $g, $cpzone;
global $config, $g, $cpzone, $cpzoneid;
$rules = "";
if (is_array($config['captiveportal'][$cpzone]['allowedhostname'])) {
@ -1192,7 +1192,7 @@ function captiveportal_allowedhostname_configure() {
if (isvalidpid("{$g['varrun_path']}/filterdns-{$cpzone}-cpah.pid")) {
sigkillbypid("{$g['varrun_path']}/filterdns-{$cpzone}-cpah.pid", "HUP");
} else {
mwexec("/usr/local/sbin/filterdns -p {$g['varrun_path']}/filterdns-{$cpzone}-cpah.pid -i 300 -c {$cp_filterdns_filename} -y {$cpzone} -d 1");
mwexec("/usr/local/sbin/filterdns -p {$g['varrun_path']}/filterdns-{$cpzone}-cpah.pid -i 300 -c {$cp_filterdns_filename} -y {$cpzoneid} -d 1");
}
} else {
killbypid("{$g['varrun_path']}/filterdns-{$cpzone}-cpah.pid");

View File

@ -57,6 +57,8 @@ require_once("filter.inc");
require("shaper.inc");
require("captiveportal.inc");
global $cpzone, $cpzoneid;
$pgtitle = array(gettext("Services"), gettext("Captive portal"), gettext("Edit allowed Hostname"));
$shortcut_section = "captiveportal";
@ -64,6 +66,7 @@ $cpzone = $_GET['zone'];
if (isset($_POST['zone'])) {
$cpzone = $_POST['zone'];
}
$cpzoneid = $config['captiveportal'][$cpzone]['zoneid'];
if (empty($cpzone) || empty($config['captiveportal'][$cpzone])) {
header("Location: services_captiveportal_zones.php");
@ -154,8 +157,7 @@ if ($_POST) {
$rules = captiveportal_allowedhostname_configure();
@file_put_contents("{$g['tmp_path']}/hostname_rules", $rules);
$cpzoneid = $a_cp[$cpzone]['zoneid'];
mwexec("/sbin/ipfw -x {$cpzoneid} {$g['tmp_path']}/hostname_rules");
mwexec("/sbin/ipfw -x {$cpzoneid} {$g['tmp_path']}/hostname_rules", true);
unset($rules);
header("Location: services_captiveportal_hostname.php?zone={$cpzone}");