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>
|
|
|
|
|
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
|
|
|
|
the Initial Developer. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
Contributor(s):
|
|
|
|
|
Mark J Crane <markjcrane@fusionpbx.com>
|
|
|
|
|
*/
|
|
|
|
|
require_once "root.php";
|
2013-07-06 08:03:27 +02:00
|
|
|
require_once "resources/require.php";
|
2013-07-06 07:50:55 +02:00
|
|
|
require_once "resources/check_auth.php";
|
2012-12-29 10:17:12 +01:00
|
|
|
if (permission_exists('voicemail_add') || permission_exists('voicemail_edit')) {
|
|
|
|
|
//access granted
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo "access denied";
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//add multi-lingual support
|
|
|
|
|
require_once "app_languages.php";
|
|
|
|
|
foreach($text as $key => $value) {
|
|
|
|
|
$text[$key] = $value[$_SESSION['domain']['language']['code']];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//action add or update
|
|
|
|
|
if (isset($_REQUEST["id"])) {
|
|
|
|
|
$action = "update";
|
|
|
|
|
$voicemail_uuid = check_str($_REQUEST["id"]);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$action = "add";
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-02 00:22:07 +01:00
|
|
|
//get http variables and set them to php variables
|
|
|
|
|
$referer_path = check_str($_REQUEST["referer_path"]);
|
|
|
|
|
$referer_query = check_str($_REQUEST["referer_query"]);
|
2012-12-29 10:17:12 +01:00
|
|
|
if (count($_POST)>0) {
|
2013-06-03 16:26:50 +02:00
|
|
|
//set the variables from the HTTP values
|
|
|
|
|
$voicemail_id = check_str($_POST["voicemail_id"]);
|
|
|
|
|
$voicemail_password = check_str($_POST["voicemail_password"]);
|
|
|
|
|
$greeting_id = check_str($_POST["greeting_id"]);
|
|
|
|
|
$voicemail_mail_to = check_str($_POST["voicemail_mail_to"]);
|
|
|
|
|
$voicemail_attach_file = check_str($_POST["voicemail_attach_file"]);
|
|
|
|
|
$voicemail_local_after_email = check_str($_POST["voicemail_local_after_email"]);
|
|
|
|
|
$voicemail_enabled = check_str($_POST["voicemail_enabled"]);
|
|
|
|
|
$voicemail_description = check_str($_POST["voicemail_description"]);
|
|
|
|
|
//remove the space
|
|
|
|
|
$voicemail_mail_to = str_replace(" ", "", $voicemail_mail_to);
|
2012-12-29 10:17:12 +01:00
|
|
|
}
|
|
|
|
|
|
2014-03-07 00:06:45 +01:00
|
|
|
//unassign the voicemail id copy from the voicemail id
|
|
|
|
|
if ($_GET["a"] == "delete" && strlen($voicemail_uuid) > 0 && strlen($_REQUEST["voicemail_destination_uuid"]) > 0) {
|
|
|
|
|
//set the variables
|
|
|
|
|
$voicemail_destination_uuid = check_str($_REQUEST["voicemail_destination_uuid"]);
|
|
|
|
|
//delete the voicemail from the destionations
|
|
|
|
|
$sqld = "
|
|
|
|
|
delete from
|
|
|
|
|
v_voicemail_destinations as d
|
|
|
|
|
where
|
|
|
|
|
d.voicemail_destination_uuid = '".$voicemail_destination_uuid."' and
|
|
|
|
|
d.voicemail_uuid = '".$voicemail_uuid."'";
|
|
|
|
|
$db->exec(check_sql($sqld));
|
|
|
|
|
//redirect the browser
|
|
|
|
|
$_SESSION["message"] = $text['message-delete'];
|
|
|
|
|
header("Location: voicemail_edit.php?id=".$voicemail_uuid);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//assign the voicemail id copy to the voicemail id
|
|
|
|
|
if (strlen($voicemail_uuid) > 0 && strlen($_REQUEST["voicemail_uuid_copy"]) > 0) {
|
|
|
|
|
//set the variables
|
|
|
|
|
$voicemail_uuid_copy = check_str($_REQUEST["voicemail_uuid_copy"]);
|
|
|
|
|
//assign the user to the extension
|
|
|
|
|
$sqli = "
|
2014-12-04 08:51:05 +01:00
|
|
|
insert into
|
|
|
|
|
v_voicemail_destinations
|
2014-03-07 00:06:45 +01:00
|
|
|
(
|
2014-12-04 08:51:05 +01:00
|
|
|
domain_uuid,
|
2014-03-07 00:06:45 +01:00
|
|
|
voicemail_destination_uuid,
|
|
|
|
|
voicemail_uuid,
|
|
|
|
|
voicemail_uuid_copy
|
|
|
|
|
)
|
|
|
|
|
values
|
|
|
|
|
(
|
2014-12-04 08:51:05 +01:00
|
|
|
'".$domain_uuid."',
|
2014-03-07 00:06:45 +01:00
|
|
|
'".uuid()."',
|
|
|
|
|
'".$voicemail_uuid."',
|
|
|
|
|
'".$voicemail_uuid_copy."'
|
|
|
|
|
)";
|
|
|
|
|
$db->exec(check_sql($sqli));
|
|
|
|
|
//redirect the browser
|
|
|
|
|
// $_SESSION["message"] = $text['message-add'];
|
|
|
|
|
// header("Location: voicemail_edit.php?id=".$voicemail_uuid);
|
|
|
|
|
// return;
|
|
|
|
|
}
|
|
|
|
|
|
2013-06-03 16:26:50 +02:00
|
|
|
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
2012-12-29 10:17:12 +01:00
|
|
|
|
|
|
|
|
$msg = '';
|
|
|
|
|
if ($action == "update") {
|
|
|
|
|
$voicemail_uuid = check_str($_POST["voicemail_uuid"]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//check for all required data
|
|
|
|
|
//if (strlen($domain_uuid) == 0) { $msg .= $text['message-required']." ".$text['label-domain_uuid']."<br>\n"; }
|
|
|
|
|
//if (strlen($voicemail_uuid) == 0) { $msg .= $text['message-required']." ".$text['label-voicemail_uuid']."<br>\n"; }
|
|
|
|
|
//if (strlen($voicemail_id) == 0) { $msg .= $text['message-required']." ".$text['label-voicemail_id']."<br>\n"; }
|
|
|
|
|
//if (strlen($voicemail_password) == 0) { $msg .= $text['message-required']." ".$text['label-voicemail_password']."<br>\n"; }
|
|
|
|
|
//if (strlen($greeting_id) == 0) { $msg .= $text['message-required']." ".$text['label-greeting_id']."<br>\n"; }
|
|
|
|
|
//if (strlen($voicemail_mail_to) == 0) { $msg .= $text['message-required']." ".$text['label-voicemail_mail_to']."<br>\n"; }
|
|
|
|
|
//if (strlen($voicemail_attach_file) == 0) { $msg .= $text['message-required']." ".$text['label-voicemail_attach_file']."<br>\n"; }
|
|
|
|
|
//if (strlen($voicemail_local_after_email) == 0) { $msg .= $text['message-required']." ".$text['label-voicemail_local_after_email']."<br>\n"; }
|
|
|
|
|
//if (strlen($voicemail_enabled) == 0) { $msg .= $text['message-required']." ".$text['label-voicemail_enabled']."<br>\n"; }
|
|
|
|
|
//if (strlen($voicemail_description) == 0) { $msg .= $text['message-required']." ".$text['label-voicemail_description']."<br>\n"; }
|
|
|
|
|
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
2013-07-06 08:29:50 +02:00
|
|
|
require_once "resources/header.php";
|
2013-07-06 08:21:12 +02:00
|
|
|
require_once "resources/persist_form_var.php";
|
2012-12-29 10:17:12 +01:00
|
|
|
echo "<div align='center'>\n";
|
|
|
|
|
echo "<table><tr><td>\n";
|
|
|
|
|
echo $msg."<br />";
|
|
|
|
|
echo "</td></tr></table>\n";
|
|
|
|
|
persistformvar($_POST);
|
|
|
|
|
echo "</div>\n";
|
2013-07-06 08:29:50 +02:00
|
|
|
require_once "resources/footer.php";
|
2012-12-29 10:17:12 +01:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//add or update the database
|
|
|
|
|
if ($_POST["persistformvar"] != "true") {
|
|
|
|
|
if ($action == "add" && permission_exists('voicemail_add')) {
|
|
|
|
|
$sql = "insert into v_voicemails ";
|
|
|
|
|
$sql .= "(";
|
|
|
|
|
$sql .= "domain_uuid, ";
|
|
|
|
|
$sql .= "voicemail_uuid, ";
|
|
|
|
|
$sql .= "voicemail_id, ";
|
|
|
|
|
$sql .= "voicemail_password, ";
|
|
|
|
|
if (strlen($greeting_id) > 0) {
|
|
|
|
|
$sql .= "greeting_id, ";
|
|
|
|
|
}
|
|
|
|
|
$sql .= "voicemail_mail_to, ";
|
|
|
|
|
$sql .= "voicemail_attach_file, ";
|
|
|
|
|
$sql .= "voicemail_local_after_email, ";
|
|
|
|
|
$sql .= "voicemail_enabled, ";
|
|
|
|
|
$sql .= "voicemail_description ";
|
|
|
|
|
$sql .= ")";
|
|
|
|
|
$sql .= "values ";
|
|
|
|
|
$sql .= "(";
|
|
|
|
|
$sql .= "'$domain_uuid', ";
|
|
|
|
|
$sql .= "'".uuid()."', ";
|
|
|
|
|
$sql .= "'$voicemail_id', ";
|
|
|
|
|
$sql .= "'$voicemail_password', ";
|
|
|
|
|
if (strlen($greeting_id) > 0) {
|
|
|
|
|
$sql .= "'$greeting_id', ";
|
|
|
|
|
}
|
|
|
|
|
$sql .= "'$voicemail_mail_to', ";
|
|
|
|
|
$sql .= "'$voicemail_attach_file', ";
|
|
|
|
|
$sql .= "'$voicemail_local_after_email', ";
|
|
|
|
|
$sql .= "'$voicemail_enabled', ";
|
|
|
|
|
$sql .= "'$voicemail_description' ";
|
|
|
|
|
$sql .= ")";
|
|
|
|
|
$db->exec(check_sql($sql));
|
|
|
|
|
unset($sql);
|
|
|
|
|
|
2014-02-23 09:47:58 +01:00
|
|
|
$_SESSION["message"] = $text['message-add'];
|
|
|
|
|
header("Location: voicemails.php");
|
2012-12-29 10:17:12 +01:00
|
|
|
return;
|
|
|
|
|
} //if ($action == "add")
|
|
|
|
|
|
|
|
|
|
if ($action == "update" && permission_exists('voicemail_edit')) {
|
|
|
|
|
$sql = "update v_voicemails set ";
|
|
|
|
|
$sql .= "voicemail_id = '$voicemail_id', ";
|
|
|
|
|
$sql .= "voicemail_password = '$voicemail_password', ";
|
|
|
|
|
if (strlen($greeting_id) > 0) {
|
|
|
|
|
$sql .= "greeting_id = '$greeting_id', ";
|
|
|
|
|
}
|
2012-12-31 17:38:45 +01:00
|
|
|
else {
|
|
|
|
|
$sql .= "greeting_id = null, ";
|
|
|
|
|
}
|
2012-12-29 10:17:12 +01:00
|
|
|
$sql .= "voicemail_mail_to = '$voicemail_mail_to', ";
|
|
|
|
|
$sql .= "voicemail_attach_file = '$voicemail_attach_file', ";
|
|
|
|
|
$sql .= "voicemail_local_after_email = '$voicemail_local_after_email', ";
|
|
|
|
|
$sql .= "voicemail_enabled = '$voicemail_enabled', ";
|
|
|
|
|
$sql .= "voicemail_description = '$voicemail_description' ";
|
|
|
|
|
$sql .= "where domain_uuid = '$domain_uuid' ";
|
|
|
|
|
$sql .= "and voicemail_uuid = '$voicemail_uuid'";
|
|
|
|
|
$db->exec(check_sql($sql));
|
|
|
|
|
unset($sql);
|
|
|
|
|
|
2014-02-23 09:47:58 +01:00
|
|
|
$_SESSION["message"] = $text['message-update'];
|
2013-01-02 00:22:07 +01:00
|
|
|
if ($referer_path == "/app/voicemails/voicemail_messages.php") {
|
2014-02-23 09:47:58 +01:00
|
|
|
header("Location: voicemail_messages.php?".$referer_query);
|
2013-01-02 00:22:07 +01:00
|
|
|
}
|
|
|
|
|
else {
|
2014-03-07 00:06:45 +01:00
|
|
|
header("Location: voicemail_edit.php?id=".$voicemail_uuid);
|
2013-01-02 00:22:07 +01:00
|
|
|
}
|
2012-12-29 10:17:12 +01:00
|
|
|
return;
|
|
|
|
|
} //if ($action == "update")
|
2014-02-23 09:47:58 +01:00
|
|
|
} //if ($_POST["persistformvar"] != "true")
|
2012-12-29 10:17:12 +01:00
|
|
|
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
|
|
|
|
|
|
|
|
|
//pre-populate the form
|
|
|
|
|
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
|
|
|
|
|
$voicemail_uuid = check_str($_GET["id"]);
|
|
|
|
|
$sql = "select * from v_voicemails ";
|
|
|
|
|
$sql .= "where domain_uuid = '$domain_uuid' ";
|
|
|
|
|
$sql .= "and voicemail_uuid = '$voicemail_uuid' ";
|
|
|
|
|
$prep_statement = $db->prepare(check_sql($sql));
|
|
|
|
|
$prep_statement->execute();
|
|
|
|
|
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
|
|
|
|
foreach ($result as &$row) {
|
|
|
|
|
$voicemail_id = $row["voicemail_id"];
|
|
|
|
|
$voicemail_password = $row["voicemail_password"];
|
|
|
|
|
$greeting_id = $row["greeting_id"];
|
|
|
|
|
$voicemail_mail_to = $row["voicemail_mail_to"];
|
|
|
|
|
$voicemail_attach_file = $row["voicemail_attach_file"];
|
|
|
|
|
$voicemail_local_after_email = $row["voicemail_local_after_email"];
|
|
|
|
|
$voicemail_enabled = $row["voicemail_enabled"];
|
|
|
|
|
$voicemail_description = $row["voicemail_description"];
|
|
|
|
|
break; //limit to 1 row
|
|
|
|
|
}
|
|
|
|
|
unset ($prep_statement);
|
|
|
|
|
}
|
|
|
|
|
|
2013-06-03 16:26:50 +02:00
|
|
|
//remove the spaces
|
|
|
|
|
$voicemail_mail_to = str_replace(" ", "", $voicemail_mail_to);
|
|
|
|
|
|
2013-01-03 00:42:33 +01:00
|
|
|
//set defaults
|
|
|
|
|
if (strlen($voicemail_attach_file) == 0) { $voicemail_attach_file = "true"; }
|
|
|
|
|
if (strlen($voicemail_local_after_email) == 0) { $voicemail_local_after_email = "true"; }
|
|
|
|
|
if (strlen($voicemail_enabled) == 0) { $voicemail_enabled = "true"; }
|
|
|
|
|
|
2012-12-29 10:17:12 +01:00
|
|
|
//show the header
|
2013-07-06 08:29:50 +02:00
|
|
|
require_once "resources/header.php";
|
2012-12-29 10:17:12 +01:00
|
|
|
|
|
|
|
|
//show the content
|
|
|
|
|
echo "<div align='center'>";
|
|
|
|
|
echo "<table width='100%' border='0' cellpadding='0' cellspacing=''>\n";
|
|
|
|
|
echo "<tr class='border'>\n";
|
|
|
|
|
echo " <td align=\"left\">\n";
|
|
|
|
|
echo " <br>";
|
|
|
|
|
|
|
|
|
|
echo "<form method='post' name='frm' action=''>\n";
|
|
|
|
|
echo "<div align='center'>\n";
|
|
|
|
|
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
|
|
|
|
|
echo "<tr>\n";
|
2013-11-23 05:19:37 +01:00
|
|
|
echo "<td align='left' width='30%' nowrap='nowrap'><b>".$text['title-voicemail']."</b></td>\n";
|
|
|
|
|
echo "<td width='70%' align='right'>\n";
|
|
|
|
|
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"javascript:history.back();\" value='".$text['button-back']."'>\n";
|
2014-04-27 01:37:41 +02:00
|
|
|
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
|
2013-11-23 05:19:37 +01:00
|
|
|
echo "</td>\n";
|
2012-12-29 10:17:12 +01:00
|
|
|
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";
|
2012-12-29 10:17:12 +01:00
|
|
|
echo " ".$text['label-voicemail_id'].":\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "<td class='vtable' align='left'>\n";
|
2013-01-19 20:06:45 +01:00
|
|
|
echo " <input class='formfld' type='text' name='voicemail_id' maxlength='255' value='$voicemail_id'>\n";
|
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";
|
2012-12-29 10:17:12 +01:00
|
|
|
echo " ".$text['label-voicemail_password'].":\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "<td class='vtable' align='left'>\n";
|
2014-03-07 02:52:44 +01:00
|
|
|
echo " <input class='formfld' type='password' name='voicemail_password' id='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=\"$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";
|
|
|
|
|
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
|
|
|
|
echo " ".$text['label-greeting_id'].":\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "<td class='vtable' align='left'>\n";
|
2013-01-19 20:06:45 +01:00
|
|
|
echo " <input class='formfld' type='text' name='greeting_id' maxlength='255' value='$greeting_id'>\n";
|
2012-12-29 10:17:12 +01:00
|
|
|
echo "<br />\n";
|
|
|
|
|
echo $text['description-greeting_id']."\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
|
|
|
|
echo " ".$text['label-voicemail_mail_to'].":\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "<td class='vtable' align='left'>\n";
|
|
|
|
|
echo " <input class='formfld' type='text' name='voicemail_mail_to' maxlength='255' value=\"$voicemail_mail_to\">\n";
|
|
|
|
|
echo "<br />\n";
|
|
|
|
|
echo $text['description-voicemail_mail_to']."\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
|
|
|
|
echo " ".$text['label-voicemail_attach_file'].":\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "<td class='vtable' align='left'>\n";
|
|
|
|
|
echo " <select class='formfld' name='voicemail_attach_file'>\n";
|
2014-02-23 09:47:58 +01:00
|
|
|
if ($voicemail_attach_file == "true") {
|
2012-12-29 10:17:12 +01:00
|
|
|
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo " <option value='true'>".$text['label-true']."</option>\n";
|
|
|
|
|
}
|
2014-02-23 09:47:58 +01:00
|
|
|
if ($voicemail_attach_file == "false") {
|
2012-12-29 10:17:12 +01:00
|
|
|
echo " <option value='false' selected='selected'>".$text['label-false']."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo " <option value='false'>".$text['label-false']."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
echo " </select>\n";
|
|
|
|
|
echo "<br />\n";
|
|
|
|
|
echo $text['description-voicemail_attach_file']."\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
|
|
|
|
|
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";
|
|
|
|
|
echo " <select class='formfld' name='voicemail_local_after_email'>\n";
|
2014-02-23 09:47:58 +01:00
|
|
|
if ($voicemail_local_after_email == "true") {
|
2012-12-29 10:17:12 +01:00
|
|
|
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo " <option value='true'>".$text['label-true']."</option>\n";
|
|
|
|
|
}
|
2014-02-23 09:47:58 +01:00
|
|
|
if ($voicemail_local_after_email == "false") {
|
2012-12-29 10:17:12 +01:00
|
|
|
echo " <option value='false' selected='selected'>".$text['label-false']."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo " <option value='false'>".$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";
|
|
|
|
|
|
2014-03-07 00:06:45 +01:00
|
|
|
if ($action == "update") {
|
|
|
|
|
echo " <tr>";
|
2014-03-07 09:35:55 +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'>";
|
|
|
|
|
|
|
|
|
|
echo " <table width='52%'>\n";
|
2014-03-07 09:35:55 +01:00
|
|
|
$sql = "
|
2014-03-07 00:06:45 +01:00
|
|
|
select
|
|
|
|
|
v.voicemail_id,
|
|
|
|
|
d.voicemail_destination_uuid,
|
|
|
|
|
d.voicemail_uuid_copy
|
|
|
|
|
from
|
|
|
|
|
v_voicemails as v,
|
|
|
|
|
v_voicemail_destinations as d
|
|
|
|
|
where
|
|
|
|
|
d.voicemail_uuid_copy = v.voicemail_uuid and
|
|
|
|
|
v.domain_uuid = '".$_SESSION['domain_uuid']."' and
|
|
|
|
|
v.voicemail_enabled = 'true' and
|
|
|
|
|
d.voicemail_uuid = '".$voicemail_uuid."'
|
|
|
|
|
order by
|
|
|
|
|
v.voicemail_id asc";
|
2014-03-07 09:35:55 +01:00
|
|
|
$prep_statement = $db->prepare(check_sql($sql));
|
2014-03-07 00:06:45 +01:00
|
|
|
$prep_statement->execute();
|
|
|
|
|
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
|
|
|
|
$result_count = count($result);
|
|
|
|
|
foreach($result as $field) {
|
|
|
|
|
echo " <tr>\n";
|
|
|
|
|
echo " <td class='vtable'>".$field['voicemail_id']."</td>\n";
|
|
|
|
|
echo " <td>\n";
|
|
|
|
|
echo " <a href='voicemail_edit.php?id=".$voicemail_uuid."&voicemail_destination_uuid=".$field['voicemail_destination_uuid']."&a=delete' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>\n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " </tr>\n";
|
|
|
|
|
$voicemail_uuid_copied[] = $field['voicemail_uuid_copy'];
|
|
|
|
|
}
|
|
|
|
|
echo " </table>\n";
|
|
|
|
|
|
|
|
|
|
if (sizeof($voicemail_uuid_copied) > 0) {
|
|
|
|
|
// modify sql to remove already copied voicemail uuids from the list
|
2014-03-07 09:35:55 +01:00
|
|
|
$sql_mod = " and v.voicemail_uuid not in ('".implode("','", $voicemail_uuid_copied)."') ";
|
2014-03-07 00:06:45 +01:00
|
|
|
}
|
|
|
|
|
echo " <br />\n";
|
2014-03-07 09:35:55 +01:00
|
|
|
$sql = "
|
2014-03-07 00:06:45 +01:00
|
|
|
select
|
|
|
|
|
v.voicemail_id,
|
|
|
|
|
v.voicemail_uuid
|
|
|
|
|
from
|
|
|
|
|
v_voicemails as v
|
|
|
|
|
where
|
|
|
|
|
v.domain_uuid = '".$_SESSION['domain_uuid']."' and
|
|
|
|
|
v.voicemail_enabled = 'true' and
|
|
|
|
|
v.voicemail_uuid <> '".$voicemail_uuid."'
|
2014-03-07 09:35:55 +01:00
|
|
|
".$sql_mod."
|
2014-03-07 00:06:45 +01:00
|
|
|
order by
|
|
|
|
|
v.voicemail_id asc";
|
2014-03-07 09:35:55 +01:00
|
|
|
$prep_statement = $db->prepare(check_sql($sql));
|
2014-03-07 00:06:45 +01:00
|
|
|
$prep_statement->execute();
|
|
|
|
|
echo " <select name=\"voicemail_uuid_copy\" class='formfld' style='width: auto;'>\n";
|
|
|
|
|
echo " <option value=\"\"></option>\n";
|
|
|
|
|
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
|
|
|
|
foreach($result as $field) {
|
|
|
|
|
echo " <option value='".$field['voicemail_uuid']."'>".$field['voicemail_id']."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
echo " </select>";
|
|
|
|
|
echo " <input type=\"submit\" class='btn' value=\"".$text['button-add']."\">\n";
|
|
|
|
|
unset($sql, $result);
|
|
|
|
|
echo " <br>\n";
|
2014-03-07 09:35:55 +01:00
|
|
|
echo " ".$text['description-forward_destinations']."\n";
|
2014-03-07 00:06:45 +01:00
|
|
|
echo " <br />\n";
|
|
|
|
|
echo " </td>";
|
|
|
|
|
echo " </tr>";
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-29 10:17:12 +01:00
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
|
|
|
|
echo " ".$text['label-voicemail_enabled'].":\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "<td class='vtable' align='left'>\n";
|
|
|
|
|
echo " <select class='formfld' name='voicemail_enabled'>\n";
|
2014-02-23 09:47:58 +01:00
|
|
|
if ($voicemail_enabled == "true") {
|
2012-12-29 10:17:12 +01:00
|
|
|
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo " <option value='true'>".$text['label-true']."</option>\n";
|
|
|
|
|
}
|
2014-02-23 09:47:58 +01:00
|
|
|
if ($voicemail_enabled == "false") {
|
2012-12-29 10:17:12 +01:00
|
|
|
echo " <option value='false' selected='selected'>".$text['label-false']."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo " <option value='false'>".$text['label-false']."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
echo " </select>\n";
|
|
|
|
|
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";
|
|
|
|
|
echo " ".$text['label-voicemail_description'].":\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "<td class='vtable' align='left'>\n";
|
|
|
|
|
echo " <input class='formfld' type='text' name='voicemail_description' maxlength='255' value=\"$voicemail_description\">\n";
|
|
|
|
|
echo "<br />\n";
|
|
|
|
|
echo $text['description-voicemail_description']."\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
echo " <tr>\n";
|
|
|
|
|
echo " <td colspan='2' align='right'>\n";
|
|
|
|
|
if ($action == "update") {
|
|
|
|
|
echo " <input type='hidden' name='voicemail_uuid' value='$voicemail_uuid'>\n";
|
|
|
|
|
}
|
2013-01-02 00:22:07 +01:00
|
|
|
$http_referer = parse_url($_SERVER["HTTP_REFERER"]);
|
|
|
|
|
echo " <input type='hidden' name='referer_path' value='".$http_referer['path']."'>\n";
|
|
|
|
|
echo " <input type='hidden' name='referer_query' value='".$http_referer['query']."'>\n";
|
2012-12-29 10:17:12 +01:00
|
|
|
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " </tr>";
|
|
|
|
|
echo "</table>";
|
|
|
|
|
echo "</form>";
|
|
|
|
|
|
|
|
|
|
echo " </td>";
|
|
|
|
|
echo " </tr>";
|
|
|
|
|
echo "</table>";
|
|
|
|
|
echo "</div>";
|
|
|
|
|
|
|
|
|
|
//include the footer
|
2013-07-06 08:29:50 +02:00
|
|
|
require_once "resources/footer.php";
|
2012-12-29 10:17:12 +01:00
|
|
|
?>
|