From 521bf62695b3cb80325729c4bbceb2a2f22e6129 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Tue, 14 Jun 2016 11:10:53 -0600 Subject: [PATCH] Update gateway_edit.php If permission to view all gateways then add an 'or domain_uuid is null' --- app/gateways/gateway_edit.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/gateways/gateway_edit.php b/app/gateways/gateway_edit.php index b3c83c065b..394e9be629 100644 --- a/app/gateways/gateway_edit.php +++ b/app/gateways/gateway_edit.php @@ -50,7 +50,12 @@ else { //get total gateway count from the database, check limit, if defined if ($action == 'add') { if ($_SESSION['limit']['gateways']['numeric'] != '') { - $sql = "select count(*) as num_rows from v_gateways where domain_uuid = '".$_SESSION['domain_uuid']."' "; + $sql = "select count(*) as num_rows from v_gateways "; + $sql .= "where ( domain_uuid = '".$_SESSION['domain_uuid']."' "; + if (permission_exists('gateway_domain') { + $sql .= "or domain_uuid is null "; + } + $sql .= ");"; $prep_statement = $db->prepare($sql); if ($prep_statement) { $prep_statement->execute(); @@ -961,4 +966,4 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { //include the footer require_once "resources/footer.php"; -?> \ No newline at end of file +?>