Move the old voicemail messages to the dev/apps directory.

This commit is contained in:
Mark Crane
2013-01-01 23:51:36 +00:00
parent 31655253f1
commit 0a5537b912
7 changed files with 0 additions and 1158 deletions

View File

@@ -1,55 +0,0 @@
<?php
//application details
$apps[$x]['name'] = "Voicemail Messages";
$apps[$x]['uuid'] = '789ea83b-4063-5076-55ba-2f7d63afa86b';
$apps[$x]['category'] = 'Switch';
$apps[$x]['subcategory'] = '';
$apps[$x]['version'] = '';
$apps[$x]['license'] = 'Mozilla Public License 1.1';
$apps[$x]['url'] = 'http://www.fusionpbx.com';
$apps[$x]['description']['en-us'] = 'Voicemails can be listed, played, downloaded and deleted.';
$apps[$x]['description']['es-mx'] = '';
$apps[$x]['description']['de'] = '';
$apps[$x]['description']['de-ch'] = '';
$apps[$x]['description']['de-at'] = '';
$apps[$x]['description']['fr'] = '';
$apps[$x]['description']['fr-ca'] = '';
$apps[$x]['description']['fr-ch'] = '';
$apps[$x]['description']['pt-pt'] = 'Mensagens de voz podem ser listadas, jogado, baixado e excluído.';
$apps[$x]['description']['pt-br'] = '';
//menu details
$apps[$x]['menu'][0]['title']['en-us'] = 'Voicemail';
$apps[$x]['menu'][0]['title']['es-mx'] = '';
$apps[$x]['menu'][0]['title']['de'] = '';
$apps[$x]['menu'][0]['title']['de-ch'] = '';
$apps[$x]['menu'][0]['title']['de-at'] = '';
$apps[$x]['menu'][0]['title']['fr'] = '';
$apps[$x]['menu'][0]['title']['fr-ca'] = '';
$apps[$x]['menu'][0]['title']['fr-ch'] = '';
$apps[$x]['menu'][0]['title']['pt-pt'] = 'Correio de Voz';
$apps[$x]['menu'][0]['title']['pt-br'] = '';
$apps[$x]['menu'][0]['uuid'] = 'e10d5672-0f82-6e5d-5022-a02ac8545198';
$apps[$x]['menu'][0]['parent_uuid'] = 'fd29e39c-c936-f5fc-8e2b-611681b266b5';
$apps[$x]['menu'][0]['category'] = 'internal';
$apps[$x]['menu'][0]['path'] = '/app/voicemail_msgs/voicemail_msgs.php';
$apps[$x]['menu'][0]['groups'][] = 'user';
$apps[$x]['menu'][0]['groups'][] = 'admin';
$apps[$x]['menu'][0]['groups'][] = 'superadmin';
//permission details
$apps[$x]['permissions'][0]['name'] = 'voicemail_view';
$apps[$x]['permissions'][0]['groups'][] = 'user';
$apps[$x]['permissions'][0]['groups'][] = 'admin';
$apps[$x]['permissions'][0]['groups'][] = 'superadmin';
$apps[$x]['permissions'][1]['name'] = 'voicemail_edit';
$apps[$x]['permissions'][1]['groups'][] = 'user';
$apps[$x]['permissions'][1]['groups'][] = 'admin';
$apps[$x]['permissions'][1]['groups'][] = 'superadmin';
$apps[$x]['permissions'][2]['name'] = 'voicemail_delete';
$apps[$x]['permissions'][2]['groups'][] = 'user';
$apps[$x]['permissions'][2]['groups'][] = 'admin';
$apps[$x]['permissions'][2]['groups'][] = 'superadmin';
?>

View File

@@ -1,111 +0,0 @@
<?php
$text['title']['en-us'] = 'Voicemail Messages';
$text['title']['pt-pt'] = 'Mensagens de correio de voz';
$text['description']['en-us'] = 'Voicemails are listed, played, downloaded and deleted from this page.';
$text['description']['pt-pt'] = 'As mensagens de voz são listadas, reproduzidas, descarregadas e excluídas através desta página.';
$text['button-greetings']['en-us'] = 'Greetings';
$text['button-greetings']['pt-pt'] = 'Saudações';
$text['button-settings']['en-us'] = 'Settings';
$text['button-settings']['pt-pt'] = 'Definições';
$text['table-mailbox']['en-us'] = 'Mailbox';
$text['table-mailbox']['pt-pt'] = 'Caixa de Correio';
$text['description-2']['en-us'] = 'Voicemails for an extension are shown to the user(s) that have been assigned to an extension.';
$text['description-2']['pt-pt'] = 'As mensagens de voz de uma extensão são apresentadas para os utilizadores que foram associados a uma extensão.';
$text['description-3']['en-us'] = 'User accounts are created in the "User Manager" and then are assigned on the "Extensions" page.';
$text['description-3']['pt-pt'] = 'As contas de utilizador são criadas no "Gestor de utilizadores" e, em seguida, são atribuídos na página de "Extensões".';
$text['label-created']['en-us'] = 'Created';
$text['label-created']['pt-pt'] = 'Criado';
$text['label-caller-id-name']['en-us'] = 'Caller ID Name';
$text['label-caller-id-name']['pt-pt'] = 'Nome de Origem';
$text['label-caller-id-number']['en-us'] = 'Caller ID Number';
$text['label-caller-id-number']['pt-pt'] = 'Número de Origem';
$text['label-folder']['en-us'] = 'Folder';
$text['label-folder']['pt-pt'] = 'Pasta';
$text['label-length']['en-us'] = 'Length (play)';
$text['label-length']['pt-pt'] = 'Comprimento (Reprodução)';
$text['label-size']['en-us'] = 'Size (download)';
$text['label-size']['pt-pt'] = 'Tamanho (download)';
$text['confirm-delete']['en-us'] = 'Are you sure you want to delete this?';
$text['confirm-delete']['pt-pt'] = 'Tem a certeza que pretende apagar?';
$text['confirm-password']['en-us'] = 'Please provide: Voicemail Password';
$text['confirm-password']['pt-pt'] = 'Por favor, forneça: Palavra passe de Correio de Voz';
$text['confirm-update']['en-us'] = 'Update Complete';
$text['confirm-update']['pt-pt'] = 'Actualização Completa';
$text['label-voicemail']['en-us'] = 'Voicemail Settings for:';
$text['label-voicemail']['pt-pt'] = 'Configurações de correio de voz para:';
$text['button-back']['en-us'] = 'Back';
$text['button-back']['pt-pt'] = 'Voltar';
$text['button-save']['en-us'] = 'Save';
$text['button-save']['pt-pt'] = 'Guardar';
$text['label-password']['en-us'] = 'Voicemail Password';
$text['label-password']['pt-pt'] = 'Palavra Chave de Correio de Voz';
$text['description-password']['en-us'] = 'Enter the password here.';
$text['description-password']['pt-pt'] = 'Digite a palavra passe aqui.';
$text['label-enabled']['en-us'] = 'Voicemail Enabled';
$text['label-enabled']['pt-pt'] = 'Correio de Voz Ativado';
$text['description-voicemail-enable']['en-us'] = 'Enable/disable voicemail for this extension.';
$text['description-voicemail-enable']['pt-pt'] = 'Ativar/desativar o correio de voz para esta extensão.';
$text['check-true']['en-us'] = 'true';
$text['ckeck-true']['pt-pt'] = 'verdade';
$text['check-false']['en-us'] = 'false';
$text['ckeck-false']['pt-pt'] = 'falso';
$text['label-mail']['en-us'] = 'Voicemail Mail To';
$text['label-mail']['pt-pt'] = 'Correio de voz para Email';
$text['description-email']['en-us'] = 'Optional: Enter the email address to send voicemail to.';
$text['description-email']['pt-pt'] = 'Opcional: Digite o endereço de e-mail para enviar correio de voz para lá.';
$text['label-attach']['en-us'] = 'Voicemail Attach File';
$text['label-attach']['pt-pt'] = 'Anexar arquivo ao Correio de Voz';
$text['description-email-attachment']['en-us'] = 'Choose whether to attach the file to the email.';
$text['description-email-attachment']['pt-pt'] = 'Escolha se desejar, anexar o arquivo para o e-mail.';
$text['label-vm']['en-us'] = 'VM Keep Local After Email';
$text['label-vm']['pt-pt'] = 'Mantenha o Correio de Voz local após e-mail';
$text['description-keep-local']['en-us'] = 'Keep local file after sending the email.';
$text['description-keep-local']['pt-pt'] = 'Manter uma copia do arquivo localmente, após o envio do e-mail.';
$text['confirm-delete-2']['en-us'] = 'Delete';
$text['confirm-delete-2']['pt-pt'] = 'Eliminação';
$text['confirm-complete']['en-us'] = 'Complete';
$text['confirm-complete']['pt-pt'] = 'Completa';
$text['confirm-failed']['en-us'] = 'Failed';
$text['confirm-failed']['pt-pt'] = 'Falhada';
$text['confirm-socket']['en-us'] = 'Connection to Event Socket failed.';
$text['confirm-socket']['pt-pt'] = 'Ligação ao Event Socket falhou.';
$text['label-message']['en-us'] = 'Message';
$text['label-message']['pt-pt'] = 'Mensagem';
?>

View File

@@ -1,50 +0,0 @@
<?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>
*/
// make sure the PATH_SEPARATOR is defined
if (!defined("PATH_SEPARATOR")) {
if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); }
}
// make sure the document_root is set
$_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]);
$_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]);
$_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]);
//echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."<br />\n";
//echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."<br />\n";
//echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."<br />\n";
// if the project directory exists then add it to the include path otherwise add the document root to the include path
if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); }
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' );
}
else {
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); }
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] );
}
?>

View File

@@ -1,300 +0,0 @@
<?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>
*/
include "root.php";
require "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('voicemail_view')) {
//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']];
}
//download the voicemail
if ($_GET['a'] == "download") {
//pdo voicemail database connection
include "includes/lib_pdo_vm.php";
session_cache_limiter('public');
$uuid = $_GET["uuid"];
$sql = "select * from voicemail_msgs ";
$sql .= "where domain = '".$_SESSION['domain_name']."' ";
$sql .= "and uuid = '$uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$created_epoch = $row["created_epoch"];
$read_epoch = $row["read_epoch"];
$username = $row["username"];
$uuid = $row["uuid"];
$cid_name = $row["cid_name"];
$cid_number = $row["cid_number"];
$in_folder = $row["in_folder"];
$file_path = $row["file_path"];
$message_len = $row["message_len"];
$flags = $row["flags"];
$read_flags = $row["read_flags"];
break; //limit to 1 row
}
unset ($prep_statement);
if ($_GET['type'] = "vm") {
if (file_exists($file_path)) {
$fd = fopen($file_path, "rb");
if ($_GET['t'] == "bin") {
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Description: File Transfer");
$file_ext = substr($file_path, -3);
if ($file_ext == "wav") {
header('Content-Disposition: attachment; filename="voicemail.wav"');
}
if ($file_ext == "mp3") {
header('Content-Disposition: attachment; filename="voicemail.mp3"');
}
}
else {
$file_ext = substr($file_path, -3);
if ($file_ext == "wav") {
header("Content-Type: audio/x-wav");
}
if ($file_ext == "mp3") {
header("Content-Type: audio/mp3");
}
}
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // date in the past
header("Content-Length: " . filesize($file_path));
fpassthru($fd);
}
return;
}
}
//get the includes
require "includes/require.php";
require_once "includes/header.php";
require_once "includes/paging.php";
//get the http values and set them as variables
if (isset($_GET["order_by"])) {
$order_by = check_str($_GET["order_by"]);
$order = check_str($_GET["order"]);
}
else {
$order_by = '';
$order = '';
}
//pdo voicemail database connection
include "includes/lib_pdo_vm.php";
//show the content
echo "<div align='center'>";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
echo "<tr class='border'>\n";
echo " <td align=\"center\">\n";
echo " <br>";
echo "<table width='100%' border='0'>\n";
echo "<tr>\n";
echo "<td align='left' width='50%' nowrap><b>".$text['title']."</b></td>\n";
echo "<td align='left' width='50%' align='right'>&nbsp;</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td colspan='2' align='left'>\n";
echo "".$text['description']." \n";
if (if_group("admin") || if_group("superadmin")) {
echo "".$text['description-2']." \n";
echo "".$text['description-3']." \n";
echo " <br />\n";
echo " <br />\n";
}
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
$tmp_msg_header = '';
$tmp_msg_header .= "<tr>\n";
$tmp_msg_header .= th_order_by('created_epoch', $text['label-created'], $order_by, $order);
//$tmp_msg_header .= th_order_by('read_epoch', 'Read', $order_by, $order);
//$tmp_msg_header .= th_order_by('username', 'Ext', $order_by, $order);
//$tmp_msg_header .= th_order_by('domain', 'Domain', $order_by, $order);
//$tmp_msg_header .= th_order_by('uuid', 'UUID', $order_by, $order);
$tmp_msg_header .= th_order_by('cid_name', $text['label-caller-id-name'], $order_by, $order);
$tmp_msg_header .= th_order_by('cid_number', $text['label-caller-id-number'], $order_by, $order);
$tmp_msg_header .= th_order_by('in_folder', $text['label-folder'], $order_by, $order);
//$tmp_msg_header .= "<th>Options</th>\n";
//$tmp_msg_header .= th_order_by('file_path', 'File Path', $order_by, $order);
$tmp_msg_header .= th_order_by('message_len', $text['label-length'], $order_by, $order);
$tmp_msg_header .= "<th nowrap>".$text['label-size']."</th>\n";
//$tmp_msg_header .= th_order_by('flags', 'Flags', $order_by, $order);
//$tmp_msg_header .= th_order_by('read_flags', 'Read Flags', $order_by, $order);
$tmp_msg_header .= "<td align='right' width='22'>\n";
//$tmp_msg_header .= " <input type='button' class='btn' name='' alt='add' onclick=\"window.location='voicemail_msgs_edit.php'\" value='+'>\n";
$tmp_msg_header .= "</td>\n";
$tmp_msg_header .= "<tr>\n";
echo "<div align='center'>\n";
echo "<table width='100%' border='0' cellpadding='2' cellspacing='0'>\n";
if (!isset($_SESSION['user']['extension'])) {
echo $tmp_msg_header;
}
else {
foreach ($_SESSION['user']['extension'] as $value) {
if (strlen($value['user']) > 0) {
echo "<tr><td colspan='5' align='left'>\n";
echo " <br />\n";
echo " <b>".$text['table-mailbox'].": ".$value['user']."</b>&nbsp;\n";
echo " \n";
echo "</td>\n";
echo "<td valign='bottom' align='right'>\n";
echo " <input type='button' class='btn' name='' alt='greetings' onclick=\"window.location='".PROJECT_PATH."/app/voicemail_greetings/voicemail_greetings.php?id=".$value['user']."'\" value='".$text['button-greetings']."'>\n";
echo " <input type='button' class='btn' name='' alt='settings' onclick=\"window.location='voicemail_msgs_password.php?id=".$value['extension_uuid']."'\" value='".$text['button-settings']."'>\n";
echo "</td>\n";
echo "</tr>\n";
echo $tmp_msg_header;
$sql = "select * from voicemail_msgs ";
if (count($_SESSION['domains']) > 1) {
$sql .= "where domain = '".$_SESSION['domain_name']."' ";
$sql .= "and username = '".$value['user']."' ";
}
else {
$sql .= "where username = '".$value['user']."' ";
}
if (isset($order_by)) {
if (strlen($order_by) > 0) {
$sql .= "order by $order_by $order ";
}
}
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
unset ($prep_statement, $sql);
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
if ($result_count > 0) {
$prevextension = '';
foreach($result as $row) {
$extension_uuid = '';
foreach($_SESSION['user']['extension'] as $value) {
if ($value['user'] == $row['username']) {
$extension_uuid = $value['extension_uuid'];
break;
}
}
$tmp_filesize = filesize($row['file_path']);
$tmp_filesize = byte_convert($tmp_filesize);
$file_ext = substr($row['file_path'], -3);
$tmp_message_len = $row['message_len'];
if ($tmp_message_len < 60 ) {
$tmp_message_len = $tmp_message_len. " sec";
}
else {
$tmp_message_len = round(($tmp_message_len/60), 2). " min";
}
if ($row['read_epoch'] == 0) {
$style = "style=\"font-weight: bold;\"";
}
else {
$style = "";
}
echo "<tr >\n";
echo " <td valign='top' class='".$row_style[$c]."' $style nowrap=\"nowrap\">";
echo date("j M Y g:i a",$row['created_epoch']);
echo "</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row['read_epoch']."</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row['username']."</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row['domain']."</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row['uuid']."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."' $style nowrap=\"nowrap\">".$row['cid_name']."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."' $style>".$row['cid_number']."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."' $style>".$row['in_folder']."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."' $style>\n";
echo " <a href=\"javascript:void(0);\" onclick=\"window.open('voicemail_msgs_play.php?a=download&type=vm&uuid=".$row['uuid']."&id=".$row['username']."&ext=".$file_ext."&desc=".urlencode($row['cid_name']." ".$row['cid_number'])."', 'play',' width=420,height=40,menubar=no,status=no,toolbar=no')\">\n";
echo " $tmp_message_len";
echo " </a>";
echo " </td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[flags]."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[read_flags]."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."' $style nowrap=\"nowrap\">";
echo " <a href=\"voicemail_msgs.php?a=download&type=vm&t=bin&uuid=".$row['uuid']."\">\n";
echo $tmp_filesize;
echo " </a>";
echo "</td>\n";
echo " <td valign='top' align='center' nowrap>\n";
//echo " <a href='voicemail_msgs_edit.php?id=".$row[voicemail_msg_id]."' alt='edit'>$v_link_label_edit</a>\n";
echo " &nbsp;&nbsp;<a href='voicemail_msgs_delete.php?uuid=".$row['uuid']."&id=".$row['username']."' alt='delete message' title='delete message' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>\n";
echo " </td>\n";
echo "</tr>\n";
$prevextension = $row['username'];
unset($tmp_message_len, $tmp_filesize);
if ($c==0) { $c=1; } else { $c=0; }
} //end foreach
unset($sql, $result, $row_count);
} //end if results
}
}
}
echo "</table>";
echo "</div>";
echo "<br><br>";
echo "<br><br>";
echo "</td>";
echo "</tr>";
echo "</table>";
echo "</div>";
echo "<br><br>";
//show the footer
require "includes/require.php";
require_once "includes/footer.php";
?>

View File

@@ -1,96 +0,0 @@
<?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>
*/
include "root.php";
require "includes/require.php";
require_once "includes/checkauth.php";
require_once "app_languages.php";
if (permission_exists('voicemail_delete')) {
//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']];
}
//get the http get values
if (count($_GET) > 0) {
$uuid = $_GET["uuid"];
$id = $_GET["id"];
}
//get the domain from the domains array
$domain_name = $_SESSION['domains'][$domain_uuid]['domain_name'];
//create the event socket connection
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if (!$fp) {
$msg = "<div align='center'>".$text['confirm-socket']."<br /></div>";
}
//show the error message or show the content
if (strlen($msg) > 0) {
require_once "includes/header.php";
echo "<div align='center'>\n";
echo " <table width='40%'>\n";
echo " <tr>\n";
echo " <th align='left'>".$text['label-message']."</th>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td class='row_style1'><strong>$msg</strong></td>\n";
echo " </tr>\n";
echo " </table>\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
}
// delete the voicemail
$cmd = "api vm_delete " .$id."@".$domain_name." ".$uuid;
$response = trim(event_socket_request($fp, $cmd));
echo $xml_response;
if (strcmp($response,"+OK")==0) {
$msg = "".$text['confirm-complete']."";
}
else {
$msg = "".$text['confirm-failed']."";
}
//redirect the user
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=voicemail_msgs.php\">\n";
echo "<div align='center'>\n";
echo "".$text['confirm-delete-2']." $msg\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
?>

View File

@@ -1,428 +0,0 @@
<?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>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (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']];
}
//set the action as an add or update
if (isset($_REQUEST["id"])) {
$action = "update";
$extension_uuid = check_str($_REQUEST["id"]);
}
//deny the user if not assigned to this mailboxes
$sql = "";
$sql .= " select * from v_extensions ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and extension_uuid = '$extension_uuid'";
if (!(if_group("admin") || if_group("superadmin"))) {
if (count($_SESSION['user']['extension']) > 0) {
$sql .= "and (";
$x = 0;
foreach($_SESSION['user']['extension'] as $row) {
if ($x > 0) { $sql .= "or "; }
$sql .= "extension = '".$row['user']."' ";
$x++;
}
$sql .= ")";
}
else {
//hide any results when a user has not been assigned an extension
$sql .= "and extension = 'disabled' ";
}
}
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$v_mailboxes = '';
$x = 0;
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$x++;
}
unset ($prep_statement);
if ($x == 0) {
//user has not been assigned to this account
echo "access denied";
exit;
}
//get the http post variables
if (count($_POST)>0) {
//$domain_uuid = check_str($_POST["domain_uuid"]);
$extension = check_str($_POST["extension"]);
$password = check_str($_POST["password"]);
$mailbox = check_str($_POST["mailbox"]);
$vm_password = check_str($_POST["vm_password"]);
$accountcode = check_str($_POST["accountcode"]);
$effective_caller_id_name = check_str($_POST["effective_caller_id_name"]);
$effective_caller_id_number = check_str($_POST["effective_caller_id_number"]);
$outbound_caller_id_name = check_str($_POST["outbound_caller_id_name"]);
$outbound_caller_id_number = check_str($_POST["outbound_caller_id_number"]);
$vm_enabled = check_str($_POST["vm_enabled"]);
$vm_mailto = check_str($_POST["vm_mailto"]);
$vm_attach_file = check_str($_POST["vm_attach_file"]);
$vm_keep_local_after_email = check_str($_POST["vm_keep_local_after_email"]);
$user_context = check_str($_POST["user_context"]);
$call_group = check_str($_POST["call_group"]);
$auth_acl = check_str($_POST["auth_acl"]);
$cidr = check_str($_POST["cidr"]);
$sip_force_contact = check_str($_POST["sip_force_contact"]);
$enabled = check_str($_POST["enabled"]);
$description = check_str($_POST["description"]);
}
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$msg = '';
if ($action == "update") {
$extension_uuid = check_str($_POST["extension_uuid"]);
}
//check for all required data
//if (strlen($domain_uuid) == 0) { $msg .= "Please provide: domain_uuid<br>\n"; }
//if (strlen($extension) == 0) { $msg .= "Please provide: Extension<br>\n"; }
//if (strlen($password) == 0) { $msg .= "Please provide: Password<br>\n"; }
//if (strlen($mailbox) == 0) { $msg .= "Please provide: Mailbox<br>\n"; }
if (strlen($vm_password) == 0) { $msg .= "".$text['confirm-password']."<br>\n"; }
//if (strlen($accountcode) == 0) { $msg .= "Please provide: Account Code<br>\n"; }
//if (strlen($effective_caller_id_name) == 0) { $msg .= "Please provide: Effective Caller ID Name<br>\n"; }
//if (strlen($effective_caller_id_number) == 0) { $msg .= "Please provide: Effective Caller ID Number<br>\n"; }
//if (strlen($outbound_caller_id_name) == 0) { $msg .= "Please provide: Outbound Caller ID Name<br>\n"; }
//if (strlen($outbound_caller_id_number) == 0) { $msg .= "Please provide: Outbound Caller ID Number<br>\n"; }
//if (strlen($vm_enabled) == 0) { $msg .= "Please provide: Voicemail Enabled<br>\n"; }
//if (strlen($vm_mailto) == 0) { $msg .= "Please provide: Voicemail Mail To<br>\n"; }
//if (strlen($vm_attach_file) == 0) { $msg .= "Please provide: Voicemail Attach File<br>\n"; }
//if (strlen($vm_keep_local_after_email) == 0) { $msg .= "Please provide: VM Keep Local After Email<br>\n"; }
//if (strlen($user_context) == 0) { $msg .= "Please provide: User Context<br>\n"; }
//if (strlen($call_group) == 0) { $msg .= "Please provide: Call Group<br>\n"; }
//if (strlen($auth_acl) == 0) { $msg .= "Please provide: Auth ACL<br>\n"; }
//if (strlen($cidr) == 0) { $msg .= "Please provide: CIDR<br>\n"; }
//if (strlen($sip_force_contact) == 0) { $msg .= "Please provide: SIP Force Contact<br>\n"; }
//if (strlen($enabled) == 0) { $msg .= "Please provide: Enabled<br>\n"; }
//if (strlen($description) == 0) { $msg .= "Please provide: Description<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "includes/header.php";
require_once "includes/persistformvar.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 "includes/footer.php";
return;
}
//add or update the database
if ($_POST["persistformvar"] != "true") {
if ($action == "update") {
$sql = "update v_extensions set ";
//$sql .= "extension = '$extension', ";
//$sql .= "password = '$password', ";
//$sql .= "mailbox = '$mailbox', ";
$sql .= "vm_password = '#$vm_password', ";
//$sql .= "accountcode = '$accountcode', ";
//$sql .= "effective_caller_id_name = '$effective_caller_id_name', ";
//$sql .= "effective_caller_id_number = '$effective_caller_id_number', ";
//$sql .= "outbound_caller_id_name = '$outbound_caller_id_name', ";
//$sql .= "outbound_caller_id_number = '$outbound_caller_id_number', ";
$sql .= "vm_enabled = '$vm_enabled', ";
$sql .= "vm_mailto = '$vm_mailto', ";
$sql .= "vm_attach_file = '$vm_attach_file', ";
$sql .= "vm_keep_local_after_email = '$vm_keep_local_after_email' ";
//$sql .= "user_context = '$user_context', ";
//$sql .= "call_group = '$call_group', ";
//$sql .= "auth_acl = '$auth_acl', ";
//$sql .= "cidr = '$cidr', ";
//$sql .= "sip_force_contact = '$sip_force_contact', ";
//$sql .= "enabled = '$enabled', ";
//$sql .= "description = '$description' ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and extension_uuid = '$extension_uuid'";
$db->exec(check_sql($sql));
unset($sql);
//syncrhonize configuration
save_extension_xml();
//apply settings reminder
$_SESSION["reload_xml"] = true;
//redirect the user
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=voicemail_msgs.php\">\n";
echo "<div align='center'>\n";
echo "".$text['confirm-update']."\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
} //if ($action == "update")
} //if ($_POST["persistformvar"] != "true")
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
//pre-populate the form
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
$extension_uuid = $_GET["id"];
$sql = "";
$sql .= "select * from v_extensions ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and extension_uuid = '$extension_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$domain_uuid = $row["domain_uuid"];
$extension = $row["extension"];
$password = $row["password"];
$mailbox = $row["mailbox"];
$vm_password = $row["vm_password"];
$vm_password = str_replace("#", "", $vm_password); //preserves leading zeros
$accountcode = $row["accountcode"];
$effective_caller_id_name = $row["effective_caller_id_name"];
$effective_caller_id_number = $row["effective_caller_id_number"];
$outbound_caller_id_name = $row["outbound_caller_id_name"];
$outbound_caller_id_number = $row["outbound_caller_id_number"];
$vm_enabled = $row["vm_enabled"];
$vm_mailto = $row["vm_mailto"];
$vm_attach_file = $row["vm_attach_file"];
$vm_keep_local_after_email = $row["vm_keep_local_after_email"];
$user_context = $row["user_context"];
$call_group = $row["call_group"];
$auth_acl = $row["auth_acl"];
$cidr = $row["cidr"];
$sip_force_contact = $row["sip_force_contact"];
$enabled = $row["enabled"];
$description = $row["description"];
break; //limit to 1 row
}
unset ($prep_statement);
}
//show the header
require_once "includes/header.php";
//show the content
echo "<script type=\"text/javascript\" language=\"JavaScript\">\n";
echo "\n";
echo "function enable_change(enable_over) {\n";
echo " var endis;\n";
echo " endis = !(document.iform.enable.checked || enable_over);\n";
echo " document.iform.range_from.disabled = endis;\n";
echo " document.iform.range_to.disabled = endis;\n";
echo "}\n";
echo "\n";
echo "function show_advanced_config() {\n";
echo " document.getElementById(\"show_advanced_box\").innerHTML='';\n";
echo " aodiv = document.getElementById('show_advanced');\n";
echo " aodiv.style.display = \"block\";\n";
echo "}\n";
echo "\n";
echo "function hide_advanced_config() {\n";
echo " document.getElementById(\"show_advanced_box\").innerHTML='';\n";
echo " aodiv = document.getElementById('show_advanced');\n";
echo " aodiv.style.display = \"block\";\n";
echo "}\n";
echo "</script>";
echo "<div align='center'>";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
echo "<tr class=''>\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";
echo " <td width='30%' nowrap valign='top' align='left'><b>".$text['label-voicemail']." $extension</b></td>\n";
echo " <td width='70%' align='right' valign='top'><input type='button' class='btn' name='' alt='back' onclick=\"window.location='voicemail_msgs.php'\" value='".$text['button-back']."'><br /><br /></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " ".$text['label-password'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='password' name='vm_password' id='password' onfocus=\"document.getElementById('show_password').innerHTML = 'Password: '+document.getElementById('password').value;\" autocomplete='off' maxlength='50' value=\"$vm_password\">\n";
echo "<br />\n";
echo "<span onclick=\"document.getElementById('show_password').innerHTML = ''\">".$text['description-password']." </span><span id='show_password'></span>\n";
echo "</td>\n";
echo "</tr>\n";
//echo "<tr>\n";
//echo "<td class='vncell' valign='top' align='left' nowrap>\n";
//echo " Effective Caller ID Name:\n";
//echo "</td>\n";
//echo "<td class='vtable' align='left'>\n";
//echo " <input class='formfld' type='text' name='effective_caller_id_name' maxlength='255' value=\"$effective_caller_id_name\">\n";
//echo "<br />\n";
//echo "Enter the effective caller id name here.\n";
//echo "</td>\n";
//echo "</tr>\n";
//echo "<tr>\n";
//echo "<td class='vncell' valign='top' align='left' nowrap>\n";
//echo " Effective Caller ID Number:\n";
//echo "</td>\n";
//echo "<td class='vtable' align='left'>\n";
//echo " <input class='formfld' type='text' name='effective_caller_id_number' maxlength='255' value=\"$effective_caller_id_number\">\n";
//echo "<br />\n";
//echo "Enter the effective caller id number here.\n";
//echo "</td>\n";
//echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " ".$text['label-enabled'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='vm_enabled'>\n";
echo " <option value=''></option>\n";
if ($vm_enabled == "true") {
echo " <option value='true' selected='selected'>true</option>\n";
}
else {
echo " <option value='true'>true</option>\n";
}
if ($vm_enabled == "false") {
echo " <option value='false' selected='selected'>false</option>\n";
}
else {
echo " <option value='false'>false</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo " ".$text['description-voicemail-enable']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " ".$text['label-mail'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='vm_mailto' maxlength='255' value=\"$vm_mailto\">\n";
echo "<br />\n";
echo "".$text['description-email']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " ".$text['label-attach'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='vm_attach_file'>\n";
echo " <option value=''></option>\n";
if ($vm_attach_file == "true") {
echo " <option value='true' selected='selected' >true</option>\n";
}
else {
echo " <option value='true'>true</option>\n";
}
if ($vm_attach_file == "false") {
echo " <option value='false' selected='selected' >false</option>\n";
}
else {
echo " <option value='false'>false</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo "".$text['description-email-attachment']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " ".$text['label-vm'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='vm_keep_local_after_email'>\n";
echo " <option value=''></option>\n";
if ($vm_keep_local_after_email == "true") {
echo " <option value='true' selected='selected' >true</option>\n";
}
else {
echo " <option value='true'>true</option>\n";
}
if ($vm_keep_local_after_email == "false") {
echo " <option value='false' selected='selected' >false</option>\n";
}
else {
echo " <option value='false'>false</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo "".$text['description-keep-local']." \n";
echo "</td>\n";
echo "</tr>\n";
//echo "<tr>\n";
//echo "<td class='vncell' valign='top' align='left' nowrap>\n";
//echo " Description:\n";
//echo "</td>\n";
//echo "<td class='vtable' align='left'>\n";
//echo " <textarea class='formfld' name='description' rows='4'>$description</textarea>\n";
//echo "<br />\n";
//echo "\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='extension_uuid' value='$extension_uuid'>\n";
}
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>";
//show the footer
require_once "includes/footer.php";
?>

View File

@@ -1,118 +0,0 @@
<?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>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('voicemail_view')) {
//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']];
}
//get the http get values
$uuid = $_GET['uuid'];
$file_ext = $_GET['ext'];
$type = $_GET['type']; //vm
$desc = $_GET['desc'];
$id = $_GET['id'];
//get the domain from the domains array
$domain_name = $_SESSION['domains'][$domain_uuid]['domain_name'];
//create the event socket connection
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if (!$fp) {
$msg = "<div align='center'>".$text['confirm-socket']."<br /></div>";
}
//show the error message or show the content
if (strlen($msg) > 0) {
require_once "includes/header.php";
echo "<div align='center'>\n";
echo " <table width='40%'>\n";
echo " <tr>\n";
echo " <th align='left'>".$text['label-message']."</th>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td class='row_style1'><strong>$msg</strong></td>\n";
echo " </tr>\n";
echo " </table>\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
}
?>
<html>
<head>
</head>
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align='center'>
<b>voicemail: <?php echo$desc?></b>
</td>
</tr>
<tr>
<td align='center'>
<?php
//mark voicemail as read
$cmd = "api vm_read " .$id."@".$domain_name." read ".$uuid;
$response = trim(event_socket_request($fp, $cmd));
if (strcmp($response,"+OK")==0) {
$msg = "Complete";
}
else {
$msg = "Failed";
}
//embed html tag to play the wav file
if ($file_ext == "wav") {
echo "<embed src=\"voicemail_msgs.php?a=download&type=".$type."&uuid=".$uuid."\" autostart=true width=200 height=40 name=\"sound".$uuid."\" enablejavascript=\"true\">\n";
}
//object html tag to add flash player that can play the mp3 file
if ($file_ext == "mp3") {
echo "<object type=\"application/x-shockwave-flash\" width=\"400\" height=\"17\" data=\"slim.swf?autoplay=true&song_title=".urlencode($uuid)."&song_url=".urlencode(PROJECT_PATH."/voicemail_msgs.php?a=download&type=".$type."&uuid=".$uuid)."\">\n";
echo "<param name=\"movie\" value=\"slim.swf?autoplay=true&song_url=".urlencode(PROJECT_PATH."/voicemail_msgs.php?a=download&type=".$type."&uuid=".$uuid)."\" />\n";
echo "<param name=\"quality\" value=\"high\"/>\n";
echo "<param name=\"bgcolor\" value=\"#E6E6E6\"/>\n";
echo "</object>\n";
}
?>
</td>
</tr>
</table>
</body>
</html>