Make sure access controls is not empty.
This commit is contained in:
parent
1f0664be66
commit
5f09dd8e08
|
|
@ -36,9 +36,24 @@
|
|||
if ($row['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
|
||||
$xml_string = file_get_contents($xml_dir."/acl.conf.xml");
|
||||
if (file_exists($xml_file)) {
|
||||
$xml_string = file_get_contents($xml_file);
|
||||
}
|
||||
elseif (file_exists($xml_file_alt)) {
|
||||
$xml_string = file_get_contents(xml_file_alt);
|
||||
}
|
||||
else {
|
||||
$xml_string = "<configuration name=\"acl.conf\" description=\"Network Lists\">\n";
|
||||
$xml_string .= " <network-lists>\n";
|
||||
$xml_string .= " <list name=\"domains\" default=\"deny\">\n";
|
||||
$xml_string .= " <node type=\"allow\" domain=\"".$_SESSION['domain_name']."\"/>\n";
|
||||
$xml_string .= " </list>\n";
|
||||
$xml_string .= " </network-lists>\n";
|
||||
$xml_string .= "</configuration>\n";
|
||||
}
|
||||
$xml_object = simplexml_load_string($xml_string);
|
||||
$json = json_encode($xml_object);
|
||||
$conf_array = json_decode($json, true);
|
||||
|
|
|
|||
Loading…
Reference in New Issue