diff --git a/app/xml_cdr/app_languages.php b/app/xml_cdr/app_languages.php index 3a04c52f8c..2432becda1 100644 --- a/app/xml_cdr/app_languages.php +++ b/app/xml_cdr/app_languages.php @@ -60,6 +60,26 @@ $text['title']['ru-ru'] = "Детализация Вызовов"; $text['title']['sv-se'] = "Detaljerad Samtalsinformation"; $text['title']['uk-ua'] = "Параметри облікового запису"; +$text['title-call_detail_records']['en-us'] = "Call Detail Records"; +$text['title-call_detail_records']['ar-eg'] = ""; +$text['title-call_detail_records']['de-at'] = "Meine Gespräche"; //copied from de-de +$text['title-call_detail_records']['de-ch'] = "Meine Gespräche"; //copied from de-de +$text['title-call_detail_records']['de-de'] = "Meine Gespräche"; +$text['title-call_detail_records']['es-cl'] = "Registro de Detalle de Llamadas"; +$text['title-call_detail_records']['es-mx'] = "Registro de Detalle de Llamadas"; //copied from es-cl +$text['title-call_detail_records']['fr-ca'] = "Historique détaillé des appels"; //copied from fr-fr +$text['title-call_detail_records']['fr-fr'] = "Historique détaillé des appels"; +$text['title-call_detail_records']['he-il'] = ""; +$text['title-call_detail_records']['it-it'] = "Cartellini di Chiamata"; +$text['title-call_detail_records']['nl-nl'] = ""; +$text['title-call_detail_records']['pl-pl'] = "Wykaz rozmów"; +$text['title-call_detail_records']['pt-br'] = "Configurações da Conta"; +$text['title-call_detail_records']['pt-pt'] = "Registo de Chamadas"; +$text['title-call_detail_records']['ro-ro'] = ""; +$text['title-call_detail_records']['ru-ru'] = "Детализация Вызовов"; +$text['title-call_detail_records']['sv-se'] = "Detaljerad Samtalsinformation"; +$text['title-call_detail_records']['uk-ua'] = "Параметри облікового запису"; + $text['title-archive']['en-us'] = "Call Detail Records Archive"; $text['title-archive']['ar-eg'] = ""; $text['title-archive']['de-at'] = "Meine Gespräche Archiv"; //copied from de-de @@ -2340,6 +2360,26 @@ $text['label-seconds']['ru-ru'] = "Sec"; $text['label-seconds']['sv-se'] = "Sec"; $text['label-seconds']['uk-ua'] = "Sec"; +$text['label-format']['en-us'] = "Format"; +$text['label-format']['ar-eg'] = "Format"; +$text['label-format']['de-at'] = "Format"; +$text['label-format']['de-ch'] = "Format"; +$text['label-format']['de-de'] = "Format"; +$text['label-format']['es-cl'] = "Format"; +$text['label-format']['es-mx'] = "Format"; +$text['label-format']['fr-ca'] = "Format"; +$text['label-format']['fr-fr'] = "Format"; +$text['label-format']['he-il'] = "Format"; +$text['label-format']['it-it'] = "Format"; +$text['label-format']['nl-nl'] = "Format"; +$text['label-format']['pl-pl'] = "Format"; +$text['label-format']['pt-br'] = "Format"; +$text['label-format']['pt-pt'] = "Format"; +$text['label-format']['ro-ro'] = "Format"; +$text['label-format']['ru-ru'] = "Format"; +$text['label-format']['sv-se'] = "Format"; +$text['label-format']['uk-ua'] = "Format"; + $text['description_search']['en-us'] = "Note: Destination and Caller ID (CID) Name fields support the use of an asterisk ('*') as a wildcard character."; $text['description_search']['ar-eg'] = ""; $text['description_search']['de-at'] = "Info: Ziel und Anruferkennung (CID) Namesfelder unterstützen die Verwendung von Stern ('*') als Wildcard Zeichen."; //copied from de-de diff --git a/app/xml_cdr/resources/classes/xml_cdr.php b/app/xml_cdr/resources/classes/xml_cdr.php index 74e0912a91..2adae85fe1 100644 --- a/app/xml_cdr/resources/classes/xml_cdr.php +++ b/app/xml_cdr/resources/classes/xml_cdr.php @@ -50,6 +50,16 @@ if (!class_exists('xml_cdr')) { public $include_internal; public $extensions; + /** + * delete method + */ + private $app_name; + private $app_uuid; + private $permission_prefix; + private $list_page; + private $table; + private $uuid_prefix; + /** * Called when the object is created */ @@ -61,6 +71,14 @@ if (!class_exists('xml_cdr')) { $database->connect(); $this->db = $database->db; } + + //assign private variables (for delete method) + $this->app_name = 'xml_cdr'; + $this->app_uuid = '4a085c51-7635-ff03-f67b-86e834422848'; + $this->permission_prefix = 'xml_cdr_'; + $this->list_page = 'xml_cdr.php'; + $this->table = 'xml_cdr'; + $this->uuid_prefix = 'xml_cdr_'; } /** @@ -1104,6 +1122,82 @@ if (!class_exists('xml_cdr')) { } } //end download method + /** + * delete records + */ + public function delete($records) { + if (permission_exists($this->permission_prefix.'delete')) { + + //add multi-lingual support + $language = new text; + $text = $language->get(); + + //validate the token + $token = new token; + if (!$token->validate($_SERVER['PHP_SELF'])) { + message::add($text['message-invalid_token'],'negative'); + header('Location: '.$this->list_page); + exit; + } + + //delete multiple records + if (is_array($records) && @sizeof($records) != 0) { + $records_deleted = 0; + + //loop through records + foreach($records as $x => $record) { + if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { + + //get the call recordings + $sql = "select * from v_call_recordings "; + $sql .= "where call_recording_uuid = :xml_cdr_uuid "; + $parameters['xml_cdr_uuid'] = $record['uuid']; + $database = new database; + $row = $database->select($sql, $parameters, 'row'); + unset($sql, $parameters); + + //delete the call recording (file) + $call_recording_path = realpath($row['call_recording_path']); + $call_recording_name = $row['call_recording_name']; + if (file_exists($call_recording_path.'/'.$call_recording_name)) { + @unlink($call_recording_path.'/'.$call_recording_name); + } + + //build the delete array + $array[$this->table][$x][$this->uuid_prefix.'uuid'] = $record['uuid']; + $array[$this->table][$x]['domain_uuid'] = $_SESSION['domain_uuid']; + $array['call_recordings'][$x]['call_recording_uuid'] = $record['uuid']; + + //increment counter + $records_deleted++; + } + } + + //delete the checked rows + if (is_array($array) && @sizeof($array) != 0) { + + //grant temporary permissions + $p = new permissions; + $p->add('call_recording_delete', 'temp'); + + //execute delete + $database = new database; + $database->app_name = $this->app_name; + $database->app_uuid = $this->app_uuid; + $database->delete($array); + unset($array); + + //revoke temporary permissions + $p->delete('call_recording_delete', 'temp'); + + //set message + message::add($text['message-delete'].": ".$records_deleted); + } + unset($records); + } + } + } + } //end the class } /* diff --git a/app/xml_cdr/xml_cdr.php b/app/xml_cdr/xml_cdr.php index aa5e90a559..7e123f56a2 100644 --- a/app/xml_cdr/xml_cdr.php +++ b/app/xml_cdr/xml_cdr.php @@ -29,6 +29,7 @@ require_once "root.php"; require_once "resources/require.php"; require_once "resources/check_auth.php"; + require_once "resources/paging.php"; //check permisions if (permission_exists('xml_cdr_view')) { @@ -43,9 +44,30 @@ $language = new text; $text = $language->get(); +//get posted data + if (is_array($_POST['xml_cdrs'])) { + $action = $_POST['action']; + $xml_cdrs = $_POST['xml_cdrs']; + } + +//delete the cdr + if (permission_exists('xml_cdr_delete')) { + if ($action == 'delete' && is_array($xml_cdrs) && @sizeof($xml_cdrs) != 0) { + //delete + $obj = new xml_cdr; + $obj->delete($xml_cdrs); + //redirect + header('Location: xml_cdr.php'); + exit; + } + } + +//create token + $object = new token; + $token = $object->create($_SERVER['PHP_SELF']); + //additional includes require_once "resources/header.php"; - require_once "resources/paging.php"; //xml cdr include $rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50; @@ -72,16 +94,15 @@ echo " function toggle_select(select_id) {"; echo " $('#'+select_id).fadeToggle(fade_speed, function() {"; echo " document.getElementById(select_id).selectedIndex = 0;"; + echo " document.getElementById(select_id).focus();"; echo " });"; echo " }"; echo ""; //page title and description - echo "
| ".$text['title']." | \n";
- echo "\n"; - echo " | \n"; - echo "
| "; + echo " | \n"; + echo " \n"; + echo " | \n"; $col_count++; } @@ -483,7 +499,7 @@ $col_count++; } if (permission_exists('xml_cdr_caller_id_name')) { - echo "".$text['label-caller_id_name']." | \n"; + echo "\n"; $col_count++; } if (permission_exists('xml_cdr_caller_id_number')) { @@ -491,7 +507,7 @@ $col_count++; } if (permission_exists('xml_cdr_caller_destination')) { - echo "".$text['label-caller_destination']." | \n"; + echo "\n"; $col_count++; } if (permission_exists('xml_cdr_destination')) { @@ -499,7 +515,7 @@ $col_count++; } if (permission_exists('xml_cdr_recording') && (permission_exists('recording_play') || permission_exists('recording_download'))) { - echo "".$text['label-recording']." | \n"; + echo "".$text['label-recording']." | \n"; $col_count++; } if (permission_exists('xml_cdr_custom_fields')) { @@ -510,34 +526,34 @@ $field_label = ucwords(str_replace("_", " ", $field_name)); $field_label = str_replace("Sip", "SIP", $field_label); if ($field_name != "destination_number") { - echo "".$field_label." | \n"; + echo "".$field_label." | \n"; $col_count++; } } } } if (permission_exists('xml_cdr_start')) { - echo "".$text['label-start']." | \n"; + echo "".$text['label-start']." | \n"; $col_count++; } if (permission_exists('xml_cdr_tta')) { - echo "".$text['label-tta']." | \n"; + echo "\n"; $col_count++; } if (permission_exists('xml_cdr_duration')) { - echo "".$text['label-duration']." | \n"; + echo "\n"; $col_count++; } if (permission_exists('xml_cdr_pdd')) { - echo "".$text['label-pdd']." | \n"; + echo "\n"; $col_count++; } if (permission_exists('xml_cdr_mos')) { - echo "".$text['label-mos']." | \n"; + echo "\n"; $col_count++; } if (permission_exists('xml_cdr_hangup_cause')) { - echo "".$text['label-hangup_cause']." | \n"; + echo "\n"; $col_count++; } else { @@ -545,16 +561,13 @@ $col_count++; } if (permission_exists('xml_cdr_details')) { - echo ""; - if (permission_exists('xml_cdr_delete') && $result_count > 0) { - echo "".$v_link_label_delete.""; - } - echo " | \n"; + echo "\n"; } echo " | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| "; - $content .= " "; - $content .= " "; - $content .= " | "; - $xml_ids[] = 'checkbox_'.$row['xml_cdr_uuid']; + $content .= "\n"; + $content .= " \n"; + $content .= " \n"; + $content .= " | \n"; } //determine call result and appropriate icon if (permission_exists('xml_cdr_direction')) { - $content .= "\n"; + $content .= " | \n"; if ($theme_cdr_images_exist) { if ($row['direction'] == 'inbound' || $row['direction'] == 'local') { if ($row['answer_stamp'] != '' && $row['bridge_uuid'] != '') { $call_result = 'answered'; } @@ -653,23 +663,23 @@ } //extension if (permission_exists('xml_cdr_extension')) { - $content .= " | "; + $content .= " | "; $content .= $row['extension'].' '; $content .= " | \n"; } //domain name if (permission_exists('xml_cdr_all') && $_REQUEST['show'] == "all") { - $content .= ""; + $content .= " | "; $content .= $row['domain_name'].' '; $content .= " | \n"; } //caller id name if (permission_exists('xml_cdr_caller_id_name')) { - $content .= "".escape(substr($row['caller_id_name'], 0, 20))." | \n"; + $content .= " \n"; } //source if (permission_exists('xml_cdr_caller_id_number')) { - $content .= ""; + $content .= " | "; $content .= " \n"; if (is_numeric($row['caller_id_number'])) { $content .= " ".format_phone(substr($row['caller_id_number'], 0, 20)).' '; @@ -682,7 +692,7 @@ } //caller destination if (permission_exists('xml_cdr_caller_destination')) { - $content .= " | "; + $content .= " | "; + $content .= " | "; $content .= " \n"; if (is_numeric($row['destination_number'])) { if ($prefix) { @@ -744,22 +754,18 @@ //recording if (permission_exists('xml_cdr_recording') && (permission_exists('recording_play') || permission_exists('recording_download'))) { if ($record_path != '' && file_exists($record_path.'/'.$record_name)) { - $content .= " | "; + $content .= " | "; if (permission_exists('recording_play')) { $content .= ""; - $content .= ""; - } - else { - //needs a translation - $content .= "Don't have recording_play permission "; + $content .= button::create(['type'=>'button','label'=>$text['button-label'],'icon'=>$_SESSION['theme']['button_icon_play'],'id'=>'recording_button_'.escape($row['xml_cdr_uuid']),'onclick'=>"recording_play('".escape($row['xml_cdr_uuid'])."')",'title'=>$text['label-play'].' / '.$text['label-pause']]); } if (permission_exists('recording_download')) { - $content .= "".$v_link_label_download.""; + $content .= button::create(['type'=>'button','title'=>$text['button-download'],'icon'=>$_SESSION['theme']['button_icon_download'],'link'=>"download.php?id=".urlencode($row['xml_cdr_uuid'])."&t=bin"]); } - $content .= " | \n"; + $content .= "\n"; } else { - $content .= "\n"; + $content .= " | \n"; } } //custom cdr fields @@ -769,26 +775,26 @@ $array = explode(",", $field); $field_name = $array[count($array) - 1]; if ($field_name != "destination_number") { - $content .= " | ".escape($row[$field_name])." | \n"; + $content .= "".escape($row[$field_name])." | \n"; } } } } //start if (permission_exists('xml_cdr_start')) { - $content .= "".escape($tmp_start_epoch)." | \n"; + $content .= "".$tmp_start_epoch." | \n"; } //tta (time to answer) if (permission_exists('xml_cdr_tta')) { - $content .= "".(($row['tta'] > 0) ? $row['tta']."s" : " ")." | \n"; + $content .= " \n"; } //duration if (permission_exists('xml_cdr_duration')) { - $content .= "".gmdate("G:i:s", $seconds)." | \n"; + $content .= " \n"; } //pdd (post dial delay) if (permission_exists("xml_cdr_pdd")) { - $content .= "".number_format(escape($row['pdd_ms'])/1000,2)."s | \n"; + $content .= " \n"; } //mos (mean opinion score) if (permission_exists("xml_cdr_mos")) { @@ -796,24 +802,19 @@ $title = " title='".$text['label-mos_score-'.round($row['rtp_audio_in_mos'])]."'"; $value = $row['rtp_audio_in_mos']; } - $content .= "$value | \n"; + $content .= " \n"; } //hangup cause/call result if (permission_exists('xml_cdr_hangup_cause')) { - $content .= "".escape($hangup_cause)." | \n"; + $content .= " \n"; } else { - $content .= "".ucwords(escape($call_result))." | \n"; + $content .= " \n"; } - //control icons + //action icon if (permission_exists('xml_cdr_details')) { - $content .= ""; - if ($tr_link != null) { - $content .= " ".$v_link_label_view.""; - } - if (permission_exists('xml_cdr_delete')) { - $content .= "".$v_link_label_delete.""; - } + $content .= " | "; + $content .= button::create(['type'=>'button','title'=>$text['button-view'],'icon'=>$_SESSION['theme']['button_icon_view'],'link'=>$list_row_url]); $content .= " | \n"; } $content .= "