diff --git a/app/access_controls/access_control_edit.php b/app/access_controls/access_control_edit.php index e5890dd82a..d6e21d7bdc 100644 --- a/app/access_controls/access_control_edit.php +++ b/app/access_controls/access_control_edit.php @@ -38,6 +38,9 @@ $language = new text; $text = $language->get(); +//create the database connection + $database = database::new(); + //action add or update if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) { $action = "update"; @@ -93,20 +96,17 @@ switch ($_POST['action']) { case 'copy': if (permission_exists('access_control_add')) { - $obj = new database; - $obj->copy($array); + $database->copy($array); } break; case 'delete': if (permission_exists('access_control_delete')) { - $obj = new database; - $obj->delete($array); + $database->delete($array); } break; case 'toggle': if (permission_exists('access_control_update')) { - $obj = new database; - $obj->toggle($array); + $database->toggle($array); } break; } @@ -229,7 +229,6 @@ //save the data if (is_array($array)) { - $database = new database; $database->app_name = 'access controls'; $database->app_uuid = '1416a250-f6e1-4edc-91a6-5c9b883638fd'; $database->save($array); @@ -266,7 +265,7 @@ $sql = "select * from v_access_controls "; $sql .= "where access_control_uuid = :access_control_uuid "; $parameters['access_control_uuid'] = $access_control_uuid; - $database = new database; + $row = $database->select($sql, $parameters, 'row'); if (!empty($row) && count($row) > 0) { $access_control_name = $row["access_control_name"]; @@ -282,7 +281,6 @@ $sql .= "where access_control_uuid = :access_control_uuid "; $sql .= "order by node_cidr asc"; $parameters['access_control_uuid'] = $access_control_uuid; - $database = new database; $access_control_nodes = $database->select($sql, $parameters, 'all'); unset ($sql, $parameters); } @@ -326,6 +324,9 @@ if (permission_exists('access_control_node_add')) { echo button::create(['type'=>'button','label'=>$text['button-import'],'icon'=>$_SESSION['theme']['button_icon_import'],'style'=>'margin-right: 3px;','link'=>'access_control_import.php?id='.escape($access_control_uuid)]); } + if (permission_exists('access_control_node_view')) { + echo button::create(['type'=>'button','label'=>$text['button-export'],'icon'=>$_SESSION['theme']['button_icon_export'],'style'=>'margin-right: 3px;','link'=>'access_control_export.php?id='.escape($access_control_uuid)]); + } if (permission_exists('access_control_node_add')) { echo button::create(['type'=>'button','label'=>$text['button-copy'],'icon'=>$_SESSION['theme']['button_icon_copy'],'id'=>'btn_copy','name'=>'btn_copy','style'=>'display: none;','onclick'=>"modal_open('modal-copy','btn_copy');"]); } diff --git a/app/access_controls/access_control_export.php b/app/access_controls/access_control_export.php new file mode 100644 index 0000000000..77cdb88160 --- /dev/null +++ b/app/access_controls/access_control_export.php @@ -0,0 +1,185 @@ + + Portions created by the Initial Developer are Copyright (C) 2008-2024 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Mark J Crane +*/ + +//includes files + require_once dirname(__DIR__, 2) . "/resources/require.php"; + require_once "resources/check_auth.php"; + require_once "resources/paging.php"; + +//check permissions + if (permission_exists('access_control_node_view')) { + //access granted + } + else { + echo "access denied"; + exit; + } + +//initialize the database object + $database = new database; + +//add multi-lingual support + $language = new text; + $text = $language->get(); + +//define available columns + $available_columns[] = 'node_type'; + $available_columns[] = 'node_cidr'; + $available_columns[] = 'node_description'; + $available_columns[] = 'insert_date'; + $available_columns[] = 'insert_user'; + $available_columns[] = 'update_date'; + $available_columns[] = 'update_user'; + +//action add or update + if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) { + $access_control_uuid = $_REQUEST["id"]; + } + +//define the functions + function array2csv(array &$array) { + if (count($array) == 0) { + return null; + } + ob_start(); + $df = fopen("php://output", 'w'); + fputcsv($df, array_keys(reset($array))); + foreach ($array as $row) { + fputcsv($df, $row); + } + fclose($df); + return ob_get_clean(); + } + +//send download headers + function download_send_headers($filename) { + // disable caching + $now = gmdate("D, d M Y H:i:s"); + header("Expires: Tue, 03 Jul 2001 06:00:00 GMT"); + header("Cache-Control: max-age=0, no-cache, must-revalidate, proxy-revalidate"); + header("Last-Modified: {$now} GMT"); + + // force download + header("Content-Type: application/force-download"); + header("Content-Type: application/octet-stream"); + header("Content-Type: application/download"); + + // disposition / encoding on response body + header("Content-Disposition: attachment;filename={$filename}"); + header("Content-Transfer-Encoding: binary"); + } + +//get the extensions from the database and send them as output + if (!empty($_REQUEST["column_group"]) && is_array($_REQUEST["column_group"]) && @sizeof($_REQUEST["column_group"]) != 0) { + + //validate the token + $token = new token; + if (!$token->validate($_SERVER['PHP_SELF'])) { + message::add($text['message-invalid_token'],'negative'); + header('Location: access_control_export.php'); + exit; + } + + //validate submitted columns + foreach ($_REQUEST["column_group"] as $column_name) { + if (in_array($column_name, $available_columns)) { + $selected_columns[] = $column_name; + } + } + if (!empty($access_control_uuid) && is_uuid($access_control_uuid) && is_array($selected_columns) && @sizeof($selected_columns) != 0) { + //get the child data + $sql = "select ".implode(', ', $selected_columns)." from v_access_control_nodes "; + $sql .= "where access_control_uuid = :access_control_uuid "; + $sql .= "order by node_cidr asc"; + $parameters['access_control_uuid'] = $access_control_uuid; + $access_control_nodes = $database->select($sql, $parameters, 'all'); + unset($sql, $parameters, $selected_columns); + + //send the download headers + download_send_headers("access_control_export_".date("Y-m-d").".csv"); + + //output the data + echo array2csv($access_control_nodes); + exit; + } + } + +//create token + $object = new token; + $token = $object->create($_SERVER['PHP_SELF']); + +//include the header + $document['title'] = $text['title-access_control_export']; + require_once "resources/header.php"; + +//show the content + echo "
\n"; + + echo "
\n"; + echo "
".$text['header-access_control_export']."
\n"; + echo "
\n"; + echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','link'=>'access_control_edit.php?id='.$access_control_uuid]); + echo button::create(['type'=>'submit','label'=>$text['button-export'],'icon'=>$_SESSION['theme']['button_icon_export'],'id'=>'btn_save','style'=>'margin-left: 15px;']); + echo "
\n"; + echo "
\n"; + echo "
\n"; + + echo $text['description-access_control_export']; + echo "

\n"; + + echo "
\n"; + echo "\n"; + echo "\n"; + echo " \n"; + echo " \n"; + echo "\n"; + + if (!empty($available_columns) && is_array($available_columns) && @sizeof($available_columns) != 0) { + $x = 0; + foreach ($available_columns as $column_name) { + $list_row_onclick = "if (!this.checked) { document.getElementById('checkbox_all').checked = false; }"; + echo "\n"; + echo " \n"; + echo " "; + echo ""; + $x++; + } + } + + echo "
\n"; + echo " \n"; + echo " ".$text['label-column_name']."
\n"; + echo " \n"; + echo " ".$column_name."
\n"; + echo "
\n"; + echo "
\n"; + echo "\n"; + echo "
\n"; + +//include the footer + require_once "resources/footer.php"; + +?> diff --git a/app/access_controls/app_config.php b/app/access_controls/app_config.php index 588ba9857b..e6a197ff9c 100644 --- a/app/access_controls/app_config.php +++ b/app/access_controls/app_config.php @@ -55,7 +55,6 @@ $y++; $apps[$x]['permissions'][$y]['name'] = "access_control_node_delete"; $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; - $y++; //cache details $apps[$x]['cache']['key'] = "configuration.acl.conf"; @@ -73,7 +72,7 @@ $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "access_control_name"; $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; - $apps[$x]['db'][$y]['fields'][$z]['search'] = 'true'; + $apps[$x]['db'][$y]['fields'][$z]['search'] = 'true'; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the name."; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "access_control_default"; diff --git a/app/access_controls/app_languages.php b/app/access_controls/app_languages.php index 9bb77aa61e..1b098a8182 100644 --- a/app/access_controls/app_languages.php +++ b/app/access_controls/app_languages.php @@ -108,32 +108,59 @@ $text['title-access_control']['zh-cn'] = "访问控制"; $text['title-access_control']['ja-jp'] = "アクセス制御"; $text['title-access_control']['ko-kr'] = "액세스 제어"; -$text['title_description-access_controls']['en-us'] = "Access control list can allow or deny ranges of IP addresses."; -$text['title_description-access_controls']['en-gb'] = "Access control list can allow or deny ranges of IP addresses."; -$text['title_description-access_controls']['ar-eg'] = "قائمة التحكم بالوصول يمكن السماح أو الرفض نطاقات العناوين."; -$text['title_description-access_controls']['de-at'] = "Die Zugriffskontrollliste kann Bereiche von IP Adressen zulassen oder ablehnen."; -$text['title_description-access_controls']['de-ch'] = "Die Zugriffskontrollliste kann Bereiche von IP Adressen zulassen oder ablehnen."; -$text['title_description-access_controls']['de-de'] = "Die Zugriffskontrollliste kann Bereiche von IP Adressen zulassen oder ablehnen."; -$text['title_description-access_controls']['el-gr'] = "Access control list can allow or deny ranges of IP addresses"; -$text['title_description-access_controls']['es-cl'] = "Lista de control de acceso puede permitir o denegar los rangos de direcciones IP."; -$text['title_description-access_controls']['es-mx'] = "Lista de control de acceso puede permitir o denegar los rangos de direcciones IP."; -$text['title_description-access_controls']['fr-ca'] = "Liste de contrôle d'accès peut autoriser ou refuser des plages d'adresses IP."; -$text['title_description-access_controls']['fr-fr'] = "Liste de contrôle d'accès peut autoriser ou refuser des plages d'adresses IP."; -$text['title_description-access_controls']['he-il'] = " רשימת בקרת גישה יכולה לאפשר או למנוע טווחים של כתובות IP."; -$text['title_description-access_controls']['it-it'] = "Le liste per il controllo di accesso permettono o negano l'accesso a range di IP."; -$text['title_description-access_controls']['ka-ge'] = "წვდომის კონტროლის სიას IP მისამართების შუალედების დაშვება ან აკრძალვა შეუძლია"; -$text['title_description-access_controls']['nl-nl'] = "Toegang Controle lijst kan IP adres reeks toestaan of verbieden."; -$text['title_description-access_controls']['pl-pl'] = "Lista kontroli dostępu może umożliwić lub zablokować zakresy adresów IP."; -$text['title_description-access_controls']['pt-br'] = "Lista de controle de acesso pode permitir ou negar intervalos de endereços IP."; -$text['title_description-access_controls']['pt-pt'] = "Lista de controle de acesso pode permitir ou negar intervalos de endereços IP."; -$text['title_description-access_controls']['ro-ro'] = "Lista de control al accesului poate permite sau refuza intervale de adrese IP."; -$text['title_description-access_controls']['ru-ru'] = "Контроль доступа может разрешить или запретить диапазоны IP адресов."; -$text['title_description-access_controls']['sv-se'] = "Åtkomstkontrollista kan tillåta eller neka intervall av IP-adresser."; -$text['title_description-access_controls']['uk-ua'] = "Список контролю доступу може дозволити або заборонити діапазони IP-адрес."; -$text['title_description-access_controls']['tr-tr'] = "Erişim kontrol listesi IP adres aralıklarına izin verebilir veya reddedebilir."; -$text['title_description-access_controls']['zh-cn'] = "访问控制列表可以允许或拒绝 IP 地址范围。"; -$text['title_description-access_controls']['ja-jp'] = "アクセス コントロール リストでは、IP アドレスの範囲を許可または拒否できます。"; -$text['title_description-access_controls']['ko-kr'] = "액세스 제어 목록은 IP 주소 범위를 허용하거나 거부할 수 있습니다."; +$text['title-access_control_export']['en-us'] = "Access Control Export"; +$text['title-access_control_export']['en-gb'] = "Access Control Export"; +$text['title-access_control_export']['ar-eg'] = ""; +$text['title-access_control_export']['de-at'] = ""; +$text['title-access_control_export']['de-ch'] = ""; +$text['title-access_control_export']['de-de'] = ""; +$text['title-access_control_export']['ek-gr'] = ""; +$text['title-access_control_export']['es-cl'] = ""; +$text['title-access_control_export']['es-mx'] = ""; +$text['title-access_control_export']['fr-ca'] = ""; +$text['title-access_control_export']['fr-fr'] = ""; +$text['title-access_control_export']['he-il'] = ""; +$text['title-access_control_export']['it-it'] = ""; +$text['title-access_control_export']['ka-ge'] = ""; +$text['title-access_control_export']['nl-nl'] = ""; +$text['title-access_control_export']['pl-pl'] = ""; +$text['title-access_control_export']['pt-br'] = ""; +$text['title-access_control_export']['pt-pt'] = ""; +$text['title-access_control_export']['ro-ro'] = ""; +$text['title-access_control_export']['ru-ru'] = ""; +$text['title-access_control_export']['sv-se'] = ""; +$text['title-access_control_export']['uk-ua'] = ""; +$text['title-access_control_export']['tr-tr'] = ""; +$text['title-access_control_export']['zh-cn'] = ""; +$text['title-access_control_export']['ja-jp'] = ""; +$text['title-access_control_export']['ko-kr'] = ""; + +$text['header-access_control_export']['en-us'] = "Access Control Export"; +$text['header-access_control_export']['en-gb'] = "Access Control Export"; +$text['header-access_control_export']['ar-eg'] = ""; +$text['header-access_control_export']['de-at'] = ""; +$text['header-access_control_export']['de-ch'] = ""; +$text['header-access_control_export']['de-de'] = ""; +$text['header-access_control_export']['ek-gr'] = ""; +$text['header-access_control_export']['es-cl'] = ""; +$text['header-access_control_export']['es-mx'] = ""; +$text['header-access_control_export']['fr-ca'] = ""; +$text['header-access_control_export']['fr-fr'] = ""; +$text['header-access_control_export']['he-il'] = ""; +$text['header-access_control_export']['it-it'] = ""; +$text['header-access_control_export']['ka-ge'] = ""; +$text['header-access_control_export']['nl-nl'] = ""; +$text['header-access_control_export']['pl-pl'] = ""; +$text['header-access_control_export']['pt-br'] = ""; +$text['header-access_control_export']['pt-pt'] = ""; +$text['header-access_control_export']['ro-ro'] = ""; +$text['header-access_control_export']['ru-ru'] = ""; +$text['header-access_control_export']['sv-se'] = ""; +$text['header-access_control_export']['uk-ua'] = ""; +$text['header-access_control_export']['tr-tr'] = ""; +$text['header-access_control_export']['zh-cn'] = ""; +$text['header-access_control_export']['ja-jp'] = ""; +$text['header-access_control_export']['ko-kr'] = ""; $text['label-node_type']['en-us'] = "Type"; $text['label-node_type']['en-gb'] = "Type"; @@ -405,6 +432,33 @@ $text['label-access_control_description']['zh-cn'] = "描述"; $text['label-access_control_description']['ja-jp'] = "説明"; $text['label-access_control_description']['ko-kr'] = "설명"; +$text['title_description-access_controls']['en-us'] = "Access control list can allow or deny ranges of IP addresses."; +$text['title_description-access_controls']['en-gb'] = "Access control list can allow or deny ranges of IP addresses."; +$text['title_description-access_controls']['ar-eg'] = "قائمة التحكم بالوصول يمكن السماح أو الرفض نطاقات العناوين."; +$text['title_description-access_controls']['de-at'] = "Die Zugriffskontrollliste kann Bereiche von IP Adressen zulassen oder ablehnen."; +$text['title_description-access_controls']['de-ch'] = "Die Zugriffskontrollliste kann Bereiche von IP Adressen zulassen oder ablehnen."; +$text['title_description-access_controls']['de-de'] = "Die Zugriffskontrollliste kann Bereiche von IP Adressen zulassen oder ablehnen."; +$text['title_description-access_controls']['el-gr'] = "Access control list can allow or deny ranges of IP addresses"; +$text['title_description-access_controls']['es-cl'] = "Lista de control de acceso puede permitir o denegar los rangos de direcciones IP."; +$text['title_description-access_controls']['es-mx'] = "Lista de control de acceso puede permitir o denegar los rangos de direcciones IP."; +$text['title_description-access_controls']['fr-ca'] = "Liste de contrôle d'accès peut autoriser ou refuser des plages d'adresses IP."; +$text['title_description-access_controls']['fr-fr'] = "Liste de contrôle d'accès peut autoriser ou refuser des plages d'adresses IP."; +$text['title_description-access_controls']['he-il'] = " רשימת בקרת גישה יכולה לאפשר או למנוע טווחים של כתובות IP."; +$text['title_description-access_controls']['it-it'] = "Le liste per il controllo di accesso permettono o negano l'accesso a range di IP."; +$text['title_description-access_controls']['ka-ge'] = "წვდომის კონტროლის სიას IP მისამართების შუალედების დაშვება ან აკრძალვა შეუძლია"; +$text['title_description-access_controls']['nl-nl'] = "Toegang Controle lijst kan IP adres reeks toestaan of verbieden."; +$text['title_description-access_controls']['pl-pl'] = "Lista kontroli dostępu może umożliwić lub zablokować zakresy adresów IP."; +$text['title_description-access_controls']['pt-br'] = "Lista de controle de acesso pode permitir ou negar intervalos de endereços IP."; +$text['title_description-access_controls']['pt-pt'] = "Lista de controle de acesso pode permitir ou negar intervalos de endereços IP."; +$text['title_description-access_controls']['ro-ro'] = "Lista de control al accesului poate permite sau refuza intervale de adrese IP."; +$text['title_description-access_controls']['ru-ru'] = "Контроль доступа может разрешить или запретить диапазоны IP адресов."; +$text['title_description-access_controls']['sv-se'] = "Åtkomstkontrollista kan tillåta eller neka intervall av IP-adresser."; +$text['title_description-access_controls']['uk-ua'] = "Список контролю доступу може дозволити або заборонити діапазони IP-адрес."; +$text['title_description-access_controls']['tr-tr'] = "Erişim kontrol listesi IP adres aralıklarına izin verebilir veya reddedebilir."; +$text['title_description-access_controls']['zh-cn'] = "访问控制列表可以允许或拒绝 IP 地址范围。"; +$text['title_description-access_controls']['ja-jp'] = "アクセス コントロール リストでは、IP アドレスの範囲を許可または拒否できます。"; +$text['title_description-access_controls']['ko-kr'] = "액세스 제어 목록은 IP 주소 범위를 허용하거나 거부할 수 있습니다."; + $text['description-node_type']['en-us'] = "Select the type."; $text['description-node_type']['en-gb'] = "Select the type."; $text['description-node_type']['ar-eg'] = "حدد نوع."; @@ -594,4 +648,31 @@ $text['description-access_control_default']['zh-cn'] = "选择默认类型。"; $text['description-access_control_default']['ja-jp'] = "デフォルトのタイプを選択します。"; $text['description-access_control_default']['ko-kr'] = "기본 유형을 선택합니다."; +$text['description-access_control_export']['en-us'] = "Select the fields you wish to include in the export."; +$text['description-access_control_export']['en-gb'] = "Select the fields you wish to include in the export."; +$text['description-access_control_export']['ar-eg'] = "حدد الحقول التي ترغب في تضمينها في التصدير."; +$text['description-access_control_export']['de-at'] = "Wählen Sie die Felder aus, die Sie in den Export einbeziehen möchten."; +$text['description-access_control_export']['de-ch'] = "Wählen Sie die Felder aus, die Sie in den Export einbeziehen möchten."; +$text['description-access_control_export']['de-de'] = "Wählen Sie die Felder aus, die Sie in den Export einbeziehen möchten."; +$text['description-access_control_export']['ek-gr'] = "Επιλέξτε τα πεδία που θέλετε να συμπεριλάβετε στην εξαγωγή."; +$text['description-access_control_export']['es-cl'] = "Seleccione los campos que desea incluir en la exportación."; +$text['description-access_control_export']['es-mx'] = "Seleccione los campos que desea incluir en la exportación."; +$text['description-access_control_export']['fr-ca'] = "Sélectionnez les champs que vous souhaitez inclure dans l'exportation."; +$text['description-access_control_export']['fr-fr'] = "Sélectionnez les champs que vous souhaitez inclure dans l'exportation."; +$text['description-access_control_export']['he-il'] = "בחר את השדות שברצונך לכלול בייצוא."; +$text['description-access_control_export']['it-it'] = "Seleziona i campi che desideri includere nell'esportazione."; +$text['description-access_control_export']['ka-ge'] = "აირჩიეთ ექსპორტში ჩასასმელი ველები."; +$text['description-access_control_export']['nl-nl'] = "Selecteer de velden die u in de export wilt opnemen."; +$text['description-access_control_export']['pl-pl'] = "Wybierz pola, które chcesz uwzględnić w eksporcie."; +$text['description-access_control_export']['pt-br'] = "Selecione os campos que deseja incluir na exportação."; +$text['description-access_control_export']['pt-pt'] = "Selecione os campos que deseja incluir na exportação."; +$text['description-access_control_export']['ro-ro'] = "Selectați câmpurile pe care doriți să le includeți în export."; +$text['description-access_control_export']['ru-ru'] = "Выберите поля, которые вы хотите включить в экспорт."; +$text['description-access_control_export']['sv-se'] = "Välj de fält du vill inkludera i exporten."; +$text['description-access_control_export']['uk-ua'] = "Виберіть поля, які потрібно включити в експорт."; +$text['description-access_control_export']['tr-tr'] = "Dışa aktarmaya dahil etmek istediğiniz alanları seçin."; +$text['description-access_control_export']['zh-cn'] = "选择您希望包含在导出中的字段。"; +$text['description-access_control_export']['ja-jp'] = "エクスポートに含めるフィールドを選択します。"; +$text['description-access_control_export']['ko-kr'] = "내보내기에 포함할 필드를 선택합니다."; + ?> diff --git a/app/call_recordings/app_config.php b/app/call_recordings/app_config.php index db076f2db1..df5ed74d42 100644 --- a/app/call_recordings/app_config.php +++ b/app/call_recordings/app_config.php @@ -45,4 +45,13 @@ $apps[$x]['default_settings'][$y]['default_setting_value'] = "90"; $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true"; $apps[$x]['default_settings'][$y]['default_setting_description'] = "Number of days to retain the maintenance logs in the database."; + $y++; + $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "e329db05-2967-422a-a71f-d0175b083828"; + $apps[$x]['default_settings'][$y]['default_setting_category'] = "call_recordings"; + $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "record_extension"; + $apps[$x]['default_settings'][$y]['default_setting_name'] = "text"; + $apps[$x]['default_settings'][$y]['default_setting_value'] = "mp3"; + $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true"; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "Call recording file format options: wav, mp3"; + ?> diff --git a/app/calls_active/calls_active_inc.php b/app/calls_active/calls_active_inc.php index 567951aa52..e7680d1cd3 100644 --- a/app/calls_active/calls_active_inc.php +++ b/app/calls_active/calls_active_inc.php @@ -37,6 +37,21 @@ exit; } +//get the session settings + $domain_uuid = $_SESSION['domain_uuid']; + $domain_name = $_SESSION['domain_name']; + $user_uuid = $_SESSION['user_uuid']; + $gateways = $_SESSION['gateways']; + $user = $_SESSION['user']; + +//initialize the settings object + $settings = new settings(["domain_uuid" => $domain_uuid, "user_uuid" => $user_uuid]); + +//get the settings + $template_name = $settings->get('domain', 'template', 'default'); + $theme_button_icon_back = $settings->get('theme', 'button_icon_back', ''); + $theme_button_icon_all = $settings->get('theme', 'button_icon_all', ''); + //add multi-lingual support $language = new text; $text = $language->get(); @@ -46,7 +61,7 @@ if ($show != "all") { $show = ''; } //include theme config for button images - include_once("themes/".$_SESSION['domain']['template']['name']."/config.php"); + include_once("themes/".$template_name."/config.php"); //set the command $switch_cmd = 'show channels as json'; @@ -80,7 +95,7 @@ if (($show == 'all' && permission_exists('call_active_all'))) { $rows[] = $row; } - elseif ($row['domain_name'] == $_SESSION['domain_name']) { + elseif ($row['domain_name'] == $domain_name) { $rows[] = $row; } } @@ -131,20 +146,20 @@ echo "
".$text['title']."
".number_format($num_rows)."
\n"; echo "
\n"; echo " ".button::create(['type'=>'button','title'=>$text['label-refresh_pause'],'icon'=>'sync-alt fa-spin','onclick'=>'refresh_stop()']).""; - if (permission_exists('call_active_eavesdrop') && !empty($_SESSION['user']['extensions'])) { - if (sizeof($_SESSION['user']['extensions']) > 1) { - echo " \n"; + if (permission_exists('call_active_eavesdrop') && !empty($user['extensions'])) { + if (sizeof($user['extensions']) > 1) { + echo " \n"; echo " \n"; echo " \n"; } - else if (sizeof($_SESSION['user']['extensions']) == 1) { - echo " \n"; + else if (sizeof($user['extensions']) == 1) { + echo " \n"; } } if (permission_exists('call_active_hangup') && $rows) { @@ -152,10 +167,10 @@ } if (permission_exists('call_active_all')) { if ($show == "all") { - 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()']); + echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$theme_button_icon_back,'link'=>'calls_active.php','onmouseover'=>'refresh_stop()','onmouseout'=>'refresh_start()']); } else { - 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 button::create(['type'=>'button','label'=>$text['button-show_all'],'icon'=>$theme_button_icon_all,'link'=>'calls_active.php?show=all','onmouseover'=>'refresh_stop()','onmouseout'=>'refresh_start()']); } } echo "
\n"; @@ -224,20 +239,14 @@ $cid_num = str_replace("+", "", $cid_num); //replace gateway uuid with name - if (is_array($_SESSION['gateways']) && sizeof($_SESSION['gateways']) > 0) { - foreach ($_SESSION['gateways'] as $gateway_uuid => $gateway_name) { + if (is_array($gateways) && sizeof($gateways) > 0) { + foreach ($gateways as $gateway_uuid => $gateway_name) { $application_data = str_replace($gateway_uuid, $gateway_name, $application_data); } } - //convert $created to a UNIX timestamp - $created_timestamp = strtotime($created); - - //get the current timestamp - $now = time(); - //calculate elapsed seconds - $elapsed_seconds = $now - $created_timestamp; + $elapsed_seconds = time() - $created_epoch; //convert seconds to hours, minutes, and seconds $hours = floor($elapsed_seconds / 3600); @@ -276,7 +285,7 @@ if (permission_exists('call_active_eavesdrop') || permission_exists('call_active_hangup')) { echo " \n"; //eavesdrop - if (permission_exists('call_active_eavesdrop') && $callstate == 'ACTIVE' && !empty($_SESSION['user']['extensions']) && !in_array($cid_num, $_SESSION['user']['extensions'])) { + if (permission_exists('call_active_eavesdrop') && $callstate == 'ACTIVE' && !empty($user['extensions']) && !in_array($cid_num, $user['extensions'])) { echo button::create(['type'=>'button','label'=>$text['label-eavesdrop'],'icon'=>'headphones','collapse'=>'hide-lg-dn','onclick'=>"if (confirm('".$text['confirm-eavesdrop']."')) { eavesdrop_call('".escape($cid_num)."','".escape($uuid)."'); } else { this.blur(); return false; }",'onmouseover'=>'refresh_stop()','onmouseout'=>'refresh_start()']); } //hangup diff --git a/app/destinations/destination_edit.php b/app/destinations/destination_edit.php index ba185c3c75..ed526cba09 100644 --- a/app/destinations/destination_edit.php +++ b/app/destinations/destination_edit.php @@ -41,10 +41,13 @@ $language = new text; $text = $language->get(); -//initialize the database - $database = new database; +//initialize the database object + $database = database::new(); -//initialize the destinations object +//initialize the settings object + $settings = new settings(['database' => $database, 'domain_uuid' => $domain_uuid]); + +//initialize the destination object $destination = new destinations; //initialize the ringbacks object @@ -68,17 +71,20 @@ default: $destination_type = 'inbound'; } +//get the call recording extension + $record_extension = $settings->get('call_recordings', 'record_extension', 'wav'); + //get total destination count from the database, check limit, if defined if (!permission_exists('destination_domain')) { if ($action == 'add') { - if (!empty($_SESSION['limit']['destinations']['numeric'])) { + if (!empty($settings->get('limit', 'destinations', ''))) { $sql = "select count(*) from v_destinations where domain_uuid = :domain_uuid "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $total_destinations = $database->select($sql, $parameters, 'column'); unset($sql, $parameters); - if ($total_destinations >= $_SESSION['limit']['destinations']['numeric']) { - message::add($text['message-maximum_destinations'].' '.$_SESSION['limit']['destinations']['numeric'], 'negative'); + if ($total_destinations >= $settings->get('limit', 'destinations', '')) { + message::add($text['message-maximum_destinations'].' '.$settings->get('limit', 'destinations', ''), 'negative'); header('Location: destinations.php'); exit; } @@ -199,7 +205,7 @@ if (empty($destination_enabled)) { $msg .= $text['message-required']." ".$text['label-destination_enabled']."
\n"; } //check for duplicates - if ($destination_type == 'inbound' && $destination_number != $db_destination_number && $_SESSION['destinations']['unique']['boolean'] == 'true') { + if ($destination_type == 'inbound' && $destination_number != $db_destination_number && $settings->get('destinations', 'unique', '')) { $sql = "select count(*) from v_destinations "; $sql .= "where (destination_number = :destination_number or destination_prefix || destination_number = :destination_number) "; $sql .= "and destination_type = 'inbound' "; @@ -448,15 +454,15 @@ if (!empty($destination_condition_field)) { $dialplan_detail_type = $destination_condition_field; } - elseif (!empty($_SESSION['dialplan']['destination']['text'])) { - $dialplan_detail_type = $_SESSION['dialplan']['destination']['text']; + elseif (!empty($settings->get('dialplan', 'destination', ''))) { + $dialplan_detail_type = $settings->get('dialplan', 'destination', ''); } else { $dialplan_detail_type = "destination_number"; } //authorized specific dialplan_detail_type that are safe, sanitize all other values - $dialplan_detail_type = $_SESSION['dialplan']['destination']['text']; + $dialplan_detail_type = $settings->get('dialplan', 'destination', ''); switch ($dialplan_detail_type) { case 'destination_number': break; @@ -534,10 +540,11 @@ } if (!empty($destination_record) && $destination_record == 'true') { $dialplan["dialplan_xml"] .= " \n"; - $dialplan["dialplan_xml"] .= " \n"; + $dialplan["dialplan_xml"] .= " \n"; $dialplan["dialplan_xml"] .= " \n"; $dialplan["dialplan_xml"] .= " \n"; $dialplan["dialplan_xml"] .= " \n"; + $dialplan["dialplan_xml"] .= " \n"; $dialplan["dialplan_xml"] .= " \n"; } if (!empty($destination_hold_music)) { @@ -596,7 +603,7 @@ $dialplan["dialplan_xml"] .= "\n"; //dialplan details - if ($_SESSION['destinations']['dialplan_details']['boolean'] == "true") { + if ($settings->get('destinations', 'dialplan_details', '')) { //set initial value of the row id $y=0; @@ -637,8 +644,8 @@ if (!empty($destination_condition_field)) { $dialplan["dialplan_details"][$y]["dialplan_detail_type"] = $destination_condition_field; } - elseif (!empty($_SESSION['dialplan']['destination']['text'])) { - $dialplan["dialplan_details"][$y]["dialplan_detail_type"] = $_SESSION['dialplan']['destination']['text']; + elseif (!empty($settings->get('dialplan', 'destination', ''))) { + $dialplan["dialplan_details"][$y]["dialplan_detail_type"] = $settings->get('dialplan', 'destination', ''); } else { $dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "regex"; @@ -697,8 +704,8 @@ if (!empty($destination_condition_field)) { $dialplan["dialplan_details"][$y]["dialplan_detail_type"] = $destination_condition_field; } - elseif (!empty($_SESSION['dialplan']['destination']['text'])) { - $dialplan["dialplan_details"][$y]["dialplan_detail_type"] = $_SESSION['dialplan']['destination']['text']; + elseif (!empty($settings->get('dialplan', 'destination', ''))) { + $dialplan["dialplan_details"][$y]["dialplan_detail_type"] = $settings->get('dialplan', 'destination', ''); } else { $dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "destination_number"; @@ -946,7 +953,7 @@ $dialplan["dialplan_details"][$y]["dialplan_uuid"] = $dialplan_uuid; $dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action"; $dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set"; - $dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "record_name=\${uuid}.\${record_ext}"; + $dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "record_name=\${uuid}.".$record_extension; $dialplan["dialplan_details"][$y]["dialplan_detail_inline"] = "true"; $dialplan["dialplan_details"][$y]["dialplan_detail_group"] = $dialplan_detail_group; $dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $dialplan_detail_order; @@ -983,6 +990,20 @@ //increment the dialplan detail order $dialplan_detail_order = $dialplan_detail_order + 10; + //add a variable + $dialplan["dialplan_details"][$y]["domain_uuid"] = $domain_uuid; + $dialplan["dialplan_details"][$y]["dialplan_uuid"] = $dialplan_uuid; + $dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action"; + $dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set"; + $dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "record_stereo_swap=true"; + $dialplan["dialplan_details"][$y]["dialplan_detail_inline"] = "true"; + $dialplan["dialplan_details"][$y]["dialplan_detail_group"] = $dialplan_detail_group; + $dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $dialplan_detail_order; + $y++; + + //increment the dialplan detail order + $dialplan_detail_order = $dialplan_detail_order + 10; + //add a variable $dialplan["dialplan_details"][$y]["domain_uuid"] = $domain_uuid; $dialplan["dialplan_details"][$y]["dialplan_uuid"] = $dialplan_uuid; @@ -1164,10 +1185,10 @@ //clear the cache $cache = new cache; - if ($_SESSION['destinations']['dialplan_mode']['text'] == 'multiple') { + if ($settings->get('destinations', 'dialplan_mode', '') == 'multiple') { $cache->delete("dialplan:".$destination_context); } - if ($_SESSION['destinations']['dialplan_mode']['text'] == 'single') { + if ($settings->get('destinations', 'dialplan_mode', '') == 'single') { if (isset($destination_prefix) && is_numeric($destination_prefix) && isset($destination_number) && is_numeric($destination_number)) { $cache->delete("dialplan:".$destination_context.":".$destination_prefix.$destination_number); $cache->delete("dialplan:".$destination_context.":+".$destination_prefix.$destination_number); @@ -2081,7 +2102,7 @@ echo " ".$text['label-destination_enabled']."\n"; echo "\n"; echo "\n"; - if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { + if (substr($settings->get('theme', 'input_toggle_style', ''), 0, 6) == 'switch') { echo "