Project

General

Profile

Bug #9121 ยป php-array-refs.diff

Jim Pingle, 11/15/2018 10:04 AM

View differences:

src/etc/inc/auth.inc
829 829
		if ($groupname == '' || in_array($groupname, $cur_groups)) {
830 830
			continue;
831 831
		}
832
		$group = & $config['system']['group'][$groupindex[$groupname]];
832
		$group = &$config['system']['group'][$groupindex[$groupname]];
833 833
		$group['member'][] = $user['uid'];
834 834
		$mod_groups[] = $group;
835 835

  
......
851 851
		if (!isset($config['system']['group'][$groupindex[$groupname]])) {
852 852
			continue;
853 853
		}
854
		$group = & $config['system']['group'][$groupindex[$groupname]];
854
		$group = &$config['system']['group'][$groupindex[$groupname]];
855 855
		if (is_array($group['member'])) {
856 856
			$index = array_search($user['uid'], $group['member']);
857 857
			array_splice($group['member'], $index, 1);
src/etc/inc/easyrule.inc
98 98
		return true;
99 99
	}
100 100

  
101
	/* No rules, start a new array */
102
	if (!is_array($config['filter']['rule'])) {
103
		$config['filter']['rule'] = array();
104
	}
105

  
106
	filter_rules_sort();
107 101
	init_config_arr(array('filter', 'rule'));
102
	filter_rules_sort();
108 103
	$a_filter = &$config['filter']['rule'];
109 104

  
110 105
	/* Make up a new rule */
......
160 155
		return false;
161 156
	}
162 157

  
163
	/* If there are no aliases, start an array */
164
	if (!is_array($config['aliases']['alias'])) {
165
		$config['aliases']['alias'] = array();
166
	}
167

  
168 158
	init_config_arr(array('aliases', 'alias'));
169 159
	$a_aliases = &$config['aliases']['alias'];
170 160

  
......
286 276
function easyrule_pass_rule_add($int, $proto, $srchost, $dsthost, $dstport, $ipproto) {
287 277
	global $config;
288 278

  
289
	/* No rules, start a new array */
290
	if (!is_array($config['filter']['rule'])) {
291
		$config['filter']['rule'] = array();
292
	}
293

  
294
	filter_rules_sort();
295 279
	init_config_arr(array('filter', 'rule'));
280
	filter_rules_sort();
296 281
	$a_filter = &$config['filter']['rule'];
297 282

  
298 283
	/* Make up a new rule */
src/etc/inc/filter.inc
212 212
			if (empty($a_gateways[$gateway['monitor']])) {
213 213
				continue;
214 214
			}
215
			$gwstatus =& $a_gateways[$gateway['monitor']];
215
			$gwstatus = &$a_gateways[$gateway['monitor']];
216 216
			if (strstr($gwstatus['status'], "down")) {
217 217
				$any_gateway_down = true;
218 218
				break;
......
1612 1612
	foreach (get_staticroutes(false, false, true) as $route) {
1613 1613
		$netip = explode("/", $route['network']);
1614 1614
		if (isset($GatewaysList[$route['gateway']])) {
1615
			$gateway =& $GatewaysList[$route['gateway']];
1615
			$gateway = &$GatewaysList[$route['gateway']];
1616 1616
			if (!interface_has_gateway($gateway['interface']) && is_private_ip($netip[0])) {
1617 1617
				$tonathosts[] = $route['network'];
1618 1618
				$descriptions[] = gettext("static route");
src/etc/inc/gwlb.inc
1972 1972
function save_gateway($gateway_settings, $realid = "") {
1973 1973
	global $config;
1974 1974

  
1975
	if (!is_array($config['gateways'])) {
1976
		$config['gateways'] = array();
1977
	}
1978
	if (!is_array($config['gateways']['gateway_item'])) {
1979
		$config['gateways']['gateway_item'] = array();
1980
	}
1975
	init_config_arr(array('gateways', 'gateway_item'));
1981 1976
	$a_gateway_item = &$config['gateways']['gateway_item'];
1982 1977
	$reloadif = "";
1983 1978
	$gateway = array();
src/etc/inc/interfaces.inc
1808 1808
		$config["virtualip_carp_maintenancemode"] = true;
1809 1809
		write_config(gettext("Enter CARP maintenance mode"));
1810 1810
	}
1811

  
1811
	init_config_arr(array('virtualip', 'vip'));
1812 1812
	$viparr = &$config['virtualip']['vip'];
1813 1813

  
1814 1814
	if (is_array($viparr)) {
......
5265 5265
	global $config;
5266 5266

  
5267 5267
	/* XXX: For speed reasons reference directly the interface array */
5268
	init_config_arr(array('interfaces'));
5268 5269
	$ifdescrs = &$config['interfaces'];
5269 5270
	//$ifdescrs = get_configured_interface_list(true);
5270 5271

  
src/etc/inc/interfaces_fast.inc
61 61

  
62 62
	$out = array();
63 63
	/* XXX: For speed reasons reference directly the interface array */
64
	init_config_arr(array('interfaces'));
64 65
	$ifdescrs = &$config['interfaces'];
65 66
	$iffriendlynames = array_keys($ifdescrs);
66 67
	$out = array_flip(get_real_interface_fast($iffriendlynames));
src/etc/inc/itemid.inc
48 48
	unset($array[$delete_index]);
49 49

  
50 50
	// Update the separators
51
	init_config_arr(array('filter', 'separator', strtolower($if)));
51 52
	$a_separators = &$config['filter']['separator'][strtolower($if)];
52 53
	// get rule index within interface
53 54
	$ridx = ifridx($if, $delete_index);
src/etc/inc/pfsense-utils.inc
807 807
function after_sync_bump_adv_skew() {
808 808
	global $config, $g;
809 809
	$processed_skew = 1;
810
	init_config_arr(array('virtualip', 'vip'));
810 811
	$a_vip = &$config['virtualip']['vip'];
811 812
	foreach ($a_vip as $vipent) {
812 813
		if ($vipent['advskew'] <> "") {
......
2704 2705
					$current[$tag . '_attr'] = $attributes_data;
2705 2706
				}
2706 2707
				$repeated_tag_index[$tag . '_' . $level] = 1;
2707
				$current = & $current[$tag];
2708
				$current = &$current[$tag];
2708 2709
			} else {
2709 2710
				if (isset ($current[$tag][0])) {
2710 2711
					$current[$tag][$repeated_tag_index[$tag . '_' . $level]] = $result;
......
2721 2722
					}
2722 2723
				}
2723 2724
				$last_item_index = $repeated_tag_index[$tag . '_' . $level] - 1;
2724
				$current = & $current[$tag][$last_item_index];
2725
				$current = &$current[$tag][$last_item_index];
2725 2726
			}
2726 2727
		} elseif ($type == "complete") {
2727 2728
			if (!isset ($current[$tag])) {
......
2756 2757
				}
2757 2758
			}
2758 2759
		} elseif ($type == 'close') {
2759
			$current = & $parent[$level -1];
2760
			$current = &$parent[$level -1];
2760 2761
		}
2761 2762
	}
2762 2763
	return ($xml_array);
src/etc/inc/pkg-utils.inc
668 668
		return;	 // No package belongs to the pkg_id passed to this function.
669 669
	}
670 670

  
671
	$package =& $config['installedpackages']['package'][$pkg_id];
671
	$package = &$config['installedpackages']['package'][$pkg_id];
672 672
	if (!file_exists("/usr/local/pkg/" . $package['configurationfile'])) {
673 673
		log_error(sprintf(gettext("The %s package is missing its configuration file and must be reinstalled."), $package['name']));
674 674
		delete_package_xml($package['name']);
......
950 950
	pkg_debug(sprintf(gettext("Removing %s package... "), $package_name));
951 951
	update_status(sprintf(gettext("Removing %s components..."), $package_name) . "\n");
952 952
	/* parse package configuration */
953
	init_config_arr(array('installedpackages', 'package'));
953
	init_config_arr(array('installedpackages', 'package', $pkgid));
954 954
	$packages = &$config['installedpackages']['package'];
955
	$pkg_info = &$packages[$pkgid];
955 956
	init_config_arr(array('installedpackages', 'menu'));
956 957
	$menus = &$config['installedpackages']['menu'];
957 958
	init_config_arr(array('installedpackages', 'service'));
958 959
	$services = &$config['installedpackages']['service'];
959
	init_config_arr(array('installedpackages', 'package', $pkgid));
960
	$pkg_info = &$packages[$pkgid];
961 960
	if (file_exists("/usr/local/pkg/" . $pkg_info['configurationfile'])) {
962 961
		$pkg_config = parse_xml_config_pkg("/usr/local/pkg/" . $packages[$pkgid]['configurationfile'], "packagegui");
963 962
		/* remove menu items */
src/etc/inc/priv.inc
214 214
	}
215 215

  
216 216
	foreach ($entry['priv'] as $pname) {
217
		if (strncmp($pname, "page-", 5)) {
218
			continue;
219
		}
220
		$priv = &$priv_list[$pname];
221
		if (!is_array($priv)) {
222
			continue;
223
		}
224
		$matches = &$priv['match'];
225
		if (!is_array($matches)) {
217
		if (strncmp($pname, "page-", 5) ||
218
		    !is_array($priv_list[$pname]) ||
219
		    !is_array($priv_list[$pname]['match'])) {
226 220
			continue;
227 221
		}
228
		foreach ($matches as $match) {
222
		foreach ($priv_list[$pname]['match'] as $match) {
229 223
			$allowed_pages[] = $match;
230 224
		}
231 225
	}
src/etc/inc/service-utils.inc
52 52
	$towrite .= "\t{$params['start']}\n";
53 53
	$towrite .= "}\n\n";
54 54
	if (!empty($params['stop'])) {
55
		$tokill =& $params['stop'];
55
		$tokill = &$params['stop'];
56 56
	} else if (!empty($params['executable'])) {
57 57
		/* just nuke the executable */
58 58
		$tokill = "/usr/bin/killall " . escapeshellarg($params['executable']);
......
92 92
				if ($service['rcfile']) {
93 93
					$prefix = RCFILEPREFIX;
94 94
					if (!empty($service['prefix'])) {
95
						$prefix =& $service['prefix'];
95
						$prefix = &$service['prefix'];
96 96
					}
97 97
					if (file_exists("{$prefix}{$service['rcfile']}") || is_link("{$prefix}{$service['rcfile']}")) {
98 98
						mwexec_bg("{$prefix}{$service['rcfile']} start");
......
120 120
				if ($service['rcfile']) {
121 121
					$prefix = RCFILEPREFIX;
122 122
					if (!empty($service['prefix'])) {
123
						$prefix =& $service['prefix'];
123
						$prefix = &$service['prefix'];
124 124
					}
125 125
					if (file_exists("{$prefix}{$service['rcfile']}") || is_link("{$prefix}{$service['rcfile']}")) {
126 126
						mwexec("{$prefix}{$service['rcfile']} stop");
src/etc/inc/services.inc
1726 1726
	/* kill any running dhcrelay */
1727 1727
	killbypid("{$g['varrun_path']}/dhcrelay.pid");
1728 1728

  
1729
	$dhcrelaycfg =& $config['dhcrelay'];
1729
	init_config_arr(array('dhcrelay'));
1730
	$dhcrelaycfg = &$config['dhcrelay'];
1730 1731

  
1731 1732
	/* DHCPRelay enabled on any interfaces? */
1732 1733
	if (!isset($dhcrelaycfg['enable'])) {
......
1801 1802
	/* kill any running dhcrelay */
1802 1803
	killbypid("{$g['varrun_path']}/dhcrelay6.pid");
1803 1804

  
1804
	$dhcrelaycfg =& $config['dhcrelay6'];
1805
	init_config_arr(array('dhcrelay6'));
1806
	$dhcrelaycfg = &$config['dhcrelay6'];
1805 1807

  
1806 1808
	/* DHCPv6 Relay enabled on any interfaces? */
1807 1809
	if (!isset($dhcrelaycfg['enable'])) {
......
2731 2733
	$crontab_contents = file("/etc/crontab", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
2732 2734

  
2733 2735
	for ($i = 0; $i < count($crontab_contents); $i++) {
2734
		$cron_item =& $crontab_contents[$i];
2736
		$cron_item = &$crontab_contents[$i];
2735 2737
		if (strpos($cron_item, "# pfSense specific crontab entries") !== false) {
2736 2738
			array_splice($crontab_contents, $i - 1);
2737 2739
			break;
src/etc/inc/shaper.inc
308 308
function &get_reference_to_me_in_config(&$mypath) {
309 309
	global $config;
310 310

  
311
	$ptr =& $config['shaper'];
311
	init_config_arr(array('shaper'));
312
	$ptr = &$config['shaper'];
312 313
	foreach ($mypath as $indeks) {
313 314
		if (!is_array($ptr)) {
314 315
			$ptr = array();
......
319 320
		if (!is_array($ptr['queue'][$indeks])) {
320 321
			$ptr['queue'][$indeks] = array();
321 322
		}
322
		$ptr =& $ptr['queue'][$indeks];
323
		$ptr = &$ptr['queue'][$indeks];
323 324
	}
324 325

  
325 326
	return $ptr;
......
328 329
function unset_object_by_reference(&$mypath) {
329 330
	global $config;
330 331

  
331
	$ptr =& $config['shaper'];
332
	init_config_arr(array('shaper'));
333
	$ptr = &$config['shaper'];
332 334
	for ($i = 0; $i < count($mypath) - 1; $i++) {
333
		$ptr =& $ptr['queue'][$mypath[$i]];
335
		$ptr = &$ptr['queue'][$mypath[$i]];
334 336
	}
335 337
	unset($ptr['queue'][$mypath[$i]]);
336 338
}
......
338 340
function &get_dn_reference_to_me_in_config(&$mypath) {
339 341
	global $config;
340 342

  
341
	$ptr =& $config['dnshaper'];
343
	init_config_arr(array('dnshaper'));
344
	$ptr = &$config['dnshaper'];
342 345
	foreach ($mypath as $indeks) {
343
		$ptr =& $ptr['queue'][$indeks];
346
		$ptr = &$ptr['queue'][$indeks];
344 347
	}
345 348

  
346 349
	return $ptr;
......
349 352
function unset_dn_object_by_reference(&$mypath) {
350 353
	global $config;
351 354

  
352
	$ptr =& $config['dnshaper'];
355
	init_config_arr(array('dnshaper'));
356
	$ptr = &$config['dnshaper'];
353 357
	for ($i = 0; $i < count($mypath) - 1; $i++) {
354
		$ptr =& $ptr['queue'][$mypath[$i]];
358
		$ptr = &$ptr['queue'][$mypath[$i]];
355 359
	}
356 360
	unset($ptr['queue'][$mypath[$i]]);
357 361
}
......
522 526
	global $altq_list_queues;
523 527

  
524 528
	$int = $object->GetInterface();
525
	$altq =& $altq_list_queues[$int];
526
	if ($altq) {
529
	if (isset($altq_list_queues[$int])) {
530
		$altq = &$altq_list_queues[$int];
527 531
		$bw_3 = $altq->GetBandwidth();
528 532
		$bw_3 = $bw_3 * get_bandwidthtype_scale($altq->GetBwscale());
529 533
		return floatval($bw_3);
......
5014 5018
	global $altq_list_queues, $config;
5015 5019
	$path = array();
5016 5020

  
5017
	if (!is_array($config['shaper'])) {
5018
		$config['shaper'] = array();
5019
	}
5020
	if (!is_array($config['shaper']['queue'])) {
5021
		$config['shaper']['queue'] = array();
5022
	}
5021
	init_config_arr(array('shaper', 'queue'));
5023 5022
	$a_int = &$config['shaper']['queue'];
5024 5023

  
5025 5024
	$altq_list_queues = array();
......
5055 5054
	global $dummynet_pipe_list, $config;
5056 5055
	$path = array();
5057 5056

  
5058
	if (!is_array($config['dnshaper'])) {
5059
		$config['dnshaper'] = array();
5060
	}
5061
	if (!is_array($config['dnshaper']['queue'])) {
5062
		$config['dnshaper']['queue'] = array();
5063
	}
5057
	init_config_arr(array('dnshaper', 'queue'));
5064 5058
	$a_int = &$config['dnshaper']['queue'];
5065 5059

  
5066 5060
	$dummynet_pipe_list = array();
5067 5061

  
5068
	if (!is_array($config['dnshaper']['queue']) ||
5069
	    !count($config['dnshaper']['queue'])) {
5062
	if (!count($config['dnshaper']['queue'])) {
5070 5063
		return;
5071 5064
	}
5072 5065

  
src/etc/inc/system.inc
1190 1190
function system_webgui_create_certificate() {
1191 1191
	global $config, $g;
1192 1192

  
1193
	if (!is_array($config['ca'])) {
1194
		$config['ca'] = array();
1195
	}
1196
	$a_ca =& $config['ca'];
1197
	if (!is_array($config['cert'])) {
1198
		$config['cert'] = array();
1199
	}
1200
	$a_cert =& $config['cert'];
1193
	init_config_arr(array('ca'));
1194
	$a_ca = &$config['ca'];
1195
	init_config_arr(array('cert'));
1196
	$a_cert = &$config['cert'];
1201 1197
	log_error(gettext("Creating SSL Certificate for this host"));
1202 1198

  
1203 1199
	$cert = array();
src/etc/inc/upgrade_config.inc
89 89
	}
90 90

  
91 91
	/* convert filter rules */
92
	init_config_arr(array('filter', 'rule'));
92 93
	$n = count($config['filter']['rule']);
93 94
	for ($i = 0; $i < $n; $i++) {
94 95

  
......
133 134
	}
134 135

  
135 136
	/* convert shaper rules */
137
	init_config_arr(array('pfqueueing', 'rule'));
136 138
	$n = count($config['pfqueueing']['rule']);
137 139
	if (is_array($config['pfqueueing']['rule'])) {
138 140
		for ($i = 0; $i < $n; $i++) {
......
215 217
	global $config;
216 218
	/* convert shaper rules (make pipes) */
217 219
	if (is_array($config['pfqueueing']['rule'])) {
220
		init_config_arr(array('pfqueueing', 'pipe'));
218 221
		$config['pfqueueing']['pipe'] = array();
219 222

  
220 223
		for ($i = 0; isset($config['pfqueueing']['rule'][$i]); $i++) {
......
514 517

  
515 518
function upgrade_028_to_029() {
516 519
	global $config;
517
	$rule_item = array();
520
	init_config_arr(array('filter', 'rule'));
518 521
	$a_filter = &$config['filter']['rule'];
522
	$rule_item = array();
519 523
	$rule_item['interface'] = "enc0";
520 524
	$rule_item['type'] = "pass";
521 525
	$rule_item['source']['any'] = true;
......
901 905
	/* Upgrade load balancer from slb to relayd */
902 906
	if (is_array($config['load_balancer']['virtual_server']) && count($config['load_balancer']['virtual_server'])) {
903 907
		$vs_a = &$config['load_balancer']['virtual_server'];
908
		init_config_arr(array('load_balancer', 'lbpool'));
904 909
		$pool_a = &$config['load_balancer']['lbpool'];
905 910
		$pools = array();
906 911
		/* Index pools by name */
......
1970 1975
		$gateway_group_arr = array();
1971 1976
		$gateways = return_gateways_array();
1972 1977
		$group_name_changes = array();
1973
		if (!is_array($config['gateways']['gateway_item'])) {
1974
			$config['gateways']['gateway_item'] = array();
1975
		}
1976

  
1977
		$a_gateways =& $config['gateways']['gateway_item'];
1978
		init_config_arr(array('gateways', 'gateway_item'));
1979
		$a_gateways = &$config['gateways']['gateway_item'];
1978 1980
		foreach ($lbpool_arr as $lbpool) {
1979 1981
			if ($lbpool['type'] == "gateway") {
1980 1982
				// Gateway Groups have to have valid names in pf, old lb pools did not. Clean them up.
......
2406 2408
function upgrade_063_to_064() {
2407 2409
	global $config;
2408 2410
	$j = 0;
2411
	init_config_arr(array('ppps', 'ppp'));
2412
	init_config_arr(array('interfaces'));
2409 2413
	$ifcfg = &$config['interfaces'];
2410 2414

  
2411
	if (is_array($config['ppps']['ppp']) && count($config['ppps']['ppp'])) {
2415
	if (count($config['ppps']['ppp'])) {
2412 2416
		foreach ($config['ppps']['ppp'] as $pppid => $ppp) {
2413 2417
			$config['ppps']['ppp'][$pppid]['if'] = "ppp".$j;
2414 2418
			$config['ppps']['ppp'][$pppid]['ptpid'] = $j;
......
2426 2430
		}
2427 2431
	}
2428 2432

  
2429
	if (!is_array($config['ppps']['ppp'])) {
2430
		$config['ppps']['ppp'] = array();
2431
	}
2432 2433
	$a_ppps = &$config['ppps']['ppp'];
2433 2434

  
2434 2435
	foreach ($ifcfg as $ifname => $ifinfo) {
......
2514 2515
function upgrade_065_to_066() {
2515 2516
	global $config;
2516 2517

  
2517
	$dhcrelaycfg =& $config['dhcrelay'];
2518
	init_config_arr(array('dhcrelay'));
2519
	$dhcrelaycfg = &$config['dhcrelay'];
2518 2520

  
2519 2521
	if (is_array($dhcrelaycfg)) {
2520 2522
		$dhcrelayifs = array();
......
3179 3181
function upgrade_091_to_092() {
3180 3182
	global $config;
3181 3183

  
3182
	if (is_array($config['nat']['advancedoutbound']) && is_array($config['nat']['advancedoutbound']['rule'])) {
3184
	if (is_array($config['nat']['advancedoutbound']['rule'])) {
3183 3185
		$nat_rules = &$config['nat']['advancedoutbound']['rule'];
3184 3186
		for ($i = 0; isset($nat_rules[$i]); $i++) {
3185 3187
			if (empty($nat_rules[$i]['interface'])) {
......
3742 3744
		unset($config['system']['cert']);
3743 3745
	}
3744 3746

  
3745
	if (!isset($config['ipsec']['phase1'])) {
3746
		return;
3747
	}
3748

  
3749
	$a_phase1 =& $config['ipsec']['phase1'];
3747
	init_config_arr(array('ipsec', 'phase1'));
3748
	$a_phase1 = &$config['ipsec']['phase1'];
3750 3749

  
3751 3750
	foreach ($a_phase1 as &$ph1_entry) {
3752 3751
		// update asn1dn strings from racoon's format to strongswan's
......
3769 3768
	}
3770 3769

  
3771 3770
	// change peerid_type to 'any' for EAP types to retain previous behavior of omitting rightid
3772
	$a_phase1 =& $config['ipsec']['phase1'];
3771
	init_config_arr(array('ipsec', 'phase1'));
3772
	$a_phase1 = &$config['ipsec']['phase1'];
3773 3773

  
3774 3774
	foreach ($a_phase1 as &$ph1_entry) {
3775 3775
		if (strstr($ph1_entry['authentication_method'], 'eap')) {
......
3803 3803
		return;
3804 3804
	}
3805 3805

  
3806
	$miniupnpd =& $config['installedpackages']['miniupnpd']['config'][0];
3806
	$miniupnpd = &$config['installedpackages']['miniupnpd']['config'][0];
3807 3807

  
3808 3808
	$miniupnpd['row'] = array();
3809 3809

  
......
3834 3834

  
3835 3835
	// Cleanup firewall rules
3836 3836
	if (isset($config['filter']['rule']) && is_array($config['filter']['rule'])) {
3837
		$rules =& $config['filter']['rule'];
3837
		$rules = &$config['filter']['rule'];
3838 3838
		$last_rule = count($rules) - 1;
3839 3839
		// Process in reverse order to be able to unset items
3840 3840
		for ($i = $last_rule; $i >= 0; $i--) {
......
3855 3855

  
3856 3856
	// Cleanup 1:1 NAT rules
3857 3857
	if (isset($config['nat']['onetoone']) && is_array($config['nat']['onetoone'])) {
3858
		$onetoone =& $config['nat']['onetoone'];
3858
		$onetoone = &$config['nat']['onetoone'];
3859 3859
		$last_rule = count($onetoone) - 1;
3860 3860
		// Process in reverse order to be able to unset items
3861 3861
		for ($i = $last_rule; $i >= 0; $i--) {
......
3876 3876

  
3877 3877
	// Cleanup npt NAT rules
3878 3878
	if (isset($config['nat']['npt']) && is_array($config['nat']['npt'])) {
3879
		$npt =& $config['nat']['npt'];
3879
		$npt = &$config['nat']['npt'];
3880 3880
		$last_rule = count($npt) - 1;
3881 3881
		// Process in reverse order to be able to unset items
3882 3882
		for ($i = $last_rule; $i >= 0; $i--) {
......
3889 3889

  
3890 3890
	// Cleanup Port-forward NAT rules
3891 3891
	if (isset($config['nat']['rule']) && is_array($config['nat']['rule'])) {
3892
		$nat_rules =& $config['nat']['rule'];
3892
		$nat_rules = &$config['nat']['rule'];
3893 3893
		$last_rule = count($nat_rules) - 1;
3894 3894
		// Process in reverse order to be able to unset items
3895 3895
		for ($i = $last_rule; $i >= 0; $i--) {
......
3910 3910

  
3911 3911
	// Cleanup Port-forward NAT rules
3912 3912
	if (isset($config['nat']['outbound']['rule']) && is_array($config['nat']['outbound']['rule'])) {
3913
		$out_rules =& $config['nat']['outbound']['rule'];
3913
		$out_rules = &$config['nat']['outbound']['rule'];
3914 3914
		$last_rule = count($out_rules) - 1;
3915 3915
		// Process in reverse order to be able to unset items
3916 3916
		for ($i = $last_rule; $i >= 0; $i--) {
......
4378 4378
	global $config;
4379 4379
	/* Convert Namecheap type DynDNS entries to the new split hostname and domain format */
4380 4380

  
4381
	if (!is_array($config['dyndnses'])) {
4382
		$config['dyndnses'] = array();
4383
	}
4384
	if (!is_array($config['dyndnses']['dyndns'])) {
4385
		$config['dyndnses']['dyndns'] = array();
4386
	}
4381
	init_config_arr(array('dyndnses', 'dyndns'));
4387 4382
	$a_dyndns = &$config['dyndnses']['dyndns'];
4388 4383

  
4389 4384
	foreach ($a_dyndns as &$dyndns) {
......
4950 4945
	global $config;
4951 4946
	/* Convert Cloudflare and GratisDNS type DynDNS entries to the new split hostname and domain format */
4952 4947

  
4953
	if (!is_array($config['dyndnses'])) {
4954
		$config['dyndnses'] = array();
4955
	}
4956
	if (!is_array($config['dyndnses']['dyndns'])) {
4957
		$config['dyndnses']['dyndns'] = array();
4958
	}
4948
	init_config_arr(array('dyndnses', 'dyndns'));
4959 4949
	$a_dyndns = &$config['dyndnses']['dyndns'];
4960 4950

  
4961 4951
	foreach ($a_dyndns as &$dyndns) {
......
4983 4973
	global $config;
4984 4974
	/* Convert Dynamic DNS passwords to base64 encoding. Redmine #6688 */
4985 4975

  
4986
	if (!is_array($config['dyndnses'])) {
4987
		$config['dyndnses'] = array();
4988
	}
4989
	if (!is_array($config['dyndnses']['dyndns'])) {
4990
		$config['dyndnses']['dyndns'] = array();
4991
	}
4976
	init_config_arr(array('dyndnses', 'dyndns'));
4992 4977
	$a_dyndns = &$config['dyndnses']['dyndns'];
4993 4978

  
4994 4979
	foreach ($a_dyndns as &$dyndns) {
......
5490 5475
function upgrade_174_to_175() {
5491 5476
	global $config;
5492 5477
	init_config_arr(array('ipsec', 'phase1'));
5493
	if (is_array($config['ipsec']['phase1'])) {
5478
	if (count($config['ipsec']['phase1'])) {
5494 5479
		$a_phase1 = &$config['ipsec']['phase1'];
5495 5480
		foreach($a_phase1 as &$phase1) {
5496 5481
			if (empty($phase1)) {
......
5759 5744
	if (is_array($config['installedpackages']['autoconfigbackup']['config'][0])) {
5760 5745
		$acbpkg = &$config['installedpackages']['autoconfigbackup']['config'][0];
5761 5746

  
5762
		if (!is_array($config['system']['acb'])) {
5763
			$config['system']['acb'] = array();
5764
		}
5765

  
5747
		init_config_arr(array('system', 'acb'));
5766 5748
		$acb = &$config['system']['acb'];
5767 5749
		$acb['enable'] = ($acbpkg['enable_acb'] != 'disabled') ?  'yes':'no';
5768 5750
		$acb['gold_encryption_password'] = $acbpkg['crypto_password'];
src/etc/inc/util.inc
1268 1268
	global $config;
1269 1269

  
1270 1270
	$list = array();
1271
	if (!is_array($config['virtualip']['vip']) || empty($config['virtualip']['vip'])) {
1271
	if (!is_array($config['virtualip']) ||
1272
	    !is_array($config['virtualip']['vip']) ||
1273
	    empty($config['virtualip']['vip'])) {
1272 1274
		return ($list);
1273 1275
	}
1274 1276

  
......
1328 1330
function get_configured_vip_detail($vipinterface = '', $family = 'inet', $what = 'ip') {
1329 1331
	global $config;
1330 1332

  
1331
	if (empty($vipinterface) || !is_array($config['virtualip']['vip']) ||
1333
	if (empty($vipinterface) ||
1334
	    !is_array($config['virtualip']) ||
1335
	    !is_array($config['virtualip']['vip']) ||
1332 1336
	    empty($config['virtualip']['vip'])) {
1333 1337
		return (NULL);
1334 1338
	}
src/etc/phpshellsessions/disablecarp
25 25

  
26 26
set_single_sysctl("net.inet.carp.allow", "0");
27 27
if (is_array($config['virtualip']['vip'])) {
28
	init_config_arr(array('virtualip', 'vip'));
28 29
	$viparr = &$config['virtualip']['vip'];
29 30
	foreach ($viparr as $vip) {
30 31
		switch ($vip['mode']) {
src/etc/phpshellsessions/enablecarp
24 24
require_once("util.inc");
25 25

  
26 26
if (is_array($config['virtualip']['vip'])) {
27
	init_config_arr(array('virtualip', 'vip'));
27 28
	$viparr = &$config['virtualip']['vip'];
28 29
	foreach ($viparr as $vip) {
29 30
		switch ($vip['mode']) {
src/etc/rc.initial.setlanip
201 201

  
202 202
function add_gateway_to_config($interface, $gatewayip, $inet_type) {
203 203
	global $g, $config, $dry_run;
204
	if (!is_array($config['gateways']['gateway_item'])) {
205
		$config['gateways']['gateway_item'] = array();
206
	}
204
	init_config_arr(array('gateways', 'gateway_item'));
207 205
	$a_gateways = &$config['gateways']['gateway_item'];
208 206
	if ($dry_run) {
209 207
		print_r($a_gateways);
src/usr/local/www/diag_dns.php
31 31

  
32 32
$host = trim($_REQUEST['host'], " \t\n\r\0\x0B[];\"'");
33 33

  
34
/* If this section of config.xml has not been populated yet we need to set it up
35
*/
36
if (!is_array($config['aliases'])) {
37
	$config['aliases'] = array();
38
}
39

  
40
if (!is_array($config['aliases']['alias'])) {
41
	$config['aliases']['alias'] = array();
42
}
43

  
34
init_config_arr(array('aliases', 'alias'));
44 35
$a_aliases = &$config['aliases']['alias'];
45 36

  
46 37
$aliasname = substr(str_replace(array(".", "-"), "_", $host), 0, 31);
src/usr/local/www/firewall_aliases.php
35 35
require_once("filter.inc");
36 36
require_once("shaper.inc");
37 37

  
38
if (!is_array($config['aliases'])) {
39
	$config['aliases'] = array();
40
}
41

  
42
if (!is_array($config['aliases']['alias'])) {
43
	$config['aliases']['alias'] = array();
44
}
45

  
38
init_config_arr(array('aliases', 'alias'));
46 39
$a_aliases = &$config['aliases']['alias'];
47 40

  
48 41
$tab = ($_REQUEST['tab'] == "" ? "ip" : preg_replace("/\W/", "", $_REQUEST['tab']));
src/usr/local/www/firewall_aliases_edit.php
55 55
$pf_reserved_keywords = array_merge($pf_reserved_keywords, $reserved_ifs, $reserved_table_names);
56 56
$max_alias_addresses = 5000;
57 57

  
58
if (!is_array($config['aliases'])) {
59
	$config['aliases'] = array();
60
}
61

  
62
if (!is_array($config['aliases']['alias'])) {
63
	$config['aliases']['alias'] = array();
64
}
65

  
58
init_config_arr(array('aliases', 'alias'));
66 59
$a_aliases = &$config['aliases']['alias'];
67 60

  
68 61
// Debugging
src/usr/local/www/firewall_aliases_import.php
55 55
$pgtitle = array(gettext("Firewall"), gettext("Aliases"), gettext("Bulk import"));
56 56
$pglinks = array("", "firewall_aliases.php?tab=" . $tab, "@self");
57 57

  
58
if (!is_array($config['aliases'])) {
59
	$config['aliases'] = array();
60
}
61

  
62
if (!is_array($config['aliases']['alias'])) {
63
	$config['aliases']['alias'] = array();
64
}
58
init_config_arr(array('aliases', 'alias'));
65 59
$a_aliases = &$config['aliases']['alias'];
66 60

  
67 61
if ($_POST) {
src/usr/local/www/firewall_nat.php
39 39
init_config_arr(array('nat', 'separator'));
40 40
init_config_arr(array('nat', 'rule'));
41 41
$a_nat = &$config['nat']['rule'];
42
$a_separators = &$config['nat']['separator'];
42 43

  
43 44
/* update rule order, POST[rule] is an array of ordered IDs */
44 45
if (array_key_exists('order-store', $_REQUEST) && have_natpfruleint_access($natent['interface'])) {
......
107 108
		unset($a_nat[$_POST['id']]);
108 109

  
109 110
		// Update the separators
110
		$a_separators = &$config['nat']['separator'];
111 111
		$ridx = $_POST['id'];
112 112
		$mvnrows = -1;
113 113
		move_separators($a_separators, $ridx, $mvnrows);
......
128 128

  
129 129
	/* delete selected rules */
130 130
	if (is_array($_POST['rule']) && count($_POST['rule'])) {
131
		$a_separators = &$config['nat']['separator'];
132 131
		$num_deleted = 0;
133 132

  
134 133
		foreach ($_POST['rule'] as $rulei) {
src/usr/local/www/firewall_nat_edit.php
46 46
	$specialsrcdst[] = "{$kif}ip";
47 47
}
48 48

  
49
init_config_arr(array('filter', 'rule'));
49 50
init_config_arr(array('nat', 'separator'));
50 51
init_config_arr(array('nat', 'rule'));
51 52
$a_nat = &$config['nat']['rule'];
53
$a_separators = &$config['nat']['separator'];
52 54

  
53 55
if (isset($_REQUEST['id']) && is_numericint($_REQUEST['id'])) {
54 56
	$id = $_REQUEST['id'];
......
512 514
				array_splice($a_nat, $after+1, 0, array($natent));
513 515

  
514 516
				// Update the separators
515
				$a_separators = &$config['nat']['separator'];
516 517
				$ridx = $after;
517 518
				$mvnrows = +1;
518 519
				move_separators($a_separators, $ridx, $mvnrows);
src/usr/local/www/firewall_rules.php
108 108
	}
109 109
}
110 110

  
111
if (!is_array($config['filter'])) {
112
	$config['filter'] = array();
113
}
114

  
115
if (!is_array($config['filter']['rule'])) {
116
	$config['filter']['rule'] = array();
117
}
118

  
111
init_config_arr(array('filter', 'rule'));
119 112
filter_rules_sort();
120 113
$a_filter = &$config['filter']['rule'];
121 114

  
......
150 143
		unset($a_filter[$_POST['id']]);
151 144

  
152 145
		// Update the separators
146
		init_config_arr(array('filter', 'separator', strtolower($if)));
153 147
		$a_separators = &$config['filter']['separator'][strtolower($if)];
154 148
		$ridx = ifridx($if, $_POST['id']);	// get rule index within interface
155 149
		$mvnrows = -1;
......
174 168
	$deleted = false;
175 169

  
176 170
	if (is_array($_POST['rule']) && count($_POST['rule'])) {
171
		init_config_arr(array('filter', 'separator', strtolower($if)));
177 172
		$a_separators = &$config['filter']['separator'][strtolower($if)];
178 173
		$num_deleted = 0;
179 174

  
......
505 500
			pprint_port($filterent['destination']['port'])
506 501
		);
507 502

  
508
		if (!is_array($config['schedules'])) {
509
			$config['schedules'] = array();
510
		}
511

  
512
		if (!is_array($config['schedules']['schedule'])) {
513
			$config['schedules']['schedule'] = array();
514
		}
515 503
		//build Schedule popup box
504
		init_config_arr(array('schedules', 'schedule'));
516 505
		$a_schedules = &$config['schedules']['schedule'];
517 506
		$schedule_span_begin = "";
518 507
		$schedule_span_end = "";
src/usr/local/www/firewall_rules_edit.php
139 139
	$specialsrcdst[] = "{$kif}ip";
140 140
}
141 141

  
142
if (!is_array($config['filter']['rule'])) {
143
	$config['filter']['rule'] = array();
144
}
145

  
142
init_config_arr(array('filter', 'rule'));
146 143
filter_rules_sort();
147 144
$a_filter = &$config['filter']['rule'];
148 145

  
......
608 605
	}
609 606

  
610 607
	if ($_POST['proto'] == "icmp") {
611
		$t =& $_POST['icmptype'];
608
		$t = $_POST['icmptype'];
612 609
		if (isset($t) && !is_array($t)) {
613 610
			// shouldn't happen but avoids making assumptions for data-sanitising
614 611
			$input_errors[] = gettext("ICMP types expected to be a list if present, but is not.");
......
965 962
				$a_filter[$id] = $filterent;
966 963
			} else {							// rule moved to different interface
967 964
				// Update the separators of previous interface.
965
				init_config_arr(array('filter', 'separator', strtolower($if)));
968 966
				$a_separators = &$config['filter']['separator'][strtolower($if)];
969 967
				$ridx = ifridx($if, $id);		// get rule index within interface
970 968
				$mvnrows = -1;
......
973 971
				$a_filter[$id] = $filterent;	// save edited rule to new interface
974 972

  
975 973
				// Update the separators of new interface.
974
				init_config_arr(array('filter', 'separator', strtolower($tmpif)));
976 975
				$a_separators = &$config['filter']['separator'][strtolower($tmpif)];
977 976
				$ridx = ifridx($tmpif, $id);	// get rule index within interface
978 977
				if ($ridx == 0) {				// rule was placed at the top
......
1004 1003
				}
1005 1004

  
1006 1005
				// Update the separators
1006
				init_config_arr(array('filter', 'separator', strtolower($tmpif)));
1007 1007
				$a_separators = &$config['filter']['separator'][strtolower($tmpif)];
1008 1008
				$ridx = ifridx($tmpif, $after);	// get rule index within interface
1009 1009
				$mvnrows = +1;
src/usr/local/www/firewall_virtual_ip.php
36 36
require_once("filter.inc");
37 37
require_once("shaper.inc");
38 38

  
39
if (!is_array($config['virtualip'])) {
40
	$config['virtualip'] = array();
41
}
42

  
43
if (!is_array($config['virtualip']['vip'])) {
44
	$config['virtualip']['vip'] = array();
45
}
46

  
39
init_config_arr(array('virtualip', 'vip'));
47 40
$a_vip = &$config['virtualip']['vip'];
48 41

  
49 42
if ($_POST['apply']) {
src/usr/local/www/firewall_virtual_ip_edit.php
35 35
require_once("filter.inc");
36 36
require_once("shaper.inc");
37 37

  
38
if (!is_array($config['virtualip'])) {
39
		$config['virtualip'] = array();
40
}
41

  
42
if (!is_array($config['virtualip']['vip'])) {
43
		$config['virtualip']['vip'] = array();
44
}
45

  
38
init_config_arr(array('virtualip', 'vip'));
46 39
$a_vip = &$config['virtualip']['vip'];
47 40

  
48 41
if (isset($_REQUEST['id']) && is_numericint($_REQUEST['id'])) {
src/usr/local/www/interfaces.php
41 41
require_once("vpn.inc");
42 42
require_once("xmlparse_attr.inc");
43 43

  
44
function remove_bad_chars($string) {
45
	return preg_replace('/[^a-z_0-9]/i', '', $string);
46
}
47

  
44 48
define("ANTENNAS", false);
45 49

  
46 50
if (isset($_POST['referer'])) {
......
72 76
	$pconfig = array();
73 77
}
74 78

  
75
if (!is_array($config['ppps'])) {
76
	$config['ppps'] = array();
77
}
78
if (!is_array($config['ppps']['ppp'])) {
79
	$config['ppps']['ppp'] = array();
80
}
79
init_config_arr(array('ppps', 'ppp'));
81 80
$a_ppps = &$config['ppps']['ppp'];
82 81

  
83
function remove_bad_chars($string) {
84
	return preg_replace('/[^a-z_0-9]/i', '', $string);
85
}
86

  
87
if (!is_array($config['gateways'])) {
88
	$config['gateways'] = array();
89
}
90

  
91
if (!is_array($config['gateways']['gateway_item'])) {
92
	$config['gateways']['gateway_item'] = array();
93
}
94

  
82
init_config_arr(array('gateways', 'gateway_item'));
95 83
$a_gateways = &$config['gateways']['gateway_item'];
96 84

  
97 85
$interfaces = get_configured_interface_with_descr();
......
106 94
	}
107 95
}
108 96

  
97
init_config_arr(array('interfaces', $if));
109 98
$wancfg = &$config['interfaces'][$if];
110 99
$old_wancfg = $wancfg;
111 100
$old_wancfg['realif'] = get_real_interface($if);
src/usr/local/www/interfaces_bridge.php
28 28

  
29 29
require_once("guiconfig.inc");
30 30

  
31
if (!is_array($config['bridges'])) {
32
	$config['bridges'] = array();
33
}
34

  
35
if (!is_array($config['bridges']['bridged'])) {
36
	$config['bridges']['bridged'] = array();
37
}
38

  
39
$a_bridges = &$config['bridges']['bridged'] ;
31
init_config_arr(array('bridges', 'bridged'));
32
$a_bridges = &$config['bridges']['bridged'];
40 33

  
41 34
function bridge_inuse($num) {
42 35
	global $config, $a_bridges;
src/usr/local/www/interfaces_bridge_edit.php
28 28

  
29 29
require_once("guiconfig.inc");
30 30

  
31
if (!is_array($config['bridges'])) {
32
	$config['bridges'] = array();
33
}
34

  
35
if (!is_array($config['bridges']['bridged'])) {
36
	$config['bridges']['bridged'] = array();
37
}
38

  
39 31
function is_aoadv_used($pconfig) {
40 32
	if (($pconfig['static'] !="") ||
41 33
	    ($pconfig['private'] != "") ||
......
60 52
	return false;
61 53
}
62 54

  
55
init_config_arr(array('bridges', 'bridged'));
63 56
$a_bridges = &$config['bridges']['bridged'];
64 57

  
65 58
$ifacelist = get_configured_interface_with_descr();
src/usr/local/www/interfaces_gif.php
28 28

  
29 29
require_once("guiconfig.inc");
30 30

  
31
if (!is_array($config['gifs'])) {
32
	$config['gifs'] = array();
33
}
34
if (!is_array($config['gifs']['gif'])) {
35
	$config['gifs']['gif'] = array();
36
}
37

  
31
init_config_arr(array('gifs', 'gif'));
38 32
$a_gifs = &$config['gifs']['gif'] ;
39 33

  
40 34
function gif_inuse($num) {
src/usr/local/www/interfaces_gif_edit.php
28 28

  
29 29
require_once("guiconfig.inc");
30 30

  
31
if (!is_array($config['gifs'])) {
32
	$config['gifs'] = array();
33
}
34
if (!is_array($config['gifs']['gif'])) {
35
	$config['gifs']['gif'] = array();
36
}
37

  
31
init_config_arr(array('gifs', 'gif'));
38 32
$a_gifs = &$config['gifs']['gif'];
39 33
$id = $_REQUEST['id'];
40 34

  
src/usr/local/www/interfaces_gre.php
29 29
require_once("guiconfig.inc");
30 30
require_once("functions.inc");
31 31

  
32
if (!is_array($config['gres'])) {
33
	$config['gres'] = array();
34
}
35
if (!is_array($config['gres']['gre'])) {
36
	$config['gres']['gre'] = array();
37
}
38

  
32
init_config_arr(array('gres', 'gre'));
39 33
$a_gres = &$config['gres']['gre'] ;
40 34

  
41 35
function gre_inuse($num) {
src/usr/local/www/interfaces_gre_edit.php
29 29
require_once("guiconfig.inc");
30 30
require_once("functions.inc");
31 31

  
32
if (!is_array($config['gres'])) {
33
	$config['gres'] = array();
34
}
35
if (!is_array($config['gres']['gre'])) {
36
	$config['gres']['gre'] = array();
37
}
38

  
32
init_config_arr(array('gres', 'gre'));
39 33
$a_gres = &$config['gres']['gre'];
40 34
$id = $_REQUEST['id'];
41 35

  
src/usr/local/www/interfaces_groups.php
29 29
require_once("guiconfig.inc");
30 30
require_once("functions.inc");
31 31

  
32
if (!is_array($config['ifgroups'])) {
33
	$config['ifgroups'] = array();
34
}
35

  
36
if (!is_array($config['ifgroups']['ifgroupentry'])) {
37
	$config['ifgroups']['ifgroupentry'] = array();
38
}
39

  
32
init_config_arr(array('ifgroups', 'ifgroupentry'));
40 33
$a_ifgroups = &$config['ifgroups']['ifgroupentry'];
41 34

  
42 35
if ($_POST['act'] == "del") {
src/usr/local/www/interfaces_groups_edit.php
34 34
$pglinks = array("", "interfaces_groups.php", "@self");
35 35
$shortcut_section = "interfaces";
36 36

  
37
if (!is_array($config['ifgroups'])) {
38
	$config['ifgroups'] = array();
39
}
40

  
41
if (!is_array($config['ifgroups']['ifgroupentry'])) {
42
	$config['ifgroups']['ifgroupentry'] = array();
43
}
44

  
37
init_config_arr(array('ifgroups', 'ifgroupentry'));
45 38
$a_ifgroups = &$config['ifgroups']['ifgroupentry'];
46 39
$id = $_REQUEST['id'];
47 40

  
src/usr/local/www/interfaces_lagg.php
28 28

  
29 29
require_once("guiconfig.inc");
30 30

  
31
if (!is_array($config['laggs'])) {
32
	$config['laggs'] = array();
33
}
34

  
35
if (!is_array($config['laggs']['lagg'])) {
36
	$config['laggs']['lagg'] = array();
37
}
38

  
31
init_config_arr(array('laggs', 'lagg'));
39 32
$a_laggs = &$config['laggs']['lagg'] ;
40 33

  
41 34
function lagg_inuse($num) {
src/usr/local/www/interfaces_lagg_edit.php
28 28

  
29 29
require_once("guiconfig.inc");
30 30

  
31
if (!is_array($config['laggs'])) {
32
	$config['laggs'] = array();
33
}
34

  
35
if (!is_array($config['laggs']['lagg'])) {
36
	$config['laggs']['lagg'] = array();
37
}
38

  
31
init_config_arr(array('laggs', 'lagg'));
39 32
$a_laggs = &$config['laggs']['lagg'];
40 33

  
41 34
$portlist = get_interface_list();
src/usr/local/www/interfaces_ppps_edit.php
39 39
define("CRON_DAILY_PATTERN", "0 0 * * *");
40 40
define("CRON_HOURLY_PATTERN", "0 * * * *");
41 41

  
42
if (!is_array($config['ppps'])) {
43
	$config['ppps'] = array();
44
}
45

  
46
if (!is_array($config['ppps']['ppp'])) {
47
	$config['ppps']['ppp'] = array();
48
}
49

  
42
init_config_arr(array('ppps', 'ppp'));
50 43
$a_ppps = &$config['ppps']['ppp'];
51 44

  
52 45
$iflist = get_configured_interface_with_descr();
......
470 463
$serviceproviders_xml = "/usr/local/share/mobile-broadband-provider-info/serviceproviders.xml";
471 464
$serviceproviders_contents = file_get_contents($serviceproviders_xml);
472 465
$serviceproviders_attr = xml2array($serviceproviders_contents, 1, "attr");
473

  
474 466
$serviceproviders = &$serviceproviders_attr['serviceproviders']['country'];
475 467

  
476 468
//print_r($serviceproviders);
src/usr/local/www/interfaces_vlan.php
35 35

  
36 36
global $profile;
37 37

  
38
if (!is_array($config['vlans'])) {
39
	$config['vlans'] = array();
40
}
41

  
42
if (!is_array($config['vlans']['vlan'])) {
43
	$config['vlans']['vlan'] = array();
44
}
45

  
46
$a_vlans = &$config['vlans']['vlan'] ;
38
init_config_arr(array('vlans', 'vlan'));
39
$a_vlans = &$config['vlans']['vlan'];
47 40

  
48 41
if ($_POST['act'] == "del") {
49 42
	if (!isset($_POST['id'])) {
src/usr/local/www/interfaces_vlan_edit.php
32 32

  
33 33
require_once("guiconfig.inc");
34 34

  
35
if (!is_array($config['vlans'])) {
36
	$config['vlans'] = array();
37
}
38
if (!is_array($config['vlans']['vlan'])) {
39
	$config['vlans']['vlan'] = array();
40
}
41

  
35
init_config_arr(array('vlans', 'vlan'));
42 36
$a_vlans = &$config['vlans']['vlan'];
43 37

  
44 38
$portlist = get_interface_list();
src/usr/local/www/interfaces_wireless.php
29 29

  
30 30
require_once("guiconfig.inc");
31 31

  
32
if (!is_array($config['wireless'])) {
33
	$config['wireless'] = array();
34
}
35
if (!is_array($config['wireless']['clone'])) {
36
	$config['wireless']['clone'] = array();
37
}
38

  
32
init_config_arr(array('wireless', 'clone'));
39 33
$a_clones = &$config['wireless']['clone'];
40 34

  
41 35
function clone_inuse($num) {
src/usr/local/www/interfaces_wireless_edit.php
29 29

  
30 30
require_once("guiconfig.inc");
31 31

  
32
if (!is_array($config['wireless'])) {
33
	$config['wireless'] = array();
34
}
35

  
36
if (!is_array($config['wireless']['clone'])) {
37
	$config['wireless']['clone'] = array();
38
}
39

  
32
init_config_arr(array('wireless', 'clone'));
40 33
$a_clones = &$config['wireless']['clone'];
41 34

  
42 35
function clone_inuse($num) {
src/usr/local/www/load_balancer_monitor.php
30 30
require_once("guiconfig.inc");
31 31
require_once("filter.inc");
32 32

  
33
if (!is_array($config['load_balancer']['monitor_type'])) {
34
	$config['load_balancer']['monitor_type'] = array();
35
}
33
init_config_arr(array('load_balancer', 'monitor_type'));
36 34
$a_monitor = &$config['load_balancer']['monitor_type'];
37 35

  
38 36
$pconfig = $_POST;
src/usr/local/www/load_balancer_monitor_edit.php
31 31

  
32 32
$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/load_balancer_monitor.php');
33 33

  
34
if (!is_array($config['load_balancer']['monitor_type'])) {
35
	$config['load_balancer']['monitor_type'] = array();
36
}
37

  
34
init_config_arr(array('load_balancer', 'monitor_type'));
38 35
$a_monitor = &$config['load_balancer']['monitor_type'];
39 36
$id = $_REQUEST['id'];
40 37

  
src/usr/local/www/load_balancer_pool.php
32 32
require_once("filter.inc");
33 33
require_once("shaper.inc");
34 34

  
35
if (!is_array($config['load_balancer']['lbpool'])) {
36
	$config['load_balancer']['lbpool'] = array();
37
}
38

  
35
init_config_arr(array('load_balancer', 'lbpool'));
39 36
$a_pool = &$config['load_balancer']['lbpool'];
40 37

  
41 38
$pconfig = $_POST;
src/usr/local/www/load_balancer_pool_edit.php
33 33

  
34 34
$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/load_balancer_pool.php');
35 35

  
36
if (!is_array($config['load_balancer']['lbpool'])) {
37
	$config['load_balancer']['lbpool'] = array();
38
}
39

  
36
init_config_arr(array('load_balancer', 'lbpool'));
40 37
$a_pool = &$config['load_balancer']['lbpool'];
41 38

  
42 39
$id = $_REQUEST['id'];
43 40

  
44

  
45 41
if (isset($id) && $a_pool[$id]) {
42
	init_config_arr(array('load_balancer', 'lbpool', $id));
46 43
	$pconfig['name'] = $a_pool[$id]['name'];
47 44
	$pconfig['mode'] = $a_pool[$id]['mode'];
48 45
	$pconfig['descr'] = $a_pool[$id]['descr'];
src/usr/local/www/load_balancer_setting.php
34 34
require_once("shaper.inc");
35 35
require_once("util.inc");
36 36

  
37
if (!is_array($config['load_balancer']['setting'])) {
38
	$config['load_balancer']['setting'] = array();
39
}
40

  
37
init_config_arr(array('load_balancer', 'setting'));
41 38
$lbsetting = &$config['load_balancer']['setting'];
42 39

  
43 40
if ($_POST) {
src/usr/local/www/load_balancer_virtual_server.php
33 33
require_once("shaper.inc");
34 34
require_once("vslb.inc");
35 35

  
36
if (!is_array($config['load_balancer']['virtual_server'])) {
37
	$config['load_balancer']['virtual_server'] = array();
38
}
39

  
36
init_config_arr(array('load_balancer', 'virtual_server'));
40 37
$a_vs = &$config['load_balancer']['virtual_server'];
41 38

  
42 39
$pconfig = $_POST;
src/usr/local/www/load_balancer_virtual_server_edit.php
35 35
	$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/load_balancer_virtual_server.php');
36 36
}
... This diff was truncated because it exceeds the maximum size that can be displayed.
    (1-1/1)