From 1b57fbb9925d6fb0546e52a91d83606919e89e88 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Thu, 14 Sep 2017 14:41:34 -0500 Subject: [PATCH] Update call_recordings.php --- .../resources/classes/call_recordings.php | 74 ++++++++++++++++++- 1 file changed, 70 insertions(+), 4 deletions(-) diff --git a/app/call_recordings/resources/classes/call_recordings.php b/app/call_recordings/resources/classes/call_recordings.php index fac920cbf4..f6c57a86f9 100644 --- a/app/call_recordings/resources/classes/call_recordings.php +++ b/app/call_recordings/resources/classes/call_recordings.php @@ -37,8 +37,7 @@ if (!class_exists('call_recordings')) { * download the recordings */ public function download() { - -// if (permission_exists('call_recording_play') || permission_exists('call_recording_download')) { + if (permission_exists('call_recording_play') || permission_exists('call_recording_download')) { //cache limiter session_cache_limiter('public'); @@ -110,8 +109,75 @@ if (!class_exists('call_recordings')) { if ($_SESSION['call_recordings']['storage_type']['text'] == 'base64' && $row['call_recording_base64'] != '') { @unlink($full_recording_path); } -// } + } } //end download method + + /** + * download the recordings + */ + public function delete($id) { + if (permission_exists('call_recording_delete')) { + + //cache limiter + session_cache_limiter('public'); + + //delete single call recording + if (isset($id) && is_uuid($id)) { + $sql = "delete from v_call_recordings "; + $sql .= "where call_recording_uuid = '".$id."'; "; + $db->query($sql); + unset($sql); + } + + //delete multiple call recordings + if (is_array($id)) { + //set the array + $call_recordings = $id; + //debug info + //echo "
\n";
+							//print_r($call_recordings);
+							//echo "
\n"; + //get the action + foreach($call_recordings as $row) { + if ($row['action'] == 'delete') { + $action = 'delete'; + break; + } + } + //delete the checked rows + if ($action == 'delete') { + foreach($call_recordings as $row) { + if ($row['checked'] == 'true') { + //delete call recordings + $sql = "delete from v_call_recordings "; + $sql .= "where call_recording_uuid = '".$row['call_recording_uuid']."'; "; + $db->query($sql); + unset($sql); + + //get the information to delete + $sql = "select call_recording_name, call_recording_path from v_call_recordings "; + $sql .= "where call_recording_uuid = '".$row['call_recording_uuid']."' "; + //$sql .= "and domain_uuid = '".$domain_uuid."' \n"; + $prep_statement = $this->db->prepare(check_sql($sql)); + $prep_statement->execute(); + $call_recordings = $prep_statement->fetchAll(PDO::FETCH_ASSOC); + if (is_array($call_recordings)) { + foreach($call_recordings as &$row) { + if (file_exists($row['call_recording_path'].'/'.$row['call_recording_name'])) { + unlink($row['call_recording_path'].'/'.$row['call_recording_name']); + } + exit; + } + } + unset ($sql, $prep_statement, $id, $call_recordings); + + } + } + } + } + } + } //end the delete function + } //end the class } @@ -120,4 +186,4 @@ $obj = new call_recordings; $obj->download('all'); */ -?> \ No newline at end of file +?>