Update ringbacks.php

This commit is contained in:
FusionPBX
2018-03-01 21:19:38 -07:00
committed by GitHub
parent fc297008c7
commit 6247765f80
+23 -1
View File
@@ -17,7 +17,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
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. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@@ -30,6 +30,7 @@ if (!class_exists('ringbacks')) {
//define variables //define variables
public $db; public $db;
public $domain_uuid;
private $ringbacks; private $ringbacks;
private $tones_list; private $tones_list;
private $music_list; private $music_list;
@@ -46,6 +47,9 @@ if (!class_exists('ringbacks')) {
$this->db = $database->db; $this->db = $database->db;
} }
//set the domain_uuid
$this->domain_uuid = $_SESSION['domain_uuid'];
//add multi-lingual support //add multi-lingual support
$language = new text; $language = new text;
$text = $language->get(); $text = $language->get();
@@ -140,6 +144,24 @@ if (!class_exists('ringbacks')) {
$select .= " </optgroup>\n"; $select .= " </optgroup>\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 .= " <optgroup label='".$text['label-streams']."'>";
foreach($streams as $row){
$select .= " <option value='".$row['stream_location']."' ".(($selected == $row['stream_location']) ? 'selected="selected"' : null).">".$row['stream_name']."</option>\n";
}
$select .= " </optgroup>\n";
}
}
//ringbacks //ringbacks
if (sizeof($this->ringbacks) > 0) { if (sizeof($this->ringbacks) > 0) {
$selected_ringback = $selected; $selected_ringback = $selected;