mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-30 00:53:50 +00:00
Fixed Errors for Phrases, Recordings, Operator Panel and Music on Hold. (#6735)
This commit is contained in:
@@ -46,10 +46,14 @@
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//add additional variables
|
||||
$search = $_GET["search"] ?? '';
|
||||
$show = $_GET['show'] ?? '';
|
||||
|
||||
//get the music_on_hold array
|
||||
$sql = "select * from v_music_on_hold ";
|
||||
$sql .= "where true ";
|
||||
if ($_GET['show'] != "all" || !permission_exists('music_on_hold_all')) {
|
||||
if ($show != "all" || !permission_exists('music_on_hold_all')) {
|
||||
$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
}
|
||||
@@ -58,17 +62,17 @@
|
||||
}
|
||||
$sql .= "order by domain_uuid desc, music_on_hold_name asc, music_on_hold_rate asc";
|
||||
$database = new database;
|
||||
$streams = $database->select($sql, $parameters, 'all');
|
||||
$streams = $database->select($sql, $parameters ?? null, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//get the http post data
|
||||
if (is_array($_POST['moh'])) {
|
||||
if (!empty($_POST['moh'])) {
|
||||
$action = $_POST['action'];
|
||||
$moh = $_POST['moh'];
|
||||
}
|
||||
|
||||
//process the http post data by action
|
||||
if ($action != '' && is_array($moh) && @sizeof($moh) != 0) {
|
||||
if (!empty($action) && !empty($moh)) {
|
||||
switch ($action) {
|
||||
case 'delete':
|
||||
if (permission_exists('music_on_hold_delete')) {
|
||||
@@ -82,11 +86,15 @@
|
||||
exit;
|
||||
}
|
||||
|
||||
//get order and order by and sanitize the values
|
||||
$order_by = $_GET["order_by"] ?? '';
|
||||
$order = $_GET["order"] ?? '';
|
||||
|
||||
//download music on hold file
|
||||
if ($_GET['action'] == "download"
|
||||
if (!empty($_GET['action'])
|
||||
&& $_GET['action'] == "download"
|
||||
&& is_uuid($_GET['id'])
|
||||
&& is_array($streams)
|
||||
&& @sizeof($streams) != 0) {
|
||||
&& !empty($streams)) {
|
||||
|
||||
//get the uuid
|
||||
$stream_uuid = $_GET['id'];
|
||||
@@ -148,8 +156,8 @@
|
||||
}
|
||||
|
||||
//upload music on hold file
|
||||
if ($_POST['action'] == 'upload'
|
||||
&& is_array($_FILES)
|
||||
if (!empty($_POST['action']) && $_POST['action'] == 'upload'
|
||||
&& !empty($_FILES)
|
||||
&& is_uploaded_file($_FILES['file']['tmp_name'])
|
||||
) {
|
||||
|
||||
@@ -162,7 +170,7 @@
|
||||
}
|
||||
|
||||
//determine name
|
||||
if ($_POST['name_new'] != '') {
|
||||
if (!empty($_POST['name_new'])) {
|
||||
//set the action
|
||||
$action = 'add';
|
||||
//get the stream_name
|
||||
@@ -174,7 +182,7 @@
|
||||
//get the stream uuid
|
||||
$stream_uuid = $_POST['name'];
|
||||
//find the matching stream
|
||||
if (is_array($streams) && @sizeof($streams) != 0) {
|
||||
if (!empty($streams) && @sizeof($streams) != 0) {
|
||||
foreach ($streams as $row) {
|
||||
if ($stream_uuid == $row['music_on_hold_uuid']) {
|
||||
//set the action
|
||||
@@ -237,7 +245,7 @@
|
||||
|
||||
//find whether the path already exists
|
||||
$stream_new_name = true;
|
||||
if (is_array($streams) && @sizeof($streams) != 0) {
|
||||
if (!empty($streams) && @sizeof($streams) != 0) {
|
||||
foreach ($streams as $row) {
|
||||
$alternate_path = str_replace('$${sounds_dir}', $_SESSION['switch']['sounds']['dir'], $row['music_on_hold_path']);
|
||||
if ($stream_path == $row['music_on_hold_path'] || $stream_path == $alternate_path) {
|
||||
@@ -364,7 +372,7 @@
|
||||
echo " <div class='heading'><b>".$text['title-music_on_hold']."</b></div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
if (permission_exists('music_on_hold_add')) {
|
||||
$modify_add_action = !is_array($streams) || @sizeof($streams) == 0 ? "name_mode('new'); $('#btn_select').hide();" : null; //hide categories select box when none exist
|
||||
$modify_add_action = empty($streams) || @sizeof($streams) == 0 ? "name_mode('new'); $('#btn_select').hide();" : null; //hide categories select box when none exist
|
||||
echo "<form id='form_upload' class='inline' method='post' enctype='multipart/form-data'>\n";
|
||||
echo "<input name='action' type='hidden' value='upload'>\n";
|
||||
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
|
||||
@@ -377,7 +385,7 @@
|
||||
|
||||
if (permission_exists('music_on_hold_domain')) {
|
||||
echo " <optgroup label='".$text['option-global']."'>\n";
|
||||
if (is_array($streams) && @sizeof($streams) != 0) {
|
||||
if (!empty($streams) && @sizeof($streams) != 0) {
|
||||
foreach ($streams as $row) {
|
||||
if (empty($row['domain_uuid'])) {
|
||||
if (empty($row['music_on_hold_rate'])) { $option_name = $row['music_on_hold_name']; }
|
||||
@@ -389,7 +397,7 @@
|
||||
echo " </optgroup>\n";
|
||||
}
|
||||
$local_found = false;
|
||||
if (is_array($streams) && @sizeof($streams) != 0) {
|
||||
if (!empty($streams) && @sizeof($streams) != 0) {
|
||||
foreach ($streams as $row) {
|
||||
if (is_uuid($row['domain_uuid'])) {
|
||||
$local_found = true;
|
||||
@@ -401,7 +409,7 @@
|
||||
if (permission_exists('music_on_hold_domain')) {
|
||||
echo " <optgroup label='".$text['option-local']."'>\n";
|
||||
}
|
||||
if (is_array($streams) && @sizeof($streams) != 0) {
|
||||
if (!empty($streams) && @sizeof($streams) != 0) {
|
||||
foreach ($streams as $row) {
|
||||
if (!empty($row['domain_uuid'])) {
|
||||
if (empty($row['music_on_hold_rate'])) { $option_name = $row['music_on_hold_name']; }
|
||||
@@ -424,7 +432,7 @@
|
||||
echo " <option value='32000'>32 kHz</option>\n";
|
||||
echo " <option value='48000'>48 kHz</option>\n";
|
||||
echo "</select>";
|
||||
echo button::create(['type'=>'button','title'=>$text['label-new'],'icon'=>$_SESSION['theme']['button_icon_add'],'id'=>'btn_new','onclick'=>"name_mode('new');"]);
|
||||
echo button::create(['type'=>'button','title'=>!empty($text['label-new']),'icon'=>$_SESSION['theme']['button_icon_add'],'id'=>'btn_new','onclick'=>"name_mode('new');"]);
|
||||
echo button::create(['type'=>'button','title'=>$text['label-select'],'icon'=>'list','id'=>'btn_select','style'=>'display: none;','onclick'=>"name_mode('select');"]);
|
||||
//file
|
||||
echo "<input type='text' class='txt' style='width: 100px; cursor: pointer;' id='filename' placeholder='Select...' onclick=\"document.getElementById('file').click(); this.blur();\" onfocus='this.blur();'>";
|
||||
@@ -436,11 +444,11 @@
|
||||
echo "</form>";
|
||||
}
|
||||
if (permission_exists('music_on_hold_all')) {
|
||||
if ($_GET['show'] == 'all') {
|
||||
if ($show == 'all') {
|
||||
echo " <input type='hidden' name='show' value='all'>";
|
||||
}
|
||||
else {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-show_all'],'icon'=>$_SESSION['theme']['button_icon_all'],'link'=>'?type=&show=all'.($search != '' ? "&search=".urlencode($search) : null)]);
|
||||
echo button::create(['type'=>'button','label'=>$text['button-show_all'],'icon'=>$_SESSION['theme']['button_icon_all'],'link'=>'?type=&show=all'.(!empty($search) ? "&search=".urlencode($search) : null)]);
|
||||
}
|
||||
}
|
||||
if (permission_exists('music_on_hold_delete') && $streams) {
|
||||
@@ -461,7 +469,7 @@
|
||||
echo "<input type='hidden' id='action' name='action' value=''>\n";
|
||||
|
||||
//show the array of data
|
||||
if (is_array($streams) && @sizeof($streams) != 0) {
|
||||
if (!empty($streams) && @sizeof($streams) != 0) {
|
||||
$previous_name = '';
|
||||
|
||||
//loop through the array
|
||||
@@ -493,7 +501,7 @@
|
||||
$stream_icons[$i]['title'] = $text['label-shuffle'];
|
||||
$i++;
|
||||
}
|
||||
if ($row['music_on_hold_chime_list'] != '') {
|
||||
if (!empty($row['music_on_hold_chime_list'])) {
|
||||
$stream_icons[$i]['icon'] = 'fa-bell';
|
||||
$stream_icons[$i]['title'] = $text['label-chime_list'].': '.$row['music_on_hold_chime_list'];
|
||||
$i++;
|
||||
@@ -504,9 +512,10 @@
|
||||
$stream_icons[$i]['margin'] = 6;
|
||||
$i++;
|
||||
}
|
||||
if (is_array($stream_icons) && sizeof($stream_icons) > 0) {
|
||||
if (!empty($stream_icons)) {
|
||||
$icons = '';
|
||||
foreach ($stream_icons as $stream_icon) {
|
||||
$icons .= "<span class='fas ".$stream_icon['icon']." icon_body' title='".escape($stream_icon['title'])."' style='width: 12px; height: 12px; margin-left: ".($stream_icon['margin'] != '' ? $stream_icon['margin'] : 8)."px; vertical-align: text-top; cursor: help;'></span>";
|
||||
$icons .= "<span class='fas ".$stream_icon['icon']." icon_body' title='".escape($stream_icon['title'])."' style='width: 12px; height: 12px; margin-left: ".(!empty($stream_icon['margin']) ? $stream_icon['margin'] : 8)."px; vertical-align: text-top; cursor: help;'></span>";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -534,8 +543,8 @@
|
||||
echo " <input type='hidden' id='checkbox_all_".$row['music_on_hold_uuid']."_hidden' name='moh[".$row['music_on_hold_uuid']."][checked]'>\n";
|
||||
echo " </th>\n";
|
||||
}
|
||||
if ($_GET['show'] == "all" && permission_exists('music_on_hold_all')) {
|
||||
echo th_order_by('domain_name', $text['label-domain'], $order_by, $order, $param, "class='shrink'");
|
||||
if ($show == "all" && permission_exists('music_on_hold_all')) {
|
||||
echo th_order_by('domain_name', $text['label-domain'], $order_by, $order, $param ?? null, "class='shrink'");
|
||||
}
|
||||
echo " <th class='pct-50'>".$stream_details."</th>\n";
|
||||
echo " <th class='center shrink'>".$text['label-tools']."</th>\n";
|
||||
@@ -545,7 +554,7 @@
|
||||
unset($stream_icons, $icons);
|
||||
|
||||
//list the stream files
|
||||
if (is_array($stream_files) && @sizeof($stream_files) != 0) {
|
||||
if (!empty($stream_files)) {
|
||||
foreach ($stream_files as $stream_file_path) {
|
||||
$row_uuid = uuid();
|
||||
$stream_file = pathinfo($stream_file_path, PATHINFO_BASENAME);
|
||||
@@ -568,7 +577,7 @@
|
||||
echo " <input type='hidden' name='moh[".$row['music_on_hold_uuid']."][$x][file_name]' value=\"".escape($stream_file)."\" />\n";
|
||||
echo " </td>\n";
|
||||
}
|
||||
if ($_GET['show'] == "all" && permission_exists('music_on_hold_all')) {
|
||||
if ($show == "all" && permission_exists('music_on_hold_all')) {
|
||||
if (!empty($_SESSION['domains'][$row['domain_uuid']]['domain_name'])) {
|
||||
$domain = $_SESSION['domains'][$row['domain_uuid']]['domain_name'];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user