From 6247765f80c7dbced3b0abefd67cf6c50a6a055d Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Thu, 1 Mar 2018 21:19:38 -0700 Subject: [PATCH] Update ringbacks.php --- resources/classes/ringbacks.php | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/resources/classes/ringbacks.php b/resources/classes/ringbacks.php index 210f22b4b9..cc9f9973ea 100644 --- a/resources/classes/ringbacks.php +++ b/resources/classes/ringbacks.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) 2016 + Portions created by the Initial Developer are Copyright (C) 2016-2018 the Initial Developer. All Rights Reserved. Contributor(s): @@ -30,6 +30,7 @@ if (!class_exists('ringbacks')) { //define variables public $db; + public $domain_uuid; private $ringbacks; private $tones_list; private $music_list; @@ -46,6 +47,9 @@ if (!class_exists('ringbacks')) { $this->db = $database->db; } + //set the domain_uuid + $this->domain_uuid = $_SESSION['domain_uuid']; + //add multi-lingual support $language = new text; $text = $language->get(); @@ -68,7 +72,7 @@ if (!class_exists('ringbacks')) { } $this->ringbacks = $ringback_list; unset($ringback_list); - + //get the default_ringback label /* $sql = "select * from v_vars where var_name = 'ringback' "; @@ -91,7 +95,7 @@ if (!class_exists('ringbacks')) { require_once "resources/classes/tones.php"; $tones = new tones; $this->tones_list = $tones->tones_list(); - + //get music on hold and recordings if (is_dir($_SERVER["PROJECT_ROOT"].'/app/music_on_hold')) { require_once "app/music_on_hold/resources/classes/switch_music_on_hold.php"; @@ -140,6 +144,24 @@ if (!class_exists('ringbacks')) { $select .= " \n"; } + //streams + if (is_dir($_SERVER["PROJECT_ROOT"].'/app/streams')) { + $sql = "select * from v_streams "; + $sql .= "where (domain_uuid = '".$this->domain_uuid."' or domain_uuid is null) "; + $sql .= "and stream_enabled = 'true' "; + $sql .= "order by stream_name asc "; + $prep_statement = $this->db->prepare(check_sql($sql)); + $prep_statement->execute(); + $streams = $prep_statement->fetchAll(PDO::FETCH_NAMED); + if (sizeof($streams) > 0) { + $select .= " "; + foreach($streams as $row){ + $select .= " \n"; + } + $select .= " \n"; + } + } + //ringbacks if (sizeof($this->ringbacks) > 0) { $selected_ringback = $selected;