diff --git a/app/bridges/bridges.php b/app/bridges/bridges.php index 1b005e1e91..4e653b8cdc 100644 --- a/app/bridges/bridges.php +++ b/app/bridges/bridges.php @@ -31,8 +31,12 @@ require_once "resources/paging.php"; //check permissions - if (!permission_exists('bridge_view')) { - echo "access denied"; exit; + if (permission_exists('bridge_view')) { + //access granted + } + else { + echo "access denied"; + exit; } //add multi-lingual support diff --git a/app/calls_active/app_languages.php b/app/calls_active/app_languages.php index d0dbe2e9c5..75181d27ca 100644 --- a/app/calls_active/app_languages.php +++ b/app/calls_active/app_languages.php @@ -561,6 +561,26 @@ $text['confirm-hangup']['ru-ru'] = "Вы действительно хотите $text['confirm-hangup']['sv-se'] = "Vill du verkligen avsluta detta samtal"; $text['confirm-hangup']['uk-ua'] = "Ви дійсно бажаєте розірвати дзвінок?"; +$text['confirm-hangups']['en-us'] = "Do you really want to hangup these calls?"; +$text['confirm-hangups']['ar-eg'] = ""; +$text['confirm-hangups']['de-at'] = "Wollen Sie dieses Gespräch wirklich beenden?"; //copied from de-de +$text['confirm-hangups']['de-ch'] = "Wollen Sie dieses Gespräch wirklich beenden?"; //copied from de-de +$text['confirm-hangups']['de-de'] = "Wollen Sie dieses Gespräch wirklich beenden?"; +$text['confirm-hangups']['es-cl'] = "¿Realmente desea terminar esta llamada?"; +$text['confirm-hangups']['es-mx'] = "¿Realmente desea terminar esta llamada?"; //copied from es-cl +$text['confirm-hangups']['fr-ca'] = "Voulez-vous vraiment raccrocher cette communication?"; //copied from fr-fr +$text['confirm-hangups']['fr-fr'] = "Voulez-vous vraiment raccrocher cette communication?"; +$text['confirm-hangups']['he-il'] = ""; +$text['confirm-hangups']['it-it'] = "Vuoi veramente chiudere questa chiamata?"; +$text['confirm-hangups']['nl-nl'] = ""; +$text['confirm-hangups']['pl-pl'] = "Czy na pewno chcesz się rozłączyć tę rozmowę?"; +$text['confirm-hangups']['pt-br'] = "Deseja realmente finalizar essa chamada?"; +$text['confirm-hangups']['pt-pt'] = "Deseja realmente terminar esta chamada?"; +$text['confirm-hangups']['ro-ro'] = ""; +$text['confirm-hangups']['ru-ru'] = "Вы действительно хотите завершить вызов?"; +$text['confirm-hangups']['sv-se'] = "Vill du verkligen avsluta detta samtal"; +$text['confirm-hangups']['uk-ua'] = "Ви дійсно бажаєте розірвати дзвінок?"; + $text['check-onbreak-status']['en-us'] = "On Break"; $text['check-onbreak-status']['ar-eg'] = ""; $text['check-onbreak-status']['de-at'] = "Auf Pause"; //copied from de-de @@ -681,4 +701,24 @@ $text['button-show_all']['ru-ru'] = "Показать все"; $text['button-show_all']['sv-se'] = "Visa Allt"; $text['button-show_all']['uk-ua'] = "Показати всі"; -?> +$text['message-calls_ended']['en-us'] = "Calls Ended"; +$text['message-calls_ended']['ar-eg'] = ""; +$text['message-calls_ended']['de-at'] = ""; +$text['message-calls_ended']['de-ch'] = ""; +$text['message-calls_ended']['de-de'] = ""; +$text['message-calls_ended']['es-cl'] = ""; +$text['message-calls_ended']['es-mx'] = ""; +$text['message-calls_ended']['fr-ca'] = ""; +$text['message-calls_ended']['fr-fr'] = ""; +$text['message-calls_ended']['he-il'] = ""; +$text['message-calls_ended']['it-it'] = ""; +$text['message-calls_ended']['nl-nl'] = ""; +$text['message-calls_ended']['pl-pl'] = ""; +$text['message-calls_ended']['pt-br'] = ""; +$text['message-calls_ended']['pt-pt'] = ""; +$text['message-calls_ended']['ro-ro'] = ""; +$text['message-calls_ended']['ru-ru'] = ""; +$text['message-calls_ended']['sv-se'] = ""; +$text['message-calls_ended']['uk-ua'] = ""; + +?> \ No newline at end of file diff --git a/app/calls_active/calls_active.php b/app/calls_active/calls_active.php index eaeaba37b1..b6476a8b2a 100644 --- a/app/calls_active/calls_active.php +++ b/app/calls_active/calls_active.php @@ -23,6 +23,7 @@ Contributor(s): Mark J Crane */ + //includes include "root.php"; require_once "resources/require.php"; @@ -86,33 +87,14 @@ //refresh controls function refresh_stop() { clearTimeout(timer_id); - document.getElementById('refresh_state').innerHTML = "\"<?php\" title=\"\">"; + document.getElementById('refresh_state').innerHTML = "\"<?php\" title=\"\">"; } function refresh_start() { - if (document.getElementById('refresh_state')) { document.getElementById('refresh_state').innerHTML = "\"<?php\" title=\"\">"; } + if (document.getElementById('refresh_state')) { document.getElementById('refresh_state').innerHTML = "\"<?php\" title=\"\">"; } ajax_get(); } - //call controls - function hangup(uuid) { - if (confirm("")) { - send_cmd('calls_exec.php?command=hangup&uuid='+uuid); - } - } - - function send_cmd(url) { - if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari - xmlhttp=new XMLHttpRequest(); - } - else {// code for IE6, IE5 - xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); - } - xmlhttp.open("GET",url,false); - xmlhttp.send(null); - document.getElementById('cmd_reponse').innerHTML=xmlhttp.responseText; - } - - Portions created by the Initial Developer are Copyright (C) 2008-2016 + Portions created by the Initial Developer are Copyright (C) 2008-2019 the Initial Developer. All Rights Reserved. Contributor(s): @@ -91,15 +91,12 @@ } unset($results); } + $num_rows = @sizeof($rows); -//set the alternating color for each row - $c = 0; - $row_style["0"] = "row_style0"; - $row_style["1"] = "row_style1"; - //if the connnection is available then run it and return the results if (!$fp) { + $msg = "
".$text['confirm-socket']."
"; echo "
\n"; echo "\n"; @@ -111,112 +108,140 @@ echo "\n"; echo "
\n"; echo "
\n"; + } else { - //define js function call var - $onhover_pause_refresh = " onmouseover='refresh_stop();' onmouseout='refresh_start();'"; + + //create token + $object = new token; + $token = $object->create('/app/calls_active/calls_active_inc.php'); //show content - echo ""; - echo " "; - echo " "; - echo " "; - echo " "; - echo "
"; - echo " \"".$text['label-refresh_pause']."\""; - echo " "; + echo "
\n"; + echo "
".$text['title']." (".$num_rows.")
\n"; + echo "
\n"; + echo " \"".$text['label-refresh_pause']."\""; + if (permission_exists('call_active_hangup') && $rows) { + echo button::create(['type'=>'button','label'=>$text['label-hangup'],'icon'=>'phone-slash','onclick'=>"if (confirm('".$text['confirm-hangups']."')) { list_action_set('hangup'); list_form_submit('form_list'); } else { this.blur(); return false; }"]); + } if (permission_exists('call_active_all')) { if ($show == "all") { - echo " \n"; + echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'link'=>'calls_active.php','onmouseover'=>'refresh_stop()','onmouseout'=>'refresh_start()']); } else { - echo " \n"; + echo button::create(['type'=>'button','label'=>$text['button-show_all'],'icon'=>$_SESSION['theme']['button_icon_all'],'link'=>'calls_active.php?show=all','onmouseover'=>'refresh_stop()','onmouseout'=>'refresh_start()']); } } - echo "
"; + echo " \n"; + echo "
\n"; + echo "\n"; - echo "".$text['title']." (" . count($rows) . ")".""; - echo "

\n"; echo $text['description']."\n"; - echo "

\n"; + echo "

\n"; //show the results echo "
\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; + echo "\n"; + echo "\n"; + + echo "
".$text['label-profile']."".$text['label-created']."
\n"; + echo "\n"; + if (permission_exists('call_active_hangup')) { + echo " \n"; + } + echo " \n"; + echo " \n"; if ($show == 'all') { - echo "\n"; + echo " \n"; + } + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + if (permission_exists('call_active_hangup')) { + echo " \n"; } - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; echo "\n"; - foreach ($rows as &$row) { - //set the php variables - foreach ($row as $key => $value) { - $$key = $value; - } - //if (if_group("superadmin") && isset($_REQUEST['debug'])) { - // echo ""; - //} + if (is_array($rows)) { + $x = 0; + foreach ($rows as &$row) { - //get the sip profile - $name_array = explode("/", $name); - $sip_profile = $name_array[1]; - $sip_uri = $name_array[2]; - - //get the number - $temp_array = explode("@", $sip_uri); - $tmp_number = $temp_array[0]; - $tmp_number = str_replace("sip:", "", $tmp_number); - - //remove the '+' because it breaks the call recording - $cid_num = str_replace("+", "", $cid_num); - - //replace gateway uuid with name - if (sizeof($_SESSION['gateways']) > 0) { - foreach ($_SESSION['gateways'] as $gateway_uuid => $gateway_name) { - $application_data = str_replace($gateway_uuid, $gateway_name, $application_data); + //set the php variables + foreach ($row as $key => $value) { + $$key = $value; } - } - // reduce too long app data - if(strlen($application_data) > 512) { - $application_data = substr($application_data, 0, 512) . ' ...'; - } + //get the sip profile + $name_array = explode("/", $name); + $sip_profile = $name_array[1]; + $sip_uri = $name_array[2]; - //send the html - echo "\n"; - echo "\n"; - echo "\n"; - if ($show == 'all') { - echo "\n"; - } - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; + //get the number + $temp_array = explode("@", $sip_uri); + $tmp_number = $temp_array[0]; + $tmp_number = str_replace("sip:", "", $tmp_number); - //alternate the row style - $c = ($c) ? 0 : 1; + //remove the '+' because it breaks the call recording + $cid_num = str_replace("+", "", $cid_num); + + //replace gateway uuid with name + if (sizeof($_SESSION['gateways']) > 0) { + foreach ($_SESSION['gateways'] as $gateway_uuid => $gateway_name) { + $application_data = str_replace($gateway_uuid, $gateway_name, $application_data); + } + } + + // reduce too long app data + if(strlen($application_data) > 512) { + $application_data = substr($application_data, 0, 512) . ' ...'; + } + + //send the html + echo "\n"; + if (permission_exists('call_active_hangup')) { + echo " \n"; + } + echo " \n"; + echo " \n"; + if ($show == 'all') { + echo " \n"; + } + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + if (permission_exists('call_active_hangup')) { + echo " \n"; + } + echo "\n"; + + //increment counter + $x++; + } + unset($rows); } - echo "\n"; - echo "\n"; + echo "
\n"; + echo " \n"; + echo " ".$text['label-profile']."".$text['label-created']."".$text['label-domain']."".$text['label-domain']."".$text['label-number']."".$text['label-cid-name']."".$text['label-cid-number']."".$text['label-destination']."".$text['label-app']."".$text['label-codec']."".$text['label-secure']." ".$text['label-number']."".$text['label-cid-name']."".$text['label-cid-number']."".$text['label-destination']."".$text['label-app']."".$text['label-codec']."".$text['label-secure']."
".print_r(escape($row), true)."
".escape($sip_profile)." ".escape($created)." ".escape($domain_name)." ".escape($tmp_number)." ".escape($cid_name)." ".escape($cid_num)." ".escape($dest)." ".((strlen($application) > 0) ? escape($application).":".escape($application_data) : null)." ".escape($read_codec).":".escape($read_rate)." / ".escape($write_codec).":".escape($write_rate)." ".escape($secure)." ".$v_link_label_delete."
\n"; + echo " \n"; + echo " \n"; + echo " ".escape($sip_profile)." ".escape($created)." ".escape($domain_name)." ".escape($tmp_number)." ".escape($cid_name)." ".escape($cid_num)." ".escape($dest)." ".(strlen($application) > 0 ? escape($application).":".escape($application_data) : null)." ".escape($read_codec).":".escape($read_rate)." / ".escape($write_codec).":".escape($write_rate)." ".escape($secure)." "; + echo button::create(['type'=>'button','title'=>$text['label-hangup'],'icon'=>'phone-slash','onclick'=>"if (confirm('".$text['confirm-hangup']."')) { list_self_check('checkbox_".$x."'); list_action_set('hangup'); list_form_submit('form_list'); } else { this.blur(); return false; }",'onmouseover'=>'refresh_stop()','onmouseout'=>'refresh_start()']); + echo "
\n"; + + echo "\n"; + + echo "\n"; + } -?> +?> \ No newline at end of file diff --git a/app/calls_active/calls_exec.php b/app/calls_active/calls_exec.php index cdcbc48005..cb3f220ca7 100644 --- a/app/calls_active/calls_exec.php +++ b/app/calls_active/calls_exec.php @@ -1,30 +1,27 @@ + Portions created by the Initial Developer are Copyright (C) 2008-2019 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Mark J Crane */ //includes @@ -33,7 +30,7 @@ require_once "resources/check_auth.php"; //check permissions - if (permission_exists('call_active_view') || permission_exists('extension_active_view')) { + if (permission_exists('call_active_view')) { //access granted } else { @@ -41,28 +38,63 @@ exit; } +//add multi-lingual support + $language = new text; + $text = $language->get(); + //authorized referrer - if(stristr($_SERVER["HTTP_REFERER"], '/calls_active_extensions.php') === false) { - if(stristr($_SERVER["HTTP_REFERER"], '/calls_active.php') === false) { - echo " access denied"; - exit; - } - } - -//authorized commands - if ($_GET["command"] == 'hangup') { - if (is_uuid($_GET["uuid"])) { - //setup the event socket connection - $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); - - //run the command - $switch_result = event_socket_request($fp, 'api uuid_kill '.$_GET["uuid"]); - } - } - else { - //not found. this command is not authorized + if (stristr($_SERVER["HTTP_REFERER"], '/calls_active.php') === false) { echo "access denied"; exit; } -?> +//authorized commands + if ($_REQUEST['action'] == 'hangup' && permission_exists('call_active_hangup')) { + + //validate the token + $token = new token; + if (!$token->validate('/app/calls_active/calls_active_inc.php')) { + message::add($text['message-invalid_token'],'negative'); + header('Location: calls_active.php'); + exit; + } + + //verify submitted call uuids + if (is_array($_POST['calls']) && @sizeof($_POST['calls']) != 0) { + foreach ($_POST['calls'] as $call) { + if ($call['checked'] == 'true' && is_uuid($call['uuid'])) { + $calls[] = $call['uuid']; + } + } + } + if (is_uuid($_REQUEST['uuid'])) { + $calls[] = $_REQUEST['uuid']; + } + + //iterate through calls + if (is_array($calls) && @sizeof($calls) != 0) { + + //setup the event socket connection + $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); + + //execute hangup command + foreach ($calls as $call_uuid) { + $switch_result = event_socket_request($fp, 'api uuid_kill '.$call_uuid); + } + + //set message + message::add($text['message-calls_ended'].': '.@sizeof($calls),'positive'); + + } + + //redirect + header('Location: calls_active.php'); + exit; + + } + else { + echo "access denied"; + exit; + } + +?> \ No newline at end of file diff --git a/resources/classes/button.php b/resources/classes/button.php index baaed113f2..54fd2b14b6 100644 --- a/resources/classes/button.php +++ b/resources/classes/button.php @@ -43,6 +43,8 @@ if (!class_exists('button')) { $button .= "title=\"".($array['title'] ? $array['title'] : $array['label'])."\" "; } $button .= $array['onclick'] ? "onclick=\"".$array['onclick']."\" " : null; + $button .= $array['onmouseover'] ? "onmouseenter=\"".$array['onmouseover']."\" " : null; + $button .= $array['onmouseout'] ? "onmouseleave=\"".$array['onmouseout']."\" " : null; $button .= "class='btn btn-".($array['class'] ? $array['class'] : 'default')." ".($array['disabled'] ? 'disabled' : null)."' "; $button .= "style='margin-left: 2px; margin-right: 2px; ".($array['style'] ? $array['style'] : null)."' "; $button .= $array['disabled'] ? "disabled='disabled' " : null; @@ -96,7 +98,7 @@ if (!class_exists('button')) { //usage - echo button::create(['type'=>'button','label'=>$text['button-label'],'icon'=>'icon','name'=>'btn','id'=>'btn','value'=>'value','link'=>'url','target'=>'_blank','onclick'=>'javascript','class'=>'name','style'=>'css','title'=>$text['button-label'],'collapse'=>'class','disabled'=>false]); + echo button::create(['type'=>'button','label'=>$text['button-label'],'icon'=>'icon','name'=>'btn','id'=>'btn','value'=>'value','link'=>'url','target'=>'_blank','onclick'=>'javascript','onmouseover'=>'javascript','onmouseout'=>'javascript','class'=>'name','style'=>'css','title'=>$text['button-label'],'collapse'=>'class','disabled'=>false]); echo button::create([ 'type'=>'button', @@ -108,6 +110,8 @@ if (!class_exists('button')) { 'link'=>'url', 'target'=>'_blank', 'onclick'=>'javascript', + 'onmouseover'=>'javascript', + 'onmouseout'=>'javascript', 'class'=>'name', 'style'=>'css', 'title'=>$text['button-label'], @@ -124,6 +128,8 @@ if (!class_exists('button')) { value submitted value (if type is also set to 'submit') target '_blank' | '_self' (default) | etc onclick javascript + onmouseover javascript (actually uses onmouseenter so doesn't bubble to child elements) + onmouseout javascript (actually uses onmouseleave so doesn't bubble to child elements) class css class[es] style css style[s] title tooltip text (if not set, defaults to value of label)