From fb8b6db71d7e757d2ee8427e8716fa6bb1e2e839 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Sat, 16 Sep 2023 02:00:57 -0600 Subject: [PATCH] Get event socket details from the settings class --- resources/switch.php | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/resources/switch.php b/resources/switch.php index b1b97c17d6..50e374e225 100644 --- a/resources/switch.php +++ b/resources/switch.php @@ -27,22 +27,15 @@ */ //includes files - require_once __DIR__ . "/require.php"; +require_once __DIR__ . "/require.php"; //get the event socket information - if (file_exists($_SERVER["PROJECT_ROOT"]."/app/settings/app_config.php")) { - if ((! isset($_SESSION['event_socket_ip_address'])) or empty($_SESSION['event_socket_ip_address'])) { - $sql = "select * from v_settings "; - $database = new database; - $row = $database->select($sql, null, 'row'); - if (!empty($row)) { - $_SESSION['event_socket_ip_address'] = $row["event_socket_ip_address"]; - $_SESSION['event_socket_port'] = $row["event_socket_port"]; - $_SESSION['event_socket_password'] = $row["event_socket_password"]; - } - unset($sql, $row); - } - } +if (empty($_SESSION['event_socket_ip_address'])) { + $setting = new settings(["category" => "switch"]); + $_SESSION['event_socket_ip_address'] = $setting->get('switch', 'event_socket_ip_address'); + $_SESSION['event_socket_port'] = $setting->get('switch', 'event_socket_port'); + $_SESSION['event_socket_password'] = $setting->get('switch', 'event_socket_password'); +} function event_socket_create($host, $port, $password) { $esl = new event_socket;