From 5f09dd8e08ed4fb486cd6e934a8e563cd28275a1 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Tue, 25 Aug 2015 14:52:19 -0600 Subject: [PATCH] Make sure access controls is not empty. --- app/access_controls/app_defaults.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/app/access_controls/app_defaults.php b/app/access_controls/app_defaults.php index 03077b6aa2..a540e6d9b0 100644 --- a/app/access_controls/app_defaults.php +++ b/app/access_controls/app_defaults.php @@ -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 = "\n"; + $xml_string .= " \n"; + $xml_string .= " \n"; + $xml_string .= " \n"; + $xml_string .= " \n"; + $xml_string .= " \n"; + $xml_string .= "\n"; + } $xml_object = simplexml_load_string($xml_string); $json = json_encode($xml_object); $conf_array = json_decode($json, true);