diff --git a/app/dialplan/dialplans.php b/app/dialplan/dialplans.php index 0dcb9c7a03..c4d76982be 100644 --- a/app/dialplan/dialplans.php +++ b/app/dialplan/dialplans.php @@ -23,16 +23,20 @@ Contributor(s): Mark J Crane */ -include "root.php"; -require_once "resources/require.php"; -require_once "resources/check_auth.php"; -if (permission_exists('dialplan_view')) { - //access granted -} -else { - echo "access denied"; - exit; -} + +//includes + include "root.php"; + require_once "resources/require.php"; + require_once "resources/check_auth.php"; + +//check permissions + if (permission_exists('dialplan_view')) { + //access granted + } + else { + echo "access denied"; + exit; + } //add multi-lingual support $language = new text; @@ -67,95 +71,8 @@ else { //includes require_once "resources/header.php"; require_once "resources/paging.php"; - if ($app_uuid == "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4") { - $document['title'] = $text['title-inbound_routes']; - } - elseif ($app_uuid == "8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3") { - $document['title'] = $text['title-outbound_routes']; - } - elseif ($app_uuid == "16589224-c876-aeb3-f59f-523a1c0801f7") { - $document['title'] = $text['title-queues']; - } - elseif ($app_uuid == "4b821450-926b-175a-af93-a03c441818b1") { - $document['title'] = $text['title-time_conditions']; - } - else { - $document['title'] = $text['title-dialplan_manager']; - } -//show the content - echo "\n"; - echo "\n"; - echo " \n"; - - echo " \n"; - - //echo " \n"; - echo "\n"; - echo "
\n"; - echo " \n"; - if ($app_uuid == "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4") { - echo " ".$text['header-inbound_routes']."\n"; - } - elseif ($app_uuid == "8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3") { - echo " ".$text['header-outbound_routes']."\n"; - } - elseif ($app_uuid == "16589224-c876-aeb3-f59f-523a1c0801f7") { - echo " ".$text['header-queues']."\n"; - } - elseif ($app_uuid == "4b821450-926b-175a-af93-a03c441818b1") { - echo " ".$text['header-time_conditions']."\n"; - } - else { - echo " ".$text['header-dialplan_manager']."\n"; - } - echo " \n"; - echo "

\n"; - echo " \n"; - if ($app_uuid == "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4") { - echo $text['description-inbound_routes']; - } - elseif ($app_uuid == "8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3") { - echo $text['description-outbound_routes']; - } - elseif ($app_uuid == "16589224-c876-aeb3-f59f-523a1c0801f7") { - echo $text['description-queues']; - } - elseif ($app_uuid == "4b821450-926b-175a-af93-a03c441818b1") { - echo $text['description-time_conditions']; - } - else { - if (if_group("superadmin")) { - echo $text['description-dialplan_manager-superadmin']; - } - else { - echo $text['description-dialplan_manager']; - } - } - echo " \n"; - echo "
\n"; - echo "
\n"; - echo " "; - if (strlen($app_uuid) > 0) { - echo " "; - } - if (strlen($order_by) > 0) { - echo " "; - echo " "; - } - echo " "; - echo "
\n"; - echo "
\n"; - //if (permission_exists('dialplan_advanced_view') && strlen($app_uuid) == 0) { - // echo " \n"; - //} - //else { - // echo " \n"; - //} - //echo "
"; - echo "
"; - - //get the number of rows in the dialplan +//get the number of rows in the dialplan $sql = "select count(*) as num_rows from v_dialplans "; $sql .= "where (domain_uuid = '$domain_uuid' or domain_uuid is null) "; if (strlen($app_uuid) == 0) { @@ -201,6 +118,7 @@ else { list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page); $offset = $rows_per_page * $page; +//get the list of dialplans $sql = "select * from v_dialplans "; $sql .= "where (domain_uuid = '$domain_uuid' or domain_uuid is null) "; if (strlen($app_uuid) == 0) { @@ -229,14 +147,110 @@ else { $sql .= " limit $rows_per_page offset $offset "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); - $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); - $result_count = count($result); + $dialplans = $prep_statement->fetchAll(PDO::FETCH_NAMED); + $result_count = count($dialplans); unset ($prep_statement, $sql); +//set the alternating row style $c = 0; $row_style["0"] = "row_style0"; $row_style["1"] = "row_style1"; +//set the title + if ($app_uuid == "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4") { + $document['title'] = $text['title-inbound_routes']; + } + elseif ($app_uuid == "8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3") { + $document['title'] = $text['title-outbound_routes']; + } + elseif ($app_uuid == "16589224-c876-aeb3-f59f-523a1c0801f7") { + $document['title'] = $text['title-queues']; + } + elseif ($app_uuid == "4b821450-926b-175a-af93-a03c441818b1") { + $document['title'] = $text['title-time_conditions']; + } + else { + $document['title'] = $text['title-dialplan_manager']; + } + +//show the content + echo "\n"; + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + + echo " \n"; + echo " \n"; + + + + //echo " \n"; + echo "\n"; + echo "
\n"; + echo " \n"; + if ($app_uuid == "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4") { + echo " ".$text['header-inbound_routes']."\n"; + } + elseif ($app_uuid == "8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3") { + echo " ".$text['header-outbound_routes']."\n"; + } + elseif ($app_uuid == "16589224-c876-aeb3-f59f-523a1c0801f7") { + echo " ".$text['header-queues']."\n"; + } + elseif ($app_uuid == "4b821450-926b-175a-af93-a03c441818b1") { + echo " ".$text['header-time_conditions']."\n"; + } + else { + echo " ".$text['header-dialplan_manager']."\n"; + } + echo " \n"; + echo "

\n"; + echo "
\n"; + echo "
\n"; + echo " "; + if (strlen($app_uuid) > 0) { + echo " "; + } + if (strlen($order_by) > 0) { + echo " "; + echo " "; + } + echo " "; + echo "
\n"; + echo "
\n"; + echo " \n"; + if ($app_uuid == "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4") { + echo $text['description-inbound_routes']; + } + elseif ($app_uuid == "8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3") { + echo $text['description-outbound_routes']; + } + elseif ($app_uuid == "16589224-c876-aeb3-f59f-523a1c0801f7") { + echo $text['description-queues']; + } + elseif ($app_uuid == "4b821450-926b-175a-af93-a03c441818b1") { + echo $text['description-time_conditions']; + } + else { + if (if_group("superadmin")) { + echo $text['description-dialplan_manager-superadmin']; + } + else { + echo $text['description-dialplan_manager']; + } + } + echo " \n"; + echo " \n"; + //if (permission_exists('dialplan_advanced_view') && strlen($app_uuid) == 0) { + // echo " \n"; + //} + //else { + // echo " \n"; + //} + //echo "
"; + echo "
"; + echo "
\n"; echo "\n"; echo "\n"; @@ -273,7 +287,9 @@ else { echo "\n"; if ($result_count > 0) { - foreach($result as $row) { + foreach($dialplans as $row) { + + //get the application id $app_uuid = $row['app_uuid']; // blank app id if doesn't match others, so will return to dialplan manager @@ -389,7 +405,6 @@ else { echo "

"; echo ""; - if (sizeof($dialplan_ids) > 0) { echo "