diff --git a/app/xml_cdr/app_defaults.php b/app/xml_cdr/app_defaults.php index ea9ed50a8a..f71499e136 100644 --- a/app/xml_cdr/app_defaults.php +++ b/app/xml_cdr/app_defaults.php @@ -73,6 +73,13 @@ $array[$x]['default_setting_enabled'] = 'true'; $array[$x]['default_setting_description'] = ''; $x++; + $array[$x]['default_setting_category'] = 'cdr'; + $array[$x]['default_setting_subcategory'] = 'http_enabled'; + $array[$x]['default_setting_name'] = 'boolean'; + $array[$x]['default_setting_value'] = 'true'; + $array[$x]['default_setting_enabled'] = 'true'; + $array[$x]['default_setting_description'] = ''; + $x++; $orm = new orm; $orm->name('default_settings'); foreach ($array as $index => $null) { diff --git a/app/xml_cdr/v_xml_cdr_import.php b/app/xml_cdr/v_xml_cdr_import.php index 6466bff2a9..301feaca87 100644 --- a/app/xml_cdr/v_xml_cdr_import.php +++ b/app/xml_cdr/v_xml_cdr_import.php @@ -483,7 +483,7 @@ print_r ($_POST["cdr"]); } //authentication for xml cdr http post - if (strlen($_SESSION["xml_cdr"]["http_enabled"]) == 0) { + if ($_SESSION["cdr"]["http_enabled"]["boolean"] == "true" && strlen($_SESSION["xml_cdr"]["username"]) == 0) { //get the contents of xml_cdr.conf.xml $conf_xml_string = file_get_contents($_SESSION['switch']['conf']['dir'].'/autoload_configs/xml_cdr.conf.xml'); @@ -494,34 +494,35 @@ catch(Exception $e) { echo $e->getMessage(); } - $_SESSION["xml_cdr"]["http_enabled"] = false; foreach ($conf_xml->settings->param as $row) { if ($row->attributes()->name == "cred") { $auth_array = explode(":", $row->attributes()->value); - $_SESSION["xml_cdr"]["username"] = $auth_array[0]; - $_SESSION["xml_cdr"]["password"] = $auth_array[1]; - //echo "username: ".$_SESSION["xml_cdr"]["username"]."
\n"; - //echo "password: ".$_SESSION["xml_cdr"]["password"]."
\n"; + //echo "username: ".$auth_array[0]."
\n"; + //echo "password: ".$auth_array[1]."
\n"; } if ($row->attributes()->name == "url") { - $_SESSION["xml_cdr"]["http_enabled"] = true; + //check name is equal to url } } } //if http enabled is set to false then deny access - if (!$_SESSION["xml_cdr"]["http_enabled"]) { + if ($_SESSION["cdr"]["http_enabled"]["boolean"] == "false") { echo "access denied
\n"; return; } //check for the correct username and password - if ($_SESSION["xml_cdr"]["username"] == $_SERVER["PHP_AUTH_USER"] && $_SESSION["xml_cdr"]["password"] == $_SERVER["PHP_AUTH_PW"]) { - //echo "access granted
\n"; - } - else { - echo "access denied
\n"; - return; + if ($_SESSION["cdr"]["http_enabled"]["boolean"] == "true") { + if ($auth_array[0] == $_SERVER["PHP_AUTH_USER"] && $auth_array[1] == $_SERVER["PHP_AUTH_PW"]) { + //echo "access granted
\n"; + $_SESSION["xml_cdr"]["username"] = $auth_array[0]; + $_SESSION["xml_cdr"]["password"] = $auth_array[1]; + } + else { + echo "access denied
\n"; + return; + } } //loop through all attribues //foreach($xml->settings->param[1]->attributes() as $a => $b) {