Use is_array around foreach
This commit is contained in:
parent
d207508ac5
commit
2a2069fe9e
|
|
@ -32,10 +32,12 @@
|
|||
$database = new database;
|
||||
$num_rows = $database->select($sql, null, 'column');
|
||||
if ($num_rows == 0) {
|
||||
|
||||
//set the directory
|
||||
$xml_dir = $_SESSION["switch"]["conf"]["dir"].'/autoload_configs';
|
||||
$xml_file = $xml_dir."/acl.conf.xml";
|
||||
$xml_file_alt = $_SERVER["DOCUMENT_ROOT"].'/'.PROJECT_PATH.'/resources/templates/conf/autoload_configs/acl.conf';
|
||||
|
||||
//load the xml and save it into an array
|
||||
if (file_exists($xml_file)) {
|
||||
$xml_string = file_get_contents($xml_file);
|
||||
|
|
@ -62,6 +64,7 @@
|
|||
$conf_array = json_decode($json, true);
|
||||
|
||||
//process the array
|
||||
if (is_array($conf_array['network-lists']['list'])) {
|
||||
foreach($conf_array['network-lists']['list'] as $list) {
|
||||
//get the attributes
|
||||
$access_control_name = $list['@attributes']['name'];
|
||||
|
|
@ -91,6 +94,7 @@
|
|||
}
|
||||
|
||||
//add the nodes
|
||||
if (is_array($list['node'])) {
|
||||
foreach ($list['node'] as $row) {
|
||||
//get the name and value pair
|
||||
$node_type = $row['@attributes']['type'];
|
||||
|
|
@ -122,6 +126,8 @@
|
|||
$p->delete('access_control_node_add', 'temp');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//rename the file
|
||||
if (file_exists($xml_dir.'/acl.conf.xml')) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue