From 2843a3ec5d4a160646e496f3922266415151902a Mon Sep 17 00:00:00 2001 From: Erik Fonnesbeck Date: Tue, 16 Mar 2010 20:50:59 -0600 Subject: Add optional support for reading attributes to xmlparse.inc and move regdomain.xml parsing from regdomain.inc to xmlparse.inc. --- usr/local/www/interfaces.php | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'usr/local/www/interfaces.php') diff --git a/usr/local/www/interfaces.php b/usr/local/www/interfaces.php index 959f448..9fd5d5c 100755 --- a/usr/local/www/interfaces.php +++ b/usr/local/www/interfaces.php @@ -52,7 +52,6 @@ require("filter.inc"); require("shaper.inc"); require("rrd.inc"); require("vpn.inc"); -require('regdomain.inc'); if ($_REQUEST['if']) { $if = $_REQUEST['if']; @@ -219,7 +218,11 @@ if (isset($wancfg['wireless'])) { interface_wireless_clone($wlanif, $wancfg); $wlanbaseif = interface_get_wireless_base($wancfg['if']); $wl_modes = get_wireless_modes($if); - $wl_regdomains = parse_xml_regdomain(); + $wl_regdomain_xml = parse_xml_regdomain($wl_regdomain_xml_attr); + $wl_regdomains = &$wl_regdomain_xml['regulatory-domains']['rd']; + $wl_regdomains_attr = &$wl_regdomain_xml_attr['regulatory-domains']['rd']; + $wl_countries = &$wl_regdomain_xml['country-codes']['country']; + $wl_countries_attr = &$wl_regdomain_xml_attr['country-codes']['country']; $pconfig['standard'] = $wancfg['wireless']['standard']; $pconfig['mode'] = $wancfg['wireless']['mode']; $pconfig['protmode'] = $wancfg['wireless']['protmode']; @@ -699,7 +702,7 @@ function handle_pppoe_reset() { } function handle_wireless_post() { - global $_POST, $config, $g, $wancfg, $if, $wl_regdomains; + global $_POST, $config, $g, $wancfg, $if, $wl_countries_attr; if (!is_array($wancfg['wireless'])) $wancfg['wireless'] = array(); $wancfg['wireless']['standard'] = $_POST['standard']; @@ -714,9 +717,9 @@ function handle_wireless_post() { $wancfg['wireless']['regcountry'] = $_POST['regcountry']; $wancfg['wireless']['reglocation'] = $_POST['reglocation']; if (!empty($wancfg['wireless']['regdomain']) && !empty($wancfg['wireless']['regcountry'])) { - foreach($wl_regdomains['country-codes']['country'] as $wl_country) { - if ($wancfg['wireless']['regcountry'] == $wl_country['attributes']['ID']) { - $wancfg['wireless']['regdomain'] = $wl_country['rd'][0]['attributes']['REF']; + foreach($wl_countries_attr as $wl_country) { + if ($wancfg['wireless']['regcountry'] == $wl_country['ID']) { + $wancfg['wireless']['regdomain'] = $wl_country['rd'][0]['REF']; break; } } @@ -1388,12 +1391,12 @@ $types = array("none" => "None", "static" => "Static", "dhcp" => "DHCP", "pppoe" @@ -1402,12 +1405,12 @@ $types = array("none" => "None", "static" => "Static", "dhcp" => "DHCP", "pppoe" -- cgit v1.1