From 04b0ffccc1f20e8014910aec214ff5a2477f63fb Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Thu, 22 Jan 2015 11:10:51 +0000 Subject: [PATCH] Enable ability to have global gateways. --- app/dialplan/dialplan_edit.php | 21 ++++++++--------- app/extensions/extension_edit.php | 2 +- app/gateways/app_config.php | 28 ++++++++++++---------- app/gateways/app_languages.php | 15 ++++++++++++ app/gateways/gateway_edit.php | 39 +++++++++++++++++++++++++++---- 5 files changed, 76 insertions(+), 29 deletions(-) diff --git a/app/dialplan/dialplan_edit.php b/app/dialplan/dialplan_edit.php index bbee90e728..13a3a3f11a 100644 --- a/app/dialplan/dialplan_edit.php +++ b/app/dialplan/dialplan_edit.php @@ -777,17 +777,16 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { } //end if update - echo "\n"; - echo " \n"; - echo " \n"; - echo " "; - echo "
\n"; - if ($action == "update") { - echo " \n"; - } - echo " \n"; - echo "
"; - + echo "\n"; + echo " \n"; + echo " \n"; + echo " "; + echo "
\n"; + if ($action == "update") { + echo " \n"; + } + echo " \n"; + echo "
"; echo ""; echo " "; diff --git a/app/extensions/extension_edit.php b/app/extensions/extension_edit.php index 7892143f11..5b1ad05ce0 100644 --- a/app/extensions/extension_edit.php +++ b/app/extensions/extension_edit.php @@ -729,7 +729,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { //pre-populate the form if (count($_GET) > 0 && $_POST["persistformvar"] != "true") { - $extension_uuid = $_GET["id"]; + $extension_uuid = check_str($_GET["id"]); $sql = "select * from v_extensions "; $sql .= "where extension_uuid = '$extension_uuid' "; $sql .= "and domain_uuid = '".$domain_uuid."' "; diff --git a/app/gateways/app_config.php b/app/gateways/app_config.php index 3c41a1ccb5..86e0ed08c5 100644 --- a/app/gateways/app_config.php +++ b/app/gateways/app_config.php @@ -21,18 +21,22 @@ $apps[$x]['description']['pt-br'] = ""; //permission details - $apps[$x]['permissions'][0]['name'] = "gateway_view"; - $apps[$x]['permissions'][0]['menu']['uuid'] = "237a512a-f8fe-1ce4-b5d7-e71c401d7159"; - $apps[$x]['permissions'][0]['groups'][] = "superadmin"; - - $apps[$x]['permissions'][1]['name'] = "gateway_add"; - $apps[$x]['permissions'][1]['groups'][] = "superadmin"; - - $apps[$x]['permissions'][2]['name'] = "gateway_edit"; - $apps[$x]['permissions'][2]['groups'][] = "superadmin"; - - $apps[$x]['permissions'][3]['name'] = "gateway_delete"; - $apps[$x]['permissions'][3]['groups'][] = "superadmin"; + $y = 0; + $apps[$x]['permissions'][$y]['name'] = "gateway_view"; + $apps[$x]['permissions'][$y]['menu']['uuid'] = "237a512a-f8fe-1ce4-b5d7-e71c401d7159"; + $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; + $y++; + $apps[$x]['permissions'][$y]['name'] = "gateway_add"; + $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; + $y++; + $apps[$x]['permissions'][$y]['name'] = "gateway_edit"; + $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; + $y++; + $apps[$x]['permissions'][$y]['name'] = "gateway_delete"; + $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; + $y++; + $apps[$x]['permissions'][$y]['name'] = "gateway_domain"; + $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; //schema details $y = 0; //table array index diff --git a/app/gateways/app_languages.php b/app/gateways/app_languages.php index 51cb569b2f..7fe9cbcc83 100644 --- a/app/gateways/app_languages.php +++ b/app/gateways/app_languages.php @@ -269,6 +269,21 @@ $text['description-profile']['pt-pt'] = "Introduza o perfil aqui."; $text['description-profile']['fr-fr'] = ""; + $text['label-domain']['en-us'] = "Domain"; + $text['label-domain']['es-cl'] = "Dominio"; + $text['label-domain']['pt-pt'] = "Domínio"; + $text['label-domain']['fr-fr'] = "Domaine"; + + $text['description-domain']['en-us'] = ""; + $text['description-domain']['es-cl'] = ""; + $text['description-domain']['pt-pt'] = ""; + $text['description-domain']['fr-fr'] = ""; + + $text['select-global']['en-us'] = "Global"; + $text['select-global']['es-cl'] = "Global"; + $text['select-global']['pt-pt'] = "Global"; + $text['select-global']['fr-fr'] = "Mondial"; + $text['label-enabled']['en-us'] = "Enabled"; $text['label-enabled']['es-cl'] = "Activado"; $text['label-enabled']['pt-pt'] = "Habilitado"; diff --git a/app/gateways/gateway_edit.php b/app/gateways/gateway_edit.php index f844008fe2..aed6acf828 100644 --- a/app/gateways/gateway_edit.php +++ b/app/gateways/gateway_edit.php @@ -49,6 +49,7 @@ else { //get http post variables and set them to php variables if (count($_POST) > 0) { + $domain_uuid = check_str($_POST["domain_uuid"]); $gateway = check_str($_POST["gateway"]); $username = check_str($_POST["username"]); $password = check_str($_POST["password"]); @@ -235,10 +236,10 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $sql .= "extension_in_contact = '$extension_in_contact', "; $sql .= "context = '$context', "; $sql .= "profile = '$profile', "; + $sql .= "domain_uuid = '$domain_uuid', "; $sql .= "enabled = '$enabled', "; $sql .= "description = '$description' "; - $sql .= "where domain_uuid = '$domain_uuid' "; - $sql .= "and gateway_uuid = '$gateway_uuid'"; + $sql .= "where gateway_uuid = '$gateway_uuid'"; $db->exec(check_sql($sql)); unset($sql); } //if ($action == "update") @@ -292,12 +293,12 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { if (count($_GET) > 0 && $_POST["persistformvar"] != "true") { $gateway_uuid = check_str($_GET["id"]); $sql = "select * from v_gateways "; - $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; - $sql .= "and gateway_uuid = '".$gateway_uuid."' "; + $sql .= "where gateway_uuid = '".$gateway_uuid."' "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); foreach ($result as &$row) { + $domain_uuid = $row["domain_uuid"]; $gateway = $row["gateway"]; $username = $row["username"]; $password = $row["password"]; @@ -750,6 +751,34 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; echo "\n"; + if (permission_exists('gateway_domain')) { + echo "\n"; + echo "\n"; + echo " ".$text['label-domain'].":\n"; + echo "\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['description-domain_name']."\n"; + echo "\n"; + echo "\n"; + } + echo " \n"; echo " "; @@ -835,4 +864,4 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //include the footer require_once "resources/footer.php"; -?> +?> \ No newline at end of file