Fixed call recording download and call center show all (#6745)

This commit is contained in:
Alex
2023-06-06 10:14:15 -06:00
committed by GitHub
parent 21fc42f12a
commit f86abd84c4
6 changed files with 23 additions and 27 deletions

View File

@@ -559,7 +559,7 @@
//add an empty row to the tiers array
if (count($tiers) == 0) {
$rows = $_SESSION['call_center']['agent_add_rows']['numeric'];
$rows = $_SESSION['call_center']['agent_add_rows']['numeric'] ?? null;
$id = 0;
}
if (count($tiers) > 0) {

View File

@@ -53,14 +53,14 @@
$list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false';
//get posted data
if (!empty($_POST['call_center_queues'])) {
if (!empty($_POST['call_center_queues']) && is_array($_POST['call_center_queues'])) {
$action = $_POST['action'];
$search = $_POST['search'];
$call_center_queues = $_POST['call_center_queues'];
}
//process the http post data by action
if (!empty($action) && !empty($call_center_queues)) {
if (!empty($action) && is_array($call_center_queues) && @sizeof($call_center_queues) != 0) {
switch ($action) {
case 'copy':
if (permission_exists('call_center_queue_add')) {
@@ -97,7 +97,7 @@
//get total call center queues count from the database
$sql = "select count(*) from v_call_center_queues ";
$sql .= "where true ";
if (!empty($_GET['show']) && $_GET['show'] != "all" || !permission_exists('call_center_all')) {
if ($show != "all" || !permission_exists('call_center_all')) {
$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
}

View File

@@ -85,7 +85,7 @@
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$parameters['extension_uuid'] = $extension_uuid;
$database = new database;
$row = $database->select($sql, $parameters ?? null, 'row');
$row = $database->select($sql, $parameters, 'row');
if (!empty($row)) {
$extension = $row["extension"];
$number_alias = $row["number_alias"];
@@ -478,7 +478,7 @@
$sql .= "order by follow_me_order asc ";
$parameters['follow_me_uuid'] = $follow_me_uuid;
$database = new database;
$result = $database->select($sql, $parameters ?? null, 'all');
$result = $database->select($sql, $parameters, 'all');
unset($destinations);
foreach ($result as $x => &$row) {
@@ -507,7 +507,7 @@
$sql .= "order by extension, number_alias asc ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$database = new database;
$extensions = $database->select($sql, $parameters ?? null, 'all');
$extensions = $database->select($sql, $parameters, 'all');
unset($sql, $parameters, $row);
//set the default
@@ -517,7 +517,7 @@
}
//prepare the autocomplete
if(!empty($_SESSION['follow_me']['follow_me_autocomplete']['boolean']) == 'true') {
if(!empty($_SESSION['follow_me']['follow_me_autocomplete']['boolean']) && $_SESSION['follow_me']['follow_me_autocomplete']['boolean'] == 'true') {
echo "<link rel=\"stylesheet\" href=\"".PROJECT_PATH."/resources/jquery/jquery-ui.min.css\" />\n";
echo "<script src=\"".PROJECT_PATH."/resources/jquery/jquery-ui.min.js\"></script>\n";
echo "<script type=\"text/javascript\">\n";
@@ -754,7 +754,7 @@
echo "</table>";
echo "<br /><br />";
if (!empty($action) == "update") {
if (!empty($action) && $action == "update") {
echo "<input type='hidden' name='id' value='".escape($extension_uuid)."'>\n";
}
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";

View File

@@ -51,14 +51,14 @@
$show = $_GET["show"] ?? '';
//get the http post data
if (!empty($_POST['call_recordings'])) {
if (!empty($_POST['call_recordings']) && is_array($_POST['call_recordings'])) {
$action = $_POST['action'];
$search = $_POST['search'];
$call_recordings = $_POST['call_recordings'];
}
//process the http post data by action
if (!empty($action) && !empty($call_recordings)) {
if (!empty($action) && is_array($call_recordings) && @sizeof($call_recordings) != 0) {
switch ($action) {
case 'delete':
if (permission_exists('call_recording_delete')) {
@@ -148,10 +148,10 @@
unset($sql, $parameters);
//count the results
$result_count = !empty($call_recordings) ? sizeof($call_recordings) : 0;
$result_count = is_array($call_recordings) ? sizeof($call_recordings) : 0;
//limit the number of results
if ($_SESSION['cdr']['limit']['numeric'] > 0) {
if (!empty($_SESSION['cdr']['limit']['numeric']) && $_SESSION['cdr']['limit']['numeric'] > 0) {
$num_rows = $_SESSION['cdr']['limit']['numeric'];
}
@@ -160,8 +160,8 @@
if ($show == "all" && permission_exists('call_recording_all')) {
$param .= "&show=all";
}
list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true, $result_count); //top
list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page, false, $result_count); //bottom
list($paging_controls_mini, $rows_per_page) = paging($num_rows ?? null, $param, $rows_per_page, true, $result_count); //top
list($paging_controls, $rows_per_page) = paging($num_rows ?? null, $param, $rows_per_page, false, $result_count); //bottom
//create token
$object = new token;
@@ -187,7 +187,7 @@
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='.urlencode($destination_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='.urlencode($destination_type ?? '').'&show=all'.(!empty($search) ? "&search=".urlencode($search) : null)]);
}
}
echo "<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search)."\" placeholder=\"".$text['label-search']."\" onkeydown=\"$('#btn_reset').hide(); $('#btn_search').show();\">";
@@ -244,7 +244,7 @@
}
echo "</tr>\n";
if (!empty($call_recordings)) {
if (is_array($call_recordings) && @sizeof($call_recordings) != 0) {
$x = 0;
foreach ($call_recordings as $row) {
//playback progress bar
@@ -262,7 +262,7 @@
echo " <input type='hidden' name='call_recordings[$x][uuid]' value='".escape($row['call_recording_uuid'])."' />\n";
echo " </td>\n";
}
if (!empty($_GET['show']) && $_GET['show'] == "all" && permission_exists('call_recording_all')) {
if ($show == "all" && permission_exists('call_recording_all')) {
echo " <td class='overflow hide-sm-dn shrink'>".escape($row['domain_name'])."</td>\n";
}
echo " <td class='hide-sm-dn shrink'>".escape($row['caller_id_name'])."</td>\n";

View File

@@ -160,15 +160,11 @@ if (!class_exists('call_recordings')) {
unset($sql, $parameters, $row);
}
//set the path for the directory
// $default_path = $_SESSION['switch']['call_recordings']['dir']."/".$_SESSION['domain_name'];
//build full path
$full_recording_path = $call_recording_path.'/'.$call_recording_name;
//download the file
if ($full_recording_path != '/' && file_exists($full_recording_path)) {
// ob_clean();
$fd = fopen($full_recording_path, "rb");
if ($this->binary) {
header("Content-Type: application/force-download");
@@ -190,8 +186,8 @@ if (!class_exists('call_recordings')) {
if ($this->binary) {
header("Content-Length: ".filesize($full_recording_path));
}
// ob_clean();
// fpassthru($fd);
ob_clean();
fpassthru($fd);
//content-range
if (isset($_SERVER['HTTP_RANGE']) && !$this->binary) {
@@ -303,4 +299,4 @@ if (!class_exists('call_recordings')) {
} //class
}
?>
?>

View File

@@ -104,7 +104,7 @@ class cache {
}
//cache method memcache
if ($_SESSION['cache']['method']['text'] == "memcache") {
if (!empty($_SESSION['cache']['method']['text']) && $_SESSION['cache']['method']['text'] == "memcache") {
//connect to event socket
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if ($fp === false) {
@@ -128,7 +128,7 @@ class cache {
}
//cache method file
if ($_SESSION['cache']['method']['text'] == "file") {
if (!empty($_SESSION['cache']['method']['text']) && $_SESSION['cache']['method']['text'] == "file") {
//change the delimiter
$key = str_replace(":", ".", $key);