diff --git a/app/call_recordings/call_recordings.php b/app/call_recordings/call_recordings.php index b60f5430b3..d597987e49 100644 --- a/app/call_recordings/call_recordings.php +++ b/app/call_recordings/call_recordings.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) 2018 - 2022 + Portions created by the Initial Developer are Copyright (C) 2018 - 2023 the Initial Developer. All Rights Reserved. Contributor(s): @@ -190,9 +190,9 @@ 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 ""; - echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search','collapse'=>'hide-xs']); - echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'call_recordings.php','style'=>($search == '' ? 'display: none;' : null),'collapse'=>'hide-xs']); + echo ""; + echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search','style'=>(!empty($search) ? 'display: none;' : null),'collapse'=>'hide-xs']); + echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'call_recordings.php','style'=>(empty($search) ? 'display: none;' : null),'collapse'=>'hide-xs']); if (!empty($paging_controls_mini)) { echo "".$paging_controls_mini."\n"; } @@ -214,13 +214,13 @@ echo "\n"; echo "\n"; - $col_count = 7; + $col_count = 8; if ($show == "all" && permission_exists('call_recording_all')) { $col_count++; } if (permission_exists('call_recording_delete')) { echo " \n"; $col_count++; } diff --git a/app/call_recordings/resources/classes/call_recordings.php b/app/call_recordings/resources/classes/call_recordings.php index 65373c6178..f1725c79d0 100644 --- a/app/call_recordings/resources/classes/call_recordings.php +++ b/app/call_recordings/resources/classes/call_recordings.php @@ -1,4 +1,28 @@ + Portions created by the Initial Developer are Copyright (C) 2018 - 2023 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Mark J Crane +*/ /** * call_recordings class @@ -57,7 +81,7 @@ if (!class_exists('call_recordings')) { $x = 0; foreach ($records as $record) { //add to the array - if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { + if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) { //get the information to delete $sql = "select call_recording_name, call_recording_path "; $sql .= "from view_call_recordings "; @@ -118,7 +142,7 @@ if (!class_exists('call_recordings')) { //get call recording from database if (is_uuid($this->recording_uuid)) { $sql = "select call_recording_name, call_recording_path "; - if ($_SESSION['call_recordings']['storage_type']['text'] == 'base64' && $row['call_recording_base64'] != '') { + if (!empty($_SESSION['call_recordings']['storage_type']['text']) && $_SESSION['call_recordings']['storage_type']['text'] == 'base64' && $row['call_recording_base64'] != '') { $sql = ", call_recording_base64 "; } $sql .= "from view_call_recordings "; @@ -129,7 +153,7 @@ if (!class_exists('call_recordings')) { if (is_array($row) && @sizeof($row) != 0) { $call_recording_name = $row['call_recording_name']; $call_recording_path = $row['call_recording_path']; - if ($_SESSION['call_recordings']['storage_type']['text'] == 'base64' && $row['call_recording_base64'] != '') { + if (!empty($_SESSION['call_recordings']['storage_type']['text']) && $_SESSION['call_recordings']['storage_type']['text'] == 'base64' && $row['call_recording_base64'] != '') { file_put_contents($path.'/'.$call_recording_name, base64_decode($row['call_recording_base64'])); } } @@ -137,18 +161,14 @@ if (!class_exists('call_recordings')) { } //set the path for the directory - $default_path = $_SESSION['switch']['call_recordings']['dir']."/".$_SESSION['domain_name']; +// $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 (file_exists($full_recording_path)) { - //content-range - if (isset($_SERVER['HTTP_RANGE']) && !$this->binary) { - $this->range_download($full_recording_path); - } - ob_clean(); + 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"); @@ -170,12 +190,17 @@ 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) { + $this->range_download($full_recording_path); + } } //if base64, remove temp recording file - if ($_SESSION['call_recordings']['storage_type']['text'] == 'base64' && $row['call_recording_base64'] != '') { + if (!empty($_SESSION['call_recordings']['storage_type']['text']) && $_SESSION['call_recordings']['storage_type']['text'] == 'base64' && $row['call_recording_base64'] != '') { @unlink($full_recording_path); } } @@ -204,7 +229,7 @@ if (!class_exists('call_recordings')) { * (mediatype = mimetype) * as well as a boundry header to indicate the various chunks of data. */ - header("Accept-Ranges: 0-$length"); + header("Accept-Ranges: 0-".$length); // header('Accept-Ranges: bytes'); // multipart/byteranges // http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.2 @@ -227,7 +252,7 @@ if (!class_exists('call_recordings')) { // If the range starts with an '-' we start from the beginning // If not, we forward the file pointer // And make sure to get the end byte if spesified - if ($range0 == '-') { + if ($range[0] == '-') { // The n-number of the last bytes is requested $c_start = $size - substr($range, 1); } @@ -278,4 +303,4 @@ if (!class_exists('call_recordings')) { } //class } -?> +?> \ No newline at end of file
\n"; - echo " \n"; + echo " \n"; echo "