From b79bde599ee73b15eeefc0ccce5b3c8fc6ad4c48 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Mon, 28 Aug 2017 01:49:03 -0600 Subject: [PATCH] Update registrations.php --- .../resources/classes/registrations.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/app/registrations/resources/classes/registrations.php b/app/registrations/resources/classes/registrations.php index cc9da4f128..f0f409827d 100644 --- a/app/registrations/resources/classes/registrations.php +++ b/app/registrations/resources/classes/registrations.php @@ -36,7 +36,7 @@ if (!class_exists('registrations')) { /** * get the registrations */ - public function get($show) { + public function get($profile) { //initialize the id used in the registrations array $id = 0; @@ -45,8 +45,16 @@ if (!class_exists('registrations')) { $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); //get the default settings - $sql = "select sip_profile_name from v_sip_profiles where sip_profile_enabled = 'true' "; - $prep_statement = $this->db->prepare($sql); + $sql = "select sip_profile_name from v_sip_profiles "; + $sql .= "where sip_profile_enabled = 'true' "; + if ($profile == 'all' || $profile == '') { + $prep_statement = $this->db->prepare($sql); + } + else { + $sql .= "and sip_profile_name=:sip_profile_name "; + $prep_statement = $this->db->prepare($sql); + $prep_statement->bindParam(':sip_profile_name', $profile); + } $prep_statement->execute(); $sip_profiles = $prep_statement->fetchAll(PDO::FETCH_NAMED); foreach ($sip_profiles as $row) { @@ -120,7 +128,7 @@ if (!class_exists('registrations')) { //remove unrelated domains if (count($_SESSION["domains"]) > 1) { - if (!(permission_exists('registration_all') && $show == "all")) { + if (!(permission_exists('registration_all') && $profile == "all")) { if ($registrations[$id]['sip-auth-realm'] == $_SESSION['domain_name']) {} elseif ($user_array[1] == $_SESSION['domain_name']){} else { @@ -142,7 +150,7 @@ if (!class_exists('registrations')) { } /* $obj = new registrations; -$registrations = $obj->get(); +$registrations = $obj->get('all'); print($registrations); */