2012-12-29 10:17:12 +01:00
|
|
|
<?php
|
|
|
|
|
/*
|
|
|
|
|
FusionPBX
|
|
|
|
|
Version: MPL 1.1
|
|
|
|
|
|
|
|
|
|
The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
|
1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
|
the License. You may obtain a copy of the License at
|
|
|
|
|
http://www.mozilla.org/MPL/
|
|
|
|
|
|
|
|
|
|
Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
|
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
|
for the specific language governing rights and limitations under the
|
|
|
|
|
License.
|
|
|
|
|
|
|
|
|
|
The Original Code is FusionPBX
|
|
|
|
|
|
|
|
|
|
The Initial Developer of the Original Code is
|
|
|
|
|
Mark J Crane <markjcrane@fusionpbx.com>
|
2024-01-30 18:10:19 +01:00
|
|
|
Portions created by the Initial Developer are Copyright (C) 2008-2024
|
2012-12-29 10:17:12 +01:00
|
|
|
the Initial Developer. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
Contributor(s):
|
|
|
|
|
Mark J Crane <markjcrane@fusionpbx.com>
|
|
|
|
|
*/
|
2017-02-16 09:28:28 +01:00
|
|
|
|
2022-10-11 00:35:14 +02:00
|
|
|
//includes files
|
2023-06-15 19:28:23 +02:00
|
|
|
require_once dirname(__DIR__, 2) . "/resources/require.php";
|
2017-02-16 09:28:28 +01:00
|
|
|
require_once "resources/check_auth.php";
|
|
|
|
|
|
|
|
|
|
//check permissions
|
|
|
|
|
if (permission_exists('voicemail_add') || permission_exists('voicemail_edit')) {
|
|
|
|
|
//access granted
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo "access denied";
|
|
|
|
|
exit;
|
|
|
|
|
}
|
2012-12-29 10:17:12 +01:00
|
|
|
|
|
|
|
|
//add multi-lingual support
|
2015-01-18 11:04:43 +01:00
|
|
|
$language = new text;
|
|
|
|
|
$text = $language->get();
|
2012-12-29 10:17:12 +01:00
|
|
|
|
2020-02-07 21:03:10 +01:00
|
|
|
//initialize the destinations object
|
|
|
|
|
$destination = new destinations;
|
|
|
|
|
|
2012-12-29 10:17:12 +01:00
|
|
|
//action add or update
|
2023-05-27 00:17:53 +02:00
|
|
|
if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) {
|
2012-12-29 10:17:12 +01:00
|
|
|
$action = "update";
|
2019-08-17 15:02:58 +02:00
|
|
|
$voicemail_uuid = $_REQUEST["id"];
|
2012-12-29 10:17:12 +01:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$action = "add";
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-27 00:17:53 +02:00
|
|
|
//set the defaults
|
|
|
|
|
$voicemail_id = '';
|
|
|
|
|
$voicemail_password = '';
|
|
|
|
|
$voicemail_alternate_greet_id = '';
|
|
|
|
|
$voicemail_description = '';
|
|
|
|
|
$voicemail_destinations_assigned = '';
|
|
|
|
|
$show_option_delete = '';
|
|
|
|
|
$voicemail_option_digits = '';
|
|
|
|
|
$voicemail_option_description = '';
|
2023-06-02 22:53:23 +02:00
|
|
|
$voicemail_mail_to = '';
|
2023-05-27 00:17:53 +02:00
|
|
|
|
2013-01-02 00:22:07 +01:00
|
|
|
//get http variables and set them to php variables
|
2023-05-27 00:17:53 +02:00
|
|
|
$referer_path = $_REQUEST["referer_path"] ?? '';
|
|
|
|
|
$referer_query = $_REQUEST["referer_query"] ?? '';
|
2023-06-02 22:53:23 +02:00
|
|
|
if (!empty($_POST)) {
|
2020-03-04 03:13:16 +01:00
|
|
|
|
|
|
|
|
//process the http post data by submitted action
|
2023-06-09 18:51:36 +02:00
|
|
|
if (!empty($_POST['action']) && is_uuid($_POST['voicemail_uuid'])) {
|
2020-03-04 03:13:16 +01:00
|
|
|
$array[0]['checked'] = 'true';
|
|
|
|
|
$array[0]['uuid'] = $_POST['voicemail_uuid'];
|
|
|
|
|
|
|
|
|
|
switch ($_POST['action']) {
|
|
|
|
|
case 'delete':
|
|
|
|
|
if (permission_exists('voicemail_delete')) {
|
|
|
|
|
$obj = new voicemail;
|
|
|
|
|
$obj->voicemail_delete($array);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
header('Location: voicemails.php');
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
|
2013-06-03 16:26:50 +02:00
|
|
|
//set the variables from the HTTP values
|
2019-08-17 15:02:58 +02:00
|
|
|
$voicemail_id = $_POST["voicemail_id"];
|
|
|
|
|
$voicemail_password = $_POST["voicemail_password"];
|
|
|
|
|
$greeting_id = $_POST["greeting_id"];
|
2015-02-15 05:54:32 +01:00
|
|
|
$voicemail_options = $_POST["voicemail_options"];
|
2019-08-17 15:02:58 +02:00
|
|
|
$voicemail_alternate_greet_id = $_POST["voicemail_alternate_greet_id"];
|
|
|
|
|
$voicemail_mail_to = $_POST["voicemail_mail_to"];
|
2023-06-09 18:51:36 +02:00
|
|
|
$voicemail_sms_to = $_POST["voicemail_sms_to"] ?? null;
|
|
|
|
|
$voicemail_transcription_enabled = $_POST["voicemail_transcription_enabled"] ?? null;
|
2019-08-17 15:02:58 +02:00
|
|
|
$voicemail_file = $_POST["voicemail_file"];
|
|
|
|
|
$voicemail_local_after_email = $_POST["voicemail_local_after_email"];
|
2020-03-04 03:13:16 +01:00
|
|
|
$voicemail_destination = $_POST["voicemail_destination"];
|
2024-06-22 01:24:06 +02:00
|
|
|
$voicemail_local_after_forward = $_POST["voicemail_local_after_forward"];
|
2023-06-07 00:05:05 +02:00
|
|
|
$voicemail_enabled = $_POST["voicemail_enabled"] ?? 'false';
|
2019-08-17 15:02:58 +02:00
|
|
|
$voicemail_description = $_POST["voicemail_description"];
|
|
|
|
|
$voicemail_tutorial = $_POST["voicemail_tutorial"];
|
2023-06-28 04:47:53 +02:00
|
|
|
$voicemail_recording_instructions = $_POST["voicemail_recording_instructions"] ?? null;
|
|
|
|
|
$voicemail_recording_options = $_POST["voicemail_recording_options"] ?? null;
|
2023-06-09 18:51:36 +02:00
|
|
|
$voicemail_options_delete = $_POST["voicemail_options_delete"] ?? null;
|
|
|
|
|
$voicemail_destinations_delete = $_POST["voicemail_destinations_delete"] ?? null;
|
2021-11-23 17:56:12 +01:00
|
|
|
|
2013-06-03 16:26:50 +02:00
|
|
|
//remove the space
|
|
|
|
|
$voicemail_mail_to = str_replace(" ", "", $voicemail_mail_to);
|
2012-12-29 10:17:12 +01:00
|
|
|
}
|
|
|
|
|
|
2019-10-10 17:25:53 +02:00
|
|
|
//process the data
|
2023-06-02 22:53:23 +02:00
|
|
|
if (!empty($_POST) && empty($_POST["persistformvar"])) {
|
2012-12-29 10:17:12 +01:00
|
|
|
|
2019-10-10 17:25:53 +02:00
|
|
|
$msg = '';
|
|
|
|
|
if ($action == "update") {
|
|
|
|
|
$voicemail_uuid = $_POST["voicemail_uuid"];
|
2012-12-29 10:17:12 +01:00
|
|
|
}
|
|
|
|
|
|
2019-10-10 17:25:53 +02:00
|
|
|
//validate the token
|
|
|
|
|
$token = new token;
|
|
|
|
|
if (!$token->validate($_SERVER['PHP_SELF'])) {
|
|
|
|
|
message::add($text['message-invalid_token'],'negative');
|
|
|
|
|
header('Location: voicemails.php');
|
|
|
|
|
exit;
|
2019-08-17 15:02:58 +02:00
|
|
|
}
|
2012-12-29 10:17:12 +01:00
|
|
|
|
2019-10-10 17:25:53 +02:00
|
|
|
//check for all required data
|
2020-03-05 01:59:32 +01:00
|
|
|
$msg = '';
|
|
|
|
|
if (!is_numeric($voicemail_id)) { $msg .= $text['message-required']." ".$text['label-voicemail_id']."<br>\n"; }
|
|
|
|
|
if (trim($voicemail_password) == '') { $msg .= $text['message-required']." ".$text['label-voicemail_password']."<br>\n"; }
|
2023-05-05 18:46:37 +02:00
|
|
|
if (!empty($msg) && empty($_POST["persistformvar"])) {
|
2019-10-10 17:25:53 +02:00
|
|
|
require_once "resources/header.php";
|
|
|
|
|
require_once "resources/persist_form_var.php";
|
|
|
|
|
echo "<div align='center'>\n";
|
|
|
|
|
echo "<table><tr><td>\n";
|
|
|
|
|
echo $msg."<br />";
|
|
|
|
|
echo "</td></tr></table>\n";
|
|
|
|
|
persistformvar($_POST);
|
|
|
|
|
echo "</div>\n";
|
|
|
|
|
require_once "resources/footer.php";
|
|
|
|
|
return;
|
2019-08-17 15:02:58 +02:00
|
|
|
}
|
2012-12-29 10:17:12 +01:00
|
|
|
|
2019-10-10 17:25:53 +02:00
|
|
|
//add or update the database
|
2023-06-02 22:53:23 +02:00
|
|
|
if (empty($_POST["persistformvar"])) {
|
2019-10-10 17:25:53 +02:00
|
|
|
|
|
|
|
|
//get a new voicemail_uuid
|
|
|
|
|
if ($action == "add" && permission_exists('voicemail_add')) {
|
|
|
|
|
$voicemail_uuid = uuid();
|
2022-01-29 10:28:07 +01:00
|
|
|
//if adding a mailbox and don't have the transcription permission, set the default transcribe behavior
|
|
|
|
|
if (!permission_exists('voicemail_transcription_enabled') && isset($_SESSION['voicemail']['transcription_enabled_default']['boolean'])) {
|
|
|
|
|
$voicemail_transcription_enabled = $_SESSION['voicemail']['transcription_enabled_default']['boolean'];
|
|
|
|
|
}
|
2019-10-10 17:25:53 +02:00
|
|
|
}
|
|
|
|
|
|
2019-08-17 15:02:58 +02:00
|
|
|
//add common array fields
|
|
|
|
|
$array['voicemails'][0]['domain_uuid'] = $domain_uuid;
|
2019-10-10 17:25:53 +02:00
|
|
|
$array['voicemails'][0]['voicemail_uuid'] = $voicemail_uuid;
|
2019-08-17 15:02:58 +02:00
|
|
|
$array['voicemails'][0]['voicemail_id'] = $voicemail_id;
|
|
|
|
|
$array['voicemails'][0]['voicemail_password'] = $voicemail_password;
|
|
|
|
|
$array['voicemails'][0]['greeting_id'] = $greeting_id != '' ? $greeting_id : null;
|
|
|
|
|
$array['voicemails'][0]['voicemail_alternate_greet_id'] = $voicemail_alternate_greet_id != '' ? $voicemail_alternate_greet_id : null;
|
|
|
|
|
$array['voicemails'][0]['voicemail_mail_to'] = $voicemail_mail_to;
|
|
|
|
|
$array['voicemails'][0]['voicemail_sms_to'] = $voicemail_sms_to;
|
|
|
|
|
$array['voicemails'][0]['voicemail_transcription_enabled'] = $voicemail_transcription_enabled;
|
|
|
|
|
$array['voicemails'][0]['voicemail_tutorial'] = $voicemail_tutorial;
|
2023-06-28 04:47:53 +02:00
|
|
|
if (permission_exists('voicemail_recording_instructions')) {
|
|
|
|
|
$array['voicemails'][0]['voicemail_recording_instructions'] = $voicemail_recording_instructions;
|
|
|
|
|
}
|
|
|
|
|
if (permission_exists('voicemail_recording_options')) {
|
|
|
|
|
$array['voicemails'][0]['voicemail_recording_options'] = $voicemail_recording_options;
|
|
|
|
|
}
|
2022-06-01 18:48:33 +02:00
|
|
|
if (permission_exists('voicemail_file')) {
|
|
|
|
|
$array['voicemails'][0]['voicemail_file'] = $voicemail_file;
|
|
|
|
|
}
|
2024-06-22 01:24:06 +02:00
|
|
|
if (permission_exists('voicemail_local_after_email') && !empty($voicemail_mail_to)) {
|
2019-08-17 15:02:58 +02:00
|
|
|
$array['voicemails'][0]['voicemail_local_after_email'] = $voicemail_local_after_email;
|
|
|
|
|
}
|
2024-06-22 01:24:06 +02:00
|
|
|
else if (permission_exists('voicemail_local_after_forward')) {
|
|
|
|
|
$array['voicemails'][0]['voicemail_local_after_email'] = $voicemail_local_after_forward;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$array['voicemails'][0]['voicemail_local_after_email'] = 'true';
|
|
|
|
|
}
|
|
|
|
|
if (permission_exists('voicemail_local_after_forward')) {
|
|
|
|
|
$array['voicemails'][0]['voicemail_local_after_forward'] = $voicemail_local_after_forward;
|
|
|
|
|
}
|
|
|
|
|
else if (permission_exists('voicemail_local_after_email') && !empty($voicemail_mail_to)) {
|
|
|
|
|
$array['voicemails'][0]['voicemail_local_after_forward'] = $voicemail_local_after_email;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$array['voicemails'][0]['voicemail_local_after_forward'] = 'true';
|
|
|
|
|
}
|
2019-08-17 15:02:58 +02:00
|
|
|
$array['voicemails'][0]['voicemail_enabled'] = $voicemail_enabled;
|
|
|
|
|
$array['voicemails'][0]['voicemail_description'] = $voicemail_description;
|
2020-03-04 03:13:16 +01:00
|
|
|
|
|
|
|
|
//create permissions object
|
2024-11-29 21:57:01 +01:00
|
|
|
$p = permissions::new();
|
2015-02-15 05:54:32 +01:00
|
|
|
|
2019-10-10 17:25:53 +02:00
|
|
|
//add voicemail options
|
2019-10-10 17:34:07 +02:00
|
|
|
if (permission_exists('voicemail_option_add') && sizeof($voicemail_options) > 0) {
|
2020-03-04 03:13:16 +01:00
|
|
|
foreach ($voicemail_options as $x => $voicemail_option) {
|
|
|
|
|
if ($voicemail_option['voicemail_option_digits'] == '' || $voicemail_option['voicemail_option_param'] == '') { unset($voicemail_options[$x]); }
|
2019-10-10 17:25:53 +02:00
|
|
|
}
|
2020-03-04 03:13:16 +01:00
|
|
|
foreach ($voicemail_options as $x => $voicemail_option) {
|
2019-10-10 17:25:53 +02:00
|
|
|
if (is_numeric($voicemail_option["voicemail_option_param"])) {
|
|
|
|
|
//if numeric then add tranfer $1 XML domain_name
|
|
|
|
|
$voicemail_option['voicemail_option_action'] = "menu-exec-app";
|
|
|
|
|
$voicemail_option['voicemail_option_param'] = "transfer ".$voicemail_option["voicemail_option_param"]." XML ".$_SESSION['domain_name'];
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
//seperate the action and the param
|
|
|
|
|
$option_array = explode(":", $voicemail_option["voicemail_option_param"]);
|
|
|
|
|
$voicemail_option['voicemail_option_action'] = array_shift($option_array);
|
|
|
|
|
$voicemail_option['voicemail_option_param'] = join(':', $option_array);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//build insert array
|
2020-03-04 03:13:16 +01:00
|
|
|
$array['voicemail_options'][$x]['voicemail_option_uuid'] = uuid();
|
|
|
|
|
$array['voicemail_options'][$x]['voicemail_uuid'] = $voicemail_uuid;
|
|
|
|
|
$array['voicemail_options'][$x]['domain_uuid'] = $domain_uuid;
|
|
|
|
|
$array['voicemail_options'][$x]['voicemail_option_digits'] = $voicemail_option['voicemail_option_digits'];
|
|
|
|
|
$array['voicemail_options'][$x]['voicemail_option_action'] = $voicemail_option['voicemail_option_action'];
|
2020-02-07 21:03:10 +01:00
|
|
|
if ($destination->valid(preg_replace('/\s/', ':', $voicemail_option['voicemail_option_param'], 1))) {
|
2020-03-04 03:13:16 +01:00
|
|
|
$array['voicemail_options'][$x]['voicemail_option_param'] = $voicemail_option['voicemail_option_param'];
|
2020-02-07 21:03:10 +01:00
|
|
|
}
|
2020-03-04 03:13:16 +01:00
|
|
|
$array['voicemail_options'][$x]['voicemail_option_order'] = $voicemail_option['voicemail_option_order'];
|
|
|
|
|
$array['voicemail_options'][$x]['voicemail_option_description'] = $voicemail_option['voicemail_option_description'];
|
2017-02-16 09:28:28 +01:00
|
|
|
}
|
2023-06-09 18:51:36 +02:00
|
|
|
if (!empty($array['voicemail_options']) && is_array($array['voicemail_options']) && @sizeof($array['voicemail_options']) != 0) {
|
2020-03-04 03:13:16 +01:00
|
|
|
//grant temporary permission
|
2019-10-10 17:25:53 +02:00
|
|
|
$p->add('voicemail_option_add', 'temp');
|
2017-02-16 09:28:28 +01:00
|
|
|
}
|
2019-10-10 17:25:53 +02:00
|
|
|
}
|
2017-02-16 09:28:28 +01:00
|
|
|
|
2020-03-04 03:13:16 +01:00
|
|
|
//add voicemail destination
|
|
|
|
|
if (permission_exists('voicemail_forward') && is_uuid($voicemail_destination)) {
|
|
|
|
|
$array['voicemail_destinations'][0]['domain_uuid'] = $domain_uuid;
|
|
|
|
|
$array['voicemail_destinations'][0]['voicemail_destination_uuid'] = uuid();
|
|
|
|
|
$array['voicemail_destinations'][0]['voicemail_uuid'] = $voicemail_uuid;
|
|
|
|
|
$array['voicemail_destinations'][0]['voicemail_uuid_copy'] = $voicemail_destination;
|
|
|
|
|
|
|
|
|
|
if (is_array($array['voicemail_destinations']) && @sizeof($array['voicemail_destinations']) != 0) {
|
|
|
|
|
//grant temporary permission
|
|
|
|
|
$p->add('voicemail_destination_add', 'temp');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//execute insert/update
|
|
|
|
|
$database = new database;
|
|
|
|
|
$database->app_name = 'voicemails';
|
|
|
|
|
$database->app_uuid = 'b523c2d2-64cd-46f1-9520-ca4b4098e044';
|
|
|
|
|
$database->save($array);
|
|
|
|
|
unset($array);
|
|
|
|
|
|
|
|
|
|
//revoke any temporary permissions granted
|
|
|
|
|
$p->delete('voicemail_option_add', 'temp');
|
|
|
|
|
$p->delete('voicemail_destination_add', 'temp');
|
|
|
|
|
|
2021-11-23 17:56:12 +01:00
|
|
|
//make sure the voicemail directory exists
|
|
|
|
|
if (is_numeric($voicemail_id)) {
|
|
|
|
|
if (!file_exists($_SESSION['switch']['voicemail']['dir']."/default/".$_SESSION['domain_name']."/".$voicemail_id)) {
|
|
|
|
|
mkdir($_SESSION['switch']['voicemail']['dir']."/default/".$_SESSION['domain_name']."/".$voicemail_id, 0770);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-04 03:13:16 +01:00
|
|
|
//remove checked voicemail options
|
|
|
|
|
if (
|
|
|
|
|
$action == 'update'
|
|
|
|
|
&& permission_exists('voicemail_option_delete')
|
|
|
|
|
&& is_array($voicemail_options_delete)
|
|
|
|
|
&& @sizeof($voicemail_options_delete) != 0
|
|
|
|
|
) {
|
|
|
|
|
$obj = new voicemail;
|
|
|
|
|
$obj->voicemail_uuid = $voicemail_uuid;
|
|
|
|
|
$obj->voicemail_options_delete($voicemail_options_delete);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//remove checked voicemail destinations
|
|
|
|
|
if (
|
|
|
|
|
$action == 'update'
|
|
|
|
|
&& permission_exists('voicemail_forward')
|
|
|
|
|
&& is_array($voicemail_destinations_delete)
|
|
|
|
|
&& @sizeof($voicemail_destinations_delete) != 0
|
|
|
|
|
) {
|
|
|
|
|
$obj = new voicemail;
|
|
|
|
|
$obj->voicemail_uuid = $voicemail_uuid;
|
|
|
|
|
$obj->voicemail_destinations_delete($voicemail_destinations_delete);
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-30 22:15:57 +01:00
|
|
|
//clear the destinations session array
|
|
|
|
|
if (isset($_SESSION['destinations']['array'])) {
|
|
|
|
|
unset($_SESSION['destinations']['array']);
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-30 18:10:19 +01:00
|
|
|
//delete record name if requested
|
|
|
|
|
if (
|
2024-05-13 19:39:19 +02:00
|
|
|
(!empty($_POST['recorded_name']) && $_POST['recorded_name'] == 1) &&
|
2024-01-30 18:10:19 +01:00
|
|
|
!empty($_SESSION['switch']['storage']['dir']) &&
|
|
|
|
|
file_exists($_SESSION['switch']['storage']['dir'].'/voicemail/default/'.$_SESSION['domain_name'].'/'.$voicemail_id.'/recorded_name.wav') &&
|
|
|
|
|
(permission_exists('voicemail_greeting_play') || permission_exists('voicemail_greeting_download'))
|
|
|
|
|
) {
|
|
|
|
|
@unlink($_SESSION['switch']['storage']['dir'].'/voicemail/default/'.$_SESSION['domain_name'].'/'.$voicemail_id.'/recorded_name.wav');
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-10 17:25:53 +02:00
|
|
|
//set message
|
|
|
|
|
if ($action == "add" && permission_exists('voicemail_add')) {
|
|
|
|
|
message::add($text['message-add']);
|
2019-08-17 15:02:58 +02:00
|
|
|
}
|
2019-10-10 17:25:53 +02:00
|
|
|
if ($action == "update" && permission_exists('voicemail_edit')) {
|
|
|
|
|
message::add($text['message-update']);
|
2015-02-15 05:54:32 +01:00
|
|
|
}
|
|
|
|
|
|
2019-10-10 17:25:53 +02:00
|
|
|
//redirect user
|
|
|
|
|
if ($action == 'add') {
|
|
|
|
|
header("Location: voicemails.php");
|
|
|
|
|
}
|
|
|
|
|
else if ($action == "update") {
|
|
|
|
|
header("Location: voicemail_edit.php?id=".$voicemail_uuid);
|
|
|
|
|
}
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-12-29 10:17:12 +01:00
|
|
|
|
|
|
|
|
//pre-populate the form
|
2024-01-30 18:10:19 +01:00
|
|
|
if (!empty($_GET) && is_uuid($_GET["id"]) && empty($_POST["persistformvar"])) {
|
2019-08-17 15:02:58 +02:00
|
|
|
$voicemail_uuid = $_GET["id"];
|
2012-12-29 10:17:12 +01:00
|
|
|
$sql = "select * from v_voicemails ";
|
2019-08-17 15:02:58 +02:00
|
|
|
$sql .= "where domain_uuid = :domain_uuid ";
|
|
|
|
|
$sql .= "and voicemail_uuid = :voicemail_uuid ";
|
|
|
|
|
$parameters['domain_uuid'] = $domain_uuid;
|
|
|
|
|
$parameters['voicemail_uuid'] = $voicemail_uuid;
|
|
|
|
|
$database = new database;
|
|
|
|
|
$row = $database->select($sql, $parameters, 'row');
|
2023-05-27 00:17:53 +02:00
|
|
|
if (!empty($row)) {
|
2012-12-29 10:17:12 +01:00
|
|
|
$voicemail_id = $row["voicemail_id"];
|
|
|
|
|
$voicemail_password = $row["voicemail_password"];
|
|
|
|
|
$greeting_id = $row["greeting_id"];
|
2016-09-20 17:51:48 +02:00
|
|
|
$voicemail_alternate_greet_id = $row["voicemail_alternate_greet_id"];
|
2012-12-29 10:17:12 +01:00
|
|
|
$voicemail_mail_to = $row["voicemail_mail_to"];
|
2016-12-01 00:26:39 +01:00
|
|
|
$voicemail_sms_to = $row["voicemail_sms_to"];
|
2017-02-13 21:12:43 +01:00
|
|
|
$voicemail_transcription_enabled = $row["voicemail_transcription_enabled"];
|
2017-03-25 06:06:16 +01:00
|
|
|
$voicemail_tutorial = $row["voicemail_tutorial"];
|
2023-06-28 04:11:01 +02:00
|
|
|
$voicemail_recording_instructions = $row["voicemail_recording_instructions"];
|
|
|
|
|
$voicemail_recording_options = $row["voicemail_recording_options"];
|
2015-02-24 09:09:01 +01:00
|
|
|
$voicemail_file = $row["voicemail_file"];
|
2012-12-29 10:17:12 +01:00
|
|
|
$voicemail_local_after_email = $row["voicemail_local_after_email"];
|
2024-06-22 01:24:06 +02:00
|
|
|
$voicemail_local_after_forward = $row["voicemail_local_after_forward"];
|
2012-12-29 10:17:12 +01:00
|
|
|
$voicemail_enabled = $row["voicemail_enabled"];
|
|
|
|
|
$voicemail_description = $row["voicemail_description"];
|
|
|
|
|
}
|
2019-08-17 15:02:58 +02:00
|
|
|
unset($sql, $parameters, $row);
|
2012-12-29 10:17:12 +01:00
|
|
|
}
|
2015-03-20 02:09:18 +01:00
|
|
|
else {
|
|
|
|
|
$voicemail_file = $_SESSION['voicemail']['voicemail_file']['text'];
|
|
|
|
|
$voicemail_local_after_email = $_SESSION['voicemail']['keep_local']['boolean'];
|
2024-06-22 01:24:06 +02:00
|
|
|
$voicemail_local_after_forward = $_SESSION['voicemail']['keep_local']['boolean'];
|
2015-03-20 02:09:18 +01:00
|
|
|
}
|
2012-12-29 10:17:12 +01:00
|
|
|
|
2013-06-03 16:26:50 +02:00
|
|
|
//remove the spaces
|
2023-05-27 00:17:53 +02:00
|
|
|
if (!empty($voicemail_mail_to)) {
|
|
|
|
|
$voicemail_mail_to = str_replace(" ", "", $voicemail_mail_to);
|
|
|
|
|
}
|
2013-06-03 16:26:50 +02:00
|
|
|
|
2023-02-17 22:21:41 +01:00
|
|
|
//set the defaults
|
2023-05-05 18:46:37 +02:00
|
|
|
if (empty($voicemail_local_after_email)) { $voicemail_local_after_email = 'true'; }
|
2024-06-22 01:24:06 +02:00
|
|
|
if (empty($voicemail_local_after_forward)) { $voicemail_local_after_forward = 'true'; }
|
2023-05-05 18:46:37 +02:00
|
|
|
if (empty($voicemail_enabled)) { $voicemail_enabled = 'true'; }
|
2024-06-22 00:27:58 +02:00
|
|
|
if (empty($voicemail_transcription_enabled)) { $voicemail_transcription_enabled = $_SESSION['voicemail']['transcription_enabled_default']['boolean']; }
|
2023-05-05 18:46:37 +02:00
|
|
|
if (empty($voicemail_tutorial)) { $voicemail_tutorial = 'false'; }
|
2023-06-28 04:11:01 +02:00
|
|
|
if (empty($voicemail_recording_instructions)) { $voicemail_recording_instructions = 'true'; }
|
|
|
|
|
if (empty($voicemail_recording_options)) { $voicemail_recording_options = 'true'; }
|
2013-01-03 00:42:33 +01:00
|
|
|
|
2016-02-25 20:06:45 +01:00
|
|
|
//get the greetings list
|
|
|
|
|
$sql = "select * from v_voicemail_greetings ";
|
2019-08-17 15:02:58 +02:00
|
|
|
$sql .= "where domain_uuid = :domain_uuid ";
|
|
|
|
|
$sql .= "and voicemail_id = :voicemail_id ";
|
2016-02-25 20:06:45 +01:00
|
|
|
$sql .= "order by greeting_name asc ";
|
2019-08-17 15:02:58 +02:00
|
|
|
$parameters['domain_uuid'] = $domain_uuid;
|
|
|
|
|
$parameters['voicemail_id'] = $voicemail_id;
|
|
|
|
|
$database = new database;
|
2023-11-06 18:12:07 +01:00
|
|
|
$rows = $database->select($sql, $parameters, 'all');
|
|
|
|
|
if (!empty($rows) && is_array($rows) && @sizeof($rows) != 0) {
|
|
|
|
|
foreach ($rows as $row) {
|
|
|
|
|
$greetings[$row['greeting_id']] = $row;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
unset($sql, $parameters, $rows, $row);
|
2016-02-25 20:06:45 +01:00
|
|
|
|
2020-03-04 03:13:16 +01:00
|
|
|
//get the voicemail options
|
|
|
|
|
if ($action == 'update' && is_uuid($voicemail_uuid)) {
|
|
|
|
|
$sql = "select * from v_voicemail_options ";
|
|
|
|
|
$sql .= "where domain_uuid = :domain_uuid ";
|
|
|
|
|
$sql .= "and voicemail_uuid = :voicemail_uuid ";
|
|
|
|
|
$sql .= "order by voicemail_option_digits, voicemail_option_order asc ";
|
|
|
|
|
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
|
|
|
|
$parameters['voicemail_uuid'] = $voicemail_uuid;
|
|
|
|
|
$database = new database;
|
|
|
|
|
$voicemail_options = $database->select($sql, $parameters, 'all');
|
|
|
|
|
unset($sql, $parameters);
|
|
|
|
|
|
|
|
|
|
$show_option_delete = false;
|
2023-06-02 22:53:23 +02:00
|
|
|
if (!empty($voicemail_options)) {
|
2020-03-04 03:13:16 +01:00
|
|
|
foreach ($voicemail_options as $x => $field) {
|
|
|
|
|
$voicemail_option_param = $field['voicemail_option_param'];
|
2023-05-05 18:46:37 +02:00
|
|
|
if (empty(trim($voicemail_option_param))) {
|
2020-03-04 03:13:16 +01:00
|
|
|
$voicemail_option_param = $field['voicemail_option_action'];
|
|
|
|
|
}
|
|
|
|
|
$voicemail_option_param = str_replace("menu-", "", $voicemail_option_param);
|
|
|
|
|
$voicemail_option_param = str_replace("XML", "", $voicemail_option_param);
|
|
|
|
|
$voicemail_option_param = str_replace("transfer", "", $voicemail_option_param);
|
|
|
|
|
$voicemail_option_param = str_replace("bridge", "", $voicemail_option_param);
|
|
|
|
|
$voicemail_option_param = str_replace($_SESSION['domain_name'], "", $voicemail_option_param);
|
|
|
|
|
$voicemail_option_param = str_replace("\${domain_name}", "", $voicemail_option_param);
|
|
|
|
|
$voicemail_option_param = str_replace("\${domain}", "", $voicemail_option_param);
|
|
|
|
|
$voicemail_option_param = ucfirst(trim($voicemail_option_param));
|
|
|
|
|
$voicemail_options[$x]['voicemail_option_param'] = $voicemail_option_param;
|
|
|
|
|
unset($voicemail_option_param);
|
|
|
|
|
}
|
|
|
|
|
$show_option_delete = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//get the assigned voicemail destinations
|
|
|
|
|
if ($action == 'update' && is_uuid($voicemail_uuid)) {
|
|
|
|
|
$sql = "select v.voicemail_id, d.voicemail_destination_uuid, d.voicemail_uuid_copy ";
|
|
|
|
|
$sql .= "from v_voicemails as v, v_voicemail_destinations as d ";
|
|
|
|
|
$sql .= "where d.voicemail_uuid_copy = v.voicemail_uuid and ";
|
|
|
|
|
$sql .= "v.domain_uuid = :domain_uuid and ";
|
|
|
|
|
$sql .= "v.voicemail_enabled = 'true' and ";
|
|
|
|
|
$sql .= "d.voicemail_uuid = :voicemail_uuid ";
|
|
|
|
|
$sql .= "order by v.voicemail_id asc";
|
|
|
|
|
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
|
|
|
|
$parameters['voicemail_uuid'] = $voicemail_uuid;
|
|
|
|
|
$database = new database;
|
|
|
|
|
$voicemail_destinations_assigned = $database->select($sql, $parameters, 'all');
|
|
|
|
|
if (is_array($voicemail_destinations_assigned) && @sizeof($voicemail_destinations_assigned) != 0) {
|
|
|
|
|
foreach ($voicemail_destinations_assigned as $field) {
|
|
|
|
|
$voicemail_destinations[] = "'".$field['voicemail_uuid_copy']."'";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
unset($sql, $parameters);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//get the available voicemail destinations
|
|
|
|
|
$sql = "select v.voicemail_id, v.voicemail_uuid ";
|
|
|
|
|
$sql .= "from v_voicemails as v ";
|
|
|
|
|
$sql .= "where v.domain_uuid = :domain_uuid and ";
|
|
|
|
|
$sql .= "v.voicemail_enabled = 'true' ";
|
2023-05-27 00:17:53 +02:00
|
|
|
if (is_uuid($voicemail_uuid ?? '')) {
|
2020-03-04 03:13:16 +01:00
|
|
|
$sql .= "and v.voicemail_uuid <> :voicemail_uuid ";
|
|
|
|
|
}
|
2023-05-27 00:17:53 +02:00
|
|
|
if (!empty($voicemail_destinations)) {
|
2020-03-04 03:13:16 +01:00
|
|
|
$sql .= "and v.voicemail_uuid not in (".implode(',', $voicemail_destinations).") ";
|
|
|
|
|
}
|
|
|
|
|
$sql .= "order by v.voicemail_id asc";
|
|
|
|
|
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
2023-06-02 22:53:23 +02:00
|
|
|
if (!empty($voicemail_uuid) && is_uuid($voicemail_uuid)) {
|
2020-03-04 03:13:16 +01:00
|
|
|
$parameters['voicemail_uuid'] = $voicemail_uuid;
|
|
|
|
|
}
|
|
|
|
|
$database = new database;
|
|
|
|
|
$voicemail_destinations_available = $database->select($sql, $parameters, 'all');
|
|
|
|
|
unset($sql, $parameters, $voicemail_destinations);
|
|
|
|
|
|
2019-09-19 15:45:34 +02:00
|
|
|
//create token
|
|
|
|
|
$object = new token;
|
|
|
|
|
$token = $object->create($_SERVER['PHP_SELF']);
|
|
|
|
|
|
2020-02-07 14:52:58 +01:00
|
|
|
//include the header
|
2015-02-15 05:54:32 +01:00
|
|
|
$document['title'] = $text['title-voicemail'];
|
2020-02-07 14:52:58 +01:00
|
|
|
require_once "resources/header.php";
|
2012-12-29 10:17:12 +01:00
|
|
|
|
2017-07-30 18:53:32 +02:00
|
|
|
//password complexity
|
2023-05-27 00:17:53 +02:00
|
|
|
$password_complexity = $_SESSION['voicemail']['password_complexity']['boolean'] ?? '';
|
2017-07-30 18:53:32 +02:00
|
|
|
if ($password_complexity == "true") {
|
2024-06-22 00:27:58 +02:00
|
|
|
echo "<script>\n";
|
2017-07-30 18:53:32 +02:00
|
|
|
$req['length'] = $_SESSION['voicemail']['password_min_length']['numeric'];
|
|
|
|
|
echo " function check_password_strength(pwd) {\n";
|
|
|
|
|
echo " var msg_errors = [];\n";
|
|
|
|
|
//length
|
|
|
|
|
if (is_numeric($req['length']) && $req['length'] != 0) {
|
2024-06-22 00:27:58 +02:00
|
|
|
echo " var re = /.{".$req['length'].",}/;\n";
|
2017-07-30 18:53:32 +02:00
|
|
|
echo " if (!re.test(pwd)) { msg_errors.push('".$req['length']."+ ".$text['label-digits']."'); }\n";
|
|
|
|
|
}
|
|
|
|
|
//numberic only
|
|
|
|
|
echo " var re = /(?=.*[a-zA-Z\W])/;\n";
|
|
|
|
|
echo " if (re.test(pwd)) { msg_errors.push('".$text['label-numberic_only']."'); }\n";
|
|
|
|
|
//repeating digits
|
|
|
|
|
echo " var re = /(\d)\\1{2}/;\n";
|
|
|
|
|
echo " if (re.test(pwd)) { msg_errors.push('".$text['label-password_repeating']."'); }\n";
|
|
|
|
|
//sequential digits
|
|
|
|
|
echo " var re = /(012|123|345|456|567|678|789|987|876|765|654|543|432|321|210)/;\n";
|
|
|
|
|
echo " if (re.test(pwd)) { msg_errors.push('".$text['label-password_sequential']."'); }\n";
|
2024-06-22 00:27:58 +02:00
|
|
|
|
2017-07-30 18:53:32 +02:00
|
|
|
echo " if (msg_errors.length > 0) {\n";
|
|
|
|
|
echo " var msg = '".$text['message-password_requirements'].": ' + msg_errors.join(', ');\n";
|
|
|
|
|
echo " display_message(msg, 'negative', '6000');\n";
|
|
|
|
|
echo " return false;\n";
|
|
|
|
|
echo " }\n";
|
|
|
|
|
echo " else {\n";
|
|
|
|
|
echo " return true;\n";
|
|
|
|
|
echo " }\n";
|
|
|
|
|
echo " }\n";
|
|
|
|
|
echo "</script>\n";
|
|
|
|
|
}
|
2019-10-10 20:25:28 +02:00
|
|
|
|
|
|
|
|
//set the location for the back button
|
|
|
|
|
if (permission_exists('voicemail_view')) {
|
|
|
|
|
$back_button_location = "voicemails.php";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$back_button_location = "voicemail_messages.php?voicemail_uuid=".urlencode($voicemail_uuid);
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-29 10:17:12 +01:00
|
|
|
//show the content
|
2023-11-06 18:12:07 +01:00
|
|
|
if (permission_exists('voicemail_greeting_play') || permission_exists('voicemail_greeting_download')) {
|
|
|
|
|
echo "<script type='text/javascript' language='JavaScript'>\n";
|
2023-11-06 20:44:21 +01:00
|
|
|
echo " function set_playable(id, audio_selected, mime_type) {\n";
|
|
|
|
|
echo " if (mime_type != undefined && mime_type != '' && audio_selected != undefined) {\n";
|
|
|
|
|
echo " $('#recording_audio_' + id).attr('src', '../voicemail_greetings/voicemail_greetings.php?id=".escape($voicemail_id)."&a=download&type=rec&uuid=' + audio_selected);\n";
|
|
|
|
|
echo " $('#recording_audio_' + id).attr('type', mime_type);\n";
|
2023-11-06 18:12:07 +01:00
|
|
|
echo " $('#recording_button_' + id).show();\n";
|
|
|
|
|
echo " }\n";
|
|
|
|
|
echo " else {\n";
|
|
|
|
|
echo " $('#recording_button_' + id).hide();\n";
|
|
|
|
|
echo " $('#recording_audio_' + id).attr('src','').attr('type','');\n";
|
|
|
|
|
echo " }\n";
|
|
|
|
|
echo " }\n";
|
|
|
|
|
echo "</script>\n";
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-07 14:52:58 +01:00
|
|
|
echo "<form method='post' name='frm' id='frm'>\n";
|
|
|
|
|
|
|
|
|
|
echo "<div class='action_bar' id='action_bar'>\n";
|
|
|
|
|
echo " <div class='heading'><b>".$text['title-voicemail']."</b></div>\n";
|
|
|
|
|
echo " <div class='actions'>\n";
|
2020-03-05 08:05:45 +01:00
|
|
|
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','link'=>$back_button_location]);
|
2020-03-04 03:13:16 +01:00
|
|
|
if ($action == "update" && (permission_exists('voicemail_delete') || permission_exists('voicemail_option_delete'))) {
|
2020-03-27 00:29:07 +01:00
|
|
|
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'name'=>'btn_delete','style'=>'margin-left: 15px;','onclick'=>"modal_open('modal-delete','btn_delete');"]);
|
2020-03-04 03:13:16 +01:00
|
|
|
}
|
2020-03-05 01:59:32 +01:00
|
|
|
echo button::create(['type'=>'button','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'id'=>'btn_save','style'=>'margin-left: 15px;','onclick'=>($password_complexity == "true" ? "if (check_password_strength(document.getElementById('password').value)) { submit_form(); } else { this.blur(); return false; }" : 'submit_form();')]);
|
2020-02-07 14:52:58 +01:00
|
|
|
echo " </div>\n";
|
|
|
|
|
echo " <div style='clear: both;'></div>\n";
|
|
|
|
|
echo "</div>\n";
|
|
|
|
|
|
2020-03-26 23:34:03 +01:00
|
|
|
if ($action == "update" && (permission_exists('voicemail_delete') || permission_exists('voicemail_option_delete'))) {
|
2020-03-27 00:29:07 +01:00
|
|
|
echo modal::create(['id'=>'modal-delete','type'=>'delete','actions'=>button::create(['type'=>'submit','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_delete','style'=>'float: right; margin-left: 15px;','collapse'=>'never','name'=>'action','value'=>'delete','onclick'=>"modal_close();"])]);
|
2020-03-26 23:34:03 +01:00
|
|
|
}
|
|
|
|
|
|
2024-09-06 01:10:04 +02:00
|
|
|
echo "<div class='card'>\n";
|
2015-02-15 05:54:32 +01:00
|
|
|
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
2012-12-29 10:17:12 +01:00
|
|
|
|
|
|
|
|
echo "<tr>\n";
|
2020-02-07 14:52:58 +01:00
|
|
|
echo "<td width='30%' class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
2015-02-15 05:54:32 +01:00
|
|
|
echo " ".$text['label-voicemail_id']."\n";
|
2012-12-29 10:17:12 +01:00
|
|
|
echo "</td>\n";
|
2020-02-07 14:52:58 +01:00
|
|
|
echo "<td width='70%' class='vtable' align='left'>\n";
|
2020-03-04 03:13:16 +01:00
|
|
|
echo " <input class='formfld' type='text' name='voicemail_id' maxlength='255' autocomplete='new-password' value='".escape($voicemail_id)."'>\n";
|
2019-04-14 01:39:43 +02:00
|
|
|
echo " <input type='text' style='display: none;' disabled='disabled'>\n"; //help defeat browser auto-fill
|
2012-12-29 10:17:12 +01:00
|
|
|
echo "<br />\n";
|
|
|
|
|
echo $text['description-voicemail_id']."\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
|
|
|
|
|
echo "<tr>\n";
|
2014-06-22 06:34:19 +02:00
|
|
|
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
2015-02-15 05:54:32 +01:00
|
|
|
echo " ".$text['label-voicemail_password']."\n";
|
2012-12-29 10:17:12 +01:00
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "<td class='vtable' align='left'>\n";
|
2019-04-14 01:39:43 +02:00
|
|
|
echo " <input type='password' style='display: none;' disabled='disabled'>\n"; //help defeat browser auto-fill
|
2020-03-04 03:13:16 +01:00
|
|
|
echo " <input class='formfld' type='password' name='voicemail_password' id='password' autocomplete='new-password' onmouseover=\"this.type='text';\" onfocus=\"this.type='text';\" onmouseout=\"if (!$(this).is(':focus')) { this.type='password'; }\" onblur=\"this.type='password';\" autocomplete='off' maxlength='50' value=\"".escape($voicemail_password)."\">\n";
|
2012-12-29 10:17:12 +01:00
|
|
|
echo "<br />\n";
|
2014-03-07 02:52:44 +01:00
|
|
|
echo $text['description-voicemail_password']."\n";
|
2012-12-29 10:17:12 +01:00
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
|
2017-03-25 06:06:16 +01:00
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
|
|
|
|
echo " ".$text['label-voicemail_tutorial']."\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "<td class='vtable' align='left'>\n";
|
|
|
|
|
echo " <select class='formfld' name='voicemail_tutorial' id='voicemail_tutorial'>\n";
|
|
|
|
|
echo " <option value='true' ".(($voicemail_tutorial == "true") ? "selected='selected'" : null).">".$text['label-true']."</option>\n";
|
|
|
|
|
echo " <option value='false' ".(($voicemail_tutorial == "false") ? "selected='selected'" : null).">".$text['label-false']."</option>\n";
|
|
|
|
|
echo " </select>\n";
|
|
|
|
|
echo "<br />\n";
|
|
|
|
|
echo $text['description-voicemail_tutorial']."\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
2024-01-30 18:10:19 +01:00
|
|
|
|
|
|
|
|
if (
|
|
|
|
|
!empty($_SESSION['switch']['storage']['dir']) &&
|
|
|
|
|
file_exists($_SESSION['switch']['storage']['dir'].'/voicemail/default/'.$_SESSION['domain_name'].'/'.$voicemail_id.'/recorded_name.wav') &&
|
|
|
|
|
(permission_exists('voicemail_greeting_play') || permission_exists('voicemail_greeting_download'))
|
|
|
|
|
) {
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo "<td class='vncell' rowspan='2' valign='top' align='left' nowrap='nowrap'>\n";
|
|
|
|
|
echo " ".$text['label-recorded_name']."\n";
|
|
|
|
|
echo "</td>\n";
|
2024-02-09 21:14:04 +01:00
|
|
|
echo "<td class='vtable playback_progress_bar_background' id='recording_progress_bar_recorded_name' onclick=\"recording_play('recorded_name','".escape($voicemail_id)."','recorded_name')\" style='display: none; border-bottom: none; padding-top: 0 !important; padding-bottom: 0 !important;' align='left'><span class='playback_progress_bar' id='recording_progress_recorded_name'></span></td>\n";
|
2024-01-30 18:10:19 +01:00
|
|
|
echo "</tr>\n";
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo "<td class='vtable' align='left'>\n";
|
|
|
|
|
echo "<audio id='recording_audio_recorded_name' style='display: none;' preload='none' ontimeupdate=\"update_progress('recorded_name')\" onended=\"recording_reset('recorded_name');\" src='voicemail_name.php?id=".escape($voicemail_id)."' type='audio/x-wav'></audio>";
|
2024-02-09 21:14:04 +01:00
|
|
|
echo button::create(['type'=>'button','title'=>$text['label-play'].' / '.$text['label-pause'],'icon'=>$_SESSION['theme']['button_icon_play'],'id'=>'recording_button_recorded_name','style'=>'display: inline-block; margin-right: 15px; margin-top: -2px;','onclick'=>"recording_play('recorded_name','".escape($voicemail_id)."','recorded_name')"]);
|
2024-01-30 18:10:19 +01:00
|
|
|
echo "<input type='checkbox' name='recorded_name' id='recorded_name' value='1'><label for='recorded_name' style='display: inline-block; padding-top: 4px; padding-left: 5px;'>".$text['label-delete']."</label>";
|
|
|
|
|
echo "<br />\n";
|
|
|
|
|
echo $text['description-recorded_name']."\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-29 10:17:12 +01:00
|
|
|
echo "<tr>\n";
|
2023-11-06 18:12:07 +01:00
|
|
|
echo "<td class='vncell' rowspan='2' valign='top' align='left' nowrap='nowrap'>\n";
|
2016-02-25 20:06:45 +01:00
|
|
|
echo " ".$text['label-greeting']."\n";
|
2012-12-29 10:17:12 +01:00
|
|
|
echo "</td>\n";
|
2024-05-13 19:39:19 +02:00
|
|
|
echo "<td class='vtable playback_progress_bar_background' id='recording_progress_bar_greeting' onclick=\"recording_play('greeting','".escape($voicemail_id).'|'.escape($greetings[($greeting_id ?? '')]['voicemail_greeting_uuid'] ?? '')."','greeting')\" style='display: none; border-bottom: none; padding-top: 0 !important; padding-bottom: 0 !important;' align='left'><span class='playback_progress_bar' id='recording_progress_greeting'></span></td>\n";
|
2023-11-06 18:12:07 +01:00
|
|
|
echo "</tr>\n";
|
|
|
|
|
echo "<tr>\n";
|
2012-12-29 10:17:12 +01:00
|
|
|
echo "<td class='vtable' align='left'>\n";
|
2023-11-06 20:44:21 +01:00
|
|
|
echo " <select class='formfld' name='greeting_id' id='greeting_id' onchange=\"if (this.selectedIndex == 0) { $('#alternate_greeting_id').slideDown(); } else { $('#alternate_greeting_id').slideUp(); } ".(permission_exists('voicemail_greeting_play') || permission_exists('voicemail_greeting_download') ? "recording_reset('greeting'); set_playable('greeting', this.options[this.selectedIndex].getAttribute('data-uuid'), this.options[this.selectedIndex].getAttribute('data-mime'));" : null)."\">\n";
|
2020-05-16 20:28:41 +02:00
|
|
|
echo " <option value=''>".$text['label-default']."</option>\n";
|
2023-06-28 00:23:04 +02:00
|
|
|
echo " <option value='0' ".(isset($greeting_id) && $greeting_id == "0" ? "selected='selected'" : null).">".$text['label-none']."</option>\n";
|
2023-11-06 20:44:21 +01:00
|
|
|
$playable = false;
|
2024-05-13 19:39:19 +02:00
|
|
|
if (!empty($greetings) && is_array($greetings)) {
|
2016-02-25 20:06:45 +01:00
|
|
|
foreach ($greetings as $greeting) {
|
2023-11-06 18:12:07 +01:00
|
|
|
if (!empty($greeting_id) && $greeting['greeting_id'] == $greeting_id) {
|
|
|
|
|
$selected = "selected='selected'";
|
2023-11-06 20:44:21 +01:00
|
|
|
$playable = $greeting['greeting_filename'];
|
2023-11-06 18:12:07 +01:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
unset($selected);
|
|
|
|
|
}
|
2023-11-06 20:44:21 +01:00
|
|
|
if ((permission_exists('voicemail_greeting_play') || permission_exists('voicemail_greeting_download')) && !empty($greeting['greeting_filename'])) {
|
|
|
|
|
switch (pathinfo($greeting['greeting_filename'], PATHINFO_EXTENSION)) {
|
|
|
|
|
case 'wav' : $mime_type = 'audio/wav'; break;
|
|
|
|
|
case 'mp3' : $mime_type = 'audio/mpeg'; break;
|
|
|
|
|
case 'ogg' : $mime_type = 'audio/ogg'; break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
echo "<option value='".escape($greeting['greeting_id'])."' ".($selected ?? '')." data-uuid='".$greeting['voicemail_greeting_uuid']."' data-mime='".$mime_type."'>".escape($greeting['greeting_name'])."</option>\n";
|
2016-02-25 20:06:45 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
echo " </select>\n";
|
2023-11-07 03:23:12 +01:00
|
|
|
if ((permission_exists('voicemail_greeting_play') || permission_exists('voicemail_greeting_download')) && (!empty($playable) || empty($greeting_id))) {
|
2024-05-13 19:39:19 +02:00
|
|
|
echo "<audio id='recording_audio_greeting' style='display: none;' preload='none' ontimeupdate=\"update_progress('greeting')\" onended=\"recording_reset('greeting');\" src='../voicemail_greetings/voicemail_greetings.php?id=".escape($voicemail_id)."&a=download&type=rec&uuid=".escape($greetings[($greeting_id ?? '')]['voicemail_greeting_uuid'] ?? '')."' type='".($mime_type ?? '')."'></audio>";
|
|
|
|
|
echo button::create(['type'=>'button','title'=>$text['label-play'].' / '.$text['label-pause'],'icon'=>$_SESSION['theme']['button_icon_play'],'id'=>'recording_button_greeting','style'=>'display: '.(!empty($greeting_id) ? 'inline' : 'none'),'onclick'=>"recording_play('greeting','".escape($voicemail_id).'|'.escape($greetings[($greeting_id ?? '')]['voicemail_greeting_uuid'] ?? '')."','greeting')"]);
|
2023-11-06 20:44:21 +01:00
|
|
|
unset($playable, $mime_type);
|
2023-11-06 18:12:07 +01:00
|
|
|
}
|
2012-12-29 10:17:12 +01:00
|
|
|
echo "<br />\n";
|
2016-02-25 20:06:45 +01:00
|
|
|
echo $text['description-greeting']."\n";
|
2012-12-29 10:17:12 +01:00
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
|
2023-06-28 04:11:01 +02:00
|
|
|
echo "</table>\n";
|
|
|
|
|
|
|
|
|
|
echo "<div id='alternate_greeting_id' ".(!isset($greeting_id) ? null : "style='display: none;'").">\n";
|
|
|
|
|
echo " <table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
|
|
|
|
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo "<td width='30%' class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
|
|
|
|
echo " ".$text['label-voicemail_alternate_greet_id']."\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "<td width='70%' class='vtable' align='left'>\n";
|
|
|
|
|
echo " <input class='formfld' type='text' name='voicemail_alternate_greet_id' maxlength='255' value='".escape($voicemail_alternate_greet_id)."'>\n";
|
|
|
|
|
echo " <br />\n";
|
|
|
|
|
echo " ".$text['description-voicemail_alternate_greet_id']."\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
|
|
|
|
|
echo " </table>\n";
|
|
|
|
|
echo "</div>\n";
|
|
|
|
|
|
|
|
|
|
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
|
|
|
|
|
2023-06-28 04:47:53 +02:00
|
|
|
if (permission_exists('voicemail_recording_instructions')) {
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo "<td width='30%' class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
|
|
|
|
echo " ".$text['label-recording_instructions']."\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "<td width='70%' class='vtable' align='left'>\n";
|
|
|
|
|
echo " <select class='formfld' name='voicemail_recording_instructions' id='voicemail_recording_instructions'>\n";
|
|
|
|
|
echo " <option value='true'>".$text['label-true']."</option>\n";
|
|
|
|
|
echo " <option value='false' ".(!empty($voicemail_recording_instructions) && $voicemail_recording_instructions == "false" ? "selected='selected'" : null).">".$text['label-false']."</option>\n";
|
|
|
|
|
echo " </select>\n";
|
|
|
|
|
echo "<br />\n";
|
|
|
|
|
echo $text['description-recording_instructions']."\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
}
|
2023-06-28 04:11:01 +02:00
|
|
|
|
2023-06-28 04:47:53 +02:00
|
|
|
if (permission_exists('voicemail_recording_options')) {
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
|
|
|
|
echo " ".$text['label-recording_options']."\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "<td class='vtable' align='left'>\n";
|
|
|
|
|
echo " <select class='formfld' name='voicemail_recording_options' id='voicemail_recording_options'>\n";
|
|
|
|
|
echo " <option value='true'>".$text['label-true']."</option>\n";
|
|
|
|
|
echo " <option value='false' ".(!empty($voicemail_recording_options) && $voicemail_recording_options == "false" ? "selected='selected'" : null).">".$text['label-false']."</option>\n";
|
|
|
|
|
echo " </select>\n";
|
|
|
|
|
echo "<br />\n";
|
|
|
|
|
echo $text['description-recording_options']."\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
}
|
2016-09-20 17:51:48 +02:00
|
|
|
|
2019-10-10 17:34:07 +02:00
|
|
|
if (permission_exists('voicemail_option_add') || permission_exists('voicemail_option_edit')) {
|
2019-10-10 17:25:53 +02:00
|
|
|
echo " <tr>";
|
2023-06-28 04:47:53 +02:00
|
|
|
echo " <td width='30%' class='vncell' valign='top'>".$text['label-options']."</td>";
|
|
|
|
|
echo " <td width='70%' class='vtable' align='left'>";
|
2020-03-04 03:13:16 +01:00
|
|
|
echo " <table border='0' cellpadding='0' cellspacing='0'>\n";
|
2019-10-10 17:25:53 +02:00
|
|
|
echo " <tr>\n";
|
2020-03-04 03:13:16 +01:00
|
|
|
echo " <td class='vtable' style='text-align: center;'>".$text['label-option']."</td>\n";
|
2019-10-10 17:25:53 +02:00
|
|
|
echo " <td class='vtable'>".$text['label-destination']."</td>\n";
|
2020-03-04 03:13:16 +01:00
|
|
|
echo " <td class='vtable' style='text-align: center;'>".$text['label-order']."</td>\n";
|
2019-10-10 17:25:53 +02:00
|
|
|
echo " <td class='vtable'>".$text['label-description']."</td>\n";
|
2020-03-04 03:13:16 +01:00
|
|
|
if ($show_option_delete && permission_exists('voicemail_option_delete')) {
|
|
|
|
|
echo " <td class='vtable edit_delete_checkbox_all' onmouseover=\"swap_display('delete_label_options', 'delete_toggle_options');\" onmouseout=\"swap_display('delete_label_options', 'delete_toggle_options');\">\n";
|
|
|
|
|
echo " <span id='delete_label_options'>".$text['label-delete']."</span>\n";
|
|
|
|
|
echo " <span id='delete_toggle_options'><input type='checkbox' id='checkbox_all_options' name='checkbox_all' onclick=\"edit_all_toggle('options');\"></span>\n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
}
|
2019-10-10 17:25:53 +02:00
|
|
|
echo " </tr>\n";
|
2020-03-04 03:13:16 +01:00
|
|
|
if ($action == 'update' && is_array($voicemail_options) && @sizeof($voicemail_options) != 0) {
|
2020-03-05 08:05:45 +01:00
|
|
|
foreach ($voicemail_options as $x => $field) {
|
2020-03-04 03:13:16 +01:00
|
|
|
echo " <tr>\n";
|
|
|
|
|
echo " <td class='vtable' style='text-align: center;'>".escape($field['voicemail_option_digits'])."</td>\n";
|
|
|
|
|
echo " <td class='vtable'>".escape($field['voicemail_option_param'])."</td>\n";
|
|
|
|
|
echo " <td class='vtable' style='text-align: center;'>".escape($field['voicemail_option_order'])."</td>\n";
|
|
|
|
|
echo " <td class='vtable'>".escape($field['voicemail_option_description'])."</td>\n";
|
|
|
|
|
if ($show_option_delete && permission_exists('voicemail_option_delete')) {
|
|
|
|
|
echo " <td class='vtable' style='text-align: center; padding-bottom: 3px;'>";
|
|
|
|
|
if (is_uuid($field['voicemail_option_uuid'])) {
|
|
|
|
|
echo " <input type='checkbox' name='voicemail_options_delete[".$x."][checked]' value='true' class='chk_delete checkbox_options' onclick=\"edit_delete_action('options');\">\n";
|
|
|
|
|
echo " <input type='hidden' name='voicemail_options_delete[".$x."][uuid]' value='".escape($field['voicemail_option_uuid'])."' />\n";
|
2019-10-10 17:25:53 +02:00
|
|
|
}
|
2020-03-04 03:13:16 +01:00
|
|
|
echo " </td>\n";
|
2019-08-17 15:02:58 +02:00
|
|
|
}
|
2020-03-04 03:13:16 +01:00
|
|
|
echo " </tr>\n";
|
2015-02-15 05:54:32 +01:00
|
|
|
}
|
|
|
|
|
}
|
2020-03-04 03:13:16 +01:00
|
|
|
unset($voicemail_options, $field);
|
2015-02-15 05:54:32 +01:00
|
|
|
|
2019-10-10 17:25:53 +02:00
|
|
|
for ($c = 0; $c < 1; $c++) {
|
2020-03-04 03:13:16 +01:00
|
|
|
echo "<tr>\n";
|
2020-03-04 07:23:57 +01:00
|
|
|
echo " <td class='vtable' style='border-bottom: none;' align='left'>\n";
|
2020-03-04 03:13:16 +01:00
|
|
|
echo " <input class='formfld' style='width: 50px; text-align: center;' type='text' name='voicemail_options[".$c."][voicemail_option_digits]' maxlength='255' value='".$voicemail_option_digits."'>\n";
|
|
|
|
|
echo " </td>\n";
|
2020-03-04 07:23:57 +01:00
|
|
|
echo " <td class='vtable' style='border-bottom: none;' align='left' nowrap='nowrap'>\n";
|
2020-03-04 03:13:16 +01:00
|
|
|
echo $destination->select('ivr', 'voicemail_options['.$c.'][voicemail_option_param]', '');
|
|
|
|
|
echo " </td>\n";
|
2020-03-04 07:23:57 +01:00
|
|
|
echo " <td class='vtable' style='border-bottom: none;' align='left'>\n";
|
2020-03-04 03:13:16 +01:00
|
|
|
echo " <select name='voicemail_options[".$c."][voicemail_option_order]' class='formfld' style='width:55px'>\n";
|
2023-06-09 18:51:36 +02:00
|
|
|
if (strlen(htmlspecialchars($voicemail_option_order ?? ''))> 0) {
|
2020-03-04 03:13:16 +01:00
|
|
|
echo " <option selected='yes' value='".htmlspecialchars($voicemail_option_order)."'>".htmlspecialchars($voicemail_option_order)."</option>\n";
|
2015-02-15 05:54:32 +01:00
|
|
|
}
|
2019-10-10 17:25:53 +02:00
|
|
|
$i = 0;
|
|
|
|
|
while ($i <= 999) {
|
|
|
|
|
if (strlen($i) == 1) {
|
|
|
|
|
echo " <option value='00$i'>00$i</option>\n";
|
|
|
|
|
}
|
|
|
|
|
if (strlen($i) == 2) {
|
|
|
|
|
echo " <option value='0$i'>0$i</option>\n";
|
|
|
|
|
}
|
|
|
|
|
if (strlen($i) == 3) {
|
|
|
|
|
echo " <option value='$i'>$i</option>\n";
|
|
|
|
|
}
|
|
|
|
|
$i++;
|
2015-02-15 05:54:32 +01:00
|
|
|
}
|
2020-03-04 03:13:16 +01:00
|
|
|
echo " </select>\n";
|
|
|
|
|
echo " </td>\n";
|
2020-03-04 07:23:57 +01:00
|
|
|
echo " <td class='vtable' style='border-bottom: none;' align='left'>\n";
|
2020-03-04 03:13:16 +01:00
|
|
|
echo " <input class='formfld' style='width:100px' type='text' name='voicemail_options[".$c."][voicemail_option_description]' maxlength='255' value=\"".$voicemail_option_description."\">\n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
|
|
|
|
|
echo " <td></td>\n";
|
|
|
|
|
echo "</tr>\n";
|
2015-02-15 05:54:32 +01:00
|
|
|
}
|
2020-03-04 03:13:16 +01:00
|
|
|
|
2019-10-10 17:25:53 +02:00
|
|
|
echo " </table>\n";
|
2015-02-15 05:54:32 +01:00
|
|
|
|
2019-10-10 17:25:53 +02:00
|
|
|
echo " ".$text['description-options']."\n";
|
|
|
|
|
echo " <br />\n";
|
|
|
|
|
echo " </td>";
|
|
|
|
|
echo " </tr>";
|
2015-02-15 05:54:32 +01:00
|
|
|
}
|
|
|
|
|
|
2012-12-29 10:17:12 +01:00
|
|
|
echo "<tr>\n";
|
2023-06-28 04:47:53 +02:00
|
|
|
echo "<td width='30%' class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
2015-02-15 05:54:32 +01:00
|
|
|
echo " ".$text['label-voicemail_mail_to']."\n";
|
2012-12-29 10:17:12 +01:00
|
|
|
echo "</td>\n";
|
2023-06-28 04:47:53 +02:00
|
|
|
echo "<td width='70%' class='vtable' align='left'>\n";
|
2018-06-09 20:05:36 +02:00
|
|
|
echo " <input class='formfld' type='text' name='voicemail_mail_to' maxlength='255' value=\"".escape($voicemail_mail_to)."\">\n";
|
2012-12-29 10:17:12 +01:00
|
|
|
echo "<br />\n";
|
|
|
|
|
echo $text['description-voicemail_mail_to']."\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
2019-10-10 17:25:53 +02:00
|
|
|
|
2020-06-02 22:29:00 +02:00
|
|
|
if (permission_exists('voicemail_sms_edit') && file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH.'/app/sms/')) {
|
2016-12-01 00:26:39 +01:00
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
|
|
|
|
echo " ".$text['label-voicemail_sms_to']."\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "<td class='vtable' align='left'>\n";
|
2018-06-09 20:05:36 +02:00
|
|
|
echo " <input class='formfld' type='text' name='voicemail_sms_to' maxlength='255' value=\"".escape($voicemail_sms_to)."\">\n";
|
2016-12-01 00:26:39 +01:00
|
|
|
echo "<br />\n";
|
|
|
|
|
echo $text['description-voicemail_sms_to']."\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
}
|
2019-10-10 17:25:53 +02:00
|
|
|
|
2024-06-22 00:27:58 +02:00
|
|
|
if (permission_exists('voicemail_transcription_enabled') && ($_SESSION['transcribe']['enabled']['boolean'] ?? '') == "true") {
|
2017-02-13 21:12:43 +01:00
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
|
|
|
|
echo " ".$text['label-voicemail_transcription_enabled']."\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "<td class='vtable' align='left'>\n";
|
|
|
|
|
echo " <select class='formfld' name='voicemail_transcription_enabled' id='voicemail_transcription_enabled'>\n";
|
|
|
|
|
echo " <option value='true' ".(($voicemail_transcription_enabled == "true") ? "selected='selected'" : null).">".$text['label-true']."</option>\n";
|
2024-06-22 00:16:05 +02:00
|
|
|
echo " <option value='false' ".((empty($voicemail_transcription_enabled) || $voicemail_transcription_enabled == "false") ? "selected='selected'" : null).">".$text['label-false']."</option>\n";
|
2017-02-13 21:12:43 +01:00
|
|
|
echo " </select>\n";
|
|
|
|
|
echo "<br />\n";
|
|
|
|
|
echo $text['description-voicemail_transcription_enabled']."\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
}
|
2012-12-29 10:17:12 +01:00
|
|
|
|
2022-06-01 18:48:33 +02:00
|
|
|
if (permission_exists('voicemail_file')) {
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
|
|
|
|
echo " ".$text['label-voicemail_file']."\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "<td class='vtable' align='left'>\n";
|
2023-02-07 00:24:49 +01:00
|
|
|
echo " <select class='formfld' name='voicemail_file' id='voicemail_file' onchange=\"if (this.selectedIndex != 2) { document.getElementById('voicemail_local_after_email').selectedIndex = 0; }\">\n";
|
|
|
|
|
echo " <option value=''>".$text['option-voicemail_file_listen']."</option>\n";
|
|
|
|
|
echo " <option value='link' ".(($voicemail_file == "link") ? "selected='selected'" : null).">".$text['option-voicemail_file_link']."</option>\n";
|
|
|
|
|
echo " <option value='attach' ".(($voicemail_file == "attach") ? "selected='selected'" : null).">".$text['option-voicemail_file_attach']."</option>\n";
|
|
|
|
|
echo " </select>\n";
|
2022-06-01 18:48:33 +02:00
|
|
|
echo "<br />\n";
|
|
|
|
|
echo $text['description-voicemail_file']."\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
}
|
2012-12-29 10:17:12 +01:00
|
|
|
|
2024-06-22 01:24:06 +02:00
|
|
|
if (
|
|
|
|
|
permission_exists('voicemail_file') &&
|
|
|
|
|
permission_exists('voicemail_local_after_email')
|
|
|
|
|
) {
|
2017-07-05 18:23:47 +02:00
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
|
|
|
|
echo " ".$text['label-voicemail_local_after_email']."\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "<td class='vtable' align='left'>\n";
|
2024-06-22 01:24:06 +02:00
|
|
|
echo " <select class='formfld' name='voicemail_local_after_email' id='voicemail_local_after_email' onchange=\"if (this.selectedIndex == 1) { document.getElementById('voicemail_file').selectedIndex = 2; }\">\n";
|
2017-07-05 18:23:47 +02:00
|
|
|
echo " <option value='true' ".(($voicemail_local_after_email == "true") ? "selected='selected'" : null).">".$text['label-true']."</option>\n";
|
|
|
|
|
echo " <option value='false' ".(($voicemail_local_after_email == "false") ? "selected='selected'" : null).">".$text['label-false']."</option>\n";
|
|
|
|
|
echo " </select>\n";
|
|
|
|
|
echo "<br />\n";
|
|
|
|
|
echo $text['description-voicemail_local_after_email']."\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
}
|
2012-12-29 10:17:12 +01:00
|
|
|
|
2020-03-04 03:13:16 +01:00
|
|
|
if (permission_exists('voicemail_forward')) {
|
2014-03-07 00:06:45 +01:00
|
|
|
echo " <tr>";
|
2015-02-15 05:54:32 +01:00
|
|
|
echo " <td class='vncell' valign='top'>".$text['label-forward_destinations']."</td>";
|
2014-03-07 00:06:45 +01:00
|
|
|
echo " <td class='vtable'>";
|
2020-03-04 03:13:16 +01:00
|
|
|
echo " <table border='0' cellpadding='0' cellspacing='0'>\n";
|
2014-03-07 00:06:45 +01:00
|
|
|
|
2020-03-04 03:13:16 +01:00
|
|
|
if (is_array($voicemail_destinations_assigned) && @sizeof($voicemail_destinations_assigned) != 0) {
|
|
|
|
|
echo " <tr>\n";
|
|
|
|
|
echo " <td class='vtable'>".$text['label-destination']."</td>\n";
|
|
|
|
|
echo " <td class='vtable edit_delete_checkbox_all' onmouseover=\"swap_display('delete_label_destinations', 'delete_toggle_destinations');\" onmouseout=\"swap_display('delete_label_destinations', 'delete_toggle_destinations');\">\n";
|
|
|
|
|
echo " <span id='delete_label_destinations'>".$text['label-delete']."</span>\n";
|
|
|
|
|
echo " <span id='delete_toggle_destinations'><input type='checkbox' id='checkbox_all_destinations' name='checkbox_all' onclick=\"edit_all_toggle('destinations');\"></span>\n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " </tr>\n";
|
|
|
|
|
foreach ($voicemail_destinations_assigned as $x => $field) {
|
|
|
|
|
echo " <tr>\n";
|
|
|
|
|
echo " <td class='vtable'>".escape($field['voicemail_id'])."</td>\n";
|
|
|
|
|
echo " <td class='vtable' style='text-align: center; padding-bottom: 3px;'>";
|
|
|
|
|
echo " <input type='checkbox' name='voicemail_destinations_delete[".$x."][checked]' value='true' class='chk_delete checkbox_destinations' onclick=\"edit_delete_action('destinations');\">\n";
|
|
|
|
|
echo " <input type='hidden' name='voicemail_destinations_delete[".$x."][uuid]' value='".escape($field['voicemail_destination_uuid'])."' />\n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " </tr>\n";
|
2015-02-15 05:54:32 +01:00
|
|
|
}
|
2014-03-07 00:06:45 +01:00
|
|
|
}
|
2024-06-22 01:24:06 +02:00
|
|
|
unset($field);
|
2020-03-04 03:13:16 +01:00
|
|
|
|
|
|
|
|
if (is_array($voicemail_destinations_available) && @sizeof($voicemail_destinations_available) != 0) {
|
|
|
|
|
echo " <tr>\n";
|
2020-03-04 07:23:57 +01:00
|
|
|
echo " <td class='vtable' style='border-bottom: none;' colspan='2'>\n";
|
2020-03-04 03:13:16 +01:00
|
|
|
echo " <select name='voicemail_destination' class='formfld'>\n";
|
|
|
|
|
echo " <option value=''></option>\n";
|
|
|
|
|
foreach ($voicemail_destinations_available as $field) {
|
|
|
|
|
echo " <option value='".escape($field['voicemail_uuid'])."'>".escape($field['voicemail_id'])."</option>\n";
|
2019-08-17 15:02:58 +02:00
|
|
|
}
|
2020-03-04 03:13:16 +01:00
|
|
|
echo " </select>";
|
|
|
|
|
if ($action == 'update') {
|
|
|
|
|
echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'collapse'=>'never','onclick'=>'submit_form();']);
|
2019-08-17 15:02:58 +02:00
|
|
|
}
|
2020-03-04 03:13:16 +01:00
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <tr>\n";
|
2014-03-07 00:06:45 +01:00
|
|
|
}
|
2020-03-04 03:13:16 +01:00
|
|
|
unset($voicemail_destinations_available, $field);
|
|
|
|
|
|
|
|
|
|
echo " </table>\n";
|
2015-02-15 05:54:32 +01:00
|
|
|
|
2014-03-07 09:35:55 +01:00
|
|
|
echo " ".$text['description-forward_destinations']."\n";
|
2014-03-07 00:06:45 +01:00
|
|
|
echo " </td>";
|
|
|
|
|
echo " </tr>";
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-22 01:24:06 +02:00
|
|
|
if (
|
|
|
|
|
permission_exists('voicemail_forward') &&
|
|
|
|
|
permission_exists('voicemail_local_after_forward') &&
|
|
|
|
|
!empty($voicemail_destinations_assigned) &&
|
|
|
|
|
is_array($voicemail_destinations_assigned)
|
|
|
|
|
) {
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
|
|
|
|
echo " ".$text['label-voicemail_local_after_forward']."\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "<td class='vtable' align='left'>\n";
|
|
|
|
|
echo " <select class='formfld' name='voicemail_local_after_forward'>\n";
|
|
|
|
|
echo " <option value='true' ".(($voicemail_local_after_forward == "true") ? "selected='selected'" : null).">".$text['label-true']."</option>\n";
|
|
|
|
|
echo " <option value='false' ".(($voicemail_local_after_forward == "false") ? "selected='selected'" : null).">".$text['label-false']."</option>\n";
|
|
|
|
|
echo " </select>\n";
|
|
|
|
|
echo "<br />\n";
|
|
|
|
|
echo $text['description-voicemail_local_after_forward']."\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
unset($voicemail_destinations_assigned);
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-29 10:17:12 +01:00
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
2015-02-15 05:54:32 +01:00
|
|
|
echo " ".$text['label-voicemail_enabled']."\n";
|
2012-12-29 10:17:12 +01:00
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "<td class='vtable' align='left'>\n";
|
2023-02-14 02:02:01 +01:00
|
|
|
if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
|
|
|
|
|
echo " <label class='switch'>\n";
|
|
|
|
|
echo " <input type='checkbox' id='voicemail_enabled' name='voicemail_enabled' value='true' ".($voicemail_enabled == 'true' ? "checked='checked'" : null).">\n";
|
|
|
|
|
echo " <span class='slider'></span>\n";
|
|
|
|
|
echo " </label>\n";
|
2012-12-29 10:17:12 +01:00
|
|
|
}
|
|
|
|
|
else {
|
2023-02-14 02:02:01 +01:00
|
|
|
echo " <select class='formfld' id='voicemail_enabled' name='voicemail_enabled'>\n";
|
|
|
|
|
echo " <option value='true' ".($voicemail_enabled == 'true' ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
|
2023-02-14 19:19:02 +01:00
|
|
|
echo " <option value='false' ".($voicemail_enabled == 'false' ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
|
2023-02-14 02:02:01 +01:00
|
|
|
echo " </select>\n";
|
2012-12-29 10:17:12 +01:00
|
|
|
}
|
|
|
|
|
echo "<br />\n";
|
|
|
|
|
echo $text['description-voicemail_enabled']."\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
2015-02-15 05:54:32 +01:00
|
|
|
echo " ".$text['label-voicemail_description']."\n";
|
2012-12-29 10:17:12 +01:00
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "<td class='vtable' align='left'>\n";
|
2018-06-09 20:05:36 +02:00
|
|
|
echo " <input class='formfld' type='text' name='voicemail_description' maxlength='255' value=\"".escape($voicemail_description)."\">\n";
|
2012-12-29 10:17:12 +01:00
|
|
|
echo "<br />\n";
|
|
|
|
|
echo $text['description-voicemail_description']."\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
2020-02-07 14:52:58 +01:00
|
|
|
|
|
|
|
|
echo "</table>";
|
2024-09-06 01:10:04 +02:00
|
|
|
echo "</div>\n";
|
2020-02-07 14:52:58 +01:00
|
|
|
echo "<br><br>";
|
|
|
|
|
|
2012-12-29 10:17:12 +01:00
|
|
|
if ($action == "update") {
|
2020-02-07 14:52:58 +01:00
|
|
|
echo "<input type='hidden' name='voicemail_uuid' value='".escape($voicemail_uuid)."'>\n";
|
2012-12-29 10:17:12 +01:00
|
|
|
}
|
2013-01-02 00:22:07 +01:00
|
|
|
$http_referer = parse_url($_SERVER["HTTP_REFERER"]);
|
2023-05-27 00:17:53 +02:00
|
|
|
echo "<input type='hidden' name='referer_path' value='".escape($http_referer['path'] ?? '')."'>\n";
|
|
|
|
|
echo "<input type='hidden' name='referer_query' value='".escape($http_referer['query'] ?? '')."'>\n";
|
2020-02-07 14:52:58 +01:00
|
|
|
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
|
|
|
|
|
|
2012-12-29 10:17:12 +01:00
|
|
|
echo "</form>";
|
|
|
|
|
|
2016-02-25 22:39:28 +01:00
|
|
|
echo "<script>\n";
|
2020-03-04 03:13:16 +01:00
|
|
|
//hide password fields before submit
|
2016-02-25 22:39:28 +01:00
|
|
|
echo " function submit_form() {\n";
|
2020-03-04 03:13:16 +01:00
|
|
|
echo " hide_password_fields();\n";
|
2016-02-25 22:39:28 +01:00
|
|
|
echo " $('form#frm').submit();\n";
|
|
|
|
|
echo " }\n";
|
|
|
|
|
echo "</script>\n";
|
|
|
|
|
|
2012-12-29 10:17:12 +01:00
|
|
|
//include the footer
|
2013-07-06 08:29:50 +02:00
|
|
|
require_once "resources/footer.php";
|
2018-06-13 01:23:42 +02:00
|
|
|
|
2024-06-22 00:27:58 +02:00
|
|
|
?>
|