diff --git a/app/voicemails/app_languages.php b/app/voicemails/app_languages.php
index 9b29022eca..6b936dd5c6 100644
--- a/app/voicemails/app_languages.php
+++ b/app/voicemails/app_languages.php
@@ -941,25 +941,25 @@ $text['label-destination']['ru-ru'] = "Место назначения";
$text['label-destination']['sv-se'] = "Destination";
$text['label-destination']['uk-ua'] = "Номер";
-$text['label-created_epoch']['en-us'] = "Created";
-$text['label-created_epoch']['ar-eg'] = "";
-$text['label-created_epoch']['de-at'] = "Erstellt"; //copied from de-de
-$text['label-created_epoch']['de-ch'] = "Erstellt"; //copied from de-de
-$text['label-created_epoch']['de-de'] = "Erstellt";
-$text['label-created_epoch']['es-cl'] = "Creación";
-$text['label-created_epoch']['es-mx'] = "Creación"; //copied from es-cl
-$text['label-created_epoch']['fr-ca'] = "Créé"; //copied from fr-fr
-$text['label-created_epoch']['fr-fr'] = "Créé";
-$text['label-created_epoch']['he-il'] = "נוצר";
-$text['label-created_epoch']['it-it'] = "Creato";
-$text['label-created_epoch']['nl-nl'] = "Gemaakt";
-$text['label-created_epoch']['pl-pl'] = "Stworzono";
-$text['label-created_epoch']['pt-br'] = "Criado";
-$text['label-created_epoch']['pt-pt'] = "Criada";
-$text['label-created_epoch']['ro-ro'] = "";
-$text['label-created_epoch']['ru-ru'] = "Создано";
-$text['label-created_epoch']['sv-se'] = "Skapad";
-$text['label-created_epoch']['uk-ua'] = "Створено";
+$text['label-received']['en-us'] = "Received";
+$text['label-received']['ar-eg'] = "";
+$text['label-received']['de-at'] = "Erstellt"; //copied from de-de
+$text['label-received']['de-ch'] = "Erstellt"; //copied from de-de
+$text['label-received']['de-de'] = "Erstellt";
+$text['label-received']['es-cl'] = "Creación";
+$text['label-received']['es-mx'] = "Creación"; //copied from es-cl
+$text['label-received']['fr-ca'] = "Créé"; //copied from fr-fr
+$text['label-received']['fr-fr'] = "Créé";
+$text['label-received']['he-il'] = "נוצר";
+$text['label-received']['it-it'] = "Creato";
+$text['label-received']['nl-nl'] = "Gemaakt";
+$text['label-received']['pl-pl'] = "Stworzono";
+$text['label-received']['pt-br'] = "Criado";
+$text['label-received']['pt-pt'] = "Criada";
+$text['label-received']['ro-ro'] = "";
+$text['label-received']['ru-ru'] = "Создано";
+$text['label-received']['sv-se'] = "Skapad";
+$text['label-received']['uk-ua'] = "Створено";
$text['label-count']['en-us'] = "Count";
$text['label-count']['ar-eg'] = "";
diff --git a/app/voicemails/resources/classes/voicemail.php b/app/voicemails/resources/classes/voicemail.php
index f7365db85d..a3b43a00af 100644
--- a/app/voicemails/resources/classes/voicemail.php
+++ b/app/voicemails/resources/classes/voicemail.php
@@ -245,15 +245,11 @@
$row['file_size'] = filesize($row['file_path']);
$row['file_size_label'] = byte_convert($row['file_size']);
$row['file_ext'] = substr($row['file_path'], -3);
-
- $message_length = $row['message_length'];
- if ($message_length < 60 ) {
- $message_length = $message_length. " sec";
- }
- else {
- $message_length = round(($message_length/60), 2). " min";
- }
- $row['message_length_label'] = $message_length;
+
+ $message_minutes = floor($row['message_length'] / 60);
+ $message_seconds = $row['message_length'] % 60;
+ //use International System of Units (SI) - Source: https://en.wikipedia.org/wiki/International_System_of_Units
+ $row['message_length_label'] = ($message_minutes > 0 ? $message_minutes.' min' : null).($message_seconds > 0 ? ' '.$message_seconds.' s' : null);
$row['created_date'] = date("j M Y g:i a",$row['created_epoch']);
}
}
diff --git a/app/voicemails/voicemail_edit.php b/app/voicemails/voicemail_edit.php
index 6c8ab96d96..5eb8b7b63e 100644
--- a/app/voicemails/voicemail_edit.php
+++ b/app/voicemails/voicemail_edit.php
@@ -588,7 +588,8 @@
echo "\n";
echo "
\n";
echo " \n";
diff --git a/app/voicemails/voicemail_messages.php b/app/voicemails/voicemail_messages.php
index a2441f7cc6..00e2eee551 100644
--- a/app/voicemails/voicemail_messages.php
+++ b/app/voicemails/voicemail_messages.php
@@ -17,7 +17,7 @@
The Initial Developer of the Original Code is
Mark J Crane
- Portions created by the Initial Developer are Copyright (C) 2008-2018
+ Portions created by the Initial Developer are Copyright (C) 2008-2019
the Initial Developer. All Rights Reserved.
Contributor(s):
@@ -27,48 +27,133 @@
//includes
require_once "root.php";
require_once "resources/require.php";
-
-//check permissions
- if (!($_REQUEST["action"] == "download" && $_REQUEST["src"] == "email")) {
- require_once "resources/check_auth.php";
- if (permission_exists('voicemail_message_view')) {
- //access granted
- }
- else {
- echo "access denied";
- exit;
- }
- }
-
-//add multi-lingual support
- $language = new text;
- $text = $language->get();
+ require_once "resources/check_auth.php";
+ require_once "resources/paging.php";
//set the voicemail_uuid
if (is_uuid($_REQUEST["id"])) {
$voicemail_uuid = $_REQUEST["id"];
}
-//required class
- require_once "app/voicemails/resources/classes/voicemail.php";
-
//download the message
- if ($_REQUEST["action"] == "download") {
- $voicemail_message_uuid = $_REQUEST["uuid"];
- $voicemail_id = $_REQUEST["id"];
- $voicemail_uuid = $_REQUEST["voicemail_uuid"];
- if (is_uuid($voicemail_message_uuid) && $voicemail_id != '' && is_uuid($voicemail_uuid)) {
- $voicemail = new voicemail;
- $voicemail->domain_uuid = $_SESSION['domain_uuid'];
- $voicemail->voicemail_id = $voicemail_id;
- $voicemail->voicemail_uuid = $voicemail_uuid;
- $voicemail->voicemail_message_uuid = $voicemail_message_uuid;
- $result = $voicemail->message_download();
- unset($voicemail);
- }
+ if (
+ $_REQUEST["action"] == "download"
+ && is_numeric($_REQUEST["id"])
+ && is_uuid($_REQUEST["uuid"])
+ && is_uuid($_REQUEST["voicemail_uuid"])
+ ) {
+ $voicemail = new voicemail;
+ $voicemail->domain_uuid = $_SESSION['domain_uuid'];
+ $voicemail->voicemail_id = $_REQUEST["id"];
+ $voicemail->voicemail_uuid = $_REQUEST["voicemail_uuid"];
+ $voicemail->voicemail_message_uuid = $_REQUEST["uuid"];
+ $result = $voicemail->message_download();
+ unset($voicemail);
exit;
}
+//check permissions
+ if (permission_exists('voicemail_message_view')) {
+ //access granted
+ }
+ else {
+ echo "access denied";
+ exit;
+ }
+
+//get the http post data
+ if (is_array($_POST['voicemail_messages'])) {
+ $action = $_POST['action'];
+ $voicemail_messages = $_POST['voicemail_messages'];
+ }
+
+//process the http post data by action
+ if ($action != '' && is_array($voicemail_messages) && @sizeof($voicemail_messages) != 0) {
+
+ //set the referrer
+ $http_referer = parse_url($_SERVER["HTTP_REFERER"]);
+ $referer_path = $http_referer['path'];
+ $referer_query = $http_referer['query'];
+
+ //validate the token
+ $token = new token;
+ if (!$token->validate($_SERVER['PHP_SELF'])) {
+ message::add($text['message-invalid_token'],'negative');
+ if ($referer_path == PROJECT_PATH."/app/voicemails/voicemail_messages.php") {
+ header('Location: voicemail_messages.php?'.$referer_query);
+ }
+ else {
+ header('Location: voicemails.php');
+ }
+ exit;
+ }
+
+ //handle action
+ switch ($action) {
+ case 'toggle':
+ if (is_array($voicemail_messages) && @sizeof($voicemail_messages) != 0) {
+ $messages_toggled = 0;
+ foreach ($voicemail_messages as $voicemail_message) {
+ if ($voicemail_message['checked'] == 'true' && is_uuid($voicemail_message['uuid']) && is_uuid($voicemail_message['voicemail_uuid'])) {
+ //delete voicemail message
+ $voicemail = new voicemail;
+ $voicemail->db = $db;
+ $voicemail->domain_uuid = $_SESSION['domain_uuid'];
+ $voicemail->voicemail_uuid = $voicemail_message['voicemail_uuid'];
+ $voicemail->voicemail_message_uuid = $voicemail_message['uuid'];
+ $voicemail->message_toggle();
+ unset($voicemail);
+ //increment counter
+ $messages_toggled++;
+ }
+ }
+ //set message
+ if ($messages_toggled != 0) {
+ message::add($text['message-toggle'].': '.$messages_toggled);
+ }
+ }
+ break;
+ case 'delete':
+ if (permission_exists('voicemail_message_delete')) {
+ if (is_array($voicemail_messages) && @sizeof($voicemail_messages) != 0) {
+ $messages_deleted = 0;
+ foreach ($voicemail_messages as $voicemail_message) {
+ if ($voicemail_message['checked'] == 'true' && is_uuid($voicemail_message['uuid']) && is_uuid($voicemail_message['voicemail_uuid'])) {
+ //delete voicemail message
+ $voicemail = new voicemail;
+ $voicemail->db = $db;
+ $voicemail->domain_uuid = $_SESSION['domain_uuid'];
+ $voicemail->voicemail_uuid = $voicemail_message['voicemail_uuid'];
+ $voicemail->voicemail_message_uuid = $voicemail_message['uuid'];
+ $voicemail->message_delete();
+ unset($voicemail);
+ //increment counter
+ $messages_deleted++;
+ }
+ }
+ //set message
+ if ($messages_deleted != 0) {
+ message::add($text['message-delete'].': '.$messages_deleted);
+ }
+ }
+ }
+ break;
+ }
+
+ //redirect the user
+ if ($referer_path == PROJECT_PATH."/app/voicemails/voicemail_messages.php") {
+ header('Location: voicemail_messages.php?'.$referer_query);
+ }
+ else {
+ header('Location: voicemails.php');
+ }
+ exit;
+ }
+
+//add multi-lingual support
+ $language = new text;
+ $text = $language->get();
+
//get the html values and set them as variables
$order_by = $_GET["order_by"];
$order = $_GET["order"];
@@ -81,136 +166,161 @@
$vm->order = $order;
$voicemails = $vm->messages();
+//count messages
+ $new_messages = 0;
+ if (is_array($voicemails) && @sizeof($voicemails) != 0) {
+ foreach ($voicemails as $voicemail) {
+ if (is_array($voicemail['messages'])) {
+ $num_rows += sizeof($voicemail['messages']);
+ foreach ($voicemail['messages'] as $message) {
+ if ($message['message_status'] != 'saved') {
+ $new_messages++;
+ }
+ }
+ }
+ }
+ }
+
+//create token
+ $object = new token;
+ $token = $object->create($_SERVER['PHP_SELF']);
+
//additional includes
$document['title'] = $text['title-voicemail_messages'];
require_once "resources/header.php";
- require_once "resources/paging.php";
//show the content
- echo "".$text['title-voicemail_messages']."";
- echo "
";
- echo $text['description-voicemail_message'];
- echo "
";
+ echo "\n";
+ echo " ".$text['title-voicemail_messages']." (".$num_rows.") \n";
+ echo " \n";
+ if ($num_rows > 0) {
+ echo button::create(['type'=>'button','label'=>$text['button-toggle'],'icon'=>$_SESSION['theme']['button_icon_toggle'],'collapse'=>'hide-xs','onclick'=>"if (confirm('".$text['confirm-toggle']."')) { list_action_set('toggle'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
+ }
+ if (permission_exists('voicemail_message_delete') && $num_rows) {
+ echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'collapse'=>'hide-xs','onclick'=>"if (confirm('".$text['confirm-delete']."')) { list_action_set('delete'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
+ }
+ echo " \n";
+ echo " \n";
+ echo " \n";
-//set the row style
- $c = 0;
- $row_style["0"] = "row_style0";
- $row_style["1"] = "row_style1";
+ echo $text['description-voicemail_message']."\n";
+ echo "
\n";
//loop through the voicemail messages
if (is_array($voicemails) && @sizeof($voicemails) != 0) {
- echo "\n";
}
else {
@@ -223,37 +333,21 @@
echo "";
}
-//check or uncheck all voicemail checkboxes
- if (is_array($vm_msg_ids) && sizeof($vm_msg_ids) > 0) {
- echo "\n";
- }
-
-//$(this).children('td:not(.tr_link_void)').css('font-weight','normal');
-?>
-
-
-
-\n";
+ echo " $(document).ready(function() {\n";
+ echo " $('.list-row').each(function(i,e) {\n";
+ echo " $(e).children('td:not(.checkbox,.no-link)').on('click',function() {\n";
+ echo " $(this).closest('tr').children('td').css('font-weight','normal');\n";
+ echo " });\n";
+ echo " $(e).children('td').children('button').on('click',function() {\n";
+ echo " $(this).closest('tr').children('td').css('font-weight','normal');\n";
+ echo " });\n";
+ echo " });\n";
+ echo " });\n";
+ echo "\n";
//include the footer
require_once "resources/footer.php";
-?>
+?>
\ No newline at end of file
|