Commit 15eb3c56 authored by Franco Fichtner's avatar Franco Fichtner

gateways: more potential fails of legacy code vs. new config system

parent a35f277d
<?php
/*
Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2010 Seth Mos <seth.mos@dds.nl>.
......@@ -28,8 +29,13 @@
require_once("guiconfig.inc");
if (!is_array($config['gateways']['gateway_group']))
if (!is_array($config['gateways'])) {
$config['gateways'] = array();
}
if (!is_array($config['gateways']['gateway_group'])) {
$config['gateways']['gateway_group'] = array();
}
$a_gateway_groups = &$config['gateways']['gateway_group'];
$changedesc = gettext("Gateway Groups") . ": ";
......
......@@ -33,8 +33,17 @@ require_once("filter.inc");
require_once("shaper.inc");
require_once("openvpn.inc");
if (!is_array($config['gateways']['gateway_group']))
if (!is_array($config['gateways'])) {
$config['gateways'] = array();
}
if (!is_array($config['gateways']['gateway_item'])) {
$config['gateways']['gateway_item'] = array();
}
if (!is_array($config['gateways']['gateway_group'])) {
$config['gateways']['gateway_group'] = array();
}
$a_gateway_groups = &$config['gateways']['gateway_group'];
$a_gateways = &$config['gateways']['gateway_item'];
......
......@@ -32,8 +32,13 @@ require_once("vpn.inc");
$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/system_gateway_groups.php');
if (!is_array($config['gateways']['gateway_group']))
if (!is_array($config['gateways'])) {
$config['gateways'] = array();
}
if (!is_array($config['gateways']['gateway_group'])) {
$config['gateways']['gateway_group'] = array();
}
$a_gateway_groups = &$config['gateways']['gateway_group'];
$a_gateways = return_gateways_array();
......
......@@ -33,12 +33,18 @@ require_once("shaper.inc");
$a_gateways = return_gateways_array(true, false, true);
$a_gateways_arr = array();
foreach ($a_gateways as $gw)
foreach ($a_gateways as $gw) {
$a_gateways_arr[] = $gw;
}
$a_gateways = $a_gateways_arr;
if (!is_array($config['gateways']['gateway_item']))
if (!is_array($config['gateways'])) {
$config['gateways'] = array();
}
if (!is_array($config['gateways']['gateway_item'])) {
$config['gateways']['gateway_item'] = array();
}
$a_gateway_item = &$config['gateways']['gateway_item'];
......
......@@ -37,8 +37,13 @@ foreach($a_gateways as $gw) {
}
$a_gateways = $a_gateways_arr;
if (!is_array($config['gateways']['gateway_item']))
if (!is_array($config['gateways'])) {
$config['gateways'] = array();
}
if (!is_array($config['gateways']['gateway_item'])) {
$config['gateways']['gateway_item'] = array();
}
$a_gateway_item = &$config['gateways']['gateway_item'];
$apinger_default = return_apinger_defaults();
......
......@@ -579,8 +579,12 @@
$config['system']['hostname'] = $config['wizardtemp']['system']['hostname'];
$config['system']['domain'] = $config['wizardtemp']['system']['domain'];
if (!empty($config['wizardtemp']['wangateway'])) {
if (!is_array($config['gateways']['gateway_item']))
if (!is_array($config['gateways'])) {
$config['gateways'] = array();
}
if (!is_array($config['gateways']['gateway_item'])) {
$config['gateways']['gateway_item'] = array();
}
$found = false;
$defaultgw_found = false;
foreach ($config['gateways']['gateway_item'] as & $gw) {
......
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