From ea91e3c3e2bdb6cf7208ef1df333da210f691ed2 Mon Sep 17 00:00:00 2001 From: Nate Date: Wed, 14 Aug 2019 07:01:43 -0600 Subject: [PATCH] SIP Status: Database class integration. --- app/sip_status/sip_status.php | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/app/sip_status/sip_status.php b/app/sip_status/sip_status.php index ed683d4087..a7143e26f3 100644 --- a/app/sip_status/sip_status.php +++ b/app/sip_status/sip_status.php @@ -102,11 +102,11 @@ if ($_GET['a'] == "download") { //get the gateways $sql = "select g.domain_uuid, g.gateway, g.gateway_uuid, d.domain_name "; - $sql .= "from v_gateways as g left outer join v_domains as d on d.domain_uuid = g.domain_uuid"; - $prep_statement = $db->prepare(check_sql($sql)); - $prep_statement->execute(); - $gateways = $prep_statement->fetchAll(PDO::FETCH_NAMED); - unset ($prep_statement, $sql); + $sql .= "from v_gateways as g left "; + $sql .= "outer join v_domains as d on d.domain_uuid = g.domain_uuid"; + $database = new database; + $gateways = $database->select($sql, null, 'all'); + unset($sql); if ($fp) { $hostname = trim(event_socket_request($fp, 'api switchname')); @@ -116,15 +116,15 @@ if ($_GET['a'] == "download") { $sql = "select sip_profile_name from v_sip_profiles "; $sql .= "where sip_profile_enabled = 'true' "; if ($hostname) { - $sql .= "and (sip_profile_hostname = '" . check_str($hostname) . "' "; + $sql .= "and (sip_profile_hostname = :sip_profile_hostname "; $sql .= "or sip_profile_hostname = '' "; - $sql .= "or sip_profile_hostname is null ) "; + $sql .= "or sip_profile_hostname is null) "; + $parameters['sip_profile_hostname'] = $hostname; } $sql .= "order by sip_profile_name asc "; - $prep_statement = $db->prepare(check_sql($sql)); - $prep_statement->execute(); - $sip_profiles = $prep_statement->fetchAll(); - unset ($prep_statement, $sql); + $database = new database; + $sip_profiles = $database->select($sql, (is_array($parameters) && @sizeof($parameters) != 0 ? $parameters : null), 'all'); + unset($sql, $parameters); //sofia status if ($fp && permission_exists('system_status_sofia_status')) { @@ -199,9 +199,10 @@ if ($_GET['a'] == "download") { if ($_SESSION["domain_name"] == $gateway_domain_name) { echo "".escape($gateway_name)."@".escape($gateway_domain_name).""; } - elseif ($gateway_domain_name == '') { + else if ($gateway_domain_name == '') { echo $gateway_name ? $gateway_name : $row->name; - } else { + } + else { echo $gateway_name."@".$gateway_domain_name; } echo " \n"; @@ -343,4 +344,4 @@ if ($_GET['a'] == "download") { //include the footer require_once "resources/footer.php"; -?> +?> \ No newline at end of file