Commit 8473cb63 authored by Ad Schellevis's avatar Ad Schellevis

(legacy) cleanup some vars

parent 2ecd7bb8
......@@ -71,10 +71,6 @@ if (!is_array($config['ipsec']['phase2'])) {
$config['ipsec']['phase2'] = array();
}
$a_phase1 = &$config['ipsec']['phase1'];
$a_phase2 = &$config['ipsec']['phase2'];
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
// fetch data
if (isset($_GET['dup']) && is_numericint($_GET['dup'])) {
......@@ -91,12 +87,12 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
,encryption-algorithm,halgo,dhgroup,lifetime,authentication_method,descr,nat_traversal
,interface,iketype,dpd_delay,dpd_maxfail,remote-gateway,pre-shared-key,certref
,caref,reauth_enable,rekey_enable";
if (isset($p1index) && isset($a_phase1[$p1index])) {
if (isset($p1index) && isset($config['ipsec']['phase1'][$p1index])) {
// 1-on-1 copy
foreach (explode(",", $phase1_fields) as $fieldname) {
$fieldname = trim($fieldname);
if(isset($a_phase1[$p1index][$fieldname])) {
$pconfig[$fieldname] = $a_phase1[$p1index][$fieldname];
if(isset($config['ipsec']['phase1'][$p1index][$fieldname])) {
$pconfig[$fieldname] = $config['ipsec']['phase1'][$p1index][$fieldname];
} elseif (!isset($pconfig[$fieldname])) {
// initialize element
$pconfig[$fieldname] = null;
......@@ -106,19 +102,19 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
// attributes with some kind of logic behind them...
if (!isset($_GET['dup']) || !is_numericint($_GET['dup'])) {
// don't copy the ikeid on dup
$pconfig['ikeid'] = $a_phase1[$p1index]['ikeid'];
$pconfig['ikeid'] = $config['ipsec']['phase1'][$p1index]['ikeid'];
}
$pconfig['disabled'] = isset($a_phase1[$p1index]['disabled']);
$pconfig['disabled'] = isset($config['ipsec']['phase1'][$p1index]['disabled']);
$pconfig['remotebits'] = null;
$pconfig['remotenet'] = null ;
if (isset($a_phase1[$p1index]['remote-subnet']) && strpos($a_phase1[$p1index]['remote-subnet'],'/') !== false) {
list($pconfig['remotenet'],$pconfig['remotebits']) = explode("/", $a_phase1[$p1index]['remote-subnet']);
} elseif (isset($a_phase1[$p1index]['remote-subnet'])) {
$pconfig['remotenet'] = $a_phase1[$p1index]['remote-subnet'];
if (isset($a_phase1[$p1index]['remote-subnet']) && strpos($config['ipsec']['phase1'][$p1index]['remote-subnet'],'/') !== false) {
list($pconfig['remotenet'],$pconfig['remotebits']) = explode("/", $config['ipsec']['phase1'][$p1index]['remote-subnet']);
} elseif (isset($config['ipsec']['phase1'][$p1index]['remote-subnet'])) {
$pconfig['remotenet'] = $config['ipsec']['phase1'][$p1index]['remote-subnet'];
}
if (isset($a_phase1[$p1index]['mobile'])) {
if (isset($config['ipsec']['phase1'][$p1index]['mobile'])) {
$pconfig['mobile'] = true;
}
} else {
......@@ -153,6 +149,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
}
} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
$a_phase1 = &$config['ipsec']['phase1'];
if (isset($_POST['p1index']) && is_numericint($_POST['p1index'])) {
$p1index = $_POST['p1index'];
}
......@@ -241,8 +238,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
}
}
if (isset($a_phase2) && (count($a_phase2))) {
foreach ($a_phase2 as $phase2) {
if (count($config['ipsec']['phase2'])) {
foreach ($config['ipsec']['phase2'] as $phase2) {
if ($phase2['ikeid'] == $pconfig['ikeid']) {
if (($pconfig['protocol'] == "inet") && ($phase2['mode'] == "tunnel6")) {
$input_errors[] = gettext("There is a Phase 2 using IPv6, you cannot use IPv4.");
......
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