From 5a59672d7447df2bf55cec00b6d4ac6212350855 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Sat, 9 Dec 2017 12:04:13 -0700 Subject: [PATCH] Update gateways.php --- app/gateways/gateways.php | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/app/gateways/gateways.php b/app/gateways/gateways.php index 00a37ea389..01d12c3c3d 100644 --- a/app/gateways/gateways.php +++ b/app/gateways/gateways.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2016 + Portions created by the Initial Developer are Copyright (C) 2008-2017 the Initial Developer. All Rights Reserved. Contributor(s): @@ -91,6 +91,14 @@ echo " \n"; echo " ".$text['title-gateways']."\n"; echo " "; + if (permission_exists('gateway_all')) { + if ($_GET['show'] == 'all') { + echo " "; + } + else { + echo " \n"; + } + } echo " \n"; echo " \n"; echo " \n"; @@ -129,18 +137,23 @@ //get the list $sql = "select * from v_gateways "; - $sql .= "where ( domain_uuid = '".$_SESSION['domain_uuid']."' "; - if (permission_exists('gateway_domain')) { - $sql .= "or domain_uuid is null "; + if ($_GET['show'] == "all" && permission_exists('gateway_all')) { + //show all gateways + } else { + $sql .= "where (\n"; + $sql .= " domain_uuid = '".$_SESSION['domain_uuid']."'\n"; + if (permission_exists('gateway_domain')) { + $sql .= " or domain_uuid is null\n"; + } + $sql .= ") "; } - $sql .= ") "; if (strlen($order_by) == 0) { - $sql .= "order by gateway asc "; + $sql .= "order by gateway asc\n"; } else { - $sql .= "order by $order_by $order "; + $sql .= "order by $order_by $order\n"; } - $sql .= "limit $rows_per_page offset $offset "; + $sql .= "limit $rows_per_page offset $offset\n"; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $gateways = $prep_statement->fetchAll(PDO::FETCH_NAMED); @@ -152,6 +165,9 @@ echo "\n"; echo "\n"; + if ($_GET['show'] == "all" && permission_exists('gateway_all')) { + echo th_order_by('domain_name', $text['label-domain'], $order_by, $order, $param); + } echo th_order_by('gateway', $text['label-gateway'], $order_by, $order); echo th_order_by('context', $text['label-context'], $order_by, $order); if ($fp) { @@ -175,6 +191,9 @@ foreach($gateways as $row) { $tr_link = (permission_exists('gateway_edit')) ? "href='gateway_edit.php?id=".$row['gateway_uuid']."'" : null; echo "\n"; + if ($_GET['show'] == "all" && permission_exists('gateway_all')) { + echo " \n"; + } echo "
".$_SESSION['domains'][$row['domain_uuid']]['domain_name'].""; if (permission_exists('gateway_edit')) { echo "".$row["gateway"]."";